function switchOn(tabNum) {
        switchAllOff();
        document.getElementById('tab'+tabNum).className = 'selectedtab'+tabNum;
        document.getElementById('tabcontents'+tabNum).className = 'tabselectedcontents'+tabNum;
        
}
function clickOn(tabNum)
{
	setCookie('tabCookie', tabNum, 7);
	switch(tabNum)
	{
		case 1 :
			document.location.href="../hotesses/accueil.aspx";
			break;
		case 2 :
			document.location.href="../pro/accueil.aspx";
			break;
		case 3 :
			document.location.href="../pro/accueil.aspx";
			break;
	}
}

function checkTabCookie() {
        tabNum=getCookie('tabCookie');
        if (tabNum==null) {
                tabNum=num;
        }

        switchOn(tabNum);
}

function clearTop() {
        /*topRow = document.getElementById('tabs');
        tabArray = topRow.childNodes;
        for (var i=0; i<tabArray.length; i++) {
                tabArray[i].className = 'stab'+i;
        }*/
        document.getElementById("tab1").className="stab1";
        document.getElementById("tab2").className="stab2";
        //document.getElementById("tab3").className="stab3";
}

function clearContents() {
        tabContents = document.getElementById('tabcontents');
        contentsArray = tabContents.childNodes;
        for (var j=0; j<contentsArray.length; j++) {
                contentsArray[j].className = 'tabcontent';
        }
}

function switchAllOff() {
        clearTop();
        clearContents();
}

function getCookie(NameOfCookie) {
        if (document.cookie.length > 0) {
                begin = document.cookie.indexOf(NameOfCookie+"=");
                if (begin != -1) {
                        begin += NameOfCookie.length+1;
                        end = document.cookie.indexOf(";", begin);
                        if (end == -1) end = document.cookie.length;
                        return unescape(document.cookie.substring(begin, end));
                }
        }
        return null;
}

function setCookie(NameOfCookie, value, expiredays) {
        var ExpireDate = new Date ();
        ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
        document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}
