//-------------添加反馈信息表单---------------
function checkFeedbackFrom(theForm)
	{
		if (theForm.feedBody.value =="")
		{
			alert("您的建议和意见不能为空!");
			theForm.feedBody.focus();
			return (false);
		}
	  return (true);
	}

//-----------添加留言表单---------------
function checkGetBbsFrom(theForm)
	{
		if (theForm.uNameBbs.value =="")
		{
			alert("姓名不能为空,请重新输入!");
			theForm.uNameBbs.focus();
			return (false);
		}
			if (theForm.xxTel.value =="")
		{
			alert("联系电话不能为空,请重新输入!");
			theForm.xxTel.focus();
			return (false);
		}
			if (theForm.contentBbs.value =="")
		{
			alert("回复内容不能为空,请重新输入!");
			theForm.contentBbs.focus();
			return (false);
		}
		if (theForm.passcode.value =="")
		{
			alert("验证码不能为空,请重新输入!");
			theForm.passcode.focus();
			return (false);
		}
	  return (true);
	}
	
	
//-----------前台添加信息表单---------------
function checkGetXxStFrom(theForm)
	{	
		if (theForm.cId.value =="")
		{
			alert("请选择类别!");
			return (false);
		}
		if (theForm.xxTitle.value =="")
		{
			alert("请输入信息标题!");
			theForm.xxTitle.focus();
			return (false);
		}
		if(theForm.xxTitle.value.length <0 || theForm.xxTitle.value.length > 100)
		{ 
         alert("信息标题长度应为0－100个字符，请重新输入！"); 
         theForm.xxTitle.focus(); 
         return false; 
        } 
		if (theForm.xxContent.value =="")
		{
			alert("请输入信息内容!");
			theForm.xxContent.focus();
			return (false);
		}
		if (theForm.xxContact.value =="")
		{
			alert("联系人不能为空,请重新输入!");
			theForm.xxContact.focus();
			return (false);
		}
		if(theForm.xxContact.value.length <0 || theForm.xxContact.value.length > 40)
		{ 
         alert("联系人长度应为0－40个字符，请重新输入！"); 
         theForm.xxContact.focus(); 
         return false; 
        } 
		if (theForm.xxAddress.value =="")
		{
			alert("请留下您的联系地址!");
			theForm.xxAddress.focus();
			return (false);
		}
		if (theForm.xxTelephone.value =="")
		{
			alert("请留下您的联系电话!");
			theForm.xxTelephone.focus();
			return (false);
		}
		 if (theForm.email.value.length > 0 && !theForm.email.value.match( /^.+@.+$/ ) ) {
     		alert("EMAIL 错误！请重新输入");
   		 	theForm.email.focus(); 
  			return false;
		 }
		 if (theForm.users.value =="")
		{
			alert("用户名不能为空,请您好重新输入!");
			theForm.users.focus();
			return (false);
		}
		 if (theForm.password.value =="")
		{
			alert("密码不能为空，请您重新输入!");
			theForm.password.focus();
			return (false);
		}
		 if (theForm.password2.value =="")
		{
			alert("请您再次输入密码!");
			theForm.password2.focus();
			return (false);
		}
		 if (theForm.passcode.value =="")
		{
			alert("验证码不能为空!");
			theForm.passcode.focus();
			return (false);
		}
	  return (true);
	}
	
	
