	// JavaScript Document

	// OPEN NEW WINDOW

	function openWindow(url,width,height,settings,name) {
		if (!settings) settings = "scrollbars=yes,menubar=yes,toolbar=yes,status=yes,resizable=yes,directories=no,location=no";
		if (height) settings = "height=" + height + "," + settings;
		if (width) settings = "width=" + width + "," + settings;
		if (!name) name = "externalWindow";
		var newWin = window.open(url,name,settings);
	}


	// MM FUNCTIONS
	
	function MM_swapImage() { //v3.0
		var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	
	function MM_swapImgRestore() { //v3.0
		var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function MM_preloadImages() { //v3.0
		var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function MM_findObj(n, d) { //v4.0
		var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		if(!x && document.getElementById) x=document.getElementById(n) ; return x;
	}


	// ADD EVENT

	function addEvent(obj, evType, fn){ 
		 if (obj.addEventListener){ 
			obj.addEventListener(evType, fn, false); 
		   return true; 
		} else if (obj.attachEvent){ 
			var r = obj.attachEvent("on"+evType, fn); 
			return r; 
		} else { 
			return false; 
 		} 
	}

	// FIND POSITION
	function findPosX(obj)
	{
		var curleft = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curleft += obj.offsetLeft
				obj = obj.offsetParent;
			}
		}
		else if (obj.x)
			curleft += obj.x;
		return curleft;
	}
	
	function findPosY(obj)
	{
		var curtop = 0;
		if (obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curtop += obj.offsetTop
				obj = obj.offsetParent;
			}
		}
		else if (obj.y)
			curtop += obj.y;
		return curtop;
	}
	
	// CLEAR AND SET SEARCH INPUT
	var searchText = "Search...";
	function searchInputFocus() {
		if (document.searchform.q.value == searchText) {
			document.searchform.q.value = "";
		}
		document.searchform.q.style.color = "#000";
	}
	
	function searchInputBlur() {
		if (document.searchform.q.value == "") {
			document.searchform.q.value = searchText;
		} 
		document.searchform.q.style.color = "#999";
	} 
	
	function searchFormSubmit(e) {
		if (document.searchform.q.value == "" || document.searchform.q.value == searchText) {
			e.preventDefault();
			return false;
		} else {
			return true;
		}
	} 
	
	
	// START LIST
	function startList() {
		if (document.all&&document.getElementById(menuname)) {
			navRoot = document.getElementById(menuname);
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
					}
					node.onmouseout=function() {
						this.className=this.className.replace(" over", "");
					}
				}
			}
		}
	} 
	
	var menuname = "languages";
	//addEvent(window, 'load', startList);
	
	// POPUP
	var windowHeight = 0;
	var windowWidth  = 0;
	var scrollTop    = 0;
	var scrollLeft   = 0;
	
	var isIE = navigator.userAgent.indexOf("MSIE"), isIE6 = -1;
	if (isIE) { isIE6 = navigator.userAgent.indexOf("6.0"); }

	function scalePageMask() {
		
		var mask;
		
		if (document.getElementById('popup_mask')) { 
			mask = document.getElementById('popup_mask'); 
			mask.style.height = document.documentElement.scrollHeight + 'px';
			mask.style.width  = document.documentElement.scrollWidth + 'px';
		}

	}

	function getWindowDimensions() {
		if( self.innerHeight || self.pageYOffset ) {
			windowHeight = self.innerHeight;
			windowWidth  = self.innerWidth;
			scrollTop    = self.pageYOffset;
			scrollLeft   = self.pageXOffset;
		} else if( document.documentElement && document.documentElement.clientHeight ) {
			windowHeight = document.documentElement.clientHeight;
			windowWidth  = document.documentElement.clientWidth;
			scrollTop    = document.documentElement.scrollTop;
			scrollLeft   = document.documentElement.scrollLeft;
		} else if( document.body ) {
			windowHeight = document.body.clientHeight;
			windowWidth  = document.body.clientWidth;
			scrollTop    = document.body.scrollTop;
			scrollLeft   = document.body.scrollLeft;
		}
	}

	function hideSelectElements() { 
		if (isIE6 > -1) {
			var selectItems = document.getElementsByTagName('select');
			for( var i = 0; i < selectItems.length; i++ ) selectItems[i].style.display = 'none';
		}
	}

	function showSelectElements() { 
		if (isIE6 > -1) {
			var selectItems = document.getElementsByTagName('select');
			for( var i = 0; i < selectItems.length; i++ ) selectItems[i].style.display = '';
		}
	}
	
	// window
	function showWindowBox() {
		document.getElementById('popup_mask').style.display  = 'block';
		document.getElementById('popup_window').style.display = 'block';
		hideSelectElements();
		sizeWindowBox();
		positionWindowBox();
	}

	function hideWindowBox() {
		document.getElementById('popup_mask').style.display  = 'none';
		document.getElementById('popup_window').style.display = 'none';
		showSelectElements();
	}

	function sizeWindowBox() {
		
		if (document.getElementById('popup_window')) {
			var windowBox  = document.getElementById('popup_window');
			if( windowBox.style.display == 'none' ) return;
			
			getWindowDimensions();
			
		}
	}

	function positionWindowBox() {
		
		if (document.getElementById('popup_window')) { positionWindowBoxSet(document.getElementById('popup_window')); }		
	}
	
	function positionWindowBoxSet(obj) {

		if (obj.style.display == 'none') return;
		
		scalePageMask();
		getWindowDimensions();

		var boxHeight = parseInt(obj.offsetHeight);
		var boxWidth  = parseInt(obj.offsetWidth);
	
		obj.style.left = Math.round((windowWidth - boxWidth) / 2) + scrollLeft + 'px';
		obj.style.top  = Math.round((windowHeight - boxHeight) / 2) + scrollTop + 'px';
		
	}

	window.onscroll = function() { positionWindowBox(); }
	window.onresize = function() { sizeWindowBox(); positionWindowBox(); }
	
	
