﻿ function $ID(){

var elements=new Array();

for(var i=0;

i<arguments.length;

i++){

var element=arguments[i];

if(typeof element=='string')element=document.getElementById(element);

if(arguments.length==1)return element;

elements.push(element);

} return elements;

} var request={

QueryString:function(val){

var uri=window.location.search;

var re=new RegExp(""+val+"=([^&?]*)","ig");

return((uri.match(re))?(uri.match(re)[0].substr(val.length+1)):"");

}

} ;

var requestFromStr={

QueryString:function(Str,val){

var uri=Str.substring(0,1)=="?"?Str:"?"+Str;

var re=new RegExp("[&?]"+val+"=([^&?]*)","ig");

return((uri.match(re))?(uri.match(re)[0].substr(val.length+2)):"");

}

} ;

function getY(el){

var y=0;

for(var e=el;

e;

e=e.offsetParent)y+=e.offsetTop;

for(e=el.parentNode;

e&&e!=document.body;

e=e.parentNode)if(e.scrollTop)y-=e.scrollTop;

return y;

} function getX(el){

var x=0;

while(el){

x+=el.offsetLeft;

el=el.offsetParent;

} return x;

} var Geometry={

} ;

Geometry.getWindowX=function(){

return window.screenLeft||window.screenX;

} ;

Geometry.getWindowY=function(){

return window.screenTop||window.screenY;

} ;

Geometry.getViewportWidth=function(){

return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body.clientWidth;

} ;

Geometry.getViewportHeight=function(){

return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body.clientHeight;

} ;

Geometry.getHorizontalScroll=function(){

return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft;

} ;

Geometry.getVerticalScroll=function(){

return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop;

} ;

Geometry.getDocumentHeight=function(){

return(window.innerHeight&&window.scrollMaxY)?window.innerHeight+window.scrollMaxY:(document.body.scrollHeight>document.body.offsetHeight)?document.body.scrollHeight:document.body.offsetHeight;

} ;

rnd.today=new Date();

rnd.seed=rnd.today.getTime();

function rnd(){

rnd.seed=(rnd.seed*9301+49297)%233280;

return rnd.seed/(233280.0);

} function rand(number){

return Math.ceil(rnd()*number);

} var Ajax=function(){

return Try.these(function(){

return new XMLHttpRequest()

} ,function(){

return new ActiveXObject('Msxml2.XMLHTTP')

} ,function(){

return new ActiveXObject('Microsoft.XMLHTTP')

} )||false;

} ;

var Try={

these:function(){

var returnValue;

for(var i=0,length=arguments.length;

i<length;

i++){

var lambda=arguments[i];

try{

returnValue=lambda();

break;

} catch(e){

}

} return returnValue;

}

} ;

function LTrim(str,delStr){

var whitespace=new String(delStr);

var s=new String(str);

if(whitespace.indexOf(s.charAt(0))!=-1){

var j=0,i=s.length;

while(j<i&&whitespace.indexOf(s.charAt(j))!=-1){

j++;

} s=s.substring(j,i);

} return s;

} ;

function RTrim(str,delStr){

var whitespace=new String(delStr);

var s=new String(str);

if(whitespace.indexOf(s.charAt(s.length-1))!=-1){

var i=s.length-1;

while(i>=0&&whitespace.indexOf(s.charAt(i))!=-1){

i--;

} s=s.substring(0,i+1);

} return s;

} ;

function TrimLR(str,delStr){

return RTrim(LTrim(str,delStr),delStr);

} ;

function StringBuilder(str){

this.tmp=new Array();

} ;

StringBuilder.prototype.Append=function(value){

this.tmp.push(value);

return this;

} ;

StringBuilder.prototype.Clear=function(){

this.tmp.length=1;

} ;

StringBuilder.prototype.toString=function(){

return this.tmp.join('');

} ;

StringBuilder.prototype.TrimEnd=function(val){

if(this.tmp[this.tmp.length-1]==val)return this.tmp.pop();

else return this.tmp;

} ;

Array.prototype.indexOf=function(substr,start){

var ta,rt,d='\0';

if(start!=null){

ta=this.slice(start);

rt=start;

} else{

ta=this;

rt=0;

} var str=d+ta.join(d)+d,t=str.indexOf(d+substr+d);

if(t==-1)return-1;

rt+=str.slice(0,t).replace(/[^\0]/g,'').length;

return rt;

} ;