//------------判断浏览器--------------
function createXMLHttpRequest(){
	var xmlHttp;
	if(window.ActiveXObject)   //判断是否是WINDOW浏览器
	{
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if(window.XMLHttpRequest)
	{
		xmlHttp = new XMLHttpRequest();
	}
	return xmlHttp;
}
//-------------更新前台举报信息----------------
function checkNumber(divName,xxId,filedTrue,filedName) {
	var oxmlHttp = createXMLHttpRequest();                  //判断是什么浏览器  
	oxmlHttp.open("get","../../../updateNumber.php?xxId="+xxId+"&filedName="+filedName+"",true);         //把kind参数传递到a2.php文件
	oxmlHttp.onreadystatechange = function(){          
		if(oxmlHttp.readyState == 4)                        //4表示所有数据都已经收到，连接关闭
		{
			if(oxmlHttp.status == 200)                      //200总是确保响应的状态
			{ 
			
			alert("谢谢您对平南通网站的支持,您提供的建议我们尽快处理!");
			}
			
			else{
				alert("数据失败,请和技术员联系：" + oxmlHttp.statusText);
			}
		}
		
	} 
	oxmlHttp.send(null);
}




//-----------------前台检查用户登陆------------------
function checkMembers(xUserLogin,passLogin,uId,membersDiv,xxId,authinput,yzm){
	if (xUserLogin=="") {
		alert("用户名不能为空!");
	}else if (passLogin==""){
		alert("密码不能为空!");
	}else if (authinput==""){
		alert("验证码不能为空!");
		}else{
		var oxmlHttp = createXMLHttpRequest();                  //判断是什么浏览器  
		oxmlHttp.open("get","../../../checkMember.php?xxId="+xxId+"&xUserLogin="+xUserLogin+"&passLogin="+passLogin+"&uId="+uId+"&authinput="+authinput+"&yzm="+yzm+"",true);         //把kind参数传递到a2.php文件
		oxmlHttp.onreadystatechange = function(){          
			if(oxmlHttp.readyState == 4)                        //4表示所有数据都已经收到，连接关闭
			{
				if(oxmlHttp.status == 200)                      //200总是确保响应的状态
				{ 
				//document.getElementById(membersDiv).innerHTML = oxmlHttp.responseText;
					if ((oxmlHttp.responseText)=="dd"){
						alert("验证码错误,请重新输入.");
					}else if((oxmlHttp.responseText)=="a") {
						alert("用户名或密码错误,请重新输入.");
					}else if((oxmlHttp.responseText)=="b1") {
						alert("你的浏览次数已够,如有疑问,请和管理员联系.");	
					}else if((oxmlHttp.responseText)=="b2"){
						alert("你今天的浏览次数已够,如有疑问,请和管理员联系.");
					}else if((oxmlHttp.responseText)=="b3"){
						alert("你的用户已到期,如有疑问,请和管理员联系.");
					}else{
						
						//alert(oxmlHttp.responseText);
						//var pic = (oxmlHttp.responseText);
						//document.getElementById(membersDiv).innerHTML = oxmlHttp.responseText;
						document.getElementById(membersDiv).innerHTML = (oxmlHttp.responseText);
					}
					
				
				}
			
			} 
		}
		oxmlHttp.send(null);
	}
	
}

//----------图片比例缩放----------------
function DrawImage(ImgD,imgwith,imgheight){ 
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.width>0 && image.height>0){ 
		flag=true; 
		if(image.width/image.height>= imgwith/imgheight){ 
			if(image.width>imgwith){ 
				ImgD.width=imgwith; 
				ImgD.height=(image.height*imgwith)/image.width; 
			}else{ 
				ImgD.width=image.width; 
				ImgD.height=image.height; 
			}
		} 
		else{ 
			if(image.height>imgheight){ 
				ImgD.height=imgheight; 
				ImgD.width=(image.width*imgheight)/image.height; 
			}else{ 
				ImgD.width=image.width; 
				ImgD.height=image.height; 
			} 
		} 
	} 
}

//--------------判断信息是否重复------------
function checkxxRepeat(xxTitle,xxTelephone,xxAddress,divName) {
	if (xxTitle==""){
		alert("信息标题不能为空，请您先输入信息标题!");
	return false;
	}
	if (xxTelephone==""){
		alert("联系电话不能为空，请您先输入联系电话!");
	return false;
	}
	if (xxAddress==""){
		alert("联系地址不能为空，请您先输入联系地址!");
	return false;
	}
	var oxmlHttp = createXMLHttpRequest();                  //判断是什么浏览器  
	oxmlHttp.open("get","checkxxRepeat.php?xxTitle="+xxTitle+"&xxTelephone="+xxTelephone+"&xxAddress="+xxAddress+"",true);         //把kind参数传递到a2.php文件
	oxmlHttp.onreadystatechange = function(){          
		if(oxmlHttp.readyState == 4)                        //4表示所有数据都已经收到，连接关闭
		{
			if(oxmlHttp.status == 200)                      //200总是确保响应的状态
			{ 
			//alert(oxmlHttp.responseText);
			//document.getElementById(divName).innerHTML=(oxmlHttp.responseText);
				if (oxmlHttp.responseText == "no") {
					alert("请注意！！！您输入的信息已经重复，不能再添加！");javascript:window.history.go(0);
				}
			}
			else{
				alert("检查用户失败,请和技术员联系：" + oxmlHttp.statusText);
			}
		}
		
	} 
	oxmlHttp.send(null);
}


//------------点击复制网页信息编号----------------
function copyText(obj)  
{ 
var rng = document.body.createTextRange(); 
rng.moveToElementText(obj); 
rng.scrollIntoView(); 
rng.select(); 
rng.execCommand("Copy"); 
alert("已复制好本条信息编号，可贴粘。"); 
rng.collapse(false);} 


