/*/////////////////////////////////////////////////////////////////*/
/*////////////////////// SET POSITIONS ////////////////////////////*/
/*/////////////////////////////////////////////////////////////////*/


	function updateLayout() {
		// build custom resizeStart & resizeEnd events
		// IE is firing continuously when resizing
		// while screen layout only needs to be updated when resizing is done
		if(document.all) {
	  		window.resizeEnd = (window.resizeEnd == null) ? (new Object()) : window.resizeEnd;
	  		clearTimeout(window.resizeEnd);
 			window.resizeEnd = setTimeout(onResizeEnd,1);
  		}
		// done resizing		
		else { onResizeEnd(); }
	}


	// Resize function
	function onResizeEnd() {
		// get width & height
		var screenH;
		var screenW;
		// IE stores browser width & height in 'document.body.clientWidth' 
		// (only IE running a transitional or no doctype stores it in 'window.innerWidth')
		window.innerHeight ? screenH = window.innerHeight : screenH = document.body.clientHeight;
		window.innerWidth ? screenW = window.innerWidth : screenW = document.body.clientWidth;
		// Safari
		self.innerHeight ? screenH = self.innerHeight : null;
		self.innerWidth ? screenW = self.innerWidth : null;
		
		// calculate offsets
		var offsetTop = Math.round((screenH*.15)*(screenH/635));
		var offsetContent = Math.round(offsetTop-50+(50*screenH/635));				
		var offsetBot = Math.round(offsetContent+290-100+(100*screenH/635));

		var offsetAdres = Math.round(0-175+(175*screenH/635));
		var offsetBotnav = Math.round(60+(60*screenH/635));

		var offsetFooter = screenH-40;


		// set boundaries
		offsetTop<96 ? offsetTop=96 : null;
		offsetContent<90 ? offsetContent=90 : null;
		offsetBot<395 ? offsetBot=395 : null;
		offsetAdres<0 ? offsetAdres=0 : null;
		offsetAdres>65 ? offsetAdres=65 : null;
		offsetBotnav<140 ? offsetBotnav=140 : null;
		offsetFooter<650 ? offsetFooter=650 : null;


		// don't resize if css is disbled
		if(document.getElementById("topwrapper").offsetWidth==984) {

			// set top
			document.getElementById("top").style.position = "absolute";			
			document.getElementById("top").style.height = (offsetTop+140)+"px";
			if(document.getElementById("logo")) {
				document.getElementById("logo").style.marginTop = (offsetTop-130)+"px";
				document.getElementById("topnavigation").style.marginTop = (offsetTop-130)+"px";
			}
			// flash-version
			document.getElementById("noFlashTopper_swf") ?
				typeof(document.getElementById("noFlashTopper_swf").changeOffset)=="function" ?
					document.getElementById("noFlashTopper_swf").changeOffset(offsetTop-120, offsetContent) :
					null :
				null;
			document.getElementById("noFlashTopper_swf") ?
				document.getElementById("noFlashTopper_swf").height = offsetTop+140 :
				null;


			// set content
			document.getElementById("content").style.position = "absolute";
			document.getElementById("content").style.marginTop = offsetContent+"px";

			// set bottom
			document.getElementById("bottom").style.position = "absolute";
			document.getElementById("bottom").style.marginTop = offsetBot+"px";
			if(document.getElementById("adres")) {
				document.getElementById("adres").style.marginTop = offsetAdres+"px";
				document.getElementById("botnavigation").style.marginTop = offsetBotnav+"px";
			}
			// flash-version
			document.getElementById("noFlashBottom_swf") ?
				typeof(document.getElementById("noFlashBottom_swf").changeAdresOffset)=="function" ?
					document.getElementById("noFlashBottom_swf").changeAdresOffset(offsetAdres,offsetBot-offsetContent) :
					null :
				null;
			document.getElementById("noFlashBottom_swf") ?
				typeof(document.getElementById("noFlashBottom_swf").changeNavigationOffset)=="function" ?
					document.getElementById("noFlashBottom_swf").changeNavigationOffset(offsetBotnav) :
					null :
				null;
			document.getElementById("noFlashBottom_swf") ?
				document.getElementById("noFlashBottom_swf").height = offsetBotnav+120 :
				null;

			// set footer
			document.getElementById("footer").style.marginTop = offsetFooter+"px";

			// flash content
			var ie = /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)
			document.getElementById("noFlash_swf") ?
				typeof(document.getElementById("noFlash_swf").changeOffset)=="function" ?
					document.getElementById("noFlash_swf").changeOffset(offsetContent,ie) :
					null :
				null;
		}
	}

	window.onload = updateLayout;
	window.onresize = updateLayout;




