﻿//  Function to call TellAFriend popup:
function popupTellAFriend(page) {
    var win = window.open('/Tellafriend.aspx?page=' + page, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=460,height=535');
}

//  Function to call TellAFriend English popup:
function popupTellAFriend_en(page) {
    var win = window.open('/Tellafriend_en.aspx?page=' + page, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=460,height=535');
}
//  Function to call Print Page popup:
function popupPrintpage(page) {
    var win = window.open('/Printpage.aspx?page=' + page, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=800,height=600');
}

//  Function to call Print Course popup:
function popupPrintcourse(page) {
    var win = window.open('/Printcourse.aspx?page=' + page, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=800,height=600');
}

//  Function to redirect page:
function redirectToPage(url) {
    window.location = url;
}

//  Function to resize banners 
//  Arguments: isSG - true when page is SG|academy Home - has banner in content column, all others have banner in left column
function resizeBanners(isSG) {
    var i = 1;
    if (isSG == true) {
        $("DIV.academyBannerBlock IMG").each(function() {
            if (screen.width < 1200) {
                if (this.width > 485) {
                    this.width = 485;
                }
            }
            else {
                if (this.width > 559) {
                    this.width = 559;
                }
            }
            i++;
        });
    }
    else {
        $("DIV#bannerBlok IMG").each(function() {
            if (this.width > 225) {
                this.width = 225;
            }
            i++;
        });
    }
}

//  Function to show Left Menu Submenu:
function showSubmenu(id) {
    submenuBlock = document.getElementById('submenu_' + id);
    submenuBlock.style.display = 'block';

    submenuHeader = document.getElementById('submenuHeader_' + id);
    submenuHeader.className = 'submenuItemOpen';
    submenuHeader.style.cursor = 'pointer';
    submenuHeader.title = 'Klik op het driehoekje om het submenu te verbergen';
}
//  Function to hide Left Menu Submenu:
function hideSubmenu(id) {
    submenuBlock = document.getElementById('submenu_' + id);
    submenuBlock.style.display = 'none';

    submenuHeader = document.getElementById('submenuHeader_' + id);
    submenuHeader.className = 'submenuItemClose';
    submenuHeader.style.cursor = 'default';
}

function moveOnMax(field, nextFieldID) {
    if (field.value.length >= field.maxLength) {
        document.getElementById(nextFieldID).focus();
    }
}
