/*
V.08052201
A.Zed Gu
D.JEND Core
Copyright (c) 2008, Eachnet All rights reserved.
*/
var JEND={};JEND.userAgent=navigator.userAgent.toLowerCase();JEND.lang={require:function(pURL){return typeof(pURL)=='string'?this.load(pURL,true):false;},load:function(pURL,pRequire){if(document.getElementById(pURL.formatToDSSID())){if(pRequire){document.documentElement.childNodes[0].removeChild(document.getElementById(pURL.formatToDSSID()));}else{document.body.removeChild(document.getElementById(pURL.formatToDSSID()));}}var newDOM=JEND.DOM.create('script',{src:pURL,id:pURL.formatToDSSID()});if(pRequire){document.documentElement.childNodes[0].appendChild(newDOM);}else{document.body.appendChild(newDOM);}return newDOM;},browser:{version:(JEND.userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(JEND.userAgent),opera:/opera/.test(JEND.userAgent),ie:/msie/.test(JEND.userAgent)&& !/opera/.test(JEND.userAgent),moz:/mozilla/.test(JEND.userAgent)&& !/(compatible|webkit)/.test(JEND.userAgent)},param:function(p){var a=[];for(var i in p){a.push(encodeURIComponent(i)+"="+encodeURIComponent(p[i]));}return a.join("&").replace(/%20/g,"+");},extend:function(){var extendObject=arguments[0]||{};var len=arguments.length;if(len==1){extendObject=this;}for(var i=0;i<len;i++){var fns=arguments[i];if(fns!=null){if(extendObject==fns){continue;}for(var f in fns){if(fns!=undefined){extendObject[f]=fns[f];}}}}return extendObject;}};JEND.extend=JEND.lang.extend;JEND.getDOM=function(selector){if(window==this)return new JEND.getDOM(selector);if(selector.nodeType){this[0]=selector;this.length=1;return this;}else if(typeof selector=='string'){var dom=document.getElementById(selector);if(dom){this[0]=dom;this.length=1;return this;}}};JEND.getDOM.fn=JEND.getDOM.prototype;if(!window.$){window.$=JEND.getDOM;}JEND.getDOM.fn.each=function(method){for(var i=0,l=this.length;i<l;i++){method.call(this[i],i);}};JEND.extend(JEND.getDOM.prototype,{getChildren:function(){var a=[];for(var i=0;i<this[0].childNodes.length;i++){if(this[0].childNodes[i].nodeType==1){a.push(this[0].childNodes[i]);}}return a;}});JEND.extend(String.prototype,{int:function(){return parseInt(this,10);},formatToDSS:function(){var m=this.match(/^http(?:s)?:\/\/([^:\/]*)(:\d+)?([^\?]*)/);var _var='';if(m[1].match(/^[\d\.]*$/)){_var='/ip/'+m[1];}else{var host=m[1].split('.');for(var i=host.length;i>0;i--){_var+='/'+host[i-1];}}if(m[2]){_var+='/'+m[2];}return _var+m[3];},formatToDSSID:function(){return this.formatToDSS().replace(/\//g,'_');}});JEND.extend(Number.prototype,{px:function(){return this+"px";},int:function(){return parseInt(this,10);}});JEND.DOM={create:function(pTagName,pTagP){var dom=document.createElement(pTagName);if(typeof(pTagP)=='object'){for(var property in pTagP){dom[property]=pTagP[property];}}return dom;}};JEND.EVENT={on:function(pElement,pEventName,pEventAction){if(JEND.lang.browser.ie){if(pEventName=='load'&&pElement!=window){pEventName='readystatechange';var loded=function(){JEND.EVENT.doReadyState(pElement,'loaded',pEventAction);};pElement.attachEvent('on'+pEventName,loded);}else{pElement.attachEvent('on'+pEventName,pEventAction);}}else{pElement.addEventListener(pEventName,pEventAction,false);}},doReadyState:function(pElement,pState,pEventAction){if(pElement.readyState==pState){pEventAction();}}};JEND.DSS={get:function(pSrc,pCallback,pP,pRequire){var o=this.mapObject(pSrc.formatToDSS());var f=function(){if(pCallback){pCallback(o.$);}};if(pP){pSrc+=(pSrc.match(/\?/)?"&":"?")+JEND.lang.param(pP);}if(pRequire){JEND.EVENT.on(JEND.lang.require(pSrc),'load',f);}else{var a=function(){JEND.EVENT.on(JEND.lang.load(pSrc),'load',f);};if(document.body){a();}else{JEND.EVENT.on(window,'load',a);}}},load:function(pSrc){var f=function(){JEND.lang.load(pSrc)};JEND.EVENT.on(window,'load',f);},mapObject:function(p){var s=p.split('/');var mapObject={};var o=function(pO,pS,pI){if(pI<pS.length){if(!pO[pS[pI]]){pO[pS[pI]]={};}mapObject=pO[pS[pI]];o(pO[pS[pI]],pS,pI+1);}};o(window,s,1);return mapObject;}};