function Rusumebmadd(){
  document.getElementById("Rusumebmdiv").innerHTML = document.getElementById("Rusumebmdiv").innerHTML + "<div><input type=text name=WorkTime style=width:80px; maxlength=10> <input type=text name=WorkCompany style=width:280px; maxlength=40> <input type=text name=WorkCareer style=width:190px; maxlength=25></div>";
}
function EducationRusumebmadd(){
  document.getElementById("EducationRusumebmdiv").innerHTML = document.getElementById("EducationRusumebmdiv").innerHTML + "<div><input type=text name=EducationWorkTime style=width:90px; maxlength=13> <input type=text name=EducationWorkCompany style=width:170px; maxlength=15> <input type=text name=EducationWorkCareer style=width:290px; maxlength=40></div>";
}
///////////////////////////////////////////
function killerr() {return true}
window.onerror=killerr

function oCopy(str)
{
var clipBoardContent=str;
window.clipboardData.setData("Text",clipBoardContent);
alert("邀请地址复制成功，赶快发给你的好友赢积分吧！");
}

//新闻添加
function doChange(objText, objDrop){
	if (!objDrop) return;
	var str = objText.value;
	var arr = str.split("|");
	objDrop.length=0;
	for (var i=0; i<arr.length; i++){
	objDrop.options[i] = new Option(arr[i], arr[i]);
	PicUrl=objDrop.options[i].value;
	}
	document.myform.WM_DefaultPicUrl.value = PicUrl;
	myform.WM_PicPreview.src = PicUrl;
	myform.WM_PicPreview.alt = PicUrl;
}

/*转向文章新闻添加*/
function WM_LinkCheck(){
  if(document.myform.WM_UseLinkUrl.checked==true){
    document.myform.WM_LinkUrl.disabled=false;
     //ArticleContent.style.display='none';
     document.getElementById("ArticleContent1").style.display='none';
  }
  else{
    document.myform.WM_LinkUrl.disabled=true;
    //ArticleContent.style.display='';
    document.getElementById("ArticleContent1").style.display='';
  }
}

var c = 0;
function Edit3(ci){if (c==0){  c = 1;  ci.style.display = "";}else{ c = 0; ci.style.display = "none";}}
var b = 0;
function Edit2(ci){if (b==0){  b = 1;  ci.style.display = "";}else{  b = 0;  ci.style.display = "none";}}

//选取所有
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked;
   }
  }

function ClassPost() {
//是否包含电话
var IsTel=/(([0-9]|[０-９]|[零,一,二,三,四,五,六,七,八,九])\W*){7,}/;
//邮箱地址
var IsEmail=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
//检测money
var IsMoney=/^[\d|\.]*$/;
//检测电话
var Isphone=/(^(0\d{2,3})?(-|\s)?(\d{7,8})(-(\d{2,4}))?$)|(^(\+86)?(\s+)?((13)|(15)|(18))(\d{9})$)/;
//检测数字
var IsNum=/^\d*$/;

  DBC2SBC(document.myform.Email,document.myform.Email.value,0);
  DBC2SBC(document.myform.Tel,document.myform.Tel.value,0);

  if( document.myform.AreaID.value ==""){
	Loading.style.display="none";
	alert("\·请选择信息所属地区");
	return false;}
  if( document.myform.ClassID.value ==""){
	Loading.style.display="none";
	alert("\·请选择信息所属分类");
	return false;}

  if( document.myform.title.value ==""){
	Loading.style.display="none";
	alert("\·请输入信息标题");
    document.myform.title.focus();
    document.myform.title.select();
	return false;}
  if (IsTel.test(document.myform.title.value)) {
	Loading.style.display="none";
	alert("\·信息标题不能带有电话或其它号码");
    document.myform.title.focus();
    document.myform.title.select();
    return false;}
  if( document.EditContent.getHTML() ==""){
	Loading.style.display="none";
	alert("\·请输入信息内容");
    document.EditContent.HtmlEdit.focus();
	return false;}
  if( document.EditContent.getHTML().length <20){
	Loading.style.display="none";
	alert("\·信息内容不少于20个字符");
    document.EditContent.HtmlEdit.focus();
	return false;}
  if( document.EditContent.getHTML().length >5000){
	Loading.style.display="none";
	alert("\·信息内容不多于5000个字符");
    document.EditContent.HtmlEdit.focus();
	return false;}
  if (IsEmail.test(document.myform.title.value)) {
	Loading.style.display="none";
	alert("\·信息标题不能带有邮箱地址");
    document.myform.title.focus();
    document.myform.title.select();
    return false;}
  if(document.myform.Email.value!=""){
  if (!IsEmail.test(document.myform.Email.value)) {
	Loading.style.display="none";
	alert("\·邮箱地址不正确");
    document.myform.Email.focus();
    document.myform.Email.select();
    return false;}
  }
  if(document.myform.Tel.value!=""){
  if (!Isphone.test(document.myform.Tel.value)) {
	Loading.style.display="none";
	alert("\·联系电话不正确");
    document.myform.Tel.focus();
    document.myform.Tel.select();
    return false;}
  }
  if(document.myform.QQ.value!=""){
  if (!IsNum.test(document.myform.QQ.value)) {
	Loading.style.display="none";
	alert("\·QQ填写不正确");
    document.myform.QQ.focus();
    document.myform.QQ.select();
    return false;}
  }
  if(document.myform.Email.value =="" && document.myform.Tel.value =="" && document.myform.QQ.value ==""){
	Loading.style.display="none";
	alert("\·在邮箱、电话、QQ三个选项中\n\n·至少填写一样");
    document.myform.Email.focus();
    document.myform.Email.select();
	return false;
  }

return true;
}

