	var oldsel=[];	
	var lenchcolor1=[];
	var lenchcolor2=[];
	var lenchcolor3=[];
	var visualtours=[];
	var visualtours_name=[];
	
 	lenchcolor1['dmenutop_']='tmenu_itemoff';
	lenchcolor2['dmenutop_']='tmenu_itemon';
	lenchcolor3['dmenutop_']='tmenu_itemoff';
	oldsel['dmenutop_']=0;
	
	lenchcolor1['bmenutop_']='bmenu_itemoff';
	lenchcolor2['bmenutop_']='bmenu_itemon';
	lenchcolor3['bmenutop_']='bmenu_itemoff';
	oldsel['bmenutop_']=0;
	
	lenchcolor1['gmenutop_']='gmenu_itemoff';
	lenchcolor2['gmenutop_']='gmenu_itemon';
	lenchcolor3['gmenutop_']='gmenu_itemoff';
	oldsel['gmenutop_']=0;
	
	lenchcolor1['vertop_']='ver_itemoff';
	lenchcolor2['vertop_']='ver_itemon';
	lenchcolor3['vertop_']='ver_itemoff';
	oldsel['vertop_']=0;
	
	lenchcolor1['vertop1_']='ver_itemoff';
	lenchcolor2['vertop1_']='ver_itemon';
	lenchcolor3['vertop1_']='ver_itemoff';
	oldsel['vertop1_']=0;
	
	lenchcolor1['tee_']='tee_itemoover';
	lenchcolor2['tee_']='tee_itemoff';
	lenchcolor3['tee_']='tee_itemon';
	oldsel['tee_']=0;
	
	function reqLenFunc(otype,oele,oid,ocode){
		
		if(!oele.id){
			oele=document.getElementById(oele);
		}
		
		var jsTRid;
		jsTRid=ocode+oldsel[ocode];
		fspea=oid*1;
		nspea=oid*1+1;
		
		cur_fspea=oldsel[ocode]*1;
		cur_nspea=oldsel[ocode]*1+1;
		
		
		if(otype=='over' && oele.id!=jsTRid){			
			oele.className=lenchcolor1[ocode];
			
			if(document.getElementById(ocode+'spea_'+fspea)){
				document.getElementById(ocode+'spea_'+fspea).className=ocode+'spea0_sel';
			}
			if(document.getElementById(ocode+'spea_'+nspea)){
				document.getElementById(ocode+'spea_'+nspea).className=ocode+'spea0_sel';
			}
		}
		
		if(otype=='out' && oele.id!=jsTRid){
			oele.className=lenchcolor2[ocode];
			if(document.getElementById(ocode+'spea_'+fspea) &&  cur_fspea!=fspea && cur_nspea!=fspea){
				document.getElementById(ocode+'spea_'+fspea).className=ocode+'spea0';
			}
			if(document.getElementById(ocode+'spea_'+nspea) &&  cur_nspea!=nspea && cur_fspea!=nspea){
				document.getElementById(ocode+'spea_'+nspea).className=ocode+'spea0';
			}
			
		}
		
		if(otype=='click'){
			
			var jsCHECKid;
			jsCHECKid='vlensel'+oldsel[ocode];
			if(oldsel[ocode]!=0){
				
				if(document.getElementById(jsTRid))
					document.getElementById(jsTRid).className=lenchcolor2[ocode];
				if(document.getElementById(jsCHECKid))
					document.getElementById(jsCHECKid).checked='';
			}
			
			if(document.getElementById(ocode+'spea_'+fspea)){
				document.getElementById(ocode+'spea_'+fspea).className=ocode+'spea0_sel';
			}
			if(document.getElementById(ocode+'spea_'+nspea)){
				document.getElementById(ocode+'spea_'+nspea).className=ocode+'spea0_sel';
			}
			
			var jsCHECKid2;
			
			jsCHECKid2='vlensel'+oid;
			oldsel[ocode]=oid;
			if('mmenumain3_'==ocode || 'mmenumain2_'==ocode){
				setCookie('mmenumain3_','',0);
				setCookie('mmenumain2_','',0);
			}
			
			//setCookie(ocode,oid,1);
			//setCookie(ocode,oid,1);
			
			oele.className=lenchcolor3[ocode];
			if(document.getElementById(jsCHECKid2))
				document.getElementById(jsCHECKid2).checked='checked';
		}
		
	}
	
	function leftNewsMenuClick(oclick){
	}
	
	function ZUwriteCookie(name,value,domain,path,exp_days){
		value=escape(value);
		var ck=name+"="+value,exp;
		if(domain)
			ck+=";domain="+domain;
		if(path)
			ck+=";path="+path;
		if(exp_days){
			exp=new Date();
			exp.setTime(exp_days*86400000+exp.getTime());
			ck+=";expires="+exp.toGMTString();
		}
		document.cookie=ck;
	}
	
	function LangSelect(olang){
	
		ZUwriteCookie('web_lang',olang);
	}
	
	var formLO=null;
	var formLO2=null;
	var formKML=null;
	
	function loginform(oresform,oresponseEl)
	{
		formLO = new Zapatec.Form({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formvalidfunc,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccess,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebug
		});		
		
	}
	
	
	function loginform(oresform,oresponseEl)
	{
		formLO = new Zapatec.Form({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formvalidfunc,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccess,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebug
		});		
		
	}
	
	
	function registerform(oresform,oresponseEl)
	{
		formLO = new Zapatec.Form({
			form: oresform,
			showErrors: 'afterField',
			showErrorsOnSubmit: true,
			submitValidFunc:formvalidfunc2,
			submitErrorFunc: testErrOutput,
			asyncSubmitFunc: myOnSuccess,
			ajaxDebugElement: oresponseEl,
			ajaxDebugFunc: myDebugnohis
		});		
		
	}
	
	
	var searchintxt='';
	
	function searchinputFocus(oelement){
		
		var chval=" "+searchintxt;
		if(oelement && oelement.value==chval){
				oelement.value='';					
		}
		
		
	}
	
	function searchinputChange(oelement){
		
		if(oelement.value==""){
			oelement.value=" "+searchintxt;
		}
	}
	
	var screenimg=new Array('');
	var screenimg1=new Array('');
	var screenimg3=new Array('');
	var screenimg2=new Array('');
	
	
	function imgrestart(){
		screenimg=new Array('');
		screenimg1=new Array('');
		screenimg3=new Array('');
		screenimg2=new Array('');	
	}
	
	var selimg=0;
	function imagechange(otype){
		
		//var maindiv=document.getElementById('nrange_homeShowImg');
		//maindiv.src=vsubpath+'/isimage/s.gif';
		if(document.getElementById('backbtnSPAN'))
			var maindiv1=document.getElementById('backbtnSPAN');
		
		if(document.getElementById('nextbtnSPAN'))
			var maindiv2=document.getElementById('nextbtnSPAN');
		
		if(document.getElementById('quicktopDIV'))
			var topdiv=document.getElementById('quicktopDIV');		
		
		var topdiv2=document.getElementById('quicktopDIV2');
		classind=selimg*1;
		showind=screenimg2.length-1;
	
		if(showind>0){
			if(otype=='back'){
				classind=classind-1;
			}
			else{
				classind=classind+1;
			}
			
			if(classind>showind ){
				classind=1;
			}
			
			if(classind>1){
				document.getElementById('backbtnIMG').style.display='block';
				if(document.getElementById('backbtnIMG2'))
					document.getElementById('backbtnIMG2').style.display='block';
				if(document.getElementById('backbtnIMG3'))
					document.getElementById('backbtnIMG3').style.display='none';
			}else{
				document.getElementById('backbtnIMG').style.display='none';
				if(document.getElementById('backbtnIMG2'))
					document.getElementById('backbtnIMG2').style.display='none';
					
				if(document.getElementById('backbtnIMG3') )
					document.getElementById('backbtnIMG3').style.display='block';	
			}
			
			if(classind<showind){
				document.getElementById('nextbtnIMG').style.display='block';
				if(document.getElementById('nextbtnIMG2'))
					document.getElementById('nextbtnIMG2').style.display='block';
				if(document.getElementById('nextbtnIMG3'))
					document.getElementById('nextbtnIMG3').style.display='none';	
			}else{
				document.getElementById('nextbtnIMG').style.display='none';
				if(document.getElementById('nextbtnIMG2'))
					document.getElementById('nextbtnIMG2').style.display='none';
				if(document.getElementById('nextbtnIMG3'))
					document.getElementById('nextbtnIMG3').style.display='block';	
			}
			
			if(document.getElementById('nrange_homeShowImg'+selimg))
				document.getElementById('nrange_homeShowImg'+selimg).style.display='none';
			
			if(document.getElementById('quickmoreDIV'+selimg))
				document.getElementById('quickmoreDIV'+selimg).style.display='none';
			
			selimg=classind;
			
			if(document.getElementById('quickmoreDIV'+selimg))
				document.getElementById('quickmoreDIV'+selimg).style.display='block';
			
			if(document.getElementById('nrange_homeShowImg'+selimg)){
				document.getElementById('nrange_homeShowImg'+selimg).style.display='block';
				document.getElementById('nrange_homeShowImg'+selimg).src=screenimg2[classind];
			}
			
			if(classind>1 && maindiv1){
				maindiv1.innerHTML='('+screenimg1[selimg]+')';
			}
			
			if(classind<showind && maindiv2){				
				maindiv2.innerHTML='('+screenimg1[selimg]+')';
			}
			
				
			if(topdiv)
				topdiv.innerHTML=screenimg[classind];
			topdiv2.innerHTML=screenimg3[classind];
		}
		else{
			document.getElementById('backbtnIMG').style.display='none';	
			document.getElementById('nextbtnIMG').style.display='none';
		}
	}
	
	
	function visualtoursF(otype){
		
		classind=oldsel['vertop_']*1;
		showind=visualtours.length-1;
		if(otype=='back'){
			classind=classind-1;
		}
		else{
			classind=classind+1;
		}
		
		if(showind<classind){
			classind=1;
		}
		
		if(classind==0){
			classind=showind;
		}
				
		
		reqLenFunc('click',document.getElementById('vertop_'+classind),classind,'vertop_'); 
		//simplepage(vsubpath+'/visualtour.php','GET','visualtour_pid','vfile=visual&vdevise='+visualtours[classind]+'&nohis=true','visualtour_pid','true');
	}
	
	function startvisual(){
		
		classind=oldsel['vertop_']*1;
		bdev=classind-1;
		ndev=classind+1;
		showind=visualtours.length-1;
		if(showind<ndev){
			ndev=1;
		}
		
		if(bdev==0){
			bdev=showind;
		}
		
		
		document.getElementById('backbtnIMG3').innerHTML=visualtours_name[bdev];	
		document.getElementById('nextbtnIMG3').innerHTML=visualtours_name[ndev];
		document.getElementById('backbtnIMG3').href='visualtour.php?vfile=visual&vdevise='+visualtours[bdev];
		document.getElementById('nextbtnIMG3').href='visualtour.php?vfile=visual&vdevise='+visualtours[ndev];
	}
	
	function loadscript(oelement){
	
		var fcontainer=document.getElementById(oelement);
		jsind=0;
		var mainbody=document.getElementsByTagName('body')[0];
		while(fcontainer.getElementsByTagName('script')[jsind]){
			var oldscript=fcontainer.getElementsByTagName('script')[jsind];
			
			var newscript=document.createElement('scr'+'ipt');
			newscript.text=oldscript.text;
			newscript.id=oelement+'_'+jsind;
			newscript.type="text/javascript";
			if(oldscript.src)
				newscript.src=oldscript.src;
			
	
			mainbody.appendChild(newscript);
			
			jsind++;
			
		}
		
	}
	
	function removescript(oelement){
	
		var fcontainer=document.getElementById(oelement);
		jsind=0;
		var mainbody=document.getElementsByTagName('body')[0];
		while(fcontainer.getElementsByTagName('script')[jsind]){
			var oldscript=fcontainer.getElementsByTagName('script')[jsind];
			if(document.getElementById(oelement+'_'+jsind)){
				var removejs=document.getElementById(oelement+'_'+jsind)
				mainbody.removeChild(removejs);
			}
			jsind++;
		}
		
	}
	
	function ajaxpage(url, containerid)
	{
		
		var page_request = false
		if (window.XMLHttpRequest) 
			page_request = new XMLHttpRequest() 
		else if (window.ActiveXObject) { 
			try { page_request = new ActiveXObject("Msxml2.XMLHTTP") } 
			catch (e){ try{ page_request = new ActiveXObject("Microsoft.XMLHTTP") }
				catch (e){}
			}
		}	
	
		else return false
		page_request.onreadystatechange = function() 
		{
			if(document.getElementById(containerid+'_load'))
			document.getElementById(containerid+'_load').innerHTML = "<table width='16' height='16'><tr><td align='center'><img src='"+vsubpath+"/isimage/spinner.gif' border='0' width='16' height='16'  align=absmiddle></td></tr></table>";
			else
			document.getElementById(containerid).innerHTML = "<table width='16' height='16'><tr><td align='center'><img src='"+vsubpath+"/isimage/spinner.gif' border='0' width='16' height='16' align=absmiddle></td></tr></table>";
			loadpage(page_request, containerid)
		}
		page_request.open('GET', url+"&isajax=true&r="+Math.random(), true)
		page_request.send(null)
	}
	
	function loadpage(page_request, containerid) {
		if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
			//if(document.getElementById(containerid+'_load'))
			//document.getElementById(containerid+'_load').innerHTML="";
			
			document.getElementById(containerid).innerHTML = page_request.responseText;
			removescript(containerid);
			loadscript(containerid);
	}
	
	function trim(stringToTrim) {
		return stringToTrim.replace(/^\s+|\s+$/g,"");
	}
	function ltrim(stringToTrim) {
		return stringToTrim.replace(/^\s+/,"");
	}
	function rtrim(stringToTrim) {
		return stringToTrim.replace(/\s+$/,"");
	}
	
	function validateEmail(email) {
	   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	   //var address = document.forms[form_id].elements[email].value;
	   var address = trim(document.getElementById(email).value);
	   
	   if(reg.test(address) == false) {
		  //alert('Invalid Email Address');
		  return false;
	   }
	   else{
		   	document.getElementById(email).value=address;
	   		return true;
			
	   }
	}
	
	function PrintpageWin(theURL) {
		
		window.open(theURL, '', 'scrollbars=yes,toolbar=No,location=No,directories=No,menubar=yes,status=No,titlebar=No,resizable=no,width=800,height=600');
	}
	
	