	function getPosX(objs){
		var obj=objs;
		var curleft = 0;
		if (obj && obj.offsetParent)
		{
			while (obj.offsetParent)
			{
				curleft += obj.offsetLeft;
				obj = obj.offsetParent;
			}
		}
		else if (obj && obj.x) curleft += obj.x;
		return curleft;
	}
	
	function getPosY(objs){
		var obj=objs;
		var curtop = 0;
		if (obj && obj.offsetParent) 
		{
			while (obj.offsetParent) 
			{
				curtop += obj.offsetTop;
				obj = obj.offsetParent;
			}
		} 
		else if (obj && obj.y) curtop += obj.y;
		return curtop;
	}

	function request(key){	//获得参数值
		var str=location.href; 
		var es=new RegExp(key + '=([^&]+)','i');
		var returnValue = es.exec(str); 
		if(returnValue==null){return ""} else {return returnValue[1]}
	}
	
	function loadLinks(Refresh){	//载入导航栏
		Refresh = Refresh;
		var url="getLinks.asp";
		new Ajax.Request(url,{  
						 method:"get",  
						 parameters:"",  
						 onCreate:function(){if(!$("box")){var msgBox=new Element('div',{'id':'box'}).update("<img src='images\/loading_16x16.gif' align='absmiddle'> 正在读取导航栏"); 
			new Insertion.Top('debuger1',msgBox);}
									var boxPosX = $("debuger1").positionedOffset().left + "px";
									var boxPosY = $("debuger1").positionedOffset().top + "px";
									$("box").setStyle({left:boxPosX,top:boxPosY,width:'200px',position:'absolute',display:'block',fontSize:'12px',fontFamily:'Verdana',color:'#777777'})
									}, 
						 onSuccess:function(e){$('site_class_list').update($('site_class_list').innerHTML + getLinkString(e.responseText,Refresh))},  
						 onFailure:function(){$('debuger1').update("<img src='images\/alarm_16x16.gif' align='absmiddle'> 导航栏读取失败!")},  
						 onComplete:function(){if($("box")){$("box").remove()}}  
							})
	}
	
	
	function getLinkString(str,Refresh){	//根据服务端返回值拼装导航栏
		str = str;
		Refresh = Refresh;
		if(str==""||str=="|")return "";
		var className = str.split("|")[0].split(",");
		var classID = str.split("|")[1].split(",");
		var onePage = str.split("|")[2].split(",");
		var hasSmallClass = str.split("|")[3].split(",");
		var returnVol = "";
		var links = "";
		var tb_width = 88;
		
		for(i=0;i<className.length;i++){
			links = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
			links = links + "    <tr>";
			links = links + "      <td width=\"3\" height=\"30\" background=\"images\/ui_r3_c6.jpg\"><\/td>";
			
			if(className[i].length>4){tb_width = 110}else{tb_width = 88}
			
			if(onePage[i]!=0){
				links = links + "      <td width=\""+ tb_width +"\" align=\"center\" onmouseover=\"this.style.background='url(images\/ui_r3_c7.jpg) no-repeat center';hideSCLBox()\" onmouseout=\"this.style.background=''\"><span><a href=\"detail.htm?id=" + onePage[i] + "\">" + className[i] + "<\/a><\/span><\/td>";
			} else {
				if(Refresh){
					if(hasSmallClass[i]!=0){	//有子分类
						links = links + "      <td width=\""+ tb_width +"\" align=\"center\" onmouseover=\"this.style.background='url(images\/ui_r3_c7.jpg) no-repeat center';getSmallClass(this,'"+ hasSmallClass[i] +"'," + classID[i] + ",1)\" onmouseout=\"this.style.background=''\"><span><a href=\"list.htm?bid=" + classID[i] + "\">" + className[i] + "<\/a><\/span><\/td>";
					} else {
						links = links + "      <td width=\""+ tb_width +"\" align=\"center\" onmouseover=\"this.style.background='url(images\/ui_r3_c7.jpg) no-repeat center';hideSCLBox()\" onmouseout=\"this.style.background=''\"><span><a href=\"list.htm?bid=" + classID[i] + "\">" + className[i] + "<\/a><\/span><\/td>";
					}
				} else {
					if(hasSmallClass[i]!=0){	//有子分类
						links = links + "      <td width=\""+ tb_width +"\" align=\"center\" onmouseover=\"this.style.background='url(images\/ui_r3_c7.jpg) no-repeat center';getSmallClass(this,'"+ hasSmallClass[i] +"'," + classID[i] + ",0)\" onmouseout=\"this.style.background=''\"><span><a href=\"javascript:void(getLists(1," + classID[i] + "))\">" + className[i] + "<\/a><\/span><\/td>";
					} else {
						links = links + "      <td width=\""+ tb_width +"\" align=\"center\" onmouseover=\"this.style.background='url(images\/ui_r3_c7.jpg) no-repeat center';hideSCLBox()\" onmouseout=\"this.style.background=''\"><span><a href=\"javascript:void(getLists(1," + classID[i] + "))\">" + className[i] + "<\/a><\/span><\/td>";
					}
				}
			}
			links = links + "    <\/tr>";
			links = links + "  <\/table>";
			returnVol = returnVol + links;
		}
		return returnVol;
	}
	
	function getLists(page,bid,sid,keywords,searchtype,continent){
		var url="getLists.asp";
		page = page; 
		sid = sid;
		keywords = keywords;	//encodeURIComponent(keywords);
		searchtype = searchtype;
		continent = continent;
		if(!page){page = 1} 
		if(!sid){sid = 0}
		var parastr="";
		if(keywords!="" && keywords){
			parastr = "page=" + page + "&bid=" + bid + "&sid=" + sid + "&keywords=" + keywords + "&searchtype=" + searchtype;
		} else {
			parastr = "page=" + page + "&bid=" + bid + "&sid=" + sid;
		}
		if(continent!="" && continent){
			parastr = parastr + "&continent=" + continent;
		}
		//document.write(parastr);
		//alert(parastr);
		new Ajax.Request(url,{  
						 method:"get",  
						 parameters:parastr,  
						 onCreate:function(){if(!$("box")){var msgBox=new Element('div',{'id':'box'}).update("<img src='images\/loading_16x16.gif' align='absmiddle'> 正在读取标题列表"); 
			new Insertion.Top('debuger1',msgBox);}
									var boxPosX = $("debuger1").positionedOffset().left + "px";
									var boxPosY = $("debuger1").positionedOffset().top + "px";
									$("box").setStyle({left:boxPosX,top:boxPosY,width:'200px',position:'absolute',display:'block',fontSize:'12px',fontFamily:'Verdana',color:'#777777'})
									}, 
						 onSuccess:function(e){
							 var responseCont = e.responseText.split("{$#BigClassName#$}");
							 var act_position = responseCont[0].split("{$#onePage#$}");
							 if(act_position[0]==1){
								 location.href = "detail.htm?id=" + act_position[1];
								 return;
							 }
							 $('title_list_tb').update(responseCont[1]);
							 $('act_position_bclass').update("&gt; " + act_position[2])
							 if(continent!="" && continent){
							 	$('act_position_bclass').update($('act_position_bclass').innerHTML + " &gt; " + continent)
							 }
							 },  
						 onFailure:function(){$('debuger1').update("<img src='images\/alarm_16x16.gif' align='absmiddle'> 标题列表读取失败!")},  
						 onComplete:function(){if($("box")){$("box").remove()}}  
							})
	}

	function getSmallClass(owner,str,bid,Refresh){
		if(!$("smallClassList")){
			var smallClassBox=new Element('div',{'id':'smallClassList'}); 
			new Insertion.Bottom(document.body,smallClassBox);
			smallClassBox.onmouseout = function(evt){
				hideSCL(evt);
			}
		}
		var boxPosX = getPosX(owner) + "px";
		var boxPosY = getPosY(owner) + owner.offsetHeight + "px";
		$("smallClassList").setStyle({left:boxPosX,top:boxPosY,padding:'5px',position:'absolute',display:'block',fontSize:'12px',fontFamily:'Verdana',backgroundColor:'#FFFFFF'});
		var listArray = str.split("/");
		var tmpList = "<table width=\"150\" border=\"0\" align=\"center\" cellpadding=\"3\" cellspacing=\"0\" style=\"border:1px solid #999999\">";
		for(var i=0;i<listArray.length;i++){
			tmpList += "<tr>";
			tmpList += "<td height=\"22\" onmouseover=\"this.style.backgroundColor='#FAFAFA'\" onmouseout=\"this.style.backgroundColor='#FFFFFF'\">";
			if(Refresh){
				tmpList += "<img src=\"images\/dot1.gif\" width=\"15\" height=\"15\" align=\"absmiddle\" \/><a href=\"list.htm?bid=" + bid + "&sid=" + listArray[i].split("-")[1] + "\">" + listArray[i].split("-")[0] + "<\/a><\/td>";
			} else {
				tmpList += "<img src=\"images\/dot1.gif\" width=\"15\" height=\"15\" align=\"absmiddle\" \/><a href=\"javascript:void(getLists(1," + bid + "," + listArray[i].split("-")[1] + "))\" onclick='hideSCLBox()'>" + listArray[i].split("-")[0] + "<\/a><\/td>";	
			}
			tmpList += "<\/tr>";
		}
		tmpList += "<\/table>";
		if(!!$("smallClassList")){
			$("smallClassList").update(tmpList);
		}
	}
	
	function hideSCL(e){	//隐藏小类列表
		try{
			if (!e) var e = window.event;
			var tg = (window.event) ? e.srcElement : e.target;
			var reltg = ((e.relatedTarget) ? e.relatedTarget : e.toElement);
			while (reltg != tg && reltg.nodeName != ((window.event) ? "BODY" : "HTML")){reltg= reltg.parentNode}
			tg = tg.id;
			reltg = reltg.id;
			if(tg!=reltg){hideSCLBox()}
		} catch(er){}
		
		//$("debuger1").update($("debuger1").innerHTML + "<br>" +tg + ","+ reltg);
		//$("debuger1").setStyle({left:"50px",top:"50px",position:"absolute"});
	}
	
	function hideSCLBox(){
		try{
			Element.hide("smallClassList");
		} catch (er){}
	}
	
	function getDetail(id){
		var url="getDetail.asp";
		id = id;  
		if(!id){id = 1} 
		//document.write(url + "?page=" + page + "&bid=" + bid);
		new Ajax.Request(url,{  
						 method:"get",  
						 parameters:"id=" + id,  
						 onCreate:function(){if(!$("box")){var msgBox=new Element('div',{'id':'box'}).update("<img src='images\/loading_16x16.gif' align='absmiddle'> 正在读取文档"); 
			new Insertion.Top('debuger1',msgBox);}
									var boxPosX = $("debuger1").positionedOffset().left + "px";
									var boxPosY = $("debuger1").positionedOffset().top + "px";
									$("box").setStyle({left:boxPosX,top:boxPosY,width:'200px',position:'absolute',display:'block',fontSize:'12px',fontFamily:'Verdana',color:'#777777'})
									}, 
						 onSuccess:function(e){var responseCont = e.responseText.split("{$#BigClassName#$}");$('detail_contents').update(responseCont[1]);$('act_position_bclass').update("&gt; " + responseCont[0])},  
						 onFailure:function(){$('debuger1').update("<img src='images\/alarm_16x16.gif' align='absmiddle'> 文档读取失败!")},  
						 onComplete:function(){if($("box")){$("box").remove()}}  
							})
	}
	
	function getIndexUnit(id){
		var url="getIndexUnit.asp";
		id = id;  
		if(!id){id = 0} 
		//document.write(url + "?page=" + page + "&bid=" + bid);
		new Ajax.Request(url,{  
						 method:"get",  
						 parameters:"id=" + id,  
						 onCreate:function(){if(!$("box")){var msgBox=new Element('div',{'id':'box'}).update("<img src='images\/loading_16x16.gif' align='absmiddle'> 正在读取首页模块"); 
			new Insertion.Top('debuger1',msgBox);}
									var boxPosX = $("debuger1").positionedOffset().left + "px";
									var boxPosY = $("debuger1").positionedOffset().top + "px";
									$("box").setStyle({left:boxPosX,top:boxPosY,width:'200px',position:'absolute',display:'block',fontSize:'12px',fontFamily:'Verdana',color:'#777777'})
									}, 
						 onSuccess:function(e){var responseCont = e.responseText;$('index_unit' + id).update(responseCont)},  
						 onFailure:function(){$('debuger1').update("<img src='images\/alarm_16x16.gif' align='absmiddle'> 首页模块读取失败!")},  
						 onComplete:function(){if($("box")){$("box").remove()}}  
							})
		
	}
	
	function getTransaction(id){
		var url="transaction.asp";
		id = id;  
		if(!id){id = 1} 
		//document.write(url + "?page=" + page + "&bid=" + bid);
		new Ajax.Request(url,{  
						 method:"get",  
						 parameters:"id=" + id,  
						 onCreate:function(){if(!$("box")){var msgBox=new Element('div',{'id':'box'}).update("<img src='images\/loading_16x16.gif' align='absmiddle'> 正在读取文档"); 
			new Insertion.Top('debuger1',msgBox);}
									var boxPosX = $("debuger1").positionedOffset().left + "px";
									var boxPosY = $("debuger1").positionedOffset().top + "px";
									$("box").setStyle({left:boxPosX,top:boxPosY,width:'200px',position:'absolute',display:'block',fontSize:'12px',fontFamily:'Verdana',color:'#777777'})
									}, 
						 onSuccess:function(e){var responseCont = e.responseText;$('detail_contents').update(responseCont);$('act_position_bclass').update("&gt; " + "业务办理进度查询")},  
						 onFailure:function(){$('debuger1').update("<img src='images\/alarm_16x16.gif' align='absmiddle'> 查询失败!")},  
						 onComplete:function(){if($("box")){$("box").remove()}}  
							})
	}
	
	function progressView(){
		if($("progressKey").value!="" && $("progressKey").value!="请输入您的查询服务号"){
			window.open('transaction.htm?id='+$('progressKey').value,'transactions');
			return false;
		}
		return false;
	}
	
	function checklogin_email(){
		if ($("user").value=="" || $("user").value=="请输入帐号名"){
			alert("请输入用户名！");
			$("user").focus();
			return false;
		}
		if ($("pass").value==""){
			alert("请输入密码！");
			$("pass").focus();
			return false;
		}
		
		return true;
     }
	 
	 function getOrderForm(){
		var url="order.asp";
		//id = id;  
		//if(!id){id = 1} 
		//document.write(url + "?page=" + page + "&bid=" + bid);
		new Ajax.Request(url,{  
						 //method:"get",  
						 //parameters:"id=" + id,  
						 onCreate:function(){if(!$("box")){var msgBox=new Element('div',{'id':'box'}).update("<img src='images\/loading_16x16.gif' align='absmiddle'> 正在读取文档"); 
			new Insertion.Top('debuger1',msgBox);}
									var boxPosX = $("debuger1").positionedOffset().left + "px";
									var boxPosY = $("debuger1").positionedOffset().top + "px";
									$("box").setStyle({left:boxPosX,top:boxPosY,width:'200px',position:'absolute',display:'block',fontSize:'12px',fontFamily:'Verdana',color:'#777777'})
									}, 
						 onSuccess:function(e){var responseCont = e.responseText;$('detail_contents').update(responseCont);$('act_position_bclass').update("&gt; " + "预约申请")},  
						 onFailure:function(){$('debuger1').update("<img src='images\/alarm_16x16.gif' align='absmiddle'> 读取失败!")},  
						 onComplete:function(){if($("box")){$("box").remove()}}  
							})
	}
	
	function checkOrderSubmit(){	//申请提交表单检查
		if($("servicetype").value==0){
			alert("请选择申请类型");
			$("servicetype").focus();
			return false;
		}
		if($("customer").value==""){
			alert("请留下您的姓名");
			$("customer").focus();
			return false;
		}
		if($("telephone").value==0){
			alert("请留下联系电话");
			$("telephone").focus();
			return false;
		}
		if($("email").value==0){
			alert("请留下您的email地址");
			$("email").focus();
			return false;
		}
		
		submitOrder();
		return false;
	}
	
	function submitOrder(){
		var url="order.asp";
		//id = id;  
		//if(!id){id = 1} 
		//document.write(url + "?page=" + page + "&bid=" + bid);
		var parastr="";
		parastr += "servicetype="+ $("servicetype").value;
		parastr += "&servicename="+ $("servicetype").options[$("servicetype").selectedIndex].text;
		parastr += "&customer="+ $("customer").value;
		parastr += "&telephone="+ $("telephone").value;
		parastr += "&contacts="+ $("contacts").value;
		parastr += "&email="+ $("email").value;
		parastr += "&notes="+ $("notes").value;
		parastr += "&action=submitorder";
		new Ajax.Request(url,{  
						 method:"post",  
						 parameters:parastr,  
						 onCreate:function(){if(!$("box")){var msgBox=new Element('div',{'id':'box'}).update("<img src='images\/loading_16x16.gif' align='absmiddle'> 正在提交申请"); 
			new Insertion.Top('debuger1',msgBox);}
									var boxPosX = $("debuger1").positionedOffset().left + "px";
									var boxPosY = $("debuger1").positionedOffset().top + "px";
									$("box").setStyle({left:boxPosX,top:boxPosY,width:'200px',position:'absolute',display:'block',fontSize:'12px',fontFamily:'Verdana',color:'#777777'})
									}, 
						 onSuccess:function(e){var responseCont = e.responseText;if(responseCont.substring(0,3)=="err"){$('submitResults').update(responseCont.replace("err",""))}else{$('detail_contents').update(responseCont)};$('act_position_bclass').update("&gt; " + "预约申请")},  
						 onFailure:function(){$('debuger1').update("<img src='images\/alarm_16x16.gif' align='absmiddle'> 提交失败!")},  
						 onComplete:function(){if($("box")){$("box").remove()}}  
							})
	}
	
	function getMsgboardForm(page){
		var url="Messageboard.asp";
		page = page;  
		if(!page){page = 1} 
		//document.write(url + "?page=" + page + "&bid=" + bid);
		new Ajax.Request(url,{  
						 method:"get",  
						 parameters:"page=" + page,  
						 onCreate:function(){if(!$("box")){var msgBox=new Element('div',{'id':'box'}).update("<img src='images\/loading_16x16.gif' align='absmiddle'> 正在读取文档"); 
			new Insertion.Top('debuger1',msgBox);}
									var boxPosX = $("debuger1").positionedOffset().left + "px";
									var boxPosY = $("debuger1").positionedOffset().top + "px";
									$("box").setStyle({left:boxPosX,top:boxPosY,width:'200px',position:'absolute',display:'block',fontSize:'12px',fontFamily:'Verdana',color:'#777777'})
									}, 
						 onSuccess:function(e){var responseCont = e.responseText;$('detail_contents').update(responseCont);$('act_position_bclass').update("&gt; " + "留言板")},  
						 onFailure:function(){$('debuger1').update("<img src='images\/alarm_16x16.gif' align='absmiddle'> 读取失败!")},  
						 onComplete:function(){if($("box")){$("box").remove()}}  
							})
	}
	
	function checkMessageSubmit(){	//申请提交表单检查
		if($("title").value==0){
			alert("请填写留言标题");
			$("title").focus();
			return false;
		}
		if($("notes").value==""){
			alert("请填写留言内容");
			$("notes").focus();
			return false;
		}
		if($("customer").value==0){
			alert("请填写您的姓名");
			$("customer").focus();
			return false;
		}
		if($("telephone").value==0){
			alert("请留下您联系电话");
			$("telephone").focus();
			return false;
		}
		if($("email").value==0){
			alert("请留下您的email地址");
			$("email").focus();
			return false;
		}
		
		submitMessage();
		return false;
	}
	
	function submitMessage(){
		var url="messageboard.asp";
		//id = id;  
		//if(!id){id = 1} 
		//document.write(url + "?page=" + page + "&bid=" + bid);
		var parastr="";
		parastr += "title="+ $("title").value;
		parastr += "&notes="+ $("notes").value;
		parastr += "&customer="+ $("customer").value;
		parastr += "&telephone="+ $("telephone").value;
		parastr += "&contacts="+ $("contacts").value;
		parastr += "&email="+ $("email").value;
		parastr += "&action=submitmessage";
		new Ajax.Request(url,{  
						 method:"post",  
						 parameters:parastr,  
						 onCreate:function(){if(!$("box")){var msgBox=new Element('div',{'id':'box'}).update("<img src='images\/loading_16x16.gif' align='absmiddle'> 正在提交留言"); 
			new Insertion.Top('debuger1',msgBox);}
									var boxPosX = $("debuger1").positionedOffset().left + "px";
									var boxPosY = $("debuger1").positionedOffset().top + "px";
									$("box").setStyle({left:boxPosX,top:boxPosY,width:'200px',position:'absolute',display:'block',fontSize:'12px',fontFamily:'Verdana',color:'#777777'})
									}, 
						 onSuccess:function(e){var responseCont = e.responseText;if(responseCont.substring(0,3)=="err"){$('submitResults').update(responseCont.replace("err",""))}else{alert("您的留言已成功提交!");document.documentElement.scrollTop=0;getMsgboardForm()};$('act_position_bclass').update("&gt; " + "留言板")},  
						 onFailure:function(){$('debuger1').update("<img src='images\/alarm_16x16.gif' align='absmiddle'> 提交失败!")},  
						 onComplete:function(){if($("box")){$("box").remove()}}  
							})
	}
	
	var lastselectedvisatype=0;	//搜索表格
	function selectvisatype(id){
		id=id;
		if(id!=lastselectedvisatype){
			$("visatype" + lastselectedvisatype).className = "visa_type_list_1";
			$("visatype" + id).className = "visa_type_list_2";
			lastselectedvisatype = id;
			$("visaServiceType").value = id;
		}
	}
	
	function checkDownload(){	//检查搜索
		if($("download_search").value=="国家名" || $("download_search").value==""){alert("请填写国家名!");$("download_search").focus();return false}
	}
	
	function getpageBottom(){		//获得页面最底端资料
		var url="webconfig.asp";
		//id = id;  
		//if(!id){id = 1} 
		//document.write(url + "?page=" + page + "&bid=" + bid);
		var parastr="";
		new Ajax.Request(url,{  
						 method:"post",  
						 parameters:parastr,  
						 onCreate:function(){if(!$("box")){var msgBox=new Element('div',{'id':'box'}).update("<img src='images\/loading_16x16.gif' align='absmiddle'> 正在读取页面底端"); 
			new Insertion.Top('debuger1',msgBox);}
									var boxPosX = $("debuger1").positionedOffset().left + "px";
									var boxPosY = $("debuger1").positionedOffset().top + "px";
									$("box").setStyle({left:boxPosX,top:boxPosY,width:'200px',position:'absolute',display:'block',fontSize:'12px',fontFamily:'Verdana',color:'#777777'})
									}, 
						 onSuccess:function(e){var responseCont = e.responseText.split("{$#webconfig#$}");$("bottomLinks").update(responseCont[0]);$("pageFoot").update(responseCont[1]);},  
						 onFailure:function(){$('debuger1').update("<img src='images\/alarm_16x16.gif' align='absmiddle'> 读取失败!")},  
						 onComplete:function(){if($("box")){$("box").remove()}}  
							})
	}