/*打开关闭UBB帮助*/
var Ukey
Ukey=0;
function UBBHelp(){
  if(Ukey==0){
    Ukey=1;
    document.getElementById('UHelp').style.display="";
  }else{
    Ukey=0;
    document.getElementById('UHelp').style.display="none";
  }
}

//设定图片显示尺寸
var flag=false;
function DrawImage(ImgD,w,h){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
  flag=true;
  if(image.width/image.height>= w/h){
    if(image.width>w){
      ImgD.width=w;
      ImgD.height=(image.height*w)/image.width;
    }else{
      ImgD.width=image.width;
      ImgD.height=image.height;
    }
  }else{
    if(image.height>h){
      ImgD.height=h;
      ImgD.width=(image.width*h)/image.height;
    }else{
      ImgD.width=image.width;
      ImgD.height=image.height;
    }
  }
}
}
// 显示无模式对话框
function ShowDialog(url, width, height) {
	var arr = showModalDialog(url, window, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:no;status:no");
}

//上传操作 Begin ============================================
function upcom(Spath,path){
  if(path!=""){
  if(Spath!=""){
      document.myform.SPic.value = Spath;
    }else{
      document.myform.SPic.value = path;
    }
    document.myform.Pic.value = path;
  }
  document.getElementById("up").style.display = "none";
  closeWithIframe();
}

//上传完成后返回参数处理
function upback(Spic,str){
  if(str!=""){
  EditContent.InsertLabel('<IMG SRC=' + str + ' onload=\"DrawImage(this, 500, 500)\" onclick=\"window.open(this.src)\" style=\"cursor:pointer !important; cursor:hand;\">');
  if(Spic!=""){
      document.myform.Pic.value = Spic;
      Add(Spic);
      document.getElementById("PicPreview").innerHTML = "<Img src="+Spic+" onload=\'DrawImage(this, 118, 118);\'>";
    }else{
      document.myform.Pic.value = str;
      Add(str);
      document.getElementById("PicPreview").innerHTML = "<Img src="+str+" onload=\'DrawImage(this, 118, 118);\'>";
    }
  }
  closeWithIframe();
}

function Add(str) {
	var sel2=document.myform.PicSelect;
	sel2.options[sel2.length]=new Option(str,str);
	sel2.selectedIndex = sel2.length-1;
}

function PicReset(str){
document.myform.Pic.value = str;
if (str == ""){
  document.getElementById("PicPreview").innerHTML = "<Img src=img/nopic.gif onload=\'DrawImage(this, 118, 118);\'>";
}else{
  document.getElementById("PicPreview").innerHTML = "<Img src="+str+" onload=\'DrawImage(this, 118, 118);\'>";
}
}

//广告图片回传操作
function upad(str){
  document.myform.Pic.value = str;
  closeWithIframe();
}

//用户头像回传操作
function upother(str){
  document.myform.Pic.value = str;
  document.images['PicShow'].src=str;
  closeWithIframe();
}
//优惠券上传完成后返回参数处理
var ii=0;
function upcou(Spath,path) {
    var sel1 = document.myform.PicList.value;
    var sel2 = document.getElementById("plist").innerHTML;
	var path1 = "<div id=l_"+ii+">"+path+"　　<a style='cursor:pointer !important;cursor:hand;' onclick=PicReset('"+Spath+"')>做为缩略图</a>　<a  style='cursor:pointer !important;cursor:hand;' onclick=dlist('"+ii+"','"+path+"','"+Spath+"')>删除</a></div>";
	if(sel1!=""){
	  sel1 = sel1 +'|' + path;
	  sel2 = sel2 + path1;
	}else{
	  sel1 = path;
	  sel2 = path1;
	}
    document.myform.PicList.value = sel1;
    document.getElementById("plist").innerHTML = sel2;
    document.myform.Pic.value = Spath;
	document.getElementById("PicPreview").innerHTML = "<Img src="+Spath+" onload=\'DrawImage(this, 118, 118);\'>";
    closeWithIframe();
    ii = ii+1;
}
function dlist(id,str,sStr){
  document.getElementById("l_"+id).style.display = "none";
  var sel2 = document.myform.PicList.value;
  var sel1 = document.myform.Pic.value;
  var str1="";
  var forpic="";
  sel = sel2.split("|");
  for(i=0;i<=sel.length;i++){
    forpic = sel[i];
    if(typeof(forpic) == "undefined"){forpic="";}
    if(forpic != "" && forpic != str){
	  if(str1!=""){
	    str1 = str1+"|"+sel[i];
	  }else{
	    str1 = sel[i];
	  }
	}
  }
  if(typeof(str1) == "undefined"){str1="";}

  if(sel1==sStr || str1==""){
    PicReset("");
  }
  document.myform.PicList.value = str1;
}
var iii=0;
function upcouunit(Spath,path) {
    var sel1 = document.myform.WM_UnitPicList.value;
    var sel2 = document.getElementById("plistunit").innerHTML;
	var path1 = "<div id=lunit_"+iii+">"+path+"　　<a style='cursor:pointer !important;cursor:hand;' onclick=PicResetUnit('"+Spath+"')>做为缩略图</a>　<a  style='cursor:pointer !important;cursor:hand;' onclick=dlistPic('"+iii+"','"+path+"','"+Spath+"')>删除</a></div>";
	if(sel1!=""){
	  sel1 = sel1 +'|' + path;
	  sel2 = sel2 + path1;
	}else{
	  sel1 = path;
	  sel2 = path1;
	}
    document.myform.WM_UnitPicList.value = sel1;
    document.getElementById("plistunit").innerHTML = sel2;
    document.myform.WM_UnitPic.value = Spath;
	document.getElementById("PicPreviewUnit").innerHTML = "<Img src="+Spath+" onload=\'DrawImage(this, 118, 118);\'>";
    closeWithIframe();
    iii = iii+1;
}
function dlistPic(id,str,sStr){
  document.getElementById("lunit_"+id).style.display = "none";
  var sel2 = document.myform.WM_UnitPicList.value;
  var sel1 = document.myform.WM_UnitPic.value;
  var str1="";
  var forpic="";
  sel = sel2.split("|");
  for(i=0;i<=sel.length;i++){
    forpic = sel[i];
    if(typeof(forpic) == "undefined"){forpic="";}
    if(forpic != "" && forpic != str){
	  if(str1!=""){
	    str1 = str1+"|"+sel[i];
	  }else{
	    str1 = sel[i];
	  }
	}
  }
  if(typeof(str1) == "undefined"){str1="";}

  if(sel1==sStr || str1==""){
    PicResetUnit("");
  }
  document.myform.WM_UnitPicList.value = str1;
}
function PicResetUnit(str){
document.myform.WM_UnitPic.value = str;
if (str == ""){
  document.getElementById("PicPreviewUnit").innerHTML = "<Img src=img/nopic.gif onload=\'DrawImage(this, 118, 118);\'>";
}else{
  document.getElementById("PicPreviewUnit").innerHTML = "<Img src="+str+" onload=\'DrawImage(this, 118, 118);\'>";
}
}
//上传操作 End ============================================

function textLimitCheck(thisArea, maxLength){
  if (thisArea.value.length > maxLength){
    alert('限 '+maxLength + ' 个字符. \r超出的部分将自动去除.');
    thisArea.value = thisArea.value.substring(0, maxLength);
    thisArea.focus();
  }
}

function DBC2SBC(input,str,flag){
var i;
var result='';
for(i=0;i<str.length;i++){
str1=str.charCodeAt(i);
if(str1<125&&!flag)
result+=String.fromCharCode(str.charCodeAt(i));
else
result+=String.fromCharCode(str.charCodeAt(i)-65248);
}
input.value = result;
}

//ajax提示框========================================
var Obj=''
document.onmouseup=MUp
document.onmousemove=MMove

function MDown(Object){
Obj=Object.id
document.all(Obj).setCapture()
pX=event.x-document.all(Obj).style.pixelLeft;
pY=event.y-document.all(Obj).style.pixelTop;
}

function MMove(){
if(Obj!=''){
  document.all(Obj).style.left=event.x-pX;
  document.all(Obj).style.top=event.y-pY;
  }
}

function MUp(){
if(Obj!=''){
  document.all(Obj).releaseCapture();
  Obj='';
  }
}
document.write('<div id="massage_box" style="display:none">loading...</div>');
document.write('<div id="bgDiv" style="display:none"></div>');
function openWithIframe(tit,url,w,h){
    //屏幕背景变暗
	var sWidth,sHeight;
	sWidth=document.body.clientWidth;
	sHeight=document.body.scrollHeight;
	if(sHeight<window.screen.height){sHeight=window.screen.height;}
	document.getElementById("bgDiv").style.display="";
	document.getElementById("bgDiv").style.position="absolute";
	document.getElementById("bgDiv").style.top="0";
	document.getElementById("bgDiv").style.background="#000000";
	document.getElementById("bgDiv").style.filter="Alpha(Opacity=30);";
	document.getElementById("bgDiv").style.left="0";
	document.getElementById("bgDiv").style.width=sWidth + "px";
	document.getElementById("bgDiv").style.height=sHeight + "px";
	document.getElementById("bgDiv").style.zIndex = "10000";
	//显示层
    document.getElementById("massage_box").style.left = (document.body.clientWidth - w) / 2+"px";
    //document.getElementById("massage_box").style.top = (screen.height - h) / 2-80+"px";
    document.getElementById("massage_box").style.screenx = (document.body.clientWidth - w) / 2+"px";//仅适用于Netscape
    document.getElementById("massage_box").style.screeny = (screen.height - h) / 2-180+"px";//仅适用于Netscape
    document.getElementById("massage_box").style.width = w+"px";
    document.getElementById("massage_box").style.height = h+"px";
    document.getElementById("massage_box").className = "massage_box";
	var popiframe;
	popiframe = '<div style="border-width:1 1 3 1; width:100%; height:100%; background:#fff; color:#666666; font-size:12px; ">'
	popiframe += '<div onmousedown=MDown(massage_box) style="background:#666666; height:20px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;color:#fff;cursor:move;padding:0 0 4px 0">'
	popiframe += '<div style="display:inline; width:200px; position:absolute;padding:3px 0 0 5px" id=pop_title>'+tit+'</div>'
	popiframe += '<span onClick="closeWithIframe()" style="float:right; display:inline; cursor:pointer;padding:3px 5px 0 0;font-size:12px">关闭</span>'
	popiframe += '</div>'
	popiframe += '<div style="padding:5px" ><iframe src="'+url+'" width="'+(w-11)+'px"  height="'+(h-36)+'px" frameborder=0 scrolling=no></iframe></div>'
	popiframe += '</div>'
    document.getElementById("massage_box").innerHTML=popiframe;
    document.getElementById("massage_box").style.display = "";
}
function closeWithIframe(){
    document.getElementById("massage_box").style.display="none";
    document.getElementById("bgDiv").style.display="none";
}
//ajax提示框功能========================================

function replaceInput(obj,event){
	if(event.keyCode!=37 && event.keyCode!=39){
      var IsTitle=/[^\u4E00-\u9FA50-9a-zA-Z\-_! (),.\%\#\$\&\*|:"'?]/g;
	  if(IsTitle.test(obj.value)){
	    obj.value=obj.value.replace(IsTitle,'');
	  }
	}
}

var dj1 = 0;
var dj2 = 0;
var dj3 = 0;
var dj4 = 0;
var dj5 = 0;
var dj6 = 0;
var dj7 = 0;
var djct = 0;
var djil = 0;
function ShowChange(id,str,il,ct,uil,uct){
 if(str==""){str=0}
 if(parseInt(id)>0){
   switch (parseInt(id)) {
     case 1:
       if(dj1==0){djct = djct+ct;djil = djil+il;dj1 = str;}else{djct = djct-ct*dj1;djil = djil-il*dj1;dj1 = 0;}
	   break;
     case 2:
       if(dj2==0){djct = djct+ct;djil = djil+il;dj2 = str;}else{djct = djct-ct*dj2;djil = djil-il*dj2;dj2 = 0;}
	   break;
     case 3:
       if(dj3<str){
	     djct = djct+ct*parseInt(str-dj3);
		 djil = djil+il*parseInt(str-dj3);
		 dj3 = str;
		 }else{
		 djct = djct-ct*parseInt(dj3-str);
		 djil = djil-il*parseInt(dj3-str);
		 dj3 = str;
		 }
	   break;
     case 4:
       if(dj4<str){
	     djct = djct+ct*parseInt(str-dj4);
		 djil = djil+il*parseInt(str-dj4);
		 dj4 = str;
		 }else{
		 djct = djct-ct*parseInt(dj4-str);
		 djil = djil-il*parseInt(dj4-str);
		 dj4 = str;
		 }
	   break;
     case 5:
       if(dj5<str){
	     djct = djct+ct*parseInt(str-dj5);
		 djil = djil+il*parseInt(str-dj5);
		 dj5 = str;
		 }else{
		 djct = djct-ct*parseInt(dj5-str);
		 djil = djil-il*parseInt(dj5-str);
		 dj5 = str;
		 }
	   break;
     case 6:
       if(dj6<str){
	     djct = djct+ct*parseInt(str-dj6);
		 djil = djil+il*parseInt(str-dj6);
		 dj6 = str;
		 }else{
		 djct = djct-ct*parseInt(dj6-str);
		 djil = djil-il*parseInt(dj6-str);
		 dj6 = str;
		 }
	   break;
     case 7:
       if(dj7<str){
	     djct = djct+ct*parseInt(str-dj7);
		 djil = djil+il*parseInt(str-dj7);
		 dj7 = str;
		 }else{
		 djct = djct-ct*parseInt(dj7-str);
		 djil = djil-il*parseInt(dj7-str);
		 dj7 = str;
		 }
	   break;
   }
   if(uct-djct<0 || uil-djil<0){
     if(confirm('您的积分或点券已不够本次支付，现在就去兑换？')){parent.location = 'User_Exchange.asp'}
   }
   Ct.innerText = djct;
   Il.innerText = djil;
 }else{
    //if(djct==0){alert('您还没有购买任何道具');return false;}
    if(uct-djct<0 || uil-djil<0){
      if(confirm('您的积分或点券已不够本次支付，现在就去兑换？')){parent.location = 'User_Exchange.asp'}else{return false;}
    }
	myform.submit();
 }
}
//添加广告表单
function ads(i){
  switch(i){
    case "text":
      ad1.style.display = "none";
      ad2.style.display = "";
      ad3.style.display = "";
      ad4.style.display = "none";
      ad5.style.display = "";
      ad6.style.display = "none";
	  break;
    case "pic":
      ad1.style.display = "";
      ad2.style.display = "none";
      ad3.style.display = "";
      ad4.style.display = "";
      ad5.style.display = "";
      ad6.style.display = "none";
	  break;
    case "swf":
      ad1.style.display = "";
      ad2.style.display = "none";
      ad3.style.display = "none";
      ad4.style.display = "";
      ad5.style.display = "none";
      ad6.style.display = "none";
	  break;
    case "code":
      ad1.style.display = "none";
      ad2.style.display = "none";
      ad3.style.display = "none";
      ad4.style.display = "none";
      ad5.style.display = "none";
      ad6.style.display = "";
	  break;
  }
}

//公用ajax
function InitAjax(){
var ajax=false;
try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) { try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { ajax = false; } }
if (!ajax && typeof XMLHttpRequest!='undefined') { ajax = new XMLHttpRequest(); }
return ajax;}
function ToAjax(url,Post){
	if (url!=""){
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST", url, true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=GB2312");
		ajax.send(Post);
	    ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText;}
	      document.getElementById("AjaxShow").innerHTML = getinfo;
		  }
	}
}
//订阅文章
function ArtClassAjax(url,Post){
	if (url!=""){
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST", url, true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=GB2312");
		ajax.send(Post);
	    ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText;}
	      document.getElementById("ArtClass").innerHTML = getinfo;
		  }
	}
}

