  /*
 /	     produced by surf | www.surf.se
/   code by david genelid | david@surf.se
*/


/*
 *	Browser-sniffing variables..
 */
var ns  = (document.layers) ? true : false;
var ie  = (document.all) ? true : false;
var dom = (document.getElementById) ? true : false;


// Scripts for the menu.
function go_main(where) {
	top.main.right.location.href = where;
}
/*
function setScrollTop() {	
	top.menuScrollTop = (ns) ? pageYOffset : document.body.scrollTop;
}
function getScrollTop() {
	if (top.menuScrollTop > 0) {
		scrollTo(0, top.menuScrollTop);
	}
}
*/


/*
 *	v2.5 Align a layer on the screen ie. left, center, right, top, middle, bottom, DOM compatible
 *			 Added argument to align using only the visible area or the real area, "client" or "scroll".
 *
 *	ex. SURF_align("myLayer", "left", 0, "middle", 0, "scroll") 
 *	or  SURF_align("myLayer", "left", -200, "middle", +50, "client", "myLayer2", "right", 0, "bottom", 0, "scroll");
 *
 */
function SURF_align() {
	var a = SURF_align.arguments;
	
	// Get array with layers
	if (ns) {		
		var obj = document.layers;
	} else {			
		var obj = (dom) ? document.getElementsByTagName("div") : document.all;
	}

	// Loop through the layer-array
	for (i = 0; i < a.length; i+=6) {	
		
		// Set scrollWidth, scrollHeight
		var scrollWidth = (ie) ? document.body.scrollWidth : document.width;
		var scrollHeight = (ie) ? document.body.scrollHeight : document.height;
		
		// Set clientWidth, clientHeight
		var clientWidth = (ie) ? document.body.clientWidth : window.innerWidth;
		var clientHeight = (ie) ? document.body.clientHeight : window.innerHeight;				

		// Check what to use: scrollWidth, scrollHeight or clientWidth, clientHeight
		var winWidth = (a[i+5] == "scroll" && scrollWidth > clientWidth) ? scrollWidth : clientWidth;
		var winHeight = (a[i+5] == "scroll" && scrollHeight > clientHeight) ? scrollHeight : clientHeight;
		
		// Get the current layer, width and height
		var	curObj = (ns) ? obj[a[i]] : obj[a[i]].style;
		var objWidth = (ns) ? parseInt(obj[a[i]].document.width) : parseInt(obj[a[i]].offsetWidth);
		var objHeight = (ns) ? parseInt(obj[a[i]].document.height) : parseInt(obj[a[i]].offsetHeight);
				
		// Horizontal alignment
		if (a[i+1] == "left") curObj.left = (0 + a[i+2]);
		else if (a[i+1] == "center") curObj.left = ((winWidth / 2 - objWidth / 2) + a[i+2]);
		else if (a[i+1] == "right") curObj.left = ((winWidth - objWidth) + a[i+2]);
		
		// Vertical alignment
		if (a[i+3] == "top") curObj.top = (0 + a[i+4]);
		else if (a[i+3] == "middle") curObj.top = ((winHeight / 2 - objHeight / 2) + a[i+4]);
		else if (a[i+3] == "bottom") curObj.top = ((winHeight - objHeight) + a[i+4]);
		
		// Fix Overflow
		curObj.width = clientWidth;
	}
}