function playswf(sFile,sWidth,sHeight){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ sWidth +'" height="'+ sHeight +'"> ');
document.write(' <param name="movie" value="'+ sFile +'"> ');
document.write(' <param name="quality" value="high"> ');
document.write(' <param name="wmode" value="transparent"> ');//背景透明
document.write(' <embed src="'+ sFile +'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ sWidth +'" height="'+ sHeight +'"></embed> ');
document.write('</object> ');
}

var flag=[0,0,0,0,1];

function CheckUser(str){
	var filter=/^\s*[.A-Za-z0-9_-]{6,12}\s*$/;
	if(str.length<3||str.length>12){
		get_error("username","用户名的长度在3-12位字符之间！")
		flag[0]=0;}else{
			check_db(str,"username");}
			checkform();
	}

function check_db(str,type){
		$.ajax({
		   url:"/ajax.php?username="+str+"&type="+type+"&"+Math.random(),
		   type:"GET",
		   error: function(){ alert("error!");},
		   success:function(date){
			    if(date==0){
					get_right(type);
					flag[0]=1;
					}else{
					get_error(type,date);
					flag[0]=0;
					}
			   }
		   });
	}

	
function CheckPass(str,type){
	if(type==0){
		if(str.length<4||str.length>12){
			get_error("password","密码的长度在4-12位字符之间！");
			flag[1]=0;}else{
				get_right("password");
				flag[1]=1;}
		}else{
			str1=$("#password").val();
			if(str.length<4||str.length>12){
			get_error("password1","密码的长度在4-12位字符之间！");
			flag[1]=0;}else{
				get_right("password1");
				flag[1]=1;}
			if(str1.length<4||str1.length>12){
			get_error("password","密码的长度在4-12位字符之间！");
			flag[1]=0;}else{
				get_right("password");
				flag[1]=1;}
			if(str!=str1){
				get_error("password","两次密码输入的结果不同！");
				get_error("password1","两次密码输入的结果不同！");
				flag[1]=0;}
				else if(str.length>3){get_right("password");
				     get_right("password1");
					 flag[1]=1;}
			}
			checkform();
	}
	
function CheckContact(str){
	if(str.length<1){
		get_error("contact","联系人不能为空哦！");
		flag[2]=0;}else{
			get_right("contact");
			flag[2]=1;
			}
			checkform();
	}
	
function CheckMobile(){
	str1=$("#phone").val();
	str=$("#mobile").val();
	if(str.length<1 && str1.length<1){
		get_error("mobile","联系电话和手机号码必须填写一项！");
		get_error("phone","联系电话和手机号码必须填写一项！");
		flag[3]=0;}
	if(str1.length>0){
		get_right("phone");
		clear_style("mobile");
		check_db_phone(str1,"phone");}
	if(str.length>0){
		get_right("mobile");
		clear_style("phone");
		check_db_phone(str,"mobile");}
	if(str.length>0 && str1.length>0){
		get_right("mobile");
		get_right("phone");
		check_db_phone(str1,"phone");
		check_db_phone(str,"mobile");}
	checkform();
	}
	
function check_db_phone(str,type){
		$.ajax({
		   url:"/ajax.php?phone="+str1+"&type="+type+"&"+Math.random(),
		   type:"GET",
		   error: function(){ alert("error!");},
		   success:function(date){
			    if(date==0){
					get_right(type);
					flag[3]=1;
					}else{
					get_error(type,date);
					flag[3]=0;
					}
			   }
		   });
	}	
	
function CheckEmail(str){
	 var filter=/^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
	 if(str.length>0){
	  if (!filter.test(str)){
		  get_error("email","请填写正确的邮箱格式！");
		  flag[4]=0;}else{
			  get_right("email");
			  flag[4]=1;}
	 }
	 checkform();
	}
	
function get_right(input_name){
	    $("#"+input_name+"_show").removeClass();
		$("#"+input_name).removeClass();
		$("#"+input_name+"_show").html("&nbsp;");
		$("#"+input_name+"_show").addClass("right");
		$("#"+input_name).addClass("input_right");
        }
function get_right_1(input_name,input_name_1){
	    $("#"+input_name_1).removeClass();
		$("#"+input_name).removeClass();
		$("#"+input_name_1).html("&nbsp;");
		$("#"+input_name_1).addClass("right");
		$("#"+input_name).addClass("input_right");
        }
function get_error(input_name,error_msg){
	    $("#"+input_name+"_show").removeClass();
		$("#"+input_name).removeClass();
		$("#"+input_name+"_show").addClass("error");
		$("#"+input_name).addClass("input_error");
		$("#"+input_name+"_show").html(error_msg);
		return false;
        }
function get_error_1(input_name,input_name_1,error_msg){
	    $("#"+input_name_1).removeClass();
		$("#"+input_name).removeClass();
		$("#"+input_name_1).addClass("error");
		$("#"+input_name).addClass("input_error");
		$("#"+input_name_1).html(error_msg);
		return false;
        }