function ad_pic(){
  if (myform.L.value =="" || myform.Pic.value =="" ){
    myform.L.focus();
    alert('输入不完整');
  }else{
    if(myform.P.value !=""){
	  myform.P.value = myform.L.value+'|'+myform.Pic.value+'\n'+myform.P.value;
	}else{
	  myform.P.value = myform.L.value+'|'+myform.Pic.value;
	}
	myform.L.value = "";
	myform.Pic.value = "";
  }
}

//添加店铺时AJAX调用自定义选项
//t 1分类信息2店铺 sid 分类ID id 内容id
function dbajax(t,sid,id){
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST","../Inc/WM.DB.Ajax.asp" , true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=GB2312");
		ajax.send("T="+t+"&SortID="+sid+"&ID="+id+"&F=Class");
	    ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText;}
	      document.getElementById("DBShow").innerHTML = getinfo;
		  if(getinfo!=""){document.getElementById("DBtr").style.display="";}else{document.getElementById("DBtr").style.display="none";}
		}
}
function areadbajax(sid,carea,isedit){
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST","../Inc/WM.DB.Ajax.asp" , true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=GB2312");
		ajax.send("SortID="+sid+"&IsEdit="+isedit+"&F=Area&C="+escape(carea));
	    ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText}
		  if (isedit==0 && carea!=""){
	        document.getElementById("ChAreaDBShow").innerHTML = getinfo;
		  }else{
	        document.getElementById("AreaDBShow").innerHTML = getinfo;
		    if(getinfo!=""){document.getElementById("AreaDBtr").style.display="";}else{document.getElementById("AreaDBtr").style.display="none";}
		  }
		}
}
//竞价排名
function pmajax(post,id){
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST","User_Ajax.asp" , true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=GB2312");
		ajax.send("Action=AuctionAdsPM&"+post);
		ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText
		    if(getinfo!=""){document.getElementById(id).innerHTML = getinfo;}
		  }
		}
}
//直达关键词检测
function zdajax(key){
	if (key!=""){
        document.getElementById("Price").innerHTML = "loading...";
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST","User_Ajax.asp" , true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=GB2312");
		ajax.send("Action=zhida&Key="+escape(key));
		ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText
		    if(isNaN(getinfo)){
			    document.getElementById("Price").innerHTML = "<span class=zPrice>"+getinfo+"</span>";
		      }else{
			    document.getElementById("Price").innerHTML = "<span class=zPrice>"+getinfo+"</span> 元";
			  }
		  }
		}
	}
}

