﻿
var docid = gup('docid');
var Dmbtitre = ""; 
var Dmbdoccode = ""; 
var Dmbwidth = "";
var Dmbheight = "";


function DmbgetDocument(code1,titre1,height1,width1) {

    return "<div><div><a href=\"javascript:void(0);\" onclick=\"openwindow(\'http://brochures.tourismewallonie.be/pages/viewer.aspx?docname=" + code1 + "\');\"> <img src=\"http://viewer.dmbel.be/remote/getimage.aspx?doccode=" + code1 + "&dhei1=" + height1 + "&dwid1=" + width1 + " border=\"0\"></a></div><div><a style=\"text-decoration: none; color: black;\" href=\"javascript:void(0);\" onclick=\"openwindow(\'http://brochures.tourismewallonie.be/pages/viewer.aspx?docname=" + code1 + "\');\">" + titre1 + "</a></div> </div>";

}


function gup(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.href);
    if (results == null)
        return "";
    else
        return results[1];
}



//Viewer JS

function alertSize() {
    var myWidth = 0, myHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    window.alert('Width = ' + myWidth);
    window.alert('Height = ' + myHeight);
}

/****************************
function openViewer(url)
{
var left =0;
var top = 0; 	
var width = screen.width;
var height = screen.height;	
var winName = 'book'+Math.round(10000*Math.random());
window.open(url, winName, 'top='+top+',left='+left+',width='+width+',height='+height+',resizable=yes,location=no,menubar=no,status=no,scrollbars=no,menubar=no');
	
return false;
}

/********************************************************/

function getBrowserName() {

    if (navigator.userAgent.indexOf("Firefox") != -1) {
        return "firefox";
    }

    if (navigator.userAgent.indexOf("MSIE") != -1) {
        return "msie";
    }

}



function getUserLang() {
    //renvoie la langue definie dans les paramètres régionaux

    if (navigator.userAgent.indexOf("Firefox") != -1) {
        return (navigator.language).substr(0, 2);
    }
    else {
        if (navigator.userAgent.indexOf("MSIE") != -1) {
            return ((navigator.userLanguage).substr(0, 2));
        }

        else {
            return "en";
        }
    }
}

//****************************


function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
    var rv = -1; // Return value assumes failure.
    if (navigator.appName == 'Microsoft Internet Explorer') {
        var ua = navigator.userAgent;
        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(ua) != null)
            rv = parseFloat(RegExp.$1);
    }
    return rv;
}
function checkVersion() {
    var msg = "";
    var ver = getInternetExplorerVersion();

    if (ver > -1) {
        if (ver >= 7.0) {
            msg = ver; //msg = "You're using a recent copy of Internet Explorer."
        }
        else {
            msg = "Vous utilisez une vielle version d'Internet Explorer. Pour exploiter pleinement les fonctionnalités de ce site, veuillez installer la version 7.0 ou ultérieure d'Internet Explorer.";
            alert(msg);
        }

    }

}

//************************************

function openwindow(url) {
    var brows = getBrowserName();
    var lang = getUserLang();
    var fullUrl = url + "&screenH=" + screen.availHeight + "&screenW=" + screen.availWidth + "&browserName=" + brows + "&userLang=" + lang;
    var options = 'scrollbars=yes,resizable=yes,status=no,toolbar=no,menubar=no,location=no';
    options += ',width=' + screen.availWidth + ',height=' + screen.availHeight;
    options += ',screenX=0,screenY=0,top=0,left=0';
    var win = window.open(fullUrl, '', options);
    //win.focus();
    //win.moveTo(0, 0); 
    return false;
}

