﻿// JavaScript Document
document.charset = "utf-8";
String.prototype.trim = function(){return this.replace(/(^\s*)|(\s*$)/g, "");};String.prototype.ByteCount = function(){txt = this.replace(/(<.*?>)/ig,"");txt = txt.replace(/([\u0391-\uFFE5])/ig, "11");var count = txt.length;return count;}
String.prototype.getQuery = function(name) 
{var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");var r = this.substr(this.indexOf("\?")+1).match(reg);if (r!=null) return unescape(r[2]); return null;}
function getCode(codeID) {var CodeFile = "/GetCode.asp";if(G(codeID+'_img'));G(codeID).value='';G(codeID+'_img').innerHTML = '<img src="'+CodeFile+'?t='+Math.random()+'" height="16px" style="border:0;vertical-align:middle;line-height:16px;" /> <a href="javascript:getCode(\''+codeID+'\');">换一张</a>';}
function CheckAll(form){for (var i=0;i<form.elements.length;i++){var e = form.elements[i];if (e.name != 'chkall' && e.type=='checkbox'){e.checked = form.chkall.checked;}}}
function bookmarkit(){var myHerf=top.location.href;
var title=document.title;try{if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function')){window.sidebar.addPanel(title,myHerf,title);}else{window.external.AddFavorite(myHerf,title);}}catch(e){}return false;}
function get_post(postid,selectid,cityid,tbody){if (tbody==1){var devalue='--不限--';}else{var devalue='--请选择--';};G(selectid).options.length=0;G(selectid).options.add(new Option(devalue,"0"));if (postid!=0 || selectid=='country'){var ajaxobj=new AJAXRequest;ajaxobj.method="POST";ajaxobj.url="/reg.asp?action=get&PostID="+postid +"";ajaxobj.callback=function(xmlobj){var response = xmlobj.responseText;if (response!=''){var str=response;var arrstr= new Array();arrstr = str.split(",");for(var i=0;i<=arrstr.length-1;i++){var myEle = document.createElement("OPTION") ;var subarr=arrstr[i].split("|");myEle.value = subarr[0];if(cityid==subarr[0]){myEle.selected=true;};myEle.text = subarr[1];G(selectid).options.add(myEle);}}};ajaxobj.send();}}
function get_school(postid,selectid,graid,tbody){G(selectid).options.length=0;if (tbody==1){var devalue='--不限--';}else{var devalue='--请选择--';}G(selectid).options.add(new Option(devalue,"0"));if (postid!=0){var ajaxobj=new AJAXRequest;ajaxobj.method="POST";ajaxobj.url="/reg.asp?action=school&PostID="+postid +"";ajaxobj.callback=function(xmlobj) {var response = xmlobj.responseText;if (response!=''){var str=response;var arrstr= new Array();arrstr = str.split(",");for(var i=0;i<=arrstr.length-1;i++){var myEle = document.createElement("OPTION") ;var subarr=arrstr[i].split("|");myEle.value = subarr[0];if(graid==subarr[0]){myEle.selected=true;};myEle.text = subarr[1];G(selectid).options.add(myEle);}}};ajaxobj.send();}}
function getXmlhttp(){var XmlRequest=false;try{XmlRequest = new XMLHttpRequest();} catch (trymicrosoft){try{XmlRequest = new ActiveXObject("Msxml2.XMLHTTP");}catch (othermicrosoft){try{XmlRequest = new ActiveXObject("Microsoft.XMLHTTP");} catch (failed){XmlRequest = false;}}}if (!XmlRequest){alert("can't create XMLHttpRequest object.");}return XmlRequest;}
function AJAXRequest(){var xmlObj = getXmlhttp();if (!xmlObj) return false;var CBfunc,ObjSelf;ObjSelf=this;this.method="POST";this.url;this.async=true;this.content="";this.callback=function(cbobj){return;};this.send=function(){if(!this.method||!this.url||!this.async) return false;xmlObj.open (this.method, this.url, this.async);if(this.method=="POST") xmlObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlObj.onreadystatechange=function(){if(xmlObj.readyState==4) {if(xmlObj.status==200) {ObjSelf.callback(xmlObj);}}};if(this.method=="POST") xmlObj.send(this.content);else xmlObj.send(null);}}
function CheckForm(FormName,GetbyID,BkText){var fName=G(FormName).value;if (fName==''){G(GetbyID).innerHTML="<font color=red>* "+BkText+" <- </font>";G(FormName).focus();}}
function CopyCode(mURL){var title=document.title;var testCode=title+mURL;if(copy2Clipboard(testCode)!=false){alert("地址复制成功！您可以用MSN/QQ等聊天工具告诉您的好友！ ");}}copy2Clipboard=function(txt){if(window.clipboardData){window.clipboardData.clearData();window.clipboardData.setData("Text",txt);}else if(navigator.userAgent.indexOf("Opera")!=-1){window.location=txt;}else if(window.netscape){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");}catch(e){alert("您的firefox安全限制限制您进行剪贴板操作，请打开’about:config’将signed.applets.codebase_principal_support’设置为true’之后重试，相对路径为firefox根目录/greprefs/all.js");return false;}var clip=Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);if(!clip)return;var trans=Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);if(!trans)return;trans.addDataFlavor('text/unicode');var str=new Object();var len=new Object();var str=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);var copytext=txt;str.data=copytext;trans.setTransferData("text/unicode",str,copytext.length*2);var clipid=Components.interfaces.nsIClipboard;if(!clip)return false;clip.setData(trans,null,clipid.kGlobalClipboard);}}
function province(SelName,SelValue,tbody){var j=2;var PostStr=new Array("","总站","北京","天津","上海","重庆","河北省","河南省","黑龙江省","吉林省","辽宁省","山东省","内蒙古自治区","江苏省","安徽省","山西省","陕西省","甘肃省","浙江省","江西省","湖北省","湖南省","贵州省","四川省","云南省","新疆自治区","宁夏自治区","青海省","西藏自治区","广西省","深圳","福建省","海南省","广东省","台湾省","香港特区","澳门特区");G(SelName).options.length=0;if (tbody==1){var devalue='--不限--';}else{var devalue='--请选择--';}G(SelName).options.add(new Option(devalue,"0"));if (tbody==2){j=1;};for(i=j;i<=PostStr.length-1;i++){var myEle = document.createElement("OPTION");myEle.value = i;myEle.text = PostStr[i];if(SelValue==i){myEle.selected=true;};G(SelName).options.add(myEle);}}
function selectSetItem(selectName,sel_value){for(var i=0;i<selectName.options.length;i++){if(selectName.options[i].value==sel_value)selectName.options[i].selected=true;}}
function tabit(btn){var idname = new String(btn.id);var s = idname.indexOf("_");var e = idname.lastIndexOf("_")+1;var tabName = idname.substr(0, s);var id = parseInt(idname.substr(e, 1));var tabNumber = btn.parentNode.childNodes.length;for(i=0;i<tabNumber;i++){G(tabName+"_div_"+i).style.display = "none";G(tabName+"_btn_"+i).className = "";};G(tabName+"_div_"+id).style.display = "block";btn.className = "curr";};
function readcookie(name){var arr,reg=new RegExp("(^|)"+name+"=([^;]*)(;|$)");if(arr=document.cookie.match(reg)){return decodeURIComponent(arr[2]);}else{return null;}}
//function readcookie(name){var cookieValue = "";var search = name + "=";if(document.cookie.length > 0){offset = document.cookie.indexOf(search);if (offset != -1){offset += search.length;end = document.cookie.indexOf(";", offset);if (end == -1) end = document.cookie.length;cookieValue = decodeURIComponent(document.cookie.substring(offset, end));}};return cookieValue;}
function writeCookie(name, value, hours){var expire = "";if(hours != null){expire = new Date((new Date()).getTime() + hours * 3600000);expire = "; expires=" + expire.toGMTString();}document.cookie = name + "=" + escape(value) + expire + ";path=/";}
function get_uid(cookies){if(cookies=='userid'){cookies=='loginuid'};var str_tmp	= readcookie(cookies);if(!str_tmp){return false;}var end = str_tmp.indexOf("&");if (end!='-1'){var uid=str_tmp.substr(0,end);}else{uid=str_tmp;};return uid;}
function replaceUrl(paramName,paramVal){var re=eval('/('+ paramName+'=)([^&]*)/gi');var mre=locurl.match(re);if (mre!=null){var nUrl = locurl.replace(re,paramName+'='+paramVal);}else{nUrl=locurl+'&'+paramName+'='+paramVal;}this.location = nUrl;}
function bbsBoxUrl(paramName,paramVal){var re=eval('/('+ paramName+'=)([^&]*)/gi');var mre=locurl.match(re);if (mre!=null){var nUrl = locurl.replace(re,paramName+'='+paramVal);}else{nUrl=locurl+'&'+paramName+'='+paramVal;}parent.bbsbox.location.href = nUrl;}
function NsloveFlash(element,url,width,height,images,links,texts){if (!G(element)) return;var borderwidth = width + 2;var borderheight = height + 2;images=rTrim(images,"|");links=rTrim(links);texts=rTrim(texts);var str = '';str += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,9,0" width="'+ width +'" height="'+ height +'">';str += '<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="'+url+'"><param name="quality" value="high"><param name="bgcolor" value="#ffffff">';str += '<param name="menu" value="false"><param name=wmode value="opaque">';str += '<param name="FlashVars" value="pics='+images+'&amp;links='+links+'&amp;texts='+texts+'&amp;borderwidth='+borderwidth+'&amp;borderheight='+borderheight+'&amp;textheight=0">';str += '<embed src="'+url+'" wmode="opaque" FlashVars="pics='+images+'&amp;links='+links+'&amp;texts='+texts+'&amp;borderwidth='+borderwidth+'&amp;borderheight='+borderheight+'&amp;textheight=0" menu="false" bgcolor="#ffffff" quality="high" width="'+ width +'" height="'+ height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';str += '</object>';G(element).innerHTML = str;}
function rTrim(str,s){var iLength;iLength = str.length;if (str.charAt(iLength - 1) ==s){str = str.substring(0, iLength - 1);str = rTrim(str);} return str;}
function build_day(value,get_id,sel){var m=31;var t=0;if (value==2){m=29;}if (value==4 || value==6 || value==9 || value==11){m=30;}for(var i=1;i<=m;i++){var sOption = document.createElement("OPTION");sOption.text = i;sOption.value = i;if (i==sel){sOption.selected=sel;};G(get_id).options.add(sOption);}}
function build_age(ID,sel){G(ID).options.length=0;G(ID).options.add(new Option( "--不限--","0"));for(var i=16;i<=80;i++){var sOption = document.createElement("OPTION");sOption.text = i;sOption.value = i;if (i==sel){sOption.selected=sel;};G(ID).options.add(sOption);}}
function SelHeight(ID,sel,tbody){G(ID).options.length=0;if (tbody==1){var devalue='--不限--';}else{var devalue="--请选择--";}G(ID).options.add(new Option(devalue,"0")); for(var i=140;i<=230;i++){var sOption = document.createElement("OPTION");sOption.text = i;sOption.value = i;if (i==sel){sOption.selected=sel;};G(ID).options.add(sOption);}}
function SelWeight(ID,sel,tbody){G(ID).options.length=0;if (tbody==1){var devalue='--不限--';}else{var devalue="--请选择--";}G(ID).options.add(new Option(devalue,"0")); for(var i=35;i<=130;i++){var sOption = document.createElement("OPTION");sOption.text = i;sOption.value = i;G(ID).options.add(sOption);}}
function show_div(divid){if (G(divid).style.display == 'none'){G(divid).style.display = 'block';}else{G(divid).style.display = 'none';}}
function PrintHtml(_Html_){var HtmlStr='<div style="float:left;width:100%;text-indent:8px;font-size:16px;line-height:80px;color:#636363;">';HtmlStr=HtmlStr+_Html_;HtmlStr=HtmlStr+'</div>';pop=new Popup({ contentType:2, isReloadOnClose:false, width:380, height:80});pop.setContent("title","操作提示");pop.setContent("contentHtml",HtmlStr);pop.build();pop.show();setTimeout(function(){pop.close()},3000);}
function chat(userid){if (chk_user()==true){pop=new Popup({ contentType:1, isReloadOnClose:false, width:350, height:80 });pop.setContent("title","邀请聊天");pop.setContent("contentUrl",'/my/chat.asp?action=invite&userid='+userid+'');pop.build();pop.show();}}
function call(userid){if (chk_user()==true){pop=new Popup({ contentType:1, isReloadOnClose:false, width:430, height:260 });pop.setContent("title","打个招呼");pop.setContent("contentUrl",'/my/usermsg.asp?action=call&type=1&userid='+userid+'');pop.build();pop.show();}}
function leer(userid){if (chk_user()==true){pop=new Popup({ contentType:1, isReloadOnClose:false, width:430, height:210 });pop.setContent("title","暗送秋波");pop.setContent("contentUrl",'/my/usermsg.asp?action=call&type=2&userid='+userid+'');pop.build();pop.show();}}
function friend(userid){if (chk_user()==true){pop=new Popup({ contentType:1, isReloadOnClose:false, width:450, height:300 });pop.setContent("title","加为好友");pop.setContent("contentUrl",'/my/friend.asp?action=new&userid='+userid+'');pop.build();pop.show();}}
function hi(userid){if (chk_user()==true){location.href='/my/chat.asp?action=chat&userid='+userid+'';}}
function avatar(userid){pop=new Popup({ contentType:1, isReloadOnClose:false, width:430, height:170 });pop.setContent("title","查看照片");pop.setContent("contentUrl",'/search/user.asp?action=avatar&userid='+userid+'');pop.build();pop.show();}
function chk_user(){if (get_uid("loginuid")==0){alert("对不起，请先登录！");return false;}return true;}
function chk_login(){/*var re = /^[_a-zA-Z0-9\-\.]+@([\-_a-zA-Z0-9]+\.)+[a-zA-Z0-9]{2,3}$/;
if (G("lname").value.trim()==""){alert("请输入登录邮件！");G("lname").focus();return;}
if (!G("lname").value.match(re)){alert("您输入的邮件帐号有误！");G("lname").focus();return;}
if (G("lpsw").value.trim()==""){alert("请输入用户密码！");G("lpsw").focus();return;}
if (G("getcode").value.trim()==''){alert("请输入验证码！");G("getcode").focus();return;}*/check_login();}function check_login(){pop=null;pop=new Popup({ contentType:1, isReloadOnClose:false, width:430, height:100});pop.setContent("title","会员登录");pop.setContent("contentUrl","");pop.build();pop.show();G("lgform").target=pop.iframeIdName;}function doZoom(size){G("tc").style.fontSize=size;}
function sugcomm(id){pop=new Popup({ contentType:1, isReloadOnClose:false, width:500, height:300});pop.setContent("title","意见反馈");pop.setContent("contentUrl",'/mark.asp?action=sug&sortid='+id+'');pop.build();pop.show();}
function goshare(sortid,id){pop=new Popup({ contentType:1, isReloadOnClose:false, width:500, height:300});pop.setContent("title","发给朋友");pop.setContent("contentUrl",'/mark.asp?action=send&sortid='+sortid+'&id='+id+'');pop.build();pop.show();}
function acpchat(sortid,id){pop=new Popup({ contentType:1, isReloadOnClose:false, width:350, height:80});pop.setContent("title","允许拒绝");pop.setContent("contentUrl",'/my/chat.asp?action=accept&check='+sortid+'&id='+id+'');pop.build();pop.show();setTimeout(function(){pop.close()},2000);}function maquee(divid,steep){var myfunc=function (){G(divid).appendChild(G(divid).firstChild);};G(divid).onmouseover=function(){clearInterval(t);};G(divid).onmouseout=function(){t=setInterval(myfunc,steep);};var t=setInterval(myfunc,steep);}
function music(id){pop=new Popup({ contentType:1, isReloadOnClose:false, width:400, height:200});pop.setContent("title","收听点歌");pop.setContent("contentUrl",'/search/music.asp?action=music&songid='+id+'');pop.build();pop.show();}