//域名查询
function CheckIfEnglish( String ){
    var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-";
     var i;
     var c;
      if(String.charAt( 0 )=='-')
	return false;
      if( String.charAt( String.length - 1 ) == '-' )
          return false;
     for( i = 0; i < String.length; i ++ )
     {
          c = String.charAt( i );
	  if (Letters.indexOf( c ) < 0)
	     return false;
     }
     return true;
}
function submitchecken() {

	if (document.checkdomain.domain.value == "") {
		alert("请输入您要查询的英文域名。");
		document.checkdomain.domain.focus();
		return false;
	}

if (!CheckIfEnglish(document.checkdomain.domain.value )) {
		alert("\n注意：在查询英文域名时应输入英文不能输入中文及非法字符\n域名由不分大小写的英文字母和数字组成\n除了开头和结尾以外，中间也可以含有“-”（即连字符或称减号）\n最大长度为26个字符");
		document.checkdomain.domain.focus();
		return false;
	}

	return true;
}

//在线支付
function pay1(){
  document.getElementById("payid1").style.display="";
  document.getElementById("payid2").style.display="none";
  document.getElementById("paytit1").className="paytype";
  document.getElementById("paytit2").className="paytype1";
}
function pay2(){
  document.getElementById("payid1").style.display="none";
  document.getElementById("payid2").style.display="";
  document.getElementById("paytit1").className="paytype1";
  document.getElementById("paytit2").className="paytype";
}

