
function GalleryPopup(url) {
    window.open(url,'GalleryPopup','width=520,height=490,scrollbars=0,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0').focus();
}

/* === Calendar ====================================================== */

function SwapCalendar(id, hiddenCtlId) {
    var calendarDiv = document.getElementById(id);
    if (calendarDiv.style.display == ""){
        calendarDiv.style.display = "none";
        document.getElementById(hiddenCtlId).value = "hide";
    }else{
        calendarDiv.style.display = "";
        document.getElementById(hiddenCtlId).value = "show";
    }
}

function ShowCalendar(id, hiddenCtlId) {
    document.getElementById(id).style.display = "";
    document.getElementById(hiddenCtlId).value = "show";
}

function HideCalendar(id, hiddenCtlId) {
    document.getElementById(id).style.display = "none";
    document.getElementById(hiddenCtlId).value = "hide";
}

function InitHideCalendar() {
}

/* === JS Session ==================================================== */

window.onload = function() {
    var sessionValues = document.getElementById('JsSessionValues');
    if (sessionValues.value != ""){
        // We have JS Session Values, so we start changing all <a>-Hyperlinks
        var areas = new Array("header", "leftContentArea", "mainContentArea");
        
        for (var j = 0; j < areas.length; j++){
            // Looping over the areas where we wanna replace the <a>-Hyperlinks
            
            var links = document.getElementById(areas[j]).getElementsByTagName('a');
            for (var i = 0; i < links.length; i++){
                // Looping over the <a>-Hyperlinks
                
                if (links[i].attributes['target'].value != '_blank' &&
                    links[i].attributes['href'].value.indexOf('mailto:') < 0 &&
                    (links[i].attributes['noJsSession'] == null ||
                    links[i].attributes['noJsSession'].value != 'true'))
                    links[i].attributes['href'].value = "javascript:Go('" + links[i].attributes['href'].value + "');";
            }
        }
        
        
    }
}

// DoJsSessionFormRedirect
function Go(url) {
    document.forms['JsSessionForm'].action = url;
    document.forms['JsSessionForm'].submit();
}