function clear_style(input_name){
	$("#"+input_name+"_show").removeClass();
	$("#"+input_name).removeClass();
	$("#"+input_name+"_show").html("");
	}
function clear_style_1(input_name,input_name_1){
	$("#"+input_name_1).removeClass();
	$("#"+input_name).removeClass();
	$("#"+input_name_1).html("");
	}
		
function checkform(){
	if(flag[0]==1 && flag[1]==1 && flag[2]==1 && flag[3]==1 && flag[4]==1){
		$("#button_1").attr("disabled",false)
		}else{
		$("#button_1").attr("disabled",true)
			}
		}
	
function check_login(){
	var check=0;
	$("#load").show();
	var username=$("#username").val();
	var password=$("#password").val();
	if(username.length<3||username.length>12){
		get_error("username","用户名的长度在3-12位字符之间！");
		check=1;
		$("#load").hide();
		return false;
		}else{get_right("username");
		check=0;}
	if(password.length<4||password.length>12){
		get_error("password","密码的长度在4-12位字符之间！");
		check=1;
		$("#load").hide();
		return false;
		}else{get_right("password");
		check=0;}
	if(check==0){
	$.ajax({
		   url:"/ajax.php?username="+username+"&password="+password+"&type=login"+"&"+Math.random(),
		   type:"GET",
		   error: function(){alert("error!");},
		   success:function(date){
			   if(date=="0"){
				   $("#load").hide();
				   $("#username").val("");
				   $("#password").val("");
				   get_error("username","用户名或者密码错误！");
				   get_error("password","用户名或者密码错误！");}else{
				   top.location.href=date;}
			   }
		   });
		}
	}

function check_header_login(){
	var check=0;
	var username=document.getElementById("username").value;
	var password=document.getElementById("password").value;
	var return_url=document.getElementById("return_url").value;
		if(username.length<3||username.length>12){
			alert("用户名的长度在3-12位字符之间！");
		check=1;
		return false;
		}else{check=0;}
	if(password.length<4||password.length>12){
		alert("密码的长度在4-12位字符之间！");
		check=1;
		return false;
		}else{check=0;}
	if(check==0){
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }

var url="/ajax.php";
url=url+"?username="+username+"&password="+password+"&return_url="+return_url+"&type=header_login";
//url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=yf_show;
xmlHttp.open("GET",url,true);
xmlHttp.setRequestHeader("If-Modified-Since","0");
xmlHttp.send(null);
      }
	}
	
function yf_show()
{
if (xmlHttp.readyState==4){
	if(xmlHttp.responseText=="8"){
		alert("账号或者密码错误！");
		return false;}else{
		window.location.href=xmlHttp.responseText;
		};
}
}	
	
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

var flag_=[1,1,1,1,1,1,1,1,1,1,1,1,1,1];

