// JavaScript Document

//active fix for dhtml + select form elements:
	ie	= (document.all && !window.opera);
	dom 	= (document.getElementById && !window.opera);
	opera 	= (window.opera);

// this hides elements 
// for opera we resize the flash movie back to original size
// arguments for the loadflash() function are id of layer, url of flash movie, width and height. 

function closeLayer(){
	var id = 'ChristmasLayer';
	document.getElementById(id).style.visibility = "hidden";
}

// this shows elements 
// for opera we resize the flash movie to a smaller size so as to allow the layer to show. 
// arguments for the loadflash() function are id of layer, url of flash movie, width and height. 

function showLayer(){
	var id = 'ChristmasLayer';
	document.getElementById(id).style.visibility="visible";
}

//main navigation for IE
var startList;

startList = function() 
{
	if (document.all&&document.getElementById && (navigator.appName != "Opera") && (typeof window.opera == "undefined")) 
	{
		navRoot = document.getElementById("at-navi");
		for (i=0; i<navRoot.childNodes.length; i++) 
		{
			node = navRoot.childNodes[i];
			if (node.nodeName=="TD") 
			{
				node.onmouseover=function() 
				{
					this.className="at-over";
					for(sl=0;sl<document.getElementsByTagName("select").length;sl++)
					{
						//exception for shop form selects
							if(document.getElementsByTagName("select")[sl].name != "fldVisitPurpose")
								document.getElementsByTagName("select")[sl].style.visibility = "hidden";
					}
			  	}
			  	
				node.onmouseout=function() 
				{
			  		this.className=this.className.replace("at-over", "");
					for(sl=0;sl<document.getElementsByTagName("select").length;sl++)
					{
						//exception for shop form selects
							if(document.getElementsByTagName("select")[sl].name != "fldVisitPurpose")
								document.getElementsByTagName("select")[sl].style.visibility = "visible"
					}
			   	}
			}
		}
	}
	//check if private startpage - if yes check for cookie 
	var completepath = window.location.href;
	var urlposition = completepath.indexOf("/privat/");
	var path1=completepath.substring(urlposition,completepath.length);
	if(path1 == "/privat/" || path1 == "/privat/index.php")
	{
		//we are in the private startpage, check for cookie
		if(!checkCookie())
		{
			//cookie returned false, cookie was not set yet, user didnt see ad today
			showChristmasBanner();
		}
		else
		{
			//do nothing
			//alert("cookie there");
		}
	}
	//alert(path2);
}

function showChristmasBanner()
{
	//div show banner
	showLayer();
	//setCookie to prevent user from seeing the same thing twice on the same day.
	setCookie();
}

function checkCookie() {
	var theCookie ="" + document.cookie;
	var index = theCookie.indexOf("tmoshopbanner");
	if(index == -1)
		return false;
	else
		return true;	
}

function setCookie() {
	var today = new Date();
	var expire = new Date();
	expire.setTime(today.getTime() + 3600000*24); //a complete day
	//expire.setTime(today.getTime() + 600000); //10 minutes
	document.cookie = "tmoshopbanner=shown;expires="+expire.toGMTString();
}

//window.onload=startList;