//竞价价格设置
function zPriceShow(p,d){
  if(isNaN(p) || isNaN(d)){
	  document.getElementById("zPrice").innerHTML = "0";
  }else{
	  document.getElementById("zPrice").innerHTML = p*d;
  }
}
function zPriceEditShow(p,d,pp,dd,DQName){
  if(isNaN(p) || isNaN(d)){
	  document.getElementById("zPrice").innerHTML = "0";
  }else{
	  document.getElementById("zPrice").innerHTML = p*d;
	  var bj = p*d - pp*dd;
	  if(bj > 0){
	    document.getElementById("zPriceBj").innerHTML = "，您需要补交 <span class=zPrice>"+bj+"</span> "+DQName;
	  }else{
	    document.getElementById("zPriceBj").innerHTML = "";
	  }
  }
}

//点券冲值
function CountOutPay(n,p){
  if(isNaN(n) || isNaN(p)){
	  document.getElementById("P").innerHTML = "0";
	  document.addform1.Price.value = "0";
  }else{
	  document.getElementById("P").innerHTML = round(n/p,2);
	  document.addform1.Price.value = round(n/p,2);
  }
}
function round(v,e){
  var t=1;
  for(;e>0;t*=10,e--);
  for(;e<0;t/=10,e++);
  return Math.round(v*t)/t;
}

