functionmap(a,f){f(a);}
functiongetRand(a,b)
{
if(a)
{
b=b?b:0;
returnMath.floor(Math.random()*a+b);
}else
{
a=newDate();
returnd.getTime();
}
}
function$(a){document.write(a);}
function$$()
{
varelements=newArray();
for(vari=0;i
varelement=arguments[i];
if(typeofelement=='string')
element=document.getElementById(element);
if(arguments.length==1)
returnelement;
elements.push(element);
}
returnelements;
}
functionfGetCookie(name)
{
varcookieValue="";
varsearch=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=unescape(document.cookie.substring(offset,end));
}
}
returncookieValue;
}
functionJ_get(name)
{
varjs_get=self.window.document.location.href;
varstart=js_get.indexOf(name+'=');
if(start==-1)return'';
varlen=start+name.length+1;
varend=js_get.indexOf('&',len);
if(end==-1)end=js_get.length;
returnunescape(js_get.substring(len,end));
}
functionwriteCookie(name,value,hours)
{
varexpire="";
vardomain=";domain=jb51.net;path=/";
if(hours!="")
{
expire=newDate((newDate()).getTime()+hours*60*60*1000);
expire=";expires="+expire.toGMTString();
}
document.cookie=name+"="+escape(value)+domain;
}
functioncreateXMLHttp()
{
varret=null;
try{
ret=newActiveXObject('Msxml2.XMLHTTP');
}
catch(e){
try{
ret=newActiveXObject('Microsoft.XMLHTTP');
}
catch(ee){
ret=null;
}
}
if(!ret&&typeofXMLHttpRequest!='undefined')
ret=newXMLHttpRequest();
returnret;
}
functionloadXmlToElement(fragment_url,element_id,mode,de)
{
varelement=$$(element_id);
varxmlhttp=createXMLHttp();
varstr;
xmlhttp.open("GET",fragment_url);
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4&&xmlhttp.status==200)
{
if(!mode)
{
str=xmlhttp.responseXML.getElementsByTagName("data")[0].childNodes[0].nodeValue;
if(!element.innerHTML)
{
try{
str=xmlhttp.responseXML.firstChild.childNodes[1].nodeValue;
}catch(e){}
}
}elseif(mode=='txt')
{
str=xmlhttp.responseText;
}
if(de)str=unescape(str);
element.innerHTML=str;
}
}
xmlhttp.send(null);
}
varoJson=newObject();
varfJson=
{
"data":{},//[0,y,yes,空值]:默认,[-1,n,no]:不运行flush(),
"file":{},//附加js代码文件
"str":{},//附加JS代码
"set":function(element,vars)
{
for(keyinvars)
{
this[key][element]=vars[key];
}
},
"getSrc":function(element)
{
varrs='';
if(this['data'][element])
{
if(this['data'][element]=='n'||this['data'][element]=='-1'||this['data'][element]=='no')
{
rs+='&gJsonData=n';
}
}
if(this['str'][element])
{
rs+='&gJsonDoStr='+escape(this['str'][element]);
}
if(this['file'][element])
{
rs+='&gJsonDoFile='+escape(this['file'][element]);
}
returnrs;
},
"main":function(url,element,un)
{
un=un?un:0;
eval("oJson."+element+"=newfJson.__Json('"+url+"','"+element+"','"+un+"')");
},
"__Json":function(url,element,un)
{
vara=document.getElementById("script_"+element)
if(!a)
{
a=document.createElement("script");
a.setAttribute("id","script_"+element);
}
a.un=un;
a.data='';
a.src=url+((url.indexOf('?')==-1)?'?':'&')+'gJson='+element+fJson.getSrc(element);
if(navigator.appVersion.indexOf("MSIE")==-1)
{
document.getElementById(element).insertBefore(a,null);
}else
{
document.body.insertAdjacentElement("BeforeBegin",a);
}
returna;
},
"flush":function(element)
{
document.getElementById(element).innerHTML=(oJson[element].un)?unescape(oJson[element].data):oJson[element].data;
//oJson[element]=null;
}
}
/*应用*/
functionsubPageSelect(b,e,d,a)//b开始e结束d默认a动作
{
varshtml='<select'+a+'>';
for(vari=b;i<=e;i++)
{
shtml+='
}
shtml+='select>';
returnshtml;
}
functionerr(a,b,c)
{
if(b)
{
if(c)
{
a.src='http://www.jb51.net/space/imgs/all/thu_woman.gif';
}else
{
a.src='http://v.jb51.net:88/img/user_no_photo.gif';
}
}else
{
a.src='http://v.jb51.net:88/img/flv_no_photo.gif';
}
}
functionimg_onerr(a)
{
err(a);
}
functiongowin(a)
{
document.location=a;
}
functionCopyInBoard(hahaUrl,note)
{
note=note?note:'网址复制成功啦!';
window.clipboardData.setData('text',hahaUrl)
alert(note);
}
functionfDoMask(a,f,s,c,p,color)//a元素f刷新调函数s样式c内容p透明度
{
a=$$(a);
p=p?p:75;
s='