//#### SCRIPT FOR POPUP: Baangarantie #### -->

	var popupWidth = 623;
	var popupHeight = 445;
	var activePopup = '';

	var t; // Timer pointer

	//Get current windows width and height. ( FF, Safari, IE )
	if (navigator.appName=="Netscape")
	{
		var winWidth = window.innerWidth;
		var winHeight = window.innerHeight;
	}
	if (navigator.appName.indexOf("Microsoft")!=-1)
	{
		var winWidth = document.documentElement.scrollWidth;
		var winHeight = document.documentElement.scrollHeight;
	}

	function showpopupCloseButton()
	{
		//Position and show all buttons if animation is done.
		var obj = document.getElementById(activePopup+'btClose');
		obj.style.top = '-3px';
		obj.style.left = popupWidth - 18 + 'px';
		obj.style.visibility = 'visible';
	}

	function hidepopupClosebutton()
	{
		//Hide all active buttons
		document.getElementById(activePopup+'btClose').style.visibility = 'hidden';
	}

	function writeCookie(name,value,expiredays) {

		var today = new Date();
		var expire = new Date();
		expire.setTime(today.getTime() + 3600000*24*expiredays); // day
		document.cookie = name+"="+value+";expires="+expire.toGMTString();

	}

	function readCookie(name)
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++)
		{
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}

	function showPopupButton()
	{

		var docTitle = document.title;
		//Check if home page is requested!
		if(docTitle.lastIndexOf("Home")!=-1)
		{
			popupobj = document.getElementById('popupContentbt');
			if(popupobj)
			{
				 popupobj.style.top = "180px";
				 popupobj.style.left = "205px";
				 popupobj.style.visibility = 'visible';
			}
		}
	}

	function viewpopup()
	{
		 popupobj = document.getElementById(activePopup);
		 if(popupobj)
		 {
			 popupobj.style.top = Math.floor( (winHeight - popupHeight)/2 ) + "px";
			 popupobj.style.left = Math.floor( (winWidth - popupWidth)/2 ) + "px";
			 popupobj.style.visibility = 'visible';
			 document.getElementById('popupBG').style.visibility= "visible";
			 showpopupCloseButton();
		}
	}

	function hidepopup()
	{
		document.getElementById(activePopup).style.visibility = 'hidden';
		document.getElementById('popupBG').style.visibility= "hidden";
		hidepopupClosebutton();
	}

	function popupInit(popupName,days)
	{
		activePopup = popupName;
		
		if( readCookie(popupName+'popupdisabled')!=1 )
		if( readCookie(popupName+'popupviewed')!=1 )
		{
			 
			 var today = new Date();
			 var expire = new Date();
			 expire.setTime(today.getTime() + 3600000*24*days); // day
			 document.cookie = popupName+"popupviewed=1;expires="+expire.toGMTString();
			 setTimeout("viewpopup();", 1000);
		}
		showPopupButton();
	}

	function popupDisable(popupName) {

		document.cookie = popupName+"popupdisabled=1;";
		hidepopup( popupName );

	}

