function checkdomain(A){isValid=true;if(!xlunConfig.isDebug&&document.domain!=xlunConfig.xlunDomain)if(document.domain=="")isValid=false;else if(isInvalidSite(A))isValid=false;alertDebug("checkdomain: isValid="+isValid);return isValid}function isInvalidSite(C){var A=true;if(isNotEmptyObject(ignoreSiteidChkArr))for(var D=0;D<ignoreSiteidChkArr.length;D++)if(ignoreSiteidChkArr[D]==xlunConfig.copid)return false;if(typeof xlunCopSitesMap=="object"&&xlunCopSitesMap.length>0){var B=xlunCopSitesMap[C];if(B&&B!="")A=false}return A}function isAllowedToShow(){for(var A=0;A<xlunAdvForbiddenCopIdArr.length;A++)if(xlunAdvForbiddenCopIdArr[A]==xlunConfig.copid)return false;return true}function chkAdvIsValidToShow(H,E){var I=null;if(H.parent)I=H.parent;else I=H;var D=false,G=false;if(I.whitelist&&I.whitelist.length>0){D=true;var A=I.whitelist.join(",")+",";if(A.indexOf(xlunConfig.copid+",")>=0)G=true}if(D&&!G)return false;if(I.blacklist&&I.blacklist.length>0)if(I.blacklist[xlunConfig.copid]==0)return false;var J=I.deadLine,F=/^\d{2}-\d{2}-\d{4}$/;if(!J||!F.test(J))J=="";if(J!="")J=J.replace(new RegExp("-","g"),"/")+" 23:59:59";if(!I.isShifted||(J!=""&&Date.parse(J)<new Date().getTime()))return false;if(typeof I.location=="string"&&I.location!=""){if(typeof xlunIpLocation=="object"&&xlunIpLocation!=null){var C=I.location.split("|");for(var K=0;K<C.length;K++)for(var B in xlunIpLocation)if(xlunIpLocation[B]==C[K])return true}return false}return true}function chkAdvIsOpenCopIds(B){var D=new Array();for(var E=0;E<B.length;E++){var C=B[E];if(C.opencopids&&C.opencopids.length>0){var A=C.opencopids.join(",")+",";if(A.indexOf(xlunConfig.copid+",")>=0)D.push(C)}}if(D.length>0)return D;else return B}function isComeFromGouGou(){var A=new RegExp("http://([^/]+)/down\\?cid=(\\d|[A-Z]){40}\\b");return A.test(xlunConfig.fromUrl)}function getAdvOnPower(C){var A=0;for(var F=0;F<C.length;F++){C[F].power=C[F].power*C.length;if(C[F].power>A)A=C[F].power}var B=Math.round(Math.random()*A),D=new Array();for(F=0;F<C.length;F++)if(B<C[F].power)D.push(C[F]);var E=Math.round(Math.random()*(D.length-1))+2;return D[E-2]}function runIframe(B){var A="xlunIframe"+new Date().getTime();document.write("<iframe id='"+A+"' style='display:none;' src='"+B+"'></iframe>")}function loadUnitAdvRelation(){xlunit=xlunConfig.xlunitArr.slice(0,1)[0];if(isNotEmptyObject(xlun_unitSettingArr)){var A=xlun_unitSettingArr[xlunit.unitid];if(isNotEmptyObject(A))if(isNotEmptyObject(A.gpPathArr)){for(var B=0;B<A.gpPathArr.length;B++)if(typeof(xlunConfig.xlunResCacheMap[A.gpPathArr[B]])=="undefined"){runXlunJS(xlunConfig.domainUrl+A.gpPathArr[B]);xlunConfig.xlunResCacheMap[A.gpPathArr[B]]=1}if(isNotEmptyObject(A.objPathArr))for(B=0;B<A.objPathArr.length;B++)if(typeof(xlunConfig.xlunResCacheMap[A.objPathArr[B]])=="undefined"){runXlunJS(xlunConfig.domainUrl+A.objPathArr[B]);xlunConfig.xlunResCacheMap[A.objPathArr[B]]=1}}}}function genIframe(A){var B=new Object();B.id=A;xlunConfig.iframeArr.push(B);document.write("<iframe id='"+A+"'  frameborder='no' scrolling='no' style='display: none;'></iframe>")}function genIframeId(A){if(!A)A="";return A+"_"+new Date().getTime()}function loadDefAdvInfo(){if(typeof(xlunConfig.xlunResCacheMap["def_adv"])=="undefined"){runXlunJS(xlunConfig.resourceUrl+"/defPubbsSetting.js");xlunConfig.xlunResCacheMap["def_adv"]=1}}function prepareXlunit(){if(isNotEmptyObject(xlunConfig)){loadUnitAdvRelation();runXlunJS(xlunConfig.copResUrl+"/unobjSetting.js");runXlunJS(xlunConfig.commonResUrl+"/runxlununit.js")}}function runXlunit(){tmpFlag=false;xlunit=xlunConfig.xlunitArr.shift();if(isNotEmptyObject(xlun_unitObjArr)){var A=xlun_unitObjArr[xlunit.unitid];if(isNotEmptyObject(A)){xlunConfig.xlunitObjArr.push(A);switch(A.showType){case 5:case 1:xlunConfig.commonSiteidArr.push(xlunit.siteid);genIframe(genIframeId(xlunit.unitid));loadDefAdvInfo();if(typeof(xlunConfig.xlunResCacheMap["commonpos"])=="undefined"){runXlunJS(xlunConfig.commonResUrl+"/_xluncommonpos.js");xlunConfig.xlunResCacheMap["commonpos"]=1}break;case 2:xlunConfig.popupSiteid=xlunit.siteid;if(typeof(xlunConfig.xlunResCacheMap["popup_adv"])=="undefined"){if(A.businessType&&A.businessType==3)runXlunJS(xlunConfig.resourceUrl+"/xlunPops_cps.js");else runXlunJS(xlunConfig.resourceUrl+"/xlunPops.js");xlunConfig.xlunResCacheMap["popup_adv"]=1}if(typeof(xlunConfig.xlunResCacheMap["popup"])=="undefined"){runXlunJS(xlunConfig.commonResUrl+"/_xlunpops.js");xlunConfig.xlunResCacheMap["popup"]=1}break;case 3:xlunConfig.floatSiteid=xlunit.siteid;if(typeof(xlunConfig.xlunResCacheMap["float_adv"])=="undefined"){if(A.businessType&&A.businessType==3)runXlunJS(xlunConfig.resourceUrl+"/xlunflts_cps.js");else runXlunJS(xlunConfig.resourceUrl+"/xlunflts.js");xlunConfig.xlunResCacheMap["float_adv"]=1}if(typeof(xlunConfig.xlunResCacheMap["float"])=="undefined"){runXlunJS(xlunConfig.commonResUrl+"/_xlunfloat.js");xlunConfig.xlunResCacheMap["float"]=1}break}tmpFlag=true}}if(tmpFlag)runXlunJS(xlunConfig.commonResUrl+"/xlunrununit_main.js");else alertDebug(unescape("xlunConfig%u521D%u59CB%u5316%u5931%u8D25%uFF01"))}function renderAdvHtml(B){switch(B.showType){case 5:case 1:tmpsiteid=xlunConfig.commonSiteidArr.slice(0,1)[0];break;case 2:tmpsiteid=xlunConfig.popupSiteid;break;case 3:tmpsiteid=xlunConfig.floatSiteid;break}if(!checkdomain(tmpsiteid))return;if(isAllowedToShow()){try{writeMD5ToCookie();switch(B.showType){case 5:case 1:renderCommonXlunAdv(B);break;case 2:renderPopupXlunAdv(B);break;case 3:renderFloatXlunAdv(B);break}}catch(A){alertDebug("from xlunpubbs-renderAdvHtml(): "+A.message)}}}var hexcase=0,b64pad="",chrsz=8;function hex_md5(A){return binl2hex(core_md5(str2binl(A),A.length*chrsz))}function b64_md5(A){return binl2b64(core_md5(str2binl(A),A.length*chrsz))}function str_md5(A){return binl2str(core_md5(str2binl(A),A.length*chrsz))}function hex_hmac_md5(B,A){return binl2hex(core_hmac_md5(B,A))}function b64_hmac_md5(B,A){return binl2b64(core_hmac_md5(B,A))}function str_hmac_md5(B,A){return binl2str(core_hmac_md5(B,A))}function md5_vm_test(){return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72"}function core_md5(K,I){K[I>>5]|=128<<((I)%32);K[(((I+64)>>>9)<<4)+14]=I;var H=1732584193,E=-271733879,G=-1732584194,B=271733878;for(var J=0;J<K.length;J+=16){var F=H,D=E,C=G,A=B;H=md5_ff(H,E,G,B,K[J+0],7,-680876936);B=md5_ff(B,H,E,G,K[J+1],12,-389564586);G=md5_ff(G,B,H,E,K[J+2],17,606105819);E=md5_ff(E,G,B,H,K[J+3],22,-1044525330);H=md5_ff(H,E,G,B,K[J+4],7,-176418897);B=md5_ff(B,H,E,G,K[J+5],12,1200080426);G=md5_ff(G,B,H,E,K[J+6],17,-1473231341);E=md5_ff(E,G,B,H,K[J+7],22,-45705983);H=md5_ff(H,E,G,B,K[J+8],7,1770035416);B=md5_ff(B,H,E,G,K[J+9],12,-1958414417);G=md5_ff(G,B,H,E,K[J+10],17,-42063);E=md5_ff(E,G,B,H,K[J+11],22,-1990404162);H=md5_ff(H,E,G,B,K[J+12],7,1804603682);B=md5_ff(B,H,E,G,K[J+13],12,-40341101);G=md5_ff(G,B,H,E,K[J+14],17,-1502002290);E=md5_ff(E,G,B,H,K[J+15],22,1236535329);H=md5_gg(H,E,G,B,K[J+1],5,-165796510);B=md5_gg(B,H,E,G,K[J+6],9,-1069501632);G=md5_gg(G,B,H,E,K[J+11],14,643717713);E=md5_gg(E,G,B,H,K[J+0],20,-373897302);H=md5_gg(H,E,G,B,K[J+5],5,-701558691);B=md5_gg(B,H,E,G,K[J+10],9,38016083);G=md5_gg(G,B,H,E,K[J+15],14,-660478335);E=md5_gg(E,G,B,H,K[J+4],20,-405537848);H=md5_gg(H,E,G,B,K[J+9],5,568446438);B=md5_gg(B,H,E,G,K[J+14],9,-1019803690);G=md5_gg(G,B,H,E,K[J+3],14,-187363961);E=md5_gg(E,G,B,H,K[J+8],20,1163531501);H=md5_gg(H,E,G,B,K[J+13],5,-1444681467);B=md5_gg(B,H,E,G,K[J+2],9,-51403784);G=md5_gg(G,B,H,E,K[J+7],14,1735328473);E=md5_gg(E,G,B,H,K[J+12],20,-1926607734);H=md5_hh(H,E,G,B,K[J+5],4,-378558);B=md5_hh(B,H,E,G,K[J+8],11,-2022574463);G=md5_hh(G,B,H,E,K[J+11],16,1839030562);E=md5_hh(E,G,B,H,K[J+14],23,-35309556);H=md5_hh(H,E,G,B,K[J+1],4,-1530992060);B=md5_hh(B,H,E,G,K[J+4],11,1272893353);G=md5_hh(G,B,H,E,K[J+7],16,-155497632);E=md5_hh(E,G,B,H,K[J+10],23,-1094730640);H=md5_hh(H,E,G,B,K[J+13],4,681279174);B=md5_hh(B,H,E,G,K[J+0],11,-358537222);G=md5_hh(G,B,H,E,K[J+3],16,-722521979);E=md5_hh(E,G,B,H,K[J+6],23,76029189);H=md5_hh(H,E,G,B,K[J+9],4,-640364487);B=md5_hh(B,H,E,G,K[J+12],11,-421815835);G=md5_hh(G,B,H,E,K[J+15],16,530742520);E=md5_hh(E,G,B,H,K[J+2],23,-995338651);H=md5_ii(H,E,G,B,K[J+0],6,-198630844);B=md5_ii(B,H,E,G,K[J+7],10,1126891415);G=md5_ii(G,B,H,E,K[J+14],15,-1416354905);E=md5_ii(E,G,B,H,K[J+5],21,-57434055);H=md5_ii(H,E,G,B,K[J+12],6,1700485571);B=md5_ii(B,H,E,G,K[J+3],10,-1894986606);G=md5_ii(G,B,H,E,K[J+10],15,-1051523);E=md5_ii(E,G,B,H,K[J+1],21,-2054922799);H=md5_ii(H,E,G,B,K[J+8],6,1873313359);B=md5_ii(B,H,E,G,K[J+15],10,-30611744);G=md5_ii(G,B,H,E,K[J+6],15,-1560198380);E=md5_ii(E,G,B,H,K[J+13],21,1309151649);H=md5_ii(H,E,G,B,K[J+4],6,-145523070);B=md5_ii(B,H,E,G,K[J+11],10,-1120210379);G=md5_ii(G,B,H,E,K[J+2],15,718787259);E=md5_ii(E,G,B,H,K[J+9],21,-343485551);H=safe_add(H,F);E=safe_add(E,D);G=safe_add(G,C);B=safe_add(B,A)}return Array(H,E,G,B)}function md5_cmn(D,E,C,F,B,A){return safe_add(bit_rol(safe_add(safe_add(E,D),safe_add(F,A)),B),C)}function md5_ff(F,D,E,A,G,C,B){return md5_cmn((D&E)|((~D)&A),F,D,G,C,B)}function md5_gg(F,D,E,A,G,C,B){return md5_cmn((D&A)|(E&(~A)),F,D,G,C,B)}function md5_hh(F,D,E,A,G,C,B){return md5_cmn(D^E^A,F,D,G,C,B)}function md5_ii(F,D,E,A,G,C,B){return md5_cmn(E^(D|(~A)),F,D,G,C,B)}function core_hmac_md5(F,E){var D=str2binl(F);if(D.length>16)D=core_md5(D,F.length*chrsz);var C=Array(16),A=Array(16);for(var G=0;G<16;G++){C[G]=D[G]^909522486;A[G]=D[G]^1549556828}var B=core_md5(C.concat(str2binl(E)),512+E.length*chrsz);return core_md5(A.concat(B),512+128)}function safe_add(D,C){var A=(D&65535)+(C&65535),B=(D>>16)+(C>>16)+(A>>16);return(B<<16)|(A&65535)}function bit_rol(A,B){return(A<<B)|(A>>>(32-B))}function str2binl(A){var C=Array(),B=(1<<chrsz)-1;for(var D=0;D<A.length*chrsz;D+=chrsz)C[D>>5]|=(A.charCodeAt(D/chrsz)&B)<<(D%32);return C}function binl2str(C){var A="",B=(1<<chrsz)-1;for(var D=0;D<C.length*32;D+=chrsz)A+=String.fromCharCode((C[D>>5]>>>(D%32))&B);return A}function binl2hex(C){var B=hexcase?"0123456789ABCDEF":"0123456789abcdef",A="";for(var D=0;D<C.length*4;D++)A+=B.charAt((C[D>>2]>>((D%4)*8+4))&15)+B.charAt((C[D>>2]>>((D%4)*8))&15);return A}function binl2b64(C){var B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="";for(var F=0;F<C.length*4;F+=3){var D=(((C[F>>2]>>8*(F%4))&255)<<16)|(((C[F+1>>2]>>8*((F+1)%4))&255)<<8)|((C[F+2>>2]>>8*((F+2)%4))&255);for(var E=0;E<4;E++)if(F*8+E*6>C.length*32)A+=b64pad;else A+=B.charAt((D>>6*(3-E))&63)}return A}function newGuid(){var A="";for(var C=1;C<=32;C++){var B=Math.floor(Math.random()*16).toString(16);A+=B;if((C==8)||(C==12)||(C==16)||(C==20))A+="-"}return A}function getUTCDateTime(){var A,B="",C=":";A=new Date();B+=A.getUTCFullYear()+"-";B+=(A.getUTCMonth()+1)+"-";B+=A.getUTCDate()+" ";B+=A.getUTCHours()+C;B+=A.getUTCMinutes()+C;B+=A.getUTCSeconds()+C;B+=A.getUTCMilliseconds();return(B)}function Cookie(A,C,B,F,E,D){this.$document=A;this.$name=C;if(B)this.$expiration=new Date((new Date()).getTime()+B*3600000);else this.$expiration=null;if(F)this.$path=F;else this.$path=null;if(E)this.$domain=E;else this.$domain=null;if(D)this.$secure=true;else this.$secure=false}Cookie.prototype.store=function(B){var D="";if(B&&B!="")D=B;else for(var C in this){if((C.charAt(0)=="$")||((typeof this[C])=="function"))continue;if(D!="")D+="&";D+=C+":"+escape(this[C])}var A=this.$name+"="+D;if(this.$expiration)A+="; expires="+this.$expiration.toGMTString();if(this.$path)A+="; path="+this.$path;if(this.$domain)A+="; domain="+this.$domain;if(this.$secure)A+="; secure";this.$document.cookie=A};Cookie.prototype.load=function(){var C=this.$document.cookie;if(C=="")return false;var A=C.indexOf(this.$name+"=");if(A==-1)return false;A+=this.$name.length+1;var E=C.indexOf(";",A);if(E==-1)E=C.length;var D=C.substring(A,E),B=D.split("&");for(var F=0;F<B.length;F++)B[F]=B[F].split(":");for(F=0;F<B.length;F++)this[B[F][0]]=unescape(B[F][1]);return true};Cookie.prototype.remove=function(){var A;A=this.$name+"=";if(this.$path)A+="; path="+this.$path;if(this.$domain)A+="; domain="+this.$domain;A+="; expires=Fri, 02-Jan-1970 00:00:00 GMT";this.$document.cookie=A};function getObj(val){var obj=null;try{obj=eval(val)}catch(e){}return obj}function getQueryString(B){var C="",F=new String(document.location),A=-1,D=B.length;do{A=F.indexOf(B+"=");if(A!=-1){if((F.charAt(A-1)=="?")||(F.charAt(A-1)=="#")||(F.charAt(A-1)=="&")){F=F.substr(A);break}F=F.substr(A+D+1)}}while(A!=-1);if(A!=-1){var E=F.indexOf("&");if(E==-1)C=F.substr(D+1);else C=F.substring(D+1,E)}return C}function getPeerid(){var A;try{A=new ActiveXObject("MediaAddin.MediaComm")}catch(B){}var C="null";if(A!=null&&typeof(A)!="undefined")C=A.peerid;return C}function isIE(){var A=window.navigator.appVersion;return A.indexOf("MSIE")>-1||A.indexOf("Microsoft")>-1}function isMaxthon(){try{var B=window.external.max_language_id;return true}catch(A){}return false}function isMaxthon2(){try{var B=window.external.max_language_id;if(B.indexOf("0x")>-1)return true}catch(A){}return false}function alertDebug(A){if(xlunConfig.isDebug=="true")alert(A)}function loadXlunJS(C,A){var B=document.getElementsByTagName("head")[0];if(B){var D=B.getElementsByTagName("script");for(var E=0;E<D.length;E++)if(D[E].src==C)return;scriptObj=document.createElement("script");scriptObj.language="javaScript";scriptObj.type="text/JavaScript";scriptObj.src=C;scriptObj.id=new Date().getTime();if(typeof(A)=="string"&&A!="")scriptObj.charset=A;B.appendChild(scriptObj)}else alertDebug(unescape("%u65E0%u6CD5%u52A0%u8F7Djs%u5230%u9875%u5934%uFF01"))}function addLoadEvent(A){var B=window.onload;if(typeof(window.onload)!="function")window.onload=A;else window.onload=function(){if(B)B();A()}}function writeMD5ToCookie(){try{var D="xlunsid",E=top.document;if(!E)E=window.document;alertDebug("docdoc.domain="+E.domain);var B=new Cookie(E,D,24*365,"/");if(B)if(!B.load()){var A=hex_md5(getUTCDateTime()+newGuid()+E.location);B.xlunsid=A;B.store()}}catch(C){alertDebug("From xlunpubbs-writeMD5ToCookie: "+C.message)}}function getMD5FromCookie(){var B="";try{var D="xlunsid",E=top.document;if(!E)E=window.document;var A=new Cookie(E,D,24*365,"/");if(A&&A.load())B=A.xlunsid;else B=hex_md5(getUTCDateTime()+newGuid()+E.location)}catch(C){alertDebug("From xlunpubbs-getMD5FromCookie: "+C.message)}return B}function writePeeridToCookie(){var C="peerid",D=top.document;if(!D)D=window.document;var B=new Cookie(D,C,24*365,"/");if(B)if(!B.load()){var A=getPeerid();B.store(A)}}function isNotEmptyObject(A){return typeof(A)=="object"&&A!=null}