//------------检测前台发布用户名--------------
function checkxxUsersValue(tableName,filedName,filedValue,divName) {
	var oxmlHttp = createXMLHttpRequest();                  //判断是什么浏览器  
	oxmlHttp.open("get","checkxxUser.php?tableName="+tableName+"&filedName="+filedName+"&filedValue="+filedValue+"",true);         //把kind参数传递到a2.php文件
	oxmlHttp.onreadystatechange = function(){          
		if(oxmlHttp.readyState == 4)                        //4表示所有数据都已经收到，连接关闭
		{
			if(oxmlHttp.status == 200)                      //200总是确保响应的状态
			{ 
				if (oxmlHttp.responseText == "no") {
					document.getElementById(divName).innerHTML="<font color=red>对不起，该用户名已被使用,请您重新输入!</font>";
				}else{
					document.getElementById(divName).innerHTML="您好，该用户名可以正常使用!";	
				}
				
			}
			else{
				alert("检查用户失败,请和技术员联系：" + oxmlHttp.statusText);
			}
		}
		
	} 
	oxmlHttp.send(null);
}

//------------检测前台发布密码--------------
function checkpwdsValue(pwdsValue,filedValue,divName) {
	var oxmlHttp = createXMLHttpRequest();                  //判断是什么浏览器  
	oxmlHttp.open("get","checkPwds.php?pwdsValue="+pwdsValue+"&filedValue="+filedValue+"",true);         //把kind参数传递到a2.php文件
	oxmlHttp.onreadystatechange = function(){          
		if(oxmlHttp.readyState == 4)                        //4表示所有数据都已经收到，连接关闭
		{
			if(oxmlHttp.status == 200)                      //200总是确保响应的状态
			{ 
				if (oxmlHttp.responseText == "no") {
					document.getElementById(divName).innerHTML="<font color=red>对不起，您两次输入的密码不相同,请您重新输入!</font>";
				}else{
					document.getElementById(divName).innerHTML="您好，您输入的两次密码相同，可以继续添加!";	
				}
				
			}
			else{
				alert("检查用户失败,请和技术员联系：" + oxmlHttp.statusText);
			}
		}
		
	} 
	oxmlHttp.send(null);
}


//-----------自主修改信息用户登陆---------------
function checkxxUsersFrom(theForm)
	{
		if (theForm.xxLogin.value =="")
		{
			alert("用户名不能为空,请您重新输入!");
			theForm.xxLogin.focus();
			return (false);
		}
			if (theForm.xxPwds.value =="")
		{
			alert("密码不能为空,请您重新输入!");
			theForm.xxPwds.focus();
			return (false);
		}
			if (theForm.passcode.value =="")
		{
			alert("验证码不能为空,请您重新输入!");
			theForm.passcode.focus();
			return (false);
		}
	  return (true);
	}
	
	
//-----------自主修改信息页面添加对接信息---------------
function checkxxFaFrom(theForm)
	{
		if (theForm.xxNumber.value =="")
		{
			alert("信息编号不能为空,请您重新输入!");
			theForm.xxNumber.focus();
			return (false);
		}
	  return (true);
	}
	
//-------------前台登陆用户粘贴------------------
function getId(objId) { 
	return document.getElementById(objId); 
} 
function paste(objid) { 
	var obj=getId(objid); 
	var clipboard = window.clipboardData.getData('Text'); 
	clipboard == null ? alert('请您先复制再进行粘贴！') : obj.value = clipboard; 
} 

	
//------------检测前台个人用户卡号验证--------------
function checkxxCardLogin(filedValue,divName) {
	var oxmlHttp = createXMLHttpRequest();                  //判断是什么浏览器  
	oxmlHttp.open("get","checkxxCardLogin.php?filedValue="+filedValue+"",true);         //把kind参数传递到a2.php文件
	oxmlHttp.onreadystatechange = function(){          
		if(oxmlHttp.readyState == 4)                        //4表示所有数据都已经收到，连接关闭
		{
			if(oxmlHttp.status == 200)                      //200总是确保响应的状态
			{ 
				if (oxmlHttp.responseText == "no") {
					document.getElementById(divName).innerHTML="<font color=red>对不起，该卡号无效！</font>";
				}else if(oxmlHttp.responseText == "c"){
					document.getElementById(divName).innerHTML="<font color=red>对不起，该卡号被停用！</font>";	
				}else if (oxmlHttp.responseText == "b"){
					document.getElementById(divName).innerHTML="<font color=red>对不起，该卡号被锁定！</font>";	
				}else{
					document.getElementById(divName).innerHTML=oxmlHttp.responseText;	
				}
				
			}
			else{
				alert("检查用户失败,请和技术员联系：" + oxmlHttp.statusText);
			}
		}
		
	} 
	oxmlHttp.send(null);
}

/*前台添加信息图片*/
function checkStxxPicFrom(theForm)
	{
		if (theForm.userfile.value =="")
		{
			alert("信息图片不能为空,请您重新输入!");
			theForm.userfile.focus();
			return (false);
		}
		if (theForm.picNotexx.value =="")
		{
			alert("信息说明不能为空,请您重新输入!");
			theForm.picNotexx.focus();
			return (false);
		}
	  return (true);
	}
	
	