/*/////////////////////////////////////////////////////////////////*/
/*//////////////////// CHANGING Z-INDEX ///////////////////////////*/
/*/////////////////////////////////////////////////////////////////*/

	
	function setZIndex(one,two,tree) {
		document.getElementById("top").style.zIndex = one;
		document.getElementById("content").style.zIndex = two;
		document.getElementById("bottom").style.zIndex = tree;
	}	



/*/////////////////////////////////////////////////////////////////*/
/*///////////////////////// PLACE SWF /////////////////////////////*/
/*/////////////////////////////////////////////////////////////////*/
	

	function setSWF(ID, url, width, height, language, level, mainpage, subpage) {
		var flashvars = { 
			lang: language,
			aLevel: level,
			aPage: mainpage,
			aSub: subpage 
		};
		var params = { 
			menu: "false", 
			wmode: "transparent",
			allowScriptAccess: "sameDomain"
		};
		var attributes = { id: ID+"_swf" };
		swfobject.embedSWF(url,ID,width,height,"8","/_include/expressinstall.swf",flashvars,params,attributes);
	}




/*/////////////////////////////////////////////////////////////////*/
/*//////////////////////// PLACE PAGETITLES ///////////////////////*/
/*/////////////////////////////////////////////////////////////////*/	


	function setTitle(id,title) {
		var flashvars = { myTitle: title };
		var params = { menu: "false", wmode: "transparent" };
		var attributes = false;
		swfobject.embedSWF("/flash/pageTitle.swf", id, "100%", "45", "8", "/_include/expressinstall.swf", flashvars, params, attributes);	
	}
		

		
/*/////////////////////////////////////////////////////////////////*/
/*//////////////////////// PLACE CONTENT PICS /////////////////////*/
/*/////////////////////////////////////////////////////////////////*/	


	function setPic(id,width,height,pic,url,target) {
		var flashvars = { 
			w: width,
			h: height,
			src: pic,
			download: url,
			target: target
		};
		var params = { menu: "false", wmode: "transparent" };
		var attributes = false;
		swfobject.embedSWF("/flash/picContainer.swf", id, width+30, height+20, "8", "/_include/expressinstall.swf", flashvars, params, attributes);	
	}


/*/////////////////////////////////////////////////////////////////*/
/*////////////////////////// AUDIOPLAYER //////////////////////////*/
/*/////////////////////////////////////////////////////////////////*/	


	function setAudioPlayer(id,mp3) {
		var flashvars = { myStream: mp3 };
		var params = { menu: "false", wmode: "transparent" };
		var attributes = false;
		swfobject.embedSWF("/flash/audioPlayer.swf", id, "100", "30", "8", "/_include/expressinstall.swf", flashvars, params, attributes);	
	}
	
	
/*/////////////////////////////////////////////////////////////////*/
/*////////////////////////// VIDEOPLAYER //////////////////////////*/
/*/////////////////////////////////////////////////////////////////*/	


	function setVideoPlayer(id) {
		var flashvars = false;
		var params = { menu: "false", wmode: "transparent" };
		var attributes = false;
		swfobject.embedSWF("/flash/videoContainer.swf", id, "400", "230", "8", "/_include/expressinstall.swf", flashvars, params, attributes);	
	}
	
	
/*/////////////////////////////////////////////////////////////////*/
/*////////////////////// WRITE COOKIE /////////////////////////////*/
/*/////////////////////////////////////////////////////////////////*/
	

	function WriteCookie(name, value) {
		var nowDate = new Date();
		var expdate = new Date();
		expdate.setTime (expdate.getTime() + 90*(24 * 60 * 60 * 1000)); // 90 days from now
		document.cookie = name + "=" + value + "; expires=" + expdate.toGMTString() + "; path=/";
	}

	



