﻿// JavaScript Document
function hg(x)
	{
	  for(t=1;t<4;t++)
		{
		 document.getElementById("dq_nr"+t).style.display="none";
		 document.getElementById("v"+t).style.background="url(images/service_new/b2.jpg)";
		}
		document.getElementById("dq_nr"+x).style.display="";
		document.getElementById("v"+x).style.background="url(images/service_new/b1.jpg)";
	}

function hx(x)
	{
	  for(t=1;t<3;t++)
		{
		 document.getElementById("lbx"+t).style.display="none";
		 document.getElementById("q"+t).style.background="url(image/zh2.jpg) no-repeat bottom";
		 document.getElementById("q"+t).style.color="#000000";
		}
		document.getElementById("lbx"+x).style.display="";
		document.getElementById("q"+x).style.background="url(image/zh1.jpg)";
		document.getElementById("q"+x).style.color="#ffffff";
	}


function hk(x)
	{
	  for(t=1;t<4;t++)
		{
		 document.getElementById("lx_nr"+t).style.display="none";
		 document.getElementById("r"+t).style.background="url(image/js_bg2.jpg)";
		}
		document.getElementById("lx_nr"+x).style.display="";
		document.getElementById("r"+x).style.background="url(image/js_bg1.jpg)";
	}

//exhinfo.asp页面头部切换
function zh(x)
	{
	  for(t=1;t<4;t++)
		{
		 document.getElementById("zh_flnr"+t).style.display="none";
		 document.getElementById("p"+t).style.background="url(image/in_bg2.jpg)";
		}
		document.getElementById("zh_flnr"+x).style.display="block";
		document.getElementById("p"+x).style.background="url(image/in_bg1.jpg)";
	}	
	
	
function px(x)
	{
	  for(t=1;t<7;t++)
		{
		 document.getElementById("pld"+t).style.display="none";
		 document.getElementById("c"+t).style.background="url(image/fw_bg2.jpg)";
		}
		document.getElementById("pld"+x).style.display="block";
		document.getElementById("c"+x).style.background="url(image/fw_bg3.jpg)";
	}		

function zk(x)
	{
	  for(t=1;t<3;t++)
		{
		 document.getElementById("bg_flnr"+t).style.display="none";
		 document.getElementById("k"+t).style.background="url(image/in_bg2.jpg)";
		}
		document.getElementById("bg_flnr"+x).style.display="block";
		document.getElementById("k"+x).style.background="url(image/in_bg1.jpg)";
	}		
function qk(x)
{
	for(t=1;t<3;t++)
	{
	 document.getElementById("jiejue_nr"+t).style.display="none";
	 document.getElementById("qe"+t).style.background="url(image/qu_bt1.jpg)";
	}
	document.getElementById("jiejue_nr"+x).style.display="";
	document.getElementById("qe"+x).style.background="url(image/qu_bt2.jpg)";
}
//展会城市切换
function showcity(i)
{
//	alert($("#swcity"+i).html());
	$(".swcitym>li").removeClass("on");
	$(".swcitym>li").eq(i).addClass("on");
	$(".swcity").css("display","none");
	$("#swcity"+i).css("display","block");
}

//按键盘回车提交账户密码
function keynvgsearch(event,i){
	if(event.keyCode==13){
		nvgsearch(i);
		}
	}
//导航搜索
function nvgsearch(x)
{
	if(x==0)	
	{
			document.getElementById("searchf").action="searchlist.asp";
	}
	if(x==1)	
	{
			document.getElementById("searchf").action="service_list.asp";
	}
	if(x==2)	
	{
			document.getElementById("searchf").action="exhplace.html";
	}
	if(x==7)	
	{
			document.getElementById("searchf").action="overseasexhibition.html";
	}
	searchf.submit();
}
//显示相应的搜素菜单  删除没有用到的菜单
function showsearchdiv(x)
{
	$(".search").each(function(){
		var thisid	=	this.id;
		if (thisid!="search"+x){
			$("#"+thisid).remove();
			}
		});
	$("#search"+x).css("display","block");	
}

//展会服务机票、酒店。。。预定
function yd(x)
	{
	  for(t=1;t<3;t++)
		{
		 document.getElementById("jp_fs"+t).style.display="none";
		 document.getElementById("z"+t).style.background="url(image/jp_bg.jpg)";
		}
		document.getElementById("jp_fs"+x).style.display="block";
		document.getElementById("z"+x).style.background="url(image/jp_bg2.jpg)";
	}
function tq(x)
	{
	  for(t=1;t<3;t++)
		{
		 document.getElementById("tq"+t).style.display="none";
		 document.getElementById("b"+t).style.background="url(image/jp_bg.jpg)";
		}
		document.getElementById("tq"+x).style.display="block";
		document.getElementById("b"+x).style.background="url(image/jp_bg2.jpg)";
	}

//按键盘回车提交账户密码
function keyuserlogin(event,i){
	if(event.keyCode==13){
		userlogin(i);
		}
	}
//ajax 用户登录验证
	function userlogin(i)
	{
		var today = new Date();
		var username=$("#username"+i).val();
		var password=$("#password"+i).val();
		if (username=="")
		{
			alert("请输入用户名！");	
			$("#username"+i).focus();
			return false;
		}
		if (password=="")
		{
			alert("请输入密码！");	
			$("#password"+i).focus();
			return false;
		}
		$.get("../hzh_login.asp?username="+escape(username)+"&password="+escape(password)+"&dat="+today.getTime(),function(data,textStatus){
			if (data=="error"){
				alert("您输入的账号或密码有误！");
				$("#password"+i).focus();
				return false;
				}
				else
				{
				$("#login").html(data);
				}
			}); 
		var urls = 'http://www.haozhanhui.com/Service/EfCompany/Service/RegSession.aspx?dt='+today.getTime()
		$.get(urls);
	}