function check_add_info(str){
   var title=$("#title").val();
   if(title==""){
	   get_error("title","信息标题不能为空！");
	   flag_[0]=0;
	   }else{clear_style("title");
	   flag_[0]=1;}
   if(str=="need"){
	   var type=$("#type").val();
	   var class_1=$("#class").val();
       if(type=="" && class_1==""){
	   get_error("type","请选择租售意向和租售类型！");
	   get_error_1("class","type_show","请选择租售意向和租售类型！");
	   flag_[11]=0;
	   }else{
	   if(type!="" && class_1==""){
	   clear_style("type");
	   clear_style_1("class","type_show");
	   get_error_1("class","type_show","请选择租售类型！");
	   flag_[11]=0;}else if(type=="" && class_1!=""){
	   clear_style("type");
	   clear_style_1("class","type_show");
	   get_error("type","请选择租售意向！");
	   flag_[11]=0;}else{
	   clear_style("type");
	   clear_style_1("class","type_show");
	   flag_[11]=1;}
	   }
	   var msg="地段要求不能为空！";
	   }else{var msg="详细地址不能为空！";}
   var quyu=$("#quyu").val();
   if(quyu==""){
	   get_error("quyu","您还没选择所在区域！");
	   flag_[1]=0;
	   }else{clear_style("quyu");
	   flag_[1]=1;}
   var address=$("#address").val();
   if(address==""){
	   get_error("address",msg);
	   flag_[2]=0;
	   }else{clear_style("address");
	   flag_[2]=1;}
   if(str=="td"){
   var p_area=$("#p_area").val();
   if(p_area==""){
	   get_error("p_area","土地面积不能为空！");
	   flag_[3]=0;
	   }else{clear_style("p_area");
	   flag_[3]=1;}
   var lift=$("#lift").val();
   if(lift==""){
	   get_error("lift","请填写该土地剩余使用年限！");
	   flag_[10]=0;
	   }else{clear_style("lift");
	   flag_[10]=1;}
   }else if(str=="need"){
	   var min_area=$("#min_area").val();
	   var max_area=$("#max_area").val();
       if(min_area=="" && max_area==""){
	   get_error_1("min_area","p_area_show","您还没有填写面积要求！");
	   get_error_1("max_area","p_area_show","您还没有填写面积要求！");
	   flag_[12]=0;
	   }else{
	   if(min_area!="" && max_area==""){
	   clear_style_1("min_area","p_area_show");
	   clear_style_1("max_area","p_area_show");
	   get_error_1("max_area","p_area_show","请填写完整的面积范围！");
	   flag_[12]=0;}else if(min_area=="" && max_area!=""){
	   clear_style_1("min_area","p_area_show");
	   clear_style_1("max_area","p_area_show");
	   get_error_1("min_area","p_area_show","请填写完整的面积范围！");
	   flag_[12]=0;}else{
	   clear_style_1("min_area","p_area_show");
	   clear_style_1("max_area","p_area_show");
	   flag_[12]=1;}
	   }  
	   var min_price=$("#min_price").val();
	   var max_price=$("#max_price").val();
       if(min_price=="" && max_price==""){
	   get_error_1("min_price","m_price_show","您还没有填写价格要求！");
	   get_error_1("max_price","m_price_show","您还没有填写价格要求！");
	   flag_[13]=0;
	   }else{
	   if(min_price!="" && max_price==""){
	   clear_style_1("min_price","m_price_show");
	   clear_style_1("max_price","m_price_show");
	   get_error_1("max_price","m_price_show","请填写完整的价格范围！");
	   flag_[13]=0;}else if(min_price=="" && max_price!=""){
	   clear_style_1("min_price","m_price_show");
	   clear_style_1("max_price","m_price_show");
	   get_error_1("min_price","m_price_show","请填写完整的价格范围！");
	   flag_[13]=0;}else{
	   clear_style_1("min_price","m_price_show");
	   clear_style_1("max_price","m_price_show");
	   flag_[13]=1;}
	   } 
   }else{
   var p_area=$("#p_area").val();
   if(p_area==""){
	   get_error("p_area","厂房面积不能为空！");
	   flag_[3]=0;
	   }else{clear_style("p_area");
	   flag_[3]=1;}
   var frame=$("#frame").val();
   if(frame==""){
	   get_error("frame","您还没选择建筑结构！");
	   flag_[4]=0;
	   } else{clear_style("frame");
	   flag_[4]=1;}
	   }
   var price=$("#price").val();
   if(price==""){
	   get_error("price","价格不能为空！");
	   flag_[5]=0;
	   }else{clear_style("price");
	   flag_[5]=1;}
   var contact=$("#contact").val();
   if(contact==""){
	   get_error("contact","联系人不能为空！");
	   flag_[6]=0;
	   }else{clear_style("contact");
	   flag_[6]=1;}
   var phone=$("#phone").val();
   var mobile=$("#mobile").val();
   if(phone=="" && mobile==""){
	   get_error("phone","联系电话和手机号码至少填写一项！");
	   get_error("mobile","联系电话和手机号码至少填写一项！");
	   flag_[7]=0;
	   }else{clear_style("phone");
	   clear_style("mobile");
	   flag_[7]=1;}
   var email=$("#email").val();
   if(email==""){clear_style("email");
	   flag_[9]=1;}else{var filter=/^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
	  if(!filter.test(email)){ 
	   get_error("email","邮箱格式不正确！");
	   flag_[9]=0;}else{clear_style("email");
	   flag_[9]=1;}}
	if(flag_[0]==0 || flag_[1]==0 || flag_[2]==0 || flag_[3]==0 || flag_[4]==0 || flag_[5]==0 || flag_[6]==0 || flag_[7]==0 || flag_[8]==0 || flag_[9]==0 || flag_[10]==0 || flag_[11]==0 || flag_[12]==0 || flag_[13]==0){
		window.scroll(0,0);
		return false;}
}

var flag_1=[1,1,1];
function check_edit_info(){
	var password=$("#password").val();
	var password1=$("#password1").val();
	var contact=$("#contact").val();
	var phone=$("#phone").val();
	var mobile=$("#mobile").val();
	if(password1!="" && password!=""){
		if(password1!=password){
			get_error("password","两次密码输入的结果不同！");
			get_error("password1","两次密码输入的结果不同！");
			flag_1[0]=0;
			}else{flag_1[0]=1;}
	    }else{flag_1[0]=1;}
	if(password!=""){
		if(password.length<4 || password.length>12){
			get_error("password","密码的长度在4-12位字符之间！");
			flag_1[0]=0;
			}else{flag_1[0]=1;}
		}else{flag_1[0]=1;}
	if(password1!=""){
		if(password1.length<4 || password1.length>12){
			get_error("password1","密码的长度在4-12位字符之间！");
			flag_1[0]=0;
			}else{flag_1[0]=1;}
		}else{flag_1[0]=1;}
	if(contact==""){
		get_error("contact","联系人不能为空！");
		flag_1[1]=0;
		}else{flag_1[1]=1;}
	if(phone=="" && mobile==""){
		get_error("phone","联系电话和手机号码必填写一项！");
		get_error("mobile","联系电话和手机号码必填写一项！");
		flag_1[2]=0;
		}else{flag_1[2]=1;}
		if(flag_1[0]==0 || flag_1[1]==0 || flag_1[2]==0){
		return false;}
	}