function Ads_1(){
  document.getElementById("AuctionAds_Tit_1").className = "JingjiaDiv1";
  document.getElementById("AuctionAds_1").style.display = "";
  document.getElementById("AuctionAds_Tit_2").className = "JingjiaDiv2";
  document.getElementById("AuctionAds_2").style.display = "none";
}
function Ads_2(){
  document.getElementById("AuctionAds_Tit_1").className = "JingjiaDiv2";
  document.getElementById("AuctionAds_1").style.display = "none";
  document.getElementById("AuctionAds_Tit_2").className = "JingjiaDiv1";
  document.getElementById("AuctionAds_2").style.display = "";
}

function bmadd(){
  document.getElementById("bmdiv").innerHTML = document.getElementById("bmdiv").innerHTML + "<div><input type=text name=bmtit>：<input type=text name=bmvalue> class=<input type=text name=bmcss></div>";
}

//判断是否为数字或小数
function clearNum(str){
	if(str.value!=""){
        var filter=/^([1-9]\d*|0)(\.\d{0,2})?$/;
        if (!filter.test(str.value)){alert("价格只能输入数字或带两位小数的数字");str.value=str.value.substring(0,str.value.length-1);}
	}
}
//同步检测用户名是否重复
function rUserName(str){
  if(str =="") {
    document.getElementById("AjaxShowUser").innerHTML = "<font color=red><strong>用户名不能为空</strong></font>";
    document.myform.UserName.focus();
    document.myform.UserName.select();
	return false;
  }
  document.getElementById("AjaxShowUser").innerHTML = "loading...";
  Ajax("../Reg.asp","Action=Check&w=u&User="+escape(str),"AjaxShowUser")
}


