// JavaScript Document
jQuery(function($){
$("#tab1").mouseover(function(){
	$("#tab2").attr( "class","indextab2" );
	$("#tab1").attr( "class","indextab1" );
	$(".tab1").css("display", "block");
	$(".tab2").css("display", "none");
	//alert("."+$(this));
	
})
$("#tab2").mouseover(function(){	
	$("#tab2").attr("class" ,"indextab1" );
	$("#tab1").attr("class" ,"indextab2" );
	$(".tab2").css("display", "block");
	$(".tab1").css("display", "none");
	//$("."+$(this).css("display", "block"));
})

})
function menus(divid)
{
   //   alert('bbbb');

   $("#"+ divid).mouseover(function(){
   $(".navbar  div").css("display","none");
   $(".fastnav,.lastnav").attr("class","lastnav");
  // $("#"+ divid).addClass("lastnav1");
    $("."+ divid).css("display","block");
   ;})   
}
function menuout(divid)
{
    // alert('aaa');

  $("."+ divid).css("display","none");
  
}
///
function ajax(vid)

{
 	if(!vid)
	{
		//alert("请您选择科室")
	}
	else
	{
	XMLHttp.sendReq('GET', '/ajax/x.aspx?id='+vid, '', function (obj) { document.getElementById("th").innerHTML = obj.responseText });
	}
}
//
//
function onselec()
{
	var k=document.getElementById('keyword').value;
	if(k=="")
	{
		alert('请您输入关键词!')
	}
	else
	{
		window.location.href="/search.aspx?k="+k;	
	}
}
function Onsumbit()
{
   //alert("aaaaa");
   var mydate=document.getElementById("mydate").value;
   var ksname=document.getElementById("ksname").value;
   var ksmingc=document.getElementById("ksmingc").value;
   if(mydate=="")
   {
		alert("请您选择日期！")
		
   }
   else if(ksname=="0")
   {
		alert("请您选择科室名称！")   
   }
   else if(ksmingc=="0")
   {
		alert("请您选择专家！")   
   }
   else
   {
		//alert(ksmingc)
		window.location.href="/cn/search.aspx?id="+ksmingc;
   }
   

}
//
function ajaxSubmit()
{
	document.getElementById("but1").disabled="disabled";
	document.getElementById("but1").value="正在提交中...请稍后...";
	var myname=document.getElementById("name");
	var mysex=document.getElementById("sex");
	var myage=document.getElementById("age");
	var mytel=document.getElementById("tel");
	var myworkdd=document.getElementById("workdd");
	var myybkid=document.getElementById("ybkid");
	var mysfzid=document.getElementById("sfzid");
	var mytsqklxr=document.getElementById("tsqklxr");
	var mytel2=document.getElementById("tel2");
	var myyyks=document.getElementById("yyks");
	var myyyzjname=document.getElementById("yyzjname");
	var myyyjzdate=document.getElementById("yyjzdate");
	var mytbdata=document.getElementById("tbdata");
	var checkcode=document.getElementById("checkcode");
	
	
	if(myname.value=="")
	{
		alert("请填写姓名!");
		//myname.focus();
		myname.focus();
		document.getElementById("but1").disabled="";
		document.getElementById("but1").value="  提交  ";
	}
	else if(mysex.value=="")
	{
		alert("请您选择性别!")	
		mysex.focus();
		document.getElementById("but1").disabled="";
		document.getElementById("but1").value="  提交  ";
	}
	else if(myage.value=="")
	{
		alert("请输入您的年龄!")	
		myage.focus();
		document.getElementById("but1").disabled="";
		document.getElementById("but1").value="  提交  ";
	}
	else if(mytel.value=="")
	{
		alert("请输入联系电话!")	
		mytel.focus();
		document.getElementById("but1").disabled="";
		document.getElementById("but1").value="  提交  ";
	}	
	
	
	else if(mysfzid.value=="")
	{
		alert("请输入您的身份证号!")	
		mysfzid.focus();
		document.getElementById("but1").disabled="";
		document.getElementById("but1").value="  提交  ";
	}	
	else if(myyyks.value=="")
	{
		alert("请输入预约科室!")	
		myyyks.focus();
		document.getElementById("but1").disabled="";
		document.getElementById("but1").value="  提交  ";
	}	
	else if(myyyjzdate.value=="")
	{
		alert("请输入预约就诊日期!")	
		myyyjzdate.focus();
		document.getElementById("but1").disabled="";
		document.getElementById("but1").value="  提交  ";
	}	
	else if(trim(checkcode.value)=="")
	{
		alert("请输入验证码!");	
		checkcode.focus();
		document.getElementById("but1").disabled="";
		document.getElementById("but1").value="  提交  ";
	}
	else
	{
		//alert(myname);
		var savedata="myname="+myname.value+"&mysex="+mysex.value+"&myage="+myage.value+"&mytel="+mytel.value+"&myworkdd="+myworkdd.value+"&myybkid="+myybkid.value+"&mysfzid="+mysfzid.value+"&mytsqklxr="+mytsqklxr.value+"&mytel2="+mytel2.value+"&myyyks="+myyyks.value+"&myyyzjname="+myyyzjname.value+"&myyyjzdate="+myyyjzdate.value+"&mytbdata="+mytbdata.value+"&checkcode="+checkcode.value;
		  XMLHttp.sendReq('POST', '/Savevip.aspx',savedata,function(obj){
																	var state=obj.responseText
																	if(state=="yes")
																	{
																		alert("提交成功!");
																		window.location=("/cn/");
																	}
																	else
																	{
	document.getElementById("but1").disabled="";
	document.getElementById("but1").value="提  交";
	alert(state.replace("cw|",""));
																	}
																		
																	});
		
	}
	
	
	
}
