/*
     MIT License
 @author      Harald Kirschner <mail [at] digitarald.de>
 @copyright   2007 Author

 @modify      2008.11.29 by Ruslan Suhar (xplay@yandex.ru)
*/
var HistoryManagerX=new Class({Implements:[Events,Options],options:{onStateChange:$empty,observeDelay:100,stateSeparator:";",iframeSrc:"javascript:void(0)"},dataOptions:{skipDefaultMatch:!0,defaults:[],regexpParams:""},initialize:function(a){this.setOptions(a||{});if(this.modules)return this;this.modules=$H({});this.count=history.length;this.states=[];this.states[this.count]=this.getHash();return this},start:function(){this.observe.periodical(this.options.observeDelay,this);this.started=!0;this.observe();
this.update();this.fireEvent("onStart",[this.state]);return this},register:function(a,b,c,d,f,g){this.modules||this.initialize();b=$merge(this.dataOptions,g||{},{defaults:b,onMatch:c,onGenerate:d,regexp:f});b.regexp=b.regexp||a+"-([\\w_-]*)";"string"==typeof b.regexp&&(b.regexp=RegExp(b.regexp,b.regexpParams));b.onGenerate=b.onGenerate||function(d){return a+"-"+d[0]};b.values=b.defaults.slice();this.modules.set(a,b);this.fireEvent("onUnregister",[a,b]);return{setValues:function(d){return this.setValues(a,
d)}.bind(this),setValue:function(d,f){return this.setValue(a,d,f)}.bind(this),generate:function(d){return this.generate(a,d)}.bind(this),unregister:function(){return this.unregister(a)}.bind(this)}},unregister:function(a){this.fireEvent("onRegister",[a]);this.modules.remove(a)},setValues:function(a,b){var c=this.modules.get(a);if(!c||c.values.isSimilar(b))return this;c.values=b;this.update();return this},setValue:function(a,b,c){a=this.modules.get(a);if(!a||a.values[b]==c)return this;a.values[b]=
c;this.update();return this},generate:function(a,b){var c=this.modules.get(a),d=c.values.slice();c.values=b;var f=this.generateState();c.values=d;return"#"+f},observe:function(){if(this&&!this.timeout){var a=this.getState();this.state!=a&&((window.ie||window.webkit419)&&null!==this.state?this.setState(a,!0):this.state=a,this.modules.each(function(b){var c=a.match(b.regexp);c?(c.splice(0,1),c.complement(b.defaults),c.isSimilar(b.defaults)||(b.values=c)):b.values=b.defaults.slice();b.onMatch(b.values,
b.defaults)}),this.fireEvent("onStateChange",[a]).fireEvent("onObserverChange",[a]))}},generateState:function(){var a=[];this.modules.each(function(b){(!b.skipDefaultMatch||!b.values.isSimilar(b.defaults))&&a.push(b.onGenerate(b.values))});return a.join(this.options.stateSeparator)},update:function(){if(!this.started)return this;var a=this.generateState();if(!this.state&&!a||this.state==a)return this;this.setState(a);this.fireEvent("onStateChange",[a]).fireEvent("onUpdate",[a]);return this},observeTimeout:function(){this.timeout=
this.timeout?$clear(this.timeout):this.observeTimeout.delay(200,this)},getHash:function(){var a=top.location.href,b=a.indexOf("#")+1;return b?a.substr(b):""},getState:function(){var a=this.getHash();if(this.iframe)try{var b=this.iframe.contentWindow;if(!b)return;var c=b.document;if(c&&"state"==c.body.id){var d=c.body.innerText;if(this.state==a)return d;this.istateOld=!0}else return this.istate}catch(f){}return window.webkit419&&history.length!=this.count?(this.count=history.length,$pick(this.states[this.count-
1],a)):a},setState:function(a,b){a=$pick(a,"");window.webkit419?(this.form||(this.form=(new Element("form",{method:"get"})).injectInside(document.body)),this.count=history.length,this.states[this.count]=a,this.observeTimeout(),this.form.setProperty("action","#"+a).submit()):top.location.hash=a||"#";if(window.ie&&(!b||this.istateOld)){this.iframe||(this.iframe=(new Element("iframe",{name:"historyfrm",src:this.options.iframeSrc,styles:"display: none;"})).injectInside(document.body),this.istate=this.state);
try{var c=this.iframe.contentWindow.document;c.open();c.write('<html><body id="state">'+a+"</body></html>");c.close();this.istateOld=!1}catch(d){}}this.state=a},implement:$extend});Array.implement({isSimilar:function(a){return this.toString()==a.toString()},complement:function(a){for(var b=0,c=this.length;b<c;b++)this[b]=$pick(this[b],a[b]||null);return this}});var historyManager;window.addEvent("domready",function(){historyManager=new HistoryManagerX});
void function(){var a=new Hash;try{a.empty.periodical(6E4,a)}catch(b){}var c=new Class({Extends:Ajax,initialize:function(d,f){a.set(d,"init");this.addEvent("onCancel",function(){a.set(d,"cancel")});this.parent(d,f)},send:function(d,f){a.set(this.url,"request");if(!this.check(arguments.callee,f))return this;this.running=!0;var b=$type(f);if("string"==b||"element"==b)f={data:f};var b=this.options,f=$extend({data:b.data,url:d,method:b.method},f),b=f.data,d=f.url,c=f.method;switch($type(b)){case "element":b=
$(b).toQueryString();break;case "object":case "hash":case "array":b=Hash.toQueryString(b)}this.options.urlEncoded&&"post"==c.toLowerCase()&&this.headers.set("Content-type","application/x-www-form-urlencoded"+(this.options.encoding?"; charset="+this.options.encoding:""));b&&"get"==c.toLowerCase()&&(d=d+(d.contains("?")?"&":"?")+b,b=null);d+="&_ajax=true";W&&(d+="&_ss="+W.sideStore);this.xhr.open(c.toUpperCase(),d,this.options.async);this.xhr.onreadystatechange=this.onStateChange.bind(this);this.headers.each(function(d,
a){$try(function(){this.xhr.setRequestHeader(a,d);return true}.bind(this))||this.fireEvent("exception",[a,d])},this);this.loadMask("onrequest",$(this.options.update));if(window.ie&&this.options.update&&$(this.options.update))try{$ES("iframe",this.options.update).each(function(d){d.remove()})}catch(e){}this.fireEvent("request");this.xhr.send(b);if(!this.options.async)this.onStateChange();return this},onFailure:function(){$chk($("loadMask"))&&this.loadMask("onfailure");switch(this.transport.status){case 404:MessageBox.error("\u9875\u9762\u672a\u627e\u5230.");
break;case 401:new Dialog("401.html",{ajaksable:!1,modal:!0,width:300,height:150,resizeable:!1});break;case 403:MessageBox.error("\u60a8\u65e0\u6b64\u64cd\u4f5c\u7684\u6743\u9650.")}a.set(this.url,"failure");this.fireEvent("onFailure",this.transport)},onException:function(d,a){$chk($("loadMask"))&&this.loadMask("onException");MessageBox.error("\u51fa\u73b0\u9519\u8bef:"+d+":"+a)},success:function(d){var a=this.options,b=this.response,c=$(a.update);b.html=d.stripScripts(function(d){b.javascript=d});
b.html=this.processHTML(b.html);c?(a.elMap&&($each(a.elMap,function(d,a){".sideContent"!=a&&$(d).empty().setStyle("fontSize",0)}),b.html=b.html.replace(/<\!-{5}(.*?)-{5}([\s\S]*?)-{5}(.*?)-{5}>/g,function(d,b,c){a.elMap[b]&&(".sideContent"==b&&c?a.elMap[b].adopt((new Element("div")).setHTML(c).getFirst().setStyle("display","none")):a.elMap[b].set("html",c).setStyle("fontSize",""));return""}),updateSize()),c.empty().setHTML(b.html),a.evalScripts&&$exec(b.javascript),makeAjaksLink(c),this.onSuccess(b.html,
null,a,null,b.javascript),this.loadMask("oncomplete"),document.title=$("shop_title_block").getText()+" - Powered By ShopEx"):(MessageBox.show(b.html),this.onSuccess(b.html),this.loadMask("complete"))},loadMask:function(d,b){$(b);switch(d){case "onrequest":return $("loadMask").amongTo(window).show();default:$("loadMask").hide(),a.set(this.url,"success")}}});ShopEx_AdminXHR=new Class({options:{evalScripts:!0,autoCancel:!0,method:"get",elMap:!1,data:null,link:"cancel"},initialize:function(){this.historyMangerInit.call(this);
$$("#mainMenus a[name]").addEvent("click",function(d){d.stop();document.body.fireEvent("click",{target:this,stop:$empty})})},historyMangerInit:function(){try{this.history=historyManager.register("page",["ctl=dashboard&act=getInfo"],function(d,a){if($("main"))return this.page("index.php?"+(d.input?d.input:a[0]))}.bind(this),function(d){return d[0]},".*"),historyManager.start()}catch(d){MessageBox.error(d.message)}},page:function(){var d=Array.flatten(arguments).link({url:String.type,options:Object.type,
sponsor:Element.type});if(-1<["request","init"].indexOf(a.get(g)))return $("loadMask").amongTo(window).show();var b=$merge(this.options,d.options),g=d.url,d=d.sponsor;b.autoCancel&&this.curAjax&&this.curAjax.cancel();if("element"==$type(b.data)&&!$(b.data).bindValidator("x-input"))return $("loadMask").hide();b.update=b.update||$($chk(d)?$(d).getContainer():!1)||"main";if("main"==b.update||"element"==$type(b.update)&&"main"==b.update.id)(d=g.match("index\\.php\\?(.*)"))&&this.history.setValue(0,d[1]),
b.elMap||(b.elMap={".mainHead":$("headBar"),".mainFoot":$("footBar")});$extend(b.elMap,{".sideContent":$("sidecontent")});this.curAjax=new c(g,b);this.curAjax.request()}});SideRender=function(d){if(d){var a=$("sidecontent").retrieve("info",{cur:d,store:[]}),b=a.store;$("submenu_"+a.cur).hide();$("submenu_"+d).show();a.cur=d;a=location.hash.slice(1);if($("sidecontent").retrieve("info")){var c=$("sidecontent").retrieve("info").cur,e=$("sidecontent").retrieve("curAction"),i=$("mainMenus").retrieve("curAction");
e&&e.removeClass("cur");i&&i.removeClass("current");(a=$("submenu_"+c).getElement("a[href$="+a+"]"))&&$("sidecontent").store("curAction",a.addClass("cur"));(a=$("mainMenus").getElement("a[name="+d+"]"))&&$("mainMenus").store("curAction",a.addClass("current"))}-1<b.indexOf(d)||(b.include(d),W&&(W.sideStore=b.join(",")),showSide())}};void function(){$(document.body).addEvents({click:function(d){var a;a=$(d.target);"a"!=a.getTag()&&(a=a.getParent("a"));if(a=!a?!1:(!$chk($(a).target)||a.target.test("{",
"i"))&&!a.href.match(/^javascript.+/i)&&!a.onclick||"_blank"==a.get("target")&&a.href.contains(SHOPADMINDIR)?a:!1){d.stop();if("_blank"==a.get("target"))return _open(a.href);var b;try{b=Json.evaluate(a.target)}catch(c){return $chk(a.href)?W.page(a.href,a):!1}if(dlg=a.get("dialog"))return d={title:$pick(a.title,a.get("text")),width:0.7*window.getSize().x,height:0.7*window.getSize().y},dlg=JSON.decode(dlg),dlg="object"==$type(dlg)?dlg:{},d=$extend(d,dlg),new Dialog(a.href,d);if("fm"in b&&$chk(b.fm)){b.update=
b.update||"main";if("main"==b.update||b.update.id&&"main"==b.update.id)[$("footBar"),$("headBar")].each(Element.empty),updateSize();(new Element("iframe",{name:b.fm,styles:{width:"100%",height:"98%",border:"none","overflow-y":"scroll"}})).inject($(b.update).empty()).setProperty("src",a.href)}else{if(d.shift)return open(a.href.replace("?","#"));W.page(a.href,b,a)}}},submit:function(d){var a=$(d.target);if("form"!=a.getTag()?0:$chk($(a).getProperty("action"))&&(!$chk(a.target)||a.target.test("{","i"))&&
!a.onsubmit){d.stop();(new Element("input",{type:"hidden",value:1,name:"__"})).inject(a);if(!a.bindValidator("x-input"))return $("loadMask").hide();$ES("textarea[ishtml=true]",a).getValue();var b=a.getProperty("action"),c=c||{};if(a.target.test("{","i"))try{c=Json.evaluate(a.target)}catch(e){}(f_target_obj=a.retrieve("target"))&&$extend(c,f_target_obj);d.requestOptions&&$extend(c,d.requestOptions);var i=$ES('input[type="file"]',a);if(0<i.length&&i.some(function(a){return a.value}))return MODALPANEL.show(),
$("loadMask").amongTo(window).show(),$("upload_iframe")||(new Element("iframe",{id:"upload_iframe",name:"upload_iframe",styles:{display:"none"}})).inject(document.body),a.setProperty("target","upload_iframe"),a.set({enctype:"multipart/form-data",encoding:"multipart/form-data"}),a.setProperty("action",a.getProperty("action")+"&_upload=true"),window.upload_rs_el=c&&c.ure?c.ure:$(d.target).getContainer(),a.submit(),a;if(c)return"fm"in c?(a.setProperty("target",ftarget.fm),a.submit()):W.page(b,$extend(c,
{method:a.getProperty("method"),data:a.toQueryString()}),a);W.page(b,{method:a.getProperty("method"),data:a.toQueryString()},a)}}})}();makeAjaksLink=function(a){$(a).getElements("form").addEvent("submit",function(a){document.body.fireEvent("submit",$extend(a||{},{target:this,stop:a?a.stop?a.stop:$empty:$empty}))})};Splash={go:function(a,b,c){$$($("loadMaks"),MODALPANEL).hide();(function(){var b;$$($("successSplash"),$("noticeSplash"),$("failedSplash")).some(function(a){if($chk(a))return b=a,!0});
b&&W.page(a,JSON.decode(c),b)}).delay(b.toInt())}}}();
void function(){finderGroup={};finderDestory=function(){for(var a in finderGroup)delete finderGroup[a]};Element.Events.ListDrag={base:"mousedown",condition:function(a){return!0==a.control}};var a=new Class({Extends:Drag,attach:function(){this.handles.addEvent("ListDrag",this.bound.start);return this},detach:function(){this.handles.removeEvent("ListDrag",this.bound.start);return this}}),b=new Class({Extends:Drag,start:function(a){0<this.element.getParent(".finder-header").scrollLeft||this.parent(a)}});
Finder=new Class({Implements:[Events],options:{},initialize:function(a,b){$extend(this.options,b);this.id=a;this.initStaticView();this.initView();this.attachStaticEvents();this.attachEvents()},initStaticView:function(){$each("action form search tip detail header footer".split(" "),function(a){this[a]=$("finder-"+a+"-"+this.id)},this)},initView:function(){this.list=$("finder-list-"+this.id).store("visibility",!0);this.listContainer=this.list.getContainer()},isVisibile:function(){return!this.list.retrieve?
!1:$chk(this.list.retrieve("visibility"))},attachStaticEvents:function(){var a=this;a.search&&(a.search.addEvent("submit",function(b){b.stop();b=this.getElement(".finder-search-input");a.filter.reset().push({value:b.value,name:this.get("current_key"),label:this.getElement("label").innerHTML+"\u4e3a:<b>"+b.value+"&nbsp;</b>"});b.value=""}),new DropMenu($E(".finder-search-select",a.action),{offset:{y:12,x:-5},relative:a.action}));a.tip&&a.tip.addEvents({show:function(a,d){$$(this.childNodes).hide();
var b=this.getElement("."+a);b.innerHTML=b.innerHTML.replace(/<em>([\s\S]*?)<\/em>/ig,function(){return"<em>"+d+"</em>"});b.setStyle("display","block");b.getElement("span").set("html",$$(".finder-footer .textright i").get("html"));if(!this.retrieve("show")){this.store("show",true);this.show();window.fireEvent("resize")}},hide:function(){if(this.retrieve("show")){this.store("show",false);$$(this.childNodes).hide();this.hide();window.fireEvent("resize")}}});a.action&&a.action.getElements("*[submit]").addEvent("click",
function(b){$list=$$("ul.finder-filter-info li.finder-filter-item input[type=hidden]");$list.each(function(a){a.set("disabled",true)});var c=this.get("target"),h=this.get("submit"),e=a.form.retrieve("rowselected"),i=new Element("div"),l;for(n in e)n&&$A(e[n]).each(function(a){a=="_ALL_"&&(l=true);i.adopt(new Element("input",{type:"hidden",name:n,value:a}))});(e=a.form.getElement(".finder-filter"))&&l&&e.getElements("input").each(function(a){i.adopt(new Element("input",{type:"hidden",name:a.name,value:a.value}))});
var e=c,k={};if(c){if(c.contains("::")){e=c.split("::")[0];k=JSON.decode(c.split("::")[1]);$type(k)!="object"&&(k={})}}else e="refresh";if(!i.getFirst())return MessageBox.error("\u8bf7\u9009\u62e9\u8981\u64cd\u4f5c\u7684\u6570\u636e\u9879.");c=this.getProperty("confirm");if(!c||window.confirm(c)){$(b.target).get("only_id")||i.adopt(a.form.toQueryString().toFormElements());switch(e){case "refresh":W.page(h,$extend({data:i,method:"post",update:"messagebox",onComplete:a.refresh.bind(a)},k));break;case "dialog":e.contains("::")&&
JSON.decode(e.split("::")[1]);window.finderDialog=new Dialog(h,$extend({title:this.get("dialogtitle")||this.get("text"),ajaxoptions:{data:i,method:"post"},onClose:a.refresh.bind(a)},k));break;case "_blank":(new Element("form",{action:h,name:e,target:"_blank",method:"post"})).adopt(i).inject("elTempBox").submit();break;default:(new Element("form",{action:h,name:e,method:"post"})).adopt(i).inject("elTempBox").submit()}$list.each(function(a){a.set("disabled",false)})}});a.header&&a.header.addEvent("click",
function(b){var c=$(b.target);c.hasClass("orderable")||(c=c.getParent(".orderable"));if(c){c=["desc"==c.get("order")?"asc":"desc",c.get("key")].link({"_finder[orderType]":String.type,"_finder[orderBy]":String.type});a.fillForm(c).refresh();b.stopPropagation()}});a.form&&(a.options.filterInit&&((new c(a.form.getElement(".finder-filter"))).attach(a.options.filterInit),updateSize()),a.filter=new c(a.form.getElement(".finder-filter"),{onChange:function(){a.unselectAll();a.refresh()}}));a.detail&&(a.detail.retrieve("content",
a.detail.getElement(".finder-detail-content")),a.detail.addEvents({slideIn:function(){var b=Array.flatten(arguments);if(this.retrieve("slideIn")){this.store("slideIn",b);return this.fireEvent("load",b)}this.store("slideIn",b);this.fireEvent("load",b);this.setStyle("height",a.listContainer.getSize().y*0.5);this.setStyle("width",a.listContainer.getSize().x);updateSize()},slideOut:function(){if(this.retrieve("slideIn")){this.store("slideIn",false);this.retrieve("content").empty();this.setStyle("height",
0);var a=this.retrieve("currow");a.removeClass&&a.removeClass("view-detail");this.store("item-id",null);updateSize()}},load:function(b,c,h,e){if(!e){if(!$chk(h)||h.hasClass("view-detail"))return;$type(this.retrieve("currow"))=="element"&&$(this.retrieve("currow")).removeClass("view-detail");this.store("currow",h.addClass("view-detail"));this.store("item-id",h.get("item-id"))}this.addClass("loading-content");var i=this,e={update:i.retrieve("content"),onComplete:function(){i.fireEvent("complete",h)}};
$extend(e,c);W.page(b+"&_finder_name="+a.id,e)},complete:function(b){b&&b.getPosition().y>this.getPosition().y&&a.listContainer.retrieve("fxscroll",new Fx.Scroll(a.listContainer,{link:"cancel"})).toElement(b);this.removeClass("loading-content")}}))},selectAll:function(){var a=this.header.getElement(".sellist");a.set("checked",!0).fireEvent("change").set("checked",!1);(this.form.retrieve("rowselected")[a.name]||[]).empty().push("_ALL_");this.tip.fireEvent("show","selectedall")},unselectAll:function(){var a=
this.header.getElement(".sellist");a.set("checked",!1).fireEvent("change");(this.form.retrieve("rowselected")[a.name]||[]).empty();this.tip.fireEvent("hide")},attachEvents:function(){var d=this;d.header&&d.header.getElements("col").each(function(a,c){var c=c.toInt(),f=c+1,e=d.header.getElement("td:nth-child("+f+")").getElement(".finder-col-resizer");e&&new b(a,{modifiers:{x:"width"},limit:{x:[15,1E3]},handle:e,unit:0,onBeforeStart:function(a){a.store("lc",d.list.getElements("col")[c])},onDrag:function(a){d.header.hasClass("col-resizing")||
d.header.addClass("col-resizing");var b=a.getStyle("width").toInt();$(a.retrieve("lc")).setStyle("width",b);$(a).addClass("resizing");window.webkit&&(d.header.getElement("td:nth-child("+f+")").setStyle("width",b),d.list.getElement("td:nth-child("+f+")").setStyle("width",b))},onComplete:function(a){d.header.removeClass("col-resizing");$(a).removeClass("resizing");var b=d.list.getElement("td:nth-child("+f+")").get("key"),c=d.options.controller,a=[b,a.getStyle("width").toInt()],b=$("msgStorage").retrieve("events",
{finder_colset:{}});(b.finder_colset[c]=b.finder_colset[c]||{})[a[0]]=a[1]}})});var c=d.list.retrieve("eventInfo",{}),g=d.form.retrieve("rowselected",{});d.list.addEvents({selectrow:function(a){a.getParent(".row").addClass("selected")},unselectrow:function(a){a.getParent(".row").removeClass("selected")}});var h=d.list.getElements(".sel");d.rowCount=h.length;d.header&&d.header.getElement(".sellist")&&d.header.getElement(".sellist").addEvent("change",function(){h.set("checked",this.checked);h.fireEvent("change")});
h.each(function(a){window.ie&&(a.addEvent("click",function(){this.fireEvent("change")}),a.addEvent("focus",function(){this.blur()}));a.addEvent("change",function(){g[this.name]=g[this.name]||[];g[this.name][this.checked?"include":"erase"](this.value);if(!this.checked&&g[this.name].contains("_ALL_")){g[this.name].erase("_ALL_");return d.unselectAll()}var b=g[this.name].length;if(b>1){d.tip.fireEvent("show",["selected",b]);(b==d.tip.get("count").toInt()||g[a.name].contains("_ALL_"))&&d.tip.fireEvent("show",
["selectedall",b])}else d.tip.fireEvent("hide");d.list.fireEvent(this.checked?"selectrow":"unselectrow",this)});g[a.name]&&g[a.name].push&&g[a.name].contains(a.value)?a.set("checked",!0).fireEvent("change"):g[a.name]&&g[a.name].contains("_ALL_")&&a.set("checked",!0).fireEvent("change");if((row=a.getParent(".row"))&&row.get("item-id")==d.detail.retrieve("item-id"))row.addClass("view-detail"),d.detail.store("currow",row),d.listContainer.retrieve("fxscroll",new Fx.Scroll(d.listContainer,{link:"cancel"})).toElement(row)});
var e=d.list.getLast();e&&e.addEvents({show:function(a){if(a){e.getSize();e.setStyles({visibility:"visible",opacity:0});e.retrieve("fx",new Fx.Styles(e,{link:"cancel",duration:400,transition:Fx.Transitions.Quint.easeOut})).start({opacity:1});var b=e.getElement(".cell-edit-action");b.addEvent("submet",function(){this.addClass("cell-edit-action-remote");e.store("requesting",!0);var b=new Request({onSuccess:function(b){"ok:"==b.substring(0,3)?(a.getElement(".cell")||a).innerHTML=b.substring(3):MessageBox.error(b);
e.fireEvent("hide",a);e.store("requesting",!1)}});b.post(this.get("action"),this);this.store("request",b)});b.getElements("button").addEvent("click",function(){if(!this.hasClass("x-select-btn")){if("submit"==this.get("type"))return b.fireEvent("submet",a);e.fireEvent("hide",a)}})}},hide:function(a){this.setStyle("visibility","hidden");var b=this.getElement(".cell-edit-action")?this.getElement(".cell-edit-action").retrieve("request"):null;b&&"cancel"in b&&b.cancel();a&&(["edit-ready","edit-begin",
"edit-ing"].each(a.removeClass,a),this.empty())}});d.list.addEvent("click",function(a){var b=$(a.target);if(b)if(b.match("img")&&(b=$(b.parentNode)),b.match("a")&&"_blank"==b.get("target"))a=b.getParent(".row").getElement("input[class=sel]"),a.set("checked",!0),d.list.fireEvent("selectrow",a),a.fireEvent("change");else{if(_detail=b.get("detail"))return a.stopPropagation(),b.hasClass("btn-detail-open")&&b.getParent(".view-detail")?d.hideDetail(_detail,{},b.getParent(".row")):d.showDetail(_detail,{},
b.getParent(".row"));if(b.hasClass("cell")||b.hasClass("cell-inside"))b=b.getParent("td");if(b.match("td")){if(d.detail.retrieve("slideIn")&&(detailbtn=b.getParent(".row").getElement("*[detail]"))&&!b.getParent(".row").hasClass("view-detail"))return d.showDetail(detailbtn.get("detail"),{},b.getParent(".row"));if(b.hasClass("editable")&&!b.hasClass("edit-ing")&&!b.hasClass("edit-begin"))if(b.hasClass("edit-ready"))b.addClass("edit-begin"),d.editCell(b,a,function(){b.addClass("edit-ing")});else{if(c.curcell){if(_editPanel=
c.curcell.retrieve("editPanel")){if(_editPanel.retrieve("requesting"))return;_editPanel.fireEvent("hide")}c.curcell.removeClass("edit-ready").removeClass("edit-begin").removeClass("edit-ing")}b.addClass("edit-ready");c.curcell=b}}}});attachEsayCheck(d.list,"td:nth-child(first)");var i=d.list.getContainer();"visible"!=d.header.getStyle("overflow")&&new a(d.header,{handle:d.list,style:!1,modifiers:{x:"scrollLeft"},invert:!0,preventDefault:!0,onDrag:function(){i.scrollTo(d.header.getScrollLeft())},onStart:function(a){a.setStyle("cursor",
"move");d.list.addEvent("contextmenu",function(a){a.stop()})},onComplete:function(a){a.setStyle("cursor","default");(function(){d.list.removeEvents("contextmenu")}).delay(200)}})},editCell:function(a,b,c){if(a){a.addClass("edit-begin");var h=this.list.getLast().setStyle("visibility","hidden"),e="index.php?ctl="+this.options.controller+"&act=cell_editor";(new Request({onSuccess:function(e){h.set("html",e);var e={x:0,y:0},l=window.getSize(),k=window.getScroll(),o={x:h.offsetWidth,y:h.offsetHeight},
p={x:"left",y:"top"},j;for(j in p){var m=b.page[j]+e[j];m+o[j]-k[j]>l[j]&&(m=b.page[j]-e[j]-o[j]);h.setStyle(p[j],m)}h.fireEvent("show",a);a.store("editPanel",h);(c||$empty)(h)}})).post(e,{id:a.getParent(".row").get("item-id"),key:a.get("key").trim()})}},fillForm:function(a){if(a&&"object"==$type(a)){var a=$H(a),b=this;a.each(function(a,d){(b.form.getElement("input[name^="+d.slice(0,-1)+"]")||(new Element("input",{type:"hidden",name:d})).inject(b.form)).set("value",a)});return b}},eraseFormElement:function(){var a=
Array.flatten(arguments),b=this;$each(a,function(a){b.form.getElement("input[name="+a+"]").remove()});return b},showDetail:function(a,b,c){this.detail.fireEvent("slideIn",Array.flatten(arguments))},hideDetail:function(a,b,c){this.detail.fireEvent("slideOut",Array.flatten(arguments))},getQueryStringByForm:function(){return this.form.toQueryString()},page:function(a){this.form.set("data-page",a||1);this.request({method:this.form.method||"post"})},refresh:function(){this.request({method:this.form.method||
"post",onComplete:function(){if(sinargs=this.detail.retrieve("slideIn"))sinargs.push("refresh"),sinargs[2]=!1,this.detail.fireEvent("load",sinargs)}})},request:function(){var a=Array.flatten(arguments).link({options:Object.type,action:String.type});a.action=a.action||this.form.action+"&page="+(this.form.get("data-page")||1);a.options=a.options||{};var b=a.options.onComplete;"function"!=$type(b)&&(b=$empty);a.options=$extend(a.options,{elMap:{".mainHead":this.header,".mainFoot":this.footer},onComplete:function(){this.initView();
this.attachEvents();b.apply(this,Array.flatten(arguments))}.bind(this)});var c=this.getQueryStringByForm(),h=a.options.data;switch($type(h)){case "string":a.options.data=[c,h].join("&");break;case "object":case "hash":a.options.data=[c,Hash.toQueryString(h)].join("&");break;case "element":a.options.data=[c,$(h).toQueryString()].join("&");break;default:a.options.data=c}var e=$("msgStorage").retrieve("events");$H(e.finder_colset).getValues().length?(new Request).post("index.php?ctl=default&act=status",
{events:$("msgStorage").retrieve("events")}).chain(function(){e.finder_colset={};W.page(a.action,a.options)}.bind(this)):W.page(a.action,a.options)}});var c=new Class({Implements:[Events,Options],options:{onPush:$empty,onRemove:$empty,onChange:$empty},initialize:function(a,b){var c=this;this.fp=$(a);this.fpInfo=this.fp.getElement(".finder-filter-info");this.fp.removeEvents("click").addEvent("click",function(a){var b=$(a.target);if(b&&b.hasClass("remove"))return c.remove(b.getParent(".finder-filter-item")),
a.stopPropagation()});this.setOptions(b)},push:function(a,b){if(this.fpInfo.getElement("input[name="+a.name+"]"))return this;var c=this.fp.getElement(".ffitpl").clone();"array"==typeof a.value?(a.name+="[]",a.each(function(){(new Element("input",{type:"hidden"})).set({name:a.name,value:a.value}).inject(c)})):(new Element("input",{type:"hidden"})).set({name:a.name,value:a.value}).inject(c);if(mg=a.merge)$splat(mg).each(function(a){var b;$type(a)=="object"&&(b=(new Element("input",{type:"hidden"})).set({name:a.name,
value:a.value}));$type(a)=="string"&&(b=a.toFormElements());c.adopt(b)}),delete a.merge;c.getElement("span").set("html",a.label);c.className="finder-filter-item";this.fpInfo.adopt(c);if(b)return this;this.change();return this},attach:function(a){a.each(function(b,c){this.push(b,!0);c==a.length-1&&this.change()},this)},remove:function(a){$(a).remove();this.change();return this},reset:function(){this.fpInfo.getElements(".finder-filter-item").each(Element.remove);return this},change:function(){this.fpInfo.getElements(".finder-filter-item").length?
this.fp.show():this.fp.hide();this.fireEvent("change")}})}();
var TreeList=new Class({options:{showStep:3,container:"",checkboxName:!1,nodeClass:{clazz:"node",handle:"node-handle",first:"first-node",last:"last-node",close:"node-close",open:"node-open",hasc:"node-hasc",nl:"node-line",icon:"node-icon",name:"node-name",loading:"node-loading",cbox:"node-child-box"},remoteURL:"",remoteParamKey:"p[0]",dataMap:{PID:"parent_id",NID:"cat_id",CNAME:"cat_name",HASC:"isleaf"}},initialize:function(a){$extend(this.options,a);(this.container=$(this.options.container))&&this.initTree()},
createNode:function(a){var b=this.options,c=b.nodeClass,d=(new Element("span",{"class":c.handle})).set({pid:a.PID,nid:a.NID,hasc:a.HASC}).setHTML("&nbsp;"),f=(new Element("span",{"class":c.nl})).setHTML("&nbsp;"),g=new Element("input",{type:"checkbox",name:b.checkboxName,value:a.NID,pid:a.PID}),b=(new Element("span",{"class":c.icon})).setHTML("&nbsp;"),h=(new Element("span",{"class":c.name})).setText(a.CNAME),f=(new Element("span",{"class":c.clazz})).adopt([d,f,g,b,h]);if(a.HASC.toInt()){var e=this;
d.addClass(c.close);g.set("value",g.get("value")+"|close");d.addEvent("click",function(){var a=this.getParent("."+c.clazz);this.hasClass(c.close)?(!a.getNext()||"div"!==a.getNext().getTag()?(a=(new Element("div",{"class":c.cbox})).injectAfter(a),e.loadNodes(this.get("nid"),a),this.addClass(c.loading),g.set("value",g.get("value").toInt())):a.getNext()&&"div"==a.getNext().getTag()&&a.getNext().show(),this.removeClass(c.close)):a.getNext()&&"div"==a.getNext().getTag()&&(a.getNext().hide(),this.addClass(c.close))});
g.addEvent("click",function(){var a=this.getParent("."+c.clazz).getNext();a&&"div"==a.getTag()&&$ES("input[type=checkbox]",a).set("checked",!0==this.checked?!0:!1)})}$E("input[value="+g.get("pid")+"]",this.container)&&$E("input[value="+g.get("pid")+"]",this.container).checked&&g.set("checked",!0);return f},initTree:function(){this.loadNodes(0)},loadNodes:function(a,b){(new Request.JSON({onRequest:function(){},onSuccess:function(c){var d=this.options,f=$H(d.dataMap);$E("span[nid="+a+"]",this.container)&&
$E("span[nid="+a+"]",this.container).removeClass(d.nodeClass.loading);c.each(function(a,h){var e={};f.each(function(b,d){e[d]=a[b]});var i=this.createNode(e);0==h&&i.addClass(d.nodeClass.first);c.length==h+1&&i.addClass(d.nodeClass.last);e.HASC.toInt()&&i.addClass(d.nodeClass.hasc);this.addNode(i,b)}.bind(this))}.bind(this)})).get(this.options.remoteURL.substitute({param:this.options.remoteParamKey,value:a})+"&v="+$time())},addNode:function(a,b){b?$(a).inject(b):$(a).inject(this.container);var c=
a.getElement("input[type=checkbox]");c&&c.retrieve("check")&&c.set("checked",!0);switch(this.options.showStep){case 2:b||$E("."+this.options.nodeClass.handle,a).fireEvent("click");break;case 3:(!b||b&&!b.getParent().hasClass(this.options.nodeClass.cbox))&&$E("."+this.options.nodeClass.handle,a).fireEvent("click");break;case 4:return $E("."+this.options.nodeClass.handle,a).fireEvent("click")}},removeNode:function(){}}),GoodsCatNavTreeList=new Class({Extends:TreeList,createNode:function(a){var b=this.options;
b.navURL=b.navURL||"#";var c=b.nodeClass,d=(new Element("span",{"class":c.handle})).set({pid:a.PID,nid:a.NID,hasc:a.HASC}).setHTML("&nbsp;"),b=b.navURL.substitute({cname:a.CNAME,cid:a.NID,cnamelth:a.CNAME.getLength()}),b=b.split("filter="),b=b[0]+"filter="+encodeURIComponent(b[1]),b=(new Element("a",{"class":c.name,href:b})).setText(a.CNAME),f=(new Element("span",{"class":c.clazz})).adopt([d,b]);0==a.NID&&b.setStyle("color","red");if(a.HASC.toInt()){var g=this;d.addClass(c.close);d.addEvent("click",
function(){var a=this.getParent("."+c.clazz);this.hasClass(c.close)?(!a.getNext()||"div"!==a.getNext().getTag()?(a=(new Element("div",{"class":c.cbox})).injectAfter(a),g.loadNodes(this.get("nid"),a),this.addClass(c.loading)):a.getNext()&&"div"==a.getNext().getTag()&&a.getNext().show(),this.removeClass(c.close)):a.getNext()&&"div"==a.getNext().getTag()&&(a.getNext().hide(),this.addClass(c.close))})}return f}}),mceInstance=new Class({Implements:[Events,Options],options:{acitve:!1,maskOpacity:0.5,autoHeight:!1,
cleanup:!0,includeBase:!0},initialize:function(a,b){this.seri=a;var c="mce_body_"+a;this.el=$(c);this.setOptions(b);this.input=$E("textarea",this.el).setProperty("ishtml","true");this.frmContainer=$(c+"_frm_container");var d=this,f=this.options.includeBase,g=0,h=this.frm=(new Element("iframe",{src:"blank.html?editor",id:c+"_frm",name:c+"_frm",frameborder:0,border:0})).addEvent("load",function(){if(!g){g=1;var b=h.contentWindow,c='<base href="'+SHOPBASE+'">',c="<html><head>"+(f?c:"")+'<script>window.onerror=function(){return false;}<\/script><link rel="stylesheet" type="text/css" href=".'+
SHOPADMINDIR+'wysiwyg_editor.css"/></head><body spellcheck="false" id="'+a+'">'+(d.cleanup(d.input.getProperty("value"))||"&nbsp;")+"</body></html>";b.document.open();b.document.write(c);b.document.close();b.document.designMode="on";b=new Window(b);(new Document(b.document)).addEvent("mousedown",d.active.bind(d));d.win=b;d.doc=b.document;d.input.setAttribute("filled","true");this.removeEvent("load",arguments.callee)}});h.inject(this.frmContainer);this.input.getValue=function(){if(!this.input.getAttribute("filled"))return"textarea-unfilled";
if("textarea"==this.editType)return this.input.value;var a=this.getValue();return this.input.value=a}.bind(this);this.options.autoHeight&&this.autoHeight.call(this);$(c)&&(this.el=$(c).setStyle("visibility","visible"))},autoHeight:function(){try{this.frm.setStyle("height",this.doc.body.offsetHeight+50)}catch(a){}},setValue:function(){this.doc.body.innerHTML=this.input.value},getValue:function(){return this.cleanup(this.doc.body.innerHTML)},regexpReplace:function(a,b,c,d){if(null==a)return a;"undefined"==
typeof d&&(d="g");return a.replace(RegExp(b,d),c)},cleanup:function(a){var b=[[/<br class\="webkit-block-placeholder">/gi,"<br />"],[/<span class="Apple-style-span">(.*)<\/span>/gi,"$1"],[/ class="Apple-style-span"/gi,""],[/<span style="">/gi,""],[/^([\w\s]+.*?)<div>/i,"<p>$1</p><div>"],[/<div>(.+?)<\/div>/ig,"<p>$1</p>"]],c=[[/<em>\s*<\/em>/gi,""],[/<strong>\s*<\/strong>/gi,""],[/<br\s*\/?>/gi,"<br/>"],[/<br\/?>\s*<\/(h1|h2|h3|h4|h5|h6|li|p)/gi,"</$1"],[/<p>\s*<br\/?>\s*<\/p>/gi,"<p>\u00a0</p>"],
[/<p>(&nbsp;|\s)*<\/p>/gi,"<p>\u00a0</p>"],[/<\/p>\s*<\/p>/g,"</p>"],[/<[^> ]*/g,function(a){return a.toLowerCase()}],[/<[^>]*>/g,function(a){return a=a.replace(/ [^=]+=/g,function(a){return a.toLowerCase()})}],[/<[^>]*>/g,function(a){return a=a.replace(/( [^=]+=)([^"][^ >]*)/g,'$1"$2"')}]];c.extend([[/(<(?:img|input)[^\/>]*)>/g,"$1 />"]]);c.extend([[/<li>\s*<div>(.+?)<\/div><\/li>/g,"<li>$1</li>"],[/<span style="font-weight: bold;">(.*)<\/span>/gi,"<strong>$1</strong>"],[/<span style="font-style: italic;">(.*)<\/span>/gi,
"<em>$1</em>"],[/<b\b[^>]*>(.*?)<\/b[^>]*>/gi,"<strong>$1</strong>"],[/<i\b[^>]*>(.*?)<\/i[^>]*>/gi,"<em>$1</em>"],[/<u\b[^>]*>(.*?)<\/u[^>]*>/gi,'<span style="text-decoration: underline;">$1</span>'],[/<p>[\s\n]*(<(?:ul|ol)>.*?<\/(?:ul|ol)>)(.*?)<\/p>/ig,"$1<p>$2</p>"],[/<\/(ol|ul)>\s*(?!<(?:p|ol|ul|img).*?>)((?:<[^>]*>)?\w.*)$/g,"</$1><p>$2</p>"],[/<br[^>]*><\/p>/g,"</p>"],[/<p([^>]*)>(.*?)<\/p>(?!\n)/g,"<p$1>$2</p>\n"],[/<\/(ul|ol|p)>(?!\n)/g,"</$1>\n"],[/><li>/g,">\n\t<li>"],[/([^\n])<\/(ol|ul)>/g,
"$1\n</$2>"],[/([^\n])<img/ig,"$1\n<img"],[/^\s*$/g,""]]);Browser.Engine.webkit&&c.extend(b);c.each(function(b){a=a.replace(b[0],b[1])});return a=a.trim()},active:function(){this.actived||(this.actived=!0,this.doc.addEvent("click",function(a){this.fireEvent("docClick",new Event(a))}.bind(this)));this.fireEvent("active",this)},sleep:function(){}}),mceHandler=new Class({Implements:[Events,Options],initialize:function(a,b,c){try{this.el=$(a),$ES("img",this.el).each(function(a){new DropMenu(a)}),this.setOptions(c),
b&&(b.length?b.each(this.addInstance.bind(this)):this.addInstance.call(this,b))}catch(d){alert(d.message)}"style_init"in this&&this.style_init()},addInstance:function(a){a.addEvent("active",this.active.bind(this));a.addEvent("docClick",this.docClick.bind(this))},active:function(a){(this.inc=a)&&this.inc.sleep.call(this.inc)},docClick:function(a){this.currentEl=a.target||a.srcElement;this.fireEvent("click",a)},getRange:function(){return!this.inc?!1:this.range?this.range:window.ie?this.inc.doc.selection.createRange():
this.inc.win.getSelection()},getSelection:function(){return window.ie?this.inc.doc.selection:this.inc.win.getSelection()},getRangeText:function(){return window.ie?this.inc.doc.selection.createRange().text:this.inc.win.getSelection().toString()},exec:function(a,b){if(!this.busy&&(this.busy=!0,a&&this.inc)){this.dlg&&(window.ie&&this.range&&this.range.select(),this.dlg.hide(),this.dlg=null);switch(a){case "formatblock":this.inc.doc.execCommand("FormatBlock",!1,"<"+b+">");break;case "wrap":this.exec("insertHTML",
b[0]+this.getRangetext()+b[1]);break;case "insertHTML":window.ie&&this.getSelection().clear();if(this.replaceEl&&this.replaceEl.tagName&&!this.replaceEl.tagName.match(/body/g))try{var c=this.inc.doc.createElement("div");c.innerHTML=b;c=c.firstChild;this.replaceEl.parentNode.replaceChild(c,this.replaceEl)}catch(d){MessageBox.error(d)}finally{this.replaceEl=null}else window.ie?(this.inc.win.focus(),this.range=null,this.getRange().pasteHTML(b)):this.inc.doc.execCommand("inserthtml",!1,b);break;default:try{this.inc.doc.execCommand(a,
!1,b)}catch(f){MessageBox.error(f)}}this.busy=!1}},mklink:function(){if(this.inc){this.replaceEl=null;var a=this.currentEl,b;if("body"!=a.tagName.toLowerCase()||this.getRangeText()){if(a&&a.tagName&&"img"==a.tagName.toLowerCase())return MessageBox.error("\u5bf9\u4e0d\u8d77,\u76ee\u524d\u4e0d\u652f\u6301\u5bf9\u5df2\u63d2\u5165\u56fe\u7247\u589e\u52a0\u8d85\u8fde\u63a5.");a&&a.tagName&&"a"==a.tagName.toLowerCase()?(b={text:this.currentEl.innerHTML,href:this.currentEl.href,alt:this.currentEl.alt,title:this.currentEl.title,
target:this.currentEl.target},this.replaceEl=a):b={text:this.getRangeText()};this.dialog("link",{height:null,width:450,ajaxoptions:{method:"post",data:b}})}}},editHTML:function(){var a=this;if(this.inc){var b=$("mce_handle_htmledit_"+this.inc.seri),c=$("mce_handle_"+this.inc.seri);this.inc.input.getValue();b.show();c.hide();this.inc.frm.getSize();this.inc.input.show();this.inc.frmContainer.hide();b.getElement(".returnwyswyg").addEvent("click",function(){c.show();b.hide();a.inc.doc.body.innerHTML=
a.inc.input.value.clean().trim();a.inc.input.hide();a.inc.frmContainer.show();a.inc.editType="wysiwyg";this.removeEvent("click",arguments.callee)});this.inc.editType="textarea"}},dialog:function(a,b){this.inc&&(this.inc.win.focus(),this.range=null,this.range=this.getRange(),b=$cleanNull(b),this.dlg=new Dialog("index.php?ctl=editor&act="+a,$merge(b,{modal:!0})),window.curEditor=this)},queryValue:function(a,b){"align"==a&&(a="justifyRight");try{return b?this.inc.doc.queryCommandState(a):this.inc.doc.queryCommandValue(a)}catch(c){}},
queryValues:function(){for(var a={},b="Bold Italic Underline strikeThrough subscript superscript insertOrderedList insertUnorderedList".split(" "),c=0;c<arguments.length;c++)a[arguments[c]]=this.queryValue(arguments[c],b.contains(arguments[c]));return a}}),editor_style_1=new Abstract({style_init:function(){this.mce_handle=this.el;this.addEvent("click",this.status.bind(this));this.addEvent("click",function(){if(!this.$init){this.mce_handle.setOpacity(1);"&nbsp;"==this.inc.doc.body.innerHTML.substr(0,
6)&&(this.inc.doc.body.innerHTML=this.inc.doc.body.innerHTML.slice(6));var a=this;$ES("img",this.mce_handle).addEvent("click",function(){this.inc.win.focus()}.bind(this));$E(".ft_select",this.mce_handle).addEvent("change",function(){var b=this.getValue();if(b){window.ie&&a.range&&a.range.select();a.set("fontName",b)}});$E(".fs_select",this.mce_handle).addEvent("change",function(){var b=this.getValue();if(b){window.ie&&a.range&&a.range.select();a.set("fontSize",b)}});$$($E(".fontColorPicker",this.el),
$E(".fontBGColorPicker",this.el),$E(".ft_select",this.mce_handle),$E(".fs_select",this.mce_handle)).addEvent("click",function(){this.range=null;if(window.ie&&this.getSelection().type.toLowerCase()!="none")this.range=this.getRange();if(!window.ie)this.range=this.getRange()}.bind(this));new GoogColorPicker($E(".fontColorPicker",this.el),{onSelect:function(a){window.ie&&this.range&&this.range.select();this.set("forecolor",a)}.bind(this),onShow:function(){window.ie&&this.range&&this.range.select()}.bind(this)});
new GoogColorPicker($E(".fontBGColorPicker",this.el),{onSelect:function(a){if(window.ie){this.range&&this.range.select();return this.set("backColor",a)}this.set("hilitecolor",a)}.bind(this),onShow:function(){window.ie&&this.range&&this.range.select()}.bind(this)})}this.$init=!0}.bind(this));this.styler=$ES(".x-section",this.el);this.stylerEl=$ES(".x-style",this.el);this.align=$ES(".x-align",this.el);this.setting=$ES(".x-enable",this.el)},status:function(a){new Event(a);this.target||(this.target=a.target.getElementsByTagName("body")[0]||
a.target);a=this.target.style;"transparent"==a["background-color"]&&(a["background-color"]="#fff");this.styler.setStyle("background-color","transparent"==a["background-color"]?"#fff":a["background-color"]);this.stylerEl.setStyle("color",a.color);var b=this.queryValues("Bold","Italic","Underline","strikeThrough","subscript","superscript","align","CreateLink","FontName","FontSize","ForeColor","FormatBlock","insertOrderedList","insertUnorderedList");"center"==b.align?(this.align[0].parentNode.className=
"",this.align[1].parentNode.className="in",this.align[2].parentNode.className=""):"right"==b.align?(this.align[0].parentNode.className="",this.align[1].parentNode.className="",this.align[2].parentNode.className="in"):(this.align[0].parentNode.className="left"==b.align?"in":"",this.align[1].parentNode.className="",this.align[2].parentNode.className="");this.setting.each(function(a){a.parentNode.className=b[a.getAttribute("value")]?"in":""})},set:function(a,b){if(this.inc&&this.inc.win){window.ie&&
this.inc.win.focus();this.exec(a,b);try{this.status.call(this)}catch(c){}}}});window.onerror=function(){MODALPANEL&&MODALPANEL.hide()};if(!Setting)var Setting={};Setting.get=function(a,b){return b};var workgroundMarginX=function(){return $("workground").getStyle("margin-left").toInt()+$("workground").getStyle("margin-right").toInt()};
function updateSize(){var a=window.mainHeight=window.getSize().y-$("header").getSize().y,b=window.mainWidth=$("header").getSize().x-(isNaN(workgroundMarginX())?0:workgroundMarginX());window.mainH=a-$("headBar").offsetHeight-$("footBar").offsetHeight;b=b.limit(1004-(isNaN(workgroundMarginX())?0:workgroundMarginX()),1E4);$("main").setStyles({width:b,height:mainH});$("footBar").setStyle("width",b);$("headBar").setStyle("width",b);(fh=$E("#headBar .finder-header"))&&fh.setStyle("width",b);$("sidecontent").setStyle("height",
a);$("leftToggler").setStyle("height",a)}var W,task,getW=function(){return W&&"object"==$type(W)?W:new ShopEx_AdminXHR};function showSide(){$(document.body).removeClass("closeLeft");updateSize()}function closeSide(){$(document.body).addClass("closeLeft");updateSize()}
window.addEvent("domready",function(){$("leftToggler").addEvents({click:function(a){new Event(a);window.setSidePanel=!0;$(document.body).hasClass("closeLeft")?showSide():closeSide()}});makeAjaksLink(document.body);W=getW();(new Ajax("index.php?ctl=dashboard&act=getcertInfo",{data:"t="+(new Date).getTime(),update:"CertificateInfo"})).request();new DropMenu("msgRunner");window.addEvent("resize",updateSize)});var extra_validator=[];function __(){}
function toggleNode(a){var a=new Event(a),b=$(a.target);if("IMG"==b.tagName){var c=$(b.get("toggle"));if(c)"none"==c.style.display?(b.removeClass("x-tnode-close"),c.show()):(b.addClass("x-tnode-close"),c.hide()),a.stop();else if(a=b.get("tree")){b.removeClass("x-tnode-close");var c=b.getParent().get("tid"),d=b.parentNode.parentNode.id+"_"+c,f=(new Element("div",{id:d,"class":"cateloadingbox"})).injectAfter(b.parentNode),g=(new Element("div")).setText("loading...").setStyle("padding-left",b.parentNode.getStyle("padding-left").toInt()+
20);f.adopt(g);b.set("toggle",d);(new Ajax("index.php?ctl=default&act=tnode&p[0]="+a+"&p[1]="+c+"&p[2]="+b.parentNode.get("depth"),{method:"get",update:d,onComplete:function(){makeAjaksLink(d)}})).request()}}}
window.setTab=function(a,b){var c=$("_"+a).getAttribute("url");c&&!$(a).getAttribute("url")&&(W.page(c,{update:a}),$(a).setAttribute("url",c));$(a).style.display="";$("_"+a).addClass("t-handle-current");$("_"+a).removeClass("t-handle");b.each(function(a){$(a).style.display="none";$("_"+a).addClass("t-handle");$("_"+a).removeClass("t-handle-current")})};
$E("#header .user_guide").addEvent("click",function(){var a=this,b;(new Request({method:"post",onComplete:function(c){b=c;var d=a.retrieve("step",b),f=(new Element("iframe",{width:710,height:520,src:d,frameborder:0,scrolling:"no",id:"user_guide_iframe",styles:{border:"none",margin:0}})).addEvent("load",function(){}),c=new Dialog(f,{title:"ShopEx\u4f7f\u7528\u5411\u5bfc",height:570,ajaksable:!1,onLoad:function(){window.gecko||f.set("src",d)},onClose:function(){(new Element("div",{styles:{background:"#66CCFF",
position:"absolute",overflow:"hidden",zIndex:65535,opacity:0.3,border:"2px #333 dashed"}})).inject(document.body).setStyles(this.dialog.getCis()).effects({duration:800,fps:90}).start(a.getCis()).chain(function(){this.element.remove();a.retrieve("goUrl")&&W.page(a.retrieve("goUrl"));a.store("goUrl",!1)})}});a.store("dialog",c)}})).post("index.php?ctl=default&act=getcertidandurl")});
window.addEvent("load",function(){$E(".container").setStyle("visibility","visible");if(!Browser.Plugins.Flash.version||9>Browser.Plugins.Flash.version){var a;a=Browser.Plugins.Flash.version?"\u5f53\u524d\u7684Flash Player \u7248\u672c:<strong>"+Browser.Plugins.Flash.version+"."+Browser.Plugins.Flash.build+"</strong>":"<strong>\u672a\u5b89\u88c5Flash player \u63d2\u4ef6.</strong>";new Dialog((new Element("div")).setHTML("<h3 class='error'>",a,"<br/><br/>\u53ef\u80fd\u4f1a\u5f71\u54cd\u5230\u6b63\u5e38\u4f7f\u7528.\u4f60\u662f\u5426\u8981\u624b\u52a8\u5347\u7ea7\u5b89\u88c5?</h3>",
"<a href='http://www.macromedia.com/go/getflashplayer' class='sysiconBtnNoIcon'><strong>\u662f</strong>,\u6211\u8981\u53bb\u4e0b\u8f7d\u5347\u7ea7\u5305</a>","<span isCloseDialogBtn='true' class='sysiconBtnNoIcon'><strong>\u5426</strong>,\u6211\u4e0d\u60f3\u5347\u7ea7</span>"),{title:"Flash Player \u53ef\u80fd\u4f1a\u5f15\u8d77\u95ee\u9898.",resizeable:!1,width:450,height:150})}!DEBUG_JS&&$("_firebugConsole")&&function(){new Dialog((new Element("div")).setHTML("<h3 class='error'>\u5728\u5df2\u77e5\u60c5\u51b5\u4e0b\uff0c\u9664\u975e\u6b63\u786e\u914d\u7f6e Firebug\uff0c\u5426\u5219\u5b83\u4f1a\u4f7f ShopEx\u540e\u53f0 \u8fd0\u884c\u7f13\u6162</h3><span class='lnk' isCloseDialogBtn='true'>\u6211\u77e5\u9053\u4e86!</span>"),
{title:"FireBug \u4f7f\u7a0b\u5e8f\u53d8\u6162.",resizeable:!1,width:450,height:150})}.delay(5E3)});
window.addEvent("domready",function(){try{window.Xtip=new Tips($("shop_title_block"),{className:"x-tip"});$("shop_title_block").store("tip:title","\u7f51\u5e97\u540d\u79f0:-(\u70b9\u51fb\u8fdb\u884c\u8bbe\u7f6e)");$("shop_title_block").store("tip:text",$("shop_title_block").subText(25));setInterval("if($('elTempBox')&&$('elTempBox').getElements('*').length)$('elTempBox').empty()",12E4);var a,b=[];a=window.ie?document.body:window;a.focus();a.addEvent("keydown",function(c){27==c.code&&($E(".finder-search-input")&&
$E(".finder-search-input").blur(),a.focus());if(!["INPUT","TEXTAREA"].contains(c.target.tagName)){if(c.shift&&191==c.code)return new Dialog("shortcut_key_help.html",{title:"\u5feb\u6377\u952e",ajaksable:!1,width:0.7*window.getSize().x,height:0.7*window.getSize().y});var f=new Hash({t49:"top-tab-goods",t50:"top-tab-order",t51:"top-tab-member",t52:"top-tab-sale",t53:"top-tab-site",t54:"top-tab-analytics"}),g="t"+c.code;if(c.alt&&f.getKeys().contains(g))return $(f[g]).fireEvent("click",{stop:$empty});
switch(c.code){case 27:f=$$(".dialog");if(f.length)return f.getLast().retrieve("instance").close();if(MODALPANEL.isDisplay())return MODALPANEL.hide();for(cf in finderGroup)return finderGroup[cf].detail.fireEvent("slideOut");break;case 82:if(c.control)return;f=historyManager.getHash();W.page("index.php?"+(f?f:"ctl=dashboard&act=index"));break;case 85:$(document.body).toggleClass("closeLeft");updateSize();break;case 191:return c.stop(),$E(".finder-search-input")?$E(".finder-search-input").focus():!1;
case 72:return $E("#header .user_guide").fireEvent("click",{stop:$empty})}b.push(c.code);-1<b.toString().indexOf("38,38,40,40,37,37,39,39,66,65")&&(new Dialog("google_gears.html",{title:"\u5229\u7528Gears\u52a0\u901fShopEx\u540e\u53f0",ajaksable:!1}),b=[])}})}catch(c){alert(c)}});
(function(){if(!window.google||!google.gears){var a=null;if("undefined"!=typeof GearsFactory)a=new GearsFactory;else try{a=new ActiveXObject("Gears.Factory"),-1!=a.getBuildInfo().indexOf("ie_mobile")&&a.privateSetGlobalObject(this)}catch(b){"undefined"!=typeof navigator.mimeTypes&&navigator.mimeTypes["application/x-googlegears"]&&(a=document.createElement("object"),a.style.display="none",a.width=0,a.height=0,a.type="application/x-googlegears",document.documentElement.appendChild(a))}a&&(window.google||
(google={}),google.gears||(google.gears={factory:a}))}})();
void function(){if(window.google&&google.gears){var a=$E("#header .top-link-menu").setStyle("width",320).getElement(".gearsIco").show();a.store("tip:text","\u5f53\u524d\u6d4f\u89c8\u5668\u652f\u6301<b>Gears</b><sup>Powered By Google</sup><br/><br/><b>Gears</b>\u53ef\u4ee5\u540c\u6b65\u8fdc\u7a0b\u8d44\u6e90\u5230\u672c\u5730\uff0c\u4f7f\u7a0b\u5e8f\u52a0\u8f7d\u8fd0\u884c\u66f4\u8fc5\u901f\u3002");new Tips(a,{className:"x-tip"});a.addEvent("click",function(a){a.stop();new Dialog("google_gears.html",
{title:"\u5229\u7528Gears\u52a0\u901fShopEx\u540e\u53f0",ajaksable:!1})})}}();