
function openSubmenu(SubmenuName){

    document.getElementById('MainThemeIMGLeftHover').style.display='none';
    document.getElementById('PersonalistikaMenuTile').className='TitlePageMenuLight';
    //document.getElementById('PersonalistikaSubMenu').style.display='none';

    document.getElementById('MainThemeIMGRightHover').style.display='none';
    document.getElementById('VzdelavanieMenuTitle').className='TitlePageMenuLight';
    //document.getElementById('VzdelavanieSubMenu').style.display='none';

    if(SubmenuName=='personalistika'){
        document.getElementById('MainThemeIMGLeftHover').style.display='block';
        document.getElementById('PersonalistikaMenuTile').className='TitlePageMenuDark';
        //document.getElementById('PersonalistikaSubMenu').style.display='block';
    }

    if(SubmenuName=='vzdelavanie'){
        document.getElementById('MainThemeIMGRightHover').style.display='block';
        document.getElementById('VzdelavanieMenuTitle').className='TitlePageMenuDark';
        //document.getElementById('VzdelavanieSubMenu').style.display='block';
    }
}


function showBarNavigationBox(NavID){
    hideBarNavigationBox(1);
    hideBarNavigationBox(2);
    // hideBarNavigationBox(3);

    document.getElementById('BarNavigationBox'+NavID).style.display='block';
}

function hideBarNavigationBox(NavID){
    document.getElementById('BarNavigationBox'+NavID).style.display='none';
}

function resetLayout(){

    MyContentMargin = 10
    
    WindowHeight = document.body.offsetHeight;

    if(WindowHeight>550){
        
        if(document.getElementById('ContentBox')!=null){

            ContentBoxDIV = document.getElementById('ContentBox');
            ContentBoxBottomOffset = 205;
            ContentBoxDIV.style.height = (WindowHeight - ContentBoxBottomOffset)+'px';

        }

        if(document.getElementById('BottomNavigation')!=null){
            BottomNavigationDIV = document.getElementById('BottomNavigation');
            BottomNavigationBottomOffset = 40;
            BottomNavigationDIV.style.top = (WindowHeight - BottomNavigationBottomOffset)+'px';
        }

    }
}

function flipEventInfo(EventInfoID){

    if(document.getElementById('EIID-'+EventInfoID)){
        
        EventBlock =  document.getElementById('EIID-'+EventInfoID);

        if(EventBlock.isOpenBlock){
            EventBlock.style.display = 'none';
            EventBlock.isOpenBlock = false;
        } else {
            EventBlock.style.display = 'block';
            EventBlock.isOpenBlock = true
        }
        
    }

}

function openRegForm(EventID){

    window.open("http://proxy.lotty.sk/dbsys/_dbsys/registracia.php?EID="+EventID, "Registrácia", "toolbar=no,menubar=no,scrollbars=yes,resizable=yes,status=no,location=no,directories=no,copyhistory=no,height=550,width=730");
    return false;
}

function cleanContent(obj){
    if(!obj.cleaned){
        obj.value = '';
        obj.cleaned = true;
    }
}

function checkSubscription(obj) {
    if(obj.Meno.value!='' && obj.EMail.value!='' && obj.Meno.value!='Meno a priezvisko' && obj.EMail.value!='E-Mail') {
        if(obj.m[0].checked || obj.m[1].checked){
            return true;
        } else {
            alert('Zvoľte si prosím kategóriu');
            return false;
        }
    }
    
    alert('Vyplňte prosím všetky polia.');

    return false;
}

/* IE fix for relative-layout box model (width, height)*/
function resetBox(BoxID,x,y){

    if(BoxID!='' && document.getElementById(BoxID)){

        boxRef = document.getElementById(BoxID);

        if(!boxRef.currentStyle) return false;

        parentBox = boxRef.parentNode;

        if(parentBox.currentStyle.display=='none') return false;

        parentHeight = parseInt(parentBox.clientHeight);
        parentWidth  = parseInt(parentBox.clientWidth);

        boxTop     = (parseInt(boxRef.currentStyle.top) ? parseInt(boxRef.currentStyle.top) : 0);
        boxRight   = (parseInt(boxRef.currentStyle.right) ? parseInt(boxRef.currentStyle.right) : 0);
        boxBottom  = (parseInt(boxRef.currentStyle.bottom) ? parseInt(boxRef.currentStyle.bottom) : 0);
        boxLeft    = (parseInt(boxRef.currentStyle.left) ? parseInt(boxRef.currentStyle.left) : 0);
        
        boxMTop    = (parseInt(boxRef.currentStyle.marginTop) ? parseInt(boxRef.currentStyle.marginTop) : 0);
        boxMRight  = (parseInt(boxRef.currentStyle.marginRight) ? parseInt(boxRef.currentStyle.marginRight) : 0);
        boxMBottom = (parseInt(boxRef.currentStyle.marginBottom) ? parseInt(boxRef.currentStyle.marginBottom) : 0);
        boxMLeft   = (parseInt(boxRef.currentStyle.marginLeft) ? parseInt(boxRef.currentStyle.marginLeft) : 0);

        boxBTop    = (parseInt(boxRef.currentStyle.borderTopWidth) ? parseInt(boxRef.currentStyle.borderTopWidth) : 0);
        boxBRight  = (parseInt(boxRef.currentStyle.borderRightWidth) ? parseInt(boxRef.currentStyle.borderRightWidth) : 0);
        boxBBottom = (parseInt(boxRef.currentStyle.borderBottomWidth) ? parseInt(boxRef.currentStyle.borderBottomWidth) : 0);
        boxBLeft   = (parseInt(boxRef.currentStyle.borderLeftWidth) ? parseInt(boxRef.currentStyle.borderLeftWidth) : 0);

        boxPTop    = (parseInt(boxRef.currentStyle.paddingTop) ? parseInt(boxRef.currentStyle.paddingTop) : 0);
        boxPRight  = (parseInt(boxRef.currentStyle.paddingRight) ? parseInt(boxRef.currentStyle.paddingRight) : 0);
        boxPBottom = (parseInt(boxRef.currentStyle.paddingBottom) ? parseInt(boxRef.currentStyle.paddingBottom) : 0);
        boxPLeft   = (parseInt(boxRef.currentStyle.paddingLeft) ? parseInt(boxRef.currentStyle.paddingLeft) : 0);

        if(x && boxRef.style!=null)
            boxRef.style.height = (parentHeight - boxTop - boxBottom - boxMTop - boxMBottom - boxBTop - boxBBottom - boxPTop - boxPBottom) + 'px';
        if(y && boxRef.style!=null)
            boxRef.style.width  = (parentWidth - boxRight - boxLeft - boxMRight - boxMLeft - boxBRight - boxBLeft - boxPRight - boxPLeft) + 'px';

        return true;
    }
}

function initBox(){
    resetBox('PageContentBox',1,1);
    resetBox('colBgLeft',1,0);
}

window.onresize = initBox;
window.onload = initBox;

/* ******************** DEBUG *********************************************** */

function objDebug(obj) {

    var properties = "";

    properties = '<TABLE BORDER="2" WIDTH="90%" COLS="2">';
    properties += '<TR ALIGN="left" BGCOLOR="lightgrey"><TH>Property</TH><TH>Value</TH></TR>';

    for (var propName in obj) {

        properties +="<TR><TD valign='top'>"+propName+"</TD><TD>"+obj[propName]+"&nbsp;</TD></TR>";

    }
    properties +="</TABLE>";
    ref = window.open('','Debug');
    ref.document.write(properties)
}