/*前台输入卡号验证*/
function checkStCardslhFrom(theForm)
	{
		if (theForm.card.value =="")
		{
			alert("请您先输入卡号!");
			theForm.card.focus();
			return (false);
		}
		if (theForm.keys_number.value =="")
		{
			alert("序列号不能为空,请您重新输入!");
			theForm.keys_number.focus();
			return (false);
		}
	  return (true);
	}
	

/*前台修改密码*/
function checkStPassFrom(theForm)
	{
		if (theForm.oldPass.value =="")
		{
			alert("请您先输入旧密码!");
			theForm.oldPass.focus();
			return (false);
		}
		if (theForm.pass.value =="")
		{
			alert("新密码不能为空,请您重新输入!");
			theForm.pass.focus();
			return (false);
		}
	  return (true);
	}
	
//-----------------前台检查营业执照信息用户登陆------------------
function checkzzxx(zzUserLg,zzPassLg,xxNumber,zzDiv,authinput,yzm){
	if (zzUserLg=="") {
		alert("用户名不能为空!");
	}else if (zzPassLg==""){
		alert("密码不能为空!");
	}else if (authinput==""){
		alert("验证码不能为空!");
		}else{
		var oxmlHttp = createXMLHttpRequest();                  //判断是什么浏览器  
		oxmlHttp.open("get","checkzzxx.php?xxNumber="+xxNumber+"&zzUserLg="+zzUserLg+"&zzPassLg="+zzPassLg+"&authinput="+authinput+"&yzm="+yzm+"",true);         //把kind参数传递到a2.php文件
		oxmlHttp.onreadystatechange = function(){          
			if(oxmlHttp.readyState == 4)                        //4表示所有数据都已经收到，连接关闭
			{
				if(oxmlHttp.status == 200)                      //200总是确保响应的状态
				{ 
				//document.getElementById(membersDiv).innerHTML = oxmlHttp.responseText;
					if ((oxmlHttp.responseText)=="dd"){
						alert("验证码错误,请重新输入.");
					}else if((oxmlHttp.responseText)=="a") {
						alert("用户名或密码错误,请重新输入.");
					}else{
						
						//alert(oxmlHttp.responseText);
						//var pic = (oxmlHttp.responseText);
						//document.getElementById(membersDiv).innerHTML = oxmlHttp.responseText;
						document.getElementById(zzDiv).innerHTML = (oxmlHttp.responseText);
					}
					
				
				}
			
			} 
		}
		oxmlHttp.send(null);
	}
	
}

//-------------添加订单信息---------------
function checkproOrderFrom(theForm)
	{
		if (theForm.oNumber.value =="")
		{
			alert("订单数量不能为空!");
			theForm.oNumber.focus();
			return (false);
		}
		if (theForm.oName.value =="")
		{
			alert("请您先输入您的姓名!");
			theForm.oName.focus();
			return (false);
		}
		if (theForm.tel.value =="")
		{
			alert("联系电话不能为空请您先输入!");
			theForm.tel.focus();
			return (false);
		}
		if (theForm.address.value =="")
		{
			alert("联系地址不能为空请您先输入!");
			theForm.address.focus();
			return (false);
		}
		if (theForm.oNote.value =="")
		{
			alert("请您输入详细的备注信息!");
			theForm.oNote.focus();
			return (false);
		}
		if (theForm.passcode.value =="")
		{
			alert("验证码不能为空，请您好先输入!");
			theForm.passcode.focus();
			return (false);
		}
	  return (true);
	}
	
	
//搜索用


function $(id) {
	return !id ? null : document.getElementById(id);
}

function initSearchmenu(searchform) {
	var searchtxt = $(searchform + '_txt');
	if(!searchtxt) {
		searchtxt = $(searchform);
	}
	var tclass = searchtxt.className;
	searchtxt.className = tclass + ' xg1';
	searchtxt.onfocus = function () {
		if(searchtxt.value == '请输入搜索内容') {
			searchtxt.value = '';
			searchtxt.className = tclass;
		}
	};
	searchtxt.onblur = function () {
		if(searchtxt.value == '' ) {
			searchtxt.value = '请输入搜索内容';
			searchtxt.className = tclass + ' xg1';
		}
	};
}

function searchFocus(obj) {
	if(obj.value == '请输入搜索内容') {
		obj.value = '';
	}
}

/*登陆中介会员*/
function checkzjFrom(theForm)
	{
		if (theForm.admin.value =="")
		{
			alert("用户名不能为空，请您重新输入!");
			theForm.admin.focus();
			return (false);
		}
		if (theForm.loginPass.value =="")
		{
			alert("密码不能为空,请您重新输入!");
			theForm.loginPass.focus();
			return (false);
		}
		if (theForm.authinput.value =="")
		{
			alert("验证码不能为空,请您重新输入!");
			theForm.authinput.focus();
			return (false);
		}
	  return (true);
	}