function replaceInput(obj,event){
	if(event.keyCode!=37 && event.keyCode!=39){
      var IsTitle=/[^\u4E00-\u9FA50-9a-zA-Z_\.]/g;
	  if(IsTitle.test(obj.value)){
	    obj.value=obj.value.replace(IsTitle,'');
	  }
	}
}

function rEmail(str){
  var filter=/^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
  if (str =="" || !filter.test(str)) {
     document.getElementById("Email1").innerHTML = "<font color=red><strong>请输入正确的邮箱地址。</strong></font>";
     document.addform.Email.focus();
     document.addform.Email.select();
     return false;
  }
  document.getElementById("Email1").innerHTML = "loading...";
  Ajax("../Reg.asp","Action=Check&w=e&Email="+escape(str),"Email1")
}


function Ajax(url,Post,name){
	if (url!=""){
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST", url, true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
		ajax.send(Post);
		ajax.onreadystatechange = function(){
			if (ajax.readyState == 4 && ajax.status == 200){
				getinfo = ajax.responseText;
				returnAjax(getinfo,name);
			}
		}
	}
}

function returnAjax(str,name){
	if(str!=""){
		checkRet = false;
		if(!name)name = 'vtable';
		document.getElementById(name).innerHTML = str;
	}else{
		document.getElementById(name).innerHTML = "";
	}
}
