/*-------------------------------------------------------------------------------- 
 *       最后发布日期 2008年03月26日 15:45:42.89 版权所有 (C) YX8.COM 
 *--------------------------------------------------------------------------------*/ 

function CVwMd5(){
this.getMd5=function(str){
return hex_md5(str);};
var hexcase=0;
var b64pad="";
var chrsz=8;
function hex_md5(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz));}
function b64_md5(s){return binl2b64(core_md5(str2binl(s),s.length*chrsz));}
function str_md5(s){return binl2str(core_md5(str2binl(s),s.length*chrsz));}
function hex_hmac_md5(key,data){return binl2hex(core_hmac_md5(key,data));}
function b64_hmac_md5(key,data){return binl2b64(core_hmac_md5(key,data));}
function str_hmac_md5(key,data){return binl2str(core_hmac_md5(key,data));}
function md5_vm_test(){
return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72";}
function core_md5(x,len){
x[len>>5]|=0x80<<((len)%32);
x[(((len+64)>>>9)<<4)+14]=len;
var a=1732584193;
var b=-271733879;
var c=-1732584194;
var d=271733878;
for(var i=0;i<x.length;i+=16){
var olda=a;
var oldb=b;
var oldc=c;
var oldd=d;
a=md5_ff(a,b,c,d,x[i+0],7,-680876936);
d=md5_ff(d,a,b,c,x[i+1],12,-389564586);
c=md5_ff(c,d,a,b,x[i+2],17,606105819);
b=md5_ff(b,c,d,a,x[i+3],22,-1044525330);
a=md5_ff(a,b,c,d,x[i+4],7,-176418897);
d=md5_ff(d,a,b,c,x[i+5],12,1200080426);
c=md5_ff(c,d,a,b,x[i+6],17,-1473231341);
b=md5_ff(b,c,d,a,x[i+7],22,-45705983);
a=md5_ff(a,b,c,d,x[i+8],7,1770035416);
d=md5_ff(d,a,b,c,x[i+9],12,-1958414417);
c=md5_ff(c,d,a,b,x[i+10],17,-42063);
b=md5_ff(b,c,d,a,x[i+11],22,-1990404162);
a=md5_ff(a,b,c,d,x[i+12],7,1804603682);
d=md5_ff(d,a,b,c,x[i+13],12,-40341101);
c=md5_ff(c,d,a,b,x[i+14],17,-1502002290);
b=md5_ff(b,c,d,a,x[i+15],22,1236535329);
a=md5_gg(a,b,c,d,x[i+1],5,-165796510);
d=md5_gg(d,a,b,c,x[i+6],9,-1069501632);
c=md5_gg(c,d,a,b,x[i+11],14,643717713);
b=md5_gg(b,c,d,a,x[i+0],20,-373897302);
a=md5_gg(a,b,c,d,x[i+5],5,-701558691);
d=md5_gg(d,a,b,c,x[i+10],9,38016083);
c=md5_gg(c,d,a,b,x[i+15],14,-660478335);
b=md5_gg(b,c,d,a,x[i+4],20,-405537848);
a=md5_gg(a,b,c,d,x[i+9],5,568446438);
d=md5_gg(d,a,b,c,x[i+14],9,-1019803690);
c=md5_gg(c,d,a,b,x[i+3],14,-187363961);
b=md5_gg(b,c,d,a,x[i+8],20,1163531501);
a=md5_gg(a,b,c,d,x[i+13],5,-1444681467);
d=md5_gg(d,a,b,c,x[i+2],9,-51403784);
c=md5_gg(c,d,a,b,x[i+7],14,1735328473);
b=md5_gg(b,c,d,a,x[i+12],20,-1926607734);
a=md5_hh(a,b,c,d,x[i+5],4,-378558);
d=md5_hh(d,a,b,c,x[i+8],11,-2022574463);
c=md5_hh(c,d,a,b,x[i+11],16,1839030562);
b=md5_hh(b,c,d,a,x[i+14],23,-35309556);
a=md5_hh(a,b,c,d,x[i+1],4,-1530992060);
d=md5_hh(d,a,b,c,x[i+4],11,1272893353);
c=md5_hh(c,d,a,b,x[i+7],16,-155497632);
b=md5_hh(b,c,d,a,x[i+10],23,-1094730640);
a=md5_hh(a,b,c,d,x[i+13],4,681279174);
d=md5_hh(d,a,b,c,x[i+0],11,-358537222);
c=md5_hh(c,d,a,b,x[i+3],16,-722521979);
b=md5_hh(b,c,d,a,x[i+6],23,76029189);
a=md5_hh(a,b,c,d,x[i+9],4,-640364487);
d=md5_hh(d,a,b,c,x[i+12],11,-421815835);
c=md5_hh(c,d,a,b,x[i+15],16,530742520);
b=md5_hh(b,c,d,a,x[i+2],23,-995338651);
a=md5_ii(a,b,c,d,x[i+0],6,-198630844);
d=md5_ii(d,a,b,c,x[i+7],10,1126891415);
c=md5_ii(c,d,a,b,x[i+14],15,-1416354905);
b=md5_ii(b,c,d,a,x[i+5],21,-57434055);
a=md5_ii(a,b,c,d,x[i+12],6,1700485571);
d=md5_ii(d,a,b,c,x[i+3],10,-1894986606);
c=md5_ii(c,d,a,b,x[i+10],15,-1051523);
b=md5_ii(b,c,d,a,x[i+1],21,-2054922799);
a=md5_ii(a,b,c,d,x[i+8],6,1873313359);
d=md5_ii(d,a,b,c,x[i+15],10,-30611744);
c=md5_ii(c,d,a,b,x[i+6],15,-1560198380);
b=md5_ii(b,c,d,a,x[i+13],21,1309151649);
a=md5_ii(a,b,c,d,x[i+4],6,-145523070);
d=md5_ii(d,a,b,c,x[i+11],10,-1120210379);
c=md5_ii(c,d,a,b,x[i+2],15,718787259);
b=md5_ii(b,c,d,a,x[i+9],21,-343485551);
a=safe_add(a,olda);
b=safe_add(b,oldb);
c=safe_add(c,oldc);
d=safe_add(d,oldd);}
return Array(a,b,c,d);}
function md5_cmn(q,a,b,x,s,t){
return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b);}
function md5_ff(a,b,c,d,x,s,t){
return md5_cmn((b&c)|((~b)&d),a,b,x,s,t);}
function md5_gg(a,b,c,d,x,s,t){
return md5_cmn((b&d)|(c&(~d)),a,b,x,s,t);}
function md5_hh(a,b,c,d,x,s,t){
return md5_cmn(b^c^d,a,b,x,s,t);}
function md5_ii(a,b,c,d,x,s,t){
return md5_cmn(c^(b|(~d)),a,b,x,s,t);}
function core_hmac_md5(key,data){
var bkey=str2binl(key);
if(bkey.length>16)bkey=core_md5(bkey,key.length*chrsz);
var ipad=Array(16),opad=Array(16);
for(var i=0;i<16;i++){
ipad[i]=bkey[i]^0x36363636;
opad[i]=bkey[i]^0x5C5C5C5C;}
var hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);
return core_md5(opad.concat(hash),512+128);}
function safe_add(x,y){
var lsw=(x&0xFFFF)+(y&0xFFFF);
var msw=(x>>16)+(y>>16)+(lsw>>16);
return(msw<<16)|(lsw&0xFFFF);}
function bit_rol(num,cnt){
return(num<<cnt)|(num>>>(32-cnt));}
function str2binl(str){
var bin=Array();
var mask=(1<<chrsz)-1;
for(var i=0;i<str.length*chrsz;i+=chrsz)
bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);
return bin;}
function binl2str(bin){
var str="";
var mask=(1<<chrsz)-1;
for(var i=0;i<bin.length*32;i+=chrsz)
str+=String.fromCharCode((bin[i>>5]>>>(i%32))&mask);
return str;}
function binl2hex(binarray){
var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";
var str="";
for(var i=0;i<binarray.length*4;i++){
str+=hex_tab.charAt((binarray[i>>2]>>((i%4)*8+4))&0xF)+
hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF);}
return str;}
function binl2b64(binarray){
var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str="";
for(var i=0;i<binarray.length*4;i+=3){
var triplet=(((binarray[i>>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);
for(var j=0;j<4;j++){
if(i*8+j*6>binarray.length*32)str+=b64pad;
else str+=tab.charAt((triplet>>6*(3-j))&0x3F);}}
return str;}}
var VW=new Object;
var g_this=this;
VW.ua=window.navigator.userAgent.toLowerCase();
VW.env={
bDebug:false,
bFirefox:false,
bOpera:false,
bOpera7Up:false,
bOpera6Dn:false,
bIE:false,
bIE4:false,
bIE5:false,
bIE6:false,
bIE7:false,
bIE4Up:false,
bIE5Up:false,
bIE6Up:false,
bIE7Up:false,
bIEBox:false,
bNetscape:false,
bMac:false};
VW.debug=function(oError,msg){
if(VW.env.bDebug){
if(msg)
alert(msg);
else
alert(oError.description);}}
function vw_set_debug(bDebug){
VW.env.bDebug=bDebug;}
function vw_isdefine(obj){
return("undefined"!=typeof obj);}
function vw_init_env(){
try{
if(window.opera){
VW.env.bOpera=true;
var i=VW.ua.indexOf("opera");
if(-1!=i){
var v=parseInt(VW.ua.charAt(i+6));
VW.env.bOpera7Up=(v>=7);
VW.env.bOpera6Dn=(v<7);}}
else{
if(navigator.vendor!="KDE"&&document.all&&VW.ua.indexOf("msie")!=-1){
VW.env.bIE4Up=(parseFloat(navigator.appVersion)>=4);
VW.env.bIE5Up=(parseFloat(navigator.appVersion)>=5);
VW.env.bIE6Up=(parseFloat(navigator.appVersion)>=6);
VW.env.bIE7Up=(parseFloat(navigator.appVersion)>=7);
VW.env.bIE4=(-1!=VW.ua.indexOf("msie 4"));
VW.env.bIE5=(-1!=VW.ua.indexOf("msie 5"));
VW.env.bIE6=(-1!=VW.ua.indexOf("msie 6"));
VW.env.bIE7=(-1!=VW.ua.indexOf("msie 7"));
VW.env.bIE=(-1!=VW.ua.indexOf("msie"));}
else{
if(document.layers){
VW.env.bNetscape=true;}}}
VW.env.bIEBox=VW.env.bIE&&(document.compatMode==null||document.compatMode!="CSS1Compat");
VW.env.bFirefox=VW.ua.match(/firefox/)?true:false;
VW.env.bMac=VW.ua.match(/mac/)?true:false;}
catch(e){}}
vw_init_env();
function vw_ge(){
var oRet=[];
var sid="";
var i=0;
for(i=0;i<arguments.length;i++){
sid=arguments[i];
if("object"==typeof(sid)){
oRet.push(sid);}
else if("string"==typeof(sid)){
oRet.push(document.getElementById(sid));}
if(1==arguments.length){
return oRet.length?oRet[0]:null;}}
return oRet;}
function $(){return vw_ge.apply(this,arguments);}
function vw_gea(vid){
var oRet=[];
var sid="";
var i=0;
var obj=null;
if("object"==typeof(vid)){
oRet.push(vid);}
else if("string"==typeof(vid)){
obj=document.all(vid);
if(vw_is_array(obj)){
oRet=obj;}
else{
oRet.push(obj);}}
return oRet;}
function $a(){return vw_gea.apply(this,arguments);}
function vw_gce(sTagName,sClsName,oNode){
var oRet=[];
try{
var obj=oNode?$(oNode):document;
var arr=obj.getElementsByTagName(sTagName);
var i=0;
for(i=0;i<arr.length;i++){
if(sClsName==arr[i].className){
oRet[oRet.length]=arr[i];}}}
catch(err){
VW.debug(err,"error in vw_gce : "+err.description);}
return oRet;}
function vw_gide(sTagName,sIdSearch,oNode){
var oRet=[];
try{
var obj=oNode?$(oNode):document;
var arr=obj.getElementsByTagName(sTagName);
var i=0;
for(i=0;i<arr.length;i++){
if(sIdSearch&&sIdSearch.length){
if(arr[i].id&&-1!=arr[i].id.indexOf(sIdSearch)){
oRet.push(arr[i]);}}
else{
oRet.push(arr[i]);}}}
catch(err){
VW.debug(err,"error in vw_gide : "+err.description);}
return oRet;}
function vw_enable_window(vid,benable){
try{
var obj=$(vid);
if(obj){
obj.disabled=!benable;}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_enable_window : "+err.description);}}
function $ew(){return vw_enable_window.apply(this,arguments);}
function vw_get_window_text(vid){
var stext="";
try{
var obj=vw_ge(vid);
var sTagName;
if(obj){
sTagName=obj.tagName.toLowerCase();
if("select"==sTagName){
stext=obj.options[obj.selectedIndex].value;}
else if(obj.length>1){
if("input"==obj[0].tagName.toLowerCase()&&
"radio"==obj[0].type.toLowerCase()){
for(i=0;i<obj.length;i++){
if(obj[i].checked){
stext=obj[i].value;
break;}}}}
else{
switch(sTagName){
case "input":
case "button":
case "textarea":{
stext=obj.value;
break;}
default:{
stext=obj.innerHTML;
break;}}}}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_get_window_text : "+err.description);}
return stext;}
function $gwt(){return vw_get_window_text.apply(this,arguments);}
function vw_set_window_text(vid,stext,bForceText){
try{
var obj=$(vid);
if(obj){
switch(obj.tagName.toLowerCase()){
case "input":
case "button":{
obj.value=stext;
break;}
default:{
if(bForceText)
obj.innerText=stext;
else
obj.innerHTML=stext;
break;}}}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_set_window_text : "+err.description);}}
function $swt(){return vw_set_window_text.apply(this,arguments);}
function vw_get_class(vid){
var sClsName="";
try{
var obj=$(vid);
if(obj){
sClsName=obj.className;}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_get_class : "+err.description);}
return sClsName;}
function $gc(){return vw_get_class.apply(this,arguments);}
function vw_set_class(vid,sClsName){
try{
var obj=$(vid);
if(obj){
obj.className=sClsName;}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_set_class : "+err.description);}}
function $sc(){return vw_set_class.apply(this,arguments);}
function vw_add_class(vid,sClsName){
try{
var obj=$(vid);
var sCls="";
if(obj){
sCls=" "+obj.className+" ";
if(-1==sCls.indexOf(" "+sClsName+" ")){
obj.className=(obj.className+(obj.className.length?" ":"")+sClsName);}}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_set_class : "+err.description);}}
function $ac(){return vw_add_class.apply(this,arguments);}
function vw_rm_class(vid,sClsName){
try{
var obj=$(vid);
var sCls="";
var arr=[];
var tmp=[];
var i=0;
if(obj&&obj.className&&obj.className.length){
sCls=" "+obj.className+" ";
if(-1!=sCls.indexOf(" "+sClsName+" ")){
arr=obj.className.split(" ");
tmp=[];
for(i=0;i<arr.length;i++){
if(sClsName!=arr[i]){
tmp[tmp.length]=arr[i];}}
obj.className=tmp.join(" ");}}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_set_class : "+err.description);}}
function $rc(){return vw_rm_class.apply(this,arguments);}
function vw_show_window(vid,bShow,oPoint){
try{
var obj=$(vid);
if(obj){
if(bShow){
obj.style.display="";
if(oPoint){
vw_set_window_point(vid,oPoint);}}
else{
obj.style.display="none";}}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_show_window : "+err.description);}}
function $sw(){return vw_show_window.apply(this,arguments);}
function vw_is_window_show(vid){
var bShow=false;
try{
var obj=$(vid);
if(obj){
if("none"==obj.style.display){
bShow=false;}
else{
bShow=true;}}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_show_window : "+err.description);}
return bShow;}
function $iws(){return vw_is_window_show.apply(this,arguments);}
function vw_set_window_focus(vid,nIndex,bNotSelected){
try{
var obj=null;
if("object"==typeof(vid)){
obj=vid;}
else{
if(nIndex&&nIndex>0){
obj=document.all(vid)[nIndex];}
else{
obj=$(vid);}}
if(obj){
if(!bNotSelected){
obj.select();}
obj.focus();}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_set_window_focus : "+err.description);}}
function $swf(){return vw_set_window_focus.apply(this,arguments);}
function vw_get_window_client_size(){
var nWidth=0,nHeight=0;
try{
if("number"==typeof(window.innerWidth)){
nWidth=window.innerWidth;
nHeight=window.innerHeight;}
else{
if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){
nWidth=document.documentElement.clientWidth;
nHeight=document.documentElement.clientHeight;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){
nWidth=document.body.clientWidth;
nHeight=document.body.clientHeight;}}}
catch(err){
VW.debug(err,"error in vw_get_window_client_size : "+err.description);}
return{width:nWidth,height:nHeight,Height:nHeight};}
function vw_get_event_point(oEvent){
var nX,nY;
if(VW.env.bIE){
nX=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;
nY=window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop;}
else{
nX=oEvent.clientX+window.scrollX;
nY=oEvent.clientY+window.scrollY;}
return{x:nX,left:nX,y:nY,top:nY};}
function $gep(){return vw_get_event_point.apply(this,arguments);}
function vw_get_window_point(vid){
function getBorderLeft(el){
return VW.env.bIE?el.clientLeft:parseInt(window.getComputedStyle(el,null).getPropertyValue("border-left-width"));}
function getInnerLeft(el){
if(el==null){
return 0;}
if(VW.env.bIEBox&&el==document.body||!VW.env.bIEBox&&el==document.documentElement){
return 0;}
return getLeft(el)+getBorderLeft(el);}
function getLeft(el){
if(el==null){
return 0;}
return el.offsetLeft+getInnerLeft(el.offsetParent);}
function getInnerTop(el){
if(el==null){
return 0;}
if(VW.env.bIEBox&&el==document.body||!VW.env.bIEBox&&el==document.documentElement){
return 0;}
return getTop(el)+getBorderTop(el);}
function getBorderTop(el){
return VW.env.bIE?el.clientTop:parseInt(window.getComputedStyle(el,null).getPropertyValue("border-top-width"));}
function getTop(el){
if(el==null){
return 0;}
return el.offsetTop+getInnerTop(el.offsetParent);}
var obj=null;
var oRet={top:0,left:0,width:0,height:0};
try{
obj=$(vid);
if(obj){
oRet={top:getTop(obj),left:getLeft(obj),width:obj.offsetWidth,height:obj.offsetHeight};}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_get_window_point : "+err.description);}
return oRet;}
function $gwp(){return vw_get_window_point.apply(this,arguments);}
function vw_set_window_point(vid,oPoint){
try{
var obj=$(vid);
if(obj&&oPoint){
obj.style.left=oPoint.left+"px";
obj.style.top=oPoint.top+"px";}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_set_window_point : "+err.description);}}
function $swp(){return vw_set_window_point.apply(this,arguments);}
function vw_remove_element(vid){
try{
var obj=$(vid);
if(obj){
var oParent=obj.parentNode;
if(oParent){
oParent.removeChild(obj);}}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_remove_element : "+err.description);}}
function $re(){return vw_remove_element.apply(this,arguments);}
function vw_window_open(sUrl,nWidth,nHeight,bNewWin,bCenter){
if(sUrl&&sUrl.length>7){
if(bCenter){
var nleft=screen.width/ 2- nWidth/ 2;
var ntop=screen.Height/ 2- nHeight/ 2;
return window.open(sUrl,bNewWin?"_blank":"_self","height="+nHeight+",width="+nWidth+",left="+nleft+",top="+ntop+",status=yes,toolbar=no,menubar=no,location=no");}
else{
return window.open(sUrl,bNewWin?"_blank":"_self");}}
return null;}
function $wo(){return vw_window_open.apply(this,arguments);}
function vw_event_attach(vid,sEventName,pfnEventProc){
try{
var obj=$(vid);
if(obj){
if(window.ActiveXObject){
obj.attachEvent("on"+sEventName,pfnEventProc);}
else{
obj.addEventListener(sEventName,pfnEventProc,false);}}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_event_attach : "+err.description);}}
function $ea(){return vw_event_attach.apply(this,arguments);}
function vw_event_detach(vid,sEventName,pfnEventProc){
try{
var obj=$(vid);
if(obj){
if(window.ActiveXObject){
obj.detachEvent("on"+sEventName,pfnEventProc);}
else{
obj.removeEventListener(sEventName,pfnEventProc,false);}}
else{
throw new Error("undefined object");}}
catch(err){
VW.debug(err,"error in vw_event_detach : "+err.description);}}
function $ed(){return vw_event_detach.apply(this,arguments);}
function vw_rd(sUrl,nTimeout){
setTimeout("window.location.href='"+sUrl+"';",nTimeout?nTimeout:0);}
function $rd(){return vw_rd.apply(this,arguments);}
function vw_show_body_scrollbar(bShow){
window.document.body.scroll=bShow?"yes":"no";
window.document.body.style.overflowY=bShow?"visible":"hidden";}
function array_value_exists(vValue,Arr){
if(Arr instanceof Array){
for(var i=0;i<Arr.length;i++){
if(vValue==Arr[i]){
return true;}}}
return false;}
function vw_left_trim(str){
return str.replace(/^\s*/,"");}
function vw_right_trim(str){
return str.replace(/\s*$/,"");}
function vw_trim(str){
return vw_right_trim(vw_left_trim(str));}
function vw_cnstrlen(str){
var nRet=0;
try{
var cArr=str.match(/[^\x00-\xff]/ig);
nRet=str.length+(cArr==null?0:cArr.length);}
catch(err){}
return nRet;}
function vw_get_speclen_string(str,nLen,sTrimMarker){
var sRet=str;
try{
if(sRet.length>nLen){
sRet=sRet.substr(0,nLen)+sTrimMarker;}}
catch(err){}
return sRet;}
function vw_print_r(theObj,vSpecTab){
var sRet="";
var vTab=vSpecTab?vSpecTab:"\t";
var vTab2=vTab.substr(0,vTab.length-1);
if(theObj.constructor==Array||theObj.constructor==Object){
sRet+=(typeof(theObj)+"\n"+vTab2+"(\n");
for(var p in theObj){
if(theObj[p].constructor==Array||theObj[p].constructor==Object){
sRet+=(vTab+"["+p+"] => "+typeof(theObj)+" ");
sRet+=vw_print_r(theObj[p],(vTab+"\t"));}
else{
sRet+=(vTab+"["+p+"] => "+theObj[p]+"\n");}}
sRet+=(vTab2+")\n");}
return sRet;}
function vw_is_array(obj){
if(!obj){
return false;}
return(-1!=obj.constructor.toString().indexOf("Array"));}
function vw_is_numeric(str){
var a=parseInt(str,10);
return(a.toString(10)==str);}
function CVwAjax(){
var m_ArrMsXmlProgid=new Array('MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP');
var m_sFrameId="id_frame_ajax_"+parseInt(Math.floor((Math.random())*10000));
var m_oFrameAjax=null;
var m_oFormNode=null;
var m_nTimeOutId=0;
var m_nIntervalId=0;
var m_nIntervalTime=50;
var m_oHttp=null;
var m_fpCallbackFunc=null;
var m_vArglist=null;
this.MyUrlEncode=function(Va){
return Va.replace(/:/g,'%3A').replace(/\//g, '%2F').replace(/\?/g, '%3F').replace(/&/g, '%26').replace(/=/g,'%3D');};
this.UrlEncode=function(Va){
if(encodeURIComponent)
return encodeURIComponent(Va);
if(escape)
return escape(Va);};
this.HtmlEncode=function(Va){
return Va.replace(/&/g,'&amp').replace(/'/g,'&quot;').replace(/</g,'&lt;').replace(/>/g,'&gt;');};
this.HttpGetResponse=function(strUrl,fpCallbackFunc,vArglist,sPostData){
var oHttp=null;
var bPost=false;
if(strUrl.length>0){
strUrl+=(-1!=strUrl.indexOf("?")?"&":"?")+"rand="+Math.floor((Math.random())*10000);
if(m_oHttp&&m_oHttp&&0!=m_oHttp.readyState){
m_oHttp.abort();}
oHttp=GetHttpObject();
if(oHttp){
m_oHttp=oHttp;
m_fpCallbackFunc=fpCallbackFunc;
m_vArglist=vArglist;
bPost=(sPostData&&sPostData.length);
m_oHttp.open(bPost?"POST":"GET",strUrl,true);
if(bPost){
SetHeader("Content-Type","application/x-www-form-urlencoded");
SetHeader("content-length",sPostData.length);}
HandleReadyState();
m_oHttp.send(bPost?sPostData:null);}}};
this.HttpSendPost=function(strUrl,fpCallbackFunc,vArglist,sPostData){
return this.HttpGetResponse(strUrl,fpCallbackFunc,vArglist,sPostData);};
this.HttpPostForm=function(sFormId,strTagUrl,fpCallbackFunc,vArglist){
var oForm=GetFormObjectById(sFormId);
if(!oForm)
return false;
m_oFormNode=oForm;
m_oFrameAjax=CreateFrame(null);
m_fpCallbackFunc=fpCallbackFunc;
m_vArglist=vArglist;
DoPostForm(m_oFormNode,m_oFrameAjax,strTagUrl);
ReleaseObject();
return true;};
this.GetFormData=function(sFormId){
var oForm=GetFormObjectById(sFormId);
if(!oForm){
return null;}
var sFormData="";
var oElement,sName,sValue,bEnable;
var hasSubmit=false;
var i=0;
for(i=0;i<oForm.elements.length;i++){
oElement=oForm.elements[i];
bEnable=oForm.elements[i].disabled?false:true;
sName=oForm.elements[i].name;
sValue=oForm.elements[i].value;
if(!bEnable||!sName){
continue;}
switch(oElement.type){
case "select-one":
case "select-multiple":{
for(var j=0;j<oElement.options.length;j++){
if(oElement.options[j].selected){
if(window.ActiveXObject){
sFormData+=encodeURIComponent(sName)+'='+encodeURIComponent(oElement.options[j].attributes['value'].specified?oElement.options[j].value:oElement.options[j].text)+'&';}
else{
sFormData+=encodeURIComponent(sName)+'='+encodeURIComponent(oElement.options[j].hasAttribute('value')?oElement.options[j].value:oElement.options[j].text)+'&';}}}}
break;
case "radio":
case "checkbox":{
if(oElement.checked){
sFormData+=encodeURIComponent(sName)+'='+encodeURIComponent(sValue)+'&';}}
break;
case "file":
case undefined:
case "undefined":
case "reset":
case "button":
break;
case "submit":{
if(hasSubmit==false){
sFormData+=encodeURIComponent(sName)+'='+encodeURIComponent(sValue)+'&';
hasSubmit=true;}}
break;
default:{
sFormData+=encodeURIComponent(sName)+'='+encodeURIComponent(sValue)+'&';}
break;}}
return sFormData.substr(0,sFormData.length-1);};
this.CreateForm=function(){
var oform=null;
if(window.ActiveXObject){
oform=document.createElement('<form action="" method="post">');}
else{
oform=document.createElement('form');
oform.action="";
oform.method="post";}
document.body.appendChild(oform);
return oform;};
function CreateHttpObject(){
var obj=null;
try{
obj=new XMLHttpRequest();}
catch(e){
for(var i in m_ArrMsXmlProgid){
try{
obj=new ActiveXObject(m_ArrMsXmlProgid[i]);
break;}
catch(e){}}}
finally{
return obj;}}
function ReleaseObject(){
if(m_oHttp){
m_oHttp=null;}}
function GetHttpObject(){
return CreateHttpObject();}
function GetFormObjectById(sFormId){
var oForm=null;
if(typeof sFormId=='string'){
oForm=(document.getElementById(sFormId)||document.forms[sFormId]);}
else if(typeof sFormId=='object'){
oForm=sFormId;}
return oForm;}
function CreateFrame(sSecureUri){
var frameId=m_sFrameId;
var oframe=null;
if(window.ActiveXObject){
oframe=document.createElement('<IFRAME id="'+frameId+'" name="'+frameId+'">');
if(typeof sSecureUri=='boolean'){
oframe.src="JavaScript:false";}
else{
oframe.src=sSecureUri;}}
else{
oframe=document.createElement('IFRAME');
oframe.id=frameId;
oframe.name=frameId;}
oframe.style.position='absolute';
oframe.style.top='-1000px';
oframe.style.left='-1000px';
document.body.appendChild(oframe);
return oframe;}
function SetHeader(sLabel,sValue){
if(!m_oHttp)
return;
if(sLabel&&sLabel.length&&sValue){
m_oHttp.setRequestHeader(sLabel,sValue);}}
function DoPostForm(oForm,oFrameAjax,sUri){
if(!oForm)
return false;
if(!oFrameAjax)
return false;
oForm.action=sUri;
oForm.enctype='multipart/form-data';
oForm.method='POST';
oForm.target=oFrameAjax.id;
oForm.submit();
var CallbackDoPostForm=function(){
var oResponse={};
oResponse.responseText=oFrameAjax.contentWindow.document.body?oFrameAjax.contentWindow.document.body.innerHTML:null;
oResponse.responseXML=oFrameAjax.contentWindow.document.XMLDocument?oFrameAjax.contentWindow.document.XMLDocument:oFrameAjax.contentWindow.document;
oResponse.argument=m_vArglist;
if(m_fpCallbackFunc.postfrm){
if(m_fpCallbackFunc.advmode){
m_fpCallbackFunc.postfrm(oResponse);}
else{
m_fpCallbackFunc.postfrm(oResponse.responseText,m_vArglist);}}
if(window.ActiveXObject){
oFrameAjax.detachEvent("onload",CallbackDoPostForm);}
else{
oFrameAjax.removeEventListener("load",CallbackDoPostForm,false);}
window.setTimeout(
function(){document.body.removeChild(oFrameAjax);},
100);};
if(window.ActiveXObject){
oFrameAjax.attachEvent('onload',CallbackDoPostForm);}
else{
oFrameAjax.addEventListener('load',CallbackDoPostForm,false);}}
function HandleReadyState(){
if(m_fpCallbackFunc&&m_fpCallbackFunc.timeout){
m_nTimeOutId=window.setTimeout(
function(){
ProcessTimeout();},
m_fpCallbackFunc.timeout);}
m_nIntervalId=window.setInterval(
function(){
if(m_oHttp&&4==m_oHttp.readyState){
ClearAllTimer();
HandleTransactionResponse();}},
m_nIntervalTime);}
function ProcessTimeout(){
if(IsCallInProgress()){
m_oHttp.abort();
ClearAllTimer();
HandleTransactionResponse(true);
return true;}
return false;}
function ClearAllTimer(){
if(m_nIntervalId){
window.clearInterval(m_nIntervalId);}
if(m_nTimeOutId){
window.clearTimeout(m_nTimeOutId);}
m_nIntervalId=0;
m_nTimeOutId=0;}
function IsCallInProgress(){
if(!m_oHttp)
return false;
return(4!=m_oHttp.readyState&&0!=m_oHttp.readyState);}
function HandleTransactionResponse(bIsTimeout){
if(!m_fpCallbackFunc){
ReleaseObject();
return;}
var nStatusCode=0;
var oResponse=null;
var pfnProc=null;
try{
if(undefined !==m_oHttp.status&&0!=m_oHttp.status){
nStatusCode=m_oHttp.status;}
else{
nStatusCode=13030;}}
catch(err){
nStatusCode=13030;}
if(nStatusCode>=200&&nStatusCode<300){
try{
oResponse=CreateResponseObject();
if(m_fpCallbackFunc.success){
if(m_fpCallbackFunc.advmode){
m_fpCallbackFunc.success(oResponse);}
else{
m_fpCallbackFunc.success(oResponse.responseText,m_vArglist);}}}
catch(err){}}
else{
try{
switch(nStatusCode){
case 12002:
case 12029:
case 12030:
case 12031:
case 12152:
case 13030:{
oResponse=CreateExceptionObject(bIsTimeout?bIsTimeout:false);
if(bIsTimeout&&m_fpCallbackFunc.tmoproc){
pfnProc=m_fpCallbackFunc.tmoproc;}
else{
pfnProc=m_fpCallbackFunc.failure;}
if(pfnProc){
if(m_fpCallbackFunc.advmode){
pfnProc(oResponse);}
else{
pfnProc(oResponse.responseText,m_vArglist);}}}
break;
default:{
oResponse=CreateResponseObject();
if(m_fpCallbackFunc.failure){
if(m_fpCallbackFunc.advmode){
m_fpCallbackFunc.failure(oResponse);}
else{
m_fpCallbackFunc.failure(oResponse.responseText,m_vArglist);}}}
break;}}
catch(err){}}
ReleaseObject();
oResponse=null;}
function CreateResponseObject(){
var obj={};
var ArrHeader={};
try{
var headerStr=m_oHttp.getAllResponseHeaders();
var header=headerStr.split('\n');
var delimitPos=0;
for(var i=0;i<header.length;i++){
delimitPos=header[i].indexOf(':');
if(-1!=delimitPos){
ArrHeader[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+2);}}}
catch(e){}
obj.fid=m_oHttp.fid;
obj.status=m_oHttp.status;
obj.statusText=m_oHttp.statusText;
obj.getResponseHeader=ArrHeader;
obj.getAllResponseHeaders=headerStr;
obj.responseText=m_oHttp.responseText;
obj.responseXML=m_oHttp.responseXML;
obj.argument=m_vArglist;
return obj;}
function CreateExceptionObject(bIsAbort){
var COMM_CODE=0;
var COMM_ERROR='communication failure';
var ABORT_CODE=-1;
var ABORT_ERROR='transaction timeout or aborted';
var obj={};
try{
obj.fid=m_oHttp.fid;
obj.argument=m_vArglist;
if(bIsAbort){
obj.status=ABORT_CODE;
obj.statusText=ABORT_ERROR;
obj.responseText=ABORT_ERROR;}
else{
obj.status=COMM_CODE;
obj.statusText=COMM_ERROR;
obj.responseText=COMM_ERROR;}}
catch(e){}
return obj;}}function vw_get_selected_num(sId){
var nRet=0;
var oSel=$(sId);
if(oSel){
for(i=0;i<oSel.options.length;i++){
if(oSel.options[i].selected){
nRet++;}}}
return nRet;}
function vw_is_usrname(str){
var nErrCount=0;
var stdChars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var i=0;
if(str&&str.length){
for(i=0;i<str.length;i++){
if(-1==stdChars.indexOf(str.substr(i,1))){
nErrCount++;
break;}}}
return(0==nErrCount);}
function vw_is_email(str){
if(-1!=str.indexOf(" "))
return false;
else if(-1==str.indexOf("@"))
return false;
else if(0==str.indexOf("@"))
return false;
else if(str.indexOf("@")==(str.length-1))
return false;
var arr=str.split("@");
if(-1==arr[1].indexOf("."))
return false;
else if(0==arr[1].indexOf("."))
return false;
else if("."==arr[1].charAt(arr[1].length-1)){
return false;}
return true;}
function vw_is_url(str){
if(str.indexOf(" ")!=-1)
return false;
else if(str.indexOf("http://")==-1)
return false;
else if(str=="http://")
return false;
else if(str.indexOf("http://")>0)
return false;
str=str.substring(7,str.length);
if(-1==str.indexOf("."))
return false;
else if(0==str.indexOf("."))
return false;
else if("."==str.charAt(str.length-1))
return false;
if(-1!=str.indexOf("/")){
str=str.substring(0,str.indexOf("/"));
if("."==str.charAt(str.length-1))
return false;}
if(-1!=str.indexOf(":")){
if(str.indexOf(":")==(str.length-1))
return false;
else if("."==str.charAt(str.indexOf(":")+1))
return false;
str=str.substring(0,str.indexOf(":"));
if("."==str.charAt(str.length-1))
return false;}
return true;}