Array.prototype.lastIndexOf=function(substr,start){

var ta,rt,d='\0';

if(start!=null){

ta=this.slice(start);

rt=start;

} else{

ta=this;

rt=0;

} ta=ta.reverse();

var str=d+ta.join(d)+d,t=str.indexOf(d+substr+d);

if(t==-1)return-1;

rt+=str.slice(t).replace(/[^\0]/g,'').length-2;

return rt;

} ;

Array.prototype.replace=function(reg,rpby){

var ta=this.slice(0),d='\0';

var str=ta.join(d);

str=str.replace(reg,rpby);

return str.split(d);

} ;

Array.prototype.search=function(reg){

var ta=this.slice(0),d='\0',str=d+ta.join(d)+d,regstr=reg.toString();

reg=new RegExp(regstr.replace(/\/((.|\n)+)\/.*/g,'\\0$1\\0'),regstr.slice(regstr.lastIndexOf('/')+1));

t=str.search(reg);

if(t==-1)return-1;

return str.slice(0,t).replace(/[^\0]/g,'').length;

} ;

function CShow(id,ifShow){

if($ID(id)!=null)$ID(id).style.display=ifShow?"":"none";

} function ClearParameter(str,key){

var val=requestFromStr.QueryString(str,key);

str=str.replace("&"+key+"="+val,"");

str=str.replace("?"+key+"="+val,"");

return str;

} function UrlEncode(str){

return escape(str).replace(/\+/gi,"%2b").replace(/%B7/gi,"%A1%A4");

} function UrlDecode(str){

return unescape(str).replace(/%2b/gi,"+");

} function UrlEncode2(str){

return transform(str);

} function transform(s){

var hex=''

var i,j,t

j=0

for(i=0;

i<s.length;

i++){

t=hexfromdec(s.charCodeAt(i));

if(t=='25'){

t='';

} hex+='%'+t;

} return hex;

} function hexfromdec(num){

if(num>65535){

return("err!")

} first=Math.round(num/4096-.5);

temp1=num-first*4096;

second=Math.round(temp1/256-.5);

temp2=temp1-second*256;

third=Math.round(temp2/16-.5);

fourth=temp2-third*16;

return(""+getletter(third)+getletter(fourth));

} function getletter(num){

if(num<10){

return num;

} else{

if(num==10){

return"A"

} if(num==11){

return"B"

} if(num==12){

return"C"

} if(num==13){

return"D"

} if(num==14){

return"E"

} if(num==15){

return"F"

}

}

} function ClearOrSetTips(obj,msg){

if(!obj)return;

if(obj.value!=""){

if(obj.value==msg)obj.value="";

} else obj.value=msg;

} function GetSubString(str,len){

if(len=="undefined"){

return str;

} var newStr=new Array();

var index=0;

for(var i=0;

i<=str.length-1;

i++){

var _str=str.substring(i,i+1);

var code=escape(str.charAt(i));

if((code.length>=4)&&(code<'%uFF60'||code>'%uFF9F')){

index=index+2;

} else{

index=index+1;

} if(index<=len){

newStr.push(_str);

} else{

newStr.push("...");

break;

}

} return newStr.join("");

} function GetSubString1(str,len,flag){

if(len=="undefined"){

return str;

} var newStr=new Array();

var index=0;

var IndexT=0;

for(var i=0;

i<=str.length-1;

i++){

var _str=str.substring(i,i+1);

var code=escape(str.charAt(i));

if(((_str=="�"||_str=="�")&&flag==1)){

IndexT+=1;

newStr.push(_str);

continue;

} if(((code.length>=4)&&(code<'%uFF60'||code>'%uFF9F'))||_str==" "){

index=index+2;

} else{

index=index+1;

} if(index<=len){

newStr.push(_str);

} else{

if(IndexT%2!=0)newStr.push("�");

newStr.push("...");

break;

}

} return newStr.join("");

} function GetStrLen(str,flag){

if(flag==1)str=str.replace(/�/g,"").replace(/�/g,"");

var index=0;

for(var i=0;

i<=str.length-1;

i++){

var _str=str.substring(i,i+1);

var code=escape(str.charAt(i));

if(((code.length>=4)&&(code<'%uFF60'||code>'%uFF9F'))||_str==" "){

index=index+2;

} else{

index=index+1;

}

} return index;

} function SetClass(obj,classname){

obj.className=classname;

} function getCookie(str){

var tmp,reg=new RegExp("(^| )"+str+"=([^;]*)(;|$)","gi");

if(tmp=reg.exec(document.cookie))return(tmp[2]);

return null;

} function URlDecode(str){

$.get("/URlDecode.awp?str="+str+"&rnd="+rnd(),function(text){

str=text;

return str;

} );

} 