﻿function _gel(a){return document.getElementById?document.getElementById(a):null;}
var am=null;
var ama=null;
var amfly=null;
var ig_host=location.host;
var ig_href=location.href;
var ig_user="/user/index.asp";
var ig_asdf="http://"+ig_host+ig_user;
function Cookie(document, name, hours, path, domain, secure)
{this.$document = document;
this.$name = name;
if (hours){
this.$expiration = new Date((new Date()).getTime() + hours*3600000);}
else
{this.$expiration = null;}
if (path) this.$path = path; else this.$path = null;
if (domain) this.$domain = domain; else this.$domain = null;
if (secure) this.$secure = true; else this.$secure = false;
}
Cookie.prototype.store = function ()
{
var cookieval = "";
for(var prop in this) {
if ((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function'))
continue;
if (cookieval != "") cookieval += '&';
cookieval += prop + ':' + escape(this[prop]);
}

var cookie = this.$name + '=' + cookieval;
if (this.$expiration)
cookie += '; expires=' + this.$expiration.toGMTString();
if (this.$path) cookie += '; path=' + this.$path;
if (this.$domain) cookie += '; domain=' + this.$domain;
if (this.$secure) cookie += '; secure';

 this.$document.cookie = cookie;
}
Cookie.prototype.load = function()
{
var allcookies = this.$document.cookie;
if (allcookies == "") return false;

var start = allcookies.indexOf(this.$name + '=');
if (start == -1) return false;
start += this.$name.length + 1;
var end = allcookies.indexOf(';', start);
if (end == -1) end = allcookies.length;
var cookieval = allcookies.substring(start, end);

var a = cookieval.split('&');
for(var i=0; i < a.length; i++)
a[i] = a[i].split(':');

for(var i = 0; i < a.length; i++) {
this[a[i][0]] = unescape(a[i][1]);
}
 return true;
}
Cookie.prototype.remove = function()
{
var cookie;
cookie = this.$name + '=';
if (this.$path) cookie += '; path=' + this.$path;
if (this.$domain) cookie += '; domain=' + this.$domain;
cookie += '; expires=Fri, 02-Jan-1970 00:00:00 GMT';
this.$document.cookie = cookie;
}
Cookie.prototype.getval = function(key, default_val)
{
if (!this[key])
return default_val;
else
return this[key];
}
function _upc(){aI(_cols);az=true;}
function ag(){if(!am){
am=document.createElement("li");
am.style.display="none";
am.style.position="absolute";
am.style.cursor="move";
am.style.backgroundColor="#ffffff";
am.style.paddingBottom="0px";
document.body.appendChild(am)}return am}
function ay(){ag().style.display="none";}
function aH(a,aa,ab)
{var ac=parseInt(ag().style.left);
var ad=parseInt(ag().style.top);
var ae=(ac-ao(a,true))/ab;
var af=(ad-ao(a,false))/ab;
return setInterval(function(){if(ab<1){clearInterval(aq);ay();return}
ab--;
ac-=ae;
ad-=af;
ag().style.left=parseInt(ac)+"px";
ag().style.top=parseInt(ad)+"px"
},aa/ab)
}
function aC(a)
{
for(var aa=0;aa<aj.length;aa++)
{
var ab=0;
var ad=aj[aa];
if(ad==a)ab=ad.offsetHeight;
ad.pagePosLeft=ao(ad,true);
ad.pagePosTop=ao(ad,false)-ab
}

}
function ao(a,aa)
{
var ab=0;
while(a!=null)
{
ab+=a["offset"+(aa?"Left":"Top")];
a=a.offsetParent
}
return ab
}
function aK(a,aa,ab)
{
var ac=null;
var ad=100000000;
for(var ae=0;ae<aj.length;ae++)
{
var ah=aj[ae];
if(ah==a)continue;
var ai=Math.sqrt(Math.pow(aa-ah.pagePosLeft,2)+Math.pow(ab-ah.pagePosTop,2));
if(isNaN(ai))continue;
if(ai<=ad)
{
ad=ai;
ac=ah;
}
}
if(ac!=null&&a.nextSibling!=ac)
{
a.style.backgroundColor="#000000";
ac.parentNode.insertBefore(a,ac);
}

}
function _sendx(a,aa,aaa)
{
var ab=aQ(),fb_d;
ab.open("GET",a,true);
if(aa)
{
fb_d="正在打开,长时间没反应请点击<a href='/user/index.asp'>返回</a>重试.";
aa(fb_d,aaa);
ab.onreadystatechange=function(){if(ab.readyState==4){aa(ab.responseText,aaa)}};
}
ab.send(null);
}

function _sendr(a,aa,aaa,as,fb_d)
{
var ab=aQ();
ab.open("GET",a,true);
if(aa)
{
ab.onreadystatechange=function(){if(ab.readyState==4){aa(ab.responseXML,aaa,as,fb_d)}};
}
ab.send(null);
}

function aQ()
{
var a=null;
if(window.ActiveXObject)
{
a=new ActiveXObject("Msxml2.XMLHTTP");
if(!a)
{
a=new ActiveXObject("Microsoft.XMLHTTP")
}
}
else if(window.XMLHttpRequest)
{
a=new XMLHttpRequest()
}
return a
}
function aga()
{
if(!ama)
{
ama=document.createElement("div");
ama.style.display="none";
ama.style.textAlign="center";
ama.style.position="absolute";
ama.style.cursor="move";
ama.style.backgroundColor="#ffffff";
ama.style.paddingBottom="0px";
aga().onmouseover=function(){aga().style.display="block";};
aga().onmouseout=function(){aga().style.display="none";};
document.body.appendChild(ama)
}
return ama
}
function agfly()
{
if(!amfly)
{
amfly=document.createElement("div");
amfly.style.display="none";
amfly.style.position="absolute";
amfly.style.paddingBottom="0px";
document.body.appendChild(amfly)
}
return amfly
}
function _checkname(fb_a)
{
_sendx('/user/index.asp?c_k=checkname&c_aj=true&username='+fb_a,false)
}
function xswz(fb_a,fb_b)
{
fb_b.innerHTML=fb_a
}
function Editor(){
oEditor = document.wrEditor;
oEditor.document.designMode="On";
oEditor.focus();
}
function getContent()
{
return oEditor.document.body.innerHTML;
}
function CheckForm(obj){
obj.c_b.value = getContent();
}

function _paix(fb_a){fb_a.action="/user/index.asp?c_k=pxclass&c_s=0";return true;}
function _pdel(fb_a){fb_a.action="/user/index.asp?c_k=pcdel&c_s=0";return true;}
function _lpaix(fb_a){fb_a.action="/user/index.asp?c_k=pxlink&c_s=0";return true;}
function _pldel(fb_a){fb_a.action="/user/index.asp?c_k=pldel&c_s=0";return true;}
function f_js_style(fb_a,fb_b){_gel(fb_a).className=fb_b;}
function f_js_searchsub(){
var v=_gel("n_search").n_keyword.value;
v=_gel("n_search").action+v

window.open(v,null);
return false;
}



function line(fb_a,fb_b){
//fb_a 对象
//fb_b 动作

fb_a=_gel(fb_a);
if (fb_b==1){fb_a.style.display="none";}
if (fb_b==2){fb_a.style.display="block";}
if (fb_b==3){fb_a.style.display="";}
if (fb_b==4){fb_a.style.display="inline";}
if (fb_b==5){fb_a.style.visibility="visible";}
}
function s_ndcode(fb_a){
if (fb_a.innerHTML==null || fb_a.innerHTML==''){
fb_a.innerHTML="<img src='/user/inc/dvcode.asp?' onclick='this.src+=Math.random()' id='dvcode' alt='点击可刷新'>";
}
}
function chat(fb_a,fb_b){
//fb_a语句,fb_b哪里显示
var thea=_gel(fb_b);
var theaa=new Array();
theaa[0]=""
theaa[1]="5-20个字符(包括小写字母、数字、下划线)，一旦注册成功会员名不能修改。";
theaa[2]="密码由6-16个字符组成，我们推荐使用英文字母加数字或符号的组合密码.请记住您的密码以便登陆时使用.";
theaa[3]="请再输入一遍您刚刚输入的密码。";
theaa[4]="没有电子邮件？推荐使用免费的雅虎邮箱和网易邮箱。";
theaa[5]="看不清楚验证码?点击验证码图片就可以更换一个验证码.";
theaa[6]="必填.网站名称可以是网站的真实名称,也可以是你想要的任何名称.10个字以内.";
theaa[7]="必填.在这里填入网站的网址.";
theaa[8]="暂时不需要填.这里是图片或者是影音地址,以后用,现在填入没用.";
theaa[9]="可以不填.输入你的网址的简单介绍.";
theaa[10]="必填.网站名称可以是网站的真实名称,也可以是你想要的任何名称.10个字以内.";
theaa[11]="必填.在这里填入网站的网址.";
theaa[12]="暂时不需要填.这里是图片或者是影音地址,以后用,现在填入没用.";
theaa[13]="可以不填.输入你的网址的简单介绍.";
theaa[14]="用户名不能修改.";
theaa[15]="请输入你原先的密码.";
theaa[16]="请输入新密码.";
theaa[17]="请再次输入新密码.";
theaa[18]="这里是你的用户名,如果你没有登陆,请登陆后在这里填写你的用户名,否则不能正常添加.";
theaa[19]="第一次进入请点击添加网址,添加后可以点击返回首页看你添加的网址."
theaa[20]="拖放链接即可排序,排序结束请点击\"保存排序\"按钮."
theaa[21]="如果要批量删除请选择好后点击下面的\"批量删除\"按钮."
theaa[22]="推荐网址和名称都填写.添加好链接后点击右上角的\"返回首页\"可以查看添加的效果."
theaa[23]=""
theaa[24]=""
if (fb_a>theaa.length-1){fb_a=0;};
thea.innerHTML=theaa[fb_a];
thea.className="chatdq";
}

function aspcookieread(fb_a,fb_b){//读取asp的cookie
var jf_index=document.cookie;
var jf_ww=jf_index.indexOf(fb_a+'=');
if (jf_ww!=-1){
var start=jf_ww+fb_a.length+1;
var end =jf_index.indexOf(";",start);
if (end ==-1 ) end =jf_index.length;
var value = jf_index.substring(start,end);
var a = value.split('&');
var ww=new Array;
for(var i=0; i < a.length; i++)
a[i] = a[i].split('=');
for(var i = 0; i < a.length; i++) {
ww[a[i][0]] = a[i][1];
}
return ww[fb_b];
}
}
//后台链接显示
function class_link(fb_a,fb_b,fb_c,fb_d,fb_e){
this.id=fb_a;
this.name=fb_b;
this.paix=fb_c;
this.att=fb_d;
this.hidden=fb_e;
}
var view_class_linkstext="",view_class_links2text=""
function view_class_links(fb_a,fb_b){
var fb_c="";
for(i=0;i<fb_a.length ;i++)
{
fb_c+="<li id="+fb_a[i].id+" onmouseover=\"f_js_style(this.id,'ht_dangqian');\" onmouseout=\"f_js_style(this.id,'ht_bdangqian');\"><INPUT type=hidden value=\""+fb_a[i].id+"\" name=c_ld><a href='/user/index.asp?c_l="+fb_a[i].id+"&c_k=golink'>"+fb_a[i].name+"</a></li>";
}
view_class_linkstext="<ol>"+fb_c+"</ol>";
}
function view_class_links2(fb_a,fb_b){
var fb_c="";
for(i=0;i<fb_a.length ;i++)
{
fb_c+="<li id="+fb_a[i].id+" onmouseover=\"f_js_style(this.id,'ht_dangqian');\" onmouseout=\"f_js_style(this.id,'ht_bdangqian');\"><p><INPUT type=hidden value=\""+fb_a[i].id+"\" name=c_ld><INPUT type=\"checkbox\" value=\""+fb_a[i].id+"\" name=\"n_lselect\"></p><span class=\"ht_olli_a\"><a href='/user/index.asp?c_l="+fb_a[i].id+"&c_k=golink'>"+fb_a[i].name+"</a></span><p><a href=\""+ig_asdf+"?c_k=editlink&c_s=0&c_m=&c_d=&c_l="+fb_a[i].id+"\" >编辑</a>"
if (fb_a[i].hidden)
{fb_c+="<a href=\""+ig_asdf+"?c_k=qyincang&c_aj=true&c_z=2&c_l="+fb_a[i].id+"\">对外公开</a>"}
else
{fb_c+="<a href=\""+ig_asdf+"?c_k=yincang&c_aj=true&c_z=2&c_l="+fb_a[i].id+"\">对外隐藏</a>"}
fb_c+="<a href=\""+ig_asdf+"?c_k=dellink&c_aj=true&c_l="+fb_a[i].id+"\">删除</a></p></li><div class=\"clear\"></div>";
}
view_class_links2text="<ol>"+fb_c+"</ol>";

}
function get_cols(fb_a){
_cols=new Array();
for(i=0;i<fb_a.length;i++)
{
	_cols[i]=_gel(fb_a[i].id)
}
}
//后台链接显示结束

function f_ingoto()
{
	var b_a,b_b,b_c;
	//b_b=ig_host.substr(0,ig_host.length-11);
	b_a=aspcookieread("asdfcncookie","username");
	b_c=aspcookieread("onlogin","username");
	ig_href=ig_href.substring(8+ig_host.length,ig_href.length)
	b_b=ig_href.substring(0,ig_href.indexOf("/")==-1?ig_href.length:ig_href.indexOf("/"))
	if (b_a!=undefined&&b_a!=""&&b_a!=null){
		//if (b_c!=undefined&&b_c!=""&&b_c!=null){
			_sendx(ig_asdf+"?c_k=qiantai&c_aj=true&w_a="+Math.random()+"&c_username="+b_a,xswz,_gel("l_asdf"));
		
		//}
		//else{
			
		//	_sendx(ig_asdf+"?c_k=qiantai&c_aj=true",xswz,_gel("l_asdf"));
				
		//}
	}
	else{

		if (b_b!=""&&b_b!="#"&&b_b!="index.htm"&&b_b!=undefined){
		
			_sendx("http://"+ig_host+ig_user+"?c_k=hqiantai&c_aj=true&c_h="+b_b,xswz,_gel("l_asdf"));
		}
	}
}
function h(obj,url){obj.style.behavior='url(#default#homepage)';obj.setHomePage(url);}
//验证类
Validator = {
Require : /.+/,
Email : /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
Phone : /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/,
Mobile : /^((\(\d{2,3}\))|(\d{3}\-))?13\d{9}$/,
Url : /^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/,
IdCard : "this.IsIdCard(value)",
Currency : /^\d+(\.\d+)?$/,
Number : /^\d+$/,
Zip : /^[1-9]\d{5}$/,
QQ : /^[1-9]\d{4,8}$/,
Integer : /^[-\+]?\d+$/,
Double : /^[-\+]?\d+(\.\d+)?$/,
English : /^[A-Za-z]+$/,
Chinese :  /^[\u0391-\uFFE5]+$/,
Username : /[\w\d]{3,20}$/i,
UnSafe : /^(([A-Z]*|[a-z]*|\d*|[-_\~!@#\$%\^&\*\.\(\)\[\]\{\}<>\?\\\/\'\"]*)|.{0,5})$|\s/,
IsSafe : function(str){return !this.UnSafe.test(str);},
SafeString : "this.IsSafe(value)",
Filter : "this.DoFilter(value, getAttribute('accept'))",
Limit : "this.limit(value.length,getAttribute('min'),  getAttribute('max'))",
LimitB : "this.limit(this.LenB(value), getAttribute('min'), getAttribute('max'))",
Date : "this.IsDate(value, getAttribute('min'), getAttribute('format'))",
Repeat : "value == document.getElementsByName(getAttribute('to'))[0].value",
Range : "getAttribute('min') < (value|0) && (value|0) < getAttribute('max')",
Compare : "this.compare(value,getAttribute('operator'),getAttribute('to'))",
Custom : "this.Exec(value, getAttribute('regexp'))",
Group : "this.MustChecked(getAttribute('name'), getAttribute('min'), getAttribute('max'))",
ErrorItem : [document.forms[0]],
ErrorMessage : ["以下原因导致提交失败：\t\t\t\t"],
Validate : function(theForm, mode){
var obj = theForm || event.srcElement;
var count = obj.elements.length;
this.ErrorMessage.length = 1;
this.ErrorItem.length = 1;
this.ErrorItem[0] = obj;
for(var i=0;i<count;i++){
with(obj.elements[i]){
var _dataType = getAttribute("dataType");
if(typeof(_dataType) == "object" || typeof(this[_dataType]) == "undefined")  continue;
this.ClearState(obj.elements[i]);
if(getAttribute("require") == "false" && value == "") continue;
switch(_dataType){
case "IdCard" :
case "Date" :
case "Repeat" :
case "Range" :
case "Compare" :
case "Custom" :
case "Group" : 
case "Limit" :
case "LimitB" :
case "SafeString" :
case "Filter" :
if(!eval(this[_dataType])){
this.AddError(i, getAttribute("msg"));
}
break;
default :
if(!this[_dataType].test(value)){
this.AddError(i, getAttribute("msg"));
}
break;
}
}
}
if(this.ErrorMessage.length > 1){
mode = mode || 1;
var errCount = this.ErrorItem.length;
switch(mode){
case 2 :
for(var i=1;i<errCount;i++)
this.ErrorItem[i].style.color = "red";
case 1 :
alert(this.ErrorMessage.join("\n"));
this.ErrorItem[1].focus();
break;
case 3 :
for(var i=1;i<errCount;i++){
try{
var span = document.createElement("SPAN");
span.id = "__ErrorMessagePanel";
span.style.color = "red";
this.ErrorItem[i].parentNode.appendChild(span);
span.innerHTML = this.ErrorMessage[i].replace(/\d+:/,"*");
}
catch(e){alert(e.description);}
}
this.ErrorItem[1].focus();
break;
default :
alert(this.ErrorMessage.join("\n"));
break;
}
return false;
}
return true;
},
limit : function(len,min, max){
min = min || 0;
max = max || Number.MAX_VALUE;
return min <= len && len <= max;
},
LenB : function(str){
return str.replace(/[^\x00-\xff]/g,"**").length;
},
ClearState : function(elem){
with(elem){
if(style.color == "red")
style.color = "";
var lastNode = parentNode.childNodes[parentNode.childNodes.length-1];
if(lastNode.id == "__ErrorMessagePanel")
parentNode.removeChild(lastNode);
}
},
AddError : function(index, str){
this.ErrorItem[this.ErrorItem.length] = this.ErrorItem[0].elements[index];
this.ErrorMessage[this.ErrorMessage.length] = this.ErrorMessage.length + ":" + str;
},
Exec : function(op, reg){
return new RegExp(reg,"g").test(op);
},
compare : function(op1,operator,op2){
switch (operator) {
case "NotEqual":
return (op1 != op2);
case "GreaterThan":
return (op1 > op2);
case "GreaterThanEqual":
return (op1 >= op2);
case "LessThan":
return (op1 < op2);
case "LessThanEqual":
return (op1 <= op2);
default:
return (op1 == op2);
}
},
MustChecked : function(name, min, max){
var groups = document.getElementsByName(name);
var hasChecked = 0;
min = min || 1;
max = max || groups.length;
for(var i=groups.length-1;i>=0;i--)
if(groups[i].checked) hasChecked++;
return min <= hasChecked && hasChecked <= max;
},
DoFilter : function(input, filter){
return new RegExp("^.+\.(?=EXT)(EXT)$".replace(/EXT/g, filter.split(/\s*,\s*/).join("|")), "gi").test(input);
},
IsIdCard : function(number){
var date, Ai;
var verify = "10x98765432";
var Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
var area = ['','','','','','','','','','','','北京','天津','河北','山西','内蒙古','','','','','','辽宁','吉林','黑龙江','','','','','','','','上海','江苏','浙江','安微','福建','江西','山东','','','','河南','湖北','湖南','广东','广西','海南','','','','重庆','四川','贵州','云南','西藏','','','','','','','陕西','甘肃','青海','宁夏','新疆','','','','','','台湾','','','','','','','','','','香港','澳门','','','','','','','','','国外'];
var re = number.match(/^(\d{2})\d{4}(((\d{2})(\d{2})(\d{2})(\d{3}))|((\d{4})(\d{2})(\d{2})(\d{3}[x\d])))$/i);
if(re == null) return false;
if(re[1] >= area.length || area[re[1]] == "") return false;
if(re[2].length == 12){
Ai = number.substr(0, 17);
date = [re[9], re[10], re[11]].join("-");
}
else{
Ai = number.substr(0, 6) + "19" + number.substr(6);
date = ["19" + re[4], re[5], re[6]].join("-");
}
if(!this.IsDate(date, "ymd")) return false;
var sum = 0;
for(var i = 0;i<=16;i++){
sum += Ai.charAt(i) * Wi[i];
}
Ai +=  verify.charAt(sum%11);
return (number.length ==15 || number.length == 18 && number == Ai);
},
IsDate : function(op, formatString){
formatString = formatString || "ymd";
var m, year, month, day;
switch(formatString){
case "ymd" :
m = op.match(new RegExp("^((\\d{4})|(\\d{2}))([-./])(\\d{1,2})\\4(\\d{1,2})$"));
if(m == null ) return false;
day = m[6];
month = m[5]*1;
year =  (m[2].length == 4) ? m[2] : GetFullYear(parseInt(m[3], 10));
break;
case "dmy" :
m = op.match(new RegExp("^(\\d{1,2})([-./])(\\d{1,2})\\2((\\d{4})|(\\d{2}))$"));
if(m == null ) return false;
day = m[1];
month = m[3]*1;
year = (m[5].length == 4) ? m[5] : GetFullYear(parseInt(m[6], 10));
break;
default :
break;
}
if(!parseInt(month)) return false;
month = month==0 ?12:month;
var date = new Date(year, month-1, day);
return (typeof(date) == "object" && year == date.getFullYear() && month == (date.getMonth()+1) && day == date.getDate());
function GetFullYear(y){return ((y<30 ? "20" : "19") + y)|0;}
}
 }
 
 
 