function openMediaGallery(BASEDIR, picturegalleryid, layout) {
  window.open(BASEDIR + "media_gallery/index.php?picturegalleryid=" + picturegalleryid + "&layout=" + layout, "MediaGallery_" + picturegalleryid, "menubar=no,scrollbars=no,toolbar=no,height=650,width=560");
}

function changePicture (picname, picobject) {
  window.document.images[picname].src = picobject.src;
}

function openParkplan(language) {
  window.open("http://195.135.166.98/parkplan/checkflash/check.html?" + language, "Parkplan", "menubar=no,scrollbars=no,toolbar=no,height=520,width=700");
}

function openPopup(BASEDIR, languageid) {
  window.open(BASEDIR + "popup.php?languageid=" + languageid, "Popup", "menubar=no,scrollbars=no,toolbar=no,height=330,width=450");
}

function getCenterX(windowHeight, windowWidth)
{
    var props,wwidth,wheight,thewindow;
    var iwidth=windowWidth;
    var iheight=windowHeight;

    var ns6 = (!document.all && document.getElementById);
    var ie4 = (document.all);
    var ns4 = (document.layers);

    if(ns6||ns4)
    {
        wwidth = innerWidth;
        wheight = innerHeight;
    }
    else if(ie4)
    {
        wwidth = document.body.clientWidth;
        wheight = document.body.clientHeight;
    }

    return (wwidth-iwidth)/2;
}

function getCenterY(windowHeight, windowWidth)
{
    var props,wwidth,wheight,thewindow;
    var iwidth=windowWidth;
    var iheight=windowHeight;

    var ns6 = (!document.all && document.getElementById);
    var ie4 = (document.all);
    var ns4 = (document.layers);

    if(ns6||ns4)
    {
        wwidth = innerWidth;
        wheight = innerHeight;
    }
    else if(ie4)
    {
        wwidth = document.body.clientWidth;
        wheight = document.body.clientHeight;
    }

    return (wheight-iheight)/2
}


function openRecommendPopup(BASEDIR, layout, siteurl) {

    var iwidth=438;
    var iheight=560;

    var x = getCenterX(iheight,iwidth);
    var y = getCenterY(iheight,iwidth);


    props="left="+x+",top="+y+",screenX="+x+",screenY="+y;

    props= props + ",width="+iwidth+",height="+iheight+",menubar=no,scrollbars=no,toolbar=no";


    window.open(BASEDIR + "recommend/recommend.php?siteurl=" + siteurl + "&layout=" + layout, "recommend", props);

}

function openReminderPopup(BASEDIR, timestamp, eventitemid, eventname, theme) {

    var iwidth=500;
    var iheight=275;

    var x = getCenterX(iheight,iwidth);
    var y = getCenterY(iheight,iwidth);


    props="left="+x+",top="+y+",screenX="+x+",screenY="+y;

    props= props + ",width="+iwidth+",height="+iheight+",menubar=no,scrollbars=no,toolbar=no";


    window.open(BASEDIR + "event_reminder.php?timestamp=" + timestamp + "&eventitemid=" + eventitemid + "&eventname=" + eventname + "&theme=" + theme, "reminder", props);

}

function openPressPopup(BASEDIR) {
  window.open("/presspopup.php", "PressPopup",
"menubar=no,scrollbars=no,toolbar=no,height=500,width=400");
}