MyXD={};window._myxd_client_loaded=false;window._book_for_a_height_update=1;window.navigator.myXDNavParams={cbknavparam:''};window._myxd_ua=navigator.userAgent.toLowerCase();MyXD.Constants={B_VER:(_myxd_ua.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],B_SAFARI:/safari/.test(_myxd_ua),B_OPERA:/opera/.test(_myxd_ua),B_MSIE:/msie/.test(_myxd_ua)&&!/opera/.test(_myxd_ua),B_MOZILLA:/mozilla/.test(_myxd_ua)&&!/(compatible|webkit)/.test(_myxd_ua),B_FIREFOX2:/firefox\/2/.test(_myxd_ua),B_FIREFOX3:/firefox\/3/.test(_myxd_ua),B_MAXTHON2:/maxthon\s2/.test(_myxd_ua),B_TT:/tencenttraveler/.test(_myxd_ua),B_KMELEON:/k-meleon/.test(_myxd_ua),B_CHROME:/chrome/.test(_myxd_ua),CSS1COMPAT:(document.compatMode=="CSS1Compat"),CONNECT_URLHASH:"myxd_connect_urlhash",CONNECT_NAVIGATOR:"myxd_connect_navigator",CONNECT_XDM:"myxd_connect_xdm",IFRAME_HEIGHT:"ifmHeight",CHANNEL_IFRAME_ID:"myxdClientChannelIframe",CHANNEL_IFRAME_NAME:"myxdClientChannelIframe",CHANNEL_CONTAINER_ID:"myxdClientChannelContainer",CALL_NAME:"__mymc__",CALL_VER:"__mymcv__",CALL_CALLBACK:"__mymcb__",CALL_PARAM_SIGN:"__myps__",CLIENT_IFRAME_ID:'__clientIfmId__',CLIENT_SUFFIX:'__clientSuffix__',CB_NAME:"__mycbn__",CB_RETN:"__mycbr__",CB_VER:"__mycbv__",CB_SUCC:"success",CB_ERROR:"error",CB_STATE_SIGN:"__myss__",CK_CLIENT_URL:"myXDClientPageURL_",CK_CB_HASH:"myXDCbkparam",HASH_FROM_CLI_TO_SER:"hashFromCliToSer",HASH_SIGN:"$$",FOO_STR:"foo",WARN_INVALID_CB_STATE:"invalid callback state!",WARN_INVALID_CALL:"invalid method call",WARN_FAIL_CALL:"method call fail!",TIMER_INTERGER:50,PAGE_SERVER:"server",PAGE_CLIENT:"client",PAGE_CHANNEL:"channel",SERVER_LOADING_ID:"myLoading",SERVER_WRAPPER_ID:"myxdServerWrapperId",SERVER_LOADING_WIDTH:100,MANYOU_UCHOME_URL:'http://uchome.manyou.com',MANYOU_SEARCH_URL:'http://search.manyou.com',MANYOU_APP_URL:'http://apps.manyou.com',ENV_MYJS:(typeof myjs_dom!='undefined')};window._myxd_conn_type=MyXD.Constants.B_MSIE?(typeof(window.postMessage)!='undefined')?MyXD.Constants.CONNECT_XDM:MyXD.Constants.CONNECT_NAVIGATOR:(MyXD.Constants.B_OPERA&&MyXD.Constants.B_VER>7)?MyXD.Constants.CONNECT_XDM:MyXD.Constants.CONNECT_URLHASH;window.forceUpdate=false;MyXD.Event={bind:function(element,eventName,handler){if(element.addEventListener){element.addEventListener(eventName,handler,false);}else if(element.attachEvent){element.attachEvent("on"+eventName,handler);}else{element["on"+eventName]=handler;}
MyXD.EventCache.add(element,eventName,handler,true);return element;},unbind:function(element,eventName,handler){if(element.addEventListener){element.removeEventListener(eventName,handler,false);}else if(element.attachEvent){element.detachEvent("on"+eventName,handler);}else{element["on"+eventName]=null;}
return element;},regist:function(element,eventName,handler){var old=element["on"+eventName];if(typeof element["on"+eventName]!="function"){MyXD.Event.bind(element,eventName,handler);}else{MyXD.Event.bind(element,eventName,function(){old();handler();});}
return element;}};MyXD.EventCache=function(){var listEvents=[];return{listEvents:listEvents,add:function(node,sEventName,fHandler,bCapture){listEvents.push(arguments);},flush:function(){var i,item;for(i=listEvents.length-1;i>=0;i=i-1){item=listEvents[i];if(item[0].removeEventListener){item[0].removeEventListener(item[1],item[2],item[3]);};if(item[1].substring(0,2)!="on"){item[1]="on"+item[1];};if(item[0].detachEvent){item[0].detachEvent(item[1],item[2]);};item[0][item[1]]=null;};}};}();MyXD.Event.regist(window,"unload",MyXD.EventCache.flush);MyXD.Util=function MyXD$Util(){};MyXD.Util.onDOMLoaded=function(handler){var u=navigator.userAgent.toLowerCase();var ie=MyXD.Constants.B_MSIE;if(/webkit/.test(u)){timeout=setTimeout(function(){if(document.readyState=="loaded"||document.readyState=="complete"){handler();}else{setTimeout(arguments.callee,10);}},10);}else if((/mozilla/.test(u)&&!/(compatible)/.test(u))||(/opera/.test(u))){document.addEventListener("DOMContentLoaded",handler,false);}else if(ie){(function(){var tempNode=document.createElement('document:ready');try{tempNode.doScroll('left');handler();tempNode=null;}catch(e){setTimeout(arguments.callee,0);}})();}else{MyXD.Event.regist(window,"load",handler);}};MyXD.Util.getElementHeight=function MyXD$Util$getElementHeight(elementID){window.updateHeightLock=true;var ie=MyXD.Constants.B_MSIE;var root=document.getElementById(elementID);var pObjArr=[];var objs=MyXD.Util.getElementsByTagNames('div,table');for(var i=0;i<objs.length;i++){var o=objs[i];var a=(/absolute|relative/.test(MyXD.Util.getCurrStyle(o,'position')));var d=ie?MyXD.Util.isElementVisible(o):o.scrollHeight;if(a&&d){var t=MyXD.Util.getCurrStyle(o,'top').replace('px','');if(MyXD.Constants.B_SAFARI){t=(t=="auto")?0:t;}
var h=(ie?o.clientHeight*1:o.scrollHeight*1)+t*1;if(MyXD.Constants.B_MSIE){var ot=parseInt(MyXD.Util.getCurrStyle(o,'borderBottomWidth').replace('px',''));var ob=parseInt(MyXD.Util.getCurrStyle(o,'borderTopWidth').replace('px',''));ot=isNaN(ot)?0:ot;ob=isNaN(ob)?0:ob;h+=ot+ob;}
pObjArr.push(h);}}
var maxh=0;if(!ie){pObjArr=pObjArr.sort(function(a,b){return a-b});maxh=pObjArr[pObjArr.length-1];}else{for(var pp=0;pp<pObjArr.length;pp++){if(pObjArr[pp]>maxh){maxh=pObjArr[pp];}}}
var result=0;if(pObjArr.length>0){result=Math.max(maxh,root.scrollHeight);}else{result=root.scrollHeight;}
result=parseInt(result)+1;root=null;delete root;pObjArr=null;delete pObjArr;objs=null;delete objs;window.updateHeightLock=false;return result;};MyXD.Util.getCurrStyle=function(object,styleName){if(!object||!styleName)return;try{return(typeof(window.getComputedStyle)=='undefined')?object.currentStyle[styleName]:window.getComputedStyle(object,null)[styleName];}catch(ex){return object.style[styleName]||'';}};MyXD.Util.isElementVisible=function MyXD$Util$isElementVisible(obj){while(obj.parentNode.tagName&&(obj.parentNode.tagName.toUpperCase()!='BODY')){if(MyXD.Util.getCurrStyle(obj,'display')=='none'){return false;}
obj=obj.parentNode;}
return true;};MyXD.Util.getElementsByTagNames=function MyXD$Util$getElementsByTagNames(list,obj){if(!obj)var obj=document;var tagNames=list.split(',');var resultArray=new Array();for(var i=0;i<tagNames.length;i++){var tags=obj.getElementsByTagName(tagNames[i]);for(var j=0;j<tags.length;j++){resultArray.push(tags[j]);}
tags=null;delete tags;}
tagNames=null;delete tagNames;var testNode=resultArray[0];if(!testNode){return[];}
if(testNode.sourceIndex){resultArray.sort(function(a,b){return a.sourceIndex-b.sourceIndex;});}
else if(testNode.compareDocumentPosition){resultArray.sort(function(a,b){return 3-(a.compareDocumentPosition(b)&6);});}
return resultArray;};MyXD.Util.getElementsByClassName=function MyXD$Util$getElementsByClassName(classNames,tagNames){var cNames=classNames.split(",");var elems=[];var result=[];if(!tagNames||!tagNames.length)return result;elems=MyXD.Util.getElementsByTagNames(tagNames);var j;for(var i=0;j=elems[i];i++){for(var m=0;m<cNames.length;m++){if(MyXD.Util.hasClassName(j,cNames[m])){result.push(j);}}}
j=null;delete j;cNames=null;delete cNames;elems=null;delete elems;return result;};MyXD.Util.hasClassName=function MyXD$Util$hasClassName(element,styleName){return((" "+element.className+" ").indexOf(" "+styleName+" ")!=-1);};MyXD.Util.hideIframe=function MyXD$Util$hideIframe(iframeID){var ifm=document.getElementById(iframeID);ifm.style.position="absolute";ifm.style.left="-10000px";ifm.style.top="-10000px";};MyXD.Util.showIframe=function MyXD$Util$showIframe(iframeID){var ifm=document.getElementById(iframeID);ifm.style.position="static";ifm.style.left="0px";ifm.style.top="0px";ifm.removeAttribute("style");};MyXD.Util.HashURL=function MyXD$Util$HashURL(href,separator){var h=href||window.location.href;var s=separator||MyXD.Constants.HASH_SIGN;var uArr=MyXD.Util.split2(h,'#');var href_part=uArr[0];var hash_part=uArr[1];this.map={};this.sign=s;if(hash_part){var arr=hash_part.split(s);for(var i=0;i<arr.length;i++){var s2=arr[i];var o=MyXD.Util.split2(s2,'=');this.map[o[0]]=o[1];}}
this.size=function(){var l=0;for(var j in this.map){l++;}
return l;};this.keys=function(){var k=[];for(var m in this.map){k.push(m);}
return k;};this.values=function(){var v=[];for(var m in this.map){v.push(this.map[m]);}
return v;};};MyXD.Util.HashURL.prototype.get=function(key){return this.map[key]||null;};MyXD.Util.HashURL.prototype.put=function(key,value){this.map[key]=value;};MyXD.Util.HashURL.prototype.putAll=function(m){if(typeof(m)=='object'){for(var item in m){this.map[item]=m[item];}}};MyXD.Util.HashURL.prototype.remove=function(key){if(this.map[key]){var newMap={};for(var item in this.map){if(item!=key){newMap[item]=this.map[item];}}
this.map=newMap;}};MyXD.Util.HashURL.prototype.toString=function(){return MyXD.Util.map2query(this.map,MyXD.Constants.HASH_SIGN);};MyXD.Util.HashURL.prototype.clone=function(){return new MyXD.Util.HashURL('foo#'+this.toString(),this.sign);};MyXD.Util.split2=function(s,separator){var i=s.indexOf(separator);return i==-1?[s,'']:[s.substring(0,i),s.substring(i+1)];};MyXD.Util.query2map=function(q){if(!q){return{};}
var i,t,r={},d=decodeURIComponent;q=q.split('&');for(i=0,l=q.length;i<l;i++){t=MyXD.Util.split2(q[i],'=');r[d(t[0])]=typeof(t[1])=='undefined'?'':d(t[1]);}
return r;};MyXD.Util.map2query=function(q,separator){var u=encodeURIComponent,k,r=[];var d=separator?separator:'&';for(k in q){r.push(u(k)+'='+u(q[k]));}
return r.join(d);};MyXD.Util.query2Hash=function(q){var hash=new MyXD.Util.HashURL(MyXD.Constants.FOO_STR);if(!q)return hash;var arr=q.split(MyXD.Constants.HASH_SIGN);for(var i=0;i<arr.length;i++){var pair=arr[i];var kv=MyXD.Util.split2(pair,"=");hash.put(kv[0],kv[1]);}
return hash;};MyXD.Util.decodeURL=function(str){if(!str)return'';var a1=MyXD.Util.split2(str.replace(/\%253F/,"?"),"?");var base=unescape(a1[0]).replace(/%3A/,":");var param=(a1.length>1)?a1[1]:"";if(""!=param)param=param.replace(/\%253D/g,"=").replace(/\%2526/g,"&").replace(/\%2525/g,"%");return base+(param.length?'?':'')+param;};MyXD.Util.fixURLParam=function(url){var base=MyXD.Util.split2(url,"?")[0];var param=MyXD.Util.split2(MyXD.Util.split2(url,"?")[1],"#")[0];var parr=param.split("&");var rarr=[];var currParam;for(var ii=0;ii<parr.length;ii++){var item=parr[ii];rarr.push(item);var ra=MyXD.Util.split2(rarr[ii],"=");var p=ra[1].replace(/=/g,"%253D");rarr[ii]=ra[0]+"="+p;}
var newCurrParam=rarr.join("&");var result=(newCurrParam=="=")?"":("?"+newCurrParam);return base+result;};MyXD.Util.styleInterception=['height','max-height','min-height','display','position','top','bottom','margin','margin-top','margin-bottom','padding','padding-top','padding-bottom','border','border-top','border-top-width','border-bottom','border-bottom-width','border-width','line-height','font-size','z-index','clear','float','clip','overflow','outline','zoom'];MyXD.Util.isInterceptStyle=function(sty){var vlu=sty.toLowerCase().replace(/^\s+/,'').replace(/\s+$/,'').replace(/-/g,'');for(var ii=0;ii<MyXD.Util.styleInterception.length;ii++){var styKey=MyXD.Util.styleInterception[ii];if(new RegExp(vlu).test(styKey.replace(/-/g,''))){return true;}}
return false;};MyXD.Util.postMsgByXDIframe=function(fid,msg,domain,depth){var win=window;var depth=depth||0;for(var ii=0;ii<depth;ii++){win=win.parent;}
var ifm=MyXD.Constants.B_MSIE?win.self.frames[fid]:win.document.getElementById(fid).contentWindow;if(!ifm||!ifm.postMessage){return false;}
ifm.postMessage(msg,domain||"*");ifm=null;delete ifm;return true;};MyXD.Util.isValidXDOrigin=function(origin,domain){if(!origin||!domain)return false;var re=new RegExp(domain.replace(/\./g,'\\.').replace(/https?:\/\//,'')+'$');return re.test(origin);};MyXD.Util.getDomain=function(url){if(typeof url!='string')return'';var r=new RegExp('^https?:\/\/[^(\/|\?|#)]+');var m=url.match(r);if(m){return m[0];}
return'';};MyXD.Util.getXDMInfo=function(data){var d=data.split('@@@');return{action:d[0],value:d[1]};};MyXD.Util.warpXDMAction=function(action,value){return action+'@@@'+value;};MyXD.Util.getXDMListener=function(){return MyXD.Constants.B_MSIE||(MyXD.Constants.B_OPERA&&MyXD.Constants.B_VER>9)?window:document;};MyXD.Util.buildFuncNameSpace=function(parentObj,funcName){var nArr=funcName.split('.');var ns=parentObj;for(var ii=0;ii<nArr.length;ii++){ns=ns[nArr[ii]];}
return ns;};MyXD.Util.getClientUrlBySuffix=function(url,suffix){if(MyXD.Constants.B_MSIE&&suffix.substr(0,3)=='/./'){suffix=suffix.substr(2);}
var u=new MyXD.Util.urlParser(url);if('http://'+u.getUri()==MyXD.Constants.MANYOU_UCHOME_URL){var staticKeys=['s_id','uch_id','uch_url','timestamp','my_sign'];var domain=MyXD.Constants.MANYOU_UCHOME_URL;}else if('http://'+u.getUri()==MyXD.Constants.MANYOU_SEARCH_URL){var staticKeys=['s_id','dz_id','dz_url','timestamp','my_sign'];var domain=MyXD.Constants.MANYOU_SEARCH_URL;}else{var staticKeys=['my_uchId','my_sId','my_prefix','my_suffix','my_current','my_extra','my_ts','my_appVersion','my_sig','my_fullscreen']
var domain=MyXD.Constants.MANYOU_APP_URL+'/'+u.getAppId();}
var s=[];for(k in u.map){if(MyXD.Util.inArray(k,staticKeys)){s.push(k+'='+u.map[k]);}}
s.push('my_suffix='+encodeURIComponent(suffix));var dash=suffix.indexOf('?')!=-1?'&':'?';url=domain+suffix+dash+s.join('&');return url;};MyXD.Util.inArray=function(needle,haystack){for(var i=0;i<haystack.length;i++){if(haystack[i]==needle){return true;}}
return false;}
MyXD.Util.urlParser=function(url){var t,x,aPs=[];this.map=[];this.hash='';this.uri='';this.path='';x=url;t=x.split('?');var path=t[0];this.path=path;if(path.substr(0,7)=='http://'){var tmp=path.substr(7,path.length);}
if(path.substr(0,8)=='https://'){var tmp=path.substr(8,path.length);}
var pos=tmp.indexOf('/');this.uri=tmp.substr(0,pos);x=t[1];if(x.indexOf('#')){t=x.split('#');x=t[0];this.hash=t[1];}
if(x.indexOf('&')){aPs=x.split('&');}else{aPs.push(x);}
for(var i=0;i<aPs.length;i++){if(aPs[i].indexOf('=')){t=aPs[i].split('=');this.map[t[0]]=t[1];}}
this.getUri=function(){return this.uri;};this.getAppId=function(){var t=this.path.replace(MyXD.Constants.MANYOU_APP_URL,'');if(t.substr(0,1)=='/'){t=t.substr(1);}
t=/([0-9]+)/.exec(t);return t[1];};};MyXD.Client=function MyXD$Client(serverURL,channelPage,iframeID){this._parentUrl=serverURL;this._iframeID=iframeID;this._rootID=null;this._transfer=null;this._channelSrc=channelPage;this._channelDom=null;this._hash=null;this._hashObj=new MyXD.Util.HashURL('');this._oldHeight=null;this._channelHasLoaded=false;this._callQueue=[];this._currCall=new MyXD.Client.CallObject(null,null,null,null,-1);MyXD.Client._client=this;window.myXDPageType=MyXD.Constants.PAGE_CLIENT;if(_myxd_conn_type==MyXD.Constants.CONNECT_NAVIGATOR){window.navigator.myXDNavParams.storagecliurl=escape(MyXD.Client._getStorageClientURL());}else{MyXD.Client._client._createChannel();}
MyXD.Client._hideServerLoading();if(_myxd_conn_type==MyXD.Constants.CONNECT_XDM){MyXD.Event.bind(MyXD.Util.getXDMListener(),'message',function(e){if(!e.origin&&e.domain){e.origin=e.domain;}
var channelDM=MyXD.Util.getDomain(MyXD.Client._client._channelSrc);if(!MyXD.Util.isValidXDOrigin(e.origin,channelDM)){return;}
var info=MyXD.Util.getXDMInfo(e.data);switch(info.action+''){case'channelHasLoaded':MyXD.Client._client._channelHasLoaded=true;break;case'tellClient':MyXD.Client._client._hash=info.value;break;case'updateSerCallBack':MyXD.Client._updateSerCallBack(info.value);break;}});}
MyXD.Util.onDOMLoaded(function(){_myxd_client_loaded=true;MyXD.Client._startClientTimerByType('call');MyXD.Client._safeUpdateHeight();if(MyXD.Constants.ENV_MYJS){window.myxd_size_flag_when_myjs=-1;window.myxd_size_itv_when_myjs=window.setInterval(function(){MyXD.Client._fireSizeAlterOnce();window.myxd_size_flag_when_myjs++;if(window.myxd_size_flag_when_myjs>20){window.clearInterval(window.myxd_size_itv_when_myjs);window.myxd_size_flag_when_myjs=0;}},500);}});if(MyXD.Constants.B_FIREFOX3){window.setTimeout(function(){window.scrollTo(0,0);},500);}};MyXD.Client._sizeTimer=null;MyXD.Client.CallObject=function(name,args,callback,onError,ver){this.name=name;this.args=args;this.callback=callback;this.onError=onError;this.ver=ver;};MyXD.Client._hideServerLoading=function(){var client=MyXD.Client._client;client.doCall('MyXD.Server.hideServerLoading',[],function(){});};MyXD.Client._safeUpdateHeight=function(){window.setInterval(function(){if(_book_for_a_height_update>0){var client=MyXD.Client._client;if(!client||client._rootID==null)return;var newHeight;try{newHeight=MyXD.Util.getElementHeight(client._rootID);}catch(ex){}
if(newHeight&&newHeight!=client._oldHeight&&client._hashObj.get(MyXD.Constants.CALL_VER)){client._hashObj.put(MyXD.Constants.IFRAME_HEIGHT,newHeight);client._flushServer();client._oldHeight=newHeight;}
if(typeof newHeight=='undefined'){window.updateHeightLock=false;}
_book_for_a_height_update=0;}},500);};MyXD.Client._fireSizeAlterOnce=function(){if(!window.updateHeightLock){_book_for_a_height_update=1;}else{window.setTimeout('MyXD.Client._fireSizeAlterOnce',500);}};MyXD.Client._processCall=function(){var client=MyXD.Client._client;if(client._currCall.ver==-1){client._shiftCall();}else{var selfH;if(_myxd_conn_type==MyXD.Constants.CONNECT_NAVIGATOR){selfH=MyXD.Util.query2Hash(window.navigator.myXDNavParams.cbknavparam);client._hash=selfH.toString();}else if(_myxd_conn_type==MyXD.Constants.CONNECT_URLHASH){selfH=new MyXD.Util.HashURL(location.href);client._hash=selfH.toString();}else if(_myxd_conn_type==MyXD.Constants.CONNECT_XDM){selfH=MyXD.Util.query2Hash(client._hash);}
var callVer=selfH.get(MyXD.Constants.CB_VER);if(client._hash&&callVer==client._currCall.ver){var cbkFunc=client._currCall.callback;var errFunc=client._currCall.onError;var cbkRetn;var keys=selfH.keys();var vlus=selfH.values();for(var kk=0;kk<keys.length;kk++){if(keys[kk].indexOf(MyXD.Constants.CB_NAME)>-1){cbkRetn=decodeURIComponent(vlus[kk]).replace(MyXD.Constants.CB_RETN,"");break;}}
var cbkState=cbkRetn.match(/^[a-z]*/)[0];var cbkParam=cbkRetn.replace(cbkState+MyXD.Constants.CB_STATE_SIGN,"");if(cbkState==MyXD.Constants.CB_SUCC){if(cbkFunc)
cbkFunc(cbkParam);}else if(cbkState==MyXD.Constants.CB_ERROR){if(errFunc)
errFunc(cbkParam);}else{if(errFunc){}}
client._currCall.ver=-1;}
selfH=null;delete selfH;}};MyXD.Client.prototype._flushServer=function(){if(_myxd_conn_type==MyXD.Constants.CONNECT_URLHASH){this._sendHashToChannel(escape(this._hashObj.toString()));}else if(_myxd_conn_type==MyXD.Constants.CONNECT_NAVIGATOR){window.navigator.myXDNavParams.xdparam=escape(this._hashObj.toString());}else if(_myxd_conn_type==MyXD.Constants.CONNECT_XDM){if(_myxd_client_loaded&&document.getElementById(MyXD.Constants.CHANNEL_IFRAME_ID)&&this._hashObj.get(MyXD.Constants.CALL_VER)&&this._channelHasLoaded){var r=MyXD.Util.postMsgByXDIframe(MyXD.Constants.CHANNEL_IFRAME_ID,MyXD.Util.warpXDMAction('flushServer',escape(this._hashObj.toString())));}else{if(this._hashObj.get(MyXD.Constants.CALL_VER)!=null){window.setTimeout(function(){MyXD.Client._client._flushServer.call({_hashObj:MyXD.Client._client._hashObj.clone(),_channelHasLoaded:(MyXD.Client._client._channelHasLoaded==true)});},200);}}}};MyXD.Client.prototype._sendCall=function(call){var tmpHeight=this._hashObj.get(MyXD.Constants.IFRAME_HEIGHT);if(tmpHeight==null){tmpHeight=500;}
this._hashObj=new MyXD.Util.HashURL(MyXD.Constants.FOO_STR);this._hashObj.put(MyXD.Constants.IFRAME_HEIGHT,tmpHeight);this._hashObj.put(MyXD.Constants.CALL_NAME+escape(call.name),decodeURIComponent((call.args).join(MyXD.Constants.CALL_PARAM_SIGN)));with(this._currCall){name=call.name;args=call.args;callback=call.callback;onError=call.onError;ver=Math.ceil(Math.random()*99999);};if(call.name){this._hashObj.put(MyXD.Constants.CALL_VER,this._currCall.ver);this._flushServer();}};MyXD.Client.prototype._shiftCall=function(){if(this._callQueue.length){if(_myxd_conn_type==MyXD.Constants.CONNECT_XDM){}
this._sendCall(this._callQueue.shift());}};MyXD.Client.prototype._createChannel=function(){MyXD.Util.onDOMLoaded(function(){if(MyXD.Constants.B_MSIE){var timer=window.setInterval(function(){if(document.getElementById(MyXD.Constants.CHANNEL_IFRAME_ID)){MyXD.Client._client._createChannelIfm();clearInterval(timer);}},MyXD.Constants.TIMER_INTERGER);}else{MyXD.Client._client._createChannelIfm();}});};MyXD.Client.prototype._createChannelIfm=function(){var cid=MyXD.Constants.CHANNEL_CONTAINER_ID;var fid=MyXD.Constants.CHANNEL_IFRAME_ID;var fname=MyXD.Constants.CHANNEL_IFRAME_NAME;var ctnr,cifm;if(document.getElementById(cid)){ctnr=document.getElementById(cid);}else{ctnr=document.createElement("DIV");document.getElementsByTagName('body')[0].appendChild(ctnr);ctnr.setAttribute('id',cid);}
ctnr.style.display="none";ctnr.innerHTML='';var lh=MyXD.Client._getStorageClientURL();var h=new MyXD.Util.HashURL(MyXD.Constants.FOO_STR);h.put(MyXD.Constants.CK_CLIENT_URL+client._iframeID,escape(lh));h.put(MyXD.Constants.CLIENT_IFRAME_ID,client._iframeID);cifm=document.getElementById(fid);if(!cifm){cifm=document.createElement("IFRAME");ctnr.appendChild(cifm);}
cifm.setAttribute('id',fid);cifm.setAttribute('name',fname);cifm.setAttribute('src',client._channelSrc+"#"+h.toString());MyXD.Client._client._channelDom=cifm;ctnr=null;delete ctnr;h=null;delete h;};MyXD.Client._getStorageClientURL=function(){return MyXD.Util.split2(location.href,'#')[0];};MyXD.Client.prototype.doCall=function MyXD$Client$doCall(methodName,args,callback,onError){this._callQueue.push(new MyXD.Client.CallObject(methodName,args,callback,onError,-2));};MyXD.Client.prototype.setRoot=function MyXD$Client$setRoot(rootElementID){this._rootID=rootElementID;if(MyXD.Constants.B_MSIE){MyXD.Event.regist(document,"readystatechange",function(){if(document.readyState=="complete"){MyXD.Client.setClientRootStyle();}else{window.setTimeout("MyXD.Client.setClientRootStyle()",20);}});}else{MyXD.Client.setClientRootStyle();}};MyXD.Client.setClientRootStyle=function(){clientRootStyleContent='body{margin:0px;padding:0px;} #'+MyXD.Client._client._rootID+'{clear:both;overflow:hidden;padding:0px;margin:0px;border:none;}';clientRootStyleObject=document.createElement('style');document.getElementsByTagName('head')[0].appendChild(clientRootStyleObject);clientRootStyleObject.setAttribute('type','text/css');clientRootStyleObject.setAttribute('rel','stylesheet');if(clientRootStyleObject.styleSheet){clientRootStyleObject.styleSheet.cssText=clientRootStyleContent;}else{clientRootStyleObject.appendChild(document.createTextNode(clientRootStyleContent));}};MyXD.Client.prototype.startSizeTimer=function MyXD$Client$startSizeTimer(rootElementID){if(_myxd_client_loaded){MyXD.Client._client.setRoot(rootElementID);if(MyXD.Constants.ENV_MYJS){var sf=MyXD.Client._fireSizeAlterOnce;try{myjs_dom.prototype.setInnerXHTML=chain(myjs_dom.prototype.setInnerXHTML,sf);myjs_dom.prototype.setInnerMYML=chain(myjs_dom.prototype.setInnerMYML,sf);myjs_dom.prototype.appendChild=chain(myjs_dom.prototype.appendChild,sf);myjs_dom.prototype.insertBefore=chain(myjs_dom.prototype.insertBefore,sf);myjs_dom.prototype.removeChild=chain(myjs_dom.prototype.removeChild,sf);myjs_dom.prototype.replaceChild=chain(myjs_dom.prototype.replaceChild,sf);myjs_dom.prototype.cloneNode=chain(myjs_dom.prototype.cloneNode,sf);myjs_dom.set_style=chain(myjs_dom.set_style,function(){var p_sty=arguments[1]||null;if(typeof p_sty=='string'){if(MyXD.Util.isInterceptStyle(p_sty)&&window.myxd_size_flag_when_myjs==0){MyXD.Client._fireSizeAlterOnce();}}});}
catch(ex){MyXD.Event.regist(document.getElementById(MyXD.Client._client._rootID),"click",sf);}}else{if(MyXD.Client._sizeTimer==null){MyXD.Client._startClientTimerByType('size');}}}else{window.setTimeout(function(){MyXD.Client._client.startSizeTimer(rootElementID);},500);}};MyXD.Client.prototype.stopSizeTimer=function MyXD$Client$stopSizeTimer(){if(MyXD.Client._sizeTimer!=null){window.clearInterval(MyXD.Client._sizeTimer);MyXD.Client._sizeTimer=null;}};MyXD.Client.prototype.updatePageSize=function MyXD$Client$updatePageSize(){MyXD.Client._fireSizeAlterOnce();};MyXD.Client._startClientTimerByType=function(type){switch(type){case'size':MyXD.Client._sizeTimer=window.setInterval("MyXD.Client._fireSizeAlterOnce()",MyXD.Constants.TIMER_INTERGER*10);break;case'call':MyXD.Client._callTimer=window.setInterval("MyXD.Client._processCall()",MyXD.Constants.TIMER_INTERGER);break;}};MyXD.Client.prototype._sendHashToChannel=function(hash){var tmpH=new MyXD.Util.HashURL(location.href);var lh=MyXD.Util.split2(location.href,'#')[0];tmpH.put(MyXD.Constants.HASH_FROM_CLI_TO_SER,hash);tmpH.put(MyXD.Constants.CK_CLIENT_URL+this._iframeID,escape(lh));tmpH.put(MyXD.Constants.CLIENT_IFRAME_ID,this._iframeID);if(this._channelDom&&this._channelSrc){var sign=this._channelSrc.indexOf("?")>-1?"&":"?";try{this._channelDom.src=this._channelSrc
+sign+"myxd_rt="+Math.ceil(Math.random()*99999)
+"#"+tmpH.toString();}catch(ex){}}
tmpH=null;delete tmpH;};MyXD.Client._updateSerCallBack=function(cb){if(_myxd_client_loaded&&document.getElementById(MyXD.Constants.CHANNEL_IFRAME_ID)){MyXD.Util.postMsgByXDIframe(MyXD.Constants.CHANNEL_IFRAME_ID,MyXD.Util.warpXDMAction('updateSerCallBack',cb));}else{window.setTimeout(function(){MyXD.Client._updateSerCallBack.call(null,cb+'');},200);}};MyXD.Server=function MyXD$Server(clientIframeID){this._clientIframeID=clientIframeID;this._map=['MyXD.Server.hideServerLoading'];this._clientURL=null;this._oldClientUrl=null;this._hashObj=null;this._hash=null;this._oldHash=null;this._oldCall=null;this._serverLoaded=false;this._currIfmHeight=0;MyXD.Server._server=this;window.myXDPageType=MyXD.Constants.PAGE_SERVER;this.setClientSrc();};MyXD.Server.prototype.setClientSrc=function(){suffix=MyXD.Util.split2(window.location.href,"#")[1];if(suffix){var timer=setInterval(function(){var ifm=window.document.getElementById(MyXD.Server._server._clientIframeID);if(ifm){ifm.src=MyXD.Util.getClientUrlBySuffix(ifm.src,suffix);clearInterval(timer);MyXD.Server._server.startHashMonitor();}},30);}else{this.startHashMonitor();}};MyXD.Server.prototype.startHashMonitor=function(){var suffix,timer,last;var clientIframeID=this._clientIframeID;timer=window.setInterval(function(){suffix=MyXD.Util.split2(window.location.href,"#")[1];if((suffix!==last||forceUpdate)){last=suffix;if(this._serverLoaded){MyXD.Server.showServerLoading();}
var ifm=window.document.getElementById(clientIframeID);if(ifm&&suffix){ifm.src=MyXD.Util.getClientUrlBySuffix(ifm.src,suffix);}
this._serverLoaded=true;forceUpdate=false;}},MyXD.Constants.TIMER_INTERGER*5);};MyXD.Server.prototype._flushChildUrl=function(hash){var ifm=document.getElementById(this._clientIframeID);this._clientURL=MyXD.Util.split2(ifm.src,"#")[0];var tmpHash=new MyXD.Util.HashURL(this._clientURL,MyXD.Constants.HASH_SIGN);var oHash=tmpHash.toString();var cHash=oHash+(oHash==""?"":MyXD.Constants.HASH_SIGN)+hash.toString();if(_myxd_conn_type==MyXD.Constants.CONNECT_NAVIGATOR){this._oldClientUrl=unescape(window.navigator.myXDNavParams.storagecliurl);}
var newChildUrl=this._oldClientUrl;var compareUrl=this._clientURL;if(MyXD.Constants.B_MSIE){compareUrl=compareUrl.replace('/./','/');}
if(/%2523/.test(newChildUrl)){newChildUrl=MyXD.Util.split2(newChildUrl,"%2523")[0];}
if(newChildUrl==compareUrl){if(_myxd_conn_type==MyXD.Constants.CONNECT_NAVIGATOR){window.navigator.myXDNavParams.cbknavparam=cHash;}else if(_myxd_conn_type==MyXD.Constants.CONNECT_URLHASH){this._callChannelFunc("MyXD.Channel.updateSerCallBack",[cHash]);}else if(_myxd_conn_type==MyXD.Constants.CONNECT_XDM){if(MyXD.Constants.B_OPERA){MyXD.Util.postMsgByXDIframe(this._clientIframeID,MyXD.Util.warpXDMAction('updateSerCallBack',escape(cHash)));}else{this._callChannelFunc("MyXD.Channel.updateSerCallBack",[cHash]);}}}else{this._clientURL=newChildUrl;}
tmpHash=null;delete tmpHash;};MyXD.Server.prototype.registHandler=function MyXD$Server$registHandler(methodName){this._map.push(methodName);};MyXD.Server.prototype.start=function MyXD$Server$start(){MyXD.Server._timer=window.setInterval("MyXD.Server.onTimer()",MyXD.Constants.TIMER_INTERGER);};MyXD.Server.prototype._isMethodValid=function(methodName){for(var i=0;i<this._map.length;i++){if(methodName==this._map[i]){return true;}}
return false;};MyXD.Server.prototype._onMethodCall=function(){var keys=this._hashObj.keys();var d=decodeURIComponent;var h=new MyXD.Util.HashURL(MyXD.Constants.FOO_STR,MyXD.Constants.HASH_SIGN);var mVer=this._hashObj.get(MyXD.Constants.CALL_VER);for(var ii=0;ii<keys.length;ii++){if(keys[ii].indexOf(MyXD.Constants.CALL_NAME)>-1){var mName=unescape(keys[ii].replace(MyXD.Constants.CALL_NAME,''));if(this._isMethodValid(mName)){var tmpParams=this._hashObj.get(keys[ii]);if(MyXD.Constants.B_OPERA||(MyXD.Constants.B_MSIE&&MyXD.Constants.B_VER>7))
{tmpParams=escape(tmpParams);}
var mParams=d(tmpParams);mParams="'"+mParams.replace(MyXD.Constants.CALL_PARAM_SIGN,'\',\'')+"'";try{h.put(MyXD.Constants.CB_NAME+mName,d(MyXD.Constants.CB_RETN+MyXD.Constants.CB_SUCC+MyXD.Constants.CB_STATE_SIGN+eval(mName+'('+mParams+')')));}catch(e){h.put(MyXD.Constants.CB_NAME+mName,d(MyXD.Constants.CB_RETN+MyXD.Constants.CB_ERROR+MyXD.Constants.CB_STATE_SIGN+MyXD.Constants.WARN_FAIL_CALL));}
break;}else{h.put(MyXD.Constants.CB_NAME+mName,d(MyXD.Constants.CB_RETN+MyXD.Constants.CB_ERROR+MyXD.Constants.CB_STATE_SIGN+MyXD.Constants.WARN_INVALID_CALL));}}}
h.put(MyXD.Constants.CB_VER,mVer);this._flushChildUrl(h);h=null;delete h;};MyXD.Server.onTimer=function MyXD$Server$onTimer(){var server=MyXD.Server._server;if(_myxd_conn_type==MyXD.Constants.CONNECT_URLHASH){server._hashObj=MyXD.Util.query2Hash(unescape(server._hash));}else if(_myxd_conn_type==MyXD.Constants.CONNECT_NAVIGATOR){server._hashObj=MyXD.Util.query2Hash(unescape(window.navigator.myXDNavParams.xdparam));}else if(_myxd_conn_type==MyXD.Constants.CONNECT_XDM){server._hashObj=MyXD.Util.query2Hash(unescape(server._hash));}
if(server._hashObj.toString()!=server._oldHash){var ht=server._hashObj.get(MyXD.Constants.IFRAME_HEIGHT);if(ht){server._currIfmHeight=ht;document.getElementById(server._clientIframeID).setAttribute('height',ht+"px");MyXD.Server.updateWrapperHeight(ht);}
var newCall=server._hashObj.get(MyXD.Constants.CALL_VER);if(newCall!=server._oldCall){server._onMethodCall();server._oldCall=newCall;}
server._oldHash=server._hashObj.toString();}};MyXD.Server.prototype._getChannelWin=function(clientName,channelName){var clientW=MyXD.Constants.B_MSIE?window.self.frames[clientName]:window.document.getElementById(clientName).contentWindow;var f=clientW.frames;for(var ii=0;ii<f.length;ii++){var w=f[ii];try{if(w.name==channelName){return w;break;}}catch(ex){}}
return null;};MyXD.Server.prototype._callChannelFunc=function(funcName,paramArr,callbackHanlder,errorHanlder){var channelW=this._getChannelWin(this._clientIframeID,MyXD.Constants.CHANNEL_IFRAME_ID);if(channelW){try{var r=MyXD.Util.buildFuncNameSpace(channelW,funcName).apply(null,paramArr);if(callbackHanlder)callbackHanlder(r);}catch(ex){if(errorHanlder)errorHanlder(ex);}}};MyXD.Server.updateCliCall=function(h){MyXD.Server._server._hash=h;};MyXD.Server.saveClientUrl=function(u){MyXD.Server._server._oldClientUrl=unescape(u);};MyXD.Server.channelHasLoaded=function(cid){if(_myxd_conn_type==MyXD.Constants.CONNECT_XDM){MyXD.Util.postMsgByXDIframe(cid,MyXD.Util.warpXDMAction('channelHasLoaded','foo'));}};MyXD.Server.updateServerUrlBySuffix=function(suffix){forceUpdate=true;var uArr=MyXD.Util.split2(window.location.href,'#');uArr=MyXD.Util.split2(uArr[0],'?');var href_part=uArr[0];var query_part=uArr[1];var map={};if(query_part){var arr=query_part.split('&');for(var i=0;i<arr.length;i++){var s2=arr[i];var o=MyXD.Util.split2(s2,'=');map[o[0]]=decodeURIComponent(o[1]);}}
var url=href_part+'?'+MyXD.Util.map2query(map,'&')+'#'+suffix;window.location.href=url;};MyXD.Server.showServerLoading=function(){var doc=window.document;var server=MyXD.Server._server;var loadingObj=doc.getElementById(MyXD.Constants.SERVER_LOADING_ID);var wrapperObj=doc.getElementById(MyXD.Constants.SERVER_WRAPPER_ID);if(!wrapperObj){wrapperObj=document.createElement('DIV');wrapperObj.id=MyXD.Constants.SERVER_WRAPPER_ID;wrapperObj.style.backgroundColor='#fff';wrapperObj.style.position='absolute';wrapperObj.style.padding='0';wrapperObj.style.margin='0';wrapperObj.style.filter='alpha(opacity=40)';wrapperObj.style.MozOpacity='0.4';wrapperObj.style.opacity='0.4';var wrapperWidth=document.getElementById(server._clientIframeID).width;if(wrapperWidth&&wrapperWidth>1){wrapperObj.style.width=wrapperWidth+'px';}else{wrapperObj.style.width='820px';}
doc.getElementsByTagName('body')[0].appendChild(wrapperObj);}
if(!loadingObj){loadingObj=document.createElement('DIV');loadingObj.id=MyXD.Constants.SERVER_LOADING_ID;loadingObj.style.width=MyXD.Constants.SERVER_LOADING_WIDTH+'px';loadingObj.style.zIndex='99999';loadingObj.style.padding='0';loadingObj.style.margin='0';loadingObj.style.position=MyXD.Constants.B_MSIE&&MyXD.Constants.B_VER<=6.0?'absolute':'fixed';loadingObj.style.backgroundColor='#FFF1A8';loadingObj.style.fontWeight='bold';loadingObj.style.MozBorderRadiusBottomleft='8px';loadingObj.style.WebkitBorderBottomLeftRadius='8px';loadingInnerObj=document.createElement('DIV');loadingInnerObj.style.margin='3px 10px';loadingInnerObj.style.textAlign='center';var html='Loading...';loadingInnerObj.innerHTML=html;loadingObj.appendChild(loadingInnerObj);doc.getElementsByTagName('body')[0].appendChild(loadingObj);}
var wWidth=doc.documentElement.clientWidth;var wHeight=doc.documentElement.clientHeight;var scrollTop=Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);loadingObj.style.top=MyXD.Constants.B_MSIE&&MyXD.Constants.B_VER<=6.0?scrollTop+'px':'0px';loadingObj.style.right='0px';loadingObj.style.display='block';if(MyXD.Constants.B_MSIE&&MyXD.Constants.B_VER<=6.0&&!timer){var timer=MyXD.Event.bind(window,'scroll',function(){loadingObj.style.top=Math.max(doc.documentElement.scrollTop,doc.body.scrollTop)+'px';});}
var ifm=doc.getElementById(server._clientIframeID);var ifmTop,ifmLeft;if(MyXD.Constants.B_MSIE){var rect=ifm.getBoundingClientRect();ifmTop=rect.top+scrollTop;ifmLeft=rect.left-10;}else{ifmTop=ifm.offsetTop;ifmLeft=ifm.offsetLeft;}
wrapperObj.style.height=server._currIfmHeight+'px';wrapperObj.style.top=ifmTop+'px';wrapperObj.style.left=ifmLeft+'px';wrapperObj.style.display='block';};MyXD.Server.updateWrapperHeight=function(height){var doc=window.document;var wrapperObj=doc.getElementById(MyXD.Constants.SERVER_WRAPPER_ID);if(wrapperObj){wrapperObj.style.height=height+'px';}};MyXD.Server.hideServerLoading=function(){var doc=window.document;var loadingObj=doc.getElementById(MyXD.Constants.SERVER_LOADING_ID);var wrapperObj=doc.getElementById(MyXD.Constants.SERVER_WRAPPER_ID);if(loadingObj&&wrapperObj){try{loadingObj.style.display='none';wrapperObj.style.display='none';}catch(ex){try{loadingObj.runtimeStyle.display='none';wrapperObj.runtimeStyle.display='none';}catch(ex){}}}};MyXD.Channel=function MyXD$Channel(){window.name=MyXD.Constants.CHANNEL_IFRAME_ID;this._oldClientURL=null;this._oldCBParam=null;this._clientIfmID=null;this._cookie=null;this._myxdID=null;MyXD.Channel._channel=this;MyXD.Event.regist(window,"load",function(){MyXD.Channel.processHashFromCliToSer();MyXD.Channel.updateStorageClientURL();MyXD.Channel._channel._callServerFunc('MyXD.Server.channelHasLoaded',[MyXD.Channel._channel._clientIfmID]);MyXD.Channel.startListenSuffix();});window.myXDPageType=MyXD.Constants.PAGE_CHANNEL;var hash=new MyXD.Util.HashURL();this._clientIfmID=hash.get(MyXD.Constants.CLIENT_IFRAME_ID);hash=null;delete hash;if(_myxd_conn_type==MyXD.Constants.CONNECT_XDM){MyXD.Event.bind(MyXD.Util.getXDMListener(),'message',function(e){if(!e.origin&&e.domain){e.origin=e.domain;}
var clientDM=MyXD.Util.getDomain(MyXD.Channel._channel._oldClientURL);if(!MyXD.Util.isValidXDOrigin(e.origin,clientDM)){return;}
var info=MyXD.Util.getXDMInfo(e.data);switch(info.action){case'flushServer':MyXD.Channel._channel._callServerFunc('MyXD.Server.updateCliCall',[MyXD.Util.decodeURL(info.value)]);break;case'updateSerCallBack':MyXD.Channel.updateSerCallBack(unescape(info.value));break;}});}};MyXD.Channel.prototype._tellClient=function(hash){if(_myxd_conn_type==MyXD.Constants.CONNECT_XDM){MyXD.Util.postMsgByXDIframe(this._clientIfmID,MyXD.Util.warpXDMAction('tellClient',hash),"*",2);}else if(_myxd_conn_type==MyXD.Constants.CONNECT_URLHASH){var cu=this._oldClientURL;var u=cu;if(u&&hash&&hash.length){try{window.parent.location.replace(u+"#"+hash);}catch(ex){try{window.parent.location.replace(unescape(u+"#"+escape(hash)));}catch(ex2){}}}}};MyXD.Channel.prototype._callServerFunc=function(funcName,paramArr,callbackHanlder,errorHanlder){try{var r=MyXD.Util.buildFuncNameSpace(parent.parent,funcName).apply(null,paramArr);if(callbackHanlder)callbackHanlder(r);}catch(ex){if(errorHanlder)errorHanlder(ex);}};MyXD.Channel.updateStorageClientURL=function(){var cha=MyXD.Channel._channel;var hash=new MyXD.Util.HashURL(location.href);var ccu=MyXD.Constants.CK_CLIENT_URL;var mthArr=hash.toString().match(ccu+"[^=]+");var ifmID='';if(mthArr){ifmID=mthArr[0].replace(ccu,"")}
var uName=ccu+ifmID;var clientURL=MyXD.Util.decodeURL(hash.get(uName));cha._callServerFunc('MyXD.Server.saveClientUrl',[escape(clientURL)]);cha._oldClientURL=clientURL;hash=null;delete hash;};MyXD.Channel.updateSerCallBack=function(h){var cha=MyXD.Channel._channel;if(h!=cha._oldCBParam){cha._oldCBParam=h;cha._tellClient(cha._oldCBParam);}};MyXD.Channel.processHashFromCliToSer=function(){var h=new MyXD.Util.HashURL(location.href);var s=h.get(MyXD.Constants.HASH_FROM_CLI_TO_SER);if(s){MyXD.Channel._channel._callServerFunc('MyXD.Server.updateCliCall',[MyXD.Util.decodeURL(s)]);}};MyXD.Channel.startListenSuffix=function(){try{var timer=setInterval(function(){var h=new MyXD.Util.HashURL(location.href);var suffix=h.get(MyXD.Constants.CLIENT_SUFFIX);suffix=decodeURIComponent(suffix);if(suffix&&suffix!='null'){clearInterval(timer);MyXD.Channel._channel._callServerFunc('MyXD.Server.updateServerUrlBySuffix',[suffix]);}},MyXD.Constants.TIMER_INTERGER);}catch(ex){}};