//判断登录状态
function loginStatus(){
		var today = new Date();
		$.ajax({ 
		type: "get", 
		url : "../login.asp", 
		dataType:'html',
		data: 'type=5&dat='+today.getTime(),
		success: function(data,textStatus){
			if (data!="error"){
				$("#login").html(data);
				}
			}
		 });
	}
		
$(document).ready(function(){ 
		loginStatus();
	})		

function Currentnavigation(i)
{
	$("#nav>ul>li").eq(i).addClass("sy")
}
//火车时刻信息查询
function trainInfo(theform)
{
//		var today = new Date();
//		var startStation	=	$("#startStation").val();
//		var arriveStation	=	$("#arriveStation").val();
//		var date	=	$("#date").val();
//		var trainCode	=	$("#trainCode").val();
//		var urls = "http://www.zl07.cn/labs/trainInfo/search.php?startStation="+startStation+"&arriveStation="+arriveStation+"&date="+date+"&trainCode="+trainCode+"&dataFormat=split&dat="+today.getTime();//json
//		alert(urls);
//		$.get(urls,function(data,textStatus){
//			alert(data);
//			}); 
	theform.action="http://open.baidu.com/train/search.php?wd="+escape("列车时刻表")+"&act=station&s1="+escape("北京")+"&s2="+escape("上海");
	theform.submit();
}
//服务留言提交
function cheakform(theform){
	if(theform.MsgContent.value=="")
	{ 
		alert("请填写您的留言内容！");
		theform.MsgContent.focus();
		return false; 
	}
	if(theform.MsgContent.value.length>190)
	{ 
		alert("您留言的内容太多了！");
		theform.MsgContent.focus();
		return false; 
	}
	Sends('messageAdd','message_function.asp?Type=2',0,'',1,0,'Boxs','message_function.asp?Type=2');
	$('#Boxs').hide();
	return true;
}

function ebuCountdown(ebuid,Ebuetime)
{
//	alert(Ebuetime);
	var today = new Date()							
	var endtime =	new Date(Ebuetime);
	var timediff=endtime.getTime()-today.getTime();
	var days	=	timediff/1000/60/60/24; //天
	var daysRound	=	Math.floor(days);
	var hours = timediff/1000/60/60 - (24*daysRound);
	var hoursRound	=	Math.floor(hours);
	var minutes = timediff/1000/60 - (24*60*daysRound)-(60*hoursRound);
	var minutesRound	=	Math.floor(minutes);
	var seconds = timediff/1000 - (24*60*60*daysRound)-(60*60*hoursRound)-(60*minutesRound); 
	var secondsRound	=	Math.floor(seconds);
	$("#day"+ebuid).html(daysRound);
	if (hoursRound<10)
	{
		hoursRound	=	'0'+hoursRound;
	}
	if (minutesRound<10)
	{
		minutesRound	=	'0'+minutesRound;
	}
	if (secondsRound<10)
	{
		secondsRound	=	'0'+secondsRound;
	}
	$("#time"+ebuid).html(hoursRound+":"+minutesRound+":"+secondsRound);
}

function exhauction(showtype,ebuid,exhid,myprice,Ebuprice)
{
	var Ebjprice = $("#myprice"+ebuid).val();//这里是从输入框中得到的
	if (Ebjprice<myprice||Ebjprice>Ebuprice)
	{
		alert("您的出价范围必须在当前叫价"+myprice+"和市场价"+Ebuprice+"之间！");
		$("#myprice"+ebuid).focus();
		$("#myprice"+ebuid).select();
		return false;
	}
		var today = new Date();
		var urls = '../buy/exhbuy.asp?exhid='+exhid+'&ebuid='+ebuid+'&action=1&dt='+today.getTime()
		$.get(urls,{Ebjprice:Ebjprice},
			function(data,textStatus){
				if(data=="0"){
					alert("请您登录之后再参与竞拍！");
					$("#username1").focus();
					return false;
				}
				if(data=="2"){
					var dlg = new J.ui.dialog({ id: 'sms', title:'手机短信验证', fixed:true,page: '../user/smscheck.asp?action=1',width:500, height:300,btns:false });
					dlg.ShowDialog();	
					//alert("只有通过手机认证的会员才能参加竞拍活动！您可以到“个人中心”--“个人资料修改”进行手机认证！");
					return false;
				}
				if(data.indexOf("######")>0){
					var temp	=	data.split("######");
					alert("当前叫价已经小于本竞拍展会的当前价格"+temp[1]+"！");
					$("#myprice"+ebuid).select();
					return false;
				}
				if(data=="888"){
					alert("您叫价成功！");
					//把新的竞拍内容更新过来
					$.get("../buy/exhbuy.asp?showtype="+showtype+"&ebuid="+ebuid+"&action=8&dt="+today.getTime(),function(data,textStatus){
						$("#ebuid"+ebuid).html(data);
						});
				}
			}		
		);	

}

function showexhgroupbuy(ebuid,exhid)
{
	var today = new Date();
	var urls = '../buy/exhbuy.asp?action=7&dt='+today.getTime()
	$.get(urls,
		function(data,textStatus){
			if(data==""||data=="0"){
				alert("请您登录之后再参与团购！");
			}
			else
			{
				var dlg = new J.ui.dialog({ id: 'groupbuy', title:'组团参展申请', fixed:true,page: 'buy/exhbuy.asp?action=2&exhid='+exhid+'&ebuid='+ebuid,width:450, height:370,btns:false });
				dlg.ShowDialog();	
			}
		}		
	);	
}