
var Config={LOVES91:false,SHOWME:true,BASEPATH:(((matches=window.location.pathname.match(/^.*\/web/))!=null)?matches[0]:'')+lang,ROOTPATH:(((matches=window.location.pathname.match(/^.*\/web/))!=null)?matches[0]:''),HOMESITE:((matches=window.location.href.match(/^\w+:\/\/[^\/:]+(:\d*)?/))!=null)?matches[0]:'',VIEWATTSCRIPT:'view.php',DOWNLOADATTSCRIPT:'download.php',PROCESS_TYPE_PROCESS:10,PROCESS_TYPE_PROJECT:20,DEFAULTDOMAIN:'',GMAPJS_URL:'',MAX_UPLOADED_FILE_SIZE:41971520,UPLOAD_PHOTO_TYPE:[".jpg",".jpeg",".png",".gif",".bmp",".emf",".dib",".jfif",".tif",".tiff",".wmf"],UPLOAD_VIDEO_TYPE:[".wmv",".avi",".flv",".mpg",".mpeg",".3gp",".mov"],UPLOAD_DOCUMENT_TYPE:[".*"],UPLOAD_ATTACHMENT_TYPE:[".*"],REQUIRE_FLASH_MAJOR_VERSION:8,REQUIRE_FLASH_MINOR_VERSION:0,REQUIRE_FLASH_REVISION:0}
Config.PORTLETICONPATH=Config.BASEPATH+'/portal/images/portleticon/';Config.SCRIPTBASEPATH=Config.HOMESITE+Config.BASEPATH;Config.SCRIPTROOTPATH=Config.HOMESITE+Config.ROOTPATH;Config.IMAGEBAEPATH=Config.HOMESITE+Config.BASEPATH;Config.ICONBASEPATH=Config.HOMESITE+Config.BASEPATH;var Post={TYPE_BLOG:1,TYPE_RSS:2,TYPE_ALBUM:3,TYPE_WEBDOC:4,TYPE_NODE:5,TYPE_RECORD:6,TYPE_BBSMSG:7,TYPE_VIDEO:8,TypeNames:['無效的類型','文章','RSS','相簿','文檔','節點','記錄','訊息','短片'],ElementNames:['無效的類型','附件','無效的類型','相片','文檔','無效的類型','無效的類型','無效的類型','無效的類型'],getTypeName:function(n){return Post.TypeNames[n];},getElementName:function(n){if(n.constructor==Number){return Post.ElementNames[n];}
return'';},STATUS_DRAFT:1,STATUS_PUBLISHED:2,STATUS_INWF:3,fileExtCheck:function(posttype,ext){switch(posttype){case Post.TYPE_BLOG:return true;case Post.TYPE_ALBUM:var types=Config.UPLOAD_PHOTO_TYPE;if(ext.charAt(0)!=".")ext="."+ext;return indexOf(types,ext.toLowerCase())>=0;case Post.TYPE_WEBDOC:return true;case Post.TYPE_VIDEO:var types=Config.UPLOAD_VIDEO_TYPE;if(ext.charAt(0)!=".")ext="."+ext;return indexOf(types,ext.toLowerCase())>=0;default:throw Error("Type check for "+posttype+" is not supported");}},ALBUM_RESIZE_CHOOSE:["1280x1024","1024x768","800x600","600x450","400x300","200x150"],ALBUM_ROTATE_CHOOSE:{"順時針 90 度":-90,"順時針 180 度":180,"反時針 90 度":90}};var SPost={TYPE_HTML:1,TYPE_SCHEMA:3,TYPE_XLIST:4,TYPE_SYSTEM_SCHEMA:5,TYPE_SURVEY:6};var Schema={RECORD_AS_BLOCK:1,RECORD_AS_ROW:2,RECORD_CUSTOM:3,STATUS_OUTSTANDING:10,STATUS_SUBMITTED:20,STATUS_FINISHED:30};var Tag={TYPE_PEOPLE:1,TYPE_GROUP:2,TYPE_POST:3,TYPE_RSS:4,TYPE_FAVORITE:5,TYPE_ALBUM:6,TYPE_WEBDOC:7,TYPE_BBSMSG:8,TYPE_RECORD:9,TYPE_NODE:10,TYPE_VIDEO:11,lookupTable:null,getTagType4Post:function(postType){if(!Tag.lookupTable){Tag.lookupTable={};Tag.lookupTable[Post.TYPE_ALBUM]=Tag.TYPE_ALBUM;Tag.lookupTable[Post.TYPE_WEBDOC]=Tag.TYPE_WEBDOC;Tag.lookupTable[Post.TYPE_BLOG]=Tag.TYPE_POST;Tag.lookupTable[Post.TYPE_RSS]=Tag.TYPE_RSS;Tag.lookupTable[Post.TYPE_RECORD]=Tag.TYPE_RECORD;Tag.lookupTable[Post.TYPE_NODE]=Tag.TYPE_NODE;Tag.lookupTable[Post.TYPE_BBSMSG]=Tag.TYPE_BBSMSG;Tag.lookupTable[Post.TYPE_VIDEO]=Tag.TYPE_VIDEO;}
return Tag.lookupTable[postType];}};var Set={TYPE_NORMAL:1,TYPE_STICKY:2,TYPE_STICKY_SYSTEM:3,TYPE_BOOK:4,TYPE_BBS:9};var NS=function(s){this.name=s;};NS.register=function(ns){var a=window;var ws=ns.split('.');var s="";for(var i in ws){s+=(s?".":"")+ws[i];if(!a[ws[i]]){a[ws[i]]=new NS(s);}
a=a[ws[i]];}};NS.prototype={toString:function(){var subs=[];for(var i in this){if(typeof this[i]=="object"&&this[i].constructor==NS){subs.push(this[i]);}
else if(typeof this[i]=="function"&&getClassName(this[i])){subs.push(getClassName(this[i]).replace(this.name+".",""));}}
return this.name+": {"+subs.join(", ")+"}";},add:function(s){if(!this[s]){this[s]=new NS(this.name+"."+s);}
return this[s];},constructor:window.NS};var Iqube=new NS("Iqube");Iqube.add("Post");Iqube.add("Admin");Iqube.add("Share");Iqube.add("Form");Iqube.add("Set");Iqube.add("Util");Iqube.add("Pref");Iqube.add("Group");Iqube.add("Comment");Iqube.add("SPost");Iqube.add("Process");Iqube.add("Portal");Iqube.add("Alias");Iqube.add("Tag");Iqube.add("Mms");var Custom=new NS("Custom");if(typeof YAHOO=="undefined"){var YAHOO={};}
YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;i=i+1){d=a[i].split(".");o=YAHOO;for(j=(d[0]=="YAHOO")?1:0;j<d.length;j=j+1){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}
return o;};YAHOO.log=function(msg,cat,src){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(msg,cat,src);}else{return false;}};YAHOO.init=function(){this.namespace("util","widget","example");if(typeof YAHOO_config!="undefined"){var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i;if(l){for(i=0;i<ls.length;i=i+1){if(ls[i]==l){unique=false;break;}}
if(unique){ls.push(l);}}}};YAHOO.register=function(name,mainClass,data){var mods=YAHOO.env.modules;if(!mods[name]){mods[name]={versions:[],builds:[]};}
var m=mods[name],v=data.version,b=data.build,ls=YAHOO.env.listeners;m.name=name;m.version=v;m.build=b;m.versions.push(v);m.builds.push(b);m.mainClass=mainClass;for(var i=0;i<ls.length;i=i+1){ls[i](m);}
if(mainClass){mainClass.VERSION=v;mainClass.BUILD=b;}else{YAHOO.log("mainClass is undefined for module "+name,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[],getVersion:function(name){return YAHOO.env.modules[name]||null;}};YAHOO.lang={isArray:function(obj){if(obj&&obj.constructor&&obj.constructor.toString().indexOf('Array')>-1){return true;}else{return YAHOO.lang.isObject(obj)&&obj.constructor==Array;}},isBoolean:function(obj){return typeof obj=='boolean';},isFunction:function(obj){return typeof obj=='function';},isNull:function(obj){return obj===null;},isNumber:function(obj){return typeof obj=='number'&&isFinite(obj);},isObject:function(obj){return obj&&(typeof obj=='object'||YAHOO.lang.isFunction(obj));},isString:function(obj){return typeof obj=='string';},isUndefined:function(obj){return typeof obj=='undefined';},hasOwnProperty:function(obj,prop){if(Object.prototype.hasOwnProperty){return obj.hasOwnProperty(prop);}
return!YAHOO.lang.isUndefined(obj[prop])&&obj.constructor.prototype[prop]!==obj[prop];},extend:function(subc,superc,overrides){if(!superc||!subc){throw new Error("YAHOO.lang.extend failed, please check that "+"all dependencies are included.");}
var F=function(){};F.prototype=superc.prototype;subc.prototype=new F();subc.prototype.constructor=subc;subc.superclass=superc.prototype;if(superc.prototype.constructor==Object.prototype.constructor){superc.prototype.constructor=superc;}
if(overrides){for(var i in overrides){subc.prototype[i]=overrides[i];}}},augment:function(r,s){if(!s||!r){throw new Error("YAHOO.lang.augment failed, please check that "+"all dependencies are included.");}
var rp=r.prototype,sp=s.prototype,a=arguments,i,p;if(a[2]){for(i=2;i<a.length;i=i+1){rp[a[i]]=sp[a[i]];}}else{for(p in sp){if(!rp[p]){rp[p]=sp[p];}}}}};YAHOO.init();YAHOO.util.Lang=YAHOO.lang;YAHOO.augment=YAHOO.lang.augment;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.2.2",build:"204"});(function(){var Y=YAHOO.util,getStyle,setStyle,id_counter=0,propertyCache={};var ua=navigator.userAgent.toLowerCase(),isOpera=(ua.indexOf('opera')>-1),isSafari=(ua.indexOf('safari')>-1),isGecko=(!isOpera&&!isSafari&&ua.indexOf('gecko')>-1),isIE=(!isOpera&&ua.indexOf('msie')>-1);var patterns={HYPHEN:/(-[a-z])/i,ROOT_TAG:/body|html/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;}
if(propertyCache[property]){return propertyCache[property];}
var converted=property;while(patterns.HYPHEN.exec(converted)){converted=converted.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}
propertyCache[property]=converted;return converted;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;if(property=='float'){property='cssFloat';}
var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];}
return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}}
return val/100;break;case'float':property='styleFloat';default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};}
if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(YAHOO.lang.isString(el.style.filter)){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}
break;case'float':property='styleFloat';default:el.style[property]=val;}};}else{setStyle=function(el,property,val){if(property=='float'){property='cssFloat';}
el.style[property]=val;};}
YAHOO.util.Dom={get:function(el){if(YAHOO.lang.isString(el)){return document.getElementById(el);}
if(YAHOO.lang.isArray(el)){var c=[];for(var i=0,len=el.length;i<len;++i){c[c.length]=Y.Dom.get(el[i]);}
return c;}
if(el){return el;}
return null;},getStyle:function(el,property){property=toCamel(property);var f=function(element){return getStyle(element,property);};return Y.Dom.batch(el,f,Y.Dom,true);},setStyle:function(el,property,val){property=toCamel(property);var f=function(element){setStyle(element,property,val);};Y.Dom.batch(el,f,Y.Dom,true);},getXY:function(el){var f=function(el){if((el.parentNode===null||el.offsetParent===null||this.getStyle(el,'display')=='none')&&el!=document.body){return false;}
var parentNode=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var doc=document;if(!this.inDocument(el)&&parent.document!=document){doc=parent.document;if(!this.isAncestor(doc.documentElement,el)){return false;}}
var scrollTop=Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);var scrollLeft=Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);return[box.left+scrollLeft,box.top+scrollTop];}
else{pos=[el.offsetLeft,el.offsetTop];parentNode=el.offsetParent;var hasAbs=this.getStyle(el,'position')=='absolute';if(parentNode!=el){while(parentNode){pos[0]+=parentNode.offsetLeft;pos[1]+=parentNode.offsetTop;if(isSafari&&!hasAbs&&this.getStyle(parentNode,'position')=='absolute'){hasAbs=true;}
parentNode=parentNode.offsetParent;}}
if(isSafari&&hasAbs){pos[0]-=document.body.offsetLeft;pos[1]-=document.body.offsetTop;}}
parentNode=el.parentNode;while(parentNode.tagName&&!patterns.ROOT_TAG.test(parentNode.tagName))
{if(Y.Dom.getStyle(parentNode,'display')!='inline'){pos[0]-=parentNode.scrollLeft;pos[1]-=parentNode.scrollTop;}
parentNode=parentNode.parentNode;}
return pos;};return Y.Dom.batch(el,f,Y.Dom,true);},getX:function(el){var f=function(el){return Y.Dom.getXY(el)[0];};return Y.Dom.batch(el,f,Y.Dom,true);},getY:function(el){var f=function(el){return Y.Dom.getXY(el)[1];};return Y.Dom.batch(el,f,Y.Dom,true);},setXY:function(el,pos,noRetry){var f=function(el){var style_pos=this.getStyle(el,'position');if(style_pos=='static'){this.setStyle(el,'position','relative');style_pos='relative';}
var pageXY=this.getXY(el);if(pageXY===false){return false;}
var delta=[parseInt(this.getStyle(el,'left'),10),parseInt(this.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=(style_pos=='relative')?0:el.offsetLeft;}
if(isNaN(delta[1])){delta[1]=(style_pos=='relative')?0:el.offsetTop;}
if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';}
if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';}
if(!noRetry){var newXY=this.getXY(el);if((pos[0]!==null&&newXY[0]!=pos[0])||(pos[1]!==null&&newXY[1]!=pos[1])){this.setXY(el,pos,true);}}};Y.Dom.batch(el,f,Y.Dom,true);},setX:function(el,x){Y.Dom.setXY(el,[x,null]);},setY:function(el,y){Y.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){var region=new Y.Region.getRegion(el);return region;};return Y.Dom.batch(el,f,Y.Dom,true);},getClientWidth:function(){return Y.Dom.getViewportWidth();},getClientHeight:function(){return Y.Dom.getViewportHeight();},getElementsByClassName:function(className,tag,root){var method=function(el){return Y.Dom.hasClass(el,className);};return Y.Dom.getElementsBy(method,tag,root);},hasClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)');var f=function(el){return re.test(el.className);};return Y.Dom.batch(el,f,Y.Dom,true);},addClass:function(el,className){var f=function(el){if(this.hasClass(el,className)){return;}
el.className=[el.className,className].join(' ');};Y.Dom.batch(el,f,Y.Dom,true);},removeClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,className)){return;}
var c=el.className;el.className=c.replace(re,' ');if(this.hasClass(el,className)){this.removeClass(el,className);}};Y.Dom.batch(el,f,Y.Dom,true);},replaceClass:function(el,oldClassName,newClassName){if(oldClassName===newClassName){return false;}
var re=new RegExp('(?:^|\\s+)'+oldClassName+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,oldClassName)){this.addClass(el,newClassName);return;}
el.className=el.className.replace(re,' '+newClassName+' ');if(this.hasClass(el,oldClassName)){this.replaceClass(el,oldClassName,newClassName);}};Y.Dom.batch(el,f,Y.Dom,true);},generateId:function(el,prefix){prefix=prefix||'yui-gen';el=el||{};var f=function(el){if(el){el=Y.Dom.get(el);}else{el={};}
if(!el.id){el.id=prefix+id_counter++;}
return el.id;};return Y.Dom.batch(el,f,Y.Dom,true);},isAncestor:function(haystack,needle){haystack=Y.Dom.get(haystack);if(!haystack||!needle){return false;}
var f=function(needle){if(haystack.contains&&!isSafari){return haystack.contains(needle);}
else if(haystack.compareDocumentPosition){return!!(haystack.compareDocumentPosition(needle)&16);}
else{var parent=needle.parentNode;while(parent){if(parent==haystack){return true;}
else if(!parent.tagName||parent.tagName.toUpperCase()=='HTML'){return false;}
parent=parent.parentNode;}
return false;}};return Y.Dom.batch(needle,f,Y.Dom,true);},inDocument:function(el){var f=function(el){return this.isAncestor(document.documentElement,el);};return Y.Dom.batch(el,f,Y.Dom,true);},getElementsBy:function(method,tag,root){tag=tag||'*';var nodes=[];if(root){root=Y.Dom.get(root);if(!root){return nodes;}}else{root=document;}
var elements=root.getElementsByTagName(tag);if(!elements.length&&(tag=='*'&&root.all)){elements=root.all;}
for(var i=0,len=elements.length;i<len;++i){if(method(elements[i])){nodes[nodes.length]=elements[i];}}
return nodes;},batch:function(el,method,o,override){var id=el;el=Y.Dom.get(el);var scope=(override)?o:window;if(!el||el.tagName||!el.length){if(!el){return false;}
return method.call(scope,el,o);}
var collection=[];for(var i=0,len=el.length;i<len;++i){if(!el[i]){id=el[i];}
collection[collection.length]=method.call(scope,el[i],o);}
return collection;},getDocumentHeight:function(){var scrollHeight=(document.compatMode!='CSS1Compat')?document.body.scrollHeight:document.documentElement.scrollHeight;var h=Math.max(scrollHeight,Y.Dom.getViewportHeight());return h;},getDocumentWidth:function(){var scrollWidth=(document.compatMode!='CSS1Compat')?document.body.scrollWidth:document.documentElement.scrollWidth;var w=Math.max(scrollWidth,Y.Dom.getViewportWidth());return w;},getViewportHeight:function(){var height=self.innerHeight;var mode=document.compatMode;if((mode||isIE)&&!isOpera){height=(mode=='CSS1Compat')?document.documentElement.clientHeight:document.body.clientHeight;}
return height;},getViewportWidth:function(){var width=self.innerWidth;var mode=document.compatMode;if(mode||isIE){width=(mode=='CSS1Compat')?document.documentElement.clientWidth:document.body.clientWidth;}
return width;}};})();YAHOO.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};YAHOO.util.Region.prototype.contains=function(region){return(region.left>=this.left&&region.right<=this.right&&region.top>=this.top&&region.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}
this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.2.2",build:"204"});YAHOO.util.CustomEvent=function(type,oScope,silent,signature){this.type=type;this.scope=oScope||window;this.silent=silent;this.signature=signature||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}
var onsubscribeType="_YUICEOnSubscribe";if(type!==onsubscribeType){this.subscribeEvent=new YAHOO.util.CustomEvent(onsubscribeType,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,obj,override){if(!fn){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}
if(this.subscribeEvent){this.subscribeEvent.fire(fn,obj,override);}
this.subscribers.push(new YAHOO.util.Subscriber(fn,obj,override));},unsubscribe:function(fn,obj){if(!fn){return this.unsubscribeAll();}
var found=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,obj)){this._delete(i);found=true;}}
return found;},fire:function(){var len=this.subscribers.length;if(!len&&this.silent){return true;}
var args=[],ret=true,i;for(i=0;i<arguments.length;++i){args.push(arguments[i]);}
var argslength=args.length;if(!this.silent){}
for(i=0;i<len;++i){var s=this.subscribers[i];if(s){if(!this.silent){}
var scope=s.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var param=null;if(args.length>0){param=args[0];}
ret=s.fn.call(scope,param,s.obj);}else{ret=s.fn.call(scope,this.type,args,s.obj);}
if(false===ret){if(!this.silent){}
return false;}}}
return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(len-1-i);}
return i;},_delete:function(index){var s=this.subscribers[index];if(s){delete s.fn;delete s.obj;}
this.subscribers.splice(index,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,override){this.fn=fn;this.obj=obj||null;this.override=override;};YAHOO.util.Subscriber.prototype.getScope=function(defaultScope){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}
return defaultScope;};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){if(obj){return(this.fn==fn&&this.obj==obj);}else{return(this.fn==fn);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+(this.obj||"")+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var loadComplete=false;var DOMReady=false;var listeners=[];var unloadListeners=[];var legacyEvents=[];var legacyHandlers=[];var retryCount=0;var onAvailStack=[];var legacyMap=[];var counter=0;var lastError=null;return{POLL_RETRYS:200,POLL_INTERVAL:10,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,isSafari:(/KHTML/gi).test(navigator.userAgent),webkit:function(){var v=navigator.userAgent.match(/AppleWebKit\/([^ ]*)/);if(v&&v[1]){return v[1];}
return null;}(),isIE:(!this.webkit&&!navigator.userAgent.match(/opera/gi)&&navigator.userAgent.match(/msie/gi)),_interval:null,startInterval:function(){if(!this._interval){var self=this;var callback=function(){self._tryPreloadAttach();};this._interval=setInterval(callback,this.POLL_INTERVAL);}},onAvailable:function(p_id,p_fn,p_obj,p_override){onAvailStack.push({id:p_id,fn:p_fn,obj:p_obj,override:p_override,checkReady:false});retryCount=this.POLL_RETRYS;this.startInterval();},onDOMReady:function(p_fn,p_obj,p_override){this.DOMReadyEvent.subscribe(p_fn,p_obj,p_override);},onContentReady:function(p_id,p_fn,p_obj,p_override){onAvailStack.push({id:p_id,fn:p_fn,obj:p_obj,override:p_override,checkReady:true});retryCount=this.POLL_RETRYS;this.startInterval();},addListener:function(el,sType,fn,obj,override){if(!fn||!fn.call){return false;}
if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=this.on(el[i],sType,fn,obj,override)&&ok;}
return ok;}else if(typeof el=="string"){var oEl=this.getEl(el);if(oEl){el=oEl;}else{this.onAvailable(el,function(){YAHOO.util.Event.on(el,sType,fn,obj,override);});return true;}}
if(!el){return false;}
if("unload"==sType&&obj!==this){unloadListeners[unloadListeners.length]=[el,sType,fn,obj,override];return true;}
var scope=el;if(override){if(override===true){scope=obj;}else{scope=override;}}
var wrappedFn=function(e){return fn.call(scope,YAHOO.util.Event.getEvent(e),obj);};var li=[el,sType,fn,wrappedFn,scope];var index=listeners.length;listeners[index]=li;if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);if(legacyIndex==-1||el!=legacyEvents[legacyIndex][0]){legacyIndex=legacyEvents.length;legacyMap[el.id+sType]=legacyIndex;legacyEvents[legacyIndex]=[el,sType,el["on"+sType]];legacyHandlers[legacyIndex]=[];el["on"+sType]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),legacyIndex);};}
legacyHandlers[legacyIndex].push(li);}else{try{this._simpleAdd(el,sType,wrappedFn,false);}catch(ex){this.lastError=ex;this.removeListener(el,sType,fn);return false;}}
return true;},fireLegacyEvent:function(e,legacyIndex){var ok=true,le,lh,li,scope,ret;lh=legacyHandlers[legacyIndex];for(var i=0,len=lh.length;i<len;++i){li=lh[i];if(li&&li[this.WFN]){scope=li[this.ADJ_SCOPE];ret=li[this.WFN].call(scope,e);ok=(ok&&ret);}}
le=legacyEvents[legacyIndex];if(le&&le[2]){le[2](e);}
return ok;},getLegacyIndex:function(el,sType){var key=this.generateId(el)+sType;if(typeof legacyMap[key]=="undefined"){return-1;}else{return legacyMap[key];}},useLegacyEvent:function(el,sType){if(this.webkit&&("click"==sType||"dblclick"==sType)){var v=parseInt(this.webkit,10);if(!isNaN(v)&&v<418){return true;}}
return false;},removeListener:function(el,sType,fn){var i,len;if(typeof el=="string"){el=this.getEl(el);}else if(this._isValidCollection(el)){var ok=true;for(i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],sType,fn)&&ok);}
return ok;}
if(!fn||!fn.call){return this.purgeElement(el,false,sType);}
if("unload"==sType){for(i=0,len=unloadListeners.length;i<len;i++){var li=unloadListeners[i];if(li&&li[0]==el&&li[1]==sType&&li[2]==fn){unloadListeners.splice(i,1);return true;}}
return false;}
var cacheItem=null;var index=arguments[3];if("undefined"==typeof index){index=this._getCacheIndex(el,sType,fn);}
if(index>=0){cacheItem=listeners[index];}
if(!el||!cacheItem){return false;}
if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);var llist=legacyHandlers[legacyIndex];if(llist){for(i=0,len=llist.length;i<len;++i){li=llist[i];if(li&&li[this.EL]==el&&li[this.TYPE]==sType&&li[this.FN]==fn){llist.splice(i,1);break;}}}}else{try{this._simpleRemove(el,sType,cacheItem[this.WFN],false);}catch(ex){this.lastError=ex;return false;}}
delete listeners[index][this.WFN];delete listeners[index][this.FN];listeners.splice(index,1);return true;},getTarget:function(ev,resolveTextNode){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(node){if(node&&3==node.nodeType){return node.parentNode;}else{return node;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}
return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}
return y;},getXY:function(ev){return[this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else if(ev.type=="mouseover"){t=ev.fromElement;}}
return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(ex){this.lastError=ex;return t;}}
return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}
c=c.caller;}}
return ev;},getCharCode:function(ev){return ev.charCode||ev.keyCode||0;},_getCacheIndex:function(el,sType,fn){for(var i=0,len=listeners.length;i<len;++i){var li=listeners[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==sType){return i;}}
return-1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+counter;++counter;el.id=id;}
return id;},_isValidCollection:function(o){return(o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(e){if(!loadComplete){loadComplete=true;var EU=YAHOO.util.Event;EU._ready();if(this.isIE){EU._simpleRemove(window,"load",EU._load);}}},_ready:function(e){if(!DOMReady){DOMReady=true;var EU=YAHOO.util.Event;EU.DOMReadyEvent.fire();EU._simpleRemove(document,"DOMContentLoaded",EU._ready);}},_tryPreloadAttach:function(){if(this.locked){return false;}
if(this.isIE&&!DOMReady){return false;}
this.locked=true;var tryAgain=!loadComplete;if(!tryAgain){tryAgain=(retryCount>0);}
var notAvail=[];var executeItem=function(el,item){var scope=el;if(item.override){if(item.override===true){scope=item.obj;}else{scope=item.override;}}
item.fn.call(scope,item.obj);};var i,len,item,el;for(i=0,len=onAvailStack.length;i<len;++i){item=onAvailStack[i];if(item&&!item.checkReady){el=this.getEl(item.id);if(el){executeItem(el,item);onAvailStack[i]=null;}else{notAvail.push(item);}}}
for(i=0,len=onAvailStack.length;i<len;++i){item=onAvailStack[i];if(item&&item.checkReady){el=this.getEl(item.id);if(el){if(loadComplete||el.nextSibling){executeItem(el,item);onAvailStack[i]=null;}}else{notAvail.push(item);}}}
retryCount=(notAvail.length===0)?0:retryCount-1;if(tryAgain){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}
this.locked=false;return true;},purgeElement:function(el,recurse,sType){var elListeners=this.getListeners(el,sType);if(elListeners){for(var i=0,len=elListeners.length;i<len;++i){var l=elListeners[i];this.removeListener(el,l.type,l.fn);}}
if(recurse&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],recurse,sType);}}},getListeners:function(el,sType){var results=[],searchLists;if(!sType){searchLists=[listeners,unloadListeners];}else if(sType=="unload"){searchLists=[unloadListeners];}else{searchLists=[listeners];}
for(var j=0;j<searchLists.length;++j){var searchList=searchLists[j];if(searchList&&searchList.length>0){for(var i=0,len=searchList.length;i<len;++i){var l=searchList[i];if(l&&l[this.EL]===el&&(!sType||sType===l[this.TYPE])){results.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}}
return(results.length)?results:null;},_unload:function(e){var EU=YAHOO.util.Event,i,j,l,len,index;for(i=0,len=unloadListeners.length;i<len;++i){l=unloadListeners[i];if(l){var scope=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){scope=l[EU.OBJ];}else{scope=l[EU.ADJ_SCOPE];}}
l[EU.FN].call(scope,EU.getEvent(e),l[EU.OBJ]);unloadListeners[i]=null;l=null;scope=null;}}
unloadListeners=null;if(listeners&&listeners.length>0){j=listeners.length;while(j){index=j-1;l=listeners[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);}
j=j-1;}
l=null;EU.clearCache();}
for(i=0,len=legacyEvents.length;i<len;++i){legacyEvents[i][0]=null;legacyEvents[i]=null;}
legacyEvents=null;EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return[dd.scrollTop,dd.scrollLeft];}else if(db){return[db.scrollTop,db.scrollLeft];}else{return[0,0];}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(el,sType,fn,capture){el.addEventListener(sType,fn,(capture));};}else if(window.attachEvent){return function(el,sType,fn,capture){el.attachEvent("on"+sType,fn);};}else{return function(){};}}(),_simpleRemove:function(){if(window.removeEventListener){return function(el,sType,fn,capture){el.removeEventListener(sType,fn,(capture));};}else if(window.detachEvent){return function(el,sType,fn){el.detachEvent("on"+sType,fn);};}else{return function(){};}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;if(EU.isIE){document.write('<scr'+'ipt id="_yui_eu_dr" defer="true" src="//:"></script>');var el=document.getElementById("_yui_eu_dr");el.onreadystatechange=function(){if("complete"==this.readyState){this.parentNode.removeChild(this);YAHOO.util.Event._ready();}};el=null;YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);}else if(EU.webkit){EU._drwatch=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._drwatch);EU._drwatch=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}
EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}
YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(p_type,p_fn,p_obj,p_override){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(ce){ce.subscribe(p_fn,p_obj,p_override);}else{this.__yui_subscribers=this.__yui_subscribers||{};var subs=this.__yui_subscribers;if(!subs[p_type]){subs[p_type]=[];}
subs[p_type].push({fn:p_fn,obj:p_obj,override:p_override});}},unsubscribe:function(p_type,p_fn,p_obj){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(ce){return ce.unsubscribe(p_fn,p_obj);}else{return false;}},unsubscribeAll:function(p_type){return this.unsubscribe(p_type);},createEvent:function(p_type,p_config){this.__yui_events=this.__yui_events||{};var opts=p_config||{};var events=this.__yui_events;if(events[p_type]){}else{var scope=opts.scope||this;var silent=opts.silent||null;var ce=new YAHOO.util.CustomEvent(p_type,scope,silent,YAHOO.util.CustomEvent.FLAT);events[p_type]=ce;if(opts.onSubscribeCallback){ce.subscribeEvent.subscribe(opts.onSubscribeCallback);}
this.__yui_subscribers=this.__yui_subscribers||{};var qs=this.__yui_subscribers[p_type];if(qs){for(var i=0;i<qs.length;++i){ce.subscribe(qs[i].fn,qs[i].obj,qs[i].override);}}}
return events[p_type];},fireEvent:function(p_type,arg1,arg2,etc){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(ce){var args=[];for(var i=1;i<arguments.length;++i){args.push(arguments[i]);}
return ce.fire.apply(ce,args);}else{return null;}},hasEvent:function(type){if(this.__yui_events){if(this.__yui_events[type]){return true;}}
return false;}};YAHOO.util.KeyListener=function(attachTo,keyData,handler,event){if(!attachTo){}else if(!keyData){}else if(!handler){}
if(!event){event=YAHOO.util.KeyListener.KEYDOWN;}
var keyEvent=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof attachTo=='string'){attachTo=document.getElementById(attachTo);}
if(typeof handler=='function'){keyEvent.subscribe(handler);}else{keyEvent.subscribe(handler.fn,handler.scope,handler.correctScope);}
function handleKeyPress(e,obj){if(!keyData.shift){keyData.shift=false;}
if(!keyData.alt){keyData.alt=false;}
if(!keyData.ctrl){keyData.ctrl=false;}
if(e.shiftKey==keyData.shift&&e.altKey==keyData.alt&&e.ctrlKey==keyData.ctrl){var dataItem;var keyPressed;if(keyData.keys instanceof Array){for(var i=0;i<keyData.keys.length;i++){dataItem=keyData.keys[i];if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);break;}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);break;}}}else{dataItem=keyData.keys;if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);}}}}
this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(attachTo,event,handleKeyPress);this.enabledEvent.fire(keyData);}
this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(attachTo,event,handleKeyPress);this.disabledEvent.fire(keyData);}
this.enabled=false;};this.toString=function(){return"KeyListener ["+keyData.keys+"] "+attachTo.tagName+
(attachTo.id?"["+attachTo.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.register("event",YAHOO.util.Event,{version:"2.2.2",build:"204"});YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_headers:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:'application/x-www-form-urlencoded; charset=UTF-8',_use_default_xhr_header:true,_default_xhr_header:'XMLHttpRequest',_has_default_headers:true,_default_headers:{},_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,_submitElementValue:null,_hasSubmitListener:(function()
{if(YAHOO.util.Event){YAHOO.util.Event.addListener(document,'click',function(e){var obj=YAHOO.util.Event.getTarget(e);if(obj.type=='submit'){YAHOO.util.Connect._submitElementValue=encodeURIComponent(obj.name)+"="+encodeURIComponent(obj.value);}})
return true;}
return false;})(),setProgId:function(id)
{this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b)
{this._use_default_post_header=b;},setDefaultXhrHeader:function(b)
{this._use_default_xhr_header=b;},setPollingInterval:function(i)
{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId)
{var obj,http;try
{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}
catch(e)
{for(var i=0;i<this._msxml_progid.length;++i){try
{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,tId:transactionId};break;}
catch(e){}}}
finally
{return obj;}},getConnectionObject:function()
{var o;var tId=this._transaction_id;try
{o=this.createXhrObject(tId);if(o){this._transaction_id++;}}
catch(e){}
finally
{return o;}},asyncRequest:function(method,uri,callback,postData)
{var o=this.getConnectionObject();if(!o){return null;}
else{if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(o.tId,callback,uri,postData);this.releaseObject(o);return;}
if(method.toUpperCase()=='GET'){if(this._sFormData.length!=0){uri+=((uri.indexOf('?')==-1)?'?':'&')+this._sFormData;}
else{uri+="?"+this._sFormData;}}
else if(method.toUpperCase()=='POST'){postData=postData?this._sFormData+"&"+postData:this._sFormData;}}
o.conn.open(method,uri,true);if(this._use_default_xhr_header){if(!this._default_headers['X-Requested-With']){this.initHeader('X-Requested-With',this._default_xhr_header,true);}}
if(this._isFormSubmit||(postData&&this._use_default_post_header)){this.initHeader('Content-Type',this._default_post_header);if(this._isFormSubmit){this.resetFormState();}}
if(this._has_default_headers||this._has_http_headers){this.setHeader(o);}
this.handleReadyState(o,callback);o.conn.send(postData||null);return o;}},handleReadyState:function(o,callback)
{var oConn=this;if(callback&&callback.timeout){this._timeOut[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true);},callback.timeout);}
this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState===4){window.clearInterval(oConn._poll[o.tId]);delete oConn._poll[o.tId];if(callback&&callback.timeout){delete oConn._timeOut[o.tId];}
oConn.handleTransactionResponse(o,callback);}},this._polling_interval);},handleTransactionResponse:function(o,callback,isAbort)
{if(!callback){this.releaseObject(o);return;}
var httpStatus,responseObject;try
{if(o.conn.status!==undefined&&o.conn.status!==0){httpStatus=o.conn.status;}
else{httpStatus=13030;}}
catch(e){httpStatus=13030;}
if(httpStatus>=200&&httpStatus<300||httpStatus===1223){responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}
else{callback.success.apply(callback.scope,[responseObject]);}}}
else{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}
break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}}}
this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg)
{var obj={};var headerObj={};try
{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i<header.length;i++){var delimitPos=header[i].indexOf(':');if(delimitPos!=-1){headerObj[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+2);}}}
catch(e){}
obj.tId=o.tId;obj.status=(o.conn.status==1223)?204:o.conn.status;obj.statusText=(o.conn.status==1223)?"No Content":o.conn.statusText;obj.getResponseHeader=headerObj;obj.getAllResponseHeaders=headerStr;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof callbackArg!==undefined){obj.argument=callbackArg;}
return obj;},createExceptionObject:function(tId,callbackArg,isAbort)
{var COMM_CODE=0;var COMM_ERROR='communication failure';var ABORT_CODE=-1;var ABORT_ERROR='transaction aborted';var obj={};obj.tId=tId;if(isAbort){obj.status=ABORT_CODE;obj.statusText=ABORT_ERROR;}
else{obj.status=COMM_CODE;obj.statusText=COMM_ERROR;}
if(callbackArg){obj.argument=callbackArg;}
return obj;},initHeader:function(label,value,isDefault)
{var headerObj=(isDefault)?this._default_headers:this._http_headers;if(headerObj[label]===undefined){headerObj[label]=value;}
else{headerObj[label]=value+","+headerObj[label];}
if(isDefault){this._has_default_headers=true;}
else{this._has_http_headers=true;}},setHeader:function(o)
{if(this._has_default_headers){for(var prop in this._default_headers){if(YAHOO.lang.hasOwnProperty(this._default_headers,prop)){o.conn.setRequestHeader(prop,this._default_headers[prop]);}}}
if(this._has_http_headers){for(var prop in this._http_headers){if(YAHOO.lang.hasOwnProperty(this._http_headers,prop)){o.conn.setRequestHeader(prop,this._http_headers[prop]);}}
delete this._http_headers;this._http_headers={};this._has_http_headers=false;}},resetDefaultHeaders:function(){delete this._default_headers
this._default_headers={};this._has_default_headers=false;},setForm:function(formId,isUpload,secureUri)
{this.resetFormState();var oForm;if(typeof formId=='string'){oForm=(document.getElementById(formId)||document.forms[formId]);}
else if(typeof formId=='object'){oForm=formId;}
else{return;}
if(isUpload){this.createFrame(secureUri?secureUri:null);this._isFormSubmit=true;this._isFileUpload=true;this._formNode=oForm;return;}
var oElement,oName,oValue,oDisabled;var hasSubmit=false;for(var i=0;i<oForm.elements.length;i++){oElement=oForm.elements[i];oDisabled=oForm.elements[i].disabled;oName=oForm.elements[i].name;oValue=oForm.elements[i].value;if(!oDisabled&&oName)
{switch(oElement.type)
{case'select-one':case'select-multiple':for(var j=0;j<oElement.options.length;j++){if(oElement.options[j].selected){if(window.ActiveXObject){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].attributes['value'].specified?oElement.options[j].value:oElement.options[j].text)+'&';}
else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].hasAttribute('value')?oElement.options[j].value:oElement.options[j].text)+'&';}}}
break;case'radio':case'checkbox':if(oElement.checked){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
break;case'file':case undefined:case'reset':case'button':break;case'submit':if(hasSubmit===false){if(this._hasSubmitListener){this._sFormData+=this._submitElementValue+'&';}
else{this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
hasSubmit=true;}
break;default:this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';break;}}}
this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);return this._sFormData;},resetFormState:function(){this._isFormSubmit=false;this._isFileUpload=false;this._formNode=null;this._sFormData="";},createFrame:function(secureUri){var frameId='yuiIO'+this._transaction_id;if(window.ActiveXObject){var io=document.createElement('<iframe id="'+frameId+'" name="'+frameId+'" />');if(typeof secureUri=='boolean'){io.src='javascript:false';}
else if(typeof secureURI=='string'){io.src=secureUri;}}
else{var io=document.createElement('iframe');io.id=frameId;io.name=frameId;}
io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},appendPostData:function(postData)
{var formElements=[];var postMessage=postData.split('&');for(var i=0;i<postMessage.length;i++){var delimitPos=postMessage[i].indexOf('=');if(delimitPos!=-1){formElements[i]=document.createElement('input');formElements[i].type='hidden';formElements[i].name=postMessage[i].substring(0,delimitPos);formElements[i].value=postMessage[i].substring(delimitPos+1);this._formNode.appendChild(formElements[i]);}}
return formElements;},uploadFile:function(id,callback,uri,postData){var frameId='yuiIO'+id;var uploadEncoding='multipart/form-data';var io=document.getElementById(frameId);this._formNode.setAttribute('action',uri);this._formNode.setAttribute('method','POST');this._formNode.setAttribute("target",frameId);if(this._formNode.encoding){this._formNode.encoding=uploadEncoding;}
else{this._formNode.enctype=uploadEncoding;}
if(postData){var oElements=this.appendPostData(postData);}
this._formNode.submit();if(oElements&&oElements.length>0){for(var i=0;i<oElements.length;i++){this._formNode.removeChild(oElements[i]);}}
this.resetFormState();var uploadCallback=function()
{var obj={};obj.tId=id;obj.argument=callback.argument;try
{obj.responseText=io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;obj.responseXML=io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;}
catch(e){}
if(callback&&callback.upload){if(!callback.scope){callback.upload(obj);}
else{callback.upload.apply(callback.scope,[obj]);}}
if(YAHOO.util.Event){YAHOO.util.Event.removeListener(io,"load",uploadCallback);}
else if(window.detachEvent){io.detachEvent('onload',uploadCallback);}
else{io.removeEventListener('load',uploadCallback,false);}
setTimeout(function(){document.body.removeChild(io);},100);};if(YAHOO.util.Event){YAHOO.util.Event.addListener(io,"load",uploadCallback);}
else if(window.attachEvent){io.attachEvent('onload',uploadCallback);}
else{io.addEventListener('load',uploadCallback,false);}},abort:function(o,callback,isTimeout)
{if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this._poll[o.tId]);delete this._poll[o.tId];if(isTimeout){delete this._timeOut[o.tId];}
this.handleTransactionResponse(o,callback,true);return true;}
else{return false;}},isCallInProgress:function(o)
{if(o.conn){return o.conn.readyState!==4&&o.conn.readyState!==0;}
else{return false;}},releaseObject:function(o)
{o.conn=null;o=null;}};YAHOO.register("connection",YAHOO.util.Connect,{version:"2.2.2",build:"204"});YAHOO.util.Anim=function(el,attributes,duration,method){if(el){this.init(el,attributes,duration,method);}};YAHOO.util.Anim.prototype={toString:function(){var el=this.getEl();var id=el.id||el.tagName;return("Anim "+id);},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(attr,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attr,val,unit){if(this.patterns.noNegatives.test(attr)){val=(val>0)?val:0;}
YAHOO.util.Dom.setStyle(this.getEl(),attr,val+unit);},getAttribute:function(attr){var el=this.getEl();var val=YAHOO.util.Dom.getStyle(el,attr);if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){return parseFloat(val);}
var a=this.patterns.offsetAttribute.exec(attr)||[];var pos=!!(a[3]);var box=!!(a[2]);if(box||(YAHOO.util.Dom.getStyle(el,'position')=='absolute'&&pos)){val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{val=0;}
return val;},getDefaultUnit:function(attr){if(this.patterns.defaultUnit.test(attr)){return'px';}
return'';},setRuntimeAttribute:function(attr){var start;var end;var attributes=this.attributes;this.runtimeAttributes[attr]={};var isset=function(prop){return(typeof prop!=='undefined');};if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){return false;}
start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);if(isset(attributes[attr]['to'])){end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){if(start.constructor==Array){end=[];for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+attributes[attr]['by'][i];}}else{end=start+attributes[attr]['by'];}}
this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;this.runtimeAttributes[attr].unit=(isset(attributes[attr].unit))?attributes[attr]['unit']:this.getDefaultUnit(attr);},init:function(el,attributes,duration,method){var isAnimated=false;var startTime=null;var actualFrames=0;el=YAHOO.util.Dom.get(el);this.attributes=attributes||{};this.duration=duration||1;this.method=method||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.getEl=function(){return el;};this.isAnimated=function(){return isAnimated;};this.getStartTime=function(){return startTime;};this.runtimeAttributes={};this.animate=function(){if(this.isAnimated()){return false;}
this.currentFrame=0;this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;YAHOO.util.AnimMgr.registerElement(this);};this.stop=function(finish){if(finish){this.currentFrame=this.totalFrames;this._onTween.fire();}
YAHOO.util.AnimMgr.stop(this);};var onStart=function(){this.onStart.fire();this.runtimeAttributes={};for(var attr in this.attributes){this.setRuntimeAttribute(attr);}
isAnimated=true;actualFrames=0;startTime=new Date();};var onTween=function(){var data={duration:new Date()-this.getStartTime(),currentFrame:this.currentFrame};data.toString=function(){return('duration: '+data.duration+', currentFrame: '+data.currentFrame);};this.onTween.fire(data);var runtimeAttributes=this.runtimeAttributes;for(var attr in runtimeAttributes){this.setAttribute(attr,this.doMethod(attr,runtimeAttributes[attr].start,runtimeAttributes[attr].end),runtimeAttributes[attr].unit);}
actualFrames+=1;};var onComplete=function(){var actual_duration=(new Date()-startTime)/1000;var data={duration:actual_duration,frames:actualFrames,fps:actualFrames/actual_duration};data.toString=function(){return('duration: '+data.duration+', frames: '+data.frames+', fps: '+data.fps);};isAnimated=false;actualFrames=0;this.onComplete.fire(data);};this._onStart=new YAHOO.util.CustomEvent('_start',this,true);this.onStart=new YAHOO.util.CustomEvent('start',this);this.onTween=new YAHOO.util.CustomEvent('tween',this);this._onTween=new YAHOO.util.CustomEvent('_tween',this,true);this.onComplete=new YAHOO.util.CustomEvent('complete',this);this._onComplete=new YAHOO.util.CustomEvent('_complete',this,true);this._onStart.subscribe(onStart);this._onTween.subscribe(onTween);this._onComplete.subscribe(onComplete);}};YAHOO.util.AnimMgr=new function(){var thread=null;var queue=[];var tweenCount=0;this.fps=1000;this.delay=1;this.registerElement=function(tween){queue[queue.length]=tween;tweenCount+=1;tween._onStart.fire();this.start();};this.unRegister=function(tween,index){tween._onComplete.fire();index=index||getIndex(tween);if(index!=-1){queue.splice(index,1);}
tweenCount-=1;if(tweenCount<=0){this.stop();}};this.start=function(){if(thread===null){thread=setInterval(this.run,this.delay);}};this.stop=function(tween){if(!tween){clearInterval(thread);for(var i=0,len=queue.length;i<len;++i){if(queue[0].isAnimated()){this.unRegister(queue[0],0);}}
queue=[];thread=null;tweenCount=0;}
else{this.unRegister(tween);}};this.run=function(){for(var i=0,len=queue.length;i<len;++i){var tween=queue[i];if(!tween||!tween.isAnimated()){continue;}
if(tween.currentFrame<tween.totalFrames||tween.totalFrames===null)
{tween.currentFrame+=1;if(tween.useSeconds){correctFrame(tween);}
tween._onTween.fire();}
else{YAHOO.util.AnimMgr.stop(tween,i);}}};var getIndex=function(anim){for(var i=0,len=queue.length;i<len;++i){if(queue[i]==anim){return i;}}
return-1;};var correctFrame=function(tween){var frames=tween.totalFrames;var frame=tween.currentFrame;var expected=(tween.currentFrame*tween.duration*1000/tween.totalFrames);var elapsed=(new Date()-tween.getStartTime());var tweak=0;if(elapsed<tween.duration*1000){tweak=Math.round((elapsed/expected-1)*tween.currentFrame);}else{tweak=frames-(frame+1);}
if(tweak>0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}
tween.currentFrame+=tweak;}};};YAHOO.util.Bezier=new function(){this.getPosition=function(points,t){var n=points.length;var tmp=[];for(var i=0;i<n;++i){tmp[i]=[points[i][0],points[i][1]];}
for(var j=1;j<n;++j){for(i=0;i<n-j;++i){tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}
return[tmp[0][0],tmp[0][1]];};};(function(){YAHOO.util.ColorAnim=function(el,attributes,duration,method){YAHOO.util.ColorAnim.superclass.constructor.call(this,el,attributes,duration,method);};YAHOO.extend(YAHOO.util.ColorAnim,YAHOO.util.Anim);var Y=YAHOO.util;var superclass=Y.ColorAnim.superclass;var proto=Y.ColorAnim.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("ColorAnim "+id);};proto.patterns.color=/color$/i;proto.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;proto.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;proto.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;proto.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;proto.parseColor=function(s){if(s.length==3){return s;}
var c=this.patterns.hex.exec(s);if(c&&c.length==4){return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];}
c=this.patterns.rgb.exec(s);if(c&&c.length==4){return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];}
c=this.patterns.hex3.exec(s);if(c&&c.length==4){return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];}
return null;};proto.getAttribute=function(attr){var el=this.getEl();if(this.patterns.color.test(attr)){var val=YAHOO.util.Dom.getStyle(el,attr);if(this.patterns.transparent.test(val)){var parent=el.parentNode;val=Y.Dom.getStyle(parent,attr);while(parent&&this.patterns.transparent.test(val)){parent=parent.parentNode;val=Y.Dom.getStyle(parent,attr);if(parent.tagName.toUpperCase()=='HTML'){val='#fff';}}}}else{val=superclass.getAttribute.call(this,attr);}
return val;};proto.doMethod=function(attr,start,end){var val;if(this.patterns.color.test(attr)){val=[];for(var i=0,len=start.length;i<len;++i){val[i]=superclass.doMethod.call(this,attr,start[i],end[i]);}
val='rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';}
else{val=superclass.doMethod.call(this,attr,start,end);}
return val;};proto.setRuntimeAttribute=function(attr){superclass.setRuntimeAttribute.call(this,attr);if(this.patterns.color.test(attr)){var attributes=this.attributes;var start=this.parseColor(this.runtimeAttributes[attr].start);var end=this.parseColor(this.runtimeAttributes[attr].end);if(typeof attributes[attr]['to']==='undefined'&&typeof attributes[attr]['by']!=='undefined'){end=this.parseColor(attributes[attr].by);for(var i=0,len=start.length;i<len;++i){end[i]=start[i]+end[i];}}
this.runtimeAttributes[attr].start=start;this.runtimeAttributes[attr].end=end;}};})();YAHOO.util.Easing={easeNone:function(t,b,c,d){return c*t/d+b;},easeIn:function(t,b,c,d){return c*(t/=d)*t+b;},easeOut:function(t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeBoth:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t+b;}
return-c/2*((--t)*(t-2)-1)+b;},easeInStrong:function(t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutStrong:function(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeBothStrong:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t+b;}
return-c/2*((t-=2)*t*t*t-2)+b;},elasticIn:function(t,b,c,d,a,p){if(t==0){return b;}
if((t/=d)==1){return b+c;}
if(!p){p=d*.3;}
if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else{var s=p/(2*Math.PI)*Math.asin(c/a);}
return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},elasticOut:function(t,b,c,d,a,p){if(t==0){return b;}
if((t/=d)==1){return b+c;}
if(!p){p=d*.3;}
if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else{var s=p/(2*Math.PI)*Math.asin(c/a);}
return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},elasticBoth:function(t,b,c,d,a,p){if(t==0){return b;}
if((t/=d/2)==2){return b+c;}
if(!p){p=d*(.3*1.5);}
if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else{var s=p/(2*Math.PI)*Math.asin(c/a);}
if(t<1){return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;}
return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},backIn:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
return c*(t/=d)*t*((s+1)*t-s)+b;},backOut:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backBoth:function(t,b,c,d,s){if(typeof s=='undefined'){s=1.70158;}
if((t/=d/2)<1){return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;}
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},bounceIn:function(t,b,c,d){return c-YAHOO.util.Easing.bounceOut(d-t,0,c,d)+b;},bounceOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}
return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;},bounceBoth:function(t,b,c,d){if(t<d/2){return YAHOO.util.Easing.bounceIn(t*2,0,c,d)*.5+b;}
return YAHOO.util.Easing.bounceOut(t*2-d,0,c,d)*.5+c*.5+b;}};(function(){YAHOO.util.Motion=function(el,attributes,duration,method){if(el){YAHOO.util.Motion.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Motion,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Motion.superclass;var proto=Y.Motion.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Motion "+id);};proto.patterns.points=/^points$/i;proto.setAttribute=function(attr,val,unit){if(this.patterns.points.test(attr)){unit=unit||'px';superclass.setAttribute.call(this,'left',val[0],unit);superclass.setAttribute.call(this,'top',val[1],unit);}else{superclass.setAttribute.call(this,attr,val,unit);}};proto.getAttribute=function(attr){if(this.patterns.points.test(attr)){var val=[superclass.getAttribute.call(this,'left'),superclass.getAttribute.call(this,'top')];}else{val=superclass.getAttribute.call(this,attr);}
return val;};proto.doMethod=function(attr,start,end){var val=null;if(this.patterns.points.test(attr)){var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;val=Y.Bezier.getPosition(this.runtimeAttributes[attr],t);}else{val=superclass.doMethod.call(this,attr,start,end);}
return val;};proto.setRuntimeAttribute=function(attr){if(this.patterns.points.test(attr)){var el=this.getEl();var attributes=this.attributes;var start;var control=attributes['points']['control']||[];var end;var i,len;if(control.length>0&&!(control[0]instanceof Array)){control=[control];}else{var tmp=[];for(i=0,len=control.length;i<len;++i){tmp[i]=control[i];}
control=tmp;}
if(Y.Dom.getStyle(el,'position')=='static'){Y.Dom.setStyle(el,'position','relative');}
if(isset(attributes['points']['from'])){Y.Dom.setXY(el,attributes['points']['from']);}
else{Y.Dom.setXY(el,Y.Dom.getXY(el));}
start=this.getAttribute('points');if(isset(attributes['points']['to'])){end=translateValues.call(this,attributes['points']['to'],start);var pageXY=Y.Dom.getXY(this.getEl());for(i=0,len=control.length;i<len;++i){control[i]=translateValues.call(this,control[i],start);}}else if(isset(attributes['points']['by'])){end=[start[0]+attributes['points']['by'][0],start[1]+attributes['points']['by'][1]];for(i=0,len=control.length;i<len;++i){control[i]=[start[0]+control[i][0],start[1]+control[i][1]];}}
this.runtimeAttributes[attr]=[start];if(control.length>0){this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);}
this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}
else{superclass.setRuntimeAttribute.call(this,attr);}};var translateValues=function(val,start){var pageXY=Y.Dom.getXY(this.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var isset=function(prop){return(typeof prop!=='undefined');};})();(function(){YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};YAHOO.extend(YAHOO.util.Scroll,YAHOO.util.ColorAnim);var Y=YAHOO.util;var superclass=Y.Scroll.superclass;var proto=Y.Scroll.prototype;proto.toString=function(){var el=this.getEl();var id=el.id||el.tagName;return("Scroll "+id);};proto.doMethod=function(attr,start,end){var val=null;if(attr=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=superclass.doMethod.call(this,attr,start,end);}
return val;};proto.getAttribute=function(attr){var val=null;var el=this.getEl();if(attr=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=superclass.getAttribute.call(this,attr);}
return val;};proto.setAttribute=function(attr,val,unit){var el=this.getEl();if(attr=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{superclass.setAttribute.call(this,attr,val,unit);}};})();YAHOO.register("animation",YAHOO.util.Anim,{version:"2.2.2",build:"204"});if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var Event=YAHOO.util.Event;return{ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,interactionInfo:null,init:function(){this.initialized=true;},POINT:0,INTERSECT:1,STRICT_INTERSECT:2,mode:0,_execOnAll:function(sMethod,args){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}
oDD[sMethod].apply(oDD,args);}}},_onLoad:function(){this.init();Event.on(document,"mouseup",this.handleMouseUp,this,true);Event.on(document,"mousemove",this.handleMouseMove,this,true);Event.on(window,"unload",this._onUnload,this,true);Event.on(window,"resize",this._onResize,this,true);},_onResize:function(e){this._execOnAll("resetConstraints",[]);},lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isLocked:function(){return this.locked;},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(oDD,sGroup){if(!this.initialized){this.init();}
if(!this.ids[sGroup]){this.ids[sGroup]={};}
this.ids[sGroup][oDD.id]=oDD;},removeDDFromGroup:function(oDD,sGroup){if(!this.ids[sGroup]){this.ids[sGroup]={};}
var obj=this.ids[sGroup];if(obj&&obj[oDD.id]){delete obj[oDD.id];}},_remove:function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}}
delete this.handleIds[oDD.id];},regHandle:function(sDDId,sHandleId){if(!this.handleIds[sDDId]){this.handleIds[sDDId]={};}
this.handleIds[sDDId][sHandleId]=sHandleId;},isDragDrop:function(id){return(this.getDDById(id))?true:false;},getRelated:function(p_oDD,bTargetsOnly){var oDDs=[];for(var i in p_oDD.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}
if(!bTargetsOnly||dd.isTarget){oDDs[oDDs.length]=dd;}}}
return oDDs;},isLegalTarget:function(oDD,oTargetDD){var targets=this.getRelated(oDD,true);for(var i=0,len=targets.length;i<len;++i){if(targets[i].id==oTargetDD.id){return true;}}
return false;},isTypeOfDD:function(oDD){return(oDD&&oDD.__ygDragDrop);},isHandle:function(sDDId,sHandleId){return(this.handleIds[sDDId]&&this.handleIds[sDDId][sHandleId]);},getDDById:function(id){for(var i in this.ids){if(this.ids[i][id]){return this.ids[i][id];}}
return null;},handleMouseDown:function(e,oDD){this.currentTarget=YAHOO.util.Event.getTarget(e);this.dragCurrent=oDD;var el=oDD.getEl();this.startX=YAHOO.util.Event.getPageX(e);this.startY=YAHOO.util.Event.getPageY(e);this.deltaX=this.startX-el.offsetLeft;this.deltaY=this.startY-el.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var DDM=YAHOO.util.DDM;DDM.startDrag(DDM.startX,DDM.startY);},this.clickTimeThresh);},startDrag:function(x,y){clearTimeout(this.clickTimeout);if(this.dragCurrent){this.dragCurrent.b4StartDrag(x,y);this.dragCurrent.startDrag(x,y);}
this.dragThreshMet=true;},handleMouseUp:function(e){if(!this.dragCurrent){return;}
clearTimeout(this.clickTimeout);if(this.dragThreshMet){this.fireEvents(e,true);}else{}
this.stopDrag(e);this.stopEvent(e);},stopEvent:function(e){if(this.stopPropagation){YAHOO.util.Event.stopPropagation(e);}
if(this.preventDefault){YAHOO.util.Event.preventDefault(e);}},stopDrag:function(e){if(this.dragCurrent){if(this.dragThreshMet){this.dragCurrent.b4EndDrag(e);this.dragCurrent.endDrag(e);}
this.dragCurrent.onMouseUp(e);}
this.dragCurrent=null;this.dragOvers={};},handleMouseMove:function(e){if(!this.dragCurrent){return true;}
if(YAHOO.util.Event.isIE&&!e.button){this.stopEvent(e);return this.handleMouseUp(e);}
if(!this.dragThreshMet){var diffX=Math.abs(this.startX-YAHOO.util.Event.getPageX(e));var diffY=Math.abs(this.startY-YAHOO.util.Event.getPageY(e));if(diffX>this.clickPixelThresh||diffY>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}
if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);this.fireEvents(e,false);}
this.stopEvent(e);return true;},fireEvents:function(e,isDrop){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}
var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);var pt=new YAHOO.util.Point(x,y);var pos=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();curRegion=new YAHOO.util.Region(pos.y,pos.x+el.offsetWidth,pos.y+el.offsetHeight,pos.x);var oldOvers=[];var outEvts=[];var overEvts=[];var dropEvts=[];var enterEvts=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}
if(!this.isOverTarget(pt,ddo,this.mode,curRegion)){outEvts.push(ddo);}
oldOvers[i]=true;delete this.dragOvers[i];}
for(var sGroup in dc.groups){if("string"!=typeof sGroup){continue;}
for(i in this.ids[sGroup]){var oDD=this.ids[sGroup][i];if(!this.isTypeOfDD(oDD)){continue;}
if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode,curRegion)){if(isDrop){dropEvts.push(oDD);}else{if(!oldOvers[oDD.id]){enterEvts.push(oDD);}else{overEvts.push(oDD);}
this.dragOvers[oDD.id]=oDD;}}}}}
this.interactionInfo={out:outEvts,enter:enterEvts,over:overEvts,drop:dropEvts,point:pt,draggedRegion:curRegion,sourceRegion:this.locationCache[dc.id],validDrop:isDrop};if(isDrop&&!dropEvts.length){this.interactionInfo.validDrop=false;dc.onInvalidDrop(e);}
if(this.mode){if(outEvts.length){dc.b4DragOut(e,outEvts);dc.onDragOut(e,outEvts);}
if(enterEvts.length){dc.onDragEnter(e,enterEvts);}
if(overEvts.length){dc.b4DragOver(e,overEvts);dc.onDragOver(e,overEvts);}
if(dropEvts.length){dc.b4DragDrop(e,dropEvts);dc.onDragDrop(e,dropEvts);}}else{var len=0;for(i=0,len=outEvts.length;i<len;++i){dc.b4DragOut(e,outEvts[i].id);dc.onDragOut(e,outEvts[i].id);}
for(i=0,len=enterEvts.length;i<len;++i){dc.onDragEnter(e,enterEvts[i].id);}
for(i=0,len=overEvts.length;i<len;++i){dc.b4DragOver(e,overEvts[i].id);dc.onDragOver(e,overEvts[i].id);}
for(i=0,len=dropEvts.length;i<len;++i){dc.b4DragDrop(e,dropEvts[i].id);dc.onDragDrop(e,dropEvts[i].id);}}},getBestMatch:function(dds){var winner=null;var len=dds.length;if(len==1){winner=dds[0];}else{for(var i=0;i<len;++i){var dd=dds[i];if(this.mode==this.INTERSECT&&dd.cursorIsOver){winner=dd;break;}else{if(!winner||!winner.overlap||(dd.overlap&&winner.overlap.getArea()<dd.overlap.getArea())){winner=dd;}}}}
return winner;},refreshCache:function(groups){var g=groups||this.ids;for(var sGroup in g){if("string"!=typeof sGroup){continue;}
for(var i in this.ids[sGroup]){var oDD=this.ids[sGroup][i];if(this.isTypeOfDD(oDD)){var loc=this.getLocation(oDD);if(loc){this.locationCache[oDD.id]=loc;}else{delete this.locationCache[oDD.id];}}}}},verifyEl:function(el){try{if(el){var parent=el.offsetParent;if(parent){return true;}}}catch(e){}
return false;},getLocation:function(oDD){if(!this.isTypeOfDD(oDD)){return null;}
var el=oDD.getEl(),pos,x1,x2,y1,y2,t,r,b,l;try{pos=YAHOO.util.Dom.getXY(el);}catch(e){}
if(!pos){return null;}
x1=pos[0];x2=x1+el.offsetWidth;y1=pos[1];y2=y1+el.offsetHeight;t=y1-oDD.padding[0];r=x2+oDD.padding[1];b=y2+oDD.padding[2];l=x1-oDD.padding[3];return new YAHOO.util.Region(t,r,b,l);},isOverTarget:function(pt,oTarget,intersect,curRegion){var loc=this.locationCache[oTarget.id];if(!loc||!this.useCache){loc=this.getLocation(oTarget);this.locationCache[oTarget.id]=loc;}
if(!loc){return false;}
oTarget.cursorIsOver=loc.contains(pt);var dc=this.dragCurrent;if(!dc||(!intersect&&!dc.constrainX&&!dc.constrainY)){return oTarget.cursorIsOver;}
oTarget.overlap=null;if(!curRegion){var pos=dc.getTargetCoord(pt.x,pt.y);var el=dc.getDragEl();curRegion=new YAHOO.util.Region(pos.y,pos.x+el.offsetWidth,pos.y+el.offsetHeight,pos.x);}
var overlap=curRegion.intersect(loc);if(overlap){oTarget.overlap=overlap;return(intersect)?true:oTarget.cursorIsOver;}else{return false;}},_onUnload:function(e,me){this.unregAll();},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null;}
this._execOnAll("unreg",[]);for(i in this.elementCache){delete this.elementCache[i];}
this.elementCache={};this.ids={};},elementCache:{},getElWrapper:function(id){var oWrapper=this.elementCache[id];if(!oWrapper||!oWrapper.el){oWrapper=this.elementCache[id]=new this.ElementWrapper(YAHOO.util.Dom.get(id));}
return oWrapper;},getElement:function(id){return YAHOO.util.Dom.get(id);},getCss:function(id){var el=YAHOO.util.Dom.get(id);return(el)?el.style:null;},ElementWrapper:function(el){this.el=el||null;this.id=this.el&&el.id;this.css=this.el&&el.style;},getPosX:function(el){return YAHOO.util.Dom.getX(el);},getPosY:function(el){return YAHOO.util.Dom.getY(el);},swapNode:function(n1,n2){if(n1.swapNode){n1.swapNode(n2);}else{var p=n2.parentNode;var s=n2.nextSibling;if(s==n1){p.insertBefore(n1,n2);}else if(n2==n1.nextSibling){p.insertBefore(n2,n1);}else{n1.parentNode.replaceChild(n2,n1);p.insertBefore(n1,s);}}},getScroll:function(){var t,l,dde=document.documentElement,db=document.body;if(dde&&(dde.scrollTop||dde.scrollLeft)){t=dde.scrollTop;l=dde.scrollLeft;}else if(db){t=db.scrollTop;l=db.scrollLeft;}else{}
return{top:t,left:l};},getStyle:function(el,styleProp){return YAHOO.util.Dom.getStyle(el,styleProp);},getScrollTop:function(){return this.getScroll().top;},getScrollLeft:function(){return this.getScroll().left;},moveToEl:function(moveEl,targetEl){var aCoord=YAHOO.util.Dom.getXY(targetEl);YAHOO.util.Dom.setXY(moveEl,aCoord);},getClientHeight:function(){return YAHOO.util.Dom.getViewportHeight();},getClientWidth:function(){return YAHOO.util.Dom.getViewportWidth();},numericSort:function(a,b){return(a-b);},_timeoutCount:0,_addListeners:function(){var DDM=YAHOO.util.DDM;if(YAHOO.util.Event&&document){DDM._onLoad();}else{if(DDM._timeoutCount>2000){}else{setTimeout(DDM._addListeners,10);if(document&&document.body){DDM._timeoutCount+=1;}}}},handleWasClicked:function(node,id){if(this.isHandle(id,node.id)){return true;}else{var p=node.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}
return false;}};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}
(function(){var Event=YAHOO.util.Event;var Dom=YAHOO.util.Dom;YAHOO.util.DragDrop=function(id,sGroup,config){if(id){this.init(id,sGroup,config);}};YAHOO.util.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true;},unlock:function(){this.locked=false;},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,deltaX:0,deltaY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(x,y){},startDrag:function(x,y){},b4Drag:function(e){},onDrag:function(e){},onDragEnter:function(e,id){},b4DragOver:function(e){},onDragOver:function(e,id){},b4DragOut:function(e){},onDragOut:function(e,id){},b4DragDrop:function(e){},onDragDrop:function(e,id){},onInvalidDrop:function(e){},b4EndDrag:function(e){},endDrag:function(e){},b4MouseDown:function(e){},onMouseDown:function(e){},onMouseUp:function(e){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=Dom.get(this.id);}
return this._domRef;},getDragEl:function(){return Dom.get(this.dragElId);},init:function(id,sGroup,config){this.initTarget(id,sGroup,config);Event.on(this.id,"mousedown",this.handleMouseDown,this,true);},initTarget:function(id,sGroup,config){this.config=config||{};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof id!=="string"){id=Dom.generateId(id);}
this.id=id;this.addToGroup((sGroup)?sGroup:"default");this.handleElId=id;Event.onAvailable(id,this.handleOnAvailable,this,true);this.setDragElId(id);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig();},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false);},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable();},setPadding:function(iTop,iRight,iBot,iLeft){if(!iRight&&0!==iRight){this.padding=[iTop,iTop,iTop,iTop];}else if(!iBot&&0!==iBot){this.padding=[iTop,iRight,iTop,iRight];}else{this.padding=[iTop,iRight,iBot,iLeft];}},setInitPosition:function(diffX,diffY){var el=this.getEl();if(!this.DDM.verifyEl(el)){return;}
var dx=diffX||0;var dy=diffY||0;var p=Dom.getXY(el);this.initPageX=p[0]-dx;this.initPageY=p[1]-dy;this.lastPageX=p[0];this.lastPageY=p[1];this.setStartPosition(p);},setStartPosition:function(pos){var p=pos||Dom.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=p[0];this.startPageY=p[1];},addToGroup:function(sGroup){this.groups[sGroup]=true;this.DDM.regDragDrop(this,sGroup);},removeFromGroup:function(sGroup){if(this.groups[sGroup]){delete this.groups[sGroup];}
this.DDM.removeDDFromGroup(this,sGroup);},setDragElId:function(id){this.dragElId=id;},setHandleElId:function(id){if(typeof id!=="string"){id=Dom.generateId(id);}
this.handleElId=id;this.DDM.regHandle(this.id,id);},setOuterHandleElId:function(id){if(typeof id!=="string"){id=Dom.generateId(id);}
Event.on(id,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(id);this.hasOuterHandles=true;},unreg:function(){Event.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this);},isLocked:function(){return(this.DDM.isLocked()||this.locked);},handleMouseDown:function(e,oDD){var button=e.which||e.button;if(this.primaryButtonOnly&&button>1){return;}
if(this.isLocked()){return;}
this.b4MouseDown(e);this.onMouseDown(e);this.DDM.refreshCache(this.groups);var pt=new YAHOO.util.Point(Event.getPageX(e),Event.getPageY(e));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(pt,this)){}else{if(this.clickValidator(e)){this.setStartPosition();this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}else{}}},clickValidator:function(e){var target=Event.getTarget(e);return(this.isValidHandleChild(target)&&(this.id==this.handleElId||this.DDM.handleWasClicked(target,this.id)));},getTargetCoord:function(iPageX,iPageY){var x=iPageX-this.deltaX;var y=iPageY-this.deltaY;if(this.constrainX){if(x<this.minX){x=this.minX;}
if(x>this.maxX){x=this.maxX;}}
if(this.constrainY){if(y<this.minY){y=this.minY;}
if(y>this.maxY){y=this.maxY;}}
x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return{x:x,y:y};},addInvalidHandleType:function(tagName){var type=tagName.toUpperCase();this.invalidHandleTypes[type]=type;},addInvalidHandleId:function(id){if(typeof id!=="string"){id=Dom.generateId(id);}
this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(cssClass){this.invalidHandleClasses.push(cssClass);},removeInvalidHandleType:function(tagName){var type=tagName.toUpperCase();delete this.invalidHandleTypes[type];},removeInvalidHandleId:function(id){if(typeof id!=="string"){id=Dom.generateId(id);}
delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(cssClass){for(var i=0,len=this.invalidHandleClasses.length;i<len;++i){if(this.invalidHandleClasses[i]==cssClass){delete this.invalidHandleClasses[i];}}},isValidHandleChild:function(node){var valid=true;var nodeName;try{nodeName=node.nodeName.toUpperCase();}catch(e){nodeName=node.nodeName;}
valid=valid&&!this.invalidHandleTypes[nodeName];valid=valid&&!this.invalidHandleIds[node.id];for(var i=0,len=this.invalidHandleClasses.length;valid&&i<len;++i){valid=!Dom.hasClass(node,this.invalidHandleClasses[i]);}
return valid;},setXTicks:function(iStartX,iTickSize){this.xTicks=[];this.xTickSize=iTickSize;var tickMap={};for(var i=this.initPageX;i>=this.minX;i=i-iTickSize){if(!tickMap[i]){this.xTicks[this.xTicks.length]=i;tickMap[i]=true;}}
for(i=this.initPageX;i<=this.maxX;i=i+iTickSize){if(!tickMap[i]){this.xTicks[this.xTicks.length]=i;tickMap[i]=true;}}
this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(iStartY,iTickSize){this.yTicks=[];this.yTickSize=iTickSize;var tickMap={};for(var i=this.initPageY;i>=this.minY;i=i-iTickSize){if(!tickMap[i]){this.yTicks[this.yTicks.length]=i;tickMap[i]=true;}}
for(i=this.initPageY;i<=this.maxY;i=i+iTickSize){if(!tickMap[i]){this.yTicks[this.yTicks.length]=i;tickMap[i]=true;}}
this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(iLeft,iRight,iTickSize){this.leftConstraint=parseInt(iLeft,10);this.rightConstraint=parseInt(iRight,10);this.minX=this.initPageX-this.leftConstraint;this.maxX=this.initPageX+this.rightConstraint;if(iTickSize){this.setXTicks(this.initPageX,iTickSize);}
this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(iUp,iDown,iTickSize){this.topConstraint=parseInt(iUp,10);this.bottomConstraint=parseInt(iDown,10);this.minY=this.initPageY-this.topConstraint;this.maxY=this.initPageY+this.bottomConstraint;if(iTickSize){this.setYTicks(this.initPageY,iTickSize);}
this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}
if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}
if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,tickArray){if(!tickArray){return val;}else if(tickArray[0]>=val){return tickArray[0];}else{for(var i=0,len=tickArray.length;i<len;++i){var next=i+1;if(tickArray[next]&&tickArray[next]>=val){var diff1=val-tickArray[i];var diff2=tickArray[next]-val;return(diff2>diff1)?tickArray[i]:tickArray[next];}}
return tickArray[tickArray.length-1];}},toString:function(){return("DragDrop "+this.id);}};})();YAHOO.util.DD=function(id,sGroup,config){if(id){this.init(id,sGroup,config);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(iPageX,iPageY){var x=iPageX-this.startPageX;var y=iPageY-this.startPageY;this.setDelta(x,y);},setDelta:function(iDeltaX,iDeltaY){this.deltaX=iDeltaX;this.deltaY=iDeltaY;},setDragElPos:function(iPageX,iPageY){var el=this.getDragEl();this.alignElWithMouse(el,iPageX,iPageY);},alignElWithMouse:function(el,iPageX,iPageY){var oCoord=this.getTargetCoord(iPageX,iPageY);if(!this.deltaSetXY){var aCoord=[oCoord.x,oCoord.y];YAHOO.util.Dom.setXY(el,aCoord);var newLeft=parseInt(YAHOO.util.Dom.getStyle(el,"left"),10);var newTop=parseInt(YAHOO.util.Dom.getStyle(el,"top"),10);this.deltaSetXY=[newLeft-oCoord.x,newTop-oCoord.y];}else{YAHOO.util.Dom.setStyle(el,"left",(oCoord.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(el,"top",(oCoord.y+this.deltaSetXY[1])+"px");}
this.cachePosition(oCoord.x,oCoord.y);this.autoScroll(oCoord.x,oCoord.y,el.offsetHeight,el.offsetWidth);},cachePosition:function(iPageX,iPageY){if(iPageX){this.lastPageX=iPageX;this.lastPageY=iPageY;}else{var aCoord=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=aCoord[0];this.lastPageY=aCoord[1];}},autoScroll:function(x,y,h,w){if(this.scroll){var clientH=this.DDM.getClientHeight();var clientW=this.DDM.getClientWidth();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var right=w+x;var toBot=(clientH+st-y-this.deltaY);var toRight=(clientW+sl-x-this.deltaX);var thresh=40;var scrAmt=(document.all)?80:30;if(bot>clientH&&toBot<thresh){window.scrollTo(sl,st+scrAmt);}
if(y<st&&st>0&&y-st<thresh){window.scrollTo(sl,st-scrAmt);}
if(right>clientW&&toRight<thresh){window.scrollTo(sl+scrAmt,st);}
if(x<sl&&sl>0&&x-sl<thresh){window.scrollTo(sl-scrAmt,st);}}},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);},b4MouseDown:function(e){this.setStartPosition();this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},b4Drag:function(e){this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));},toString:function(){return("DD "+this.id);}});YAHOO.util.DDProxy=function(id,sGroup,config){if(id){this.init(id,sGroup,config);this.initFrame();}};YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var self=this;var body=document.body;if(!body||!body.firstChild){setTimeout(function(){self.createFrame();},50);return;}
var div=this.getDragEl();if(!div){div=document.createElement("div");div.id=this.dragElId;var s=div.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;body.insertBefore(div,body.firstChild);}},initFrame:function(){this.createFrame();},applyConfig:function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId);},showFrame:function(iPageX,iPageY){var el=this.getEl();var dragEl=this.getDragEl();var s=dragEl.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}
this.setDragElPos(iPageX,iPageY);YAHOO.util.Dom.setStyle(dragEl,"visibility","visible");},_resizeProxy:function(){if(this.resizeFrame){var DOM=YAHOO.util.Dom;var el=this.getEl();var dragEl=this.getDragEl();var bt=parseInt(DOM.getStyle(dragEl,"borderTopWidth"),10);var br=parseInt(DOM.getStyle(dragEl,"borderRightWidth"),10);var bb=parseInt(DOM.getStyle(dragEl,"borderBottomWidth"),10);var bl=parseInt(DOM.getStyle(dragEl,"borderLeftWidth"),10);if(isNaN(bt)){bt=0;}
if(isNaN(br)){br=0;}
if(isNaN(bb)){bb=0;}
if(isNaN(bl)){bl=0;}
var newWidth=Math.max(0,el.offsetWidth-br-bl);var newHeight=Math.max(0,el.offsetHeight-bt-bb);DOM.setStyle(dragEl,"width",newWidth+"px");DOM.setStyle(dragEl,"height",newHeight+"px");}},b4MouseDown:function(e){this.setStartPosition();var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.autoOffset(x,y);this.setDragElPos(x,y);},b4StartDrag:function(x,y){this.showFrame(x,y);},b4EndDrag:function(e){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");},endDrag:function(e){var DOM=YAHOO.util.Dom;var lel=this.getEl();var del=this.getDragEl();DOM.setStyle(del,"visibility","");DOM.setStyle(lel,"visibility","hidden");YAHOO.util.DDM.moveToEl(lel,del);DOM.setStyle(del,"visibility","hidden");DOM.setStyle(lel,"visibility","");},toString:function(){return("DDProxy "+this.id);}});YAHOO.util.DDTarget=function(id,sGroup,config){if(id){this.initTarget(id,sGroup,config);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return("DDTarget "+this.id);}});YAHOO.register("dragdrop",YAHOO.util.DragDropMgr,{version:"2.2.2",build:"204"});YAHOO.util.Attribute=function(hash,owner){if(owner){this.owner=owner;this.configure(hash,true);}};YAHOO.util.Attribute.prototype={name:undefined,value:null,owner:null,readOnly:false,writeOnce:false,_initialConfig:null,_written:false,method:null,validator:null,getValue:function(){return this.value;},setValue:function(value,silent){var beforeRetVal;var owner=this.owner;var name=this.name;var event={type:name,prevValue:this.getValue(),newValue:value};if(this.readOnly||(this.writeOnce&&this._written)){return false;}
if(this.validator&&!this.validator.call(owner,value)){return false;}
if(!silent){beforeRetVal=owner.fireBeforeChangeEvent(event);if(beforeRetVal===false){return false;}}
if(this.method){this.method.call(owner,value);}
this.value=value;this._written=true;event.type=name;if(!silent){this.owner.fireChangeEvent(event);}
return true;},configure:function(map,init){map=map||{};this._written=false;this._initialConfig=this._initialConfig||{};for(var key in map){if(key&&YAHOO.lang.hasOwnProperty(map,key)){this[key]=map[key];if(init){this._initialConfig[key]=map[key];}}}},resetValue:function(){return this.setValue(this._initialConfig.value);},resetConfig:function(){this.configure(this._initialConfig);},refresh:function(silent){this.setValue(this.value,silent);}};(function(){var Lang=YAHOO.util.Lang;YAHOO.util.AttributeProvider=function(){};YAHOO.util.AttributeProvider.prototype={_configs:null,get:function(key){var configs=this._configs||{};var config=configs[key];if(!config){return undefined;}
return config.value;},set:function(key,value,silent){var configs=this._configs||{};var config=configs[key];if(!config){return false;}
return config.setValue(value,silent);},getAttributeKeys:function(){var configs=this._configs;var keys=[];var config;for(var key in configs){config=configs[key];if(Lang.hasOwnProperty(configs,key)&&!Lang.isUndefined(config)){keys[keys.length]=key;}}
return keys;},setAttributes:function(map,silent){for(var key in map){if(Lang.hasOwnProperty(map,key)){this.set(key,map[key],silent);}}},resetValue:function(key,silent){var configs=this._configs||{};if(configs[key]){this.set(key,configs[key]._initialConfig.value,silent);return true;}
return false;},refresh:function(key,silent){var configs=this._configs;key=((Lang.isString(key))?[key]:key)||this.getAttributeKeys();for(var i=0,len=key.length;i<len;++i){if(configs[key[i]]&&!Lang.isUndefined(configs[key[i]].value)&&!Lang.isNull(configs[key[i]].value)){configs[key[i]].refresh(silent);}}},register:function(key,map){this.setAttributeConfig(key,map);},getAttributeConfig:function(key){var configs=this._configs||{};var config=configs[key]||{};var map={};for(key in config){if(Lang.hasOwnProperty(config,key)){map[key]=config[key];}}
return map;},setAttributeConfig:function(key,map,init){var configs=this._configs||{};map=map||{};if(!configs[key]){map.name=key;configs[key]=new YAHOO.util.Attribute(map,this);}else{configs[key].configure(map,init);}},configureAttribute:function(key,map,init){this.setAttributeConfig(key,map,init);},resetAttributeConfig:function(key){var configs=this._configs||{};configs[key].resetConfig();},fireBeforeChangeEvent:function(e){var type='before';type+=e.type.charAt(0).toUpperCase()+e.type.substr(1)+'Change';e.type=type;return this.fireEvent(e.type,e);},fireChangeEvent:function(e){e.type+='Change';return this.fireEvent(e.type,e);}};YAHOO.augment(YAHOO.util.AttributeProvider,YAHOO.util.EventProvider);})();(function(){var Dom=YAHOO.util.Dom,AttributeProvider=YAHOO.util.AttributeProvider;YAHOO.util.Element=function(el,map){if(arguments.length){this.init(el,map);}};YAHOO.util.Element.prototype={DOM_EVENTS:null,appendChild:function(child){child=child.get?child.get('element'):child;this.get('element').appendChild(child);},getElementsByTagName:function(tag){return this.get('element').getElementsByTagName(tag);},hasChildNodes:function(){return this.get('element').hasChildNodes();},insertBefore:function(element,before){element=element.get?element.get('element'):element;before=(before&&before.get)?before.get('element'):before;this.get('element').insertBefore(element,before);},removeChild:function(child){child=child.get?child.get('element'):child;this.get('element').removeChild(child);return true;},replaceChild:function(newNode,oldNode){newNode=newNode.get?newNode.get('element'):newNode;oldNode=oldNode.get?oldNode.get('element'):oldNode;return this.get('element').replaceChild(newNode,oldNode);},initAttributes:function(map){},addListener:function(type,fn,obj,scope){var el=this.get('element');scope=scope||this;el=this.get('id')||el;var self=this;if(!this._events[type]){if(this.DOM_EVENTS[type]){YAHOO.util.Event.addListener(el,type,function(e){if(e.srcElement&&!e.target){e.target=e.srcElement;}
self.fireEvent(type,e);},obj,scope);}
this.createEvent(type,this);}
this.subscribe.apply(this,arguments);},on:function(){this.addListener.apply(this,arguments);},removeListener:function(type,fn){this.unsubscribe.apply(this,arguments);},addClass:function(className){Dom.addClass(this.get('element'),className);},getElementsByClassName:function(className,tag){return Dom.getElementsByClassName(className,tag,this.get('element'));},hasClass:function(className){return Dom.hasClass(this.get('element'),className);},removeClass:function(className){return Dom.removeClass(this.get('element'),className);},replaceClass:function(oldClassName,newClassName){return Dom.replaceClass(this.get('element'),oldClassName,newClassName);},setStyle:function(property,value){var el=this.get('element');if(!el){return this._queue[this._queue.length]=['setStyle',arguments];}
return Dom.setStyle(el,property,value);},getStyle:function(property){return Dom.getStyle(this.get('element'),property);},fireQueue:function(){var queue=this._queue;for(var i=0,len=queue.length;i<len;++i){this[queue[i][0]].apply(this,queue[i][1]);}},appendTo:function(parent,before){parent=(parent.get)?parent.get('element'):Dom.get(parent);this.fireEvent('beforeAppendTo',{type:'beforeAppendTo',target:parent});before=(before&&before.get)?before.get('element'):Dom.get(before);var element=this.get('element');if(!element){return false;}
if(!parent){return false;}
if(element.parent!=parent){if(before){parent.insertBefore(element,before);}else{parent.appendChild(element);}}
this.fireEvent('appendTo',{type:'appendTo',target:parent});},get:function(key){var configs=this._configs||{};var el=configs.element;if(el&&!configs[key]&&!YAHOO.lang.isUndefined(el.value[key])){return el.value[key];}
return AttributeProvider.prototype.get.call(this,key);},set:function(key,value,silent){var el=this.get('element');if(!el){this._queue[this._queue.length]=['set',arguments];if(this._configs[key]){this._configs[key].value=value;}
return;}
if(!this._configs[key]&&!YAHOO.lang.isUndefined(el[key])){_registerHTMLAttr.call(this,key);}
return AttributeProvider.prototype.set.apply(this,arguments);},setAttributeConfig:function(key,map,init){var el=this.get('element');if(el&&!this._configs[key]&&!YAHOO.lang.isUndefined(el[key])){_registerHTMLAttr.call(this,key,map);}else{AttributeProvider.prototype.setAttributeConfig.apply(this,arguments);}},getAttributeKeys:function(){var el=this.get('element');var keys=AttributeProvider.prototype.getAttributeKeys.call(this);for(var key in el){if(!this._configs[key]){keys[key]=keys[key]||el[key];}}
return keys;},createEvent:function(type,scope){this._events[type]=true;AttributeProvider.prototype.createEvent.apply(this,arguments);},init:function(el,attr){_initElement.apply(this,arguments);}};var _initElement=function(el,attr){this._queue=this._queue||[];this._events=this._events||{};this._configs=this._configs||{};attr=attr||{};attr.element=attr.element||el||null;this.DOM_EVENTS={'click':true,'dblclick':true,'keydown':true,'keypress':true,'keyup':true,'mousedown':true,'mousemove':true,'mouseout':true,'mouseover':true,'mouseup':true,'focus':true,'blur':true,'submit':true};var isReady=false;if(YAHOO.lang.isString(el)){_registerHTMLAttr.call(this,'id',{value:attr.element});}
if(Dom.get(el)){isReady=true;_initHTMLElement.call(this,attr);_initContent.call(this,attr);}
YAHOO.util.Event.onAvailable(attr.element,function(){if(!isReady){_initHTMLElement.call(this,attr);}
this.fireEvent('available',{type:'available',target:attr.element});},this,true);YAHOO.util.Event.onContentReady(attr.element,function(){if(!isReady){_initContent.call(this,attr);}
this.fireEvent('contentReady',{type:'contentReady',target:attr.element});},this,true);};var _initHTMLElement=function(attr){this.setAttributeConfig('element',{value:Dom.get(attr.element),readOnly:true});};var _initContent=function(attr){this.initAttributes(attr);this.setAttributes(attr,true);this.fireQueue();};var _registerHTMLAttr=function(key,map){var el=this.get('element');map=map||{};map.name=key;map.method=map.method||function(value){el[key]=value;};map.value=map.value||el[key];this._configs[key]=new YAHOO.util.Attribute(map,this);};YAHOO.augment(YAHOO.util.Element,AttributeProvider);})();YAHOO.register("element",YAHOO.util.Element,{version:"2.2.2",build:"204"});YAHOO.util.Config=function(owner){if(owner){this.init(owner);}};YAHOO.util.Config.CONFIG_CHANGED_EVENT="configChanged";YAHOO.util.Config.BOOLEAN_TYPE="boolean";YAHOO.util.Config.prototype={owner:null,queueInProgress:false,config:null,initialConfig:null,eventQueue:null,configChangedEvent:null,checkBoolean:function(val){return(typeof val==YAHOO.util.Config.BOOLEAN_TYPE);},checkNumber:function(val){return(!isNaN(val));},fireEvent:function(key,value){var property=this.config[key];if(property&&property.event){property.event.fire(value);}},addProperty:function(key,propertyObject){key=key.toLowerCase();this.config[key]=propertyObject;propertyObject.event=new YAHOO.util.CustomEvent(key,this.owner);propertyObject.key=key;if(propertyObject.handler){propertyObject.event.subscribe(propertyObject.handler,this.owner);}
this.setProperty(key,propertyObject.value,true);if(!propertyObject.suppressEvent){this.queueProperty(key,propertyObject.value);}},getConfig:function(){var cfg={};for(var prop in this.config){var property=this.config[prop];if(property&&property.event){cfg[prop]=property.value;}}
return cfg;},getProperty:function(key){var property=this.config[key.toLowerCase()];if(property&&property.event){return property.value;}else{return undefined;}},resetProperty:function(key){key=key.toLowerCase();var property=this.config[key];if(property&&property.event){if(this.initialConfig[key]&&!YAHOO.lang.isUndefined(this.initialConfig[key])){this.setProperty(key,this.initialConfig[key]);}
return true;}else{return false;}},setProperty:function(key,value,silent){key=key.toLowerCase();if(this.queueInProgress&&!silent){this.queueProperty(key,value);return true;}else{var property=this.config[key];if(property&&property.event){if(property.validator&&!property.validator(value)){return false;}else{property.value=value;if(!silent){this.fireEvent(key,value);this.configChangedEvent.fire([key,value]);}
return true;}}else{return false;}}},queueProperty:function(key,value){key=key.toLowerCase();var property=this.config[key];if(property&&property.event){if(!YAHOO.lang.isUndefined(value)&&property.validator&&!property.validator(value)){return false;}else{if(!YAHOO.lang.isUndefined(value)){property.value=value;}else{value=property.value;}
var foundDuplicate=false;var iLen=this.eventQueue.length;for(var i=0;i<iLen;i++){var queueItem=this.eventQueue[i];if(queueItem){var queueItemKey=queueItem[0];var queueItemValue=queueItem[1];if(queueItemKey==key){this.eventQueue[i]=null;this.eventQueue.push([key,(!YAHOO.lang.isUndefined(value)?value:queueItemValue)]);foundDuplicate=true;break;}}}
if(!foundDuplicate&&!YAHOO.lang.isUndefined(value)){this.eventQueue.push([key,value]);}}
if(property.supercedes){var sLen=property.supercedes.length;for(var s=0;s<sLen;s++){var supercedesCheck=property.supercedes[s];var qLen=this.eventQueue.length;for(var q=0;q<qLen;q++){var queueItemCheck=this.eventQueue[q];if(queueItemCheck){var queueItemCheckKey=queueItemCheck[0];var queueItemCheckValue=queueItemCheck[1];if(queueItemCheckKey==supercedesCheck.toLowerCase()){this.eventQueue.push([queueItemCheckKey,queueItemCheckValue]);this.eventQueue[q]=null;break;}}}}}
return true;}else{return false;}},refireEvent:function(key){key=key.toLowerCase();var property=this.config[key];if(property&&property.event&&!YAHOO.lang.isUndefined(property.value)){if(this.queueInProgress){this.queueProperty(key);}else{this.fireEvent(key,property.value);}}},applyConfig:function(userConfig,init){if(init){this.initialConfig=userConfig;}
for(var prop in userConfig){this.queueProperty(prop,userConfig[prop]);}},refresh:function(){for(var prop in this.config){this.refireEvent(prop);}},fireQueue:function(){this.queueInProgress=true;for(var i=0;i<this.eventQueue.length;i++){var queueItem=this.eventQueue[i];if(queueItem){var key=queueItem[0];var value=queueItem[1];var property=this.config[key];property.value=value;this.fireEvent(key,value);}}
this.queueInProgress=false;this.eventQueue=[];},subscribeToConfigEvent:function(key,handler,obj,override){var property=this.config[key.toLowerCase()];if(property&&property.event){if(!YAHOO.util.Config.alreadySubscribed(property.event,handler,obj)){property.event.subscribe(handler,obj,override);}
return true;}else{return false;}},unsubscribeFromConfigEvent:function(key,handler,obj){var property=this.config[key.toLowerCase()];if(property&&property.event){return property.event.unsubscribe(handler,obj);}else{return false;}},toString:function(){var output="Config";if(this.owner){output+=" ["+this.owner.toString()+"]";}
return output;},outputEventQueue:function(){var output="";for(var q=0;q<this.eventQueue.length;q++){var queueItem=this.eventQueue[q];if(queueItem){output+=queueItem[0]+"="+queueItem[1]+", ";}}
return output;}};YAHOO.util.Config.prototype.init=function(owner){this.owner=owner;this.configChangedEvent=new YAHOO.util.CustomEvent(YAHOO.util.CONFIG_CHANGED_EVENT,this);this.queueInProgress=false;this.config={};this.initialConfig={};this.eventQueue=[];};YAHOO.util.Config.alreadySubscribed=function(evt,fn,obj){for(var e=0;e<evt.subscribers.length;e++){var subsc=evt.subscribers[e];if(subsc&&subsc.obj==obj&&subsc.fn==fn){return true;}}
return false;};YAHOO.widget.Module=function(el,userConfig){if(el){this.init(el,userConfig);}else{}};YAHOO.widget.Module.IMG_ROOT=null;YAHOO.widget.Module.IMG_ROOT_SSL=null;YAHOO.widget.Module.CSS_MODULE="yui-module";YAHOO.widget.Module.CSS_HEADER="hd";YAHOO.widget.Module.CSS_BODY="bd";YAHOO.widget.Module.CSS_FOOTER="ft";YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL="javascript:false;";YAHOO.widget.Module.textResizeEvent=new YAHOO.util.CustomEvent("textResize");YAHOO.widget.Module._EVENT_TYPES={"BEFORE_INIT":"beforeInit","INIT":"init","APPEND":"append","BEFORE_RENDER":"beforeRender","RENDER":"render","CHANGE_HEADER":"changeHeader","CHANGE_BODY":"changeBody","CHANGE_FOOTER":"changeFooter","CHANGE_CONTENT":"changeContent","DESTORY":"destroy","BEFORE_SHOW":"beforeShow","SHOW":"show","BEFORE_HIDE":"beforeHide","HIDE":"hide"};YAHOO.widget.Module._DEFAULT_CONFIG={"VISIBLE":{key:"visible",value:true,validator:YAHOO.lang.isBoolean},"EFFECT":{key:"effect",suppressEvent:true,supercedes:["visible"]},"MONITOR_RESIZE":{key:"monitorresize",value:true}};YAHOO.widget.Module.prototype={constructor:YAHOO.widget.Module,element:null,header:null,body:null,footer:null,id:null,imageRoot:YAHOO.widget.Module.IMG_ROOT,initEvents:function(){var EVENT_TYPES=YAHOO.widget.Module._EVENT_TYPES;this.beforeInitEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_INIT,this);this.initEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.INIT,this);this.appendEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.APPEND,this);this.beforeRenderEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_RENDER,this);this.renderEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.RENDER,this);this.changeHeaderEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_HEADER,this);this.changeBodyEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_BODY,this);this.changeFooterEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_FOOTER,this);this.changeContentEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.CHANGE_CONTENT,this);this.destroyEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.DESTORY,this);this.beforeShowEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_SHOW,this);this.showEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.SHOW,this);this.beforeHideEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_HIDE,this);this.hideEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.HIDE,this);},platform:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1){return"windows";}else if(ua.indexOf("macintosh")!=-1){return"mac";}else{return false;}}(),browser:function(){var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1){return'opera';}else if(ua.indexOf('msie 7')!=-1){return'ie7';}else if(ua.indexOf('msie')!=-1){return'ie';}else if(ua.indexOf('safari')!=-1){return'safari';}else if(ua.indexOf('gecko')!=-1){return'gecko';}else{return false;}}(),isSecure:function(){if(window.location.href.toLowerCase().indexOf("https")===0){return true;}else{return false;}}(),initDefaultConfig:function(){var DEFAULT_CONFIG=YAHOO.widget.Module._DEFAULT_CONFIG;this.cfg.addProperty(DEFAULT_CONFIG.VISIBLE.key,{handler:this.configVisible,value:DEFAULT_CONFIG.VISIBLE.value,validator:DEFAULT_CONFIG.VISIBLE.validator});this.cfg.addProperty(DEFAULT_CONFIG.EFFECT.key,{suppressEvent:DEFAULT_CONFIG.EFFECT.suppressEvent,supercedes:DEFAULT_CONFIG.EFFECT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.MONITOR_RESIZE.key,{handler:this.configMonitorResize,value:DEFAULT_CONFIG.MONITOR_RESIZE.value});},init:function(el,userConfig){this.initEvents();this.beforeInitEvent.fire(YAHOO.widget.Module);this.cfg=new YAHOO.util.Config(this);if(this.isSecure){this.imageRoot=YAHOO.widget.Module.IMG_ROOT_SSL;}
if(typeof el=="string"){var elId=el;el=document.getElementById(el);if(!el){el=document.createElement("div");el.id=elId;}}
this.element=el;if(el.id){this.id=el.id;}
var childNodes=this.element.childNodes;if(childNodes){for(var i=0;i<childNodes.length;i++){var child=childNodes[i];switch(child.className){case YAHOO.widget.Module.CSS_HEADER:this.header=child;break;case YAHOO.widget.Module.CSS_BODY:this.body=child;break;case YAHOO.widget.Module.CSS_FOOTER:this.footer=child;break;}}}
this.initDefaultConfig();YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Module.CSS_MODULE);if(userConfig){this.cfg.applyConfig(userConfig,true);}
if(!YAHOO.util.Config.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}
this.initEvent.fire(YAHOO.widget.Module);},initResizeMonitor:function(){if(this.browser!="opera"){var resizeMonitor=document.getElementById("_yuiResizeMonitor");if(!resizeMonitor){resizeMonitor=document.createElement("iframe");var bIE=(this.browser.indexOf("ie")===0);if(this.isSecure&&YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL&&bIE){resizeMonitor.src=YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL;}
resizeMonitor.id="_yuiResizeMonitor";resizeMonitor.style.visibility="hidden";document.body.appendChild(resizeMonitor);resizeMonitor.style.width="10em";resizeMonitor.style.height="10em";resizeMonitor.style.position="absolute";var nLeft=-1*resizeMonitor.offsetWidth;var nTop=-1*resizeMonitor.offsetHeight;resizeMonitor.style.top=nTop+"px";resizeMonitor.style.left=nLeft+"px";resizeMonitor.style.borderStyle="none";resizeMonitor.style.borderWidth="0";YAHOO.util.Dom.setStyle(resizeMonitor,"opacity","0");resizeMonitor.style.visibility="visible";if(!bIE){var doc=resizeMonitor.contentWindow.document;doc.open();doc.close();}}
var fireTextResize=function(){YAHOO.widget.Module.textResizeEvent.fire();};if(resizeMonitor&&resizeMonitor.contentWindow){this.resizeMonitor=resizeMonitor;YAHOO.widget.Module.textResizeEvent.subscribe(this.onDomResize,this,true);if(!YAHOO.widget.Module.textResizeInitialized){if(!YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow,"resize",fireTextResize)){YAHOO.util.Event.addListener(this.resizeMonitor,"resize",fireTextResize);}
YAHOO.widget.Module.textResizeInitialized=true;}}}},onDomResize:function(e,obj){var nLeft=-1*this.resizeMonitor.offsetWidth,nTop=-1*this.resizeMonitor.offsetHeight;this.resizeMonitor.style.top=nTop+"px";this.resizeMonitor.style.left=nLeft+"px";},setHeader:function(headerContent){if(!this.header){this.header=document.createElement("div");this.header.className=YAHOO.widget.Module.CSS_HEADER;}
if(typeof headerContent=="string"){this.header.innerHTML=headerContent;}else{this.header.innerHTML="";this.header.appendChild(headerContent);}
this.changeHeaderEvent.fire(headerContent);this.changeContentEvent.fire();},appendToHeader:function(element){if(!this.header){this.header=document.createElement("div");this.header.className=YAHOO.widget.Module.CSS_HEADER;}
this.header.appendChild(element);this.changeHeaderEvent.fire(element);this.changeContentEvent.fire();},setBody:function(bodyContent){if(!this.body){this.body=document.createElement("div");this.body.className=YAHOO.widget.Module.CSS_BODY;}
if(typeof bodyContent=="string")
{this.body.innerHTML=bodyContent;}else{this.body.innerHTML="";this.body.appendChild(bodyContent);}
this.changeBodyEvent.fire(bodyContent);this.changeContentEvent.fire();},appendToBody:function(element){if(!this.body){this.body=document.createElement("div");this.body.className=YAHOO.widget.Module.CSS_BODY;}
this.body.appendChild(element);this.changeBodyEvent.fire(element);this.changeContentEvent.fire();},setFooter:function(footerContent){if(!this.footer){this.footer=document.createElement("div");this.footer.className=YAHOO.widget.Module.CSS_FOOTER;}
if(typeof footerContent=="string"){this.footer.innerHTML=footerContent;}else{this.footer.innerHTML="";this.footer.appendChild(footerContent);}
this.changeFooterEvent.fire(footerContent);this.changeContentEvent.fire();},appendToFooter:function(element){if(!this.footer){this.footer=document.createElement("div");this.footer.className=YAHOO.widget.Module.CSS_FOOTER;}
this.footer.appendChild(element);this.changeFooterEvent.fire(element);this.changeContentEvent.fire();},render:function(appendToNode,moduleElement){this.beforeRenderEvent.fire();if(!moduleElement){moduleElement=this.element;}
var me=this;var appendTo=function(element){if(typeof element=="string"){element=document.getElementById(element);}
if(element){element.appendChild(me.element);me.appendEvent.fire();}};if(appendToNode){appendTo(appendToNode);}else{if(!YAHOO.util.Dom.inDocument(this.element)){return false;}}
if(this.header&&!YAHOO.util.Dom.inDocument(this.header)){var firstChild=moduleElement.firstChild;if(firstChild){moduleElement.insertBefore(this.header,firstChild);}else{moduleElement.appendChild(this.header);}}
if(this.body&&!YAHOO.util.Dom.inDocument(this.body)){if(this.footer&&YAHOO.util.Dom.isAncestor(this.moduleElement,this.footer)){moduleElement.insertBefore(this.body,this.footer);}else{moduleElement.appendChild(this.body);}}
if(this.footer&&!YAHOO.util.Dom.inDocument(this.footer)){moduleElement.appendChild(this.footer);}
this.renderEvent.fire();return true;},destroy:function(){var parent;if(this.element){YAHOO.util.Event.purgeElement(this.element,true);parent=this.element.parentNode;}
if(parent){parent.removeChild(this.element);}
this.element=null;this.header=null;this.body=null;this.footer=null;for(var e in this){if(e instanceof YAHOO.util.CustomEvent){e.unsubscribeAll();}}
YAHOO.widget.Module.textResizeEvent.unsubscribe(this.onDomResize,this);this.destroyEvent.fire();},show:function(){this.cfg.setProperty("visible",true);},hide:function(){this.cfg.setProperty("visible",false);},configVisible:function(type,args,obj){var visible=args[0];if(visible){this.beforeShowEvent.fire();YAHOO.util.Dom.setStyle(this.element,"display","block");this.showEvent.fire();}else{this.beforeHideEvent.fire();YAHOO.util.Dom.setStyle(this.element,"display","none");this.hideEvent.fire();}},configMonitorResize:function(type,args,obj){var monitor=args[0];if(monitor){this.initResizeMonitor();}else{YAHOO.widget.Module.textResizeEvent.unsubscribe(this.onDomResize,this,true);this.resizeMonitor=null;}}};YAHOO.widget.Module.prototype.toString=function(){return"Module "+this.id;};YAHOO.widget.Overlay=function(el,userConfig){YAHOO.widget.Overlay.superclass.constructor.call(this,el,userConfig);};YAHOO.extend(YAHOO.widget.Overlay,YAHOO.widget.Module);YAHOO.widget.Overlay._EVENT_TYPES={"BEFORE_MOVE":"beforeMove","MOVE":"move"};YAHOO.widget.Overlay._DEFAULT_CONFIG={"X":{key:"x",validator:YAHOO.lang.isNumber,suppressEvent:true,supercedes:["iframe"]},"Y":{key:"y",validator:YAHOO.lang.isNumber,suppressEvent:true,supercedes:["iframe"]},"XY":{key:"xy",suppressEvent:true,supercedes:["iframe"]},"CONTEXT":{key:"context",suppressEvent:true,supercedes:["iframe"]},"FIXED_CENTER":{key:"fixedcenter",value:false,validator:YAHOO.lang.isBoolean,supercedes:["iframe","visible"]},"WIDTH":{key:"width",suppressEvent:true,supercedes:["iframe"]},"HEIGHT":{key:"height",suppressEvent:true,supercedes:["iframe"]},"ZINDEX":{key:"zindex",value:null},"CONSTRAIN_TO_VIEWPORT":{key:"constraintoviewport",value:false,validator:YAHOO.lang.isBoolean,supercedes:["iframe","x","y","xy"]},"IFRAME":{key:"iframe",value:(YAHOO.widget.Module.prototype.browser=="ie"?true:false),validator:YAHOO.lang.isBoolean,supercedes:["zIndex"]}};YAHOO.widget.Overlay.IFRAME_SRC="javascript:false;";YAHOO.widget.Overlay.TOP_LEFT="tl";YAHOO.widget.Overlay.TOP_RIGHT="tr";YAHOO.widget.Overlay.BOTTOM_LEFT="bl";YAHOO.widget.Overlay.BOTTOM_RIGHT="br";YAHOO.widget.Overlay.CSS_OVERLAY="yui-overlay";YAHOO.widget.Overlay.prototype.init=function(el,userConfig){YAHOO.widget.Overlay.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Overlay);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Overlay.CSS_OVERLAY);if(userConfig){this.cfg.applyConfig(userConfig,true);}
if(this.platform=="mac"&&this.browser=="gecko"){if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)){this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)){this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);}}
this.initEvent.fire(YAHOO.widget.Overlay);};YAHOO.widget.Overlay.prototype.initEvents=function(){YAHOO.widget.Overlay.superclass.initEvents.call(this);var EVENT_TYPES=YAHOO.widget.Overlay._EVENT_TYPES;this.beforeMoveEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_MOVE,this);this.moveEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.MOVE,this);};YAHOO.widget.Overlay.prototype.initDefaultConfig=function(){YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);var DEFAULT_CONFIG=YAHOO.widget.Overlay._DEFAULT_CONFIG;this.cfg.addProperty(DEFAULT_CONFIG.X.key,{handler:this.configX,validator:DEFAULT_CONFIG.X.validator,suppressEvent:DEFAULT_CONFIG.X.suppressEvent,supercedes:DEFAULT_CONFIG.X.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.Y.key,{handler:this.configY,validator:DEFAULT_CONFIG.Y.validator,suppressEvent:DEFAULT_CONFIG.Y.suppressEvent,supercedes:DEFAULT_CONFIG.Y.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.XY.key,{handler:this.configXY,suppressEvent:DEFAULT_CONFIG.XY.suppressEvent,supercedes:DEFAULT_CONFIG.XY.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.CONTEXT.key,{handler:this.configContext,suppressEvent:DEFAULT_CONFIG.CONTEXT.suppressEvent,supercedes:DEFAULT_CONFIG.CONTEXT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.FIXED_CENTER.key,{handler:this.configFixedCenter,value:DEFAULT_CONFIG.FIXED_CENTER.value,validator:DEFAULT_CONFIG.FIXED_CENTER.validator,supercedes:DEFAULT_CONFIG.FIXED_CENTER.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.WIDTH.key,{handler:this.configWidth,suppressEvent:DEFAULT_CONFIG.WIDTH.suppressEvent,supercedes:DEFAULT_CONFIG.WIDTH.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.HEIGHT.key,{handler:this.configHeight,suppressEvent:DEFAULT_CONFIG.HEIGHT.suppressEvent,supercedes:DEFAULT_CONFIG.HEIGHT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.ZINDEX.key,{handler:this.configzIndex,value:DEFAULT_CONFIG.ZINDEX.value});this.cfg.addProperty(DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.key,{handler:this.configConstrainToViewport,value:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.value,validator:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.validator,supercedes:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.IFRAME.key,{handler:this.configIframe,value:DEFAULT_CONFIG.IFRAME.value,validator:DEFAULT_CONFIG.IFRAME.validator,supercedes:DEFAULT_CONFIG.IFRAME.supercedes});};YAHOO.widget.Overlay.prototype.moveTo=function(x,y){this.cfg.setProperty("xy",[x,y]);};YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"show-scrollbars");YAHOO.util.Dom.addClass(this.element,"hide-scrollbars");};YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars=function(){YAHOO.util.Dom.removeClass(this.element,"hide-scrollbars");YAHOO.util.Dom.addClass(this.element,"show-scrollbars");};YAHOO.widget.Overlay.prototype.configVisible=function(type,args,obj){var visible=args[0];var currentVis=YAHOO.util.Dom.getStyle(this.element,"visibility");if(currentVis=="inherit"){var e=this.element.parentNode;while(e.nodeType!=9&&e.nodeType!=11){currentVis=YAHOO.util.Dom.getStyle(e,"visibility");if(currentVis!="inherit"){break;}
e=e.parentNode;}
if(currentVis=="inherit"){currentVis="visible";}}
var effect=this.cfg.getProperty("effect");var effectInstances=[];if(effect){if(effect instanceof Array){for(var i=0;i<effect.length;i++){var eff=effect[i];effectInstances[effectInstances.length]=eff.effect(this,eff.duration);}}else{effectInstances[effectInstances.length]=effect.effect(this,effect.duration);}}
var isMacGecko=(this.platform=="mac"&&this.browser=="gecko");if(visible){if(isMacGecko){this.showMacGeckoScrollbars();}
if(effect){if(visible){if(currentVis!="visible"||currentVis===""){this.beforeShowEvent.fire();for(var j=0;j<effectInstances.length;j++){var ei=effectInstances[j];if(j===0&&!YAHOO.util.Config.alreadySubscribed(ei.animateInCompleteEvent,this.showEvent.fire,this.showEvent)){ei.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true);}
ei.animateIn();}}}}else{if(currentVis!="visible"||currentVis===""){this.beforeShowEvent.fire();YAHOO.util.Dom.setStyle(this.element,"visibility","visible");this.cfg.refireEvent("iframe");this.showEvent.fire();}}}else{if(isMacGecko){this.hideMacGeckoScrollbars();}
if(effect){if(currentVis=="visible"){this.beforeHideEvent.fire();for(var k=0;k<effectInstances.length;k++){var h=effectInstances[k];if(k===0&&!YAHOO.util.Config.alreadySubscribed(h.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)){h.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true);}
h.animateOut();}}else if(currentVis===""){YAHOO.util.Dom.setStyle(this.element,"visibility","hidden");}}else{if(currentVis=="visible"||currentVis===""){this.beforeHideEvent.fire();YAHOO.util.Dom.setStyle(this.element,"visibility","hidden");this.cfg.refireEvent("iframe");this.hideEvent.fire();}}}};YAHOO.widget.Overlay.prototype.doCenterOnDOMEvent=function(){if(this.cfg.getProperty("visible")){this.center();}};YAHOO.widget.Overlay.prototype.configFixedCenter=function(type,args,obj){var val=args[0];if(val){this.center();if(!YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent,this.center,this)){this.beforeShowEvent.subscribe(this.center,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent,this.doCenterOnDOMEvent,this)){YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.doCenterOnDOMEvent,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowScrollEvent,this.doCenterOnDOMEvent,this)){YAHOO.widget.Overlay.windowScrollEvent.subscribe(this.doCenterOnDOMEvent,this,true);}}else{YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);}};YAHOO.widget.Overlay.prototype.configHeight=function(type,args,obj){var height=args[0];var el=this.element;YAHOO.util.Dom.setStyle(el,"height",height);this.cfg.refireEvent("iframe");};YAHOO.widget.Overlay.prototype.configWidth=function(type,args,obj){var width=args[0];var el=this.element;YAHOO.util.Dom.setStyle(el,"width",width);this.cfg.refireEvent("iframe");};YAHOO.widget.Overlay.prototype.configzIndex=function(type,args,obj){var zIndex=args[0];var el=this.element;if(!zIndex){zIndex=YAHOO.util.Dom.getStyle(el,"zIndex");if(!zIndex||isNaN(zIndex)){zIndex=0;}}
if(this.iframe){if(zIndex<=0){zIndex=1;}
YAHOO.util.Dom.setStyle(this.iframe,"zIndex",(zIndex-1));}
YAHOO.util.Dom.setStyle(el,"zIndex",zIndex);this.cfg.setProperty("zIndex",zIndex,true);};YAHOO.widget.Overlay.prototype.configXY=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];this.cfg.setProperty("x",x);this.cfg.setProperty("y",y);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);};YAHOO.widget.Overlay.prototype.configX=function(type,args,obj){var x=args[0];var y=this.cfg.getProperty("y");this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");YAHOO.util.Dom.setX(this.element,x,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);};YAHOO.widget.Overlay.prototype.configY=function(type,args,obj){var x=this.cfg.getProperty("x");var y=args[0];this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.beforeMoveEvent.fire([x,y]);x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");YAHOO.util.Dom.setY(this.element,y,true);this.cfg.setProperty("xy",[x,y],true);this.cfg.refireEvent("iframe");this.moveEvent.fire([x,y]);};YAHOO.widget.Overlay.prototype.showIframe=function(){if(this.iframe){this.iframe.style.display="block";}};YAHOO.widget.Overlay.prototype.hideIframe=function(){if(this.iframe){this.iframe.style.display="none";}};YAHOO.widget.Overlay.prototype.configIframe=function(type,args,obj){var val=args[0];if(val){if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showIframe,this)){this.showEvent.subscribe(this.showIframe,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideIframe,this)){this.hideEvent.subscribe(this.hideIframe,this,true);}
var x=this.cfg.getProperty("x");var y=this.cfg.getProperty("y");if(!x||!y){this.syncPosition();x=this.cfg.getProperty("x");y=this.cfg.getProperty("y");}
if(!isNaN(x)&&!isNaN(y)){if(!this.iframe){this.iframe=document.createElement("iframe");if(this.isSecure){this.iframe.src=YAHOO.widget.Overlay.IFRAME_SRC;}
var parent=this.element.parentNode;if(parent){parent.appendChild(this.iframe);}else{document.body.appendChild(this.iframe);}
YAHOO.util.Dom.setStyle(this.iframe,"position","absolute");YAHOO.util.Dom.setStyle(this.iframe,"border","none");YAHOO.util.Dom.setStyle(this.iframe,"margin","0");YAHOO.util.Dom.setStyle(this.iframe,"padding","0");YAHOO.util.Dom.setStyle(this.iframe,"opacity","0");if(this.cfg.getProperty("visible")){this.showIframe();}else{this.hideIframe();}}
var iframeDisplay=YAHOO.util.Dom.getStyle(this.iframe,"display");if(iframeDisplay=="none"){this.iframe.style.display="block";}
YAHOO.util.Dom.setXY(this.iframe,[x,y]);var width=this.element.clientWidth;var height=this.element.clientHeight;YAHOO.util.Dom.setStyle(this.iframe,"width",(width+2)+"px");YAHOO.util.Dom.setStyle(this.iframe,"height",(height+2)+"px");if(iframeDisplay=="none"){this.iframe.style.display="none";}}}else{if(this.iframe){this.iframe.style.display="none";}
this.showEvent.unsubscribe(this.showIframe,this);this.hideEvent.unsubscribe(this.hideIframe,this);}};YAHOO.widget.Overlay.prototype.configConstrainToViewport=function(type,args,obj){var val=args[0];if(val){if(!YAHOO.util.Config.alreadySubscribed(this.beforeMoveEvent,this.enforceConstraints,this)){this.beforeMoveEvent.subscribe(this.enforceConstraints,this,true);}}else{this.beforeMoveEvent.unsubscribe(this.enforceConstraints,this);}};YAHOO.widget.Overlay.prototype.configContext=function(type,args,obj){var contextArgs=args[0];if(contextArgs){var contextEl=contextArgs[0];var elementMagnetCorner=contextArgs[1];var contextMagnetCorner=contextArgs[2];if(contextEl){if(typeof contextEl=="string"){this.cfg.setProperty("context",[document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner],true);}
if(elementMagnetCorner&&contextMagnetCorner){this.align(elementMagnetCorner,contextMagnetCorner);}}}};YAHOO.widget.Overlay.prototype.align=function(elementAlign,contextAlign){var contextArgs=this.cfg.getProperty("context");if(contextArgs){var context=contextArgs[0];var element=this.element;var me=this;if(!elementAlign){elementAlign=contextArgs[1];}
if(!contextAlign){contextAlign=contextArgs[2];}
if(element&&context){var contextRegion=YAHOO.util.Dom.getRegion(context);var doAlign=function(v,h){switch(elementAlign){case YAHOO.widget.Overlay.TOP_LEFT:me.moveTo(h,v);break;case YAHOO.widget.Overlay.TOP_RIGHT:me.moveTo(h-element.offsetWidth,v);break;case YAHOO.widget.Overlay.BOTTOM_LEFT:me.moveTo(h,v-element.offsetHeight);break;case YAHOO.widget.Overlay.BOTTOM_RIGHT:me.moveTo(h-element.offsetWidth,v-element.offsetHeight);break;}};switch(contextAlign){case YAHOO.widget.Overlay.TOP_LEFT:doAlign(contextRegion.top,contextRegion.left);break;case YAHOO.widget.Overlay.TOP_RIGHT:doAlign(contextRegion.top,contextRegion.right);break;case YAHOO.widget.Overlay.BOTTOM_LEFT:doAlign(contextRegion.bottom,contextRegion.left);break;case YAHOO.widget.Overlay.BOTTOM_RIGHT:doAlign(contextRegion.bottom,contextRegion.right);break;}}}};YAHOO.widget.Overlay.prototype.enforceConstraints=function(type,args,obj){var pos=args[0];var x=pos[0];var y=pos[1];var offsetHeight=this.element.offsetHeight;var offsetWidth=this.element.offsetWidth;var viewPortWidth=YAHOO.util.Dom.getViewportWidth();var viewPortHeight=YAHOO.util.Dom.getViewportHeight();var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;var topConstraint=scrollY+10;var leftConstraint=scrollX+10;var bottomConstraint=scrollY+viewPortHeight-offsetHeight-10;var rightConstraint=scrollX+viewPortWidth-offsetWidth-10;if(x<leftConstraint){x=leftConstraint;}else if(x>rightConstraint){x=rightConstraint;}
if(y<topConstraint){y=topConstraint;}else if(y>bottomConstraint){y=bottomConstraint;}
this.cfg.setProperty("x",x,true);this.cfg.setProperty("y",y,true);this.cfg.setProperty("xy",[x,y],true);};YAHOO.widget.Overlay.prototype.center=function(){var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;var viewPortWidth=YAHOO.util.Dom.getClientWidth();var viewPortHeight=YAHOO.util.Dom.getClientHeight();var elementWidth=this.element.offsetWidth;var elementHeight=this.element.offsetHeight;var x=(viewPortWidth/2)-(elementWidth/2)+scrollX;var y=(viewPortHeight/2)-(elementHeight/2)+scrollY;this.cfg.setProperty("xy",[parseInt(x,10),parseInt(y,10)]);this.cfg.refireEvent("iframe");};YAHOO.widget.Overlay.prototype.syncPosition=function(){var pos=YAHOO.util.Dom.getXY(this.element);this.cfg.setProperty("x",pos[0],true);this.cfg.setProperty("y",pos[1],true);this.cfg.setProperty("xy",pos,true);};YAHOO.widget.Overlay.prototype.onDomResize=function(e,obj){YAHOO.widget.Overlay.superclass.onDomResize.call(this,e,obj);var me=this;setTimeout(function(){me.syncPosition();me.cfg.refireEvent("iframe");me.cfg.refireEvent("context");},0);};YAHOO.widget.Overlay.prototype.destroy=function(){if(this.iframe){this.iframe.parentNode.removeChild(this.iframe);}
this.iframe=null;YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);YAHOO.widget.Overlay.superclass.destroy.call(this);};YAHOO.widget.Overlay.prototype.toString=function(){return"Overlay "+this.id;};YAHOO.widget.Overlay.windowScrollEvent=new YAHOO.util.CustomEvent("windowScroll");YAHOO.widget.Overlay.windowResizeEvent=new YAHOO.util.CustomEvent("windowResize");YAHOO.widget.Overlay.windowScrollHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.scrollEnd){window.scrollEnd=-1;}
clearTimeout(window.scrollEnd);window.scrollEnd=setTimeout(function(){YAHOO.widget.Overlay.windowScrollEvent.fire();},1);}else{YAHOO.widget.Overlay.windowScrollEvent.fire();}};YAHOO.widget.Overlay.windowResizeHandler=function(e){if(YAHOO.widget.Module.prototype.browser=="ie"||YAHOO.widget.Module.prototype.browser=="ie7"){if(!window.resizeEnd){window.resizeEnd=-1;}
clearTimeout(window.resizeEnd);window.resizeEnd=setTimeout(function(){YAHOO.widget.Overlay.windowResizeEvent.fire();},100);}else{YAHOO.widget.Overlay.windowResizeEvent.fire();}};YAHOO.widget.Overlay._initialized=null;if(YAHOO.widget.Overlay._initialized===null){YAHOO.util.Event.addListener(window,"scroll",YAHOO.widget.Overlay.windowScrollHandler);YAHOO.util.Event.addListener(window,"resize",YAHOO.widget.Overlay.windowResizeHandler);YAHOO.widget.Overlay._initialized=true;}
YAHOO.widget.OverlayManager=function(userConfig){this.init(userConfig);};YAHOO.widget.OverlayManager.CSS_FOCUSED="focused";YAHOO.widget.OverlayManager.prototype={constructor:YAHOO.widget.OverlayManager,overlays:null,initDefaultConfig:function(){this.cfg.addProperty("overlays",{suppressEvent:true});this.cfg.addProperty("focusevent",{value:"mousedown"});},init:function(userConfig){this.cfg=new YAHOO.util.Config(this);this.initDefaultConfig();if(userConfig){this.cfg.applyConfig(userConfig,true);}
this.cfg.fireQueue();var activeOverlay=null;this.getActive=function(){return activeOverlay;};this.focus=function(overlay){var o=this.find(overlay);if(o){if(activeOverlay!=o){if(activeOverlay){activeOverlay.blur();}
activeOverlay=o;YAHOO.util.Dom.addClass(activeOverlay.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.overlays.sort(this.compareZIndexDesc);var topZIndex=YAHOO.util.Dom.getStyle(this.overlays[0].element,"zIndex");if(!isNaN(topZIndex)&&this.overlays[0]!=overlay){activeOverlay.cfg.setProperty("zIndex",(parseInt(topZIndex,10)+2));}
this.overlays.sort(this.compareZIndexDesc);o.focusEvent.fire();}}};this.remove=function(overlay){var o=this.find(overlay);if(o){var originalZ=YAHOO.util.Dom.getStyle(o.element,"zIndex");o.cfg.setProperty("zIndex",-1000,true);this.overlays.sort(this.compareZIndexDesc);this.overlays=this.overlays.slice(0,this.overlays.length-1);o.hideEvent.unsubscribe(o.blur);o.destroyEvent.unsubscribe(this._onOverlayDestroy,o);if(o.element){YAHOO.util.Event.removeListener(o.element,this.cfg.getProperty("focusevent"),this._onOverlayElementFocus);}
o.cfg.setProperty("zIndex",originalZ,true);o.cfg.setProperty("manager",null);o.focusEvent.unsubscribeAll();o.blurEvent.unsubscribeAll();o.focusEvent=null;o.blurEvent=null;o.focus=null;o.blur=null;}};this.blurAll=function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].blur();}};this._onOverlayBlur=function(p_sType,p_aArgs){activeOverlay=null;};var overlays=this.cfg.getProperty("overlays");if(!this.overlays){this.overlays=[];}
if(overlays){this.register(overlays);this.overlays.sort(this.compareZIndexDesc);}},_onOverlayElementFocus:function(p_oEvent){var oTarget=YAHOO.util.Event.getTarget(p_oEvent),oClose=this.close;if(oClose&&(oTarget==oClose||YAHOO.util.Dom.isAncestor(oClose,oTarget))){this.blur();}
else{this.focus();}},_onOverlayDestroy:function(p_sType,p_aArgs,p_oOverlay){this.remove(p_oOverlay);},register:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){overlay.cfg.addProperty("manager",{value:this});overlay.focusEvent=new YAHOO.util.CustomEvent("focus",overlay);overlay.blurEvent=new YAHOO.util.CustomEvent("blur",overlay);var mgr=this;overlay.focus=function(){mgr.focus(this);};overlay.blur=function(){if(mgr.getActive()==this){YAHOO.util.Dom.removeClass(this.element,YAHOO.widget.OverlayManager.CSS_FOCUSED);this.blurEvent.fire();}};overlay.blurEvent.subscribe(mgr._onOverlayBlur);overlay.hideEvent.subscribe(overlay.blur);overlay.destroyEvent.subscribe(this._onOverlayDestroy,overlay,this);YAHOO.util.Event.addListener(overlay.element,this.cfg.getProperty("focusevent"),this._onOverlayElementFocus,null,overlay);var zIndex=YAHOO.util.Dom.getStyle(overlay.element,"zIndex");if(!isNaN(zIndex)){overlay.cfg.setProperty("zIndex",parseInt(zIndex,10));}else{overlay.cfg.setProperty("zIndex",0);}
this.overlays.push(overlay);return true;}else if(overlay instanceof Array){var regcount=0;for(var i=0;i<overlay.length;i++){if(this.register(overlay[i])){regcount++;}}
if(regcount>0){return true;}}else{return false;}},find:function(overlay){if(overlay instanceof YAHOO.widget.Overlay){for(var o=0;o<this.overlays.length;o++){if(this.overlays[o]==overlay){return this.overlays[o];}}}else if(typeof overlay=="string"){for(var p=0;p<this.overlays.length;p++){if(this.overlays[p].id==overlay){return this.overlays[p];}}}
return null;},compareZIndexDesc:function(o1,o2){var zIndex1=o1.cfg.getProperty("zIndex");var zIndex2=o2.cfg.getProperty("zIndex");if(zIndex1>zIndex2){return-1;}else if(zIndex1<zIndex2){return 1;}else{return 0;}},showAll:function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].show();}},hideAll:function(){for(var o=0;o<this.overlays.length;o++){this.overlays[o].hide();}},toString:function(){return"OverlayManager";}};YAHOO.widget.Tooltip=function(el,userConfig){YAHOO.widget.Tooltip.superclass.constructor.call(this,el,userConfig);};YAHOO.extend(YAHOO.widget.Tooltip,YAHOO.widget.Overlay);YAHOO.widget.Tooltip.CSS_TOOLTIP="yui-tt";YAHOO.widget.Tooltip._DEFAULT_CONFIG={"PREVENT_OVERLAP":{key:"preventoverlap",value:true,validator:YAHOO.lang.isBoolean,supercedes:["x","y","xy"]},"SHOW_DELAY":{key:"showdelay",value:200,validator:YAHOO.lang.isNumber},"AUTO_DISMISS_DELAY":{key:"autodismissdelay",value:5000,validator:YAHOO.lang.isNumber},"HIDE_DELAY":{key:"hidedelay",value:250,validator:YAHOO.lang.isNumber},"TEXT":{key:"text",suppressEvent:true},"CONTAINER":{key:"container"}};YAHOO.widget.Tooltip.prototype.init=function(el,userConfig){if(document.readyState&&document.readyState!="complete"){var deferredInit=function(){this.init(el,userConfig);};YAHOO.util.Event.addListener(window,"load",deferredInit,this,true);}else{YAHOO.widget.Tooltip.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Tooltip);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Tooltip.CSS_TOOLTIP);if(userConfig){this.cfg.applyConfig(userConfig,true);}
this.cfg.queueProperty("visible",false);this.cfg.queueProperty("constraintoviewport",true);this.setBody("");this.render(this.cfg.getProperty("container"));this.initEvent.fire(YAHOO.widget.Tooltip);}};YAHOO.widget.Tooltip.prototype.initDefaultConfig=function(){YAHOO.widget.Tooltip.superclass.initDefaultConfig.call(this);var DEFAULT_CONFIG=YAHOO.widget.Tooltip._DEFAULT_CONFIG;this.cfg.addProperty(DEFAULT_CONFIG.PREVENT_OVERLAP.key,{value:DEFAULT_CONFIG.PREVENT_OVERLAP.value,validator:DEFAULT_CONFIG.PREVENT_OVERLAP.validator,supercedes:DEFAULT_CONFIG.PREVENT_OVERLAP.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.SHOW_DELAY.key,{handler:this.configShowDelay,value:200,validator:DEFAULT_CONFIG.SHOW_DELAY.validator});this.cfg.addProperty(DEFAULT_CONFIG.AUTO_DISMISS_DELAY.key,{handler:this.configAutoDismissDelay,value:DEFAULT_CONFIG.AUTO_DISMISS_DELAY.value,validator:DEFAULT_CONFIG.AUTO_DISMISS_DELAY.validator});this.cfg.addProperty(DEFAULT_CONFIG.HIDE_DELAY.key,{handler:this.configHideDelay,value:DEFAULT_CONFIG.HIDE_DELAY.value,validator:DEFAULT_CONFIG.HIDE_DELAY.validator});this.cfg.addProperty(DEFAULT_CONFIG.TEXT.key,{handler:this.configText,suppressEvent:DEFAULT_CONFIG.TEXT.suppressEvent});this.cfg.addProperty(DEFAULT_CONFIG.CONTAINER.key,{handler:this.configContainer,value:document.body});};YAHOO.widget.Tooltip.prototype.configText=function(type,args,obj){var text=args[0];if(text){this.setBody(text);}};YAHOO.widget.Tooltip.prototype.configContainer=function(type,args,obj){var container=args[0];if(typeof container=='string'){this.cfg.setProperty("container",document.getElementById(container),true);}};YAHOO.widget.Tooltip.prototype._removeEventListeners=function(){var aElements=this._context;if(aElements){var nElements=aElements.length;if(nElements>0){var i=nElements-1,oElement;do{oElement=aElements[i];YAHOO.util.Event.removeListener(oElement,"mouseover",this.onContextMouseOver);YAHOO.util.Event.removeListener(oElement,"mousemove",this.onContextMouseMove);YAHOO.util.Event.removeListener(oElement,"mouseout",this.onContextMouseOut);}
while(i--);}}};YAHOO.widget.Tooltip.prototype.configContext=function(type,args,obj){var context=args[0];if(context){if(!(context instanceof Array)){if(typeof context=="string"){this.cfg.setProperty("context",[document.getElementById(context)],true);}else{this.cfg.setProperty("context",[context],true);}
context=this.cfg.getProperty("context");}
this._removeEventListeners();this._context=context;var aElements=this._context;if(aElements){var nElements=aElements.length;if(nElements>0){var i=nElements-1,oElement;do{oElement=aElements[i];YAHOO.util.Event.addListener(oElement,"mouseover",this.onContextMouseOver,this);YAHOO.util.Event.addListener(oElement,"mousemove",this.onContextMouseMove,this);YAHOO.util.Event.addListener(oElement,"mouseout",this.onContextMouseOut,this);}
while(i--);}}}};YAHOO.widget.Tooltip.prototype.onContextMouseMove=function(e,obj){obj.pageX=YAHOO.util.Event.getPageX(e);obj.pageY=YAHOO.util.Event.getPageY(e);};YAHOO.widget.Tooltip.prototype.onContextMouseOver=function(e,obj){if(obj.hideProcId){clearTimeout(obj.hideProcId);obj.hideProcId=null;}
var context=this;YAHOO.util.Event.addListener(context,"mousemove",obj.onContextMouseMove,obj);if(context.title){obj._tempTitle=context.title;context.title="";}
obj.showProcId=obj.doShow(e,context);};YAHOO.widget.Tooltip.prototype.onContextMouseOut=function(e,obj){var el=this;if(obj._tempTitle){el.title=obj._tempTitle;obj._tempTitle=null;}
if(obj.showProcId){clearTimeout(obj.showProcId);obj.showProcId=null;}
if(obj.hideProcId){clearTimeout(obj.hideProcId);obj.hideProcId=null;}
obj.hideProcId=setTimeout(function(){obj.hide();},obj.cfg.getProperty("hidedelay"));};YAHOO.widget.Tooltip.prototype.doShow=function(e,context){var yOffset=25;if(this.browser=="opera"&&context.tagName&&context.tagName.toUpperCase()=="A"){yOffset+=12;}
var me=this;return setTimeout(function(){if(me._tempTitle){me.setBody(me._tempTitle);}else{me.cfg.refireEvent("text");}
me.moveTo(me.pageX,me.pageY+yOffset);if(me.cfg.getProperty("preventoverlap")){me.preventOverlap(me.pageX,me.pageY);}
YAHOO.util.Event.removeListener(context,"mousemove",me.onContextMouseMove);me.show();me.hideProcId=me.doHide();},this.cfg.getProperty("showdelay"));};YAHOO.widget.Tooltip.prototype.doHide=function(){var me=this;return setTimeout(function(){me.hide();},this.cfg.getProperty("autodismissdelay"));};YAHOO.widget.Tooltip.prototype.preventOverlap=function(pageX,pageY){var height=this.element.offsetHeight;var elementRegion=YAHOO.util.Dom.getRegion(this.element);elementRegion.top-=5;elementRegion.left-=5;elementRegion.right+=5;elementRegion.bottom+=5;var mousePoint=new YAHOO.util.Point(pageX,pageY);if(elementRegion.contains(mousePoint)){this.cfg.setProperty("y",(pageY-height-5));}};YAHOO.widget.Tooltip.prototype.destroy=function(){this._removeEventListeners();YAHOO.widget.Tooltip.superclass.destroy.call(this);};YAHOO.widget.Tooltip.prototype.toString=function(){return"Tooltip "+this.id;};YAHOO.widget.Panel=function(el,userConfig){YAHOO.widget.Panel.superclass.constructor.call(this,el,userConfig);};YAHOO.extend(YAHOO.widget.Panel,YAHOO.widget.Overlay);YAHOO.widget.Panel.CSS_PANEL="yui-panel";YAHOO.widget.Panel.CSS_PANEL_CONTAINER="yui-panel-container";YAHOO.widget.Panel._EVENT_TYPES={"SHOW_MASK":"showMask","HIDE_MASK":"hideMask","DRAG":"drag"};YAHOO.widget.Panel._DEFAULT_CONFIG={"CLOSE":{key:"close",value:true,validator:YAHOO.lang.isBoolean,supercedes:["visible"]},"DRAGGABLE":{key:"draggable",value:(YAHOO.util.DD?true:false),validator:YAHOO.lang.isBoolean,supercedes:["visible"]},"UNDERLAY":{key:"underlay",value:"shadow",supercedes:["visible"]},"MODAL":{key:"modal",value:false,validator:YAHOO.lang.isBoolean,supercedes:["visible"]},"KEY_LISTENERS":{key:"keylisteners",suppressEvent:true,supercedes:["visible"]}};YAHOO.widget.Panel.prototype.init=function(el,userConfig){YAHOO.widget.Panel.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Panel);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Panel.CSS_PANEL);this.buildWrapper();if(userConfig){this.cfg.applyConfig(userConfig,true);}
this.beforeRenderEvent.subscribe(function(){var draggable=this.cfg.getProperty("draggable");if(draggable){if(!this.header){this.setHeader("&#160;");}}},this,true);this.renderEvent.subscribe(function(){var sWidth=this.cfg.getProperty("width");if(!sWidth){this.cfg.setProperty("width",(this.element.offsetWidth+"px"));}});var me=this;var doBlur=function(){this.blur();};this.showMaskEvent.subscribe(function(){var checkFocusable=function(el){var sTagName=el.tagName.toUpperCase(),bFocusable=false;switch(sTagName){case"A":case"BUTTON":case"SELECT":case"TEXTAREA":if(!YAHOO.util.Dom.isAncestor(me.element,el)){YAHOO.util.Event.addListener(el,"focus",doBlur,el,true);bFocusable=true;}
break;case"INPUT":if(el.type!="hidden"&&!YAHOO.util.Dom.isAncestor(me.element,el)){YAHOO.util.Event.addListener(el,"focus",doBlur,el,true);bFocusable=true;}
break;}
return bFocusable;};this.focusableElements=YAHOO.util.Dom.getElementsBy(checkFocusable);},this,true);this.hideMaskEvent.subscribe(function(){for(var i=0;i<this.focusableElements.length;i++){var el2=this.focusableElements[i];YAHOO.util.Event.removeListener(el2,"focus",doBlur);}},this,true);this.beforeShowEvent.subscribe(function(){this.cfg.refireEvent("underlay");},this,true);this.initEvent.fire(YAHOO.widget.Panel);};YAHOO.widget.Panel.prototype.initEvents=function(){YAHOO.widget.Panel.superclass.initEvents.call(this);var EVENT_TYPES=YAHOO.widget.Panel._EVENT_TYPES;this.showMaskEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.SHOW_MASK,this);this.hideMaskEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.HIDE_MASK,this);this.dragEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.DRAG,this);};YAHOO.widget.Panel.prototype.initDefaultConfig=function(){YAHOO.widget.Panel.superclass.initDefaultConfig.call(this);var DEFAULT_CONFIG=YAHOO.widget.Panel._DEFAULT_CONFIG;this.cfg.addProperty(DEFAULT_CONFIG.CLOSE.key,{handler:this.configClose,value:DEFAULT_CONFIG.CLOSE.value,validator:DEFAULT_CONFIG.CLOSE.validator,supercedes:DEFAULT_CONFIG.CLOSE.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.DRAGGABLE.key,{handler:this.configDraggable,value:DEFAULT_CONFIG.DRAGGABLE.value,validator:DEFAULT_CONFIG.DRAGGABLE.validator,supercedes:DEFAULT_CONFIG.DRAGGABLE.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.UNDERLAY.key,{handler:this.configUnderlay,value:DEFAULT_CONFIG.UNDERLAY.value,supercedes:DEFAULT_CONFIG.UNDERLAY.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.MODAL.key,{handler:this.configModal,value:DEFAULT_CONFIG.MODAL.value,validator:DEFAULT_CONFIG.MODAL.validator,supercedes:DEFAULT_CONFIG.MODAL.supercedes});this.cfg.addProperty(DEFAULT_CONFIG.KEY_LISTENERS.key,{handler:this.configKeyListeners,suppressEvent:DEFAULT_CONFIG.KEY_LISTENERS.suppressEvent,supercedes:DEFAULT_CONFIG.KEY_LISTENERS.supercedes});};YAHOO.widget.Panel.prototype.configClose=function(type,args,obj){var val=args[0];var doHide=function(e,obj){obj.hide();};if(val){if(!this.close){this.close=document.createElement("span");YAHOO.util.Dom.addClass(this.close,"container-close");this.close.innerHTML="&#160;";this.innerElement.appendChild(this.close);YAHOO.util.Event.addListener(this.close,"click",doHide,this);}else{this.close.style.display="block";}}else{if(this.close){this.close.style.display="none";}}};YAHOO.widget.Panel.prototype.configDraggable=function(type,args,obj){var val=args[0];if(val){if(!YAHOO.util.DD){this.cfg.setProperty("draggable",false);return;}
if(this.header){YAHOO.util.Dom.setStyle(this.header,"cursor","move");this.registerDragDrop();}}else{if(this.dd){this.dd.unreg();}
if(this.header){YAHOO.util.Dom.setStyle(this.header,"cursor","auto");}}};YAHOO.widget.Panel.prototype.configUnderlay=function(type,args,obj){var val=args[0];switch(val.toLowerCase()){case"shadow":YAHOO.util.Dom.removeClass(this.element,"matte");YAHOO.util.Dom.addClass(this.element,"shadow");if(!this.underlay){this.underlay=document.createElement("div");this.underlay.className="underlay";this.underlay.innerHTML="&#160;";this.element.appendChild(this.underlay);}
this.sizeUnderlay();break;case"matte":YAHOO.util.Dom.removeClass(this.element,"shadow");YAHOO.util.Dom.addClass(this.element,"matte");break;default:YAHOO.util.Dom.removeClass(this.element,"shadow");YAHOO.util.Dom.removeClass(this.element,"matte");break;}};YAHOO.widget.Panel.prototype.configModal=function(type,args,obj){var modal=args[0];if(modal){this.buildMask();if(!YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent,this.showMask,this)){this.beforeShowEvent.subscribe(this.showMask,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMask,this)){this.hideEvent.subscribe(this.hideMask,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent,this.sizeMask,this)){YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.sizeMask,this,true);}
if(!YAHOO.util.Config.alreadySubscribed(this.destroyEvent,this.removeMask,this)){this.destroyEvent.subscribe(this.removeMask,this,true);}
this.cfg.refireEvent("zIndex");}else{this.beforeShowEvent.unsubscribe(this.showMask,this);this.hideEvent.unsubscribe(this.hideMask,this);YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.sizeMask,this);this.destroyEvent.unsubscribe(this.removeMask,this);}};YAHOO.widget.Panel.prototype.removeMask=function(){var oMask=this.mask;if(oMask){this.hideMask();var oParentNode=oMask.parentNode;if(oParentNode){oParentNode.removeChild(oMask);}
this.mask=null;}};YAHOO.widget.Panel.prototype.configKeyListeners=function(type,args,obj){var listeners=args[0];if(listeners){if(listeners instanceof Array){for(var i=0;i<listeners.length;i++){var listener=listeners[i];if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,listener.enable,listener)){this.showEvent.subscribe(listener.enable,listener,true);}
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,listener.disable,listener)){this.hideEvent.subscribe(listener.disable,listener,true);this.destroyEvent.subscribe(listener.disable,listener,true);}}}else{if(!YAHOO.util.Config.alreadySubscribed(this.showEvent,listeners.enable,listeners)){this.showEvent.subscribe(listeners.enable,listeners,true);}
if(!YAHOO.util.Config.alreadySubscribed(this.hideEvent,listeners.disable,listeners)){this.hideEvent.subscribe(listeners.disable,listeners,true);this.destroyEvent.subscribe(listeners.disable,listeners,true);}}}};YAHOO.widget.Panel.prototype.configHeight=function(type,args,obj){var height=args[0];var el=this.innerElement;YAHOO.util.Dom.setStyle(el,"height",height);this.cfg.refireEvent("underlay");this.cfg.refireEvent("iframe");};YAHOO.widget.Panel.prototype.configWidth=function(type,args,obj){var width=args[0];var el=this.innerElement;YAHOO.util.Dom.setStyle(el,"width",width);this.cfg.refireEvent("underlay");this.cfg.refireEvent("iframe");};YAHOO.widget.Panel.prototype.configzIndex=function(type,args,obj){YAHOO.widget.Panel.superclass.configzIndex.call(this,type,args,obj);var maskZ=0;var currentZ=YAHOO.util.Dom.getStyle(this.element,"zIndex");if(this.mask){if(!currentZ||isNaN(currentZ)){currentZ=0;}
if(currentZ===0){this.cfg.setProperty("zIndex",1);}else{maskZ=currentZ-1;YAHOO.util.Dom.setStyle(this.mask,"zIndex",maskZ);}}};YAHOO.widget.Panel.prototype.buildWrapper=function(){var elementParent=this.element.parentNode;var originalElement=this.element;var wrapper=document.createElement("div");wrapper.className=YAHOO.widget.Panel.CSS_PANEL_CONTAINER;wrapper.id=originalElement.id+"_c";if(elementParent){elementParent.insertBefore(wrapper,originalElement);}
wrapper.appendChild(originalElement);this.element=wrapper;this.innerElement=originalElement;YAHOO.util.Dom.setStyle(this.innerElement,"visibility","inherit");};YAHOO.widget.Panel.prototype.sizeUnderlay=function(){if(this.underlay&&this.browser!="gecko"&&this.browser!="safari"){this.underlay.style.width=this.innerElement.offsetWidth+"px";this.underlay.style.height=this.innerElement.offsetHeight+"px";}};YAHOO.widget.Panel.prototype.onDomResize=function(e,obj){YAHOO.widget.Panel.superclass.onDomResize.call(this,e,obj);var me=this;setTimeout(function(){me.sizeUnderlay();},0);};YAHOO.widget.Panel.prototype.registerDragDrop=function(){if(this.header){if(!YAHOO.util.DD){return;}
this.dd=new YAHOO.util.DD(this.element.id,this.id);if(!this.header.id){this.header.id=this.id+"_h";}
var me=this;this.dd.startDrag=function(){if(me.browser=="ie"){YAHOO.util.Dom.addClass(me.element,"drag");}
if(me.cfg.getProperty("constraintoviewport")){var offsetHeight=me.element.offsetHeight;var offsetWidth=me.element.offsetWidth;var viewPortWidth=YAHOO.util.Dom.getViewportWidth();var viewPortHeight=YAHOO.util.Dom.getViewportHeight();var scrollX=window.scrollX||document.documentElement.scrollLeft;var scrollY=window.scrollY||document.documentElement.scrollTop;var topConstraint=scrollY+10;var leftConstraint=scrollX+10;var bottomConstraint=scrollY+viewPortHeight-offsetHeight-10;var rightConstraint=scrollX+viewPortWidth-offsetWidth-10;this.minX=leftConstraint;this.maxX=rightConstraint;this.constrainX=true;this.minY=topConstraint;this.maxY=bottomConstraint;this.constrainY=true;}else{this.constrainX=false;this.constrainY=false;}
me.dragEvent.fire("startDrag",arguments);};this.dd.onDrag=function(){me.syncPosition();me.cfg.refireEvent("iframe");if(this.platform=="mac"&&this.browser=="gecko"){this.showMacGeckoScrollbars();}
me.dragEvent.fire("onDrag",arguments);};this.dd.endDrag=function(){if(me.browser=="ie"){YAHOO.util.Dom.removeClass(me.element,"drag");}
me.dragEvent.fire("endDrag",arguments);};this.dd.setHandleElId(this.header.id);this.dd.addInvalidHandleType("INPUT");this.dd.addInvalidHandleType("SELECT");this.dd.addInvalidHandleType("TEXTAREA");}};YAHOO.widget.Panel.prototype.buildMask=function(){if(!this.mask){this.mask=document.createElement("div");this.mask.id=this.id+"_mask";this.mask.className="mask";this.mask.innerHTML="&#160;";var maskClick=function(e,obj){YAHOO.util.Event.stopEvent(e);};var firstChild=document.body.firstChild;if(firstChild){document.body.insertBefore(this.mask,document.body.firstChild);}else{document.body.appendChild(this.mask);}}};YAHOO.widget.Panel.prototype.hideMask=function(){if(this.cfg.getProperty("modal")&&this.mask){this.mask.style.display="none";this.hideMaskEvent.fire();YAHOO.util.Dom.removeClass(document.body,"masked");}};YAHOO.widget.Panel.prototype.showMask=function(){if(this.cfg.getProperty("modal")&&this.mask){YAHOO.util.Dom.addClass(document.body,"masked");this.sizeMask();this.mask.style.display="block";this.showMaskEvent.fire();}};YAHOO.widget.Panel.prototype.sizeMask=function(){if(this.mask){this.mask.style.height=YAHOO.util.Dom.getDocumentHeight()+"px";this.mask.style.width=YAHOO.util.Dom.getDocumentWidth()+"px";}};YAHOO.widget.Panel.prototype.render=function(appendToNode){return YAHOO.widget.Panel.superclass.render.call(this,appendToNode,this.innerElement);};YAHOO.widget.Panel.prototype.destroy=function(){YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.sizeMask,this);if(this.close){YAHOO.util.Event.purgeElement(this.close);}
YAHOO.widget.Panel.superclass.destroy.call(this);};YAHOO.widget.Panel.prototype.toString=function(){return"Panel "+this.id;};YAHOO.widget.Dialog=function(el,userConfig){YAHOO.widget.Dialog.superclass.constructor.call(this,el,userConfig);};YAHOO.extend(YAHOO.widget.Dialog,YAHOO.widget.Panel);YAHOO.widget.Dialog.CSS_DIALOG="yui-dialog";YAHOO.widget.Dialog._EVENT_TYPES={"BEFORE_SUBMIT":"beforeSubmit","SUBMIT":"submit","MANUAL_SUBMIT":"manualSubmit","ASYNC_SUBMIT":"asyncSubmit","FORM_SUBMIT":"formSubmit","CANCEL":"cancel"};YAHOO.widget.Dialog._DEFAULT_CONFIG={"POST_METHOD":{key:"postmethod",value:"async"},"BUTTONS":{key:"buttons",value:"none"}};YAHOO.widget.Dialog.prototype.initDefaultConfig=function(){YAHOO.widget.Dialog.superclass.initDefaultConfig.call(this);this.callback={success:null,failure:null,argument:null};var DEFAULT_CONFIG=YAHOO.widget.Dialog._DEFAULT_CONFIG;this.cfg.addProperty(DEFAULT_CONFIG.POST_METHOD.key,{handler:this.configPostMethod,value:DEFAULT_CONFIG.POST_METHOD.value,validator:function(val){if(val!="form"&&val!="async"&&val!="none"&&val!="manual"){return false;}else{return true;}}});this.cfg.addProperty(DEFAULT_CONFIG.BUTTONS.key,{handler:this.configButtons,value:DEFAULT_CONFIG.BUTTONS.value});};YAHOO.widget.Dialog.prototype.initEvents=function(){YAHOO.widget.Dialog.superclass.initEvents.call(this);var EVENT_TYPES=YAHOO.widget.Dialog._EVENT_TYPES;this.beforeSubmitEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.BEFORE_SUBMIT,this);this.submitEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.SUBMIT,this);this.manualSubmitEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.MANUAL_SUBMIT,this);this.asyncSubmitEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.ASYNC_SUBMIT,this);this.formSubmitEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.FORM_SUBMIT,this);this.cancelEvent=new YAHOO.util.CustomEvent(EVENT_TYPES.CANCEL,this);};YAHOO.widget.Dialog.prototype.init=function(el,userConfig){YAHOO.widget.Dialog.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.Dialog);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.Dialog.CSS_DIALOG);this.cfg.setProperty("visible",false);if(userConfig){this.cfg.applyConfig(userConfig,true);}
this.showEvent.subscribe(this.focusFirst,this,true);this.beforeHideEvent.subscribe(this.blurButtons,this,true);this.beforeRenderEvent.subscribe(function(){var buttonCfg=this.cfg.getProperty("buttons");if(buttonCfg&&buttonCfg!="none"){if(!this.footer){this.setFooter("");}}},this,true);this.initEvent.fire(YAHOO.widget.Dialog);};YAHOO.widget.Dialog.prototype.doSubmit=function(){var pm=this.cfg.getProperty("postmethod");switch(pm){case"async":var method=this.form.getAttribute("method")||'POST';method=method.toUpperCase();YAHOO.util.Connect.setForm(this.form);var cObj=YAHOO.util.Connect.asyncRequest(method,this.form.getAttribute("action"),this.callback);this.asyncSubmitEvent.fire();break;case"form":this.form.submit();this.formSubmitEvent.fire();break;case"none":case"manual":this.manualSubmitEvent.fire();break;}};YAHOO.widget.Dialog.prototype._onFormKeyDown=function(p_oEvent){var oTarget=YAHOO.util.Event.getTarget(p_oEvent),nCharCode=YAHOO.util.Event.getCharCode(p_oEvent);if(nCharCode==13&&oTarget.tagName&&oTarget.tagName.toUpperCase()=="INPUT"){var sType=oTarget.type;if(sType=="text"||sType=="password"||sType=="checkbox"||sType=="radio"||sType=="file"){this.defaultHtmlButton.click();}}};YAHOO.widget.Dialog.prototype.registerForm=function(){var form=this.element.getElementsByTagName("form")[0];if(!form){var formHTML="<form name=\"frm_"+this.id+"\" action=\"\"></form>";this.body.innerHTML+=formHTML;form=this.element.getElementsByTagName("form")[0];}
this.firstFormElement=function(){for(var f=0;f<form.elements.length;f++){var el=form.elements[f];if(el.focus&&!el.disabled){if(el.type&&el.type!="hidden"){return el;}}}
return null;}();this.lastFormElement=function(){for(var f=form.elements.length-1;f>=0;f--){var el=form.elements[f];if(el.focus&&!el.disabled){if(el.type&&el.type!="hidden"){return el;}}}
return null;}();this.form=form;if(this.form&&(this.browser=="ie"||this.browser=="ie7"||this.browser=="gecko")){YAHOO.util.Event.addListener(this.form,"keydown",this._onFormKeyDown,null,this);}
if(this.cfg.getProperty("modal")&&this.form){var me=this;var firstElement=this.firstFormElement||this.firstButton;if(firstElement){this.preventBackTab=new YAHOO.util.KeyListener(firstElement,{shift:true,keys:9},{fn:me.focusLast,scope:me,correctScope:true});this.showEvent.subscribe(this.preventBackTab.enable,this.preventBackTab,true);this.hideEvent.subscribe(this.preventBackTab.disable,this.preventBackTab,true);}
var lastElement=this.lastButton||this.lastFormElement;if(lastElement){this.preventTabOut=new YAHOO.util.KeyListener(lastElement,{shift:false,keys:9},{fn:me.focusFirst,scope:me,correctScope:true});this.showEvent.subscribe(this.preventTabOut.enable,this.preventTabOut,true);this.hideEvent.subscribe(this.preventTabOut.disable,this.preventTabOut,true);}}};YAHOO.widget.Dialog.prototype.configClose=function(type,args,obj){var val=args[0];var doCancel=function(e,obj){obj.cancel();};if(val){if(!this.close){this.close=document.createElement("div");YAHOO.util.Dom.addClass(this.close,"container-close");this.close.innerHTML="&#160;";this.innerElement.appendChild(this.close);YAHOO.util.Event.addListener(this.close,"click",doCancel,this);}else{this.close.style.display="block";}}else{if(this.close){this.close.style.display="none";}}};YAHOO.widget.Dialog.prototype.configButtons=function(type,args,obj){var buttons=args[0];if(buttons!="none"){this.buttonSpan=null;this.buttonSpan=document.createElement("span");this.buttonSpan.className="button-group";for(var b=0;b<buttons.length;b++){var button=buttons[b];var htmlButton=document.createElement("button");htmlButton.setAttribute("type","button");if(button.isDefault){htmlButton.className="default";this.defaultHtmlButton=htmlButton;}
htmlButton.appendChild(document.createTextNode(button.text));YAHOO.util.Event.addListener(htmlButton,"click",button.handler,this,true);this.buttonSpan.appendChild(htmlButton);button.htmlButton=htmlButton;if(b===0){this.firstButton=button.htmlButton;}
if(b==(buttons.length-1)){this.lastButton=button.htmlButton;}}
this.setFooter(this.buttonSpan);this.cfg.refireEvent("iframe");this.cfg.refireEvent("underlay");}else{if(this.buttonSpan){if(this.buttonSpan.parentNode){this.buttonSpan.parentNode.removeChild(this.buttonSpan);}
this.buttonSpan=null;this.firstButton=null;this.lastButton=null;this.defaultHtmlButton=null;}}};YAHOO.widget.Dialog.prototype.focusFirst=function(type,args,obj){if(args){var e=args[1];if(e){YAHOO.util.Event.stopEvent(e);}}
if(this.firstFormElement){this.firstFormElement.focus();}else{this.focusDefaultButton();}};YAHOO.widget.Dialog.prototype.focusLast=function(type,args,obj){if(args){var e=args[1];if(e){YAHOO.util.Event.stopEvent(e);}}
var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){this.focusLastButton();}else{if(this.lastFormElement){this.lastFormElement.focus();}}};YAHOO.widget.Dialog.prototype.focusDefaultButton=function(){if(this.defaultHtmlButton){this.defaultHtmlButton.focus();}};YAHOO.widget.Dialog.prototype.blurButtons=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[0].htmlButton;if(html){html.blur();}}};YAHOO.widget.Dialog.prototype.focusFirstButton=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[0].htmlButton;if(html){html.focus();}}};YAHOO.widget.Dialog.prototype.focusLastButton=function(){var buttons=this.cfg.getProperty("buttons");if(buttons&&buttons instanceof Array){var html=buttons[buttons.length-1].htmlButton;if(html){html.focus();}}};YAHOO.widget.Dialog.prototype.configPostMethod=function(type,args,obj){var postmethod=args[0];this.registerForm();YAHOO.util.Event.addListener(this.form,"submit",function(e){YAHOO.util.Event.stopEvent(e);this.submit();this.form.blur();},this,true);};YAHOO.widget.Dialog.prototype.validate=function(){return true;};YAHOO.widget.Dialog.prototype.submit=function(){if(this.validate()){this.beforeSubmitEvent.fire();this.doSubmit();this.submitEvent.fire();this.hide();return true;}else{return false;}};YAHOO.widget.Dialog.prototype.cancel=function(){this.cancelEvent.fire();this.hide();};YAHOO.widget.Dialog.prototype.getData=function(){var oForm=this.form;if(oForm){var aElements=oForm.elements,nTotalElements=aElements.length,oData={},sName,oElement,nElements;for(var i=0;i<nTotalElements;i++){sName=aElements[i].name;function isFormElement(p_oElement){var sTagName=p_oElement.tagName.toUpperCase();return((sTagName=="INPUT"||sTagName=="TEXTAREA"||sTagName=="SELECT")&&p_oElement.name==sName);}
oElement=YAHOO.util.Dom.getElementsBy(isFormElement,"*",oForm);nElements=oElement.length;if(nElements>0){if(nElements==1){oElement=oElement[0];var sType=oElement.type,sTagName=oElement.tagName.toUpperCase();switch(sTagName){case"INPUT":if(sType=="checkbox"){oData[sName]=oElement.checked;}
else if(sType!="radio"){oData[sName]=oElement.value;}
break;case"TEXTAREA":oData[sName]=oElement.value;break;case"SELECT":var aOptions=oElement.options,nOptions=aOptions.length,aValues=[],oOption,sValue;for(var n=0;n<nOptions;n++){oOption=aOptions[n];if(oOption.selected){sValue=oOption.value;if(!sValue||sValue===""){sValue=oOption.text;}
aValues[aValues.length]=sValue;}}
oData[sName]=aValues;break;}}
else{var sType=oElement[0].type;switch(sType){case"radio":var oRadio;for(var n=0;n<nElements;n++){oRadio=oElement[n];if(oRadio.checked){oData[sName]=oRadio.value;break;}}
break;case"checkbox":var aValues=[],oCheckbox;for(var n=0;n<nElements;n++){oCheckbox=oElement[n];if(oCheckbox.checked){aValues[aValues.length]=oCheckbox.value;}}
oData[sName]=aValues;break;}}}}}
return oData;};YAHOO.widget.Dialog.prototype.destroy=function(){var Event=YAHOO.util.Event,oForm=this.form,oFooter=this.footer;if(oFooter){var aButtons=oFooter.getElementsByTagName("button");if(aButtons&&aButtons.length>0){var i=aButtons.length-1;do{Event.purgeElement(aButtons[i],false,"click");}
while(i--);}}
if(oForm){Event.purgeElement(oForm);this.body.removeChild(oForm);this.form=null;}
YAHOO.widget.Dialog.superclass.destroy.call(this);};YAHOO.widget.Dialog.prototype.toString=function(){return"Dialog "+this.id;};YAHOO.widget.SimpleDialog=function(el,userConfig){YAHOO.widget.SimpleDialog.superclass.constructor.call(this,el,userConfig);};YAHOO.extend(YAHOO.widget.SimpleDialog,YAHOO.widget.Dialog);YAHOO.widget.SimpleDialog.ICON_BLOCK="blckicon";YAHOO.widget.SimpleDialog.ICON_ALARM="alrticon";YAHOO.widget.SimpleDialog.ICON_HELP="hlpicon";YAHOO.widget.SimpleDialog.ICON_INFO="infoicon";YAHOO.widget.SimpleDialog.ICON_WARN="warnicon";YAHOO.widget.SimpleDialog.ICON_TIP="tipicon";YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG="yui-simple-dialog";YAHOO.widget.SimpleDialog._DEFAULT_CONFIG={"ICON":{key:"icon",value:"none",suppressEvent:true},"TEXT":{key:"text",value:"",suppressEvent:true,supercedes:["icon"]}};YAHOO.widget.SimpleDialog.prototype.initDefaultConfig=function(){YAHOO.widget.SimpleDialog.superclass.initDefaultConfig.call(this);var DEFAULT_CONFIG=YAHOO.widget.SimpleDialog._DEFAULT_CONFIG;this.cfg.addProperty(DEFAULT_CONFIG.ICON.key,{handler:this.configIcon,value:DEFAULT_CONFIG.ICON.value,suppressEvent:DEFAULT_CONFIG.ICON.suppressEvent});this.cfg.addProperty(DEFAULT_CONFIG.TEXT.key,{handler:this.configText,value:DEFAULT_CONFIG.TEXT.value,suppressEvent:DEFAULT_CONFIG.TEXT.suppressEvent,supercedes:DEFAULT_CONFIG.TEXT.supercedes});};YAHOO.widget.SimpleDialog.prototype.init=function(el,userConfig){YAHOO.widget.SimpleDialog.superclass.init.call(this,el);this.beforeInitEvent.fire(YAHOO.widget.SimpleDialog);YAHOO.util.Dom.addClass(this.element,YAHOO.widget.SimpleDialog.CSS_SIMPLEDIALOG);this.cfg.queueProperty("postmethod","manual");if(userConfig){this.cfg.applyConfig(userConfig,true);}
this.beforeRenderEvent.subscribe(function(){if(!this.body){this.setBody("");}},this,true);this.initEvent.fire(YAHOO.widget.SimpleDialog);};YAHOO.widget.SimpleDialog.prototype.registerForm=function(){YAHOO.widget.SimpleDialog.superclass.registerForm.call(this);this.form.innerHTML+="<input type=\"hidden\" name=\""+this.id+"\" value=\"\"/>";};YAHOO.widget.SimpleDialog.prototype.configIcon=function(type,args,obj){var icon=args[0];if(icon&&icon!="none"){var iconHTML="";if(icon.indexOf(".")==-1){iconHTML="<span class=\"yui-icon "+icon+"\" >&#160;</span>";}else{iconHTML="<img src=\""+this.imageRoot+icon+"\" class=\"yui-icon\" />";}
this.body.innerHTML=iconHTML+this.body.innerHTML;}};YAHOO.widget.SimpleDialog.prototype.configText=function(type,args,obj){var text=args[0];if(text){this.setBody(text);this.cfg.refireEvent("icon");}};YAHOO.widget.SimpleDialog.prototype.toString=function(){return"SimpleDialog "+this.id;};YAHOO.widget.ContainerEffect=function(overlay,attrIn,attrOut,targetElement,animClass){if(!animClass){animClass=YAHOO.util.Anim;}
this.overlay=overlay;this.attrIn=attrIn;this.attrOut=attrOut;this.targetElement=targetElement||overlay.element;this.animClass=animClass;};YAHOO.widget.ContainerEffect.prototype.init=function(){this.beforeAnimateInEvent=new YAHOO.util.CustomEvent("beforeAnimateIn",this);this.beforeAnimateOutEvent=new YAHOO.util.CustomEvent("beforeAnimateOut",this);this.animateInCompleteEvent=new YAHOO.util.CustomEvent("animateInComplete",this);this.animateOutCompleteEvent=new YAHOO.util.CustomEvent("animateOutComplete",this);this.animIn=new this.animClass(this.targetElement,this.attrIn.attributes,this.attrIn.duration,this.attrIn.method);this.animIn.onStart.subscribe(this.handleStartAnimateIn,this);this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this);this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,this);this.animOut=new this.animClass(this.targetElement,this.attrOut.attributes,this.attrOut.duration,this.attrOut.method);this.animOut.onStart.subscribe(this.handleStartAnimateOut,this);this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this);this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,this);};YAHOO.widget.ContainerEffect.prototype.animateIn=function(){this.beforeAnimateInEvent.fire();this.animIn.animate();};YAHOO.widget.ContainerEffect.prototype.animateOut=function(){this.beforeAnimateOutEvent.fire();this.animOut.animate();};YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut=function(type,args,obj){};YAHOO.widget.ContainerEffect.prototype.toString=function(){var output="ContainerEffect";if(this.overlay){output+=" ["+this.overlay.toString()+"]";}
return output;};YAHOO.widget.ContainerEffect.FADE=function(overlay,dur){var fade=new YAHOO.widget.ContainerEffect(overlay,{attributes:{opacity:{from:0,to:1}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{opacity:{to:0}},duration:dur,method:YAHOO.util.Easing.easeOut},overlay.element);fade.handleStartAnimateIn=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(!obj.overlay.underlay){obj.overlay.cfg.refireEvent("underlay");}
if(obj.overlay.underlay){obj.initialUnderlayOpacity=YAHOO.util.Dom.getStyle(obj.overlay.underlay,"opacity");obj.overlay.underlay.style.filter=null;}
YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","visible");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",0);};fade.handleCompleteAnimateIn=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}
if(obj.overlay.underlay){YAHOO.util.Dom.setStyle(obj.overlay.underlay,"opacity",obj.initialUnderlayOpacity);}
obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();};fade.handleStartAnimateOut=function(type,args,obj){YAHOO.util.Dom.addClass(obj.overlay.element,"hide-select");if(obj.overlay.underlay){obj.overlay.underlay.style.filter=null;}};fade.handleCompleteAnimateOut=function(type,args,obj){YAHOO.util.Dom.removeClass(obj.overlay.element,"hide-select");if(obj.overlay.element.style.filter){obj.overlay.element.style.filter=null;}
YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","hidden");YAHOO.util.Dom.setStyle(obj.overlay.element,"opacity",1);obj.overlay.cfg.refireEvent("iframe");obj.animateOutCompleteEvent.fire();};fade.init();return fade;};YAHOO.widget.ContainerEffect.SLIDE=function(overlay,dur){var x=overlay.cfg.getProperty("x")||YAHOO.util.Dom.getX(overlay.element);var y=overlay.cfg.getProperty("y")||YAHOO.util.Dom.getY(overlay.element);var clientWidth=YAHOO.util.Dom.getClientWidth();var offsetWidth=overlay.element.offsetWidth;var slide=new YAHOO.widget.ContainerEffect(overlay,{attributes:{points:{to:[x,y]}},duration:dur,method:YAHOO.util.Easing.easeIn},{attributes:{points:{to:[(clientWidth+25),y]}},duration:dur,method:YAHOO.util.Easing.easeOut},overlay.element,YAHOO.util.Motion);slide.handleStartAnimateIn=function(type,args,obj){obj.overlay.element.style.left=(-25-offsetWidth)+"px";obj.overlay.element.style.top=y+"px";};slide.handleTweenAnimateIn=function(type,args,obj){var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var currentX=pos[0];var currentY=pos[1];if(YAHOO.util.Dom.getStyle(obj.overlay.element,"visibility")=="hidden"&&currentX<x){YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","visible");}
obj.overlay.cfg.setProperty("xy",[currentX,currentY],true);obj.overlay.cfg.refireEvent("iframe");};slide.handleCompleteAnimateIn=function(type,args,obj){obj.overlay.cfg.setProperty("xy",[x,y],true);obj.startX=x;obj.startY=y;obj.overlay.cfg.refireEvent("iframe");obj.animateInCompleteEvent.fire();};slide.handleStartAnimateOut=function(type,args,obj){var vw=YAHOO.util.Dom.getViewportWidth();var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var yso=pos[1];var currentTo=obj.animOut.attributes.points.to;obj.animOut.attributes.points.to=[(vw+25),yso];};slide.handleTweenAnimateOut=function(type,args,obj){var pos=YAHOO.util.Dom.getXY(obj.overlay.element);var xto=pos[0];var yto=pos[1];obj.overlay.cfg.setProperty("xy",[xto,yto],true);obj.overlay.cfg.refireEvent("iframe");};slide.handleCompleteAnimateOut=function(type,args,obj){YAHOO.util.Dom.setStyle(obj.overlay.element,"visibility","hidden");obj.overlay.cfg.setProperty("xy",[x,y]);obj.animateOutCompleteEvent.fire();};slide.init();return slide;};YAHOO.register("container",YAHOO.widget.Module,{version:"2.2.2",build:"204"});var dojo={require:function(p){var c=p.split(".");var x=window;for(var i=0;i<c.length;i++){x[c[i]]=x[c[i]]||{};x=x[c[i]];}},kwCompoundRequire:function(o){for(var i=0;i<o.common.length;i++){this.require(o.common[i]);}},provide:function(p){this.require(p);},deprecated:function(){}};dojo.provide("dojo.date");dojo.date.setDayOfYear=function(dateObject,dayofyear){dateObject.setMonth(0);dateObject.setDate(dayofyear);return dateObject;}
dojo.date.getDayOfYear=function(dateObject){var firstDayOfYear=new Date(dateObject.getFullYear(),0,1);return Math.floor((dateObject.getTime()-
firstDayOfYear.getTime())/86400000);}
dojo.date.setWeekOfYear=function(dateObject,week,firstDay){if(arguments.length==1){firstDay=0;}
dojo.unimplemented("dojo.date.setWeekOfYear");}
dojo.date.getWeekOfYear=function(dateObject,firstDay){if(arguments.length==1){firstDay=0;}
var firstDayOfYear=new Date(dateObject.getFullYear(),0,1);var day=firstDayOfYear.getDay();firstDayOfYear.setDate(firstDayOfYear.getDate()-
day+firstDay-(day>firstDay?7:0));return Math.floor((dateObject.getTime()-
firstDayOfYear.getTime())/604800000);}
dojo.date.setIsoWeekOfYear=function(dateObject,week,firstDay){if(arguments.length==1){firstDay=1;}
dojo.unimplemented("dojo.date.setIsoWeekOfYear");}
dojo.date.getIsoWeekOfYear=function(dateObject,firstDay){if(arguments.length==1){firstDay=1;}
dojo.unimplemented("dojo.date.getIsoWeekOfYear");}
dojo.date.setIso8601=function(dateObject,string){var comps=(string.indexOf("T")==-1)?string.split(" "):string.split("T");dojo.date.setIso8601Date(dateObject,comps[0]);if(comps.length==2){dojo.date.setIso8601Time(dateObject,comps[1]);}
return dateObject;}
dojo.date.fromIso8601=function(string){return dojo.date.setIso8601(new Date(0,0),string);}
dojo.date.setIso8601Date=function(dateObject,string){var regexp="^([0-9]{4})((-?([0-9]{2})(-?([0-9]{2}))?)|"+"(-?([0-9]{3}))|(-?W([0-9]{2})(-?([1-7]))?))?$";var d=string.match(new RegExp(regexp));if(!d){dojo.debug("invalid date string: "+string);return false;}
var year=d[1];var month=d[4];var date=d[6];var dayofyear=d[8];var week=d[10];var dayofweek=(d[12])?d[12]:1;dateObject.setYear(year);if(dayofyear){dojo.date.setDayOfYear(dateObject,Number(dayofyear));}
else if(week){dateObject.setMonth(0);dateObject.setDate(1);var gd=dateObject.getDay();var day=(gd)?gd:7;var offset=Number(dayofweek)+(7*Number(week));if(day<=4){dateObject.setDate(offset+1-day);}
else{dateObject.setDate(offset+8-day);}}else{if(month){dateObject.setDate(1);dateObject.setMonth(month-1);}
if(date){dateObject.setDate(date);}}
return dateObject;}
dojo.date.fromIso8601Date=function(string){return dojo.date.setIso8601Date(new Date(0,0),string);}
dojo.date.setIso8601Time=function(dateObject,string){var timezone="Z|(([-+])([0-9]{2})(:?([0-9]{2}))?)$";var d=string.match(new RegExp(timezone));var offset=0;if(d){if(d[0]!='Z'){offset=(Number(d[3])*60)+Number(d[5]);offset*=((d[2]=='-')?1:-1);}
offset-=dateObject.getTimezoneOffset();string=string.substr(0,string.length-d[0].length);}
var regexp="^([0-9]{2})(:?([0-9]{2})(:?([0-9]{2})(\.([0-9]+))?)?)?$";var d=string.match(new RegExp(regexp));if(!d){dojo.debug("invalid time string: "+string);return false;}
var hours=d[1];var mins=Number((d[3])?d[3]:0);var secs=(d[5])?d[5]:0;var ms=d[7]?(Number("0."+d[7])*1000):0;dateObject.setHours(hours);dateObject.setMinutes(mins);dateObject.setSeconds(secs);dateObject.setMilliseconds(ms);return dateObject;}
dojo.date.fromIso8601Time=function(string){return dojo.date.setIso8601Time(new Date(0,0),string);}
dojo.date.shortTimezones=["IDLW","BET","HST","MART","AKST","PST","MST","CST","EST","AST","NFT","BST","FST","AT","GMT","CET","EET","MSK","IRT","GST","AFT","AGTT","IST","NPT","ALMT","MMT","JT","AWST","JST","ACST","AEST","LHST","VUT","NFT","NZT","CHAST","PHOT","LINT"];dojo.date.timezoneOffsets=[-720,-660,-600,-570,-540,-480,-420,-360,-300,-240,-210,-180,-120,-60,0,60,120,180,210,240,270,300,330,345,360,390,420,480,540,570,600,630,660,690,720,765,780,840];dojo.date.months=["January","February","March","April","May","June","July","August","September","October","November","December"];dojo.date.shortMonths=["Jan","Feb","Mar","Apr","May","June","July","Aug","Sep","Oct","Nov","Dec"];dojo.date.days=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];dojo.date.shortDays=["Sun","Mon","Tues","Wed","Thur","Fri","Sat"];dojo.date.getDaysInMonth=function(dateObject){var month=dateObject.getMonth();var days=[31,28,31,30,31,30,31,31,30,31,30,31];if(month==1&&dojo.date.isLeapYear(dateObject)){return 29;}
else{return days[month];}}
dojo.date.isLeapYear=function(dateObject){var year=dateObject.getFullYear();return(year%400==0)?true:(year%100==0)?false:(year%4==0)?true:false;}
dojo.date.getDayName=function(dateObject){return dojo.date.days[dateObject.getDay()];}
dojo.date.getDayShortName=function(dateObject){return dojo.date.shortDays[dateObject.getDay()];}
dojo.date.getMonthName=function(dateObject){return dojo.date.months[dateObject.getMonth()];}
dojo.date.getMonthShortName=function(dateObject){return dojo.date.shortMonths[dateObject.getMonth()];}
dojo.date.getTimezoneName=function(dateObject){var timezoneOffset=-(dateObject.getTimezoneOffset());for(var i=0;i<dojo.date.timezoneOffsets.length;i++){if(dojo.date.timezoneOffsets[i]==timezoneOffset){return dojo.date.shortTimezones[i];}}
function $(s){s=String(s);while(s.length<2){s="0"+s;}return s;}
return(timezoneOffset<0?"-":"+")+$(Math.floor(Math.abs(timezoneOffset)/60))+":"+$(Math.abs(timezoneOffset)%60);}
dojo.date.getOrdinal=function(dateObject){var date=dateObject.getDate();if(date%100!=11&&date%10==1){return"st";}
else if(date%100!=12&&date%10==2){return"nd";}
else if(date%100!=13&&date%10==3){return"rd";}
else{return"th";}}
dojo.date.format=dojo.date.strftime=function(dateObject,format){var padChar=null;function _(s,n){s=String(s);n=(n||2)-s.length;while(n-->0){s=(padChar==null?"0":padChar)+s;}
return s;}
function $(property){switch(property){case"a":return dojo.date.getDayShortName(dateObject);break;case"A":return dojo.date.getDayName(dateObject);break;case"b":case"h":return dojo.date.getMonthShortName(dateObject);break;case"B":return dojo.date.getMonthName(dateObject);break;case"c":return dateObject.toLocaleString();break;case"C":return _(Math.floor(dateObject.getFullYear()/100));break;case"d":return _(dateObject.getDate());break;case"D":return $("m")+"/"+$("d")+"/"+$("y");break;case"e":if(padChar==null){padChar=" ";}
return _(dateObject.getDate(),2);break;case"g":break;case"G":break;case"F":return $("Y")+"-"+$("m")+"-"+$("d");break;case"H":return _(dateObject.getHours());break;case"I":return _(dateObject.getHours()%12||12);break;case"j":return _(dojo.date.getDayOfYear(dateObject),3);break;case"m":return _(dateObject.getMonth()+1);break;case"M":return _(dateObject.getMinutes());break;case"n":return"\n";break;case"p":return dateObject.getHours()<12?"am":"pm";break;case"r":return $("I")+":"+$("M")+":"+$("S")+" "+$("p");break;case"R":return $("H")+":"+$("M");break;case"S":return _(dateObject.getSeconds());break;case"t":return"\t";break;case"T":return $("H")+":"+$("M")+":"+$("S");break;case"u":return String(dateObject.getDay()||7);break;case"U":return _(dojo.date.getWeekOfYear(dateObject));break;case"V":return _(dojo.date.getIsoWeekOfYear(dateObject));break;case"W":return _(dojo.date.getWeekOfYear(dateObject,1));break;case"w":return String(dateObject.getDay());break;case"x":break;case"X":break;case"y":return _(dateObject.getFullYear()%100);break;case"Y":return String(dateObject.getFullYear());break;case"z":var timezoneOffset=dateObject.getTimezoneOffset();return(timezoneOffset<0?"-":"+")+
_(Math.floor(Math.abs(timezoneOffset)/60))+":"+
_(Math.abs(timezoneOffset)%60);break;case"Z":return dojo.date.getTimezoneName(dateObject);break;case"%":return"%";break;}}
var string="";var i=0,index=0,switchCase;while((index=format.indexOf("%",i))!=-1){string+=format.substring(i,index++);switch(format.charAt(index++)){case"_":padChar=" ";break;case"-":padChar="";break;case"0":padChar="0";break;case"^":switchCase="upper";break;case"#":switchCase="swap";break;default:padChar=null;index--;break;}
var property=$(format.charAt(index++));if(switchCase=="upper"||(switchCase=="swap"&&/[a-z]/.test(property))){property=property.toUpperCase();}else if(switchCase=="swap"&&!/[a-z]/.test(property)){property=property.toLowerCase();}
var swicthCase=null;string+=property;i=index;}
string+=format.substring(i);return string;}
dojo.date.compareTypes={DATE:1,TIME:2};dojo.date.compare=function(dateA,dateB,options){var dA=dateA;var dB=dateB||new Date();var now=new Date();var opt=options||(dojo.date.compareTypes.DATE|dojo.date.compareTypes.TIME);var d1=new Date(((opt&dojo.date.compareTypes.DATE)?(dA.getFullYear()):now.getFullYear()),((opt&dojo.date.compareTypes.DATE)?(dA.getMonth()):now.getMonth()),((opt&dojo.date.compareTypes.DATE)?(dA.getDate()):now.getDate()),((opt&dojo.date.compareTypes.TIME)?(dA.getHours()):0),((opt&dojo.date.compareTypes.TIME)?(dA.getMinutes()):0),((opt&dojo.date.compareTypes.TIME)?(dA.getSeconds()):0));var d2=new Date(((opt&dojo.date.compareTypes.DATE)?(dB.getFullYear()):now.getFullYear()),((opt&dojo.date.compareTypes.DATE)?(dB.getMonth()):now.getMonth()),((opt&dojo.date.compareTypes.DATE)?(dB.getDate()):now.getDate()),((opt&dojo.date.compareTypes.TIME)?(dB.getHours()):0),((opt&dojo.date.compareTypes.TIME)?(dB.getMinutes()):0),((opt&dojo.date.compareTypes.TIME)?(dB.getSeconds()):0));if(d1.valueOf()>d2.valueOf()){return 1;}
if(d1.valueOf()<d2.valueOf()){return-1;}
return 0;}
dojo.date.dateParts={YEAR:0,MONTH:1,DAY:2,HOUR:3,MINUTE:4,SECOND:5,MILLISECOND:6};dojo.date.add=function(d,unit,amount){var n=(amount)?amount:1;var v;switch(unit){case dojo.date.dateParts.YEAR:{v=new Date(d.getFullYear()+n,d.getMonth(),d.getDate(),d.getHours(),d.getMinutes(),d.getSeconds(),d.getMilliseconds());break;}
case dojo.date.dateParts.MONTH:{v=new Date(d.getFullYear(),d.getMonth()+n,d.getDate(),d.getHours(),d.getMinutes(),d.getSeconds(),d.getMilliseconds());break;}
case dojo.date.dateParts.HOUR:{v=new Date(d.getFullYear(),d.getMonth(),d.getDate(),d.getHours()+n,d.getMinutes(),d.getSeconds(),d.getMilliseconds());break;}
case dojo.date.dateParts.MINUTE:{v=new Date(d.getFullYear(),d.getMonth(),d.getDate(),d.getHours(),d.getMinutes()+n,d.getSeconds(),d.getMilliseconds());break;}
case dojo.date.dateParts.SECOND:{v=new Date(d.getFullYear(),d.getMonth(),d.getDate(),d.getHours(),d.getMinutes(),d.getSeconds()+n,d.getMilliseconds());break;}
case dojo.date.dateParts.MILLISECOND:{v=new Date(d.getFullYear(),d.getMonth(),d.getDate(),d.getHours(),d.getMinutes(),d.getSeconds(),d.getMilliseconds()+n);break;}
default:{v=new Date(d.getFullYear(),d.getMonth(),d.getDate()+n,d.getHours(),d.getMinutes(),d.getSeconds(),d.getMilliseconds());}};return v;};dojo.date.toString=function(date,format){dojo.deprecated("dojo.date.toString","use dojo.date.format instead","0.4");if(format.indexOf("#d")>-1){format=format.replace(/#dddd/g,dojo.date.getDayOfWeekName(date));format=format.replace(/#ddd/g,dojo.date.getShortDayOfWeekName(date));format=format.replace(/#dd/g,(date.getDate().toString().length==1?"0":"")+date.getDate());format=format.replace(/#d/g,date.getDate());}
if(format.indexOf("#M")>-1){format=format.replace(/#MMMM/g,dojo.date.getMonthName(date));format=format.replace(/#MMM/g,dojo.date.getShortMonthName(date));format=format.replace(/#MM/g,((date.getMonth()+1).toString().length==1?"0":"")+(date.getMonth()+1));format=format.replace(/#M/g,date.getMonth()+1);}
if(format.indexOf("#y")>-1){var fullYear=date.getFullYear().toString();format=format.replace(/#yyyy/g,fullYear);format=format.replace(/#yy/g,fullYear.substring(2));format=format.replace(/#y/g,fullYear.substring(3));}
if(format.indexOf("#")==-1){return format;}
if(format.indexOf("#h")>-1){var hours=date.getHours();hours=(hours>12?hours-12:(hours==0)?12:hours);format=format.replace(/#hh/g,(hours.toString().length==1?"0":"")+hours);format=format.replace(/#h/g,hours);}
if(format.indexOf("#H")>-1){format=format.replace(/#HH/g,(date.getHours().toString().length==1?"0":"")+date.getHours());format=format.replace(/#H/g,date.getHours());}
if(format.indexOf("#m")>-1){format=format.replace(/#mm/g,(date.getMinutes().toString().length==1?"0":"")+date.getMinutes());format=format.replace(/#m/g,date.getMinutes());}
if(format.indexOf("#s")>-1){format=format.replace(/#ss/g,(date.getSeconds().toString().length==1?"0":"")+date.getSeconds());format=format.replace(/#s/g,date.getSeconds());}
if(format.indexOf("#T")>-1){format=format.replace(/#TT/g,date.getHours()>=12?"PM":"AM");format=format.replace(/#T/g,date.getHours()>=12?"P":"A");}
if(format.indexOf("#t")>-1){format=format.replace(/#tt/g,date.getHours()>=12?"pm":"am");format=format.replace(/#t/g,date.getHours()>=12?"p":"a");}
return format;}
dojo.date.daysInMonth=function(month,year){dojo.deprecated("daysInMonth(month, year)","replaced by getDaysInMonth(dateObject)","0.4");return dojo.date.getDaysInMonth(new Date(year,month,1));}
dojo.date.toLongDateString=function(date){dojo.deprecated("dojo.date.toLongDateString",'use dojo.date.format(date, "%B %e, %Y") instead',"0.4");return dojo.date.format(date,"%B %e, %Y")}
dojo.date.toShortDateString=function(date){dojo.deprecated("dojo.date.toShortDateString",'use dojo.date.format(date, "%b %e, %Y") instead',"0.4");return dojo.date.format(date,"%b %e, %Y");}
dojo.date.toMilitaryTimeString=function(date){dojo.deprecated("dojo.date.toMilitaryTimeString",'use dojo.date.format(date, "%T")',"0.4");return dojo.date.format(date,"%T");}
dojo.date.toRelativeString=function(date){var now=new Date();var diff=(now-date)/1000;var end=" ago";var future=false;if(diff<0){future=true;end=" from now";diff=-diff;}
if(diff<60){diff=Math.round(diff);return diff+" second"+(diff==1?"":"s")+end;}else if(diff<3600){diff=Math.round(diff/60);return diff+" minute"+(diff==1?"":"s")+end;}else if(diff<3600*24&&date.getDay()==now.getDay()){diff=Math.round(diff/3600);return diff+" hour"+(diff==1?"":"s")+end;}else if(diff<3600*24*7){diff=Math.round(diff/(3600*24));if(diff==1){return future?"Tomorrow":"Yesterday";}else{return diff+" days"+end;}}else{return dojo.date.toShortDateString(date);}}
dojo.date.getDayOfWeekName=function(date){dojo.deprecated("dojo.date.getDayOfWeekName","use dojo.date.getDayName instead","0.4");return dojo.date.days[date.getDay()];}
dojo.date.getShortDayOfWeekName=function(date){dojo.deprecated("dojo.date.getShortDayOfWeekName","use dojo.date.getDayShortName instead","0.4");return dojo.date.shortDays[date.getDay()];}
dojo.date.getShortMonthName=function(date){dojo.deprecated("dojo.date.getShortMonthName","use dojo.date.getMonthShortName instead","0.4");return dojo.date.shortMonths[date.getMonth()];}
dojo.date.toSql=function(date,noTime){return dojo.date.format(date,"%F"+!noTime?" %T":"");}
dojo.date.fromSql=function(sqlDate){var parts=sqlDate.split(/[\- :]/g);while(parts.length<6){parts.push(0);}
return new Date(parts[0],(parseInt(parts[1],10)-1),parts[2],parts[3],parts[4],parts[5]);}
dojo.provide("dojo.lang");dojo.provide("dojo.lang.Lang");dojo.require("dojo.lang.common");dojo.provide("dojo.regexp");dojo.provide("dojo.regexp.us");dojo.regexp.tld=function(flags){flags=(typeof flags=="object")?flags:{};if(typeof flags.allowCC!="boolean"){flags.allowCC=true;}
if(typeof flags.allowInfra!="boolean"){flags.allowInfra=true;}
if(typeof flags.allowGeneric!="boolean"){flags.allowGeneric=true;}
var infraRE="arpa";var genericRE="aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|xxx|jobs|mobi|post";var ccRE="ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|"+"bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|"+"ec|ee|eg|er|es|et|fi|fj|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|"+"hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|la|"+"lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|"+"mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|"+"ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sk|sl|sm|sn|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|"+"to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw";var a=[];if(flags.allowInfra){a.push(infraRE);}
if(flags.allowGeneric){a.push(genericRE);}
if(flags.allowCC){a.push(ccRE);}
var tldRE="";if(a.length>0){tldRE="("+a.join("|")+")";}
return tldRE;}
dojo.regexp.ipAddress=function(flags){flags=(typeof flags=="object")?flags:{};if(typeof flags.allowDottedDecimal!="boolean"){flags.allowDottedDecimal=true;}
if(typeof flags.allowDottedHex!="boolean"){flags.allowDottedHex=true;}
if(typeof flags.allowDottedOctal!="boolean"){flags.allowDottedOctal=true;}
if(typeof flags.allowDecimal!="boolean"){flags.allowDecimal=true;}
if(typeof flags.allowHex!="boolean"){flags.allowHex=true;}
if(typeof flags.allowIPv6!="boolean"){flags.allowIPv6=true;}
if(typeof flags.allowHybrid!="boolean"){flags.allowHybrid=true;}
var dottedDecimalRE="((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";var dottedHexRE="(0[xX]0*[\\da-fA-F]?[\\da-fA-F]\\.){3}0[xX]0*[\\da-fA-F]?[\\da-fA-F]";var dottedOctalRE="(0+[0-3][0-7][0-7]\\.){3}0+[0-3][0-7][0-7]";var decimalRE="(0|[1-9]\\d{0,8}|[1-3]\\d{9}|4[01]\\d{8}|42[0-8]\\d{7}|429[0-3]\\d{6}|"+"4294[0-8]\\d{5}|42949[0-5]\\d{4}|429496[0-6]\\d{3}|4294967[01]\\d{2}|42949672[0-8]\\d|429496729[0-5])";var hexRE="0[xX]0*[\\da-fA-F]{1,8}";var ipv6RE="([\\da-fA-F]{1,4}\\:){7}[\\da-fA-F]{1,4}";var hybridRE="([\\da-fA-F]{1,4}\\:){6}"+"((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";var a=[];if(flags.allowDottedDecimal){a.push(dottedDecimalRE);}
if(flags.allowDottedHex){a.push(dottedHexRE);}
if(flags.allowDottedOctal){a.push(dottedOctalRE);}
if(flags.allowDecimal){a.push(decimalRE);}
if(flags.allowHex){a.push(hexRE);}
if(flags.allowIPv6){a.push(ipv6RE);}
if(flags.allowHybrid){a.push(hybridRE);}
var ipAddressRE="";if(a.length>0){ipAddressRE="("+a.join("|")+")";}
return ipAddressRE;}
dojo.regexp.host=function(flags){flags=(typeof flags=="object")?flags:{};if(typeof flags.allowIP!="boolean"){flags.allowIP=true;}
if(typeof flags.allowLocal!="boolean"){flags.allowLocal=false;}
if(typeof flags.allowPort!="boolean"){flags.allowPort=true;}
var domainNameRE="([0-9a-zA-Z]([-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?\\.)+"+dojo.regexp.tld(flags);var portRE=(flags.allowPort)?"(\\:"+dojo.regexp.integer({signed:false})+")?":"";var hostNameRE=domainNameRE;if(flags.allowIP){hostNameRE+="|"+dojo.regexp.ipAddress(flags);}
if(flags.allowLocal){hostNameRE+="|localhost";}
return"("+hostNameRE+")"+portRE;}
dojo.regexp.url=function(flags){flags=(typeof flags=="object")?flags:{};if(typeof flags.scheme=="undefined"){flags.scheme=[true,false];}
var protocalRE=dojo.regexp.buildGroupRE(flags.scheme,function(q){if(q){return"(https?|ftps?)\\://";}return"";});var pathRE="(/([^?#\\s/]+/)*)?([^?#\\s/]+(\\?[^?#\\s/]*)?(#[A-Za-z][\\w.:-]*)?)?";return(protocalRE+dojo.regexp.host(flags)+pathRE);}
dojo.regexp.emailAddress=function(flags){flags=(typeof flags=="object")?flags:{};if(typeof flags.allowCruft!="boolean"){flags.allowCruft=false;}
flags.allowPort=false;var usernameRE="([\\da-z]+[-._+&'])*[\\da-z]+";var emailAddressRE=usernameRE+"@"+dojo.regexp.host(flags);if(flags.allowCruft){emailAddressRE="<?(mailto\\:)?"+emailAddressRE+">?";}
return emailAddressRE;}
dojo.regexp.emailAddressList=function(flags){flags=(typeof flags=="object")?flags:{};if(typeof flags.listSeparator!="string"){flags.listSeparator="\\s;,";}
var emailAddressRE=dojo.regexp.emailAddress(flags);var emailAddressListRE="("+emailAddressRE+"\\s*["+flags.listSeparator+"]\\s*)*"+
emailAddressRE+"\\s*["+flags.listSeparator+"]?\\s*";return emailAddressListRE;}
dojo.regexp.integer=function(flags){flags=(typeof flags=="object")?flags:{};if(typeof flags.signed=="undefined"){flags.signed=[true,false];}
if(typeof flags.separator=="undefined"){flags.separator="";}
var signRE=dojo.regexp.buildGroupRE(flags.signed,function(q){if(q){return"[-+]";}return"";});var numberRE=dojo.regexp.buildGroupRE(flags.separator,function(sep){if(sep==""){return"(0|[1-9]\\d*)";}
return"(0|[1-9]\\d{0,2}(["+sep+"]\\d{3})*)";});var numberRE;return(signRE+numberRE);}
dojo.regexp.realNumber=function(flags){flags=(typeof flags=="object")?flags:{};if(typeof flags.places!="number"){flags.places=Infinity;}
if(typeof flags.decimal!="string"){flags.decimal=".";}
if(typeof flags.exponent=="undefined"){flags.exponent=[true,false];}
if(typeof flags.eSigned=="undefined"){flags.eSigned=[true,false];}
var integerRE=dojo.regexp.integer(flags);var decimalRE="";if(flags.places==Infinity){decimalRE="(\\"+flags.decimal+"\\d+)?";}
else if(flags.places>0){decimalRE="\\"+flags.decimal+"\\d{"+flags.places+"}";}
var exponentRE=dojo.regexp.buildGroupRE(flags.exponent,function(q){if(q){return"([eE]"+dojo.regexp.integer({signed:flags.eSigned})+")";}
return"";});return(integerRE+decimalRE+exponentRE);}
dojo.regexp.currency=function(flags){flags=(typeof flags=="object")?flags:{};if(typeof flags.signed=="undefined"){flags.signed=[true,false];}
if(typeof flags.symbol=="undefined"){flags.symbol="$";}
if(typeof flags.placement!="string"){flags.placement="before";}
if(typeof flags.separator!="string"){flags.separator=",";}
if(typeof flags.cents=="undefined"){flags.cents=[true,false];}
if(typeof flags.decimal!="string"){flags.decimal=".";}
var signRE=dojo.regexp.buildGroupRE(flags.signed,function(q){if(q){return"[-+]";}return"";});var symbolRE=dojo.regexp.buildGroupRE(flags.symbol,function(symbol){return"\\s?"+symbol.replace(/([.$?*!=:|\\\/^])/g,"\\$1")+"\\s?";});var numberRE=dojo.regexp.integer({signed:false,separator:flags.separator});var centsRE=dojo.regexp.buildGroupRE(flags.cents,function(q){if(q){return"(\\"+flags.decimal+"\\d\\d)";}return"";});var currencyRE;if(flags.placement=="before"){currencyRE=signRE+symbolRE+numberRE+centsRE;}
else{currencyRE=signRE+numberRE+centsRE+symbolRE;}
return currencyRE;}
dojo.regexp.us.state=function(flags){flags=(typeof flags=="object")?flags:{};if(typeof flags.allowTerritories!="boolean"){flags.allowTerritories=true;}
if(typeof flags.allowMilitary!="boolean"){flags.allowMilitary=true;}
var statesRE="AL|AK|AZ|AR|CA|CO|CT|DE|DC|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|"+"NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY";var territoriesRE="AS|FM|GU|MH|MP|PW|PR|VI";var militaryRE="AA|AE|AP";if(flags.allowTerritories){statesRE+="|"+territoriesRE;}
if(flags.allowMilitary){statesRE+="|"+militaryRE;}
return"("+statesRE+")";}
dojo.regexp.time=function(flags){flags=(typeof flags=="object")?flags:{};if(typeof flags.format=="undefined"){flags.format="h:mm:ss t";}
if(typeof flags.amSymbol!="string"){flags.amSymbol="AM";}
if(typeof flags.pmSymbol!="string"){flags.pmSymbol="PM";}
var timeRE=function(format){format=format.replace(/([.$?*!=:|{}\(\)\[\]\\\/^])/g,"\\$1");var amRE=flags.amSymbol.replace(/([.$?*!=:|{}\(\)\[\]\\\/^])/g,"\\$1");var pmRE=flags.pmSymbol.replace(/([.$?*!=:|{}\(\)\[\]\\\/^])/g,"\\$1");format=format.replace("hh","(0[1-9]|1[0-2])");format=format.replace("h","([1-9]|1[0-2])");format=format.replace("HH","([01][0-9]|2[0-3])");format=format.replace("H","([0-9]|1[0-9]|2[0-3])");format=format.replace("mm","([0-5][0-9])");format=format.replace("m","([1-5][0-9]|[0-9])");format=format.replace("ss","([0-5][0-9])");format=format.replace("s","([1-5][0-9]|[0-9])");format=format.replace("t","\\s?("+amRE+"|"+pmRE+")\\s?");return format;};return dojo.regexp.buildGroupRE(flags.format,timeRE);}
dojo.regexp.numberFormat=function(flags){flags=(typeof flags=="object")?flags:{};if(typeof flags.format=="undefined"){flags.format="###-###-####";}
var digitRE=function(format){format=format.replace(/([.$*!=:|{}\(\)\[\]\\\/^])/g,"\\$1");format=format.replace(/\?/g,"\\d?");format=format.replace(/#/g,"\\d");return format;};return dojo.regexp.buildGroupRE(flags.format,digitRE);}
dojo.regexp.buildGroupRE=function(a,re){if(!(a instanceof Array)){return re(a);}
var b=[];for(var i=0;i<a.length;i++){b.push(re(a[i]));}
return"("+b.join("|")+")";}
dojo.provide("dojo.validate");dojo.require("dojo.validate.common");dojo.require("dojo.validate");dojo.kwCompoundRequire({common:["dojo.validate.check","dojo.validate.datetime","dojo.validate.de","dojo.validate.jp","dojo.validate.us","dojo.validate.web"]});dojo.provide("dojo.validate.*");dojo.provide("dojo.validate.common");dojo.require("dojo.validate");dojo.require("dojo.regexp");dojo.validate.isText=function(value,flags){flags=(typeof flags=="object")?flags:{};if(/^\s*$/.test(value)){return false;}
if(typeof flags.length=="number"&&flags.length!=value.length){return false;}
if(typeof flags.minlength=="number"&&flags.minlength>value.length){return false;}
if(typeof flags.maxlength=="number"&&flags.maxlength<value.length){return false;}
return true;}
dojo.validate.isInteger=function(value,flags){var re=new RegExp("^"+dojo.regexp.integer(flags)+"$");return re.test(value);}
dojo.validate.isRealNumber=function(value,flags){var re=new RegExp("^"+dojo.regexp.realNumber(flags)+"$");return re.test(value);}
dojo.validate.isCurrency=function(value,flags){var re=new RegExp("^"+dojo.regexp.currency(flags)+"$");return re.test(value);}
dojo.validate.isInRange=function(value,flags){flags=(typeof flags=="object")?flags:{};var max=(typeof flags.max=="number")?flags.max:Infinity;var min=(typeof flags.min=="number")?flags.min:-Infinity;var dec=(typeof flags.decimal=="string")?flags.decimal:".";var pattern="[^"+dec+"\\deE+-]";value=value.replace(RegExp(pattern,"g"),"");value=value.replace(/^([+-]?)(\D*)/,"$1");value=value.replace(/(\D*)$/,"");pattern="(\\d)["+dec+"](\\d)";value=value.replace(RegExp(pattern,"g"),"$1.$2");value=Number(value);if(value<min||value>max){return false;}
return true;}
dojo.validate.isNumberFormat=function(value,flags){var re=new RegExp("^"+dojo.regexp.numberFormat(flags)+"$","i");return re.test(value);}
dojo.provide("dojo.validate.datetime");dojo.require("dojo.validate.common");dojo.validate.isValidTime=function(value,flags){var re=new RegExp("^"+dojo.regexp.time(flags)+"$","i");return re.test(value);}
dojo.validate.is12HourTime=function(value){return dojo.validate.isValidTime(value,{format:["h:mm:ss t","h:mm t"]});}
dojo.validate.is24HourTime=function(value){return dojo.validate.isValidTime(value,{format:["HH:mm:ss","HH:mm"]});}
dojo.validate.isValidDate=function(dateValue,format){if(typeof format=="object"&&typeof format.format=="string"){format=format.format;}
if(typeof format!="string"){format="MM/DD/YYYY";}
var reLiteral=format.replace(/([$^.*+?=!:|\/\\\(\)\[\]\{\}])/g,"\\$1");reLiteral=reLiteral.replace("YYYY","([0-9]{4})");reLiteral=reLiteral.replace("MM","(0[1-9]|10|11|12)");reLiteral=reLiteral.replace("M","([1-9]|10|11|12)");reLiteral=reLiteral.replace("DDD","(00[1-9]|0[1-9][0-9]|[12][0-9][0-9]|3[0-5][0-9]|36[0-6])");reLiteral=reLiteral.replace("DD","(0[1-9]|[12][0-9]|30|31)");reLiteral=reLiteral.replace("D","([1-9]|[12][0-9]|30|31)");reLiteral=reLiteral.replace("ww","(0[1-9]|[1-4][0-9]|5[0-3])");reLiteral=reLiteral.replace("d","([1-7])");reLiteral="^"+reLiteral+"$";var re=new RegExp(reLiteral);if(!re.test(dateValue))return false;var year=0,month=1,date=1,dayofyear=1,week=1,day=1;var tokens=format.match(/(YYYY|MM|M|DDD|DD|D|ww|d)/g);var values=re.exec(dateValue);for(var i=0;i<tokens.length;i++){switch(tokens[i]){case"YYYY":year=Number(values[i+1]);break;case"M":case"MM":month=Number(values[i+1]);break;case"D":case"DD":date=Number(values[i+1]);break;case"DDD":dayofyear=Number(values[i+1]);break;case"ww":week=Number(values[i+1]);break;case"d":day=Number(values[i+1]);break;}}
var leapyear=(year%4==0&&(year%100!=0||year%400==0));if(date==31&&(month==4||month==6||month==9||month==11))return false;if(date>=30&&month==2)return false;if(date==29&&month==2&&!leapyear)return false;if(dayofyear==366&&!leapyear)return false;return true;}
dojo.provide("dojo.validate.web");dojo.require("dojo.validate.common");dojo.validate.isIpAddress=function(value,flags){var re=new RegExp("^"+dojo.regexp.ipAddress(flags)+"$","i");return re.test(value);}
dojo.validate.isUrl=function(value,flags){var re=new RegExp("^"+dojo.regexp.url(flags)+"$","i");return re.test(value);}
dojo.validate.isEmailAddress=function(value,flags){var re=new RegExp("^"+dojo.regexp.emailAddress(flags)+"$","i");return re.test(value);}
dojo.validate.isEmailAddressList=function(value,flags){var re=new RegExp("^"+dojo.regexp.emailAddressList(flags)+"$","i");return re.test(value);}
dojo.validate.getEmailAddressList=function(value,flags){if(!flags){flags={};}
if(!flags.listSeparator){flags.listSeparator="\\s;,";}
if(dojo.validate.isEmailAddressList(value,flags)){return value.split(new RegExp("\\s*["+flags.listSeparator+"]\\s*"));}
return[];}
function ifWin(iframe)
{var win=null;if(iframe.contentWindow){win=iframe.contentWindow;}else if(iframe.contentDocument){win=iframe.contentDocument.defaultView;}else if(iframe.Document){win=iframe.Document.parentWindow;}else{}
return win;}
function fc2(e,d,criteria,className,first)
{if(d!=null&&d.constructor!=Number){throw'Incorrect calling syntax for fc2: 2nd parameter [depth] must be number!';}
var ret=[];var cs=e.childNodes;for(var i=0,e=cs.length;i<e;i++){if(cs[i].nodeType==3)continue;var pass=true;if(className&&(className.constructor==RegExp?!(className.test(cs[i].className)):!(cs[i].className==className)))
continue;for(var field in criteria){value=criteria[field];switch(value.constructor){case Boolean:attr=cs[i][field]||cs[i].getAttribute(field);if(value&&attr||!value&&!attr)continue;break;case RegExp:attr=cs[i].getAttribute(field);if(value.test(attr))continue;break;default:attr=cs[i].getAttribute(field);if(attr==value)continue;}
pass=false;break;}
if(pass){ret[ret.length]=cs[i];if(first==ret.length)return cs[i];}}
if(d>1){for(var i=0,e=cs.length;i<e;i++){ret=ret.concat(fc2(cs[i],d-1,criteria,className));}}
return first?ret[first-1]:ret;}
function fc(e,t,criteria,className,first)
{var cs=e.getElementsByTagName(t);var ret=[];var first=first||0;if(criteria||className){for(var i=0,e=cs.length;i<e;i++){if(cs[i].nodeType==3)continue;var pass=true;if(className&&(className.constructor==RegExp?!(className.test(cs[i].className)):!(cs[i].className==className)))
continue;for(var field in criteria){var value=criteria[field];switch(value.constructor){case Boolean:var attr=cs[i][field]||cs[i].getAttribute(field);if(value&&attr||!value&&!attr)continue;break;case RegExp:var attr=cs[i].getAttribute(field);if(value.test(attr))continue;break;default:var attr=cs[i].getAttribute(field);if(attr==value)continue;}
pass=false;break;}
if(pass){ret[ret.length]=cs[i];if(first==ret.length)return cs[i];}}}
else{ret=cs;}
return first?ret[first-1]:ret;}
function fca(e,t,criteria,values,obj,properties)
{var n=values.length;var cs=e.getElementsByTagName(t);var hash={};if(typeof properties!='undefined'){if(properties.length!=n){throw'values must correspond to properties'}
for(var i=0;i<n;i++){hash[values[i]]=properties[i];}}else{if(typeof obj=='undefined'){for(var i=0;i<n;i++){hash[values[i]]=i;}}else{for(var i=0;i<n;i++){hash[values[i]]=values[i];}}}
if(typeof obj=='undefined'){obj=new Array(n);}
switch(criteria){case'className':for(var i=0,e=cs.length;i<e;i++){var j=hash[cs[i].className];if(typeof j!='undefined'){obj[j]&&obj[j].constructor==Array?obj[j].push(cs[i]):(!obj[j]?(obj[j]=cs[i]):false);}}
break;default:for(var i=0,e=cs.length;i<e;i++){var j=hash[cs[i][criteria]||cs[i].getAttribute(criteria)];if(typeof j!='undefined'){obj[j]&&obj[j].constructor==Array?obj[j].push(cs[i]):(!obj[j]?(obj[j]=cs[i]):false);}}
break;}
return obj;}
function fp(e,t,criteria,className)
{var p=e;var attr,value;t&&(t=t.toUpperCase());while(p&&p!=document&&p.getAttribute){var pass=(!t||(p.tagName==t));if(pass&&className&&(className.constructor==RegExp?!(className.test(p.className)):!(p.className==className))){pass=false;}
if(pass&&criteria){for(var field in criteria){value=criteria[field];switch(value.constructor){case Boolean:attr=p[field]||p.getAttribute(field);if(value&&attr||!value&&!attr)continue;break;case RegExp:attr=p.getAttribute(field);if(value.test(attr))continue;break;default:attr=p.getAttribute(field);if(attr==value)continue;}
pass=false;break;}}
if(pass){return p;break;}
p=p.parentNode;}
return null;}
function ce(e){return document.createElement(e);}
function cex(e,x){var a=document.createElement(e);for(var prop in x){if(typeof x[prop]=='object'){for(var y in x[prop]){eval('a.'+prop+'.'+y+'=x.'+prop+'.'+y+';');}}else{a[prop]=x[prop];}}
return a;}
function ctn(t){return document.createTextNode(t);}
function ge(i){return document.getElementById(i);}
Function.prototype.apply2all=function(a){for(var i=0,e=a.length;i<e;i++){this(a[i],i,e);};}
function gc(e,i){return e.childNodes[i];}
function ra(){if(ra.arguments.length>1){var el=ra.arguments[0];for(i=1;i<ra.arguments.length;i++){if(arguments[i])
el.removeAttribute(ra.arguments[i]);}
return el;}else{return null;}}
function ib(a,b){return b.parentNode.insertBefore(a,b);}
function rn(a,keepNode){!keepNode&&a.innerHTML&&(a.innerHTML='');return a.parentNode&&a.parentNode.removeChild(a);}
function rc(n,o){return o.parentNode.replaceChild(n,o);}
function ia(a,b){if(b.nextSibling){return b.parentNode.insertBefore(a,b.nextSibling);}
else{b.parentNode.appendChild(a);}}
function rec(a){if(a.firstChild&&a.firstChild.nodeType==3){for(var i=a.childNodes.length;i>0;i--){var n=a.childNodes[i-1];if(n.nodeType==3&&!/\S/.test(n.nodeValue))rn(n);}}
return a.firstChild;}
function ac(){if(ac.arguments.length>1){var a=ac.arguments[0];if(a.nodeType==3)throw new'cannot append to text node';for(i=1;i<ac.arguments.length;i++){if(arguments[i])
a.appendChild(ac.arguments[i]);}
return a;}else{document.body.appendChild(ac.arguments[0]);return ac.arguments[0];}}
function at(a){if(a.constructor==Array){var b=a[0];var c;for(var i=1,e=a.length;i<e;i++){c=a[i];if(!c)continue;if(c.constructor==Array){b.appendChild(c[0]);at(c);}else{b.appendChild(c);}}
return b;}else{document.body.appendChild(a);return a;}}
function getXY(el,which)
{var xy=YuDom.getXY(el);if(which){xy[0]+=el.offsetWidth*(which%3)/2;xy[1]+=el.offsetHeight*parseInt(which/3)/2;}
return{x:xy[0],y:xy[1]};}
function getCorners(el){var pos=getXY(el);var w=el.offsetWidth;var h=el.offsetHeight;return{x:pos.x,x2:pos.x+w,y:pos.y,y2:pos.y+h,ym:pos.y+h/2,xm:pos.x+w/2,h:h,w:w};}
function getEvtXY(e)
{var pos={x:0,y:0};if(e.pageX){pos={x:e.pageX,y:e.pageY}}else{pos={x:e.clientX+document.body.scrollLeft-document.body.clientLeft,y:e.clientY+document.body.scrollTop-document.body.clientTop};if(document.body.parentElement&&document.body.parentElement.clientLeft){var bodParent=document.body.parentElement;pos.x+=bodParent.scrollLeft-bodParent.clientLeft;pos.y+=bodParent.scrollTop-bodParent.clientTop;}}
return pos;}
function clone(myObj)
{if(typeof(myObj)!='object')return myObj;if(myObj==null)return myObj;var myNewObj=new myObj.constructor();for(var i in myObj){if(typeof myObj[i]=='object'){myNewObj[i]=clone(myObj[i]);}else{myNewObj[i]=myObj[i];}}
return myNewObj;}
function getRawHref(a)
{return a.getAttribute('href',2);}
function reloadCSS(filename,delquery,addquery)
{var a=document.getElementsByTagName('link');for(var i=0;i<a.length;i++){var s=a[i];if(s.rel.toLowerCase().indexOf('stylesheet')>=0&&s.href&&(!filename||s.href.toLowerCase().indexOf(filename)>=0)){var h=s.href.replace(/(&|\?)forceReload=\d+/,'');if(delquery){var regex=new RegExp('(&|\\?)'+delquery+'=.*?$');h=h.replace(regex,'');var regex=new RegExp('(&|\\?)'+delquery+'=.*?&');h=h.replace(regex,'$1');}
if(addquery){h=h+(h.indexOf('?')>=0?'&':'?')+addquery;}
h=h+(h.indexOf('?')>=0?'&':'?')+'forceReload='+(new Date().valueOf());s.href=h;}}}
function happensInElement(event,element){var etarget=YuEvent.getTarget(event);if(YuDom.isAncestor(element,etarget))return true;var xy=getEvtXY(event);var corners=getCorners(element);return xy.x>=corners.x&&xy.x<=corners.x2&&xy.y>=corners.y&&xy.y<=corners.y2;};var op=/opera 5|opera\/5/i.test(navigator.userAgent)&&window.opera;var ie=!op&&/msie/i.test(navigator.userAgent);var mz=!op&&/mozilla\/5/i.test(navigator.userAgent);function centerParent(el){var parent=el.parentNode;if(!parent)return;var pl=parseInt(parent.style.paddingLeft||'0');var pr=parseInt(parent.style.paddingRight||'0');el.style.left=(parent.clientWidth-pl-pr-el.clientWidth)/2+'px';}
function middleParent(el){var parent=el.parentNode;if(!parent)return;var pl=parseInt(parent.style.paddingTop||'0');var pr=parseInt(parent.style.paddingBottom||'0');el.style.top=(parent.clientHeight-pl-pr-el.clientHeight)/2+'px';}
function Capture(elSrc,sEvent,fHandler)
{var events=sEvent.split('|');var handler=function(e){e=YuEvent.getEvent(e);YuEvent.stopEvent(e);fHandler.call(YuEvent.getTarget(e),e,YuEvent.getTarget(e));return false};var stop=function(){if(elSrc.releaseCapture){for(var i=0;i<events.length;i++){YuEvent.removeListener(elSrc,events[i],handler);}
elSrc.releaseCapture();}
else if(document.addEventListener){for(var i=0;i<events.length;i++){document.removeEventListener(events[i],handler,true);}}
else{}
YuEvent.removeListener(elSrc,'keydown',escape);elSrc=null;start=null;stop=null;events=null;this.start=null;this.stop=null;fHandler=null;handler=null;};var start=function(){if(elSrc.setCapture){for(var i=0;i<events.length;i++){YuEvent.addListener(elSrc,events[i],handler);}
elSrc.setCapture();}
else if(document.addEventListener){for(var i=0;i<events.length;i++){document.addEventListener(events[i],handler,true);}}
else{}};this.start=start;this.stop=stop;}
var addStyleRule=document.styleSheets[0].addRule?function(selector,style){return document.styleSheets[0].addRule(selector,style,0);}:function(selector,style){return document.styleSheets[0].insertRule(selector+" {"+style+"}",0);};var removeStyleRule=document.styleSheets[0].removeRule?function(index){document.styleSheets[0].removeRule(index);}:function(index){document.styleSheets[0].removeRule(index);};function onContent(f){YuEvent.onDOMReady(f);}
function fixSelect(el)
{var value=el.getAttribute('m_value');if(value!=''){for(var i=0;i<el.options.length;i++){if(el.options[i].value==value){el.options[i].selected=true;break;}}}}
function getImgSize(dImg)
{var size=[-1,-1];if(dImg.naturalWidth!=null)
{size[0]=dImg.naturalWidth;size[1]=dImg.naturalHeight;}
else if(dImg.runtimeStyle)
{dImg.runtimeStyle.width='auto';dImg.runtimeStyle.height='auto';dImg.runtimeStyle.borderWidth='0';dImg.runtimeStyle.padding='0';size[0]=dImg.offsetWidth;size[1]=dImg.offsetHeight;dImg.runtimeStyle.width='';dImg.runtimeStyle.height='';dImg.runtimeStyle.borderWidth='';dImg.runtimeStyle.padding='';}else
{var dImgBk=dImg.cloneNode(true);dImg.className='';dImg.style.width='auto !important';dImg.style.height='auto !important';dImg.style.borderWidth='0 !important';dImg.style.padding='0 !important';dImg.removeAttribute('width');dImg.removeAttribute('height');size[0]=dImg.width;size[1]=dImg.height;dImg.setAttribute('width',dImgBk.getAttribute('width'));dImg.setAttribute('height',dImgBk.getAttribute('height'));dImg.style.width=dImgBk.style.width;dImg.style.height=dImgBk.style.height;dImg.style.padding=dImgBk.style.padding;dImg.style.borderWidth=dImgBk.style.borderWidth;dImg.style.className=dImgBk.style.className;};return(size);}
Iqube.Controller=function(portlet,econtent){if(portlet||econtent){this._portlet=portlet;this._econtent=econtent;portlet=null;econtent=null;}
this._jsInit();this._controllers=[];};Iqube.Controller._className="Iqube.Controller";Iqube.Controller.prototype.toString=function(){var s=getClassName(this);if(this._portlet)s+=" "+this._portlet.toString();if(this._econtent)s+=" "+util.toString(this._econtent);return"["+s+"]";};Iqube.Controller.prototype._getClassName=function(){var strConstructor=this.constructor.toString();var nFirstBracket=strConstructor.indexOf('(');return strConstructor.substr(0,nFirstBracket).split(' ')[1];};Iqube.Controller.prototype.setView=function(){this.activate();};Iqube.Controller.prototype.activate=function(){if(!this._bActivated&&this._domActivate){this._bActivated=true;this._domActivate();}};Iqube.Controller.prototype.portletContentChanged=function(){if(this._bActivated&&this._domDeactivate){this._domDeactivate();}
if(this._domActivate){this._domActivate();}};Iqube.Controller.prototype.portletResized=function(){};Iqube.Controller.prototype.deactivate=function(bCascade){if(arguments.length==0){bCascade=true;}
if(this._bActivated&&this._domDeactivate){this._bActivated=false;for(var i=0;this._controllers&&bCascade&&i<this._controllers.length;i++){if(this._controllers[i]&&this._controllers[i].deactivate)this._controllers[i].deactivate(bCascade);}
this._domDeactivate();}};Iqube.Controller.prototype.destruct=function(bCascade){if(arguments.length==0){bCascade=true;}
this.deactivate();for(var i=0;bCascade&&i<this._controllers.length;i++){if(this._controllers[i].destruct)this._controllers[i].destruct(bCascade);}
this._jsDestruct();this._portlet=null;this._econtent=null;this._controllers=[];};Iqube.Controller.prototype.isActivated=function(){return this._bActivated;};Iqube.Controller.prototype._jsInit=function(){};Iqube.Controller.prototype._domActivate=function(){};Iqube.Controller.prototype._domDeactivate=function(){};Iqube.Controller.prototype._jsDestruct=function(bCascade){if(this._bActivated)this.deactivate(bCascade);};Iqube.Controller.prototype._registerController=function(){for(var i=0;i<arguments.length;i++){var ctrl=arguments[i];var bIncluded=false;for(var j=0;!bIncluded&&j<this._controllers.length;j++){bIncluded=this._controllers[j]==ctrl;}
if(!bIncluded&&ctrl._isController&&ctrl._isController()){this._controllers[this._controllers.length]=ctrl;}}};Iqube.Controller.prototype._isController=function(){return true;}
Iqube.Controller.prototype._createCallback=function(bShowStatus,strPortletAction,strPortalAction,strPortalCAction){var controller=this;if(arguments.length==0)bShowStatus=true;if(arguments.length<=1)strPortletAction=null;if(arguments.length<=2)strPortalAction=null;if(arguments.length<=3)strPortalCAction=null;strPortletAction=strPortletAction||'';strPortalAction=strPortalAction||'';strPortalCAction=strPortalCAction||'';var callback=function(result){var resp=result.getResponse();if(bShowStatus){var msg=resp.html||resp.result||'請求巳成功地執行';MsgBar.addMsg(msg);}
if(!resp.isException){switch(strPortalCAction.toLowerCase()){case'invalidate':gPortalC.invalidate();break;default:}
switch(strPortalAction.toLowerCase()){case'refresh':controller._portlet.portal.invalidate();controller._portlet.portal.update(strPortletAction?[controller._portlet]:null);break;case'close':controller._portlet.portal.close();break;case'noaction':break;default:}
switch(strPortletAction.toLowerCase()){case'refresh':controller._portlet.refresh();break;case'close':controller._portlet.close();break;case'noaction':break;default:}}else{}
controller=null;};return callback;};Iqube.Controller.prototype.log=function(msg,cat,src){if(typeof cat=="undefined"){var cat="debug";}
if(typeof src=="undefined"){var src=typeof(this)=="function"?getClassName(this):this.toString();}
if(typeof msg!="string"){msg=JSON.stringify(msg,true);}
YAHOO.log(msg,cat,src);};Iqube.Controller.log=Iqube.Controller.prototype.log;Iqube.Controller.prototype.getEvent=function(){if(this._portlet&&this._portlet.getEvent){return this._portlet.getEvent.apply(this._portlet,$A(arguments));}};Iqube.Controller.prototype.removeEventListener=function(){if(this._portlet&&this._portlet.removeEventListener){return this._portlet.removeEventListener.apply(this._portlet,$A(arguments));}};Iqube.Controller.prototype.addEventListener=function(){if(this._portlet&&this._portlet.addEventListener){return this._portlet.addEventListener.apply(this._portlet,$A(arguments));}};Iqube.Controller.prototype.fireEvent=function(){if(this._portlet&&this._portlet.fireEvent){return this._portlet.fireEvent.apply(this._portlet,$A(arguments));}};Iqube.Controller.getController=function(el){var portletObj=fp(el,null,{portletObj:true});portletObj=portletObj&&portletObj.portletObj;return portletObj&&portletObj.getController();};var getController=Iqube.Controller.getController;Iqube.Controller.getPortletObj=function(el){var portletObj=fp(el,null,{portletObj:true});return portletObj&&portletObj.portletObj;};Iqube.Controller.__extend=function(subc,superc){var subproto=subc.prototype;if(!subproto.base){new superc;if(Config.DEBUG&&superc.instances)superc.instances.length--;var superproto=superc.prototype;for(var i in superproto){if(typeof subproto[i]=="undefined"){subproto[i]=superproto[i];}}
if(subproto.toString.toString().indexOf("[native code]")>=0){subproto["toString"]=superproto["toString"];}
subproto.base=superc;console.log(getClassName(superc)+' => '+getClassName(subc));}else{if(subproto.base!=superc)throw new Error('double inheritance: '+getClassName(subc)+'<='+getClassName(superc)+'; __base='+getClassName(subproto.base));}};Iqube.Controller.extend=function(realClass,baseClass,portlet,econtent){Iqube.Controller.__extend(realClass,baseClass);baseClass.apply(this,[portlet,econtent]);};Iqube.Controller.prototype.fcn=function(t,n,w){if(arguments.length<3)var w=false;if(n.constructor==Array){if(w)fca(this._econtent,t,"name",n,this,n);else return fca(this._econtent,t,"name",n);}
else{if(w)return this[n]=fc(this._econtent,t,{"name":n},null,true);else return fc(this._econtent,t,{"name":n},null,true);}};Iqube.Controller.prototype.getBaseZIndex=function(){return this._portlet?(this._portlet.baseZIndex||0):0;};function ConfirmUrlProcess()
{this.url;this.action;this.aliasid;this.aliasname;this.groupid;this.wfmemberid;this.ck;this.option;this.lang;}
ConfirmUrlProcess.prototype.encode=function(sitename,x)
{var path=[];var tmp;var query_arr=[];if(!sitename)sitename=Config.HOMESITE;if(x){this.action=null;this.aliasid=null;this.aliasname=null;this.groupid=null;this.wfmemberid=null;this.ck=null;this.option=null;this.lang=null;for(var prop in x){this[prop]=x[prop];}}
path.push(this.action);switch(ConfirmUrlProcess.whitelist[this.action]){case ConfirmUrlProcess.typeid['GID']:path.push(this.groupid);break;case ConfirmUrlProcess.typeid['GID_WFID']:path.push(this.groupid);path.push(this.wfmemberid);break;case ConfirmUrlProcess.typeid['GID_AID']:path.push(this.groupid);if(this.aliasid){path.push(this.aliasid);}else{path.push(this.aliasname);}
break;case ConfirmUrlProcess.typeid['AID']:if(this.aliasid){path.push(this.aliasid);}else{path.push(this.aliasname);}
break;case ConfirmUrlProcess.typeid['CK_WFID']:path.push(this.ck);path.push(this.wfmemberid);break;case ConfirmUrlProcess.typeid['LANG']:path.push(this.lang);break;case ConfirmUrlProcess.typeid['WFID_OPTION']:path.push(this.wfmemberid);path.push(this.option);break;case ConfirmUrlProcess.typeid['STANDARD']:break;default:path=[];path.push('invalid');break;}
return(this.url=sitename+this.implode(path));}
ConfirmUrlProcess.prototype.implode=function(path)
{return Config.ROOTPATH+'/process/'+path.join('/');}
ConfirmUrlProcess.typeid={'STANDARD':1,'GID':2,'GID_WFID':3,'GID_AID':4,'AID':5,'CK_WFID':6,'LANG':7,'WFID_OPTION':8};ConfirmUrlProcess.whitelist={'register':6,'emailchange':6,'cfminvitefriend':6,'cfmcommunityinvite':6,'cfmforgotpassword':6,'approveMember':3,'joinAsMember':2,'notAsMember':2,'createsubgroup':2,'createpermgroup':2,'editpermgroup':2,'memberprofile':5,'editcommunity':2,'communityinvite':4,'massinvite':2,'groupprofile':2,'removefromsn':5,'memberlist':2,'memberlistuc':2,'swlang':7,'becomefriends':5,'removemember':4,'addtoperm':4,'userinfo':1,'userinfo1':1,'registration':1,'createcommunity':1,'invitefriend':1,'blogprofileedit':1,'forgotpassword':1,'logout':1,'invalid':1,'getconfirm':1,'manageinvite':8,'removeperm':2,'subscribe':2,'unsubscribe':2,'invitetosite':1};ConfirmUrlProcess.isActionValid=function(action)
{if(ConfirmUrlProcess.whitelist[action]){return true;}else{return false;}};function UrlProcess(url)
{this.postid;this.spostid;this.typeid;this.aliasid;this.aliasname;this.grouppath='';this.groupid=null;this.setpath='';this.setid=null;this.revid;this.wfpostid;this.tagnames=[];this.tagids=[];this.commentid;this.scope;this.view='';this.aggrview='';this.element='';this.page;this.action='read';this.url;this.orderby;this.offset;this.limit;this.date;this.sitename;this.mode;this.attidx;this.prefid;this.searchParam={};if(url){this.url=url;var matches=url.match(/^((\w+):\/\/([^\/:]+)(:\d*)?)?([^# ?]*)(.*)$/);if(matches){var sitename=matches[3]||window.location.host;if(Config.DEFAULTDOMAIN&&sitename!=Config.DEFAULTDOMAIN){this.sitename=sitename;if(!this.resolveSitename()){throw new Error('External');}}
var protocol=matches[2];var port=matches[4];var path=matches[5];var query=matches[6];path=path.replace(Config.ROOTPATH,'');path=path.replace(/^\/|\/$/,'');var path_arr=path.split('/');for(var i=0,e=path_arr.length;i<e;i++){path_arr[i]=decodeURIComponent(path_arr[i]);}
this.decode(path_arr,query);}else{throw new Error('Invalid path:'+url);}}}
UrlProcess.prototype.decode=function(path,query)
{var matches,tmp;var test=path.shift();var arrQuery={};if(query&&query!=''){var queryPattern=/(?:^\?|&)(.*?)(?:(?:=)(.*?))?(?=&|$)/ig;while((matches=queryPattern.exec(query))!=null){arrQuery[matches[1]]=matches[2];}}
switch(test){case'home':if(this.scope!=null)throw new Error('Bad Url - duplicate scope');this.scope='home';this.view='portal';test=path.shift();if(!this.sitename){matches=test.match(/^@([^@]+)$|(^[^@]+$)/);if((matches==null)||!matches[0]){this.grouppath=Alias.name;}else{this.grouppath=matches[2]||'';this.groupid=(matches[1]?parseInt(matches[1]):null);test=path.shift();}}
if(arrQuery['edit']){this.action='edit';}
break;case'print':case'email':case'rss':case'sms':case'atom':this.scope=test;return true;case'process':this.scope='process';test=action=path.shift();if(ConfirmUrlProcess.isActionValid(test)){this.action=test;}else{this.action='invalid';}
this.element='';this.view='';return true;case Config.VIEWATTSCRIPT:case Config.DOWNLOADATTSCRIPT:this.scope='image';return true;default:if(this.scope==null)this.scope='world';break;}
switch(test){case'go':if(this.sitename&&this.scope=='world'){throw new Error('Redirect!');}
this.view='portal';test=path.shift();if(!test){return true;}else{this.page=test;test=path.shift();}
if(!test){return true;}else{throw new Error('bad url - path too long');}
break;case'admin':this.view='portal';this.action='admin';test=path.shift();if(!test){return true;}else{this.page=test;test=path.shift();}
if(!test){return true;}else{throw new Error('bad url - path too long');}
break;case'pref':this.view='single';this.element='pref';if(query&&query!=''){var queryPattern=/(?:^\?|&)(.*?)(?:(?:=)(.*?))?(?=&|$)/ig;while((matches=queryPattern.exec(query))!=null){switch(matches[1]){case'css':case'csspick':this.action=matches[1];break;case'__prefid':this.prefid=parseInt(matches[2]);break;default:throw new Error('Bad Url - invalid pref action');}}}else{throw new Error('Bad Url - invalid pref action');}
test=path.shift();if(!test){return true;}else{throw new Error('bad url - path too long');}
break;case'inset':if(this.scope=='world'){throw new Error('bad url - a home/group scope is required to view a set');}
this.view='aggregate';this.aggrview='byset';this.element='post';test=path.shift();matches=test.match(/^@([^@]+)$|(^[^@]+$)/);this.setpath=matches[2]||'';this.setid=(matches[1]?parseInt(matches[1]):null);test=path.shift();break;}
switch(test){case'postring':this.view='ring';this.element='post';test=path.shift();this.postid=test;test=path.shift();break;case'posts':this.view='aggregate';this.aggrview='';this.element='post';test=path.shift();if(arrQuery['__date']){this.date=arrQuery['__date'];}
break;case'sposts':this.view='aggregate';this.aggrview='';this.element='spost';test=path.shift();break;case'sets':if(this.scope!='home')throw new Error('bad URL - sets must be view under a home scope');this.view='aggregate';this.element='set';test=path.shift();break;case'members':this.view='aggregate';this.element='alias';test=path.shift();break;case'groups':case'tags':case'favorites':case'albums':case'videos':case'contents':case'documents':case'rssfeeds':this.view='aggregate';this.element=test.slice(0,-1);test=path.shift();break;default:break;}
if(this.view=='aggregate'){this.ordeby=arrQuery['orderby'];if(arrQuery['offset'])this.offset=parseInt(arrQuery['offset']);if(arrQuery['limit'])this.limit=parseInt(arrQuery['limit']);}
switch(test){case'post':if(this.view!=''&&this.view!='portal')throw new Error('bad URL - mixed single/aggregate view for post');this.view='single';this.element='post';if(query&&query!=''){var queryPattern=/(?:^\?|&)(.*?)(?:(?:=)(.*?))?(?=&|$)/ig;while((matches=queryPattern.exec(query))!=null){switch(matches[1]){case'edit':this.action=matches[1];this.typeid=matches[2];break;case'delete':case'remove':case'togglefav':case'send':case'ring:join':case'unring':this.action=matches[1];break;case'comment:reply':case'comment:remove':case'comment:read':this.action=matches[1];this.commentid=parseInt(matches[2]);break;case'wf:read':case'wf:delete':case'wf:approve':case'wf:deny':this.action=matches[1];this.wfpostid=parseInt(matches[2]);break;case'__attidx':this.attidx=parseInt(matches[2]);break;case'__mode':this.mode=matches[2];break;}}}
test=path.shift();this.postid=test;test=path.shift();break;case'spost':if(this.view!=''&&this.view!='portal')throw new Error('bad URL - mixed single/aggregate view for spost');this.view='single';this.element='spost';if(query&&query!=''){var queryPattern=/(?:^\?|&)(.*?)(?:(?:=)(.*?))?(?=&|$)/ig;while((matches=queryPattern.exec(query))!=null){switch(matches[1]){case'edit':this.action=matches[1];this.typeid=matches[2];break;case'delete':this.action=matches[1];break;}}}
test=path.shift();this.spostid=test;test=path.shift();break;case'person':if(this.view!=''&&this.view!='portal')throw new Error('bad URL - mixed single/aggregate view for person');this.view='single';this.element='alias';test=path.shift();matches=test.match(/^@([^@]+)$|(^[^@]+$)/);this.aliasname=matches[2];this.aliasid=(matches[1]?parseInt(matches[1]):null);test=path.shift();if(query&&query!=''){var queryPattern=/(?:^\?|&)(.*?)(?:(?:=)(.*?))?(?=&|$)/ig;while((matches=queryPattern.exec(query))!=null){switch(matches[1]){case'edit':this.action=matches[1];break;}}}
break;case'gmprofile':this.view='single';this.element='gmprofile';test=path.shift();if(query&&query!=''){var queryPattern=/(?:^\?|&)(.*?)(?:(?:=)(.*?))?(?=&|$)/ig;while((matches=queryPattern.exec(query))!=null){switch(matches[1]){case'edit':this.action=matches[1];break;default:throw new Error('Bad Url - gmprofile is edit-only');}}}
break;case'set':if(this.view!=''&&this.view!='portal')throw new Error('bad URL - mixed single/aggregate view for set');this.view='single';this.element='set';test=path.shift();matches=test.match(/^@([^@]+)$|(^[^@]+$)/);this.setpath=matches[2]||'';this.setid=(matches[1]?parseInt(matches[1]):null);test=path.shift();if(query&&query!=''){var queryPattern=/(?:^\?|&)(.*?)(?:(?:=)(.*?))?(?=&|$)/ig;while((matches=queryPattern.exec(query))!=null){switch(matches[1]){case'edit':case'delete':case'create':this.action=matches[1];break;}}}
break;case'spost':if(this.view!=''&&this.view!='portal')throw new Error('bad URL - mixed single/aggregate view for spost');this.view='single';this.element='spost';if(query&&query!=''){var queryPattern=/(?:^\?|&)(.*?)(?:(?:=)(.*?))?(?=&|$)/ig;while((matches=queryPattern.exec(query))!=null){switch(matches[1]){case'edit':this.action=matches[1];this.typeid=matches[2];break;case'delete':this.action=matches[1];break;}}}
test=path.shift();this.spostid=test;test=path.shift();break;default:break;}
if(test=='search'){this.action='search';this.view='aggregate';test=path.shift();if(query&&query!=''){var queryPattern=/(?:^\?|&)(?:_*)(.*?)(?:(?:=)(.*?))?(?=&|$)/ig;while((matches=queryPattern.exec(query))!=null){this.searchParam[matches[1]]=decodeURIComponent(matches[2]);}}}
if(test=='by'){if(this.view!='aggregate'||this.element!='post')throw new Error('bad URL - by must work with aggregate post view');test=path.shift();matches=test.match(/^@([^@]+)$|(^[^@]+$)/);this.aliasname=matches[2];this.aliasid=(matches[1]?parseInt(matches[1]):null);this.aggrview='byalias';test=path.shift();}
switch(test){case'tags':if(this.view=='single'||this.element=='set')throw new Error('bad URL - tags must work with non-set aggregate view');test=path.shift();while(test){this.tagnames.push(test);test=path.shift();}
if(this.view=='aggregate')this.aggrview='bytag';return true;break;case'inset':if((this.element!='post')&&(this.element!='spost'))throw new Error('bad URL - inset must work with post view');test=path.shift();matches=test.match(/^@([^@]+)$|(^[^@]+$)/);this.setpath=matches[2]||'';this.setid=(matches[1]?parseInt(matches[1]):null);if(this.view=='aggregate')this.aggrview='byset';test=path.shift();break;default:break;}
switch(test){case'rev':if(this.view=='aggregate'||this.element!='post')throw new Error('bad URL - rev must work with single post view');test=path.shift();this.revid=test;this.action='readrev';test=path.shift();break;}
if(test){throw new Error('bad URL - path is too long');}
return true;}
UrlProcess.prototype.readCachedDomain=function()
{var domain=UrlProcess.cachedDomains[this.groupid]||UrlProcess.cachedDomainsPath[this.grouppath]||false;return domain;}
UrlProcess.prototype.resolveSitename=function()
{for(var i in UrlProcess.cachedDomains){if(UrlProcess.cachedDomains[i]==this.sitename){this.groupid=i;break;}}
if(this.groupid){for(var i in UrlProcess.cachedDomainsPath){if(UrlProcess.cachedDomainsPath[i]==this.sitename){this.grouppath=i;break;}}
return true;}else{return false;}}
UrlProcess.prototype.encode=function()
{var path=[];var tmp;var query_arr=[];this.sitename=this.readCachedDomain();var sitename=(this.sitename||Config.DEFAULTDOMAIN);sitename=window.location.protocol+'//'+sitename;if(this.view=='portal'){if(sitename!=''&&sitename!=Config.HOMESITE){if(this.scope=='world')throw new Error('world level portal does not support customised sitenames');}else{switch(this.scope){case'world':path.push('go');if(this.page){path.push(encodeURIComponent(this.page));}
sitename=window.location.protocol+'//'+Config.DEFAULTDOMAIN;break;case'home':path.push('home');if(!this.sitename){tmp=(!this.grouppath)?('@'+this.groupid):(encodeURIComponent(this.grouppath));if(tmp==''){tmp=encodeURIComponent(Alias.name);}
path.push(tmp);}
if(this.action=='admin'){path.push('admin');if(this.page){path.push(encodeURIComponent(this.page));}}else if(this.page){path.push('go',encodeURIComponent(this.page));}
switch(this.action){case'edit':query_arr.push('edit');break;}
break;default:throw new Error('Invalid scope for a portal view:'+this.scope);break;}}
var query=query_arr.length==0?'':'?'+query_arr.join('&');return(this.url=sitename+this.implode(path)+query);}
if(this.scope=='home'){path.push('home');if(!this.sitename){tmp=(!this.grouppath)?('@'+this.groupid):(encodeURIComponent(this.grouppath));if(tmp==''){throw new Error('groupid or grouppath missing');}
path.push(tmp);}}
switch(this.view){case'aggregate':switch(this.element){case'post':if(this.setid!=null||this.setpath!=''){tmp=(this.setid!=null)?('@'+this.setid):(encodeURIComponent(this.setpath));path.push('posts','inset',tmp);}else{path.push('posts');}
if(this.aliasid!=null||this.aliasname!=null){path.push('by');tmp=(this.aliasid!=null)?('@'+this.aliasid):(encodeURIComponent(this.aliasname));path.push(tmp);}
if(this.date)query_arr.push('__date='+this.date);break;case'spost':if(this.setid!=null||this.setpath!=''){tmp=(this.setid!=null)?('@'+this.setid):(encodeURIComponent(this.setpath));path.push('sposts','inset',tmp);}else{path.push('sposts');}
if(this.aliasid!=null||this.aliasname!=null){path.push('by');tmp=(this.aliasid!=null)?('@'+this.aliasid):(encodeURIComponent(this.aliasname));path.push(tmp);}
break;case'alias':path.push('members');break;case'tag':case'set':case'group':case'favorite':case'rssfeed':case'album':case'video':case'content':case'document':path.push(this.element+'s');break;}
if(this.tagids.length>0||this.tagnames.length>0){path.push('tags');for(i=0;i<this.tagids.length;i++){path.push('@'+this.tagids[i]);}
for(i=0;i<this.tagnames.length;i++){path.push(encodeURIComponent(this.tagnames[i]));}}
if(this.action=='search'){path.push('search');for(var i in this.searchParam){query_arr.push('__'+i+'='+encodeURIComponent(this.searchParam[i]));}}
if(this.orderby)query_arr.push('orderby='+encodeURIComponent(this.orderby));if(this.offset)query_arr.push('offset='+this.offset);if(this.limit)query_arr.push('limit='+this.limit);var query=query_arr.length==0?'':'?'+query_arr.join('&');return(this.url=sitename+this.implode(path)+query);break;case'ring':if(this.postid!=''){path.push('postring');path.push(this.postid);}else{throw new Error('Postid is required for post ring');}
if(this.setid!=null||this.setpath!=''){path.push('inset');tmp=(this.setid!=null)?('@'+this.setid):(encodeURIComponent(this.setpath));path.push(tmp);}
return(this.url=sitename+this.implode(path));break;case'single':switch(this.element){case'post':if(this.postid!=''){path.push('post',this.postid);}else{throw new Error('Postid is required for post single view');}
if(this.setid!=null||this.setpath!=''){tmp=(this.setid!=null)?('@'+this.setid):(encodeURIComponent(this.setpath));path.push('inset',tmp);}
switch(this.action){case'readrev':if(this.revid!=null){path.push('rev',this.revid);}else{throw new Error('Revision # not present for action: readrev.');}
break;case'edit':query_arr.push('edit='+this.typeid);break;case'delete':query_arr.push('delete');break;case'remove':query_arr.push('remove');break;case'togglefav':query_arr.push('togglefav');break;case'comment:reply':query_arr.push('comment:reply='+this.commentid);break;case'comment:remove':query_arr.push('comment:remove='+this.commentid);break;case'comment:read':query_arr.push('comment:read='+this.commentid);break;case'ring:join':query_arr.push('ring:join');break;case'unring':query_arr.push('unring');break;case'send':query_arr.push('send');break;case'wf:read':query_arr.push('wf:read='+this.wfpostid);break;case'wf:delete':query_arr.push('wf:delete='+this.wfpostid);break;case'wf:approve':query_arr.push('wf:approve='+this.wfpostid);break;case'wf:deny':query_arr.push('wf:deny='+this.wfpostid);break;}
if(this.mode)query_arr.push('__mode='+this.mode);if(typeof this.attidx!='undefined')query_arr.push('__attidx='+this.attidx);break;case'spost':if(this.spostid!=''){path.push('spost',this.spostid);}else{throw new Error('SPostid is required for spost single view');}
if(this.setid!=null||this.setpath!=''){tmp=(this.setid!=null)?('@'+this.setid):(encodeURIComponent(this.setpath));path.push('inset',tmp);}
switch(this.action){case'edit':query_arr.push('edit='+this.typeid);break;case'delete':query_arr.push('delete');break;}
break;case'alias':if(this.aliasid!=''||this.aliasname!=''){path.push('person');tmp=(this.aliasid!=null)?('@'+this.aliasid):(encodeURIComponent(this.aliasname));path.push(tmp);}else{throw new Error('Aliasid/Aliasname is required for member single view');}
switch(this.action){case'edit':query_arr.push('edit');break;}
break;case'gmprofile':path.push('gmprofile');switch(this.action){case'edit':query_arr.push('edit');break;default:throw new Error('gmprofile is edit-only');}
break;case'set':if(this.setid!=null||this.setpath!=''){tmp=(this.setid!=null)?('@'+this.setid):(encodeURIComponent(this.setpath));path.push('set',tmp);}
switch(this.action){case'edit':query_arr.push('edit');break;case'delete':query_arr.push('delete');break;case'create':query_arr.push('create');break;}
break;case'pref':path.push('pref');switch(this.action){case'css':case'csspick':query_arr.push(this.action);break;default:throw new Error('Invalid Pref action');}
if(this.prefid){query_arr.push('__prefid='+this.prefid);}
break;default:throw new Error('Only post and member has single view');break;}
var query=query_arr.length==0?'':'?'+query_arr.join('&');return(this.url=sitename+this.implode(path)+query);break;default:throw new Error('Invalid view type:'+this.view);break;}
throw new Error('Unknown Error');}
UrlProcess.prototype.implode=function(path)
{return Config.ROOTPATH+'/'+path.join('/');}
UrlProcess.urlForTab=function(url)
{url=url.replace(/\b__[^=]+?(=[^&]*?)?(&|$)/g,'');url=url.replace(/(\?|&)$/,'');return url;}
UrlProcess.prototype.getFullAction=function()
{return this.scope.ucfirst()+this.element.ucfirst()+this.view.ucfirst()+this.action.ucfirst()+this.aggrview.ucfirst();}
UrlProcess.prototype.getPortalMenuTitle=function()
{return'_'+this.scope+this.element+this.view+this.action;}
var JSON=(function(){var pPr=false;var lvl;var indentLevel=0;var indent=function(a){if(!pPr)return a;a[a.length]=pPr==2?('                    ').substr(0,indentLevel*2):'<span style="padding-left:'+(indentLevel*15)+'px;">&nbsp;</span>';return a;};var newline=function(a){if(pPr){a[a.length]=pPr==2?'\n':'<br />';}
return a;};var highlight=function(a){if(pPr&&pPr!=2)return'<b>'+a+'</b>';return a;}
var pre=function(a){if(a.indexOf('<')>-1&&pPr!=2){return'<br /><textarea readonly="1" style="width:100%;height:10em;">'+(a.replace(/</g,'&lt;'))+'</textarea>';}
return'"'+a+'"';}
var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},s={array:function(x){var a=['['],b,f,i,l=x.length,v;a=newline(a);indentLevel++;for(i=0;i<l;i+=1){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=',';a=newline(a);}
a=indent(a);a[a.length]=v;b=true;}}}
indentLevel--;a=newline(a);a=indent(a);a[a.length]=']';return a.join('');},'boolean':function(x){return String(x);},'null':function(x){return"null";},number:function(x){return isFinite(x)?String(x):'null';},object:function(x){if(x){if(x instanceof Array){return s.array(x);}
if(pPr){if(x.nodeType&&x.nodeName){return x.nodeName;}
if(indentLevel>lvl)return'. . . .';}
var a=['{'],b,f,i,v;a=newline(a);indentLevel++;for(i in x){v=x[i];f=s[typeof v];if(f){v=pPr?(typeof v=='string'?pre(v):f(v)):f(v);if(typeof v=='string'){if(b){a[a.length]=',';a=newline(a);}
a=indent(a);a.push(highlight(s.string(i)),((pPr)?' : ':':'),v);b=true;}}}
indentLevel--;a=newline(a);a=indent(a);a[a.length]='}';return a.join('');}
return'null';},string:function(x){if(/["\\\x00-\x1f]/.test(x)){x=x.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;}
c=b.charCodeAt();return'\\u00'+
Math.floor(c/16).toString(16)+
(c%16).toString(16);});}
return'"'+x+'"';}};return{stringify:function(a,b,c){pPr=b;lvl=c||100;if(a==null||typeof(a)=="undefined")return a;switch(a.constructor){case Array:return s.array(a);case String:return s.string(a);case Boolean:return s.boolean(a);case Number:return s.number(a);case Object:default:return s.object(a);}},parse:function(a){if(a.constructor==String){try{return(eval('('+a+')'));}catch(e){return false;}}
return false;}};})();function unixtimetodate(input){var theDate=new Date(input*1000);return theDate.toLocaleString();}
function filename(path)
{var pathSeparator='/';if(path.indexOf('\\')>=0){pathSeparator='\\';}
var tokens=path.split(pathSeparator);return tokens[tokens.length-1];}
function basename(filename)
{var index=filename.lastIndexOf('.');if(index>=0){return filename.substr(0,index);}
else{return filename;}}
function extension(filename)
{var index=filename.lastIndexOf('.');if(index>=0){return filename.substr(index);}
else{return'';}}
String.prototype.ucfirst=function()
{if(this.length==0)return this;return this.charAt(0).toUpperCase()+this.substr(1);}
String.prototype.toFriendlyUrl=function()
{return this.replace(/[^-0-9A-Za-z]/g,'-');}
function toString(o,options){var defaultopts={'function':false};options=arguments.length==2?options:defaultopts;var strs=[];for(var key in o){if(o[key]&&o[key].constructor==Function){if(options['function']){strs.push(key+' = '+o[key]);}}
else{strs.push(key+' = '+o[key]);}}
return strs.join('\n');}
function getCookie(name,doc){if(arguments.length==1)doc=document;var arg=name+"=";var alen=arg.length;var clen=doc.cookie.length;var cookie=doc.cookie;var i=0;while(i<clen){var j=i+alen;if(cookie.substring(i,j)==arg){var endstr=cookie.indexOf(";",j);if(endstr==-1)
endstr=cookie.length;return unescape(cookie.substring(j,endstr));}
i=cookie.indexOf(" ",i)+1;if(i==0)
break;}
return null;}
function hex(d){var map=[0,1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F'];var h='';do{var remainder=d%16;h=map[remainder]+h;d=(d-remainder)/16;}while(d!=0);return h;}
function pad(s,n,c){if(arguments.length<3)c=' ';var d=n-s.length;while(0<d--)s=c+s;return s;}
function colorCode(r,g,b){return'#'+pad(hex(r),2,'0')+pad(hex(g),2,'0')+pad(hex(b),2,'0');}
function randColor(r,g,b){if(arguments.length!=3){r=0;g=0;b=0;}
r+=Math.random()*(255-r);g+=Math.random()*(255-g);b+=Math.random()*(255-b);return colorCode(Math.floor(r),Math.floor(g),Math.floor(b));}
String.prototype.plural=function(type,n){if(arguments.length==2){if(n==0||n==1){return this;}
else{return this.plural(type);}}
if(arguments.length){switch(type){case 2:return this+'es';break;case 3:return this.substring(0,this.length-1)+'ies';break;case 9:var map={'is':'are','was':'were','has':'have'};if(map[this]){return map[this];}
else{return this;}
break;case 1:default:return this+'s';break;}}
return this+'s';}
String.prototype.trim=function(){s=this.replace(/^\s*(.*?)\s*$/,'$1');return s;};function __getoid(prefix,postfix){if(arguments.length<1)var prefix="";if(arguments.length<2)var postfix="";if(!window.__oids)window.__oids={};var key='oid-'+prefix+'-'+postfix;if(typeof window.__oids[key]=="undefined")window.__oids[key]=0;return prefix+(++window.__oids[key])+postfix;};function __getuid(prefix,postfix){if(arguments.length<1)var prefix="";if(arguments.length<2)var postfix="";var d=window.document;do{var id=prefix+(Math.random()+"").substring(2)+postfix;}
while(d.getElementById(id));return id;};function count(obj){if(!(typeof obj=="object")){return 0;}
n=0;for(var i in obj)n++;return n;};function cloneNotEmpty(obj){var o={};for(var i in obj){if(typeof(obj[i])=="object"){var c=cloneNotEmpty(obj[i]);if(c)o[i]=c;}
else if(obj[i]){o[i]=obj[i];}}
if(count(o))return o;return false;};function onCondition(condition,action,delay,timeout){if(condition()){action();return false;}
delay=delay||100;timeout=timeout||60*1000;var id=setInterval(function(){if(condition()){clearInterval(id);action();return false;}
timeout-=delay;if(timeout<=0){console.log('onCondition failed: time out!');clearInterval(id);}},delay);return id;};function indexOf(arr,x){for(var i=0,e=arr.length;i<e;i++){if(arr[i]==x)return i;}
return-1;};function in_array(arr,x){return indexOf(arr,x)>=0;}
function keys(jsObj){var arr=[];for(var i in jsObj){arr[arr.length]=i;}
return arr;};function values(jsObj){var arr=[];for(var i in jsObj){arr[arr.length]=jsObj[i];}
return arr;}
function _(jsObj){return JSON.stringify(jsObj);}
function getClassName(obj){obj=obj||this;var con=typeof obj=="function"?obj:obj.constructor;if(con._className){return con._className;}
var strConstructor=typeof obj=="function"?obj.toString():obj.constructor.toString();var nFirstBracket=strConstructor.indexOf('(');return strConstructor.substr(0,nFirstBracket).split(' ')[1];};function pdh(parent,children){for(var name in children){var ndices=hIndex(parent[1],children[name]);var code=name+' = '+parent[0];for(var j in ndices){code+='.childNodes['+ndices[j]+']';}
code+=';';YAHOO.log(code);}};function hIndex(parent,child){var ndices=[];do{ndices[ndices.length]=indexOf(child.parentNode.childNodes,child);child=child.parentNode;}while(child!=parent);ndices.reverse();return ndices;};var util={};util.extend=function(subc,superc,fields){if(arguments.length>2){for(var i=2;i<arguments.length;i++){var f=arguments[i];if(typeof f=='string'){subc.prototype[f]=superc.prototype[f];}
else{util.extend.apply(this,subc,superc,f);}}}
else{for(var i in superc.prototype){if(typeof subc.prototype[i]=='undefined'){subc.prototype[i]=superc.prototype[i];}}}
return subc;};util.toString=function(el){var s=el.nodeName;if(el.nodeType!=3){if(el.type){s+='('+el.type+')';}
if(el.className){s+=' .'+el.className;}
if(el.getAttribute('id')){s+=' #'+el.getAttribute('id');}}
return"["+s+"]";};util.profiles=[];util.profile=function(f,n){if(f.constructor==Function){if(arguments.length<2)n=1;var t1=new Date().getTime();for(var i=0;i<n;i++){f();}
var t2=new Date().getTime();util.profiles.push({time:t1,name:f.toString()});return(t2-t1);}else{util.profiles.push({time:new Date().getTime(),name:f});}};util.clearProfile=function()
{util.profiles=[];}
util.profileResults=function(formatted)
{var html=[];var profiles=util.profiles;if(profiles.length>1){formatted?html.push('<table><tr><td>'+profiles[0].name+'</td><td>start</td></tr>'):html.push(profiles[0].name+': start');for(var i=1;i<profiles.length;i++){formatted?html.push('<tr><td>'+profiles[i].name+'</td><td>'+(profiles[i].time-profiles[i-1].time)+'ms</td></tr>'):html.push(profiles[i].name+':'+(profiles[i].time-profiles[i-1].time)+'ms');}
formatted?html.push('</table>'):'';}
return html.join('');}
util.getLoadingImgUrl=function(n){return Config.BASEPATH+'/portal/images/loading'+(typeof n=="undefined"?'':n)+'.gif';};util.getTime=function(d){if(d&&d.constructor!=Date){throw Error("input must be Date object");}
d=d||new Date();return d.getTime()+d.getMilliseconds()/1000;};util.isEmailAddress=function(value){return dojo.validate.isEmailAddress(value);var RE="([\da-z]+[-._+&'])*[\da-z]+@(([0-9a-zA-Z]([-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?\.)+(arpa|aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|xxx|jobs|mobi|post|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|fi|fj|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sk|sl|sm|sn|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])|(0[xX]0*[\da-fA-F]?[\da-fA-F]\.){3}0[xX]0*[\da-fA-F]?[\da-fA-F]|(0+[0-3][0-7][0-7]\.){3}0+[0-3][0-7][0-7]|(0|[1-9]\d{0,8}|[1-3]\d{9}|4[01]\d{8}|42[0-8]\d{7}|429[0-3]\d{6}|4294[0-8]\d{5}|42949[0-5]\d{4}|429496[0-6]\d{3}|4294967[01]\d{2}|42949672[0-8]\d|429496729[0-5])|0[xX]0*[\da-fA-F]{1,8}|([\da-fA-F]{1,4}\:){7}[\da-fA-F]{1,4}|([\da-fA-F]{1,4}\:){6}((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])))";var re=new RegExp("^"+RE+"$","i");return re.test(value);};util.isUrl=function(value){return dojo.validate.isUrl(value);var RE="((https?|ftps?)\://|)(([0-9a-zA-Z]([-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?\.)+(arpa|aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|xxx|jobs|mobi|post|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|fi|fj|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sk|sl|sm|sn|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])|(0[xX]0*[\da-fA-F]?[\da-fA-F]\.){3}0[xX]0*[\da-fA-F]?[\da-fA-F]|(0+[0-3][0-7][0-7]\.){3}0+[0-3][0-7][0-7]|(0|[1-9]\d{0,8}|[1-3]\d{9}|4[01]\d{8}|42[0-8]\d{7}|429[0-3]\d{6}|4294[0-8]\d{5}|42949[0-5]\d{4}|429496[0-6]\d{3}|4294967[01]\d{2}|42949672[0-8]\d|429496729[0-5])|0[xX]0*[\da-fA-F]{1,8}|([\da-fA-F]{1,4}\:){7}[\da-fA-F]{1,4}|([\da-fA-F]{1,4}\:){6}((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])))(\:(0|[1-9]\d*))?(/([^?#\s/]+/)*)?([^?#\s/]+(\?[^?#\s/]*)?(#[A-Za-z][\w.:-]*)?)?";var re=new RegExp("^"+RE+"$","i");return re.test(value);};util.isValidDate=function(dateValue,format){if(typeof format=="object"&&typeof format.format=="string"){format=format.format;}
if(typeof format!="string"){format="MM/DD/YYYY";}
var reLiteral=format.replace(/([$^.*+?=!:|\/\\\(\)\[\]\{\}])/g,"\\$1");reLiteral=reLiteral.replace("YYYY","([0-9]{4})");reLiteral=reLiteral.replace("MM","(0[1-9]|10|11|12)");reLiteral=reLiteral.replace("M","([1-9]|10|11|12)");reLiteral=reLiteral.replace("DDD","(00[1-9]|0[1-9][0-9]|[12][0-9][0-9]|3[0-5][0-9]|36[0-6])");reLiteral=reLiteral.replace("DD","(0[1-9]|[12][0-9]|30|31)");reLiteral=reLiteral.replace("D","([1-9]|[12][0-9]|30|31)");reLiteral=reLiteral.replace("ww","(0[1-9]|[1-4][0-9]|5[0-3])");reLiteral=reLiteral.replace("d","([1-7])");reLiteral="^"+reLiteral+"$";var re=new RegExp(reLiteral);if(!re.test(dateValue))return false;var year=0,month=1,date=1,dayofyear=1,week=1,day=1;var tokens=format.match(/(YYYY|MM|M|DDD|DD|D|ww|d)/g);var values=re.exec(dateValue);for(var i=0;i<tokens.length;i++){switch(tokens[i]){case"YYYY":year=Number(values[i+1]);break;case"M":case"MM":month=Number(values[i+1]);break;case"D":case"DD":date=Number(values[i+1]);break;case"DDD":dayofyear=Number(values[i+1]);break;case"ww":week=Number(values[i+1]);break;case"d":day=Number(values[i+1]);break;}}
var leapyear=(year%4==0&&(year%100!=0||year%400==0));if(date==31&&(month==4||month==6||month==9||month==11))return false;if(date>=30&&month==2)return false;if(date==29&&month==2&&!leapyear)return false;if(dayofyear==366&&!leapyear)return false;return true;};util.decodeQuery=function(query){var arrQuery={};var queryPattern=/(?:^\?|&)(.*?)(?:(?:=)(.*?))?(?=&|$)/ig;while((matches=queryPattern.exec(query))!=null){arrQuery[matches[1]]=decodeURIComponent(matches[2]);}
return arrQuery;};function Menu(container){this.container=container;this.overToggle=false;this.overMenu=false;this.timeoutId=0;this.nDelayInMillis=150;this.container.menu=this;};Menu.prototype.activate=function(){this.elToggle=fc2(this.container,2,null,/\btoggle\b/)[0];this.itemContainer=fc2(this.container,2,null,/\bitemContainer\b/)[0];this.menuItems=fc2(this.itemContainer,2,null,/\bitem\b/);this.toggleClass=this.elToggle.getAttribute('toggleClass');YuEvent.addListener(this.elToggle,'mouseover',this.toggleMouseOver,this);YuEvent.addListener(this.elToggle,'mouseout',this.toggleMouseOut,this);YuEvent.addListener(this.itemContainer,'mouseover',this.itemContainerMouseOver,this);YuEvent.addListener(this.itemContainer,'mouseout',this.itemContainerMouseOut,this);for(var i=0;i<this.menuItems.length;i++){var elItem=this.menuItems[i];YuEvent.addListener(elItem,'mouseup',this.itemMouseUp,this);}};Menu.prototype.deactivate=function(){YuEvent.removeListener(this.elToggle,'mouseover',this.toggleMouseOver,this);YuEvent.removeListener(this.elToggle,'mouseout',this.toggleMouseOut,this);YuEvent.removeListener(this.itemContainer,'mouseover',this.itemContainerMouseOver,this);YuEvent.removeListener(this.itemContainer,'mouseout',this.itemContainerMouseOut,this);for(var i=0;i<this.menuItems.length;i++){var elItem=this.menuItems[i];YuEvent.removeListener(elItem,'mouseup',this.itemMouseUp,this);}
this.elToggle=null;this.itemContainer=null;this.menuItems=null;this.container.menu=null;};Menu.prototype.showMenu=function(){if(this.onShowMenu){this.onShowMenu();}
if(this.itemContainer)YuDom.setStyle(this.itemContainer,"display",'block');};Menu.prototype.hideMenu=function(){if(this.onHideMenu){this.onHideMenu();}
if(this.itemContainer)YuDom.setStyle(this.itemContainer,"display",'none');};Menu.prototype.delayedHideMenu=function(){if(this.overToggle||this.overMenu)return;this.hideMenu();};Menu.prototype.toString=function(detail){if(detail){var obj={overToggle:this.overToggle,overMenu:this.overMenu,timeoutId:this.timeoutId,delay:this.nDelayInMillis,toggle:this.elToggle.style,item_con:this.itemContainer.style};return obj;}
return'Menu';};Menu.prototype.toggleMouseOver=function(evt,menu){if(menu.toggleClass)Element.replaceClassName(this,'',menu.toggleClass);menu.overToggle=true;menu.showMenu();};Menu.prototype.toggleMouseOut=function(evt,menu){if(menu.toggleClass)Element.replaceClassName(this,menu.toggleClass,'');menu.overToggle=false;if(!menu.overMenu){if(menu.timeoutId)clearTimeout(menu.timeoutId);menu.timeoutId=setTimeout(menu.delayedHideMenu.bind(menu),menu.nDelayInMillis);}};Menu.prototype.itemContainerMouseOver=function(evt,menu){menu.overMenu=true;};Menu.prototype.itemContainerMouseOut=function(evt,menu){menu.overMenu=false;if(!menu.overToggle){if(menu.timeoutId)clearTimeout(menu.timeoutId);menu.timeoutId=setTimeout(menu.delayedHideMenu.bind(menu),menu.nDelayInMillis);}};Menu.prototype.itemMouseUp=function(evt,menu){if(menu.timeoutId)clearTimeout(menu.timeoutId);menu.timeoutId=setTimeout(menu.hideMenu.bind(menu),menu.nDelayInMillis);};Iqube.Util.Highlight=function(el,config){Iqube.Controller.extend.apply(this,[Iqube.Util.Highlight,Iqube.Controller]);if(!el)throw Error(this+": Target element must not be empty!");this.elTarget=el;this.set(config);this.dirty=true;this.htop=null;this.hbottom=null;this.hleft=null;this.hright=null;this.rendered=false;this.nOId=__getoid('highlight-');};Iqube.Util.Highlight.className="Iqube.Util.Highlight";Iqube.Util.Highlight.prototype.toString=function(){return"["+this.nOId+" target: "+util.toString(this.elTarget)+"]";};Iqube.Util.Highlight.prototype.activate=function(){this.base.prototype.activate.call(this);this.render();};Iqube.Util.Highlight.prototype.deactivate=function(){this.dirty=true;if(this.rendered){rn(this.htop);rn(this.hbottom);rn(this.hleft);rn(this.hright);this.htop=null;this.hbottom=null;this.hleft=null;this.hright=null;this.rendered=false;}
this.elTarget=null;this.base.prototype.deactivate.call(this);};Iqube.Util.Highlight.prototype.show=function(recalc){if(!this.rendered)return;if(recalc||this.dirty){var target=this.elTarget;var c=getCorners(target);if(ie){var dX=parseInt(YuDom.getStyle(target,'borderLeftWidth'));var dY=parseInt(YuDom.getStyle(target,'borderTopWidth'));if(!isNaN(dX)){c.x-=dX;c.x2-=dX;}
if(!isNaN(dY)){c.y-=dY;c.y2-=dY;}}
YuDom.applyStyle(this.htop,{left:c.x-this.width+'px',top:c.y-this.width+'px',width:c.x2-c.x+2*this.width+'px',height:this.width+'px',background:this.color,zIndex:this.zIndex});YuDom.applyStyle(this.hright,{left:c.x2+'px',top:c.y-this.width+'px',height:c.y2-c.y+2*this.width+'px',width:this.width+'px',background:this.color,zIndex:this.zIndex});YuDom.applyStyle(this.hbottom,{left:c.x-this.width+'px',top:c.y2+'px',width:c.x2-c.x+2*this.width+'px',height:this.width+'px',background:this.color,zIndex:this.zIndex});YuDom.applyStyle(this.hleft,{left:c.x-this.width+'px',top:c.y-this.width+'px',height:c.y2-c.y+2*this.width+'px',width:this.width+'px',background:this.color,zIndex:this.zIndex});this.dirty=false;}
if(this.animation){YuDom.setStyle([this.htop,this.hright,this.hbottom,this.hleft],'display','block');YuDom.setStyle([this.htop,this.hright,this.hbottom,this.hleft],'visibility','visible');var effect=new this.animation.func([this.htop,this.hright,this.hbottom,this.hleft],this.animation.options);effect.custom.apply(effect,this.animation.params);}else{YuDom.setStyle([this.htop,this.hright,this.hbottom,this.hleft],'display','block');}};Iqube.Util.Highlight.prototype.hide=function(){if(!this.rendered)return;YuDom.setStyle([this.htop,this.hright,this.hbottom,this.hleft],'display','none');};Iqube.Util.Highlight.prototype.render=function(){if(!this.rendered){var style={width:this.width+'px',height:this.width+'px',position:'absolute',display:'none',padding:'0px',background:this.color,fontSize:'0px',zIndex:this.zIndex};this.htop=cex('div',{id:__getuid(this.nOId+'-'),style:style});this.hright=cex('div',{id:__getuid(this.nOId+'-'),style:style});this.hbottom=cex('div',{id:__getuid(this.nOId+'-'),style:style});this.hleft=cex('div',{id:__getuid(this.nOId+'-'),style:style});ac(this.htop);ac(this.hright);ac(this.hbottom);ac(this.hleft);this.rendered=true;}};Iqube.Util.Highlight.prototype.setColor=function(color){this.color=color;this.dirty=true;};Iqube.Util.Highlight.prototype.setWidth=function(width){this.width=width;this.dirty=true;};Iqube.Util.Highlight.prototype.setZIndex=function(index){this.zIndex=index;this.dirty=true;};Iqube.Util.Highlight.prototype.set=function(config,show){config=config||{};this.width=config.width||this.width||2;this.color=config.color||this.color||'#f00';this.zIndex=config.zIndex||this.zIndex||10005;this.animation=config.animation||this.animation;this.dirty=true;if(show)this.show();};Iqube.Util.Highlight.prototype.scrollIntoView=function(){if(!this.rendered)return;var scroll=new fx.ScrollIntoView(this.htop,{padding:50,duration:400});scroll.start();};Iqube.Util.Highlight.highlight=function(element,config){if(!this.highlights)this.highlights=[];var h=this._getHighlight(element,config);h.show();};Iqube.Util.Highlight.lowlight=function(element){var h=null;for(var i=0;!h&&i<this.highlights.length;i++){var t=this.highlights[i];if(t.elTarget==element)h=t;}
if(h)h.hide();};Iqube.Util.Highlight._getHighlight=function(element,config){var h=null;for(var i=0;!h&&i<this.highlights.length;i++){var t=this.highlights[i];if(t.elTarget==element)h=t;}
if(!h){var h=new Iqube.Util.Highlight(element,config);h.render();this.highlights.push(h);}
else{h.set(config);}
return h;};function InlineEditor(element,event,postedit,preedit)
{var oldHtml=element.innerText||element.textContent||'';if(oldHtml=='')element.innerHTML='&nbsp;&nbsp;&nbsp;';var editElement=function(){if(oldHtml=='')this.innerHTML='';if(preedit&&!preedit(this,event))return false;oldHtml=this.innerText||this.textContent||'';var oldTitle=this.title;this.title='請按 ENTER 鍵儲存';this.innerHTML='<input type="text" class="InlineEditor" />';var edit=this.firstChild;edit.style.marginLeft=0;if(ie){if(parseInt(YuDom.getStyle(edit.parentNode,'margin-left'))==edit.offsetLeft){edit.style.marginLeft=-edit.offsetLeft+'px';}}
edit.style.height=this.offsetHeight-4+'px';edit.value=oldHtml;edit.m_postedit=postedit;edit.m_preedit=preedit;edit.m_fh=new InputFocusHandler(edit);edit.focus();edit.select();edit.onkeydown=function(e){e=YuEvent.getEvent(e);var keyCode=e.keyCode;if(keyCode==13||keyCode==27||keyCode==9){this.onblur(e);return false;}};edit.onblur=function(e){this.onblur=null;this.onkeydown=null;e=YuEvent.getEvent(e);YuEvent.stopEvent(e);this.parentNode.title=oldTitle;var m_postedit=this.m_postedit;var m_preedit=this.m_preedit;var element=this.parentNode;if(this.m_postedit)this.m_postedit(this.value);this.m_postedit=null;this.m_preedit=null;this.m_fh.destruct();this.m_fh=null;rc(ctn(this.value),this);new InlineEditor(element,event,m_postedit,m_preedit);event=null;element=null;return false;}
oldHtml=null;edit=null;this[event]=null;postedit=null;preedit=null;}
element[event]=editElement;element.title=element.title||'點擊來進行編輯';element=null;editElement=null;};function MouseActivator(toggle,target){this.toggle=toggle;this.target=target;this.timeoutId=0;this.nDelayInMillis=150;this.state='default';this.overToggle=false;this.overTarget=false;if(this.toggle)this.toggle.m_act=this;if(this.target)this.target.m_act=this;};MouseActivator.prototype.activate=function(){if(this.toggle){YuEvent.addListener(this.toggle,'mouseover',this.toggleMouseOver,this);YuEvent.addListener(this.toggle,'mouseout',this.toggleMouseOut,this);}
if(this.target){YuEvent.addListener(this.target,'mouseover',this.targetMouseOver,this);YuEvent.addListener(this.target,'mouseout',this.targetMouseOut,this);}};MouseActivator.prototype.deactivate=function(){if(this.toggle){YuEvent.removeListener(this.toggle,'mouseover',this.toggleMouseOver,this);YuEvent.removeListener(this.toggle,'mouseout',this.toggleMouseOut,this);this.toggle.m_act=null;this.toggle=null;}
if(this.target){YuEvent.removeListener(this.target,'mouseover',this.targetMouseOver,this);YuEvent.removeListener(this.target,'mouseout',this.targetMouseOut,this);this.target.m_act=null;this.target=null;}};MouseActivator.prototype.activateTarget=function(){if(this.state=='activating'||this.state=='activated')return;this.state='activating';if(this.onActivate){this.onActivate();}
this.state='activated';};MouseActivator.prototype.deactivateTarget=function(){if(this.state=='deactivating'||this.state=='deactivated')return;this.state='deactivating';if(this.onDeactivate){this.onDeactivate();}
this.state='deactivated';};MouseActivator.prototype.delayedDeactivate=function(){if(this.overToggle||this.overTarget)return;this.deactivateTarget();};MouseActivator.prototype.toString=function(detail){if(arguments.length==0||!detail){return'MouseActivator';}
return toString(this);};MouseActivator.prototype.toggleMouseOver=function(evt,menu){menu.overToggle=true;menu.activateTarget();};MouseActivator.prototype.toggleMouseOut=function(evt,menu){menu.overToggle=false;if(!menu.overTarget){if(menu.timeoutId)clearTimeout(menu.timeoutId);menu.timeoutId=setTimeout(menu.delayedDeactivate.bind(menu),menu.nDelayInMillis);}};MouseActivator.prototype.targetMouseOver=function(evt,menu){menu.overTarget=true;};MouseActivator.prototype.targetMouseOut=function(evt,menu){menu.overTarget=false;if(!menu.overToggle){if(menu.timeoutId)clearTimeout(menu.timeoutId);menu.timeoutId=setTimeout(menu.delayedDeactivate.bind(menu),menu.nDelayInMillis);}};MouseActivator.prototype.setDeactivateDelay=function(nDelay){this.nDelayInMillis=arguments.length?nDelay:150;return this.nDelayInMillis;};MouseActivator.prototype.getState=function(){return this.state;};MouseActivator.prototype.setState=function(newstate){if(this.state=='default')this.state=newstate;return this.state;};var ClickHandler={container:window.document,element:null,callback:null,condition:null,bSuspended:false,stack:[],INSIDE:'inside',OUTSIDE:'outside',activate:function(){var _this=this;this.container.onclick=function(event){if(!_this.bSuspended)_this._fireEvent(YuEvent.getEvent(event,false));};},resume:function(){setTimeout(function(){this.bSuspended=false;}.bind(this),100);},suspend:function(){this.bSuspended=true;},push:function(){if(this.element){this.stack.push({element:this.element,callback:this.callback,condition:this.condition});this.element=null;this.callback=null;}},pop:function(){if(this.stack.length>0){setTimeout(function(){var obj=this.stack.pop();this.element=obj.element;this.callback=obj.callback;this.condition=obj.condition;}.bind(this),100);}},addListener:function(el,f,c){this.clearCurrent();this.element=el;this.callback=f;this.condition=c||this.INSIDE;},clearCurrent:function(){if(this.element){this._fireEvent(null,true);}},removeListener:function(el){if(this.element==el){this.element=null;this.callback=null;}},_fireEvent:function(event,forced){if(!this.element||this.element.offsetWidth==0){this.removeListener(this.element);}else if
(forced||this.condition==this.INSIDE&&happensInElement(event,this.element)||this.condition==this.OUTSIDE&&!happensInElement(event,this.element)){this.callback.call(this.element);}},deactivate:function(){this.element=null;this.callback=null;for(var i=0;i<this.stack.length;i++){this.stack[i].element=null;this.stack[i].callback=null;}
this.container.onclick=null;}};function FocusHandler(el,fOnMouseOver,fOnMouseOut,fOnFocus,fOnBlur){if(arguments.length==0)return;this.el=el;var isFocus=false;var onFocus=function(e,args){fOnFocus.apply(args[0]);isFocus=true;};var onBlur=function(e,args){fOnBlur.apply(args[0]);isFocus=false;};var onMouseOver=function(e,args){if(!isFocus)fOnMouseOver.apply(args[0]);};var onMouseOut=function(e,args){if(!isFocus)fOnMouseOut.apply(args[0]);};YuEvent.addListener(el,'mouseover',onMouseOver,[el]);YuEvent.addListener(el,'mouseout',onMouseOut,[el]);YuEvent.addListener(el,'focus',onFocus,[el]);YuEvent.addListener(el,'blur',onBlur,[el]);el=null;this.destruct=function(){YuEvent.removeListener(this.el,'mouseover',onMouseOver);YuEvent.removeListener(this.el,'mouseout',onMouseOut);YuEvent.removeListener(this.el,'focus',onFocus);YuEvent.removeListener(this.el,'blur',onBlur);this.el=null;onMouseOver=null;onMouseOut=null;onFocus=null;onBlur=null;fOnMouseOver=null;fOnMouseOut=null;fOnFocus=null;fOnBlur=null;};};function InputFocusHandler(el,strHighlight,strLowlight){strHighlight=strHighlight||'#8F8';strLowlight=strLowlight||'#DDD';var fFocus=el.onFocus;var fBlur=el.onBlur;var fOver=el.onMouseOver;var fOut=el.onMouseOut;var showBorder=function(e){this.style.border='2px solid '+strHighlight;this.style.padding='0';};var hideBorder=function(e){this.style.border='1px solid '+strLowlight;this.style.padding='1px';};var onFocus=function(e){if(fFocus){fFocus.apply(this);}
this.select();showBorder.apply(this);};var onBlur=function(e){if(fBlur){fBlur.apply(this);}
hideBorder.apply(this);};var onMouseOver=function(e){if(fOver){fOver.apply(this);}
showBorder.apply(this);};var onMouseOut=function(e){if(fOut){fOut.apply(this);}
hideBorder.apply(this);};var fh=new FocusHandler(el,onMouseOver,onMouseOut,onFocus,onBlur);el=null;return fh;};var Help={toggle:null,receiver:null,htop:null,hright:null,hbottom:null,hleft:null,capture:null,borderWidth:1,helpurl:Config.ROOTPATH+'/help',init:function(){this.toggle=document.getElementById('helptoggle');if(!this.toggle)return;this.receiver=document.getElementById('helpreceiver');var style={width:'2px',height:'2px',position:'absolute',display:'none',padding:'0px',background:'#f88',fontSize:'0px'};this.htop=cex('div',{style:style});this.hright=cex('div',{style:style});this.hbottom=cex('div',{style:style});this.hleft=cex('div',{style:style});ac(this.htop);ac(this.hright);ac(this.hbottom);ac(this.hleft);YuEvent.addListener(this.toggle,'click',this.starttrace.bind(this));},starttrace:function(){this.receiver.style.cursor='help';Element.replaceClassName(document.body,'','help');this.capture=new Capture(this.receiver,'click|mouseover|mouseout',function(e,source){this.source=source;if(source!=this.highlight){this.trace(e,source);}else{if(e.type=='click'){this.stoptrace();this.help(this.token);}}}.bind(this));this.capture.start();},trace:function(e,source){var target=fp(source,null,{helptoken:true});switch(e.type){case'click':this.stoptrace(source,target);if(this.source&&this.source.nodeName&&this.source.nodeName.toUpperCase()=='HTML'){var p=YuEvent.getXY(e);var r=YuDom.getRegion(document.body);var bInPage=p[0]>=r.left&&p[0]<=r.right&&p[1]>=r.top&&p[1]<=r.bottom;if(!bInPage)return;}
this.help(this.token);break;case'mouseover':default:this.highlight(source,target);this.token=target?(target.getAttribute('helptoken')||target.helptoken):"";this.target=target;break;}},stoptrace:function(source,target){this.receiver.style.cursor='';Element.replaceClassName(document.body,'help','');YuDom.setStyle(this.htop,'display','none');YuDom.setStyle(this.hright,'display','none');YuDom.setStyle(this.hbottom,'display','none');YuDom.setStyle(this.hleft,'display','none');this.capture.stop();this.capture=null;},highlight:function(source,target){if(target==this.target)return;if(target){var c=getCorners(target);if(ie){var dX=parseInt(YuDom.getStyle(target,'borderLeftWidth'));var dY=parseInt(YuDom.getStyle(target,'borderTopWidth'));if(!isNaN(dX)){c.x-=dX;c.x2-=dX;}
if(!isNaN(dY)){c.y-=dY;c.y2-=dY;}}
YuDom.applyStyle(this.htop,{left:c.x-2*this.borderWidth-1+'px',top:c.y-2*this.borderWidth-1+'px',width:c.x2-c.x+2*this.borderWidth+'px',display:'block'});YuDom.applyStyle(this.hright,{left:c.x2-1+'px',top:c.y-2*this.borderWidth-1+'px',height:c.y2-c.y+2*this.borderWidth+2+'px',display:'block'});YuDom.applyStyle(this.hbottom,{left:c.x-2*this.borderWidth-1+'px',top:c.y2-1+'px',width:c.x2-c.x+2*this.borderWidth+2+'px',display:'block'});YuDom.applyStyle(this.hleft,{left:c.x-2*this.borderWidth-1+'px',top:c.y-2*this.borderWidth-1+'px',height:c.y2-c.y+2*this.borderWidth+'px',display:'block'});}
else{this.htop.style.display='none';this.hright.style.display='none';this.hbottom.style.display='none';this.hleft.style.display='none';}},help:function(token){this.load(token);},load:function(token){var url=this.helpurl+'?t='+(token?encodeURIComponent(token):'');this.helpwin=window.open(url,'HelpOn'+window.location.host,'resizable=yes,status=no,menubar=no,location=yes,scrollbars=yes');},deactivate:function(){if(!this.toggle)return;YuEvent.removeListener(this.toggle,'click',this.starttrace.bind(this));if(this.capture){this.capture.stop();}
this.toggle=null;this.receiver=null;this.htop=null;this.hright=null;this.hbottom=null;this.hleft=null;this.helpwin=null;this.target=null;this.source=null;}};Iqube.Util.Help2={el:null,nElId:null,oDialog:null,tags:["a","div","span","img","table"],nodes:[],overlays:[],highlights:[],sImgIds:[],helpContents:{},token2id:{"toolbar_myPortal":"toolbar_myPortal"},sImgUrl2:Config.BASEPATH+"/portal/images/help.gif",sImgUrl1:Config.BASEPATH+"/portal/images/help_on.gif",sColor1:'#f88',sColor2:'#8f8',nWidth1:2,nWidth2:4,overlayWidth:16,overlayHeight:16,render:function(){if(!this.el){this.nElId=__getuid("Help2-");this.el=cex('div',{id:this.nElId,innerHTML:'<div class="hd"></div><div name="bd" class="bd"></div>'});ac(this.el);this.oDialog=new YAHOO.widget.Dialog(this.nElId,{fixedcenter:true,visible:false,modal:true,constraintoviewport:true,close:false,autoSize:true,buttons:[{text:"Home",handler:this.helpHome.bind(this)},{text:"Prev",handler:this.helpPrev.bind(this)},{text:"Next",handler:this.helpNext.bind(this)},{text:"Close",handler:this.hideHelp.bind(this),isDefault:true}]});this.oDialog.render();}},activate:function(){this.render();},deactivate:function(){this.hideHelp();this.el=null;this.oDialog=null;},handleClose:function(){throw Error("not implemented function handleClose");},helpHome:function(){if(this.homeToken){this.loadHelp(this.homeToken);}},helpPrev:function(){var ndx=indexOf(this.nodes,this.target);if(ndx<=0||!ndx)return;ndx--;this.loadHelp([this.nodes[ndx],this.overlays[ndx],this.highlights[ndx]]);},helpNext:function(){var ndx=indexOf(this.nodes,this.target);if(ndx>=this.nodes.length-1)return;ndx++;this.loadHelp([this.nodes[ndx],this.overlays[ndx],this.highlights[ndx]]);},showHelp:function(homeToken){this.render();this.oDialog.setHeader("");this.oDialog.setBody("正在載入幫助. 請稍侯…")
this.oDialog.show();this.addMarkers();this.homeToken=homeToken;if(this.homeToken){this.loadHelp(this.homeToken);}
else{this.oDialog.setHeader("幫助");this.oDialog.setBody("請在<img src='"+this.sImgUrl1+"'/>上按鼠標選擇需要協助的部份!");}},hideHelp:function(){this.removeMarkers();if(this.oDialog)this.oDialog.hide();},addMarkers:function(){this.nodes=[];this.overlays=[];this.sImgIds=[];for(var i=0;i<this.tags.length;i++){var els=fc(document.body,this.tags[i],{helpToken:true});this.nodes=this.nodes.concat(els);}
for(var i=0;i<this.nodes.length;i++){var h=this.addMarker(this.nodes[i]);if(!h){this.nodes.splice(i,1);i--;}}},removeMarkers:function(){this.nodes=[];for(var i=0;i<this.overlays.length;i++){$(this.sImgIds[i]).onclick=null;this.overlays[i].hide();rn(this.overlays[i].element);this.highlights[i].deactivate();}
this.overlays=[];this.highlights=[];this.sImgIds=[];},addMarker:function(e){var xy=getXY(e);if(typeof xy['x']=="undefined"||typeof xy['y']=="undefined"){return;}
var sMarkerId=__getuid("Help2-marker-");var sImgId=sMarkerId+'-img';var o=new YAHOO.widget.Overlay(sMarkerId,{width:"16px",visible:true,xy:this._getOverlayPosition(e)});o.setBody("<img style='cursor:pointer;-moz-user-select:none;' unselectable='1' id='"+sImgId+"' src='"+this.sImgUrl1+"'/>");o.render(document.body);var h=new Iqube.Util.Highlight(e,{color:this.sColor1});h.activate();h.show();$(sMarkerId).style.zIndex=10007;$(sImgId).onclick=this.loadHelp.bind(this,[e,o,h]);this.overlays.push(o);this.highlights.push(h);this.sImgIds.push(sImgId);return h;},loadHelp:function(args,e){if(this.target){var ndx=indexOf(this.nodes,this.target);if(ndx>=0)this.highlights[ndx].set({color:this.sColor1,width:this.nWidth1});}
if(typeof args=="string"){var token=args;delete this.target;}
else{var element=args[0];var overlay=args[1];var highlight=args[2];var token=element.getAttribute("helpToken");this.target=element;highlight.set({color:this.sColor2,width:this.nWidth2});highlight.scrollIntoView();}
if(this.helpContents[token]){this.displayHelpPage(this.helpContents[token]);}
else{this.oDialog.setBody('<img src="'+Config.BASEPATH+'/portal/images/loading3.gif"/>');this.onHelpContentReady(token,this.loadHelp.bind(this,args,e));}},onHelpContentReady:function(token,action){if(this.helpContents[token]){action();return;}
var onReturn=function(result,args){var resp=result.getResponse();if(!resp.isException){var post=resp.result;post=post||{};post.helpToken=token;this.helpContents[token]=post;action();}else{MsgBar.addMsg(resp.html);}};var filter={helpToken:token};if(typeof this.token2id[token]=="number"){var filter={post_id:this.token2id[token]};}
else{var filter={helpToken:this.token2id[token]||token};}
var ajx=new AjxAction('iqube','getPage');ajx.set('search',filter);ajx.setCallback(onReturn.bind(this));ajx.fire();},displayHelpPage:function(page){if(page.post_id){var title="<h3 class='title'>"+page.title+"</h3>";var body="<div style='padding:3px;'>"+page.body+"<div>";}
else{var title="";var body="<div class='instruction' style='padding:3px;'>沒法提供幫助.<div>";}
var header="幫助 \""+page.helpToken+"\"";this.oDialog.setHeader(header);this.oDialog.setBody(title+body);if(this.oDialog.autoSize)this.oDialog.autoSize();this.oDialog.center();},_getOverlayPosition:function(element){var c=getCorners(element);if(ie){var dX=parseInt(YuDom.getStyle(element,'borderLeftWidth'));var dY=parseInt(YuDom.getStyle(element,'borderTopWidth'));if(!isNaN(dX)){c.x-=dX;c.x2-=dX;}
if(!isNaN(dY)){c.y-=dY;c.y2-=dY;}}
var left=0;var top=0;var width=c.x2-c.x;if(width>this.overlayWidth)left=c.x;else left=(c.x+c.x2-this.overlayWidth)/2;var height=c.y2-c.y;if(height>this.overlayHeight)top=c.y;else top=(c.y+c.y2-this.overlayHeight)/2;return[left,top];}};function IqubeMsg(){}
IqubeMsg['set']="文件夾";IqubeMsg['setpicker']="搜索文件夾";IqubeMsg["search"]="搜索";IqubeMsg["selectSet"]="請選擇文件夾";IqubeMsg["_name"]="名稱";IqubeMsg["group"]="群組";IqubeMsg["searchBySetname"]="文件夾名";IqubeMsg["searchByGroupname"]="社群名稱";IqubeMsg["searchByTag"]="標籤";IqubeMsg["searchBy"]="搜索方式"
IqubeMsg["group_path"]="群組";IqubeMsg["ownername"]="作者";IqubeMsg['group_displayname']="群組的顯示名稱";IqubeMsg['group_name']="社群名稱";IqubeMsg["postpicker"]="搜索文章";IqubeMsg["title"]="標題";IqubeMsg["tag_list"]="標籤";IqubeMsg["t_stamp"]="時間";IqubeMsg["name"]="Name";IqubeMsg["grouppicker"]="Search Group";IqubeMsg["path"]="Path";IqubeMsg["description"]="Description";IqubeMsg["description_short"]="Description";IqubeMsg['aliaspicker']="搜索人物";IqubeMsg["alias_id"]="登入名稱";IqubeMsg["aliasname"]=" 登入名稱";IqubeMsg["displayname"]="顯示名稱";IqubeMsg["_id"]="ID";IqubeMsg["add"]="增加";IqubeMsg["remove"]="移除";IqubeMsg["range"]="每頁顯示數目";IqubeMsg["editSave"]="儲存";IqubeMsg["editCancel"]="取消";IqubeMsg["preview"]="預覽";IqubeMsg["columnlist_NoResultFound"]="未找到結果";IqubeMsg["columnlist_SearchTips"]="-請輸入搜索字句-";IqubeMsg["columnlist_Loading"]="-載入中-";IqubeMsg['perm_public']="公開";IqubeMsg['perm_private']="祇有我";IqubeMsg['perm_logged_in']="已登入會員";IqubeMsg['perm_sn']="我的朋友圈";IqubeMsg['perm_member']="會員";IqubeMsg['perm_advanced']="進階";IqubeMsg['set_perm_read']="誰人可看見這文件夾?";IqubeMsg['set_perm_createPost']="誰人可提交內容來批核?";IqubeMsg['set_perm_publishPost']="誰人可直接發表一個內容?";IqubeMsg['set_perm_readPost']="進入閱讀的預置名單"
IqubeMsg['set_perm_editPost']="進入編輯的預置名單"
IqubeMsg['set_perm_commentPost']="進入留言的預置名單"
IqubeMsg['set_wf_voter']="誰人可投票來批準內容?";IqubeMsg['post_perm_read']="<b>誰人可閱讀</b>?";IqubeMsg['post_perm_edit']="<b>誰人可編輯</b>?<br/><i>所選擇的會員可獲得瀏覽權</i>";IqubeMsg['post_perm_comment']="<b>誰人可作出留言</b>?<br/><i>所選擇的會員可獲得瀏覽權</i>";IqubeMsg['post_perm_ring']="<b>誰人可將文章串鏈</b>?<br/><i>所選擇的會員可獲得瀏覽權</i>";IqubeMsg['portal_perm_read']="誰人可看見這網頁?";IqubeMsg['blog']='網誌';function CallResult(bStatus,strErrorMsg,objData){this.status=bStatus;this.errorMsg=strErrorMsg;this.data=objData;this.getStatus=function(){return this.status;};this.getErrorMsg=function(){return this.errorMsg;};this.getData=function(){return this.data;};};function SoapCall(strService,objCtrlData,objCaller,funcCallback){this.strService=strService;this.objCtrlData=objCtrlData;this.objCaller=objCaller;this.funcCallback=funcCallback;this._ajxCallback=function(result){if(this.funcCallback){this._callback(result);}};this._errorCallback=function(ex){if(this.funcCallback){this._callback(new CallResult(false,'Exception: "'+ex.getMessage()+'"'));}};this._callback=function(callResult){var tFunc=this.funcCallback;var tCaller=this.objCaller;this.destruct();if(tCaller&&tFunc){tFunc.call(tCaller,callResult);}
else{tFunc(callResult);}};this._loadWSData=function(objData,soapDoc){for(var field in objData){soapDoc.set(field,objData[field]);}}
this.doCall=function(){var ajx=new AjxAction('iqube',this.strService);this._loadWSData(this.objCtrlData,ajx);ajx.setCallback(this._ajxCallback,this);ajx.setErrorCallback(this._errorCallback,this);ajx.fire();};this.destruct=function(){}};var IqubePost={ERROR_INVALID_SET:4,ERROR_INVALID_EDITOR:5,createPost:function(){},createAlbum:function(objAlbumData,funcCallback,objCaller){var call=new SoapCall('submitAlbum',objAlbumData,funcCallback,objCaller);call.doCall();call=null;},getAlbumPhoto:function(objCtrlData,funcCallback,objCaller){}};var IqubeFavorite={markFavorite:function(objAlbumData,funcCallback,objCaller){var call=new SoapCall('markFavorite',objAlbumData,objCaller,funcCallback);call.doCall();call=null;},unmarkFavorite:function(objAlbumData,funcCallback,objCaller){var call=new SoapCall('unmarkFavorite',objAlbumData,objCaller,funcCallback);call.doCall();call=null;},saveFavorite:function(objAlbumData,funcCallback,objCaller){var call=new SoapCall('saveFavorite',objAlbumData,objCaller,funcCallback);call.doCall();call=null;},getFavoriteTags:function(objAlbumData,funcCallback,objCaller){var call=new SoapCall('getFavoriteTags',objAlbumData,objCaller,funcCallback);call.doCall();call=null;}};var IqubeSet={ERROR_INVALID_POST_PERM_TEMPLATE:3,PERM_CREATE_POST:128,PERM_PUBLISH_POST:64}
Iqube.Post.FavoriteEditor=function(domContainer,nPostId){Iqube.Controller.extend.apply(this,[Iqube.Post.FavoriteEditor,Iqube.Controller]);this.divContainer=domContainer;this.nPostId=nPostId||domContainer.m_postId||domContainer.getAttribute('m_postId');if(!this.nPostId){throw new Error('發生錯誤');}};Iqube.Post.FavoriteEditor._className="Iqube.Post.FavoriteEditor";Iqube.Post.FavoriteEditor.prototype._jsInit=function(){};Iqube.Post.FavoriteEditor.prototype._domActivate=function(){if(!this.nPostId){return;}
if(!Alias.id){this.nPostId=0;MsgBar.addMsg('請先登入');return false;}
if(!this.divEditor){this.lnkFavToggle=fc(this.divContainer,'a',null,/starred/,true);this.divEditor=this._buildEditorPane();this.divFavClose=fc(this.divEditor,'div',null,'close_div',true);this.txtFavTags=fc(this.divEditor,'input',null,'favorite_tag_txt',true);this.chkIsPrivate=fc(this.divEditor,'input',null,'is_private_check',true);this.lnkUnmark=fc(this.divEditor,'button',null,'favorite_unmark_link',true);this.lnkSave=fc(this.divEditor,'button',null,'favorite_save_link',true);this.frmFavorite=fc(this.divEditor,'form',null,'frmFavorite',true);}
var xy=getXY(this.divContainer);this.divEditor.style.left=xy.x+5+'px';this.divEditor.style.top=xy.y+20+'px';this.divEditor.FavoriteEditor=this;ac(this.divEditor);this.txtFavTags.m_fh=new InputFocusHandler(this.txtFavTags);this.frmFavorite.onsubmit=function(){var controller=fp(this,null,{'FavoriteEditor':true}).FavoriteEditor;controller._saveFavorite();controller=null;return false;};if(this.lnkFavToggle.className=='starred'){this.lnkFavToggle.className='loading';this._getFavoriteTags();}
else{this.divEditor.style.display='block';this.lnkFavToggle.className='starred';this.txtFavTags.value='';this.txtFavTags.select();this.txtFavTags.focus();this.chkIsPrivate.checked=false;this._markFavorite();this.txtFavTags.m_autocomplete=new Iqube.TagAutoComplete(this.txtFavTags,Tag.TYPE_FAVORITE);}
this.lnkUnmark.onclick=function(e){var controller=fp(this,null,{'FavoriteEditor':true}).FavoriteEditor;controller._unmarkFavorite();controller=null;YuEvent.stopEvent(YuEvent.getEvent(e));return false;}
this.divFavClose.onclick=function(e){var controller=fp(this,null,{'FavoriteEditor':true}).FavoriteEditor;controller.destruct();controller=null;YuEvent.stopEvent(YuEvent.getEvent(e));return false;};this.setAutoClose(true);};Iqube.Post.FavoriteEditor.prototype.setAutoClose=function(bAutoClose){if(bAutoClose){var onClickOutside=function(){var controller=this.constructor==Iqube.Post.FavoriteEditor?this:fp(this,null,{'FavoriteEditor':true}).FavoriteEditor;controller.destruct();}
ClickHandler.addListener(this.divEditor,onClickOutside,ClickHandler.OUTSIDE);onClickOutside=null;}};Iqube.Post.FavoriteEditor.prototype._domDeactivate=function(){if(!this.nPostId){return;}
this.lnkUnmark.onclick=null;this.lnkSave.onclick=null;this.divFavClose.onclick=null;if(this.txtFavTags.m_fh){this.txtFavTags.m_fh.destruct();}
if(this.txtFavTags&&this.txtFavTags.m_autocomplete&&this.txtFavTags.m_autocomplete.destruct){this.txtFavTags.m_autocomplete.destruct();this.txtFavTags.m_autocomplete=null;}
this.divEditor.style.display='none';ClickHandler.removeListener(this.divEditor);};Iqube.Post.FavoriteEditor.prototype._jsDestruct=function(){if(!this.divEditor)return;this.divEditor.FavoriteEditor=null;this.frmFavorite.onsubmit=null;this.frmFavorite=null;this.divEditor=null;this.divFavClose=null;this.lnkFavToggle=null;this.txtFavTags=null;this.chkIsPrivate=null;this.lnkUnmark=null;this.lnkSave=null;};Iqube.Post.FavoriteEditor.prototype._buildEditorPane=function(){var pane=cex('div',{className:'favorite_edit_div',innerHTML:'<form name="frmFavorite" class="frmFavorite" style="padding:0px; margin:0px;">'+'<table>'+'<tr><th align="center"  colspan="2">標示為我的最愛</th><td align="right">'+'<div name="close_div" class="close_div" ></div>'+'</td></tr>'+'<tr>'+'<th align="right">標籤:</th>'+'<td colspan="2" align="center">'+'<input type="text" name="favorite_tag_txt" class="favorite_tag_txt" style="width:95%"/>'+'</td>'+'</tr>'+'<tr>'+'<th align="right"></th>'+'<td nowrap>'+'<input type="checkbox" name="is_private_check" class="is_private_check" />不公開'+'</td>'+'<td align="right" nowrap="1">'+'<button name="favorite_unmark_link" class="favorite_unmark_link">移除我的最愛</button> '+'<button name="favorite_save_link" class="favorite_save_link" type="submit">儲存</button>'+'</td>'+'</tr>'+'</table>'+'</form>'});return pane;};Iqube.Post.FavoriteEditor.prototype._getFavoriteTags=function(){var callback=function(result){var controller=this.constructor==Iqube.Post.FavoriteEditor?this:fp(this,null,{'FavoriteEditor':true}).FavoriteEditor;var resp=result.getResponse();controller.lnkFavToggle.className='starred';if(!resp.isException){var jsFav=resp.html;controller.txtFavTags.value=jsFav.tag_text;controller.txtFavTags.m_autocomplete=new Iqube.TagAutoComplete(controller.txtFavTags,Tag.TYPE_FAVORITE);controller.divEditor.style.display='block';controller.txtFavTags.select();controller.txtFavTags.focus();controller.chkIsPrivate.checked=!jsFav.is_public;}else{MsgBar.addMsg(resp.html);}
controller=null;};new AjxAction('iqube','getFavoriteTags',{post_id:this.nPostId},callback.bind(this)).fire();callback=null;};Iqube.Post.FavoriteEditor.prototype._callback=function(result,args){var resp=result.getResponse();var div=args[0];var updateCounter=args[1];var msg=args[2];if(!resp.isException){if(updateCounter){var counter=fc(div,'div',{name:'fav_aliascnt_div'},null,true);if(counter)counter.innerHTML=resp.html;}
window.gPortalC&&gPortalC.invalidate();var portletObj=fp(div,null,{portletObj:true}).portletObj;portletObj.portal.update([portletObj]);MsgBar.addMsg(msg);}else{MsgBar.addMsg(resp.html);}};Iqube.Post.FavoriteEditor.prototype._markFavorite=function()
{var ajx=new AjxAction('iqube','markFavorite',{post_id:this.nPostId});ajx.setCallback(this._callback,this,[this.divContainer,true,'已標示為我的最愛']);ajx.fire();};Iqube.Post.FavoriteEditor.prototype._unmarkFavorite=function(){var ajx=new AjxAction('iqube','unmarkFavorite',{post_id:this.nPostId});ajx.setCallback(this._callback,this,[this.divContainer,true,'已從我的最愛取消']);ajx.fire();this.lnkFavToggle.className='notstarred';this.destruct();};Iqube.Post.FavoriteEditor.prototype._saveFavorite=function(){var params={'post_id':this.nPostId,'tag_txt':this.txtFavTags.value,'is_public':this.chkIsPrivate.checked?0:1};var ajx=new AjxAction('iqube','saveFavorite',params);ajx.setCallback(this._callback,this,[this.divContainer,false,'我的最愛已成功儲存']);ajx.fire();this.destruct();};var SEQ_NONPORTAL=255;var minColWidth=50;var colDivWidth=0.5;var GROUPID_RANGE_START=200000000;function Portal()
{this.portlets={};this.isDesignMode=false;this.isDragging=false;this.showToolbar=false;this.textOnTab='';this.nextpid=1;this.layoutType=Portal.LAYOUT_TYPE_COLUMN;this.canEdit=false;this.unsaved=false;this.editOption=Portal.EDITOPTION_ADV;this.seq=0;this.title='';this.ecolumn=[];this.erows=[];this.mobLayout=[];this.events={'remove_portlet':new YAHOO.util.CustomEvent('remove_portlet'),'remove_portal':new YAHOO.util.CustomEvent('remove_portal')};}
Portal.LAYOUT_TYPE_COLUMN=1;Portal.LAYOUT_TYPE_FREESTYLE=2;Portal.LAYOUT_TYPE_BAG=3;Portal.EDITOPTION_ADV={row:'v-',column:'xh012'};Portal.EDITOPTION_NOR={row:'v-',column:'xh012'};Portal.EDITOPTION_NONE={row:'',column:''};Portal.IMG_EDIT_ON='<img src="'+Config.BASEPATH+'/portal/images/edit_on.gif" width="16" height="16" title="關閉編輯" />';Portal.IMG_EDIT='<img src="'+Config.BASEPATH+'/portal/images/edit.gif" width="16" height="16" title="編輯" />';Portal.createFromObj=function(portal)
{var newportal=new Portal();newportal.textOnTab=portal.textOnTab;newportal.nextpid=portal.nextpid;newportal.version=portal.version;for(var i in portal.portlets){newportal.portlets[i]=Portlet.createFromObj(portal.portlets[i]);}
newportal.canEdit=portal.canEdit;newportal.unsaved=portal.unsaved;newportal.seq=portal.seq;newportal.system=portal.system;newportal.portalset_id=portal.portalset_id;newportal.title=portal.title;newportal.groupid=portal.groupid;newportal.layoutType=portal.layoutType||Portal.LAYOUT_TYPE_COLUMN;newportal.layout=portal.layout||[[]];newportal.mobLayout=portal.mobLayout;return newportal;};Portal.prototype.removeColumn=function(elRoot)
{if(this.ecolumn.length==1){MsgBar.addMsg('您的版面設計最少要有一個直列行');return;}
var nodes=elRoot.childNodes;for(var i=0;i<nodes.length;i++){if(nodes[i].className=='row'||/portlet_frame/.test(nodes[i].className)){MsgBar.addMsg('不能移除非空白的直列行.','error');return;}}
for(var i=1,e=elRoot.parentNode.childNodes.length;i<e;i+=2){if(elRoot==elRoot.parentNode.childNodes[i])break;}
if(i>=e){throw('cannot find column');}
var col=(i-1)/2;var elRow=elRoot.parentNode;this.deactivateElementEdit(elRoot);var jsRoot=elRow.jsObj;jsRoot.splice(col,1);if(jsRoot.length==0){rn(elRoot);this.ecolumn.splice(indexOf(this.ecolumn,elRoot),1);this.removeRow(elRow);MsgBar.addMsg('空白的橫行已被移除');}
else{var origWidth=elRoot.jsObj.width;var divider=elRoot.nextSibling||elRoot.previousSibling;divider=/colhighlight|coldiv/.test(divider.className)?divider:null;rn(elRoot);this.ecolumn.splice(indexOf(this.ecolumn,elRoot),1);if(divider){this.deactivateColdiv(divider);rn(divider);}
this.recalcColPercent(elRow,origWidth);MsgBar.addMsg('這橫行現在有 '+jsRoot.length+' 個直列.');}
Current.saveDesign();}
Portal.prototype.popColumn=function(elRoot)
{var elCols=fc2(elRoot,1,null,/column/);var elRow=elRoot;var col=elCols.length-1;var elCol=elCols[col];elRoot=null;if(elRow.jsObj.length==1){MsgBar.addMsg('最少要有一直欄。');return;}
var elSister=elCols[col-1];var elPortlets=fc2(elCol,1,null,/portlet_frame/);for(var i=0;i<elPortlets.length;i++){elSister.appendChild(elPortlets[i]);}
this.deactivateElementEdit(elCol);var jsRoot=elRow.jsObj;var origWidth=elCol.jsObj.width;jsRoot.splice(col,1);var divider=elCol.nextSibling||elCol.previousSibling;divider=/colhighlight|coldiv/.test(divider.className)?divider:null;rn(elCol);this.ecolumn.splice(indexOf(this.ecolumn,elCol),1);if(divider){this.deactivateColdiv(divider);rn(divider);}
this.recalcColPercent(elRow,origWidth);Current.saveDesign();MsgBar.addMsg('這橫行現在有 '+jsRoot.length+' 個直列.');}
Portal.prototype.addColumn=function(elRoot)
{var jsRoot=elRoot.jsObj;var i=jsRoot.length;if(i>=5){MsgBar.addMsg('已達最高欄位數目。','error');return false;}
var column2=cex("div",{style:{width:'0'},className:'column show'});var ecoldiv2;if(i==0){ac(elRoot,column2);}else{ecoldiv2=cex("div",{className:'coldiv'});ac(elRoot,ecoldiv2,column2);}
var jsChild={'width':'0%',content:[]};column2.jsObj=jsChild;this.ecolumn.push(column2);jsRoot.push(jsChild);this.recalcColPercent(elRoot,0,1);if(ecoldiv2){this.activateColdiv(ecoldiv2);}
this.activateElementEdit(column2);Current.saveDesign();}
Portal.prototype.getJsObjFromDom=function(elRoot,bReset){var jsObj=null;if(elRoot.className=='row'){jsObj=this.getRowObjFromDom(elRoot,bReset);}
else{jsObj=this.getColObjFromDom(elRoot,bReset);}
return jsObj;};Portal.prototype.getRowObjFromDom=function(elRoot,bReset){var jsObj=[];var nodes=elRoot.childNodes;for(var i=0,e=nodes.length;i<e;i++){if(Element.hasClassName(nodes[i],'column')){jsObj.push(this.getColObjFromDom(nodes[i],bReset));}}
if(bReset){elRoot.jsObj=jsObj;}
return jsObj;};Portal.prototype.getColObjFromDom=function(elRoot,bReset){var jsObj={};jsObj.width=elRoot.style.width;var matches=elRoot.className.match(/colstyle([12])/);if(matches){jsObj.style=matches[1];}
jsObj.content=[];var nodes=elRoot.childNodes;for(var i=0,e=nodes.length;i<e;i++){if(nodes[i].className=='row'){jsObj.content.push({'row':this.getRowObjFromDom(nodes[i],bReset)});}
else if(/portlet_frame/.test(nodes[i].className)){jsObj.content.push({'portlet':nodes[i].getAttribute('portlet_id')});}
else{}}
if(bReset){elRoot.jsObj=jsObj;}
return jsObj;};Portal.prototype.buildPortalFrameDOM=function(root)
{var portalFrame=cex("div",{className:'portal_frame'});var header=cex("div",{className:'portal_header'});var edit=cex("div",{className:'portal_edit',display:'none'});var content=cex("div",{className:'portal_content'});at([root,[portalFrame,header,edit,content]]);return{frame:portalFrame,edit:edit,content:content};}
Portal.prototype.buildPortalContentDOM=function(root)
{var mainFrame=cex("div",{className:'portal',style:{width:'100%',display:'none'}});var erow=cex("div",{className:'row',style:{width:'100%'}});if(root)at([root,[mainFrame,erow]]);this.erows.push(erow);this.activateElementEdit(erow);erow.jsObj=[];this.addColumn(erow);this.addColumn(erow);this.addColumn(erow);this.layout=[erow.jsObj];mainFrame.style.display='';return mainFrame;}
Portal.prototype.showTopToolbar=function(){var utility=cex('div',{className:'utility'});ac(this.eheader,utility);this.estartedit=cex('div',{innerHTML:Portal.IMG_EDIT,onclick:this.editPortal});ac(utility,this.estartedit);if(this.layoutType==Portal.LAYOUT_TYPE_COLUMN){var expandAll=cex('div',{style:{cursor:'pointer'},href:"",innerHTML:"全部展開",onclick:function(){var _this=fp(this,'DIV',{portalObj:true}).portalObj;_this.expandAllPortlets();return false;}});var collapseAll=cex('div',{style:{cursor:'pointer'},href:"",innerHTML:"全部收起",onclick:function(){var _this=fp(this,'DIV',{portalObj:true}).portalObj;_this.collapseAllPortlets();return false;}});var hideshowEdit=cex('div',{className:'hideshowEdit',style:{cursor:'pointer',width:'100px'},href:"",onclick:function(){var _this=fp(this,'DIV',{portalObj:true}).portalObj;if(_this.showToolbar==true){_this.hideEditToolbar();}else{_this.showEditToolbar();}}});var addColumn=cex('div',{style:{cursor:'pointer'},href:"",innerHTML:"新增欄位",onclick:function(){var _this=fp(this,'DIV',{portalObj:true}).portalObj;_this.addColumn(_this.erows[0]);return false;}});var delColumn=cex('div',{style:{cursor:'pointer'},href:"",innerHTML:"移除欄位",onclick:function(){var _this=fp(this,'DIV',{portalObj:true}).portalObj;_this.popColumn(_this.erows[0]);return false;}});ac(utility,hideshowEdit,expandAll,collapseAll,addColumn,delColumn);}
utility=null;expandAll=null;collapseAll=null;var savePane=cex('div',{className:'savePane',innerHTML:'<img class="attention_small" src="'+Config.BASEPATH+'/portal/images/1x1dot.gif" align="absmiddle" /> 您已經對您的設計進行了修改。每當您完成修改後，請按儲存鍵。如果您不想儲存修改，請按放棄鍵。<span style="white-space:nowrap"></span>',style:{display:'none'}});var saveButton=cex('button',{className:'saveButton',innerHTML:'儲存'});var cancelButton=cex('button',{className:'cancelButton',innerHTML:'放棄更改'});at([this.eheader,[savePane,[savePane.lastChild,saveButton,cancelButton]]]);cancelButton.onclick=Current.exitDesign;saveButton.onclick=Current.saveDesign.bind(Current,true);if(hideshowEdit){this.hideEditToolbar();hideshowEdit=null;}
this.eheader.style.display='block';}
Portal.prototype.hideTopToolbar=function()
{(function(a){rn(a);}).apply2all(fca(this.eheader,'div','className',['utility','savePane']));}
Portal.prototype.showSavePane=function()
{var savePane=fc(this.eheader,'div',null,'savePane',true);savePane&&(savePane.style.display='block');}
Portal.prototype.hideSavePane=function()
{var savePane=fc(this.eheader,'div',null,'savePane',true);savePane&&(savePane.style.display='none');}
Portal.prototype.swDesignMode=function(isDesignMode)
{if(this.isDesignMode==isDesignMode)return isDesignMode;if(isDesignMode&&this.canEdit){this.resetDirty();if(window._logReader){}
this.isDesignMode=isDesignMode;for(var i=0;i<this.erows.length;i++){this.activateElementEdit(this.erows[i],true);}
this.showTopToolbar();this.activate();}
if(!isDesignMode){this.closeEditAllPortlets();for(var i=0;i<this.erows.length;i++){this.deactivateElementEdit(this.erows[i],true);}
this.closeEditPortal();this.isDesignMode=isDesignMode;this.hideTopToolbar();this.activate();}}
Portal.prototype.addPortlet=function(portlet)
{if(portlet.id=='new'){portlet.id=this.nextpid++;var element=portlet.eframe;element&&element.setAttribute('portlet_id',portlet.id);if(portlet.depend){var dependPortlet=this.portlets[portlet.depend];(dependPortlet.dCount)?dependPortlet.dCount++:(dependPortlet.dCount=1);}}
this.portlets[portlet.id]=portlet;if(!portlet.column)
portlet.column=0;}
Portal.prototype.removePortlet=function(id)
{var portlet=this.portlets[id];if(portlet){if(portlet.depend){var dependPortlet=this.portlets[portlet.depend];(dependPortlet.dCount)?dependPortlet.dCount--:(dependPortlet.dCount=0);}
this.events['remove_portlet'].fire(portlet);delete this.portlets[id];}}
Portal.prototype.expandAllPortlets=function(nodelay)
{var autoSave=Current.autosave;Current.autosave=false;for(var i in this.portlets){this.portlets[i].expand(nodelay);}
Current.autosave=autoSave;Current.saveDesign();}
Portal.prototype.collapseAllPortlets=function()
{var autoSave=Current.autosave;Current.autosave=false;for(var i in this.portlets){this.portlets[i].collapse();}
Current.autosave=autoSave;Current.saveDesign();}
Portal.prototype.closeEditAllPortlets=function(nodelay)
{for(var i in this.portlets){this.portlets[i].closeEditPortlet(nodelay);}}
Portal.prototype.deactivate=function(destory)
{if(!this.eframe)return;this.eframe.portalObj=null;for(var i in this.portlets){this.portlets[i].deactivate();this.portlets[i]=null;}
for(var i=0;i<this.erows.length;i++){this.deactivateElementEdit(this.erows[i],true);}
this.etable=null;this.ecolumn=null;this.eheader=null;this.eedit=null;this.econtent=null;this.estartedit=null;if(destory)rn(this.eframe);this.eframe=null;for(var i in this.events){this.events[i].unsubscribeAll();}}
Portal.prototype.activate=function(element)
{if(!this.eframe&&element){this.eframe=rec(element);this.eheader=rec(this.eframe);this.eedit=this.eheader.nextSibling;this.econtent=this.eedit.nextSibling;this.eframe.portalObj=this;}
this.activateAllPortlets(this.econtent);}
Portal.prototype.activateColdiv=function(elDivider)
{if(!elDivider){for(var i in this.erows){var elDividers=fc2(this.erows[i],1,null,/coldiv|highlight/);for(var j in elDividers){this.activateColdiv(elDividers[j]);}}
return;}
var ecoldiv=elDivider;ecoldiv.style.cursor='w-resize';ecoldiv.className='coldiv';ecoldiv.style.visibility='visible';ecoldiv.title='拖拉來調整直列行的大小';ecoldiv.onmouseover=Portal.coldivEvent;ecoldiv.onmouseout=Portal.coldivEvent;ecoldiv.onmousedown=Portal.startResizeEvent;ecoldiv=null;elDivider=null;}
Portal.prototype.deactivateColdiv=function(elDivider)
{if(elDivider){var ecoldiv=elDivider;ecoldiv.style.cursor='';ecoldiv.className='coldiv';ecoldiv.style.visibility='';ecoldiv.onmouseover='';ecoldiv.onmousedown='';ecoldiv.onmouseout='';ecoldiv.title='';}
else{for(var i=0;i<this.erows.length;i++){var elDividers=fc2(this.erows[i],1,null,/coldiv|highlight/);for(var j=0;j<elDividers.length;j++){this.deactivateColdiv(elDividers[j]);}}}}
Portal.prototype.recalcColPercent=function(elRoot,removeWidth,pushCol)
{var fromActual=(!removeWidth&&!pushCol);var jsRoot=elRoot.jsObj;var total=fromActual?elRoot.offsetWidth:100;removeWidth=parseFloat(removeWidth)||0;pushCol=pushCol||0;var rest=99.9;var percent;var coldivLeft=0;for(var i=0,e=jsRoot.length-1;i<e;i++){var width=fromActual?elRoot.childNodes[2*i+1].clientWidth:parseFloat(jsRoot[i].width);percent=width*(1+removeWidth/(total-removeWidth))*(e+1-pushCol)/(e+1)/total*100;rest-=percent;elRoot.childNodes[2*i+1].style.width=jsRoot[i].width=percent+'%';coldivLeft+=percent;elRoot.childNodes[2*i+2].style.left=coldivLeft+'%';}
if(rest<1){}else{elRoot.childNodes[2*i+1].style.width=jsRoot[i].width=rest+'%';}}
Portal.coldivEvent=function(e)
{var _this=fp(this,'div',{portalObj:true}).portalObj;if(!_this.isDragging){e=YuEvent.getEvent(e);if(e.type=='mouseover'){this.className='colhighlight';}else{this.className='coldiv';}}}
Portal.startResizeEvent=function(e)
{var _this=fp(this,'DIV',{portalObj:true}).portalObj;e=YuEvent.getEvent(e);if(!_this.isDragging){this.onmousedown='';this.onmouseover='';this.onmouseout='';document.onmouseup=Portal.stopResizeEvent;document.onmousemove=Portal.resizeEvent;document.portalObj=_this;document.resizeColEle=this;_this.startResize(this);}
YuEvent.stopEvent(e);return false;}
Portal.stopResizeEvent=function(e)
{var _this=document.portalObj;e=YuEvent.getEvent(e);document.onmousemove='';document.onmouseup='';document.portalObj=null;var pos=getEvtXY(e);_this.resize(pos);_this.stopResize(document.resizeColEle);YuEvent.stopEvent(e);document.resizeColEle=null;return false;}
Portal.resizeEvent=function(e)
{var _this=document.portalObj;e=YuEvent.getEvent(e);var pos=getEvtXY(e);_this.resize(pos);YuEvent.stopEvent(e);return false;}
Portal.prototype.startResize=function(elColdiv)
{this.isDragging=true;var elRoot=elColdiv.parentNode;this.tmpTotal=elRoot.offsetWidth;this.tmpOrgColWidth=this.tmpColWidth=elColdiv.previousSibling.clientWidth;this.tmpNextColWidth=elColdiv.nextSibling.clientWidth;this.tmpColX=getXY(elColdiv.previousSibling).x;elColdiv.className='coldiv';var dummy=cex('div',{className:'colhighlight',style:{position:'absolute'}});var pos=getXY(elColdiv);var x=pos.x;var y=pos.y;dummy.style.left=x+'px';dummy.style.top=y+'px';dummy.style.width=elColdiv.offsetWidth+'px';dummy.style.height=elRoot.offsetHeight+'px';ac(dummy);ac(dummy,cex('div',{className:'left',innerHTML:parseInt(this.tmpColWidth*100/this.tmpTotal)+'%'}),cex('div',{className:'right',innerHTML:parseInt(this.tmpNextColWidth*100/this.tmpTotal)+'%'}));this.dummy=dummy;}
Portal.prototype.stopResize=function(elColdiv)
{this.isDragging=false;elColdiv.innerHTML='';var elRoot=elColdiv.parentNode;elColdiv.previousSibling.style.width=this.tmpColWidth+'px';elColdiv.nextSibling.style.width=this.tmpNextColWidth+'px';this.recalcColPercent(elRoot);this.activateColdiv(elColdiv);if(this.tmpOrgColWidth!=this.tmpColWidth){Current.saveDesign();}
rn(this.dummy);this.dummy=null;delete this.tmpColWidth;delete this.tmpOrgColWidth;delete this.tmpNextColWidth;delete this.tmpColX;delete this.tmpTotal;}
Portal.prototype.resize=function(pos)
{var width=(pos.x-this.tmpColX);var nextColWidth=this.tmpNextColWidth-(width-this.tmpColWidth);if(width<minColWidth||nextColWidth<minColWidth)return false;if(width==this.tmpColWidth)return false;this.tmpColWidth=width;this.tmpNextColWidth=nextColWidth;this.dummy.firstChild.innerHTML=parseInt(this.tmpColWidth*100/this.tmpTotal)+'%';this.dummy.lastChild.innerHTML=parseInt(this.tmpNextColWidth*100/this.tmpTotal)+'%';this.dummy.style.left=this.tmpColX+width+'px';}
Portal.prototype.activateAllPortlets=function(element)
{var portlet,ediv,id,ecolumns,ecolumn;if(element&&!this.etable){this.ecolumn=[];this.etable=rec(element);var tmpFunc=function(ecolumns){for(var i=0,e=ecolumns.length;i<e;i++){ecolumn=ecolumns[i];if(!Element.hasClassName(ecolumn,'column'))continue;this.ecolumn.push(ecolumn);ediv=rec(ecolumn);while(ediv){if(ediv.className.indexOf('portlet_frame')!=-1){id=ediv.getAttribute('portlet_id');if(portlet=this.portlets[id]){portlet.portal=this;portlet.activate(ediv);if(portlet.options&Portlet.OPTION_DEFERRED){portlet.refresh();}
portlet.column=ecolumn;}else{}}
portlet=null;ediv=ediv.nextSibling;}}};switch(this.layoutType){case Portal.LAYOUT_TYPE_COLUMN:Current.isAdvancedEdit?this.editOption=Portal.EDITOPTION_ADV:this.editOption=Portal.EDITOPTION_NOR;var tmpNodes=fc2(this.etable,1,null,'row');for(var i=0;i<tmpNodes.length;i++){this.attachRowJsObj(tmpNodes[i],this.layout[i]);}
tmpNodes=null;this.erows=fc(this.etable,'div',null,'row');for(var i=0;i<this.erows.length;i++){var row=this.erows[i];rec(row);tmpFunc.call(this,row.childNodes);}
break;default:this.editOption=Portal.EDITOPTION_NONE;if(this.layoutType==Portal.LAYOUT_TYPE_BAG){ecolumns=fc(this.etable,'TD',null,'column');}else if(this.layoutType==Portal.LAYOUT_TYPE_FREESTYLE){this.erows=fc2(this.etable,1,null,'row');ecolumns=fc2(this.etable,2,null,'column');}
tmpFunc.call(this,ecolumns);break;}
this.resetHeight();for(var i in this.portlets){if(!this.portlets[i].eframe){delete this.portlets[i];}}}else{for(var i in this.portlets){this.portlets[i].activate();}}}
Portal.prototype.resetHeight=function()
{if(this.layoutType==Portal.LAYOUT_TYPE_FREESTYLE){var bottom=0;var portlet;for(var i in this.portlets){portlet=this.portlets[i];bottom=Math.max(portlet.height+portlet.top,bottom);}
this.econtent.style.height=bottom+'px';this.bottom=bottom;}else{delete this.bottom;this.econtent.style.height='';}}
Portal.prototype.swColLayout=function()
{var eframes=[];var port,eframe;this.hideTopToolbar();this.closeEditAllPortlets();if(this.layoutType==Portal.LAYOUT_TYPE_COLUMN){MsgBar.addMsg('已在直列設置版面','error');return;}
for(var i in this.portlets){port=this.portlets[i];if(eframes[i]=port.eframe){delete port.left;delete port.top;delete port.width;delete port.height;port.deactivate();}}
this.layoutType=Portal.LAYOUT_TYPE_COLUMN;for(var i in this.portlets){port=this.portlets[i];if(eframe=eframes[i]){port.portal=this;port.column=this.ecolumn[0];port.activate(eframe);port.eportlet.style.height='';port.eportlet.style.width='';eframe.style.width='';eframe.style.height='';eframe.style.left='';eframe.style.top='';}
eframes[i]=null;}
Element.replaceClassName(this.eframe,'layout_fixed','layout_col');this.resetHeight();this.unsaved=true;this.getRowObjFromDom(this.erows[0],true);Current.isAdvancedEdit?this.editOption=Portal.EDITOPTION_ADV:this.editOption=Portal.EDITOPTION_NOR;for(var i=0;i<this.erows.length;i++){this.activateElementEdit(this.erows[i],true);}
this.showTopToolbar();Current.saveDesign();Toolbar.refresh();}
Portal.prototype.swFixedLayout=function()
{if(this.layoutType==Portal.LAYOUT_TYPE_FREESTYLE){MsgBar.addMsg('已在固定設置版面','error');return;}
if(this.layoutType==Portal.LAYOUT_TYPE_COLUMN){for(var i=0;i<this.erows.length;i++){this.deactivateElementEdit(this.erows[i],true);}}
this.hideTopToolbar();this.closeEditAllPortlets();this.expandAllPortlets(true);var eframes=[];var topXY=getXY(this.econtent);var port,pos,eframe;for(var i in this.portlets){port=this.portlets[i];if(eframes[i]=port.eframe){pos=getXY(port.eframe);port.left=pos.x-topXY.x;port.top=pos.y-topXY.y;port.width=port.eframe.offsetWidth;port.height=port.eframe.offsetHeight;port.deactivate();}}
this.layoutType=Portal.LAYOUT_TYPE_FREESTYLE;for(var i in this.portlets){port=this.portlets[i];if(eframe=eframes[i]){port.portal=this;port.column=this.ecolumn[0];port.activate(eframe);port.resetWH();eframe.style.left=port.left+'px';eframe.style.top=port.top+'px';ac(this.ecolumn[0],eframe);}
eframes[i]=null;}
Element.replaceClassName(this.eframe,'layout_col','layout_fixed');while(this.erows.length>1){rn(this.erows.pop());}
while(this.ecolumn.length>1){rn(this.ecolumn.pop());}
var ecoldivs=fc2(this.erows[0],1,null,/coldiv|colhighlight/);for(var i=0,e=ecoldivs.length;i<e;i++){rn(ecoldivs[i]);}
this.resetHeight();this.ecolumn[0].style.width='99.5%';this.ecolumn[0].className='column';this.unsaved=true;this.editOption=Portal.EDITOPTION_NONE;Current.saveDesign();this.showTopToolbar();Toolbar.refresh();}
Portal.prototype.teardown=function()
{this.closeEditAllPortlets();this.deactivate(true);gPortalC.portals[this.url]=null;}
Portal.prototype.refresh=function()
{this.teardown();gPortalC.handlers[this.url].show(true);}
Portal.prototype.invalidate=function()
{this._bOutdated=true;}
Portal.prototype.addMsg=function(str,autoTimeout)
{this.removeMsg();var msg=cex('div',{innerHTML:str,className:'message'});ac(this.eheader,msg);if(autoTimeout){var id=setTimeout(this.removeMsg.bind(this),5000);msg.timerId=id;}}
Portal.prototype.removeMsg=function()
{if(this.eheader){var msg=fc(this.eheader,'div',null,'message',true);if(msg){if(msg.timerID)clearTimeout(msg.timerID);rn(msg);}}}
Portal.prototype.update=function(exceptions,forced)
{if(!forced&&!this._bOutdated){return;}
if(this._isUpdating)return;var data={};var exIds=[];var addPortlet=function(portlet){if(data[portlet.id])return;data[portlet.id]={filter:portlet.filter,xsl:portlet.xsl,menuId:portlet.menuId,checksum:portlet.checksum,limit:portlet.lastLimit,offset:portlet.lastOffset,depend:portlet.depend,dCount:portlet.dCount};}
for(var i in this.portlets){var portlet=this.portlets[i];if((exceptions&&exceptions.constructor==Array&&indexOf(exceptions,portlet)>-1)||(portlet.options&Portlet.OPTION_DEFERRED)||(portlet.options&Portlet.OPTION_NOAUTOUPDATE)){exIds.push(portlet.id);portlet.checksum='';continue;}
addPortlet(portlet);while(portlet.depend){portlet=this.portlets[portlet.depend];addPortlet(portlet);}}
this.addMsg('正在更新...',false);var ajx=new AjxAction('portal','getPortalUpdate');ajx.set('url',this.url);ajx.set('dataJson',JSON.stringify(data));ajx.set('exJson',JSON.stringify(exIds));ajx.setCallback(new AjxCallback(this,this._updateCallback));ajx.fire();this._isUpdating=true;};Portal.prototype._updateCallback=function(result)
{delete this._isUpdating;var resp=result.getResponse();var msg='';if(!resp.isException){for(var i in this.portlets){var portlet=this.portlets[i];if(!portlet)return;if(!resp.checksum||!resp.checksum[portlet.id]){continue;}
portlet.updateHtml(resp.html[portlet.id],resp.checksum[portlet.id],{msg:'已更新'});msg='已更新';}
this._bOutdated=false;if(!msg)msg='沒有更新';}else{log('Exception in Portal.prototype._updateCallback#url='+this.url+'#: '+resp.html);msg='更新失敗';}
this.addMsg(msg,true);};Portal.prototype.close=function()
{gPortalC.handlers[this.url].remove();}
Portal.prototype.getLayoutObj=function(bReset){if(arguments.length==0)bReset=true;var layout=[];var rows=this.etable.childNodes;for(var i=0,e=rows.length;i<e;i++){if(rows[i].className=='row'){var jsObj=this.getRowObjFromDom(rows[i],bReset);layout.push(jsObj);}}
return layout;};Portal.prototype.getNewLayout=function()
{var newLayout={nextpid:this.nextpid,version:this.version,layoutType:this.layoutType,layout:this.layout,mobLayout:this.mobLayout,title:this.title,portlets:[]};if(this.seq!=SEQ_NONPORTAL){newLayout.textOnTab=this.textOnTab;}
var build;for(var j=0;j<this.ecolumn.length;j++){if(!Element.hasClassName(this.ecolumn[j],'column'))continue;var nodes=this.ecolumn[j].childNodes;for(var k=0;k<nodes.length;k++){var id=nodes[k].getAttribute('portlet_id');if(id===null)continue;var port=this.portlets[id];if(!port){log(' portlet '+id+' is undefined');continue;}
if(port.unsaved===true||this.unsaved){build={id:id,ico:port.ico,title:port.title,filter:port.filter,menuId:port.menuId,style:port.style,column:j,expanded:port.expanded,depend:port.depend,dCount:port.dCount,unsaved:true};}else{build={id:id,expanded:port.expanded,dCount:port.dCount,style:port.style,title:port.title,column:j};}
if(this.layoutType==Portal.LAYOUT_TYPE_FREESTYLE){build.left=port.left;build.top=port.top;build.width=port.width;build.height=port.height;}
newLayout.portlets.push(build);build=null;}}
return newLayout;}
Portal.prototype.getNewSetting=function()
{if(this.readPermList){var newSetting={perm_value:this.readPermList.selectValue,read_perm_list:this.readPermList.permListTxt};}else{var newSetting={};}
return newSetting;}
Portal.prototype.markAllSaved=function()
{var portlets=this.portlets;if(portlets){for(var i in portlets){delete portlets[i].unsaved;}}
delete this.unsaved;}
Portal.prototype.getPortletByFilterType=function(type)
{for(var i in this.portlets){var portlet=this.portlets[i];if(portlet.filtertype==type){return portlet;}}
return false;}
Portal.prototype.getPortletByMenuId=function(id)
{for(var i in this.portlets){var portlet=this.portlets[i];if(portlet.menuId==id){return portlet;}}
return false;}
Portal.prototype.hideEditToolbar=function()
{this.showToolbar=false;(function(a){a.style.display='none';}).apply2all(fc(this.econtent,'div',null,/EleEditToolbar/));fc(this.eheader,'div',null,'hideshowEdit',true).innerHTML='展示工具欄';if(this.layoutType!=Portal.LAYOUT_TYPE_BAG){for(var i=0;i<this.ecolumn.length;i++){Element.replaceClassName(this.ecolumn[i],'show','');}}}
Portal.prototype.showEditToolbar=function()
{this.showToolbar=true;(function(a){a.style.display='block';}).apply2all(fc(this.econtent,'div',null,/EleEditToolbar/));fc(this.eheader,'div',null,'hideshowEdit',true).innerHTML='收藏工具欄';if(this.layoutType!=Portal.LAYOUT_TYPE_BAG){for(var i=0;i<this.ecolumn.length;i++){Element.replaceClassName(this.ecolumn[i],'','show');}}}
Portal.prototype.getDependentPortlets=function(id)
{var dependents=[];for(var i in this.portlets){if(this.portlets[i].depend==id){dependents[dependents.length]=i;}}
return dependents;}
Portal.prototype.editPortal=function()
{var _this=(this.constructor==Portal?this:fp(this,'DIV',{portalObj:true}).portalObj);if(Current.sandbox){MsgBar.addMsg('不能在測試區儲存 - 請先登記成會員');return false;}
PortalMenu.displayPortalEditForm(_this.eedit,_this);_this.estartedit.innerHTML=Portal.IMG_EDIT_ON;_this.estartedit.onclick=_this.closeEditPortal;return false;}
Portal.prototype.closeEditPortal=function(nodelay)
{var _this=(this.constructor==Portal?this:fp(this,'DIV',{portalObj:true}).portalObj);if(_this.estartedit&&_this.canEdit){PortalMenu.closeEditForm(_this.eedit,_this,nodelay);_this.estartedit.innerHTML=Portal.IMG_EDIT;_this.estartedit.onclick=_this.editPortal;}
return false;}
Portal.prototype.showLayout=function(){if(this.layoutType!=Portal.LAYOUT_TYPE_BAG){return;}
var strBorderStyle='1px solid #0F0';for(var i=0;i<this.ecolumn.length;i++){var column=this.ecolumn[i];YuDom.setStyle(column,'border',strBorderStyle);YuDom.setStyle(column,'width',column.offsetWidth>52?'':'50px');YuDom.setStyle(column,'backgroundColor','#FFF');YuDom.setStyle(column,'height',column.offsetHeight>52?'':'50px');var table=fp(column,'table',null,"tbl_template");var parent=fp(table,'td',null,"tbl_container");if(parent){YuDom.setStyle(parent,'border',strBorderStyle);YuDom.setStyle(parent,'backgroundColor','#0a0');}}};Portal.prototype.hideLayout=function(){if(this.layoutType!=Portal.LAYOUT_TYPE_BAG){return;}
for(var i=0;i<this.ecolumn.length;i++){var column=this.ecolumn[i];YuDom.setStyle(column,'border','');YuDom.setStyle(column,'width','');YuDom.setStyle(column,'height','');YuDom.setStyle(column,'backgroundColor','');var table=fp(column,'table',null,'tbl_template');var parent=fp(table,'td',null,'tbl_container');if(parent){YuDom.setStyle(parent,'border','');YuDom.setStyle(parent,'backgroundColor','');}}};Portal.prototype.toString=function(){this._className=this._className||getClassName(this);return this._className;}
Portal.prototype.compareLayout=function(aLayout,bLayout,options){var a=eval(aLayout);if(!bLayout){var b=this.getJsObjFromDom(this.erows[0]);}
else{var b=eval(bLayout);}
if(!options)options={};if(typeof(options.ignoreWidth)=="undefined")options.ignoreWidth=true;if(typeof(options.ignorePortlet)=="undefined")options.ignorePortlet=true;var fnIsSameRow=function(jsRowA,jsRowB){var same=jsRowA.length==jsRowB.length;for(var ndx=0;same&&ndx<jsRowA.length;ndx++){same=fnIsSameCol(jsRowA[ndx],jsRowB[ndx]);}
return same;};var fnIsSameCol=function(jsColA,jsColB){var same=options.ignoreWidth||jsColA.width==jsColB.width;if(same){var itemsA=jsColA.content;var itemsB=jsColB.content;if(options.ignorePortlet){for(var ndx=0;ndx<itemsA.length;ndx++){if(itemsA[ndx].portlet){itemsA.splice(ndx,1);--ndx;}}
for(var ndx=0;ndx<itemsB.length;ndx++){if(itemsB[ndx].portlet){itemsB.splice(ndx,1);--ndx;}}}
same=itemsA.length==itemsB.length;for(var ndx=0;same&&ndx<itemsA.length;ndx++){var s=itemsA[ndx];var t=itemsB[ndx];if(s.portlet||t.portlet){same=s.portlet==t.portlet;}
else if(s.row&&t.row){same=fnIsSameRow(s.row,t.row);}
else{log('Error: unexpected program flow');throw'Error: unexpected program flow';}}}
return same;};return fnIsSameRow(a,b);};Portal.verifyLayout=function(strLayout){try{var jsLayout=eval(strLayout);var fnCheckRow=function(jsRowDef){var ok=jsRowDef.constructor==Array;for(var i=0;ok&&i<jsRowDef.length;i++){ok=fnCheckCol(jsRowDef[i]);}
return ok;};var fnCheckCol=function(jsColDef){var ok=jsColDef.width&&jsColDef.content;if(ok){ok=jsColDef.content.constructor==Array;for(var i=0;ok&&i<jsColDef.content.length;i++){var item=jsColDef.content[i];if(item.portlet){ok=item.portlet.charAt(0)!='0'&&/^[0-9]+$/.test(item.portlet);}
else if(item.row){ok=fnCheckRow(item.row);}
else{ok=false;}}}
return ok;};return fnCheckRow(jsLayout);}
catch(e){return false;}
return false;}
Portal.prototype.applyLayout=function(strLayout){if(!Portal.verifyLayout(strLayout)){log('Failed to apply layout: invalid layout: layout = '+strLayout);throw'錯誤: 不能使用這版面設計 - 版面無效!';}
if(this.compareLayout(strLayout)){MsgBar.addMsg('選擇的版面設計與目前的設計相同');return;}
for(var i=0;i<this.erows.length;i++){this.deactivateElementEdit(this.erows[i],true);}
var jsLayout=eval(strLayout);var fnAddRow=function(elParent,jsRowDef){var row=cex('div',{className:'row',style:{width:'100%'}});if(elParent)ac(elParent,row);for(var i=0;i<jsRowDef.length;i++){fnAddCol(row,jsRowDef[i]);if(i!=jsRowDef.length-1)fnAddColdiv(row);}
return row;};var fnAddColdiv=function(elParent){var div=cex('div',{className:'coldiv'});if(elParent)ac(elParent,div);return div;};var fnAddCol=function(elParent,jsColDef){var col=cex('div',{className:'column show',style:{width:jsColDef.width}});if(elParent)ac(elParent,col);for(var i=0;i<jsColDef.content.length;i++){var item=jsColDef.content[i];if(item.row){fnAddRow(col,item.row);}
else{throw'錯誤: 不能使用這版面設計 - 不容許新生的内容方格!'}}
return col;};var root=fnAddRow(null,jsLayout);var rows=fc(root,'div',null,/row/);var cols=fc(root,'div',null,/column/);rows.push(root);for(var id in this.portlets){var portlet=this.portlets[id];var ndxCol=indexOf(this.ecolumn,portlet.column);if(ndxCol<0||ndxCol>=cols.length||portlet.column.constructor==Number){ndxCol=cols.length-1;}
arow=fc(cols[ndxCol],'div',null,'row',true);if(arow){cols[ndxCol].insertBefore(portlet.eframe,arow);}
else{cols[ndxCol].appendChild(portlet.eframe);}
portlet.column=cols[ndxCol];}
jsLayout=this.getJsObjFromDom(root);this.etable.innerHTML='';ac(this.etable,root);this.layout=[jsLayout];this.etable=null;this.activateAllPortlets(this.econtent);for(var i=0;i<this.erows.length;i++){this.activateElementEdit(this.erows[i],true);}
Current.saveDesign();root=null;cols=null;rows=null;MsgBar.addMsg('成功地使用選擇了的版面設計');}
Portal.prototype.addRow=function(elRoot){var elChild=cex('div',{'className':'row','style':{'width':'100%'}});ac(elRoot,elChild);this.erows.push(elChild);elChild.jsObj=[];this.activateElementEdit(elChild);this.addColumn(elChild);this.addColumn(elChild);var scroll=new fx.ScrollIntoView(elChild,{padding:50,duration:400,onComplete:function(){var animation={func:fx.Opacity,options:{duration:1000},params:[1,0]};Iqube.Util.Highlight.highlight(this.el,{width:5,animation:animation});}});scroll.start();scroll=null;MsgBar.addMsg('一個包含兩個直列的新橫行已被增加');};Portal.prototype.removeRow=function(elRoot){if(elRoot.jsObj.length>0){log('Fail to remove non-empty elements!');return;}
this.deactivateElementEdit(elRoot);var elParent=elRoot.parentNode;elRoot=elParent.removeChild(elRoot);if(elParent.jsToolbar&&fc2(elParent,1,null,/portlet_frame|row/).length==0){elParent.jsToolbar.enableEdit('x');}
this.erows.splice(indexOf(this.erows,elRoot),1);return elRoot;};Portal.prototype.checkDirty=function()
{if(!this.canEdit)return false;this.strNewLayout=this.strNewLayout||JSON.stringify(this.getNewLayout());this.strNewSetting=this.strNewSetting||JSON.stringify(this.getNewSetting());return(this.strNewLayout!=this.strCurrentLayout)?1:0+(this.strNewSetting!=this.strCurrentSetting)?2:0;};Portal.prototype.resetDirty=function()
{this.strCurrentLayout=this.strNewLayout||JSON.stringify(this.getNewLayout());this.strCurrentSetting=this.strNewSetting||JSON.stringify(this.getNewSetting());this.strNewLayout=this.strCurrentLayout;this.strNewSetting=this.strCurrentSetting;};Portal.prototype.markDirty=function()
{this.strNewLayout=this.strNewSetting=null;this.layout=this.getLayoutObj();}
Portal.prototype.attachRowJsObj=function(elRoot,jsObj){elRoot.jsObj=jsObj;var nodes=elRoot.childNodes;var count=0;for(var i=0;i<nodes.length;i++){if(/column/.test(nodes[i].className)){this.attachColJsObj(nodes[i],jsObj[count]);count++;}}};Portal.prototype.attachColJsObj=function(elRoot,jsObj){elRoot.jsObj=jsObj;var nodes=elRoot.childNodes;var count=0;for(var i=0;i<nodes.length;i++){if(/row/.test(nodes[i].className)){this.attachRowJsObj(nodes[i],jsObj.content[count].row);count++;}
else if(/portlet_frame/.test(nodes[i].className)){count++;}}};Portal.prototype.activateElementEdit=function(elRoot,bRecursive){var strEditOption=this.editOption.column;if(/row/.test(elRoot.className)){var elDividers=fc2(elRoot,1,null,/colhighlight|coldiv/);for(var i=0;i<elDividers.length;i++){this.activateColdiv(elDividers[i]);}
elDividers=null;strEditOption=this.editOption.row;var strTypeClass='RowToolbar';}else{var strTypeClass='ColToolbar';}
if(!strEditOption||elRoot.isEdit)return;var toolbar=cex('div',{className:'EleEditToolbar '+strTypeClass});var jsToolbar={elRoot:toolbar,highlight:function(strColor){strColor=strColor||'#FCC';this.elRoot.m_backgroundColor=this.elRoot.backgroundColor;this.elRoot.style.backgroundColor=strColor;},reset:function(){this.elRoot.style.backgroundColor=this.elRoot.m_backgroundColor;this.elRoot.m_backgroundColor=null;},enableEdit:function(strOption){var buttons=fc2(this.elRoot,1,null,/EleEditButton/);for(var i=0;i<buttons.length;i++){for(var j=0;j<strOption.length;j++){if(buttons[i].innerHTML==strOption.substring(j,1)&&/disabled/.test(buttons[i].className)){var className=buttons[i].className;className=className.replace(/ disabled/,'');buttons[i].className=className;buttons[i].onclick=buttons[i].m_onclick;buttons[i].m_onclick=null;}}}},deactivate:function(){var buttons=fc2(this.elRoot,1,null,/EleEditButton/);for(var i=0;i<buttons.length;i++){buttons[i].m_onclick=null;buttons[i].onclick=null;}
this.elRoot=null;}};elRoot.jsToolbar=jsToolbar;var bEmptyParent=false;if(elRoot.firstChild){ib(toolbar,elRoot.firstChild);}
else{bEmptyParent=true;ac(elRoot,toolbar);}
for(var ndx=0;ndx<strEditOption.length;ndx++){var ch=strEditOption.charAt(ndx);switch(ch){case'x':var btnRemove=cex('div',{innerHTML:'x',className:'EleEditButton',title:'移除這直行',unselectable:'on'});ac(toolbar,btnRemove);btnRemove.onclick=function(){var elColumn=fp(this,'div',{jsObj:true});var _this=fp(this,'div',{portalObj:true}).portalObj;_this.removeColumn(elColumn);};btnRemove=null;break;case'-':var btnPopColumn=cex('div',{innerHTML:'-',className:'EleEditButton',title:'將最右方直行移除',unselectable:'on'});ac(toolbar,btnPopColumn);btnPopColumn.onclick=function(){var elRow=fp(this,'div',{jsObj:true});var _this=fp(this,'div',{portalObj:true}).portalObj;_this.popColumn(elRow);};btnPopColumn=null;break;case'h':var btnHSplit=cex('div',{innerHTML:'=',className:'EleEditButton',title:'增加一橫列行',unselectable:'on'});ac(toolbar,btnHSplit);btnHSplit.onclick=function(){var elColumn=fp(this,'div',{jsObj:true});var _this=fp(this,'div',{portalObj:true}).portalObj;_this.addRow(elColumn);};btnHSplit=null;break;case'v':var btnVSplit=cex('div',{innerHTML:'+',className:'EleEditButton',title:'增加一直列行',unselectable:'on'});ac(toolbar,btnVSplit);btnVSplit.onclick=function(){var elRow=fp(this,'div',{jsObj:true});var _this=fp(this,'div',{portalObj:true}).portalObj;_this.addColumn(elRow);MsgBar.addMsg('您現在有 '+elRow.jsObj.length+'個直列行.');};btnVSplit=null;break;case'@':var btnDebug=cex('div',{innerHTML:'@',className:'EleEditButton',title:'展示版面設計',unselectable:'on'});ac(toolbar,btnDebug);btnDebug.onclick=function(){var elParent=fp(this,'div',{jsObj:true});var _this=fp(this,'div',{portalObj:true}).portalObj;log(JSON.stringify(_this.getJsObjFromDom(elParent,true)));};btnDebug=null;break;case'0':case'1':case'2':var btnCol=cex('div',{innerHTML:ch,className:'EleEditButton',title:'在此直行中 '+ch+' 使用此風格',unselectable:'on'});ac(toolbar,btnCol);btnCol.onclick=function(){var elParent=fp(this,'div',{jsObj:true});Element.replaceClassName(elParent,/colstyle/,'colstyle'+this.innerHTML);Current.saveDesign();};btnCol=null;break;default:break;}}
elRoot.isEdit=true;if(!!bRecursive){var nodes=elRoot.childNodes;for(var i=0;i<nodes.length;i++){var className=nodes[i].className;if(/row/.test(className)){this.activateElementEdit(nodes[i],bRecursive);}
else if(/column/.test(className)){this.activateElementEdit(nodes[i],bRecursive);}
else{}}}
if(this.showToolbar){toolbar.style.display='block';}else{toolbar.style.display='none';}
elRoot=null;toolbar=null;};Portal.prototype.deactivateElementEdit=function(elRoot,bRecursive){if(!elRoot.isEdit||!elRoot.jsToolbar){return;}
elRoot.jsToolbar.elRoot.parentNode.removeChild(elRoot.jsToolbar.elRoot);elRoot.jsToolbar.deactivate();elRoot.isEdit=false;elRoot.jsToolbar=null;if(/row/.test(elRoot.className)){var elDividers=fc2(elRoot,1,null,/colhighlight|coldiv/);for(var i=0;i<elDividers.length;i++){this.deactivateColdiv(elDividers[i]);}
elDividers=null;}
if(!!bRecursive){var nodes=elRoot.childNodes;for(var i=0;i<nodes.length;i++){var className=nodes[i].className;if(/row/.test(className)||/column/.test(className)){this.deactivateElementEdit(nodes[i],bRecursive);}}}};function TabSet()
{this.container=null;this.eTabPanes=null;this.activeTabId=null;this.tabEventHandlers={};this.tabPaneDivs={};this.nextid=0;this.eTabsFixed=null;this.eTabs=null;this.tabLinks={};this.history=[];YuEvent.addListener(window,'unload',this.deactivate,this,true)}
TabSet.prototype.deactivate=function(e)
{for(var i in this.tabLinks){if(this.tabEventHandlers[i]&&this.tabEventHandlers[i].onRemove){this.tabEventHandlers[i].onRemove(this.tabPaneDivs[i],getRawHref(this.tabLinks[i]));}}
this.container&&(this.container.tabsetObj=null);this.container=null;this.eTabPanes=null;this.eTabsFixed=null;this.eTabs=null;if(!e||e.type!='unload'){YuEvent.removeListener(window,'unload',this.deactivate);}}
TabSet.prototype.init=function()
{var maxTabId=0;var container=ge('tabContainer');var header=ge('tabLinks');var eTabPanes=ge('tabPanes');var links=fc(header,'a');var link,tabId;var tabs=fc(header,'ul',null,/tabs/);this.eTabsFixed=tabs[0];this.eTabs=tabs[1];tabs=null;for(var i=0,e=links.length;i<e;i++){link=links[i];tabId=parseInt(link.id.substr(3));maxTabId=Math.max(tabId,maxTabId);link.onclick=Dispatch.goEvent;var pane=ge('pane'+tabId);if(!pane){pane=cex("div",{'id':'pane'+tabId,className:'tab_pane',style:{display:'none'}});ac(eTabPanes,pane);}
if(fp(link,'LI').className=='current'){this.activeTabId=tabId;}
this.tabPaneDivs[tabId]=pane;this.tabLinks[tabId]=link;if(fp(link,'UL')==this.eTabs){this.addClose(tabId);}}
this.nextid=++maxTabId;this.container=container;this.container.tabsetObj=this;this.eTabPanes=eTabPanes;}
TabSet.prototype.addClose=function(tabId)
{var div=fc(this.tabLinks[tabId],'div',null,null,true)
ac(div,cex('img',{src:Config.BASEPATH+'/portal/images/close.gif',className:'tab_close',border:0,onclick:this.removeTabEvent,tabId:tabId}));}
TabSet.prototype.showPaneEvent=function()
{var tabId=parseInt(this.id.substr(3));tabSet.showPane(tabId);this.blur();return false;}
TabSet.prototype.removeTabEvent=function()
{var _this=fp(this,'div',{tabsetObj:true}).tabsetObj;_this.removeTab(this.tabId);return false;}
TabSet.prototype.pushHistory=function(tabId)
{this.history.push(tabId);}
TabSet.prototype.popHistory=function()
{var tabId,history,found=0;for(var i=0,e=this.history.length;i<e;i++){tabId=this.history.pop();if(this.tabLinks[tabId]){found=tabId;break;}}
return found;}
TabSet.prototype.loadPane=function(tabId)
{var pane=this.tabPaneDivs[tabId];var link=this.tabLinks[tabId];if(this.tabEventHandlers[tabId]&&this.tabEventHandlers[tabId].onEnter){this.tabEventHandlers[tabId].onEnter(pane,getRawHref(link),false);}}
TabSet.prototype.showPane=function(tabId,refresh)
{var oldTabId=this.activeTabId;if(!refresh&&(tabId==oldTabId))return false;if(tabId!=oldTabId){if(oldTabId!=null){this.pushHistory(oldTabId);var oldLink=this.tabLinks[oldTabId];oldLink.m_scrollTop=document.documentElement.scrollTop;var oldPane=this.tabPaneDivs[oldTabId];if(this.tabEventHandlers[oldTabId]&&this.tabEventHandlers[oldTabId].onExit){if(!this.tabEventHandlers[oldTabId].onExit(oldPane,getRawHref(oldLink)))return false;}
ClickHandler.clearCurrent();if(this.activeTabId==oldTabId){oldPane.style.display='none';var pane=this.tabPaneDivs[tabId];pane.style.display="block";fp(oldLink,'LI').className='';}}else{var pane=this.tabPaneDivs[tabId];pane.style.display="block";}}else{var pane=this.tabPaneDivs[tabId];}
var link=this.tabLinks[tabId];if(this.tabEventHandlers[tabId]&&this.tabEventHandlers[tabId].onEnter){this.tabEventHandlers[tabId].onEnter(pane,getRawHref(link),true);}
fp(link,'LI').className="current";this.activeTabId=tabId;if(typeof link.m_scrollTop!='undefined'){document.documentElement.scrollTop=link.m_scrollTop;}else if(document.body.scrollIntoView)document.body.scrollIntoView(true);return false;}
TabSet.prototype.addEventHandler=function(tabId,handler)
{this.tabEventHandlers[tabId]=handler;}
TabSet.prototype.removeEventHandler=function(tabId)
{this.tabEventHandlers[tabId]=null;}
TabSet.prototype.addEmptyTab=function(textOnTab,url,aClass,fixed)
{var tabId=this.nextid++;var newDiv=cex("div",{'id':'pane'+tabId,className:'tab_pane',style:{display:'none'}});this.tabPaneDivs[tabId]=newDiv;ac(this.eTabPanes,newDiv);var newTabLi=ce("li");var newTabRight=ce('div');var newTabA=cex("a",{id:'tab'+tabId,hideFocus:true,title:textOnTab,href:url});newTabA.setAttribute('fixed',fixed);var tabText=ctn(fixed?textOnTab:textOnTab.replace(/(.{16}).+/,'$1'+String.fromCharCode(187)));var tabSpan=ce('span');if(aClass){tabSpan.className=aClass;}
newTabA.onclick=this.showPaneEvent;this.tabLinks[tabId]=newTabA;if(!fixed){at([this.eTabs,[newTabLi,[newTabA,cex('b',{className:'s1'}),cex('b',{className:'s2'}),[newTabRight,[tabSpan,tabText]],cex('b',{className:'s2'}),cex('b',{className:'s1'})]]]);this.addClose(tabId);}else{at([this.eTabsFixed,[newTabLi,[newTabA,cex('b',{className:'s1'}),cex('b',{className:'s2'}),[newTabRight,[tabSpan,tabText]],cex('b',{className:'s2'}),cex('b',{className:'s1'})]]]);}
return tabId;}
TabSet.prototype.removeTab=function(tabId,removeOnly)
{var pane=this.tabPaneDivs[tabId];var link=this.tabLinks[tabId];if(tabId==this.activeTabId){if(this.tabEventHandlers[tabId]&&this.tabEventHandlers[tabId].onExit){if(!this.tabEventHandlers[tabId].onExit(pane,getRawHref(link),1))return false;}
this.activeTabId=null;}else{if(this.tabEventHandlers[tabId]&&this.tabEventHandlers[tabId].onExit){if(!this.tabEventHandlers[tabId].onExit(pane,getRawHref(link),2))return false;}}
ClickHandler.clearCurrent();pane.style.display="none";if(this.tabEventHandlers[tabId]&&this.tabEventHandlers[tabId].onRemove){this.tabEventHandlers[tabId].onRemove(pane,getRawHref(link));}
if(this.tabEventHandlers[tabId]){this.tabEventHandlers[tabId]=null;delete this.tabEventHandlers[tabId];}
rn(fp(this.tabLinks[tabId],'LI'));this.tabLinks[tabId].onclick=null;try{this.tabLinks[tabId].lastChild.onclick=null;}catch(e){};this.tabLinks[tabId]=null;delete this.tabLinks[tabId];rn(this.tabPaneDivs[tabId]);this.tabPaneDivs[tabId]=null;delete this.tabPaneDivs[tabId];if(!removeOnly&&!this.activeTabId){var id=this.popHistory();this.showPane(id);}
return true;}
TabSet.prototype.resetTab=function(tabId,textOnTab,url,loading)
{var link=this.tabLinks[tabId];var span=fc(link,'span',null,null,true);var pane=this.tabPaneDivs[tabId];if(url){if(url)link.href=url;}
if(typeof loading!='undefined'){var img=span.previousSibling;if(loading){if(!img){img=cex('img',{className:'tab_loading',align:'absmiddle'});}
img.src=Config.BASEPATH+'/portal/images/loading.gif';ib(img,span);}else{if(img)rn(img);}}
if(textOnTab){var tab=fp(link,'ul',null,/tabs/,true);textOnTab+='';link.style.width='';link.title=textOnTab;var tabText=(tab==this.eTabsFixed)?ctn(textOnTab):ctn(textOnTab.replace(/(.{16}).+/,'$1'+String.fromCharCode(187)));rc(tabText,span.firstChild);}
return pane;}
function PortalC(groupid,grouppath,displayname,groupTypeid,isAdminPortal)
{this.groupid=groupid;this.grouppath=grouppath;this.displayname=displayname;this.groupTypeid=groupTypeid;this.isAdminPortal=isAdminPortal;this.portals={};this.handlers={};this.tabUrls={};}
PortalC.prototype.deactivate=function()
{for(var i in this.portals){this.portals[i]=null;this.handlers[i]=null;delete this.portals[i];delete this.handlers[i];}}
PortalC.prototype.changeUrl=function(oldUrl,newUrl,tabUrl)
{this.portals[oldUrl].url=newUrl;this.handlers[oldUrl].reset(null,newUrl,false);this.portals[newUrl]=this.portals[oldUrl];this.handlers[newUrl]=this.handlers[oldUrl];if(tabUrl)this.tabUrls[tabUrl]=newUrl;delete this.portals[oldUrl];delete this.handlers[oldUrl];if(Current.url==oldUrl)Current.url=newUrl;}
PortalC.prototype._saveDesignCallback=function(result,args)
{MsgCorner.hide();var url=args[0];var resp=result.getResponse();if(!resp.isException){if(url){var portal=this.portals[url];if(portal.seq==-1&&resp.seq){portal.seq=resp.seq;}
if(portal.oldTitle&&portal.oldTitle!=portal.title){var urlProcess=new UrlProcess(url);if(urlProcess.view=='portal'){urlProcess.page=portal.title;var newUrl=urlProcess.encode();this.changeUrl(url,newUrl);}
portal.oldTitle=portal.title;}
portal.markAllSaved();portal.resetDirty();portal.hideSavePane();Current.autosave||(portal.hideEditToolbar(),DesignBar.closeLowerPane(),MsgBar.addMsg('成功將設計儲存'));Current.isSaving=false;}else{}}else{MsgBar.addMsg('設計不能儲存','error');}}
PortalC.prototype.markDirty=function(url)
{var portal=this.portals[url];portal&&portal.markDirty();}
PortalC.prototype.pendingSave=function(url)
{var portal;if(url){portal=this.portals[url];if(portal.checkDirty()){portal.showSavePane();}else{portal.hideSavePane();}}}
PortalC.prototype.saveDesign=function(url)
{var portal;if(url){portal=this.portals[url];if(!portal.checkDirty()){Current.autosave||MsgBar.addMsg('沒有改變');return;}
MsgCorner.show('儲存中…');}else{return;}
var ajx=new AjxAction('portal','savePortal');ajx.set("groupid",portal.groupid);ajx.set("title",portal.title);ajx.set("system",portal.system||'');ajx.set("oldTitle",portal.oldTitle||portal.title);ajx.set("layoutJson",portal.strNewLayout);ajx.set("settingJson",portal.strNewSetting);ajx.setCallback(new AjxCallback(this,this._saveDesignCallback,[url]));ajx.fire();Current.isSaving=true;return false;}
PortalC.prototype.revertDesign=function(url,refresh,quiet)
{if(url){var portal=this.portals[url];if(portal.seq==-1){portal.resetDirty();this.handlers[url].remove();return true;}
var dirty=portal.checkDirty();if(!dirty){if(!quiet)MsgBar.addMsg('沒有改變');return false;}
if(dirty&1){if(refresh){portal.refresh();}else{portal.teardown();}}else{portal.title=portal.oldTitle;portal.readPermList=null;portal.resetDirty();}}
return true;}
PortalC.prototype.activatePortal=function(element,url)
{if(url!=Current.url)return false;var portal=this.portals[url];if(portal){if(Current.sandbox&&portal.seq!=SEQ_NONPORTAL){portal.canEdit=Current.sandbox;}
var title=(this.displayname?this.displayname:this.grouppath)+': '+portal.textOnTab;;document.title=title;portal.url=url;portal.isDisplay=true;portal.activate(element);Current.canEdit=portal.canEdit;portal.swDesignMode(Current.inDesignMode&&portal.canEdit);Toolbar.refresh();}
return false;}
PortalC.prototype._readAndDisplayPortalCallback=function(result,args)
{var element=args[0];var url=args[1];var display=args[2];var resp=result.getResponse();if(!resp.isException){if(!this.handlers[url])return;var newUrl=resp.url;if(newUrl!=url&&this.portals[newUrl]&&!this.portals[url]){if(this.handlers[newUrl]){this.handlers[url]&&this.handlers[url].remove(true);if(display)this.handlers[newUrl].show();}else{this.handlers[url].remove();if(display)Dispatch.goUrl(newUrl);}
return;}
var portal=resp.portal;if(resp.html&&resp.html!=''){element.innerHTML=resp.html;}
if(portal){if(this.groupid!=portal.groupid)portal.canEdit=false;this.portals[url]=Portal.createFromObj(portal);if(this.handlers[url].reset){this.handlers[url].reset(portal.textOnTab,null,false);}}
this.activatePortal(element,url);}else{MsgBar.addMsg(resp.html||'portal error','error');var urlProcess=new UrlProcess(url);if(urlProcess.view!='portal'){this.handlers[url]&&(this.handlers[url].remove());}}}
PortalC.prototype.readAndDisplayPortal=function(element,url,display)
{if(display)Current.switchContext(this,url);if(this.portals[url]){this.portals[url].update();this.activatePortal(element,url);return false;}
var ajx=new AjxAction('portal',"getPortalObjAndHtml");ajx.set("url",url);ajx.setCallback(new AjxCallback(this,this._readAndDisplayPortalCallback,[element,url,display]));ajx.fire();if(this.handlers[url].reset){this.handlers[url].reset(null,null,true);}
return false;}
PortalC.prototype.showFirst=function()
{for(var i in this.handlers){this.handlers[i].show();break;}}
PortalC.prototype.addTabHandlers=function(url,tabId)
{this.handlers[url]={show:function(_refresh){return tabSet.showPane(tabId,_refresh);},remove:function(removeOnly){return tabSet.removeTab(tabId,removeOnly);},reset:function(_textOnTab,_url,_loading){return tabSet.resetTab(tabId,_textOnTab,_url,_loading);}};var tabUrl=UrlProcess.urlForTab(url);this.tabUrls[tabUrl]=url;}
PortalC.prototype.addHandlersToTab=function(tabId)
{tabSet.addEventHandler(tabId,{onEnter:function(_el,_url,_display){return gPortalC.readAndDisplayPortal(_el,_url,_display);},onRemove:function(_el,_url){return gPortalC.removePortal(_el,_url);},onExit:function(_el,_url,_remove){return gPortalC.exitPortal(_el,_url,_remove);}});}
PortalC.prototype.initTabs=function()
{var url,matches;for(var tabId in tabSet.tabLinks){this.addHandlersToTab(tabId);var link=tabSet.tabLinks[tabId];url=getRawHref(link);this.addTabHandlers(url,tabId);if(tabId==tabSet.activeTabId){tabSet.showPane(tabId,true);}}}
PortalC.prototype.addPortalToTab=function(textOnTab,url,aClass,dontShow)
{var tabId=tabSet.addEmptyTab(textOnTab,url,aClass);this.addTabHandlers(url,tabId);this.addHandlersToTab(tabId);if(!dontShow){tabSet.showPane(tabId);}else{tabSet.loadPane(tabId);}
return tabId;}
PortalC.prototype.removePortalEvent=function()
{var _this=this;return function(element,url){_this.removePortal(element,url);}}
PortalC.prototype.removePortal=function(element,url)
{if(element)Dispatch.unHook(element);if(this.portals[url]){if(this.portals[url].deactivate)this.portals[url].deactivate();delete this.portals[url];}
if(this.handlers[url]){delete this.handlers[url];}
var tabUrl=UrlProcess.urlForTab(url);if(this.tabUrls[tabUrl]){delete this.tabUrls[tabUrl];}}
PortalC.prototype.exitPortal=function(element,url,remove)
{var portal=this.portals[url];if(!portal)return true;if(remove&&!portal.events['remove_portal'].fire(portal))
{return false;}
if(portal.isDesignMode&&portal.checkDirty()){if(portal.seq==-1){if(confirm('這個新網頁尚未被儲存\n放棄這頁面並繼續?\n\n* 請按OK鍵撤銷現在網頁並繼續\n* 退出並保留原來網頁')){portal.resetDirty();if(!remove)this.handlers[url].remove();}else{return false;}}else{if(confirm('版面設計已改變\n放棄更改並繼續?\n\n* 請按OK鍵撤銷所有改動並繼續\n* 退出並保留原來網頁')){this.revertDesign(url,false);}
else{return false;}}}
else{if(remove!=2){portal.closeEditPortal(true);portal.closeEditAllPortlets(true);portal.isDisplay=false;}}
return true;}
PortalC.prototype._newPageOK=function(textOnTab)
{var urlProcess=new UrlProcess();if(this.groupid>=GROUPID_RANGE_START){urlProcess.scope='home';urlProcess.grouppath=this.grouppath;}else{urlProcess.scope='world';}
var title=textOnTab.toFriendlyUrl();urlProcess.view='portal';urlProcess.page=title;var url=urlProcess.encode();if(!this.portals[url]){var portal=new Portal();portal.canEdit=true;portal.textOnTab=textOnTab;portal.url=url;portal.unsaved=true;portal.groupid=this.groupid;portal.seq=-1;portal.title=title;this.portals[url]=portal;var tabId=tabSet.addEmptyTab(textOnTab,url,'portal',true);this.addTabHandlers(url,tabId);this.addHandlersToTab(tabId);portal.buildPortalContentDOM(portal.buildPortalFrameDOM(tabSet.tabPaneDivs[tabId]).content);tabSet.showPane(tabId);portal.showEditToolbar();portal.strCurrentLayout='';portal.strCurrentSetting='';Current.saveDesign();portal.editPortal();}else{MsgBar.addMsg('這標題已存在','error');}}
PortalC.prototype.newPage=function()
{var calltitle=window.prompt('請輸入標題:','');if(calltitle&&calltitle!=''){this._newPageOK(calltitle);}}
PortalC.prototype.removePage=function(url)
{var portal=this.portals[url];if(portal){if(portal.seq==0){MsgBar.addMsg('不能移除首頁');return;}
if(confirm('確定移走網頁請按OK鍵')){var ajx=new AjxAction('portal','removePage');ajx.set("groupid",portal.groupid);ajx.set("title",portal.title);ajx.setCallback(new AjxCallback(this,this._removePageCallback,[url]));ajx.fire();portal.resetDirty();this.handlers[url].remove();}}}
PortalC.prototype._removePageCallback=function(result,args)
{var url=args[0];var resp=result.getResponse();if(!resp.isException){}else{MsgBar.addMsg(resp.html,'error');}}
PortalC.prototype.showIfExists=function(url)
{if(this.handlers[url]){this.handlers[url].show();return true;}else{var tabUrl=UrlProcess.urlForTab(url);var oldUrl=this.tabUrls[tabUrl];if(oldUrl){this.changeUrl(oldUrl,url,tabUrl);this.portals[url].invalidate();this.handlers[url].show(true);return true;}
return false;}}
PortalC.prototype.startDesign=function()
{if(this.portals[Current.url]){return this.portals[Current.url].swDesignMode(true);}}
PortalC.prototype.exitDesign=function()
{for(var url in this.portals){if(this.portals[url])this.portals[url].swDesignMode(false);}}
PortalC.prototype.getDesignMode=function(url)
{return this.portals[url].isDesignMode;}
PortalC.prototype.invalidate=function()
{for(var i in this.portals){if(this.portals[i])this.portals[i].invalidate();}};PortalC.prototype.updateCurrent=function()
{var portal;if((portal=this.portals[Current.url])&&portal.update){portal.update()}}
var Current={collection:null,url:'',urlProcess:null,inDesignMode:false,canEdit:false,sandbox:false,autosave:false,tryTheme:false,saveDesign:function(forced){if(!this.sandbox){Current.collection.markDirty(Current.url);if(this.autosave||forced){Current.collection.saveDesign(Current.url);}else{Current.collection.pendingSave(Current.url);}}else{MsgBar.addMsg('不能在測試區儲存 - 請先登記成會員');}},swDesignMode:function(mode){if(mode==Current.inDesignMode)return;Current.inDesignMode=mode;if(mode){window.onbeforeunload=Current.onbeforeunload;Current.collection.startDesign();var portal=gPortalC.portals[Current.url];if(portal)portal.showEditToolbar();}else if(!mode){Current.collection.exitDesign();}
Toolbar.refresh();},switchContext:function(collection,url){Current.collection=collection;Current.url=url;BubbleTooltip.hide();History.add(url);Current.urlProcess=new UrlProcess(url);},getDesignMode:function(){return Current.collection.getDesignMode(Current.url);},exitDesign:function(forced){if(forced!=true){var portal=gPortalC.portals[Current.url];if(!portal||!portal.isDesignMode)return;if(portal.checkDirty()){if(!confirm('這個網頁尚未被儲存\n放棄更改並繼續?\n\n* 請按OK鍵撤銷所有改動並繼續\n* 退出並保留')){return;}}}
Current.swDesignMode(false);gPortalC.revertDesign(Current.url,true,true);},onbeforeunload:function(e){var msg='';if(Current.tryTheme){msg+='這場景主題未儲存\n';}
if(Current.inDesignMode){var portal=Current.collection.portals[Current.url];if(!portal||!portal.isDesignMode)return;if(portal.checkDirty()){msg+='版面設計已改變\n';}}
if(msg!=''){e=YuEvent.getEvent(e);if(mz)e.preventDefault();e.returnValue=msg+'放棄更改並繼續?\n\n* 如按下OK鍵. 所有更改將被撤銷.';}}};function Portlet(cfg)
{if(cfg)return Portlet.createFromObj(cfg);this.isDragging=false;this.isRefreshing=false;this.isPopup=0;this.isInner=0;this.portal=null;this.onClose=new YAHOO.util.CustomEvent('close');this.events={'refresh':new YAHOO.util.CustomEvent('portlet_refresh')};}
Portlet.TYPE_SET_ADMIN=49;Portlet.TYPE_SPOST_AGG=66;Portlet.TYPE_ADMIN_POST_AGG=76;Portlet.TYPE_ADMIN_BBSMSG_AGG='76.1';Portlet.TYPE_ADMIN_BBSREPLY_AGG='76.2';Portlet.TYPE_ADMIN_COMMENT_AGG='76.3';Portlet.TYPE_ADMIN_MEMBER_AGG=79;Portlet.OPTION_FIXED=0x01;Portlet.OPTION_NONEDITABLE=0x02;Portlet.OPTION_TOPTITLE=0x04;Portlet.OPTION_DEFERRED=0x08;Portlet.OPTION_NONREFRESH=0x10;Portlet.OPTION_READER=0x40;Portlet.OPTION_MOBILE=0x20;Portlet.OPTION_EXPORT=0x80;Portlet.OPTION_NOAUTOUPDATE=0x100;Portlet.MIN_WIDTH=100;Portlet.MIN_HEIGHT=14;Portlet.WIDTH_PADDING=12;Portlet.HEIGHT_PADDING=14;Portlet.MARGIN=10;Portlet.IMG_EDIT_ON='<img src="'+Config.BASEPATH+'/portal/images/edit_on.gif" width="16" height="16" title="關閉編輯" />';Portlet.IMG_EDIT='<img src="'+Config.BASEPATH+'/portal/images/edit.gif" width="16" height="16" title="編輯" />';Portlet.IMG_DRAG='<img src="'+Config.BASEPATH+'/portal/images/add.gif" width="16" height="16" title="拖拉" />';Portlet.IMG_REFRESH='<img src="'+Config.BASEPATH+'/portal/images/refresh.gif" width="16" height="16" title="更新內容方格" />';Portlet.IMG_CLOSE_ASK='<img src="'+Config.BASEPATH+'/portal/images/close_ask.gif" width="16" height="16" title="關閉內容方格"/>';Portlet.IMG_CLOSE_SURE='<img src="'+Config.BASEPATH+'/portal/images/close_sure.gif" width="16" height="16" title="確定"/>';Portlet.createFromObj=function(portlet)
{var newportlet=new Portlet();newportlet.title=portlet.title,newportlet.id=portlet.id,newportlet.filter=portlet.filter,newportlet.isPopup=newportlet.isPopup||(portlet.filter&&portlet.filter.uiOptions&&portlet.filter.uiOptions.isPopup);newportlet.isInner=newportlet.isInner||(portlet.filter&&portlet.filter.uiOptions&&portlet.filter.uiOptions.isInner);newportlet.menuId=portlet.menuId,newportlet.filtertype=portlet.filtertype,newportlet.style=portlet.style||{},newportlet.ico=portlet.ico,newportlet.options=portlet.options||0;newportlet.topTitle=portlet.topTitle,newportlet.expanded=portlet.expanded;newportlet.depend=portlet.depend;newportlet.dCount=portlet.dCount;newportlet.left=portlet.left;newportlet.top=portlet.top;newportlet.width=portlet.width;newportlet.height=portlet.height;newportlet.xsl=portlet.xsl||'';newportlet.checksum=portlet.checksum;newportlet.jsHandler=portlet.jsHandler;newportlet.realxsl=portlet.realxsl;return newportlet;}
Portlet.prototype.getEvent=function(event){return this.events[event];};Portlet.prototype.removeEventListener=function(event,fn,obj,override){if(!this.getEvent(event)){return false;}
var e=this.getEvent(event);e.unsubscribe(fn,obj);};Portlet.prototype.addEventListener=function(event,fn,obj,override){if(!this.getEvent(event)){this.events[event]=new YAHOO.util.CustomEvent(event);}
var e=this.getEvent(event);e.subscribe(fn,obj,override);}
Portlet.prototype.fireEvent=function(event,args){var e=this.getEvent(event);if(e){e.fire(args);}};Portlet.prototype.buildPortletFrameDOM=function(root)
{var portletFrame=cex("div",{portlet_id:this.id,className:'portlet_frame '+(this.style?(this.style.className||'')+(this.style.hideFrame?' hide_frame':'')+(this.style.hideHeader?' hide_header':''):'')});var w1=cex("div",{className:'w1'});var w2=cex("div",{className:'w2'});var rtop=cex("b",{className:"rtop",innerHTML:'<b class="r1"></b><b class="r2"></b>'});var rbot=cex("b",{className:"rbottom",innerHTML:'<b class="r2"></b><b class="r1"></b>'});var portlet=cex("div",{className:'portlet'});var top=cex("div",{className:'portlet_top'});var header=cex("div",{className:'portlet_header'});var expand=cex("div",{className:this.expanded?'expanded':'collapsed',innerHTML:this.expanded?'<img src="'+Config.BASEPATH+'/portal/images/hideMod.gif" />':'<img src="'+Config.BASEPATH+'/portal/images/showMod.gif" />'});var title=cex("span",{className:'title'});var title0=cex('div',{className:'title0'});var titleText=ctn(this.title);var refresh=cex("div",{className:'refresh',style:{display:'none'}});var startedit=cex("div",{className:'startedit',style:{display:'none'},innerHTML:(this.options&Portlet.OPTION_NONEDITABLE)?'':' 編輯 '});var closer=cex("div",{className:'close_ask',style:{display:'none'}});var edit=cex("div",{className:'portlet_edit',style:{display:'none'}});var drag=cex("div",{className:'drag',style:{display:'none'}});var main=cex("div",{className:'portlet_main'});var bg=cex("div",{className:'portlet_bg'});var title1=cex("div",{className:'title1'});var content=cex("div",{className:'portlet_content'});var prevnext=cex("div",{className:'portlet_prevnext',style:{display:'none'}});var nextA=cex('a',{href:'javascript:void(0);',pid:this.id,className:'next',style:{display:'none'},innerHTML:'下頁'});var prevA=cex('a',{href:'javascript:void(0);',pid:this.id,className:'prev',style:{display:'none'},innerHTML:'上頁'});var range=cex('span',{className:'range'});at([root,[portletFrame,[w1,rtop,[top,[header,expand,closer,drag,refresh,startedit,[title0,[title,titleText]]],],edit,[main,[portlet,content,[prevnext,nextA,range,prevA]],bg,title1],rbot,[w2,[ce('s'),[ce('s'),[ce('s'),ce('s')]]]]]]]);return portletFrame;}
Portlet.prototype.toString=function(){var s="Portlet";s+=" id="+this.id;s+=" menuId="+this.menuId;s+=" filter="+this.filtertype;return"["+s+"]";};var totalTime=0;Portlet.prototype.activate=function(element)
{if(!this.eframe&&element){this.eframe=element;fca(element,'div','className',['portlet_header','portlet','portlet_content','portlet_prevnext','portlet_edit','title0'],this,['eheader','eportlet','econtent','eprevnext','eedit','etitle']);this.eexpand=rec(this.eheader);this.eclose=this.eexpand.nextSibling;this.edrag=this.eclose.nextSibling;this.erefresh=this.edrag.nextSibling;this.estartedit=this.erefresh.nextSibling;this.eclose.innerHTML=Portlet.IMG_CLOSE_ASK;this.edrag.innerHTML=Portlet.IMG_DRAG;if(!(this.options&Portlet.OPTION_NONREFRESH)){this.erefresh.innerHTML=Portlet.IMG_REFRESH;}
if(!(this.options&Portlet.OPTION_NONEDITABLE)){this.estartedit.innerHTML=Portlet.IMG_EDIT;}
this.eframe.portletObj=this;if(this.portal.layoutType==Portal.LAYOUT_TYPE_FREESTYLE){this.eresize=cex('div',{className:'resize',innerHTML:'<img src="'+Config.BASEPATH+'/portal/images/resizer.gif'+'" border="0" alt="更改內容方格的大小" />'});ib(this.eresize,this.eframe.firstChild);}
if(Alias.status>=STATUS_SYSDESIGNER){var exportUrls=PortalMenu.makeExportUrls(this);var exportLink=cex('a',{className:'tools',href:exportUrls.xmlExportUrl,title:'export XML',innerHTML:'<img src="'+Config.BASEPATH+'/portal/images/arrow_right.gif'+'" border="0" alt="export XML" />'});ib(exportLink,this.eheader);exportLink.onclick=function(link,e){var exportUrls=PortalMenu.makeExportUrls(this);window.open(exportUrls.xmlExportUrl);YuEvent.stopEvent(YuEvent.getEvent(e));return false;}.bind(this,exportLink);exportLink.oncontextmenu=function(){this.nextSibling.oncontextmenu&&this.nextSibling.oncontextmenu();return true;}
exportLink=exportUrls=null;}}
if(this.eframe){this.enableHeader();this.enableContent();Dispatch.hook(this.eprevnext);}}
Portlet.prototype.updateTitleStyle=function()
{var spans=fc(this.etitle,'span');for(var i=0;i<spans.length;i++){spans[i].innerHTML='';ac(spans[i],ctn(this.title));}
spans=null;var styleNew=/portlet_new/.test(this.eframe.className);this.eframe.className='portlet_frame '+(this.style?(this.style.className||'')+(this.style.hideFrame?' hide_frame':'')+(this.style.hideHeader?' hide_header':''):'')+(styleNew?' portlet_new':'');this.resetWH();if(this.style&&this.style.hideHeader){this.eframe.onmouseover=this.highlight;this.eframe.onmouseout=this.lowlight;}else{this.eframe.onmouseover='';this.eframe.onmouseout='';}}
Portlet.prototype.enableHeader=function()
{if(!(this.options&Portlet.OPTION_NONREFRESH)){this.erefresh.onclick=function(e){e=YuEvent.getEvent(e);var _this=fp(this,null,{portletObj:true}).portletObj;if(!_this.portal.isDragging)_this.refresh();YuEvent.stopEvent(e);return false;}}
if(this.portal.isDesignMode){this.estartedit.onclick=this.editPortlet;if(this.style.hideHeader){this.eframe.ondblclick=this.editPortlet;}else{this.eheader.ondblclick=this.editPortlet;}
this.erefresh.onmousedown=Portlet.nomousedown;this.eclose.onmousedown=Portlet.nomousedown;this.estartedit.onmousedown=Portlet.nomousedown;this.eheader.onmousedown=Portlet.onmousedown;this.eframe.style.display='block';this.eheader.style.cursor='move';if(!(this.options&Portlet.OPTION_FIXED)){if(this.id!='new'){this.eclose.onclick=function(e){e=YuEvent.getEvent(e);var _this=fp(this,null,{portletObj:true}).portletObj;if(this.className=='close_ask')_this.closeAsk();e=YuEvent.stopEvent(e);return false;}
this.eclose.ondblclick=function(e){var _this=fp(this,null,{portletObj:true}).portletObj;if(this.className=='close_sure')_this.close();return false;}}else{this.eclose.onclick=function(e){var _this=fp(this,null,{portletObj:true}).portletObj;if(this.className=='close_sure')_this.close();return false;}}}else{this.eclose.className='';}
if(this.portal.layoutType==Portal.LAYOUT_TYPE_FREESTYLE){this.eframe.onclick=Portlet.goOnTop;this.eresize.onmousedown=Portlet.startResizeEvent;if(this.id=='new'){this.eresize.style.display='none';}else{this.eresize.style.display='';}}}else{if(this.portal.canEdit){this.eheader.onmousedown=Portlet.onmousedown;this.eheader.style.cursor='move';}else{this.eheader.style.cursor='';this.eheader.onmousedown='';}
if(this.eframe.getAttribute('hidden')=='1'){this.eframe.removeAttribute('hidden');this.eframe.style.display='none';}
this.eclose.onclick='';this.eclose.ondblclick='';this.estartedit.onclick='';this.eheader.ondblclick='';this.eframe.ondblclick='';(this.eframe.getAttribute('isempty'))&&(this.eframe.style.display='none');if(this.portal.layoutType==Portal.LAYOUT_TYPE_FREESTYLE){this.eframe.onclick=Portlet.goOnTop;this.eresize.onmousedown='';this.eresize.style.display='none';}}
this.eheader.oncontextmenu=function(e){var _this=fp(this,null,{portletObj:true}).portletObj;if(window._logReader){log(JSON.stringify({title:_this.title,id:_this.id,filter:_this.filter,menuId:_this.menuId,filtertype:_this.filtertype,style:_this.style,options:_this.options,checksum:_this.checksum,topTitle:_this.topTitle,expanded:_this.expanded,depend:_this.depend,dCount:_this.dCount,controller:_this.contentcontroller?_this.contentcontroller.toString():'NULL',jsHandler:_this.jsHandler,realxsl:_this.realxsl},true));return true;}else{PkgMan.load('YAHOO.widget.Logger',loggerInit)}}
if(this.id=='new'){this.highlight();}else{if(this.style&&this.style.hideHeader){this.eframe.onmouseover=this.highlight;this.eframe.onmouseout=this.lowlight;}else{this.eframe.onmouseover='';this.eframe.onmouseout='';}
this.eheader.onmouseover=this.highlight;this.eheader.onmouseout=this.lowlight;if(this.portal.layoutType!=Portal.LAYOUT_TYPE_FREESTYLE)this.eexpand.onclick=(this.expanded)?this.collapse:this.expand;}}
Portlet.prototype.getController=function(){var ctrl=this.contentcontroller||(this.depend&&this.portal.portlets[this.depend].contentcontroller);return ctrl;};Portlet.prototype.enableController=function(){if(!this.jsHandler||this.jsHandler=='none')return false;if(this._ctrlCallbackId||this.contentcontroller)return false;this.jsHandler=PkgMan.registerJsHandler(this.jsHandler);var f=function(){this._ctrlCallbackId=null;var ns=this.jsHandler.split('.');var o=window;for(var i=0;i<ns.length;i++)o=o[ns[i]];this.contentcontroller=new o(this,this.econtent);try{if(this.contentcontroller.setView){this.contentcontroller.setView();}}catch(e){if(window._logReader){log(JSON.stringify({error:e,'type':'activate'},true,3),'DBG','Portlet');}}
if(this.onControllerEnabled){this.onControllerEnabled(this,this.contentcontroller);}}.bind(this);this._ctrlCallbackId=PkgMan.load(this.jsHandler,f);};Portlet.prototype.enableContent=function()
{if(this.econtent.childNodes.length!=0){if(this.econtent.firstChild.tagName=='NOSCRIPT')return;}else{return;}
if(this.id=='new'){Dispatch.hookDisable(this.econtent);ImgFadeIn.hook(this.econtent,true);}else{if(!this._contentHooked){Dispatch.hook(this.econtent);ImgFadeIn.hook(this.econtent,!this.portal.isDisplay);this._contentHooked=1;}
this.enableController();}}
Portlet.prototype.disableContent=function()
{if(this._contentHooked){Dispatch.unHook(this.econtent);ImgFadeIn.unhook(this.econtent);this._contentHooked=0;}
this.disableController();}
Portlet.prototype.disableController=function(){if(this._ctrlCallbackId){PkgMan.removeOnloadCallback(this._ctrlCallbackId);this._ctrlCallbackId=null;}
if(this.contentcontroller){try{this.contentcontroller.deactivate&&this.contentcontroller.deactivate(this.econtent);}catch(e){if(window._logReader){log(JSON.stringify({error:e,'type':'deactivate'},true,3),'DBG','Portlet');}}
this.contentcontroller=null;}};Portlet.prototype.disableHeader=function()
{if(!this.eframe)return;this.eheader.onmouseover='';this.eheader.onmouseout='';this.eframe.onmouseover='';this.eframe.onmouseout='';this.eheader.onmousedown='';this.eheader.style.cursor='';this.eclose.ondblclick='';this.eclose.onclick='';this.eclose.ondblclick='';this.estartedit.onclick='';if(this.portal.layoutType==Portal.LAYOUT_TYPE_FREESTYLE){if(this.eresize)this.eresize.onmousedown='';this.eframe.onclick='';}
(function(a){a.onclick=null;}).apply2all(fc(this.eheader,'A'));}
Portlet.prototype.updatePrevNext=function(offset,limit)
{if(typeof limit=='undefined'){limit=parseInt(this.filter.limit);}else{limit=parseInt(limit);}
if(typeof offset=='undefined'){offset=(this.filter.offset)?parseInt(this.filter.offset):0;}else{offset=parseInt(offset);}
var link=fc(this.eprevnext,'A');var range=fc(this.eprevnext,'SPAN')
this.eprevnext.style.display='none';if(limit&&this.count){if(this.count==limit){link[0].setAttribute('offset',offset+limit);link[0].setAttribute('limit',limit)
link[0].style.display='block';this.eprevnext.style.display='block';}else{link[0].style.display='none';}
var from=1;if(offset&&offset>0){link[1].setAttribute('offset',(offset-limit>0)?(offset-limit):0);link[1].setAttribute('limit',limit)
link[1].style.display='block';this.eprevnext.style.display='block';from=offset+1;}else{link[1].style.display='none';}
var to=from+this.count-1;range[0].innerHTML=(from==to)?from:from+'-'+to;range[0].style.display='block';}else if(limit&&this.count===0){if(offset>0)this.eprevnext.style.display='block';link[0].style.display='none';}}
Portlet.prototype.editPortlet=function(e)
{var _this=(this.constructor==Portlet?this:fp(this,null,{portletObj:true}).portletObj);if(!_this.expanded){BubbleTooltip.show(getXY(_this.estartedit),'請在編輯設定前將內容方格展開',3000);YuEvent.stopEvent(YuEvent.getEvent(e));return false;}
PortalMenu.displayEditForm(_this.eedit,_this);_this.estartedit.innerHTML=Portlet.IMG_EDIT_ON;_this.estartedit.onclick=_this.closeEditPortlet;return false;}
Portlet.prototype.closeEditPortlet=function(nodelay)
{var _this=(this.constructor==Portlet?this:fp(this,null,{portletObj:true}).portletObj);if(_this.estartedit){PortalMenu.closeEditForm(_this.eedit,_this,nodelay);_this.estartedit.innerHTML=Portlet.IMG_EDIT;_this.estartedit.onclick=_this.editPortlet;}
return false;}
Portlet.prototype.resetWH=function()
{if(this.height){this.eframe.style.width=this.width+'px';this.eframe.style.height=this.height+'px';this.eportlet.style.width=this.width-(this.style&&this.style.hideFrame?0:Portlet.WIDTH_PADDING)+'px';this.eportlet.style.height=this.height-(this.style&&this.style.hideHeader?0:this.eheader.offsetHeight)-(this.style&&this.style.hideFrame?0:Portlet.HEIGHT_PADDING)+'px';}}
Portlet.stopResizeEvent=function(e)
{var _this=document.portletObj;if(_this&&_this.isDragging){_this.isDragging=false;_this.portal.isDragging=false;_this.eframe.id='';delete _this.tmpX;delete _this.tmpY;_this.width=parseInt(_this.dummy.style.width);_this.height=parseInt(_this.dummy.style.height);_this.resetWH();_this.portal.resetHeight();rn(_this.dummy);_this.dummy=null;document.portletObj=null;document._tmpHeight=null;document.onmousemove=null;document.onmouseup=null;Current.saveDesign();}
YuEvent.stopEvent(YuEvent.getEvent(e));return false;}
Portlet.prototype.deactivate=function()
{if(this.estartedit&&this.estartedit.onclick==this.closeEditPortlet){this.estartedit.onclick();}
if(!this.eframe)return;this.disableContent();this.disableHeader();Dispatch.unHook(this.eprevnext);if(this.eresize)rn(this.eresize);this.eresize=null;this.contentcontroller=null;this.eframe.portletObj=null;this.eframe=null;this.eportlet=null;this.eheader=null;this.eexpand=null;this.eclose=null;this.edrag=null;this.erefresh=null;this.estartedit=null;this.etitle=null;this.eedit=null;this.econtent=null;this.eprevnext=null;this.portal=null;for(var e in this.events){this.events[e].unsubscribeAll();}}
Portlet.prototype.highlight=function()
{var _this=(this.constructor==Portlet?this:fp(this,null,{portletObj:true}).portletObj);if(!_this.portal.isDragging&&!_this.highlighted){if(!(_this.style&&_this.style.hideHeader))_this.erefresh.style.display="block";if(_this.portal.isDesignMode){if(!(_this.options&Portlet.OPTION_FIXED))_this.eclose.style.display="block";_this.estartedit.style.display="block";if(_this.style&&_this.style.hideHeader)_this.edrag.style.display="block";}
_this.highlighted=true;}}
Portlet.prototype.lowlight=function()
{var _this=(this.constructor==Portlet?this:fp(this,null,{portletObj:true}).portletObj);if(_this.highlighted){_this.eclose.style.display="none";_this.erefresh.style.display="none";_this.estartedit.style.display="none";_this.edrag.style.display="none";_this.highlighted=false;}}
Portlet.prototype.setIcon=function()
{if(this.isRefreshing){this.eexpand.firstChild.setAttribute('src',Config.BASEPATH+'/portal/images/loading.gif');}else if(!this.height&&this.highlighted){this.eexpand.firstChild.setAttribute('src',Config.BASEPATH+'/portal/images/'+(this.expanded?'hideMod.gif':'showMod.gif'));}else{this.eexpand.firstChild.setAttribute('src',Config.BASEPATH+'/portal/images/'+(this.expanded?'hideMod.gif':'showMod.gif'));}}
Portlet.prototype.expand=function(nodelay)
{var _this=(this.constructor==Portlet?this:fp(this,null,{portletObj:true}).portletObj);if(!_this.expanded){if(!nodelay){var myHeight=new fx.Height(_this.eportlet,{duration:200});myHeight.expand();}else{_this.eportlet.style.height='';_this.eportlet.style.display='block';}
_this.eexpand.onclick=_this.collapse;_this.expanded=true;_this.setIcon();Current.saveDesign();}}
Portlet.prototype.collapse=function(nodelay)
{var _this=(this.constructor==Portlet?this:fp(this,null,{portletObj:true}).portletObj);if(_this.expanded&&!_this.height){if(!nodelay){var myHeight=new fx.Height(_this.eportlet,{duration:200});myHeight.custom(_this.eportlet.offsetHeight,0);}else{_this.eportlet.style.height='0px';_this.eportlet.style.display='none';}
_this.eexpand.onclick=_this.expand;_this.expanded=false;_this.setIcon();Current.saveDesign();}}
Portlet.prototype.closeAsk=function()
{var _this=this;this.eclose.className='close_sure';this.eclose.innerHTML=Portlet.IMG_CLOSE_SURE;setTimeout(function(){if(_this.eclose){_this.eclose.className='close_ask';_this.eclose.innerHTML=Portlet.IMG_CLOSE_ASK;}
_this=null;},5000);BubbleTooltip.show(getXY(this.eclose),'請按滑鼠兩次將內容方格移走',5000);}
Portlet.prototype.close=function(forced)
{this.closeEditPortlet(1);if(this.dCount>0){var dependents=this.portal.getDependentPortlets(this.id);var msg='這個內容方格是連繫到\n';var j=0;for(var i=0,e=dependents.length;i<e;i++){var portlet=this.portal.portlets[dependents[i]];if(portlet){msg+='- '+portlet.title+'\n';j++;}}
if(j){if(forced){msg+='手動移除以上方格';}else{msg+='如果您想移除這個內容方格, 請先將以上的方格移去!';}
alert(msg);dependents=null;i=null;if(!forced)return;}}
this.eclose.onclick=null;this.eclose.ondblclick=null;var msg=''+this.title+' 已刪除.';var portal=this.portal;if(this.id!='new'&&this.depend&&portal.portlets[this.depend]){msg+='這個內容方格是連繫到 '+portal.portlets[this.depend].title+'的';portal.portlets[this.depend].dCount--;}
var eframe=this.eframe;this.deactivate();eframe.style.display='none';rn(eframe);if(this.id!='new'){portal.removePortlet(this.id);MsgBar.addMsg(msg);Current.saveDesign();}
eframe=null;BubbleTooltip.hide();this.onClose.fire(this.id);this.onClose.unsubscribeAll();}
Portlet.prototype.startDrag=function(startPos,currPos)
{var port=this.eframe;this.portal.strCurrentLayout=this.portal.strCurrentLayout||JSON.stringify(this.portal.getNewLayout());this.lowlight();this.disableHeader();BubbleTooltip.hide();this.isDragging=true;this.portal.isDragging=true;this.closeEditPortlet(1);if(this.portal.layoutType==Portal.LAYOUT_TYPE_FREESTYLE){if(this.id=='new'){var pos=getXY(this.eframe);var x=pos.x;var y=pos.y;var pos=getXY(this.portal.etable);x-=pos.x;y-=pos.y;this.width=port.offsetWidth;this.height=port.offsetHeight;port.style.left=x+'px';port.style.top=y+'px';port.style.width=this.width+'px';this.column=this.portal.ecolumn[0];ac(this.column,port);}else{var x=parseInt(port.style.left)||0;var y=parseInt(port.style.top)||0;ac(port.parentNode,port);}
this.eresize.style.display='none';this.dragOffsetX=startPos.x-x;this.dragOffsetY=startPos.y-y;Element.replaceClassName(port,'portlet_new','dragging');var dummy=cex("div",{id:'freestyle_dummy'});dummy.style.left=x+'px';dummy.style.top=y+'px';dummy.style.width=this.width-2+'px';dummy.style.height=this.height-2+'px';ib(dummy,port);this.dummy=dummy;}else{if(this.portal.layoutType!=Portal.LAYOUT_TYPE_BAG){this.portal.showEditToolbar();}else{this.portal.showLayout();}
this.target=port;var pos;if(this.id=='new'){this.column=this.portal.ecolumn[0];var firstPort=fc2(this.column,1,null,/portlet|row/,1);if(firstPort){this.target=firstPort;pos=getXY(this.target);}else{this.target=null;pos=getXY(this.column.firstChild,6);}
firstPort=null;}else{pos=getXY(port);this.column=port.parentNode;}
this.dragOffsetX=startPos.x-currPos.x;this.dragOffsetY=startPos.y-currPos.y;var dummy=cex("div",{className:'portlet_dragging'});if(!(this.options&Portlet.OPTION_FIXED)){this.trash=cex("div",{className:'portal_trash',innerHTML:'垃圾箱'});ac(this.portal.eheader,this.trash);}
Element.replaceClassName(port,'portlet_new','portlet_freeze');ac(dummy);this.dummy=dummy;var colpos=getXY(this.column);this.dummy2=cex("div",{id:'drag_dummy',style:{width:this.column.offsetWidth+'px',left:colpos.x+'px',top:pos.y-5+'px'}});ac(this.dummy2);}
if(this.id=='new'){PortalMenu.detachDisplayPortlet(true);}
this.dragTo(currPos);}
Portlet.prototype.getDragToPortlet=function(mx,my)
{var ecolumns=this.portal.ecolumn;var ecolumn,pos;for(var i=0,e=ecolumns.length-1;;i++){ecolumn=ecolumns[i];pos=getXY(ecolumn);if(i==e)break;if(mx<pos.x+ecolumn.clientWidth)break;}
var ediv=ecolumn.firstChild;var divpos;while(ediv){divpos=getXY(ediv,3);if(my<divpos.y)break;ediv=ediv.nextSibling;}
return{column:i,ecolumn:ecolumn,ediv:ediv};}
Portlet.prototype.getDragToPortlet2=function(mx,my)
{var ecolumns=this.portal&&this.portal.ecolumn;var ecolumn,pos,objDragTo,objDragTo2;if(!this._colCorners){this._colCorners=[];for(var i=0;i<ecolumns.length;i++){this._colCorners[i]=getCorners(ecolumns[i]);}
this._portXY=[];}
if(this.trash){if(!this._trashCorners){this._trashCorners=getCorners(this.trash);}
var objCorner=this._trashCorners;if(mx>=objCorner.x&&mx<=objCorner.x2&&my>=objCorner.y&&my<=objCorner.y2){return{trash:true};}}
for(var i=0;i<ecolumns.length;i++){var objCorner=this._colCorners[i];if(mx>=objCorner.x&&mx<=objCorner.x2&&my>=objCorner.y&&my<=objCorner.y2){ecolumn=ecolumns[i];var divpos,divpos2,ediv;if(!this._portXY[i]){this._portXY[i]=[];for(var j=0,e=ecolumn.childNodes.length;j<e;j++){ediv=ecolumn.childNodes[j];this._portXY[i][j]=getCorners(ediv);}}
divpos2=this._portXY[i][0];for(var j=1,e=this._portXY[i].length;j<e;j++){divpos=this._portXY[i][j];if(my<divpos.ym)break;divpos2=divpos;}
objDragTo={ecolumn:ecolumn,ediv:ecolumn.childNodes[j],x:objCorner.x,y:divpos2.y2,w:objCorner.x2-objCorner.x};}
if(mx>=objCorner.x&&mx<=objCorner.x2){if(my>objCorner.y2&&(!objDragTo2||objDragTo2.y<objCorner.y2)){objDragTo2={ecolumn:ecolumns[i],ediv:null,y:objCorner.y2,x:objCorner.x,w:objCorner.x2-objCorner.x};}}}
return objDragTo||objDragTo2;}
Portlet.freeStyleDragTo=function(currPos)
{var mx=currPos.x;var my=currPos.y;var port=this.eframe;var left=(mx-this.dragOffsetX);var top=(my-this.dragOffsetY);port.style.left=left+'px';port.style.top=top+'px';this.dummy.style.left=left+'px';this.dummy.style.top=top+'px';if(top+this.height>this.portal.bottom){this.portal.bottom=top+this.height;this.portal.econtent.style.height=this.portal.bottom+'px';}}
Portlet.colDragTo=function(currPos)
{var mx=currPos.x;var my=currPos.y;this.dummy.style.left=mx+'px';this.dummy.style.top=my+'px';var target=this.getDragToPortlet2(mx,my);var dummy2=this.dummy2;if(!target)return;if(target.trash){this.trash.className='portal_trash inside_trash';dummy2.style.display='none';this.target=this.trash;return;}else if(this.trash){this.trash.className='portal_trash';dummy2.style.display='block';}
if(target.ecolumn!=this.column||target.ediv!=this.target){dummy2.style.left=target.x+'px';dummy2.style.top=target.y+'px';if(target.ecolumn!=this.column){this.column=target.ecolumn;dummy2.style.width=target.w+'px';}
this.target=target.ediv;}}
Portlet.bagDragTo=function(currPos)
{var mx=currPos.x;var my=currPos.y;var port=this.eframe;port.style.left=(mx-this.dragOffsetX)+'px';port.style.top=(my-this.dragOffsetY)+'px';var target=this.getDragToPortlet2(mx,my);var dummy=this.dummy;if(!target||target.ediv==dummy)return;if(target.ecolumn!=this.column||target.ediv!=this.target){if(target.ediv&&/EleEditToolbar/.test(target.ediv.className)){target.ediv=target.ediv.nextSibling;}
if(target.ediv){dummy.style.visibility='hidden';ib(dummy,target.ediv);}else{dummy.style.visibility='hidden';ac(target.ecolumn,dummy);}
if(target.ecolumn!=this.column){var column;column=this.column;column.style.width=column.offsetWidth>52?'':'50px';column.style.height=column.offsetHeight>52?'':'50px';this.column=target.ecolumn;this.dragOffsetX=dummy.offsetWidth/port.offsetWidth*this.dragOffsetX;port.style.width=dummy.offsetWidth+'px';port.style.left=(mx-this.dragOffsetX)+'px';dummy.style.height=port.offsetHeight-2+'px';column=target.ecolumn;column.style.width=column.offsetWidth>52?'':'50px';column.style.height=column.offsetHeight>52?'':'50px';column=null;}
this.dummy=dummy;this.target=target.ediv;dummy.style.visibility='visible';}}
Portlet.prototype.stopDrag=function()
{var trashed=this.trash&&this.target==this.trash;if(!trashed&&(this.id=='new')){this.portal.addPortlet(this);this.enableContent();this.eclose.className='close_ask';}
if(this.portal.layoutType==Portal.LAYOUT_TYPE_FREESTYLE){this.eresize.style.display='';this.left=parseInt(this.dummy.offsetLeft);this.top=parseInt(this.dummy.offsetTop);this.eframe.style.left=this.left+'px';this.eframe.style.top=this.top+'px';setTimeout(function(){this.isDragging=false;this.portal.isDragging=false;}.bind(this),100);Element.replaceClassName(this.eframe,'dragging','');rn(this.dummy);this.dummy=null;this.portal.resetHeight();Current.saveDesign();this.enableHeader();}else{rn(this.dummy);this.dummy=null;if(!trashed){if(this.target){ib(this.eframe,this.target);}else{ac(this.column,this.eframe);}
Element.replaceClassName(this.eframe,'portlet_freeze','');this.enableHeader();Current.saveDesign();}
delete this._portXY;delete this._colCorners;delete this._trashCorners;rn(this.dummy2);this.dummy2=null;}
this.isDragging=false;this.portal.isDragging=false;this.target=null;this.column=null;this.portal.hideLayout();if(this.trash){rn(this.trash);this.trash=null;}
if(trashed){this.close();}}
Portlet.onmousedown=function(e)
{e=YuEvent.getEvent(e);var _this=fp(this,null,{portletObj:true}).portletObj;if(!_this.isDragging){document.onmousemove=Portlet.startDragEvent;document.portletObj=_this;document.startPos=getEvtXY(e);document.onmouseup=function(){document.onmousemove='';document.onmouseup='';document.portletObj=null;document.startPos=null;};if(_this.portal.layoutType==Portal.LAYOUT_TYPE_FREESTYLE){Portlet.goOnTop.call(_this.eframe);}}
YuEvent.stopEvent(e);_this=null;e=null;return false;}
Portlet.nomousedown=function(e)
{e=YuEvent.getEvent(e);YuEvent.stopEvent(e);return false;}
Portlet.startDragEvent=function(e)
{e=YuEvent.getEvent(e);if(Current.inDesignMode){var _this=document.portletObj;if(!_this.isDragging){var pos=getEvtXY(e);switch(_this.portal.layoutType){case Portal.LAYOUT_TYPE_COLUMN:_this.dragTo=Portlet.colDragTo;break;case Portal.LAYOUT_TYPE_FREESTYLE:_this.dragTo=Portlet.freeStyleDragTo;break;case Portal.LAYOUT_TYPE_BAG:_this.dragTo=Portlet.bagDragTo;break;default:throw new Error('Invalid layout type');}
_this.startDrag(document.startPos,pos);document.startPos=null;document.onmouseup=Portlet.stopDragEvent;document.onmousemove=Portlet.dragToEvent;}}else{document.onmouseup=Portlet.stopDragEvent;}
YuEvent.stopEvent(e);return false;}
Portlet.stopDragEvent=function(e)
{e=YuEvent.getEvent(e);if(!Current.inDesignMode){document.onmouseup='';document.onmousemove='';var pos=getEvtXY(e);if(Math.abs(document.startPos.x-pos.x)>10||Math.abs(document.startPos.y-pos.y)>10){if(confirm('您是否要開始版面設計?')){Current.swDesignMode(true);}}else{return true;}}else{var _this=document.portletObj;if(_this.isDragging){var pos=getEvtXY(e);_this.dragTo(pos);_this.dragTo=null;_this.stopDrag();}
document.portletObj=null;document.onmousemove='';document.onmouseup='';}
YuEvent.stopEvent(e);return false;}
Portlet.dragToEvent=function(e)
{var _this=document.portletObj;e=YuEvent.getEvent(e);if(_this.isDragging){var pos=getEvtXY(e);var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;var docHeight=document.documentElement.offsetHeight;if(pos.y-scrollTop>docHeight-100){window.scrollBy(0,100-docHeight+pos.y-scrollTop);}else if(pos.y-scrollTop<100){window.scrollBy(0,-(100-pos.y+scrollTop)/2);}
_this.dragTo(pos);}
YuEvent.stopEvent(e);_this=null;e=null;return false;}
Portlet.goOnTop=function()
{var _this=this.portletObj;if(_this.isDragging||_this.portal.isDragging)return false;if(_this.portal.portletOnTop!=_this.id){ac(this.parentNode,this);_this.portal.portletOnTop=_this.id;if(_this.portal.isDesignMode)Current.saveDesign();}}
Portlet.startResizeEvent=function(e)
{var _this=fp(this,null,{portletObj:true}).portletObj;e=YuEvent.getEvent(e);if(!_this.isDragging){_this.isDragging=true;_this.portal.isDragging=true;var pos=getEvtXY(e);_this.tmpX=pos.x;_this.tmpY=pos.y;document.portletObj=_this;document._tmpHeight=_this.style&&_this.style.hideHeader?0:_this.eheader.offsetHeight;document.onmousemove=Portlet.resizeEvent;document.onmouseup=Portlet.stopResizeEvent;ac(_this.eframe.parentNode,_this.eframe);var dummy=cex("div",{id:'freestyle_dummy'});dummy.style.left=_this.left+'px';dummy.style.top=_this.top+'px';dummy.style.width=_this.width+'px';dummy.style.height=_this.height+'px';ib(dummy,_this.eframe);_this.dummy=dummy;}
YuEvent.stopEvent(e);return false;}
Portlet.resizeEvent=function(e)
{e=YuEvent.getEvent(e);var _this=document.portletObj;if(_this&&_this.isDragging){var pos=getEvtXY(e);var width=_this.width+=pos.x-_this.tmpX;_this.tmpX=pos.x;var height=_this.height+=pos.y-_this.tmpY;_this.tmpY=pos.y;_this.width=(width>Portlet.MIN_WIDTH)?width:Portlet.MIN_WIDTH;_this.height=(height>Portlet.MIN_HEIGHT+document._tmpHeight)?height:Portlet.MIN_HEIGHT+document._tmpHeight;_this.dummy.style.width=_this.width+'px';_this.dummy.style.height=_this.height+'px';if(_this.top+height>_this.portal.bottom){_this.portal.bottom=_this.top+height;_this.portal.econtent.style.height=_this.portal.bottom+'px';}}
YuEvent.stopEvent(e);return false;}
Portlet.prototype.refresh=function(options)
{options=(arguments.length==1)?options:{};if(options.forced){var filter=this.filter;}else if(typeof options.offset!='undefined'||typeof options.limit!='undefined'){var filter=clone(this.filter);filter.limit=options.limit||filter.limit;filter.offset=options.offset||filter.offset;}else if(typeof this.lastLimit!='undefined'){var filter=clone(this.filter);options.limit=filter.limit=this.lastLimit;options.offset=filter.offset=this.lastOffset;}else{var filter=this.filter;}
var ajx=new AjxAction('portal','getPortletHtml');ajx.set('url',this.portal.url);ajx.set("portlet",JSON.stringify({filter:filter,xsl:this.xsl,menuId:this.menuId}));if(this.depend){var dependPortlet=this.portal.portlets[this.depend];ajx.set("dependPortlet",JSON.stringify({filter:dependPortlet.filter,menuId:dependPortlet.menuId}));}
ajx.setCallback(new AjxCallback(this,this._refreshCallback,[options]));ajx.fire();this.isRefreshing=true;this.setIcon();return false;}
Portlet.prototype.addMsg=function(str)
{var msg=cex('div',{innerHTML:str,className:'updated'});ib(msg,this.econtent);setTimeout((function(){if(this&&this.className=='updated')rn(this);}).bind(msg),5000);}
Portlet.prototype.scrollIntoView=function(highlight)
{var scroll=new fx.ScrollIntoView(this.eframe,{padding:50,duration:400,onComplete:highlight?function(){var animation={func:fx.Opacity,options:{duration:1000},params:[1,0]};Iqube.Util.Highlight.highlight(this.el,{width:5,animation:animation});}:null});scroll.start();scroll=null;}
Portlet.prototype._refreshCallback=function(result,args)
{if(this.econtent){var options=args[0];var resp=result.getResponse();this.isRefreshing=false;this.setIcon();if(!resp.isException){if(typeof resp.passBack!='undefined'&&resp.passBack!=null){this.passBack=resp.passBack;if(options.onPassBack)options.onPassBack(this,true);}else{if(options.onPassBack)options.onPassBack(this,false);}
if(typeof options.offset!='undefined'&&typeof options.limit!='undefined'&&(options.offset!=this.lastOffset)){if(resp.count===0){this.addMsg('完結');this.updateTitleStyle();this.count=resp.count;this.updatePrevNext(options.offset,options.limit);return;}
this.updateHtml(resp.html,resp.checksum,{animation:true});}else{this.updateHtml(resp.html,resp.checksum);}
this.updateTitleStyle();if(!this.isPopup&&resp.topTitle){gPortalC.handlers[this.portal.url].reset(resp.topTitle);}
if(typeof resp.count!='undefined'){if(typeof options.offset!='undefined'&&typeof options.limit!='undefined'){this.lastLimit=options.limit;this.lastOffset=options.offset;}else{this.lastLimit=this.filter.limit;this.lastOffset=this.filter.offset;}
this.count=resp.count;this.updatePrevNext(options.offset,options.limit);}
if(options.scrollIntoView)this.scrollIntoView(false);}else{this.addMsg('刷新內容方格失敗! 請稍後再試.');}}
options=null;result=null;resp=null;args=null;}
Portlet.prototype.updateHtml=function(html,checksum,options)
{this.disableContent();if(html!=''&&options&&options.animation&&!this.isInner){var myReplace=new fx.Replace(this.econtent,{duration:300,onComplete:function(){var _this=fp(this.el,null,{portletObj:true}).portletObj;_this.enableContent();if(_this.onPortletRefresh){_this.onPortletRefresh();}}});myReplace.replace(html);myReplace=null;}else{if(html==''){this.eframe.style.display='none';}else{this.econtent.innerHTML=html;this.eframe.style.display='block';}
if(options&&options.msg)this.addMsg(options.msg);this.enableContent();if(this.onPortletRefresh){this.onPortletRefresh();}}
this.checksum=checksum;html=null;checksum=null;options=null;}
var STATUS_SYSDESIGNER=50;var PortalMenu={menuItems:{},portalMenus:[],defaultIconHtml:'<img src="'+Config.BASEPATH+'/portal/images/defaulticon.gif" align="absmiddle" />',folderIconHtml:'<img src="'+Config.BASEPATH+'/portal/images/folder.gif" align="absmiddle" />',portlet:false,advance:false,showMini:false,init:function(){},deactivate:function(){if(this.portlet&&this.portlet.eframe){this.portlet.deactivate();this.portlet=null;}
if(this.el_addFrame){var button=fc(this.el_addFrame,'button',null,null,true);if(button)button.onclick=null;ClickHandler.removeListener(this.el_addFrame);rn(this.el_addFrame);this.el_addFrame=null;}},getDefaultFilter:function(filter,expandos){var selectorExist=false;var f=function(obj,i){if(!obj[i])return;if(typeof obj[i]=='string'){if(expandos&&expandos[i]){obj[i]=expandos[i];}else{var getSelector=obj[i].match(/^##\s*(.+)\((.*)\)\s*,(.*)##$/);if(getSelector!==null){selectorExist=true;eval('obj[i] = '+getSelector[3])+';';}}}else{for(var j in obj[i]){f(obj[i],j);}}}
for(var i in filter){f(filter,i);}
return{filter:filter,selectorExist:selectorExist};},deactivatePortalMenu:function(el)
{(function(a){var b=a.firstChild;if(b){b.onclick=null;Tooltip.unhookThis(b,'mouseover','mouseout');}}).apply2all(fc(el,'div',null,'itemLI'));var portal=gPortalC.portals[Current.url];portal&&(portal.events['remove_portlet'].unsubscribe(PortalMenu.refreshSimpleMenu));},displayPortalMenu:function(element,headerId){var portalMenu=PortalMenu.portalMenus[[headerId,gPortalC.groupid,Current.isAdvancedEdit].join(',')];if(portalMenu){PortalMenu.advance=portalMenu.advance;if(this.showMini)this.showMiniPortal();if(!portalMenu.advance)return this.displaySimpleMenu(element,headerId);var html=[];html[html.length]='<div class="leftpane"><div class="title" menuId="'+headerId+'">'+portalMenu['title']+'</div>';html[html.length]='<div class="itemUL">';var menuItems=portalMenu['menuItems'];for(var i=0,e=menuItems.length;i<e;i++){html[html.length]='<div class="itemLI">';var id=menuItems[i]['id'];if(id>0){html[html.length]='<div class="menuItem" menuId="'+id+'">';var iconHtml=PortalMenu.defaultIconHtml;if(menuItems[i]['ico']){iconHtml='<img src="'+Config.PORTLETICONPATH+menuItems[i]['ico']+'" align="absmiddle" />';}
html[html.length]=iconHtml;html[html.length]='<div class="text">'+menuItems[i]['title']+'</div></div>';}else if(id<0){html[html.length]='<div class="menuHeader" menuId="'+id+'">'+PortalMenu.folderIconHtml+'<div class="text">'+menuItems[i]['title']+'</div></div>';}else{html[html.length]='<div class="separator">'+(menuItems[i]['title']||'')+'</div>';}
html[html.length]='</div>';}
html[html.length]='</div></div><div class="rightpane"></div>';PortalMenu.deactivatePortalMenu(element);element.innerHTML=html.join('');html=null;var arrItemLI=fc(element,'div',null,'itemLI');for(var i=0,e=arrItemLI.length;i<e;i++){var item=arrItemLI[i].firstChild;item.seq=i;switch(item.className){case'menuItem':item.onclick=function(e){e=YuEvent.getEvent(e);var itemUL=fp(this,'div',null,'itemUL');var current=itemUL.current;if(typeof current!='undefined')Element.replaceClassName(itemUL.childNodes[current],'selected','');Element.replaceClassName(this.parentNode,'','selected');itemUL.current=this.seq;PortalMenu.displayPortlet(this.parentNode,this.getAttribute("menuId"));fp(this,'div',null,'leftpane').nextSibling.innerHTML='';YuEvent.stopEvent(e);return false;};break;case'menuHeader':item.onclick=function(e){e=YuEvent.getEvent(e);var itemUL=fp(this,'div',null,'itemUL');var current=itemUL.current;if(typeof current!='undefined')Element.replaceClassName(itemUL.childNodes[current],'selected','')
Element.replaceClassName(this.parentNode,'','selected');itemUL.current=this.seq;PortalMenu.displayPortalMenu(fp(this,'div',null,'leftpane').nextSibling,-this.getAttribute("menuId"));return false;}
break;default:break;}
item.setAttribute('tooltip',menuItems[i]['info']||menuItems[i]['title']);Tooltip.hookThis(item,'mouseover','mouseout');}
item=null;menuItems=null;arrItemLI=null;element=null;}else{PortalMenu.deactivatePortalMenu(element);element.innerHTML='<div class="showMenu"></div><img src="'+Config.BASEPATH+'/portal/images/loading.gif" />';element.style.display='block';var ajx=new AjxAction('portal','getPortalMenu');ajx.set("headerId",headerId);ajx.set("groupid",gPortalC.groupid);ajx.set("advance",Current.isAdvancedEdit);var getAll=1;ajx.set("getAll",getAll);ajx.setCallback(new AjxCallback(PortalMenu,PortalMenu._displayPortalMenuCallback,[element,headerId,getAll]));ajx.fire();}},hideMiniPortal:function()
{if(MiniPortal.isActivated){if(MiniPortal.eportal){var miniportal=MiniPortal.eportal;(function(a){a.onmousedown=null;}).apply2all(fc(miniportal,'div',null,'miniportlet'));rn(miniportal);}
MiniPortal.deactivate();}},showMiniPortal:function(linkToReal)
{if(MiniPortal.eportal)return;var portal=gPortalC.portals[Current.url];var miniportal=cex('div',{className:'miniportal',style:{width:'350px',fontSize:'9px',position:'absolute',top:'300px',left:'300px',zIndex:5}});ac(miniportal);MiniPortal.eportal=miniportal;MiniPortal.ecolumn=[];MiniPortlet.postStartDrag=function(ediv){MiniPortlet.trash=cex("div",{className:'portal_trash',innerHTML:'垃圾箱'});ac(MiniPortlet.portal.eportal,MiniPortlet.trash);if(PortalMenu.portlet){Element.replaceClassName(ediv,'portlet_new','');ediv.title=PortalMenu.portlet.title;PortalMenu.detachDisplayPortlet(true);}};MiniPortlet.postStopDrag=function(ediv,etarget,ecolumn,trashed){var portal=gPortalC.portals[Current.url];if(ediv.portlet_id=='new'){if(trashed)return;var menuItem=PortalMenu.menuItems[ediv.menuId];var portlet=PortalMenu.createPortlet(menuItem,portal);portlet.title=menuItem.title;var eframe=portlet.buildPortletFrameDOM(document.body);portal.addPortlet(portlet);ediv.portlet_id=portlet.id;portlet.activate(eframe);portlet.refresh();}else{var portlet=portal.portlets[ediv.portlet_id];}
if(trashed){portlet.close();}else{if(etarget){var targetRow=MiniPortal.findPath(portal.etable,etarget.path);targetRow&&ib(portlet.eframe,targetRow);}else{var targetColumn=MiniPortal.findPath(portal.etable,ecolumn.path);targetColumn&&ac(targetColumn,portlet.eframe);}}
if(MiniPortlet.trash)rn(MiniPortlet.trash);MiniPortlet.trash=null;MiniPortal.resetPath(MiniPortal.eportal);Current.saveDesign();};MiniPortlet.preStopDrag=function(ediv,etarget,ecolumn,trashed){var portal=gPortalC.portals[Current.url];if(ediv.portlet_id=='new'){if(ediv.portletObj){var portlet=ediv.portletObj;if(!trashed){portal.addPortlet(portlet);portlet.enableContent();portlet.eclose.className='close_ask';portlet.enableHeader();ediv.portlet_id=portlet.id;}else{portlet.close();}}
if(trashed)return null;ediv=cex('div',{className:'miniportlet',innerHTML:'<div class="miniportlet_content">'+ediv.title+'</div>',menuId:ediv.menuId,portlet_id:ediv.portlet_id,style:{textAlign:'center',border:'1px solid #444',cursor:'move'}});ediv.onmousedown=MiniPortlet.onmousedown;}
return ediv;};for(var i in portal.layout){MiniPortal.buildRow(miniportal,portal.layout[i],portal.portlets,MiniPortal.ecolumn,{events:{onmousedown:MiniPortlet.onmousedown}});}
MiniPortal.resetPath(miniportal);MiniPortal.activate(miniportal);miniportal=null;portal=null;},refreshSimpleMenu:function(etype,args,etable){if(etype=='remove_portlet'){var ediv=fc(etable,'td',{menuId:args[0].menuId},null,true);if(ediv){var block=fc(ediv,'div',{name:'simpleblock'},0,true);block&&YuDom.setStyle(block,'opacity',1);var button=fc(ediv,'button',0,0,true);button&&(button.innerHTML='增加')&&(button.disabled=0);ediv=block=button=null;}}},displaySimpleMenu:function(element,headerId){var portalMenu=PortalMenu.portalMenus[[headerId,gPortalC.groupid,Current.isAdvancedEdit].join(',')];if(portalMenu){this.deactivatePortalMenu(element);element.innerHTML='';var menuItems=portalMenu['menuItems'];var width=menuItems.length*270;var fullpane=cex('div',{className:'fullpane',style:{width:'100%',overflowX:'auto',overflowY:'hidden',height:'160px'}});var slidepane=cex('div',{className:'slidepane',style:{height:'140px'}});ac(element,ac(fullpane,slidepane));var etable=cex('table',{className:'',cellSpacing:'2px',style:{height:'140px',tableLayout:''}});var etbody=ce('tbody');var erow=ce('tr');at([slidepane,[etable,[etbody,erow]]]);var portal=gPortalC.portals[Current.url];for(var i=0,e=menuItems.length;i<e;i++){var menuItem=menuItems[i];var iconsrc=menuItem.ico?Config.PORTLETICONPATH+menuItem.ico:Config.BASEPATH+'/portal/images/defaulticon.gif';var block=cex('td',{innerHTML:['<div style="width: 140px;height:100px;margin: 5px; border: 1px solid #888;text-align:left;" name="simpleblock">','<div style="background: #888; padding: 2px;overflow: hidden; white-space: nowrap;width:136px;text-overflow: ellipsis;">','<img align="absmiddle" src="',iconsrc,'"/><span style="font-weight: bold; margin-left: 2px;">',menuItem.title,'</span></div><div style="margin: 10px 0pt 5px; padding: 3px;">',menuItem.info,'</div></div>'].join(''),className:'button-group',align:'center',vAlign:'top',width:'150px'});ac(erow,block);if(portal.getPortletByMenuId(menuItem.id)){YuDom.setStyle(block.firstChild,'opacity',0.5);var button=cex('button',{innerHTML:'In Use',disabled:true});}else{var button=cex('button',{innerHTML:'+ 增加'});}
ac(block,button);button.onclick=this.addPortletEvent;block.menuId=menuItem.id;block.portlet_id='new';block.title=menuItem.title;if(MiniPortal.isActivated){block.onmousedown=MiniPortlet.onmousedown;block.style.cursor='move';}}
portal.events['remove_portlet'].subscribe(PortalMenu.refreshSimpleMenu,etable)
element=etable=etbody=erow=fullpane=slidepane=button=block=null;}},_displayPortalMenuCallback:function(result,args){var element=args[0];var headerId=args[1];var getAll=args[2];var resp=result.getResponse();if(!resp.isException){if(resp.menu){PortalMenu.portalMenus[[headerId,gPortalC.groupid,Current.isAdvancedEdit].join(',')]=resp.menu;if(getAll){var menuItems=resp.menu.menuItems;for(var i=0,e=menuItems.length;i<e;i++){PortalMenu.menuItems[menuItems[i]['id']]=menuItems[i];}}
PortalMenu.displayPortalMenu(element,headerId);return;}}
element.innerHTML='不能提供菜單';},closeEditForm:function(element,portletOrPortal,nodelay){var inputs=element.getElementsByTagName('INPUT');for(var i=0,e=inputs.length;i<e;i++){inputs[i].onclick='';}
inputs=null;if(portletOrPortal.m_selectorForms){for(var i=0;i<portletOrPortal.m_selectorForms.length;i++){if(portletOrPortal.m_selectorForms[i].deactivate){portletOrPortal.m_selectorForms[i].deactivate();}}
portletOrPortal.m_selectorForms=null;}
element.style.display="none";element.innerHTML='';if(portletOrPortal.backup){if(portletOrPortal.backup.unsaved&&(portletOrPortal.id!='new')){portletOrPortal.title=portletOrPortal.backup.title;portletOrPortal.style=clone(portletOrPortal.backup.style);portletOrPortal.filter=clone(portletOrPortal.backup.filter);portletOrPortal.refresh();}else if(portletOrPortal.id!='new'&&portletOrPortal.style){portletOrPortal.style=clone(portletOrPortal.backup.style);portletOrPortal.updateTitleStyle();}
portletOrPortal.backup.filter=null;portletOrPortal.backup=null;delete portletOrPortal.backup;}
element.style.zIndex='';},closeEditForm2:function(element,portletOrPortal,save){if(save){var submitbtns=fc(element,'input',{'type':'submit'});submitbtns[0].onclick();submitBtns=null;}
var inputs=element.getElementsByTagName('INPUT');for(var i=0,e=inputs.length;i<e;i++){inputs[i].onclick='';}
inputs=null;if(portletOrPortal.m_selectorForms){for(var i=0;i<portletOrPortal.m_selectorForms.length;i++){if(portletOrPortal.m_selectorForms[i].deactivate){portletOrPortal.m_selectorForms[i].deactivate();}}
portletOrPortal.m_selectorForms=null;}
element.style.display="none";element.innerHTML='';element.style.zIndex='';},makeExportUrls:function(portlet)
{if(Alias.status>=STATUS_SYSDESIGNER){if(!portletFilterComponent){var portletFilterComponent=encodeURIComponent(JSON.stringify({filter:portlet.filter,menuId:portlet.menuId}));var portletUrlComponent=encodeURIComponent(portlet.portal.url);}
if(portlet.depend){var dependPortlet=portlet.portal.portlets[portlet.depend];var dependFilterComponent=encodeURIComponent(JSON.stringify({filter:dependPortlet.filter,menuId:dependPortlet.menuId}));}
var xmlExportUrl=Config.HOMESITE+'/exportXml.php?url='+portletUrlComponent+'&portlet='+portletFilterComponent;if(dependFilterComponent)xmlExportUrl+='&depend='+dependFilterComponent;var xslExportUrl=Config.HOMESITE+'/exportXsl.php?url='+portletUrlComponent+'&portlet='+encodeURIComponent(JSON.stringify({menuId:portlet.menuId}));}
return{xmlExportUrl:xmlExportUrl||'',xslExportUrl:xslExportUrl}||'';},displayEditForm:function(element,portlet){var menuItem=PortalMenu.menuItems[portlet.menuId];if(menuItem){var selectorForms=[];portlet.m_selectorForms=selectorForms;var titleSelector,length=0;portlet.backup={unsaved:false,title:portlet.title,style:clone(portlet.style),filter:clone(portlet.filter)};selectorForms[selectorForms.length]=Selector['inputText']('title',{title:'標題'},portlet);selectorForms[selectorForms.length]=Selector['selectStyle']('style',{title:'樣式'},portlet);for(var i in menuItem.filter){this.buildSelectorForms(menuItem.filter,portlet.filter,i,selectorForms);}
var editForm=[];if(menuItem['ico']){var iconHtml='<img src="'+Config.PORTLETICONPATH+menuItem['ico']+'" align="absmiddle" />';}else{var iconHtml='';}
if(menuItem['info']){editForm[editForm.length]='<div class="portletinfo"><div class="title">'+menuItem['title']+'</div><div class="instruction">'+menuItem['info']+'</div></div>';}
if(Alias.status>=STATUS_SYSDESIGNER){var exportUrls=this.makeExportUrls(portlet);editForm[editForm.length]='&nbsp;&nbsp;<a href="'+exportUrls.xmlExportUrl+'" target="_blank">Export Xml</a><br />';editForm[editForm.length]='&nbsp;&nbsp;<a href="'+exportUrls.xslExportUrl+'" target="_blank">Export Default Xsl</a><br />';}
editForm[editForm.length]='<hr />';editForm[editForm.length]='<table cellpadding="0" cellspacing="1" width="100%" border="0">';var length=selectorForms.length;var i=length;do{editForm[editForm.length]=selectorForms[length-i].html;if(selectorForms[length-i].$options&&selectorForms[length-i].$options.help){editForm[editForm.length]='<tr><td></td><td class="instruction">'+selectorForms[length-i].$options.help+'</td></tr>';}else{editForm[editForm.length]='<tr></tr>';}}while(--i);var saveBtn=Current.autosave?'儲存':'使用';editForm[editForm.length]='<tr><td width="0"></td><td width="100%"></td></tr><tr>'+'<td colspan="2" align="right"><input type="submit" value="預覽" />&nbsp;<input type="submit" value="'+saveBtn+'" /></td>'+'</tr></table>';element.innerHTML=editForm.join('');element.style.display='block';function _allSubmit(){var i=length;var tmp,topTitle='';do{tmp=selectorForms[length-i].submit();if(tmp)topTitle=tmp;}while(--i);return topTitle;};function _allReset(){var i=length;do{if(selectorForms[length-i].reset)selectorForms[length-i].reset();}while(--i);}
function preview(){var tmp=_allSubmit();if(tmp){portlet.title=tmp;}
_allReset();delete portlet.lastOffset;delete portlet.lastLimit;if(passBackHandler){portlet.refresh({onPassBack:function(){passBackHandler.apply(this,arguments);_allReset();},forced:1});}else{portlet.refresh();}
portlet.backup.unsaved=true;return false;}
function save(){_allSubmit();delete portlet.lastOffset;delete portlet.lastLimit;portlet.unsaved=true;portlet.backup.filter=null;portlet.backup=null;delete portlet.backup;if(passBackHandler){portlet.refresh({onPassBack:function(){passBackHandler.apply(this,arguments);Current.saveDesign();}});}else{portlet.refresh();Current.saveDesign();}
portlet.closeEditPortlet();return false;};var passBackHandler;if(menuItem.passBackHandler){eval("passBackHandler = PassBackHandlers."+menuItem.passBackHandler+';')}
var el_table=fc(element,'table',null,null,true);var i=length;do{if(selectorForms[length-i].activate){selectorForms[length-i].activate(el_table.firstChild.childNodes[(length-i)*2],preview);}
if(i%2){el_table.firstChild.childNodes[(length-i)*2].style.background='#ccc';}}while(--i);var submitbtns=fc(el_table,'input',{'type':'submit'});submitbtns[0].onclick=preview;submitbtns[1].onclick=save;submitbtns=null;el_table=null;trs=null;return element;}else{element.innerHTML='<img src="'+Config.BASEPATH+'/portal/images/loading.gif" />';element.style.display="block";PortalMenu.onMenuItemReady(portlet.menuId,portlet.portal.groupid,PortalMenu.displayEditForm,[element,portlet]);}},buildSelectorForms:function(menuObj,filterObj,i,selectorForms)
{if(!menuObj[i])return;if(typeof menuObj[i]=='string'){var getSelector=menuObj[i].match(/^##\s*(.+?)\((.*)\)\s*,(.*)##$/);if(getSelector===null){return;}
if(Selector[getSelector[1]]){if(getSelector[2]==''){var tempobj=null;}else{var tempobj=JSON.parse(getSelector[2]);}
selectorForms[selectorForms.length++]=Selector[getSelector[1]](i,tempobj,filterObj);selectorForms[selectorForms.length-1].$options=tempobj;}}else{for(var j in menuObj[i]){this.buildSelectorForms(menuObj[i],filterObj[i],j,selectorForms);}}},displayEditForm2:function(element,portlet){var menuItem=PortalMenu.menuItems[portlet.menuId];if(menuItem){var selectorForms=[];portlet.m_selectorForms=selectorForms;var titleSelector;selectorForms[selectorForms.length]=Selector['inputText']('title',{title:'標題'},portlet);for(var i in menuItem.filter){this.buildSelectorForms(menuItem.filter,portlet.filter,i,selectorForms);}
var editForm=[];editForm[editForm.length]='<h3 class="title">'+menuItem.title+'<span class="instruction">編輯設定</span></h3>';editForm[editForm.length]='<table cellpadding="0" cellspacing="1" width="100%" border="0">';var length=selectorForms.length;var i=length;while(i){editForm[editForm.length]=selectorForms[length-i].html;if(selectorForms[length-i].$options&&selectorForms[length-i].$options.help){editForm[editForm.length]='<tr><td></td><td class="instruction">'+selectorForms[length-i].$options.help+'</td></tr>';}else{editForm[editForm.length]='<tr></tr>';}
i--;}
editForm[editForm.length]='<tr><td width="0"></td><td width="100%"></td></tr><tr>'+'<td colspan="2" align="right"><input type="submit" value="使用" /></td>'+'</tr></table>';element.innerHTML=editForm.join('');element.style.display='block';function _allSubmit(){var i=length;var tmp,topTitle='';while(i){tmp=selectorForms[length-i].submit();if(tmp)topTitle=tmp;i--;}
return topTitle;};function _allReset(){var i=length;while(i){if(selectorForms[length-i].reset)selectorForms[length-i].reset();i--;}};function save(){_allSubmit();portlet.refresh();return false;};var el_table=fc(element,'table',null,null,true);var i=length;while(i){if(selectorForms[length-i].activate){selectorForms[length-i].activate(el_table.firstChild.childNodes[(length-i)*2]);}
if(i%2){el_table.firstChild.childNodes[(length-i)*2].style.background='#ccc';}
i--;}
var submitbtns=fc(el_table,'input',{'type':'submit'});submitbtns[0].onclick=save;submitbtns=null;el_table=null;trs=null;return element;}else{element.innerHTML='<img src="'+Config.BASEPATH+'/portal/images/loading.gif" />';element.style.display="block";PortalMenu.onMenuItemReady(portlet.menuId,portlet.portal.groupid,PortalMenu.displayEditForm2,[element,portlet]);}},displayPortalEditForm:function(element,portal){if(Current.urlProcess.view!='portal')return;if(Current.urlProcess.scope!='home'||Alias.status<STATUS_SYSDESIGNER||portal.readPermList){if(!portal.oldTitle){portal.oldTitle=portal.title;}
var selectorForms=[];var length=0;selectorForms[length++]=Selector['inputText']('title',{title:'URL 用的名稱'},portal);selectorForms[length++]=Selector['inputText']('textOnTab',{title:'顯示標題'},portal);if(Alias.status>=STATUS_SYSDESIGNER){selectorForms[length++]=Selector['selectMobLayout']('mobLayout',{portlets:portal.portlets},portal);if(Current.urlProcess.scope=='home'){selectorForms[length++]=Selector['selectPermission2']('readPermList',portal.permSelectorInput,portal);}}
var editForm='<form><table width="100%" cellpadding="0" cellspacing="0" class="formTable">';var i=length;do{editForm+=selectorForms[length-i].html;}while(--i);var saveBtn=Current.autosave?'儲存':'使用';editForm+='<tr>'+'<td colSpan="2" align="center">'+'<table><tr>'+'<td><input type="submit" value="'+saveBtn+'" /></td>'+'<td><input type="submit" value="取消" /></td>'+'</tr></table>'+'</td>'+'</tr>';editForm+='</table></form>';element.innerHTML=editForm;element.style.display='block';editForm=null;var el_table=fc(element,'table',null,null,true);var i=length;do{if(selectorForms[length-i].activate){selectorForms[length-i].activate(el_table.firstChild.childNodes[length-i]);}}while(--i);function _allSubmit(){var i=length;do{selectorForms[length-i].submit();}while(--i);};var submitbtns=fc(el_table,'input',{'type':'submit'});submitbtns[0].onclick=function(){_allSubmit();gPortalC.handlers[portal.url].reset(portal.textOnTab);Current.saveDesign();portal.closeEditPortal();return false;};submitbtns[1].onclick=function(){portal.closeEditPortal();return false;};submitbtns=null;el_table=null;return element;}else{element.innerHTML='<img src="'+Config.BASEPATH+'/portal/images/loading.gif" />';element.style.display="block";var ajx=new AjxAction('portal','getPortalReadPerm');ajx.set("groupid",portal.groupid);ajx.set("title",portal.title);ajx.setCallback(new AjxCallback(PortalMenu,PortalMenu._displayPortalEditFormCallback,[element,portal]));ajx.fire();}},_displayPortalEditFormCallback:function(result,args){var element=args[0];var portal=args[1];var resp=result.getResponse();if(!resp.isException){if(resp.readPermList){portal.permSelectorInput=resp.permSelectorInput;portal.readPermList=resp.readPermList;portal.strCurrentSetting=JSON.stringify(portal.getNewSetting());PortalMenu.displayPortalEditForm(element,portal);}}else{element.innerHTML='';PortalMenu.closeEditForm(element,portal);MsgBar.addMsg('在載入設定時發生錯誤','error');}},addPortletEvent:function(e){var pos=getEvtXY(YuEvent.getEvent(e));if(!PortalMenu.portlet){if(this.disabled)return;var ediv=this.parentNode;var menuItem=PortalMenu.menuItems[ediv.menuId];var portal=gPortalC.portals[Current.url];var portlet=PortalMenu.createPortlet(menuItem,portal);portlet.title=menuItem.title;var eframe=portlet.buildPortletFrameDOM(document.body);portlet.activate(eframe);portlet.refresh();PortalMenu.portlet=portlet;var block=fc(ediv,'div',{name:'simpleblock'},null,true);block&&YuDom.setStyle(block,'opacity',0.5);var button=fc(ediv,'button',null,null,true);button&&(button.innerHTML='In Use')&&(button.disabled=1);ediv=block=button=portal=portlet=null;}else{PortalMenu.portlet.closeEditPortlet(1);}
var eframe;if(MiniPortal.isActivated){eframe=PortalMenu.portlet.eframe;MiniPortlet.startDrag(eframe,pos,pos);MiniPortlet.stopDrag(eframe);}else{var portlet=PortalMenu.portlet;eframe=PortalMenu.portlet.eframe;portlet.dragTo=Portlet.colDragTo;portlet.startDrag(pos,pos);portlet.dragTo=null;portlet.stopDrag();portlet=null;}
if(eframe){var dummy=cex("div",{className:'portlet_dragging',style:{left:pos.x,top:pos.y}});ac(dummy);var mySlide=new fx.Slide(dummy,{duration:300,onComplete:function(){BubbleTooltip.show(getXY(this.el),'您現在可以將方格拖放至您希望的位置，或修改方格設定。',5000);rn(this.el);}});mySlide.slide(getXY(eframe,1));dummy=mySlide=null;}
eframe=null;},initAddFrame:function(layoutType){if(!this.el_addFrame){this.el_addFrame=cex('div',{className:'add_frame',innerHTML:'<table class="top"><tr><td class="info"></td><td><button>增加</button></td></tr></table><!--[if lte IE 6.5]><iframe></iframe><![endif]-->'});ac(this.el_addFrame);var button=fc(this.el_addFrame,'button',null,null,true);button.onclick=this.addPortletEvent;}
ClickHandler.addListener(this.el_addFrame,this.detachDisplayPortlet,ClickHandler.OUTSIDE);var button=fc(this.el_addFrame,'button',null,null,true);var info=fc(this.el_addFrame,'td',null,'info',true);if(layoutType==Portal.LAYOUT_TYPE_COLUMN){if(button)button.style.display='';info.innerHTML='您可以按 "增加" 鍵將方格直接添加到您的第一個直列行, 或將方格拖放至您希望的位置.<br />';}else{if(button)button.style.display='none';info.innerHTML='請將內容方格移到您想放的位置<br />';}
info=button=null;},detachDisplayPortlet:function(noclose){if(PortalMenu.portlet){PortalMenu.portlet.onClose.unsubscribe(PortalMenu.detachDisplayPortlet);if(PortalMenu.portlet.eframe){if(!noclose)PortalMenu.portlet.close();}
PortalMenu.portlet=null;if(PortalMenu.el_addFrame){PortalMenu.el_addFrame.style.display='none';ClickHandler.removeListener(PortalMenu.el_addFrame);}}},createPortlet:function(menuItem,portal,expandos,filterConfig){var portlet=new Portlet();portlet.portal=portal;portlet.title=menuItem.title;var defaultFilter=PortalMenu.getDefaultFilter(clone(menuItem.filter),expandos);portlet.options=menuItem.options;portlet.ico=menuItem.ico;Object.extend(defaultFilter.filter,filterConfig);portlet.filter=defaultFilter.filter;portlet.filtertype=menuItem.filtertype;portlet.menuId=menuItem.id;portlet.expanded=true;portlet.unsaved=true;portlet.id='new';portlet.style={className:'style1'};portlet.jsHandler=menuItem.jsHandler;return portlet;},displayPortlet:function(element,menuId){var dependPortlet,depend,portal;PortalMenu.detachDisplayPortlet();var menuItem=PortalMenu.menuItems[menuId];if(menuItem){var img=fc(element,'img',null,'loadingIcon',true);if(img)rn(img);var img=fc(element,'img',null,null,true);if(img)img.style.display='';portal=gPortalC.portals[Current.url];if(menuItem.topTitle&&portal.getPortletByMenuId(menuId)){Alert('You cannot have 2 portlets of '+menuItem.title);return;}
if(menuItem['depend']){depend=menuItem['depend'];dependPortlet=portal.getPortletByMenuId(depend);if(!dependPortlet){var dependMenuItem=PortalMenu.menuItems[depend];if(dependMenuItem){alert('This portlet is dependent on " '+dependMenuItem.title+'" portlet.<br />Please add it before adding this portlet.');return;}else{PortalMenu.onMenuItemReady(depend,gPortalC.groupid,PortalMenu.displayPortlet,[element,menuId]);return;}}}
var pos=getXY(element);var divMenuItem=fc(element,'div',null,'menuItem',true);var portlet=this.createPortlet(menuItem,portal,divMenuItem&&divMenuItem.expandos);try{portlet.title=fc(element,'div',null,'text',true).firstChild.nodeValue;}catch(e){portlet.title=menuItem.title;}
if(dependPortlet)portlet.depend=dependPortlet.id;PortalMenu.portlet=portlet;PortalMenu.initAddFrame(portal.layoutType);var eframe=portlet.buildPortletFrameDOM(PortalMenu.el_addFrame);Element.replaceClassName(eframe,'','portlet_new');PortalMenu.el_addFrame.style.top=pos.y+'px';PortalMenu.el_addFrame.style.left=pos.x+element.offsetWidth+5+'px';PortalMenu.el_addFrame.style.display='block';portlet.activate(eframe);portlet.eclose.className='close_sure';portlet.refresh();portlet.editPortlet();portlet.onClose.subscribe(PortalMenu.detachDisplayPortlet);if(MiniPortal.isActivated){portlet.eheader.onmousedown='';}
portal=null;portlet=null;eframe=null;divMenuItem=null;}else{var img=fc(element,'img',null,null,true);if(img){img.style.display='none';var img2=cex("img",{className:'loadingIcon',src:Config.BASEPATH+'/portal/images/loading.gif'});ib(img2,img);}
img=img2=null;PortalMenu.onMenuItemReady(menuId,gPortalC.groupid,PortalMenu.displayPortlet,[element,menuId]);}},onMenuItemReady:function(menuId,groupid,callback,args){if(PortalMenu.menuItems[menuId]){var item=PortalMenu.menuItems[menuId];if(item.__groupid!=groupid){delete PortalMenu.menuItems[menuId];}else{callback.apply(PortalMenu,args);return;}}
var ajx=new AjxAction('portal','getMenuItem',{itemId:menuId,groupid:groupid});ajx.setCallback(new AjxCallback(PortalMenu,PortalMenu.getMenuItemCallback,[menuId,groupid,callback,args]));ajx.fire();},getMenuItemCallback:function(result,args){var menuId=args[0];var groupid=args[1];var callback=args[2];var callbackArgs=args[3];var resp=result.getResponse();if(!resp.isException){if(resp.menu){PortalMenu.menuItems[menuId]=resp.menu;PortalMenu.menuItems[menuId].__groupid=groupid;PortalMenu.onMenuItemReady.apply(PortalMenu,args);}}else{MsgBar.addMsg('在閱讀菜單時發生錯誤','error');}}};var MiniPortlet={portal:null,preStopDrag:null,postStopDrag:null,preStartDrag:null,postStartDrag:null,activate:function(miniPortal)
{this.dragTo=Portlet.colDragTo;this.getDragToPortlet2=Portlet.prototype.getDragToPortlet2;this.portal=miniPortal;},deactivate:function()
{this.portal=this.preStopDrag=this.postStopDrag=this.preStartDrag=this.postStartDrag=null;},startDrag:function(ediv,startPos,currPos)
{if(this.preStartDrag){ediv=this.preStartDrag(ediv);}
if(ediv.portlet_id=='new'){this.column=this.portal.ecolumn[0];var firstPort=fc2(this.column,1,null,/portlet|row/,1);if(firstPort){this.target=firstPort;pos=getXY(this.target);}else{this.target=null;pos=getXY(this.column.firstChild,6);}
firstPort=null;}else{pos=getXY(ediv);this.column=ediv.parentNode;}
Element.replaceClassName(ediv,'','miniportlet_freeze');this.dragOffsetX=startPos.x-pos.x;this.dragOffsetY=startPos.y-pos.y;var dummy=cex("div",{className:'portlet_dragging'});ac(dummy);this.dummy=dummy;this.dummy2=cex("div",{id:'drag_dummy',style:{width:this.column.offsetWidth+'px',left:pos.x+'px',top:pos.y+'px'}});ac(this.dummy2);if(this.postStartDrag)this.postStartDrag(ediv);this.dragTo(currPos);},onmousedown:function(e)
{e=YuEvent.getEvent(e);document.ediv=this;document.onmousemove=MiniPortlet.startDragEvent;document.startPos=getEvtXY(e);document.onmouseup=function(){document.onmousemove='';document.onmouseup='';document.ediv=null;document.startPos=null;};YuEvent.stopEvent(e);e=null;return false;},startDragEvent:function(e)
{e=YuEvent.getEvent(e);var pos=getEvtXY(e);MiniPortlet.startDrag(document.ediv,document.startPos||pos,pos);document.startPos=null;document.onmouseup=MiniPortlet.stopDragEvent;document.onmousemove=MiniPortlet.dragToEvent;YuEvent.stopEvent(e);return false;},dragToEvent:function(e)
{e=YuEvent.getEvent(e);var pos=getEvtXY(e);MiniPortlet.dragTo(pos);YuEvent.stopEvent(e);return false;},stopDragEvent:function(e)
{e=YuEvent.getEvent(e);var pos=getEvtXY(e);MiniPortlet.dragTo(pos);MiniPortlet.stopDrag(document.ediv);document.ediv=null;document.onmousemove='';document.onmouseup='';YuEvent.stopEvent(e);return false;},stopDrag:function(ediv)
{var trashed=this.trash&&this.target==this.trash;Element.replaceClassName(ediv,'miniportlet_freeze','');if(this.preStopDrag){ediv=this.preStopDrag(ediv,this.target,this.column,trashed);}
rn(this.dummy);this.dummy=null;if(!trashed){if(this.target){ib(ediv,this.target);}else{ac(this.column,ediv);}}
rn(this.dummy2);this.dummy2=null;delete this._portXY;delete this._colCorners;if(this.postStopDrag)this.postStopDrag(ediv,this.target,this.column,trashed);this.target=null;this.column=null;if(trashed)rn(ediv);}}
var MiniPortal={eportal:null,ecolumn:null,isActivated:false,activate:function(eportal)
{this.isActivated=true;this.eportal=eportal;MiniPortlet.activate(this);},deactivate:function()
{MiniPortlet.deactivate();this.eportal=this.ecolumn=null;this.isActivated=false;},buildRow:function(root,row,portlets,ecolumn,options){var twidth=parseInt(root.style.width)-4;if(twidth<5)return root;var erow=cex('div',{className:'minirow',cellSpacing:'3',style:{width:twidth+'px'}});ac(root,erow);var tw=twidth;for(var i=0,e=row.length;i<e;i++){var col=row[i];if(i==e-1){width=tw-4;}else{var width=parseInt(twidth*parseInt(col.width)/100)-4;if(width<5)continue;tw-=width+4;}
var ecol=cex('div',{innerHTML:'<div>column</div>',className:'minicol',style:{width:width+'px',margin:'2px 0 2px '+(i?4:2)+'px',background:'#fff'}});ac(erow,ecol);ecolumn&&ecolumn.push(ecol);if(!col.content.length)continue;for(var j=0;j<col.content.length;j++){var content=col.content[j];if(content.portlet){if(!portlets[content.portlet])continue;var block=cex('div',{className:'miniportlet',title:portlets[content.portlet].title,innerHTML:'<div class="miniportlet_content">'+portlets[content.portlet].title+'</div>',portlet_id:content.portlet,style:{textAlign:'center',border:'1px solid #444',cursor:'move'}});ac(ecol,block);if(options&&options.events){for(var k in options.events)block[k]=options.events[k];}
if(options&&options.cursor){block.style.cursor=options.cursor;}}else if(content.row){this.buildRow(ecol,content.row,portlets,ecolumn,options);}}}
return root;},resetPath:function(root,id){var nodes=fc2(root,1,null,/col|row|portlet/);for(var i=0,e=nodes.length;i<e;i++){nodes[i].path=(id&&(id+'_')||'')+(i+1);this.resetPath(nodes[i],nodes[i].path)}},findPath:function(root,path)
{var xpath=path.split('_');for(var i=0;(i<xpath.length)&&root;i++){root=fc2(root,1,null,/column|row|portlet/,xpath[i]);}
return root;}}
var PassBackHandlers={rssBOHandler:function(portlet,hasPassBack)
{if(hasPassBack){portlet.filter.groupid=portlet.passBack.groupid;if(portlet.passBack.displayname)portlet.title=portlet.passBack.displayname;}
portlet=null;},flickrBOHandler:function(portlet,hasPassBack)
{if(hasPassBack){portlet.filter.limit=portlet.passBack.limit;}},spostReadHandler:function(portlet,hasPassBack)
{if(hasPassBack){portlet.filter.spost_id=portlet.passBack.spost_id;}}};var PortalMenu2={portalMenus:[],limit:50,enext:null,deactivatePortalMenu:function(el)
{this.enext=null;(function(a){a.onclick=null;}).apply2all(fc(el,'LI'));},displayPortalMenu:function(element,headerId,offset,custom){var portalMenu=PortalMenu2.portalMenus[headerId];offset=offset||0;if(portalMenu){var count=portalMenu.count;var html=[];html[html.length]='<div class="leftpane"><div class="title" menuId="'+headerId+'">'+portalMenu['title']+'</div>';html[html.length]='<div class="itemUL">';if(offset>0&&count==0){html[html.length]='<center>完結</center>';}
var menuItems=portalMenu['menuItems'];var e=menuItems.length;for(var i=0;i<e;i++){var menuItem=menuItems[i];html[html.length]='<div class="itemLI">';var id=menuItem['id'];if(id>0){html[html.length]='<div class="menuItem" menuId="'+id+'" style="'+(menuItem['menustyle']||'')+'">';var iconHtml=PortalMenu.defaultIconHtml;if(menuItem['ico']){iconHtml='<img src="'+Config.PORTLETICONPATH+menuItem['ico']+'" align="absmiddle" />';}
html[html.length]=iconHtml;html[html.length]='<div class="text">'+menuItem['title']+'</div></div>';}else if(id<0){html[html.length]='<div class="menuHeader" menuId="'+id+'">'+PortalMenu.folderIconHtml+'<div class="text">'+menuItem['title']+'</div></div>';}else{html[html.length]='<div class="separator">'+(menuItem['title']||'')+'</div>';}
html[html.length]='</div>';}
menuItem=null;html[html.length]='<div class="prevnext">';if(offset>0){html[html.length]='<span class="prev" style="cursor:pointer">上頁</span>&nbsp;';}
if(count==this.limit){html[html.length]='&nbsp;<span class="next" style="cursor:pointer">下頁</span>';}
html[html.length]='</div>';html[html.length]='</div></div><div class="rightpane"></div>';PortalMenu2.deactivatePortalMenu(element);element.innerHTML=html.join('');Dispatch.hook(element);html=null;var arrItemLI=fc(element,'div',null,'itemLI');for(var i=0,e=arrItemLI.length;i<e;i++){var item=arrItemLI[i].firstChild;item.seq=i;if(menuItems[i]['expandos']){item.expandos=menuItems[i]['expandos'];}
switch(item.className){case'menuItem':item.onclick=function(e){e=YuEvent.getEvent(e);var itemUL=fp(this,'div',null,'itemUL');var current=itemUL.current;if(typeof current!='undefined')Element.replaceClassName(itemUL.childNodes[current],'selected','')
Element.replaceClassName(this.parentNode,'','selected');itemUL.current=this.seq;PortalMenu.displayPortlet(this.parentNode,this.getAttribute("menuId"));fp(this,'div',null,'leftpane').nextSibling.innerHTML='';YuEvent.stopEvent(e);return false;}
break;case'menuHeader':item.onclick=function(e){e=YuEvent.getEvent(e);var itemUL=fp(this,'div',null,'itemUL');var current=itemUL.current;if(typeof current!='undefined')Element.replaceClassName(itemUL.childNodes[current],'selected','')
Element.replaceClassName(this.parentNode,'','selected');itemUL.current=this.seq;PortalMenu2.displayPortalMenu(fp(this,'div',null,'leftpane').nextSibling,-this.getAttribute("menuId"),0,this.expandos||{});return false;}
break;default:break;}}
item=null;menuItems=null;var eprevnext=fc(element,'div',null,'prevnext',true);var eprev=fc(eprevnext,'span',null,'prev',true);this.enext=fc(eprevnext,'span',null,'next',true);if(eprev){eprev.onclick=function(e){PortalMenu2.displayPortalMenu(fp(this,'div',null,'leftpane'),headerId,offset-PortalMenu2.limit);}}
if(this.enext){this.enext.onclick=function(e){PortalMenu2.displayPortalMenu(fp(this,'div',null,'leftpane'),headerId,offset+PortalMenu2.limit);}}
eprevnext=null;eprev=null;arrItemLI=null;element=null;PortalMenu2.portalMenus[headerId]=null;}else{PortalMenu2.deactivatePortalMenu(element);element.innerHTML='<div class="showMenu"></div><img src="'+Config.BASEPATH+'/portal/images/loading.gif" />';element.style.display='';var ajx=new AjxAction('portal','getPortalMenu2');ajx.set("headerId",headerId);ajx.set("offset",offset);ajx.set("limit",this.limit);ajx.set("groupid",gPortalC.groupid>=GROUPID_RANGE_START?gPortalC.groupid:'');ajx.set('custom',custom);ajx.setCallback(new AjxCallback(PortalMenu,PortalMenu2._displayPortalMenuCallback,[element,headerId,offset,custom]));ajx.fire();}},_displayPortalMenuCallback:function(result,args){var element=args[0];var headerId=args[1];var offset=args[2];var custom=args[3];var resp=result.getResponse();if(!resp.isException){if(resp.menu){PortalMenu2.portalMenus[headerId]=resp.menu;PortalMenu2.displayPortalMenu(element,headerId,offset);return;}}
element.innerHTML='不能提供捷徑';}};Iqube.ArrayEditor=function(el,colnames,data){Iqube.Controller.extend.apply(this,[Iqube.ArrayEditor,Iqube.Controller,null,el]);this.el=el;if(colnames.constructor==Array){this.colnames={};for(var i=0;i<colnames.length;i++){this.colnames[colnames[i]]=colnames[i];}}
else{this.colnames=colnames;}
this.data=data;};Iqube.ArrayEditor._className="Iqube.ArrayEditor";Iqube.ArrayEditor.prototype._jsInit=function(){};Iqube.ArrayEditor.prototype._domActivate=function(){this.base.prototype._domActivate.call(this);this.dataRows=[];if(!this.rendered){this.render();}};Iqube.ArrayEditor.prototype._domDeactivate=function(){this.dataRows=[];var actions=fc(this.el,"span",{m_action:true});for(var i=0;i<actions.length;i++){actions[i].onclick=null;}
this.el=null;this.rendered=false;this.base.prototype._domDeactivate.call(this);};Iqube.ArrayEditor.prototype.render=function(container){container=container||this.el;html="<table cellpadding='5' cellspacing='3' width='90%'><tr>";for(var key in this.colnames){html+="<td m_key=\""+key+"\">"+this.colnames[key]+"</td>";}
html+="<td name='td_action'>行動</td>";html+="</tr></table>";container.innerHTML=html;this.elHeader=fc(container,"tr")[0];this.dataRows=[];for(var i=0;i<this.data.length;i++){var row=this.elHeader.cloneNode(true);for(var key in this.colnames){fc(row,"td",{m_key:key},null,true).innerHTML=this.data[i][key]||"<span class='instruction'>-</span>";}
row.m_data=this.data[i];var sub="<span m_action='up' class='active_link'>[&uarr;]</span>";sub+="<span m_action='down' class='active_link'>[&darr;]</span>";sub+="<span m_action='del' class='active_link'>[x]</span>";fc(row,"td",{name:'td_action'},null,true).innerHTML=sub;var actions=fc(row,"span",{m_action:true});for(var j=0;j<actions.length;j++){actions[j].onclick=this.handleRowAction.bind(this,actions[j]);}
ac(this.elHeader.parentNode,row);this.dataRows.push(row);}
this.elHeader.style.fontWeight="bold";this.rendered=true;};Iqube.ArrayEditor.prototype.handleRowAction=function(el){var action=el.getAttribute("m_action");var tr=fp(el,"tr");var ndx=indexOf(this.dataRows,tr);switch(action){case"up":var prev=this.dataRows[ndx-1];if(prev){ib(tr,prev);this.dataRows[ndx]=prev;this.dataRows[ndx-1]=tr;this.data[ndx]=prev.m_data;this.data[ndx-1]=tr.m_data;}
break;case"down":var next=this.dataRows[ndx+1];if(next){ia(tr,next);this.dataRows[ndx]=next;this.dataRows[ndx+1]=tr;this.data[ndx]=next.m_data;this.data[ndx+1]=tr.m_data;}
break;case"del":var msg="確定要刪除這一行?";if(confirm(msg)){var actions=fc(tr,"span",{m_action:true});for(var i=0;i<actions.length;i++){actions[i].onclick=null;}
tr.parentNode.removeChild(tr);this.dataRows.splice(ndx,1);this.data.splice(ndx,1);}
break;default:throw new Error("Unknown action \""+action+"\"");break;}};Iqube.ArrayEditor.prototype.getData=function(){var data=[];for(var i=0;i<this.dataRows.length;i++){data.push(this.dataRows[i].m_data);}
return data;};var Selector={inputText:function(field,options,obj)
{var input1;var lastvalue;var width;var ac=null;var tmp={html:'<tr>'+'<td nowrap="nowrap" align="right"><label>'+options.title+' :</label></td>'+'<td align="left"><div><input type="text" maxlength="256" /></div></td>'+'</tr>',activate:function(tr1)
{this.tr1=tr1;if(options.verify&&typeof obj[field]=='string'){obj[field]={url:obj[field],verified:false};}
input1=tr1.childNodes[1].firstChild.firstChild;if(options.verify){input1.m_ac=input1.m_ac||new RssAutoComplete(input1);}
width=input1.parentNode.offsetWidth;this.reset();tr1=null;},submit:function()
{if(input1.value!=lastvalue){if(options.verify){if(!/^http:/.test(input1.value)){input1.value='http://'+input1.value;}
obj[field]={url:input1.value,verified:false};}
else
obj[field]=input1.value;}
this.reset();},reset:function()
{lastvalue=input1.value=options.verify?obj[field].url:obj[field];var className=(!options.verify?'':(obj[field].verified?'verified':'unverified'));input1.parentNode.className=className;if(width){if(className=='verified'){input1.style.width=width-28+'px';}else{input1.style.width=width-10+'px';}}},deactivate:function(){if(input1.m_fh){input1.m_fh.destruct();input1.m_fh=null;}
if(input1.m_ac){input1.m_ac.deactivate();input1.m_ac=null;}
this.tr1=null;input1=null;}};return tmp;},selectMobLayout:function(field,options,obj){var tmp={activate:function(tr1)
{this.tr1=tr1;tr1.ctrlObj=this;this.selected=fc(tr1,'fieldset',null,'selected',true);this.notselected=fc(tr1,'fieldset',null,'notselected',true);var inputs=fc(tr1,'input');for(var i=0;i<inputs.length;i++){inputs[i].onclick=this.onclick;}},onclick:function(e)
{var _this=fp(this,'tr',{ctrlObj:true}).ctrlObj;if(this.checked){ac(_this.selected,this.parentNode);this.checked=true;}else{ac(_this.notselected,this.parentNode);this.checked=false;}},submit:function()
{var inputs=fc(this.selected,'input');obj[field]=[];for(var i=0;i<inputs.length;i++){obj[field].push(parseInt(inputs[i].value));}},deactivate:function()
{(function(a){a.onclick=null;}).apply2all(fc(this.tr1,'input'));this.tr1.ctrlObj=null;this.tr1=null;this.selected=null;this.notselected=null;},reset:function()
{}};var portlets=options.portlets;var selection=[];for(var i in portlets){if(portlets[i].options&Portlet.OPTION_MOBILE){selection[i]='<span style="padding:5px">'+portlets[i].title+'<input type="checkbox" value="'+i+'" nochecked="1" /></span>';}}
var selected=[];for(var i in obj[field]){if(selection[obj[field][i]]){selected.push(selection[obj[field][i]].replace('nochecked','checked'));selection[obj[field][i]]='';}}
tmp.html='<tr valign="top"><td nowrap="nowrap"><label>'+(options.title||'手機版')+' :'+'</label></td><td align="left">'+'<fieldset class="selected" style="float:left;clear:both;width:90%;display:block;height:3em;"><legend>以下的內容方格將可顯示在手機內(順序)</legend>'+selected.join('')+'</fieldset>'+'<fieldset class="notselected" style="float:left;clear:both;width:90%;display:block;height:3em;"><legend>選擇在手機版顯示的內容方格</legend>'+selection.join('')+'</fieldset></td></tr>';portlets=null;selection=null;selected=null;return tmp;},selectStyle:function(field,options,obj)
{var input1,checkbox,inputbox;var selected;var tmp={html:['<tr>','<td nowrap><label>'+options.title+' :</label></td>','<td align="left" style="padding:1px;">','<nobr class="samplebox"><span class="sample1" expando="style1"><b class="hd">&nbsp;1&nbsp;</b><b class="bd">&nbsp;1&nbsp;</b></span></nobr> ','<nobr class="samplebox"><span class="sample2" expando="style2"><b class="hd">&nbsp;2&nbsp;</b><b class="bd">&nbsp;2&nbsp;</b></span></nobr> ','<nobr class="samplebox"><span class="sample3" expando="style3"><b class="hd">&nbsp;3&nbsp;</b><b class="bd">&nbsp;3&nbsp;</b></span></nobr> ','<nobr class="samplebox"><span class="sample4" expando="style4"><b class="hd">&nbsp;4&nbsp;</b><b class="bd">&nbsp;4&nbsp;</b></span></nobr> ','<nobr class="samplebox"><span class="sample5" expando="style5"><b class="hd">&nbsp;5&nbsp;</b><b class="bd">&nbsp;5&nbsp;</b></span></nobr> ','<nobr class="samplebox"><span class="sample6" expando="style6"><b class="hd">&nbsp;6&nbsp;</b><b class="bd">&nbsp;6&nbsp;</b></span></nobr> ','<nobr class="samplebox"><span class="sample" style="cursor:pointer" expando=""><b class="hd">&nbsp;0&nbsp;</b><b class="bd">&nbsp;0&nbsp;</b></span></nobr> ','<nobr>收藏頁面首部: <input name="hide_header" type="checkbox" value="hideHeader"/></nobr> <span class="separator5"></span>','<nobr>沒有空白邊: <input name="hide_frame" type="checkbox" value="hideFrame"/></nobr>',(Alias.status>=STATUS_SYSDESIGNER)?'<br /><Br />Desiger Only:<br /><nobr>Style: <input type="text" name="className" size="6" /></nobr> <nobr>bg2: <input type="text" name="bg2" size="6" /></nobr> <nobr>title1: <input type="text" name="title1" size="6" /></nobr>':'','</td>','</tr>'].join(''),activate:function(tr1)
{this.tr1=tr1;var style=obj[field].className||'';input1=fc(tr1,'span',null,/sample/);for(var i=0,e=input1.length;i<e;i++){if(input1[i].getAttribute('expando')==style){selected=input1[i];Element.replaceClassName(selected.parentNode,'','selected_sample')}
input1[i].onclick=function(){selected&&Element.replaceClassName(selected.parentNode,'selected_sample','')
var newstyle=this.getAttribute('expando');Element.replaceClassName(obj.eframe,/style*/,newstyle);obj[field].className=newstyle;inputbox&&(inputbox.value=newstyle);Element.replaceClassName(this.parentNode,'','selected_sample')
selected=this;return false;}}
checkbox=fc(tr1,'input',{type:'checkbox'},null);var handler=function(){if(this.checked){Element.replaceClassName(obj.eframe,'',this.name);obj[field][this.value]=true;}else{Element.replaceClassName(obj.eframe,this.name,'');obj[field][this.value]=false;}};(function(a){a.onclick=handler;a.checked=obj[field]&&obj[field][a.value];}).apply2all(checkbox);inputbox=fc(tr1,'input',{type:'text'},null);for(var i=0,e=inputbox.length;i<e;i++){if(inputbox[i].getAttribute('name')=='className'){inputbox[i].onblur=function(){obj[field].className=this.value;Element.replaceClassName(obj.eframe,/style*/,this.value);}}else{inputbox[i].onblur=function(){obj[field][this.getAttribute('name')]=this.value;}}
inputbox[i].value=obj[field][inputbox[i].getAttribute('name')]||'';}
handler=null;tr1=null;},submit:function()
{},deactivate:function(){(function(a){a.onclick=null;}).apply2all(input1);(function(a){a.onclick=null;}).apply2all(checkbox);selected=null;(function(a){a.onblur=null;}).apply2all(inputbox);delete inputbox;delete selected;delete input1;delete checkbox;},reset:function()
{}};return tmp;},selectRange:function(field,input,obj)
{var def=obj[field];var select1;var selectHTML='<select name="'+field+'">';var step=input.step?Math.max(1,input.step):1;for(var i=input.min;i<=input.max;i+=step){if(i==def){selectHTML+='<option SELECTED value="'+i+'">'+i+'</option>';}else{selectHTML+='<option value="'+i+'">'+i+'</option>';}}
selectHTML+='</select>';var tmp={html:'<tr>'+'<td align="right" nowrap="1" width="1%"><label>'+(input.title?input.title:IqubeMsg.range)+' :</label></td>'+'<td align="left">'+selectHTML+'</td>'+'</tr>',activate:function(tr1,preview){this.tr1=tr1;select1=fc(tr1,'select',null,null,true);if(preview&&input.autopreview){select1.onchange=function(e){preview();}};tr1=null;},deactivate:function(){this.tr1=null;select1.onchange=null;select1=null;},submit:function()
{obj[field]=select1.value;}};return tmp;},selectSet2:function(field,input,obj)
{var g,s;var tmp={html:'<tr>'+'<td align="right"><label>'+IqubeMsg.set+':</label></td>'+'<td align="left"><strong style="white-space:nowrap;">網站: <input/></strong> <strong style="white-space:nowrap;">文件夾: <select><option value="">[請首先選擇一個群組]</option></select></strong>'+'</td></tr>',activate:function(tr1){this.tr1=tr1;var is=fc(tr1,'input');g=is[0];;s=fc(tr1,'select')[0];var ac=new Iqube.GroupName1AutoComplete(g);ac.encodeItem=function(jsObj,strKey){var html='<div><em>'+jsObj.name+'</em><div>'+jsObj.name+'</div><div>'+jsObj.displayname+'</div></div>';var jsItem={'html':html,'match':false};return jsItem;};ac.onSelect=function(jsObj){this.oNode.value=jsObj.name;this.oNode.m_gid=jsObj.group_id;get();};g.m_ac=ac;g.onfocus=function(){this.select();};var c=function(r){var resp=r.getResponse();if(!resp.isException){f(resp.sets);}else{MsgBar.addMsg(resp.html);}};var f=function(a){s.options.length=0;for(var i=0;i<a.length;i++){s.options[i]=new Option(a[i][1],a[i][0]);}};var get=function(e){var ajx=new AjxAction('iqube','getSetId');ajx.set('groupid',g.m_gid);if(input&&input.config)ajx.set('config',input.config);ajx.setCallback(c,this);ajx.fire();};if(obj[field]){g.value='--不存在--';g.vback=g.value;s.options[0]=new Option(obj[field],obj[field]);var pop=function(r){if(g){var resp=r.getResponse();if(g.value==g.vback&&!resp.isException){init(resp.set);}
else{MsgBar.addMsg(resp.html);}
g.vback=null;}
pop=null;};var init=function(set){g.value=set[3];g.m_gid=set[2];s.options[0]=new Option(set[1],set[0]);init=null;};(function(){var ajx=new AjxAction('iqube','resolveSetId');ajx.set('setid',obj[field]);ajx.setCallback(pop,this);ajx.fire();})();}
tr1=null;},submit:function(){obj[field]=s.value;},deactivate:function(){g.m_ac.deactivate();g.m_ac=null;g.onfocus=null;g=null;s=null;},clear:function(){g.value="";delete g.m_gid;s.options.length=0;s.value="";}};return tmp;},selectGroup2:function(field,input,obj)
{var g,d;var tmp={html:'<tr>'+'<td><label>'+IqubeMsg.blog+':</label></td>'+'<td><input style="width:95%;"></td>'+'</tr>',activate:function(tr1)
{g=tr1.childNodes[1].childNodes[0];var ac=new Iqube.GroupName1AutoComplete(g);ac.encodeItem=function(jsObj,strKey){var html='<div><em>'+jsObj.name+'</em><div>'+jsObj.name+'</div><div>'+jsObj.displayname+'</div></div>';var jsItem={'html':html,'match':false};return jsItem;};ac.onSelect=function(jsObj){this.oNode.value=jsObj.name;d=jsObj.displayname;};g.m_ac=ac;ac=null;d=obj[field];g.value=obj[field];tr1=null;},deactivate:function(){g.m_ac.deactivate();g.m_ac=null;},submit:function()
{obj[field]=g.value;if(input&&input.topTitle==1)return d;}};return tmp;},selectPermission2:function(field,input,obj){var selectValue,perm_elm,aliasPerm,groupPerm;var cbs,rootCb;var tmp={html:'<tr>'+'<td nowrap valign="top"><label>'+IqubeMsg[input.label]+'</label></td>'+'<td align="left">'+'<table cellpadding="0" cellspacing="0">'+'<tr><td>'+'<select name="'+input.perm+'_sel'+'">'+
(input.option.perm_public?'<option value="perm_public">公開</option>':'')+
(input.option.perm_logged_in?'<option value="perm_logged_in">已登入會員</option>':'')+
(input.option.perm_sn?'<option value="perm_sn">我的朋友圈</option>':'')+
(input.option.perm_member?'<option value="perm_member">會員</option>':'')+
(input.option.perm_private?'<option value="perm_private">祇有我</option>':'')+
(input.option.perm_none?'<option value="perm_none">無</option>':'')+
(input.option.perm_advanced?'<option value="perm_advanced">進階</option>':'')+'</select>'+
(input.option.perm_public?'<div name="perm_public" m_option="1" style="display: none">'+'<span class="describe_public">'+'<i class="instruction">'+input.option.perm_public+'</i>'+'</span>'+'</div>':'')+
(input.option.perm_logged_in?'<div name="perm_logged_in" m_option="1" style="display: none">'+'<span class="perm_logged_in">'+'<i class="instruction">'+input.option.perm_logged_in+' </i>'+'</span>'+'</div>':'')+
(input.option.perm_sn?'<div name="perm_sn" m_option="1" style="display: none">'+'<span class="describe_sn">'+'<i class="instruction">'+input.option.perm_sn+' </i>'+'</span>'+'</div>':'')+
(input.option.perm_member?'<div name="perm_member" m_option="1" style="display: none">'+'<span class="describe_member">'+'<i class="instruction">'+input.option.perm_member+' </i>'+'</span>'+'</div>':'')+
(input.option.perm_private?'<div name="perm_private" m_option="1" style="display: none">'+'<span class="describe_private">'+'<i class="instruction">'+input.option.perm_private+' </i>'+'</span>'+'</div>':'')+
(input.option.perm_none?'<div name="perm_none" m_option="1" style="display: none">'+'<span class="describe_none">'+'<i class="instruction">'+input.option.perm_none+' </i>'+'</span>'+'</div>':'')+
(input.option.perm_advanced?'<div name="perm_advanced" m_option="1" style="display: none">'+'<table cellPadding="2" style="width : 100%">'+'<tr>'+'<td colSpan="3">'+'<span class="describe_advance">'+'<i class="instruction">'+input.option.perm_advanced+' </i>'+'</span>'+'</td>'+'</tr>'+'<tr>'+'<td style="width : 80%">'+'<div style="PADDING-RIGHT : 10px">'+'<textarea Cols="40" Rows="2" name="'+input.perm+'_list'+'"> </textarea>'+'<span class="errorMsg" name="setError">請輸入您的登入名稱或社群名稱，例如John, @community</span>'+'</div>'+'</td>'+'</tr>'+'</table>'+'</div>':'')+'</td></tr>'+'</table>'+'</td>'+'</tr>',activate:function(tr1)
{aliasPerm=[];groupPerm=[];var selector=this;var readPermOnChangeListener=function(){selectValue=this.value;var tr=this.parentNode.parentNode;switchDesc(tr,this.value);};var switchDesc=function(tr,selection){var divs=fc(tr,"div",{m_option:true});for(var i=0;i<divs.length;i++){if(divs[i].getAttribute("name")==selection){divs[i].style.display="block";}
else{divs[i].style.display="none";}}}
var allCbToggleListener=function(){for(var i=0;i<cbs.length;i++){cbs[i].disabled=!cbs[i].disabled;}}
if(obj[field]){var initObj=obj[field];}
var tBody=tr1.childNodes[1].firstChild.firstChild;var select=tBody.childNodes[0].firstChild.firstChild;for(var i=0;i<select.options.length;i++){if(select.options[i].value==initObj.selectValue){select.options[i].selected=true;}}
selectValue=initObj.selectValue;groupPerm=initObj.groupPerm;aliasPerm=initObj.aliasPerm;permGroup=initObj.permGroup;if(permGroup&&permGroup.length>0){if(fc(tBody,'div',{name:'perm_sn'}).length>0){var trGroupOrSn=fc(tBody,'div',{name:'perm_sn'})[0];}else if(fc(tBody,'div',{name:'perm_member'}).length>0){var trGroupOrSn=fc(tBody,'div',{name:'perm_member'})[0];}else{var trGroupOrSn=null;}
if(trGroupOrSn){var tdGroupOrSn=trGroupOrSn.firstChild;allCb=null;cbs=[];var checked=false;for(var i=0;i<permGroup.length;i++){var spanWrapper=cex('span');if(permGroup[i].checked=='1'){spanWrapper.innerHTML='<input type="checkbox" value="'+
permGroup[i].group_id+'" name="'+input.perm+'_group" checked>'+'<span>'+permGroup[i].name+'</span>';checked=true;}else{spanWrapper.innerHTML='<input type="checkbox" value="'+
permGroup[i].group_id+'" name="'+input.perm+'_group">'+'<span>'+permGroup[i].name+'</span>';}
if(permGroup[i].all){allCb=spanWrapper.firstChild;}else{cbs.push(spanWrapper.firstChild);}
spanWrapper.style.marginLeft=10;spanWrapper.style.marginRight=10;tdGroupOrSn.appendChild(spanWrapper);spanWrapper=null;}
if(!checked)allCb.checked=true;if(allCb.checked){allCbToggleListener();}
allCb.onclick=allCbToggleListener;}
trGroupOrSn=null;tdGroupOrSn=null;}
select.onchange=readPermOnChangeListener;this.select=select;var selectCollection=tBody.getElementsByTagName("SELECT");for(var i=0;i<selectCollection.length;i++){switch(selectCollection[i].name){case input.perm+'_sel':var tr=selectCollection[i].parentNode.parentNode;switchDesc(tr,selectCollection[i].value);tr=null;break;}}
var inputCollection=tBody.getElementsByTagName("INPUT");for(var i=0;i<inputCollection.length;i++){switch(inputCollection[i].name){case input.perm+'_list':perm_elm=inputCollection[i];break;default:break;}}
var textAreaCollection=tBody.getElementsByTagName("TEXTAREA");if(textAreaCollection.length==1){perm_elm=textAreaCollection[0];perm_elm.value=initObj.permListTxt;perm_elm.m_ac=new Iqube.PeopleAutoComplete(perm_elm);}
this.tr1=tr1;tr1=null;select=null;tBody=null;inputCollection=null;textAreaCollection=null;selectCollection=null;},submit:function()
{var temp={};temp.groupPerm=groupPerm;temp.aliasPerm=aliasPerm;temp.selectValue=selectValue;if(perm_elm){temp.permListTxt=perm_elm.value;}
obj[field]=temp;},deactivate:function(){this.select.onchange=null;this.select=null;var a=fc(this.tr1,'textarea');for(var i=0;i<a.length;i++){if(a[i].m_ac){a[i].m_ac.deactivate();a[i].m_ac=null;}}
cbs=null;rootCb=null;perm_elm=null;}};return tmp;},selectGroup3:function(field,input,obj){var pid,ptitle;var b,p,d,ae,data,getIds;var tmp={html:'<tr>'+'<td nowrap="1"><label>'+(input.title||'網站')+' :</label></td>'+'<td style="padding:0 5px;"><input type="button" value="加入..."/><br/><div style="padding:8px 5px; border:1px solid #aaa;"></div></td>'+'</tr>',activate:function(tr1,preview)
{this.tr1=tr1;b=fc(tr1,"input")[0];d=fc(tr1,"div")[0];if(obj[field]){data=obj[field];}
data=$A(data||[]);tr1=null;ae=new Iqube.ArrayEditor(d,{group_id:"ID",displayname:"名稱"},data);ae.activate();b.onclick=function(e){if(!p){PkgMan.load("Iqube.PortletPopup",function(){var options={header:"尋找及選擇 "+(input.title||'Group')+"",onOK:function(){var c=p.getController();if(c&&c.getSelected){var selected=c.getSelected();for(var i=0;i<selected.length;i++){var ndx=-1;for(var j=0;j<data.length;j++){if(data[j].group_id==selected[i].group_id){ndx=j;break;}}
if(ndx>=0){data[ndx]={group_id:selected[i].group_id,displayname:selected[i].displayname};}
else{data.push({group_id:selected[i].group_id,displayname:selected[i].displayname});}}
if(ae){ae.deactivate();ae=null;d.innerHTML="";}
ae=new Iqube.ArrayEditor(d,{group_id:"ID",displayname:"名稱"},data);ae.activate();}
p.hide();},onCancel:function(){p.hide();},close:false,btnOK:true,btnCancel:true,width:'666px',filterConfig:Object.extend({},input?input.filterConfig:{})};p=new Iqube.PortletPopup(2202,gPortalC.groupid,options);p.activate();p.show();});}
else{p.show();}};},deactivate:function(){this.tr1=null;if(b)b.onclick=null;if(p)p.deactivate();if(ae)ae.deactivate();getIds=p=b=null;},submit:function()
{obj[field]=data;}};return tmp;},selectAlias:function(field,input,obj){var pid,ptitle;var b,p,d,ae,data,getIds;var tmp={html:'<tr>'+'<td nowrap="1"><label>'+(input.title||'人物')+' :</label></td>'+'<td style="padding:0 5px;"><input type="button" value="加入..."/><br/><div style="padding:8px 5px; border:1px solid #aaa;"></div></td>'+'</tr>',activate:function(tr1,preview)
{this.tr1=tr1;b=fc(tr1,"input")[0];d=fc(tr1,"div")[0];if(obj[field]){data=obj[field];}
data=$A(data||[]);tr1=null;ae=new Iqube.ArrayEditor(d,{alias_id:"ID",displayname:"會員名稱"},data);ae.activate();b.onclick=function(e){if(!p){PkgMan.load("Iqube.PortletPopup",function(){var options={header:"尋找及選擇 "+(input.title||'People')+"",onOK:function(){var c=p.getController();if(c&&c.getSelected){var selected=c.getSelected();for(var i=0;i<selected.length;i++){var ndx=-1;for(var j=0;j<data.length;j++){if(data[j].alias_id==selected[i].alias_id){ndx=j;break;}}
if(ndx>=0){data[ndx]={alias_id:selected[i].alias_id,displayname:selected[i].displayname};}
else{data.push({alias_id:selected[i].alias_id,displayname:selected[i].displayname});}}
if(ae){ae.deactivate();ae=null;d.innerHTML="";}
ae=new Iqube.ArrayEditor(d,{alias_id:"ID",displayname:"會員名稱"},data);ae.activate();}
p.hide();},onCancel:function(){p.hide();},close:false,btnOK:true,btnOKText:"選取",btnCancel:true,width:'666px',filterConfig:Object.extend({},input?input.filterConfig:{})};p=new Iqube.PortletPopup(2201,gPortalC.groupid,options);p.activate();p.show();});}
else{p.show();}};},deactivate:function(){this.tr1=null;if(b)b.onclick=null;if(p)p.deactivate();if(ae)ae.deactivate();getIds=p=b=null;},submit:function()
{obj[field]=data;}};return tmp;},selectSPost2:function(field,input,obj){var pid,ptitle;var b,p,d,ae,data,getIds;var tmp={html:'<tr>'+'<td nowrap="1"><label>'+(input.title||'插件')+' :</label></td>'+'<td style="padding:0 5px;"><input type="button" value="加入..."/><br/><div style="padding:8px 5px; border:1px solid #aaa;"></div></td>'+'</tr>',activate:function(tr1,preview)
{this.tr1=tr1;b=fc(tr1,"input")[0];d=fc(tr1,"div")[0];if(obj[field]){data=obj[field];}
data=$A(data||[]);tr1=null;ae=new Iqube.ArrayEditor(d,{spost_id:"ID",title:"標題"},data);ae.activate();b.onclick=function(e){if(!p){PkgMan.load("Iqube.PortletPopup",function(){var options={header:"搜尋及選擇 "+(input.title||'SPost')+"",onOK:function(){var c=p.getController();if(c&&c.getSelected){var selected=c.getSelected();for(var i=0;i<selected.length;i++){var ndx=-1;for(var j=0;j<data.length;j++){if(data[j].spost_id==selected[i].spost_id){ndx=j;break;}}
if(ndx>=0){data[ndx]={spost_id:selected[i].spost_id,title:selected[i].title};}
else{data.push({spost_id:selected[i].spost_id,title:selected[i].title});}}
if(ae){ae.deactivate();ae=null;d.innerHTML="";}
ae=new Iqube.ArrayEditor(d,{spost_id:"ID",title:"標題"},data);ae.activate();}
p.hide();},onCancel:function(){p.hide();},close:false,btnOK:true,btnCancel:true,width:'666px',filterConfig:Object.extend({},input?input.filterConfig:{})};p=new Iqube.PortletPopup(2207,gPortalC.groupid,options);p.activate();p.show();});}
else{p.show();}};},deactivate:function(){this.tr1=null;if(b)b.onclick=null;if(p)p.deactivate();if(ae)ae.deactivate();getIds=p=b=null;},submit:function()
{obj[field]=data;}};return tmp;},selectSPost1:function(field,input,obj){var pid,ptitle;var v,b,p,c;var tmp={html:'<tr>'+'<td nowrap="1"><label>'+(input.title||'插件')+' :</label></td>'+'<td style="padding:0 5px;"><span></span><input type="button" value="選取" style="margin-left:5px;"/><input type="button" value="清除"/></td>'+'</tr>',activate:function(tr1,preview)
{this.tr1=tr1;v=fc(tr1,"span")[0];b=fc(tr1,"input")[0];c=fc(tr1,"input")[1];if(obj[field]){pid=obj[field];v.innerHTML="["+obj[field]+"]";}
tr1=null;c.onclick=function(e){pid="";v.innerHTML="";return false;};b.onclick=function(e){if(!p){PkgMan.load("Iqube.PortletPopup",function(){var options={header:"搜找及選擇 "+(input.title||'_(SPost')+")_",onOK:function(){var c=p.getController();if(c&&c.getSelected){var selected=c.getSelected();if(selected.length>0){pid=selected[0].spost_id;ptitle=selected[0].title;v.innerHTML=ptitle+" ["+pid+"]";}}
p.hide();},onCancel:function(){p.hide();},close:false,btnOK:true,btnCancel:true,width:'666px',filterConfig:Object.extend({},input?input.filterConfig:{})};p=new Iqube.PortletPopup(2207,gPortalC.groupid,options);p.activate();p.show();});}
else{p.show();}};},deactivate:function(){this.tr1=null;if(b)b.onclick=null;if(c)c.onclick=null;if(p)p.deactivate();c=p=b=v=null;pid=ptitle=null;},submit:function()
{obj[field]=pid;}};return tmp;},selectPost2:function(field,input,obj){var pid,ptitle;var v,b,s;var tmp={html:'<tr>'+'<td nowrap="1"><label>文章 :</label></td>'+'<td style="padding:0 5px;"><span></span><input type="button" value="選取" style="margin-left:5px;"/></td>'+'</tr>',activate:function(tr1,preview)
{this.tr1=tr1;v=fc(tr1,"span")[0];b=fc(tr1,"input")[0];if(obj[field]){pid=obj[field];v.innerHTML="["+obj[field]+"]";}
tr1=null;b.onclick=function(e){if(!s){PkgMan.load("Iqube.Post.PostPicker",function(){var cb=function(status,p){if(status&&p){pid=p.post_id;ptitle=p.title;v.innerHTML=ptitle+" ["+pid+"]";}};s=new Iqube.Post.PostPicker({typeid:Post.TYPE_BLOG,multiple:false,onClose:cb});s.activate();s.show();}.bind(this));}
else{s.show();}};},deactivate:function(){this.tr1=null;if(b)b.onclick=null;if(s)s.deactivate();s=b=v=null;},submit:function()
{obj[field]=pid;if(input&&input.topTitle==1&&typeof ptitle=="string")return ptitle;}};return tmp;},selectPhotoOption:function(field,input,obj){var radioInteresting_el;var radioRecent_el;var radioTag_el,txtTag_el;var radioUser_el,txtUser_el;var radioUrl_el,txtUrl_el;var divMoreOptions_el;var tglMoreOptions_el;var tmp={html:['<tr>','<td valign=top><label style="padding-top:3px;">展示:</label></td>','<td>','<table>','<tr>','<td colspan=2>','<table>','<tr>','<td width=1% valign=top>','<input type="radio" value="interesting" name="showoption">','</td>','<td>','有趣','</td>','</tr>','</table>','</td>','</tr>','<tr>','<td colspan=2>','<table>','<tr>','<td width=1% valign=top>','<input type="radio" value="recent" name="showoption">','</td>','<td>','最近的','</td>','</tr>','</table>','</td>','</tr>','<tr>','<td colspan=2>','<div style="display:none;">','<table>','<tr>','<td width=1% valign=top>','<input type="radio" value="tag" name="showoption">','</td>','<td>','<div>','請輸入標籤：','</div>','<div>','<input class="txt_disabled" type="text" name="tag" disabled>','</div>','<div>','例如：花，聚會，家庭','</div>','</td>','</tr>','<tr>','<td width=1% valign=top>','<input type="radio" value="user" name="showoption">','</td>','<td>','<div>','這個Flickr會員的照片','</div>','<div>','<input class="txt_disabled" type="text" name="user" disabled>','</div>','<div>','例如：Wilson Chen','</div>','</td>','</tr>','<tr>','<td width=1% valign=top>','<input type="radio" value="url" name="showoption">','</td>','<td>','<div>','這個Flickr 的(URL)輸入:','</div>','<div>','<input class="txt_disabled" type="text" name="url" disabled>','</div>','</td>','</tr>','</table>','</div>','<div>','<a href="javascript:void(0);">更多選擇</a>','</div>','</td>','</tr>','</table>','</td>','</tr>'].join(''),activate:function(tr1,preview){var inputCollection=tr1.getElementsByTagName("input");radioInteresting_el=inputCollection[0];radioRecent_el=inputCollection[1];radioTag_el=inputCollection[2];txtTag_el=inputCollection[3];radioUser_el=inputCollection[4];txtUser_el=inputCollection[5];radioUrl_el=inputCollection[6];txtUrl_el=inputCollection[7];inputCollection=null;var radio_onclick=function(){if(this!=radioTag_el){txtTag_el.disabled=true;txtTag_el.className='txt_disabled';}
if(this!=radioUser_el){txtUser_el.disabled=true;txtUser_el.className='txt_disabled';}
if(this!=radioUrl_el){txtUrl_el.disabled=true;txtUrl_el.className='txt_disabled';}
if(this==radioTag_el){txtTag_el.disabled=false;txtTag_el.className='txt_enabled';txtTag_el.focus();}
if(this==radioUser_el){txtUser_el.disabled=false;txtUser_el.className='txt_enabled';txtUser_el.focus();}
if(this==radioUrl_el){txtUrl_el.disabled=false;txtUrl_el.className='txt_enabled';txtUrl_el.focus();}};radioInteresting_el.onclick=radio_onclick;radioRecent_el.onclick=radio_onclick;radioTag_el.onclick=radio_onclick;radioUser_el.onclick=radio_onclick;radioUrl_el.onclick=radio_onclick;radio_onclick=null;var divCollection=tr1.getElementsByTagName("div");divMoreOptions_el=divCollection[0];divCollection=null;var anchorCollection=tr1.getElementsByTagName("A");tglMoreOptions_el=anchorCollection[0];tglMoreOptions_el.onclick=function(){switch(divMoreOptions_el.style.display){case'none':divMoreOptions_el.style.display='block';tglMoreOptions_el.innerHTML='更少選項';break;case'block':divMoreOptions_el.style.display='none';tglMoreOptions_el.innerHTML='更多選擇';break;default:break;}
return false;};anchorCollection=null;switch(obj[field].type){case'interesting':radioInteresting_el.checked=true;break;case'recent':radioRecent_el.checked=true;break;case'tag':tglMoreOptions_el.onclick();radioTag_el.checked=true;txtTag_el.value=obj[field].text;radioTag_el.onclick();break;case'user':tglMoreOptions_el.onclick();radioUser_el.checked=true;txtUser_el.value=obj[field].text;radioUser_el.onclick();break;case'url':tglMoreOptions_el.onclick();radioUrl_el.checked=true;txtUrl_el.value=obj[field].text;radioUrl_el.onclick();break;default:break;}
tr1=null;},submit:function(){var title='相片';if(radioInteresting_el.checked){obj[field]={type:radioInteresting_el.value,text:'interesting'};title='Flickr:有趣的照片';}
else if(radioRecent_el.checked){obj[field]={type:radioRecent_el.value,text:'recent'};title='Flickr: 最新的照片';}
else if(radioTag_el.checked){obj[field]={type:radioTag_el.value,text:txtTag_el.value};title='Flickr: 用'+txtTag_el.value+'標籤的照片';}
else if(radioUser_el.checked){obj[field]={type:radioUser_el.value,text:txtUser_el.value};title='Flickr: 會員 '+txtUser_el.value+' 的照片';}
else if(radioUrl_el.checked){obj[field]={type:radioUrl_el.value,text:txtUrl_el.value};title='Flickr: 照片';}
if(input.topTitle==1)return title;},deactivate:function(){radioInteresting_el.onclick=null;radioRecent_el.onclick=null;radioTag_el.onclick=null;radioUser_el.onclick=null;radioUrl_el.onclick=null;divMoreOptions_el.onclick=null;tglMoreOptions_el.onclick=null;radioInteresting_el=null;radioRecent_el=null;radioTag_el=null;radioUser_el=null;radioUrl_el=null;divMoreOptions_el=null;tglMoreOptions_el=null;txtTag_el=null;txtUser_el=null;txtUrl_el=null;}};return tmp;},selectPhotoDisplay:function(field,input,obj){var select_el;var txt_limit;var tmp={html:['<tr>','<td valign=top><label>'+'顯示'+':</label></td>','<td>','<table>','<tr>','<td>','<select name="display">','<option value="tiled">方塊</option>','<option value="single">單幅照片</option>','</select><br />','方塊數量','&nbsp;&nbsp;<input name="limit" size="6"/>','</td>','</tr>','</table>','</td>','</tr>'].join(''),activate:function(tr1,preview){select_el=tr1.getElementsByTagName("select")[0];txt_limit=tr1.getElementsByTagName('input')[0];select_el.onchange=function(){switch(select_el.value){case'tiled':txt_limit.disabled=false;break;case'single':txt_limit.value=9;txt_limit.disabled=true;break;default:}};select_el.value=obj[field].type;select_el.onchange();txt_limit.value=obj[field].limit;tr1=null;},submit:function(){obj[field]={type:select_el.value,limit:txt_limit.value};},deactivate:function(){select_el.onchange=null;select_el=null;txt_limit=null;html=null;}};return tmp;},editFeedSources:function(field,input,obj){var frmAdd;var txtInput;var btnAdd;var divMsg;var ulList;var items={count:0,ids:[],urls:[],titles:[],selected:'all'};var selector;var tmp={html:['<tr>','<td valign=top align=right><label>來源:</label></td>','<td valign="middle">','<form class="compact">','<div>','<input class="txtInput">','<button type="submit" class="btnAddSource">增加</button>','</div>','<div class="divMessage" style="overflow:hidden; text-overflow:ellipsis; border-bottom:1px solid #888">','</div>','<div><ul class="feedList" style="margin:0px;padding:0px 0px 0px 20px;">','</ul>','</div>','<div class="instruction">開始時請先將RSS的URL 打進系統, 然後用滑鼠按"增加".','</div>','</form>','</td>','</tr>'].join(''),activate:function(tr1,preview){this.tr1=tr1;selector=this;if(!obj[field]||!obj[field].count){obj[field]={count:0,ids:[],urls:[],titles:[],selected:'all'};}
if(!obj[field].selected){obj[field].selected='all';}
frmAdd=fc(tr1,'form')[0];txtInput=fc(tr1,'input',null,/txtInput/)[0];btnAdd=fc(tr1,'button',null,/btnAddSource/)[0];divMsg=fc(tr1,'div',null,/divMessage/)[0];ulList=fc(tr1,'ul',null,/feedList/)[0];txtInput.style.width=txtInput.parentNode.offsetWidth-btnAdd.offsetWidth-10+'px';var fnAddItem=function(id,url,title){if(items[id]){return;}
items.count++;items.ids.push(id);items.urls.push(url);items.titles.push(title);var elItem=cex('li',{});var elTitle=cex('span',{innerHTML:title,style:{'paddingRight':'5px'}});var elUrl=cex('div',{innerHTML:'<span style="color:#888;">'+url+'</span>',style:{"overflow":"hidden","textOverflow":"ellipsis"}});var elRemove=cex('span',{className:'link_span',innerHTML:'remove',style:{'paddingLeft':'5px','paddingRight':'5px','color':'blue'}});ulList.appendChild(elItem);elItem.appendChild(elTitle);elItem.appendChild(elRemove);elItem.appendChild(elUrl);elRemove.onclick=function(e){this.onclick=null;rn(this.parentNode);var ndx=indexOf(items.ids,id);if(ndx>=0){if(id==items.selected){items.selected='all';}
items.ids.splice(ndx,1);items.urls.splice(ndx,1);items.titles.splice(ndx,1);items.count--;divMsg.style.color='#0F0';divMsg.innerHTML=''+title+' 已刪除.';}
if(input.autopreview){if(preview)preview();};};elItem=null;elTitle=null;elUrl=null;elRemove=null;txtInput.value='';txtInput.focus();};for(var i=0;i<obj[field].count;i++){fnAddItem(obj[field].ids[i],obj[field].urls[i],obj[field].titles[i]);}
divMsg.innerHTML='已選擇'+items.count+' 個RSS';this.setStatus=function(msg,color){if(arguments.length==2){divMsg.style.color=color;}
divMsg.innerHTML=msg;};this.hasItem=function(url){for(var ndx in items.urls){if(new RegExp('^\s*'+items.urls[ndx]+'\s*$').test(url)){return true;}}
return false;};var verifyCallback=function(result){if(!txtInput||!btnAdd)return;txtInput.disabled=false;btnAdd.disabled=false;var resp=result.getResponse();if(resp.isException){divMsg.style.color='#F00';divMsg.innerHTML=resp.result;}
else{var jsResult=resp.result;var isValidUrl=jsResult.isValidUrl;if(isValidUrl){fnAddItem(jsResult.id,jsResult.url,jsResult.title);divMsg.style.color='#0F0';divMsg.innerHTML='已增加 "'+jsResult.url+'"<div>'+jsResult.html+'</div>';if(input.autopreview){if(preview)preview();};}
else{divMsg.style.color='#F00';divMsg.innerHTML='"'+jsResult.url+'" 是無效的.';}}};frmAdd.onsubmit=function(){var url=txtInput.value;url=url.replace(/^\s*(.*?)\s*$/,'$1');if(url.length==0){divMsg.style.color='#F00';divMsg.innerHTML='RSS來源不能空白';return false;}
if(selector.hasItem(url)){divMsg.style.color='#F00';divMsg.innerHTML='已經選擇了 "'+url+'"';return false;}
divMsg.style.color='';divMsg.innerHTML='請等侯…';var ajx=new AjxAction('iqube','verifyFeedUrl',{'url':url});ajx.setCallback(new AjxCallback(selector,verifyCallback));ajx.fire();return false;};var ac=new Iqube.RssAutoComplete(txtInput);ac.encodeItem=function(jsObj,strKey){var html='<div><em>'+jsObj.url+'</em><div>'+jsObj.name+'</div><div>'+jsObj.url+'</div></div>';var jsItem={'html':html,'match':false};return jsItem;};ac.onSelect=function(jsObj){txtInput.value=jsObj.url;};txtInput.m_ac=ac;tr1=null;ac=null;},submit:function(){obj[field]=items;},deactivate:function(){if(txtInput.m_fh)txtInput.m_fh.destruct();if(txtInput.m_ac)txtInput.m_ac.destruct();txtInput=null;btnAdd=null;divMsg=null;frmAdd.onsubmit=null;frmAdd=null;var spans=fc(ulList,'span',null,/link_span/);for(var i=0;i<spans.length;i++){spans[i].onclick=null;}
ulList=null;selector=null;this.tr1=null;}};return tmp;},selectLocation:function(field,input,obj){var radioProfile_el;var radioZipCode_el,txtZipCode_el;var radioAddress_el,txtAddress_el;var radioGeoCoor_el,txtLng_el,txtLat_el;var btnLocLookUp,frmLocLoopUp;var spanGeoCoor;var spanLocName;var bVerified=false;var initLocation;var tmp={html:['<tr>','<td valign=top><label>地址:</label></td>','<td>','<table>','<tr>','<td valign=top>','<input type="radio" checked value="myprofile" name="radioLocation">','</td>','<td>','從我的個人檔案中','</td>','</tr>','<tr>','<td valign=top>','<input type="radio" value="zipcode" name="radioLocation">','</td>','<td>','<div>','郵政編號','</div>','<div>','<input name="txtZipCode" type="text" class="txt_disabled" disabled="1">','</div>','</td>','</tr>','<tr>','<td valign=top>','<input type="radio" value="address" name="radioLocation">','</td>','<td>','<div>','地址 (例如; 九龍塘)','</div>','<div>','<input name="txtAddress" type="text" class="txt_disabled" disabled="1"><button name="btnLocLookUp" style="height:26px;width:75px;">尋找!</button>','</div>','<div>','GEO:<span name="spanGeoCoor"></span>','</div>','</td>','</tr>','<tr>','<td valign=top>','<input type="radio" value="lng_lat" name="radioLocation">','</td>','<td>','<div>','定制 GEO 座標<span name="spanLocName"></span>','</div>','<div><table>','<tr><td>經緯</td><td><input name="txtLatitude" size="11" type="text" class="txt_disabled" disabled="1"></td></tr>','<tr><td>經度</td><td><input name="txtLongtitude" size="11" type="text" class="txt_disabled" disabled="1"></td></tr>','</table></div>','</td>','</tr>','</table>','</td>','</tr>'].join(''),activate:function(tr1,preview){this.tr1=tr1;var arrRadios=fc(tr1,'input',{'name':'radioLocation','type':'radio'});radioProfile_el=arrRadios[0];radioZipCode_el=arrRadios[1];radioAddress_el=arrRadios[2];radioGeoCoor_el=arrRadios[3];arrRadios=null;txtZipCode_el=fc(tr1,'input',{'name':'txtZipCode'})[0];txtAddress_el=fc(tr1,'input',{'name':'txtAddress'})[0];txtLat_el=fc(tr1,'input',{'name':'txtLatitude'})[0];txtLng_el=fc(tr1,'input',{'name':'txtLongtitude'})[0];btnLocLookUp=fc(tr1,'button',{'name':'btnLocLookUp'})[0];spanGeoCoor=fc(tr1,'span',{name:'spanGeoCoor'})[0];spanLocName=fc(tr1,'span',{name:'spanLocName'})[0];txtAddress_el.onfocus=function(){this.select();};btnLocLookUp.hideFocus=1;btnLocLookUp.onclick=function(){verified=false;var ac=txtAddress_el.m_ac;if(!ac){ac=new Iqube.GeoLocAutoComplete(txtAddress_el);ac.onDataReturned=function(arrData,searchKey){btnLocLookUp.innerHTML='尋找!';};ac.encodeItem=function(jsObj,strKey){if(window._logReader)YAHOO.log(this+'.encodeItem: strKey = '+strKey+'; jsObj: '+JSON.stringify(jsObj,true));var html='<div><em>'+jsObj.name+'</em><div>'+jsObj.name+'</div><div>'+jsObj.lat+', '+jsObj.lng+'</div></div>';var jsItem={'html':html,'match':false};return jsItem;};ac.onSelect=function(jsObj){spanGeoCoor.innerHTML=jsObj.lat+', '+jsObj.lng;bVerified=true;};ac.bLazyMode=true;txtAddress_el.m_ac=ac;}
var imgSrc=Config.BASEPATH+'/portal/images/loading_text2.gif';btnLocLookUp.innerHTML='<img src="'+imgSrc+'"/>';ac.suggest(true);};var radio_onclick=function(){if(this!=radioZipCode_el){txtZipCode_el.disabled=true;txtZipCode_el.className='txt_disabled';}
if(this!=radioAddress_el){txtAddress_el.disabled=true;txtAddress_el.className='txt_disabled';}
if(this!=radioGeoCoor_el){txtLat_el.disabled=true;txtLng_el.disabled=true;txtLng_el.className='txt_disabled';txtLat_el.className='txt_disabled';}
if(this==radioZipCode_el){txtZipCode_el.disabled=false;txtZipCode_el.className='txt_enabled';txtZipCode_el.focus();}
if(this==radioAddress_el){txtAddress_el.disabled=false;txtAddress_el.className='txt_enabled';txtAddress_el.focus();}
if(this==radioGeoCoor_el){txtLat_el.disabled=false;txtLat_el.className='txt_enabeld';txtLng_el.disabled=false;txtLng_el.className='txt_enabeld';txtLng_el.focus();}};radioProfile_el.onclick=radio_onclick;radioZipCode_el.onclick=radio_onclick;radioAddress_el.onclick=radio_onclick;radioGeoCoor_el.onclick=radio_onclick;radio_onclick=null;initLocation=obj[field];switch(initLocation.sel){case"myprofile":radioProfile_el.checked=true;break;case"zipcode":radioZipCode_el.checked=true;txtZipCode_el.value=initLocation.text;radioZipCode_el.onclick();break;case"address":radioAddress_el.checked=true;txtAddress_el.value=initLocation.text;spanGeoCoor.innerHTML=initLocation.latitude+', '+initLocation.longitude;radioAddress_el.onclick();break;case'lng_lat':radioGeoCoor_el.checked=true;txtLat_el.value=initLocation.latitude;txtLng_el.value=initLocation.longitude;radioGeoCoor_el.onclick();break;}
tr1=null;},submit:function(){if(radioProfile_el.checked){obj[field]={sel:radioProfile_el.value,text:''};}
else if(radioZipCode_el.checked){obj[field]={sel:radioZipCode_el.value,text:txtZipCode_el.value};}
else if(radioAddress_el.checked){if(!bVerified){txtAddress_el.value=initLocation.text;spanGeoCoor.innerHTML=initLocation.latitude+', '+initLocation.longitude;}
var latlng=spanGeoCoor.innerHTML;if(latlng&&latlng.length>0){var arrWords=latlng.split(',');var lat=parseFloat(arrWords[0]);var lng=parseFloat(arrWords[1]);}
obj[field]={sel:radioAddress_el.value,text:txtAddress_el.value,latitude:lat,longitude:lng,verified:true};}
else if(radioGeoCoor_el.checked){obj[field]={sel:radioGeoCoor_el.value,text:'',latitude:txtLat_el.value,longitude:txtLng_el.value};}},deactivate:function(){if(txtAddress_el.m_ac){txtAddress_el.m_ac.destruct();}
txtAddress_el.m_ac=null;txtAddress_el.onfocus=null;radioProfile_el.onclick=null;radioZipCode_el.onclick=null;radioAddress_el.onclick=null;radioGeoCoor_el.onclick=null;radioProfile_el=null;radioZipCode_el=null;radioAddress_el=null;radioGeoCoor_el=null;txtZipCode_el=null;txtAddress_el=null;txtLat_el=null;txtLng_el=null;btnLocLookUp.onclick=null;btnLocLookUp=null;html=null;spanGeoCoor=null;spanLocName=null;this.tr1=null;}};return tmp;},basicSelect:function(field,input,obj){var tmp={html:'<tr>'+'<td nowrap><label>'+input.title+'</label></td>'+'<td align="left">'+'<select name="select">'+'</select>'+'</td>'+'</tr>',activate:function(tr1,preview){this.tr1=tr1;this.elSelect=fc(this.tr1,'select')[0];var options=input.options;if(options){for(var value in options){var label=options[value];this.elSelect.options[this.elSelect.options.length]=new Option(label,value);}}
this.elSelect.value=obj[field];if(input.autopreview&&preview){this.elSelect.onchange=function(e){preview();};}
tr1=null;},submit:function(){obj[field]=this.elSelect.value;},deactivate:function(){this.tr1=null;this.elSelect.onchange=null;this.elSelect=null;html=null;}};return tmp;},multiSelect:function(field,input,obj){var tmp={html:'<tr>'+'<td nowrap><label>'+input.title+'</label></td>'+'<td align="left" name="container">'+'</td>'+'</tr>',activate:function(tr1,preview){this.tr1=tr1;this.container=fc(this.tr1,"td",{name:"container"},null,true);this.items=[];var options=input.options;if(options){for(var value in options){var label=options[value];var item=cex("span",{innerHTML:'<input type="checkbox" value="'+value+'"/>'+label,style:{whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden"}});ac(this.container,item);this.items.push(fc(item,"input")[0]);item=null;}}
var value=obj[field];for(var i=0;i<value.length;i++){for(var j=0;j<this.items.length;j++){if(this.items[j].value==(value[i]).toString()){this.items[j].checked=true;}}}
tr1=null;},submit:function(){var value=[];for(var i=0;i<this.items.length;i++){if(this.items[i].checked){value.push(this.items[i].value);}}
obj[field]=value;},deactivate:function(){this.tr1=null;this.container=null;this.items=null;html=null;}};return tmp;},selectAlbumDisplay:function(field,input,obj){var tmp={html:'<tr>'+'<td nowrap><label>顯示:</label></td>'+'<td align="left">'+'<select name="selMode">'+'<option value="tile">方塊'+'<option value="scroller">捲動式'+'<option value="browse">瀏覽'+'<option value="slideshow">幻燈片展示'+'</select> '+'<span style="padding:0px 5px;font-weight:bold;white-space:nowrap;">窗口:'+'<select name="selWindow">'+'</select></span>'+'<span style="padding:0px 5px;font-weight:bold;white-space:nowrap;">闊度:'+'<select name="selWidth">'+'</select></span>'+'</td>'+'</tr>',activate:function(tr1,preview){this.tr1=tr1;var sels=fc(this.tr1,'select');this.selMode=sels[0];this.selWindow=sels[1];this.selWidth=sels[2];sels=null;this.selMode.value=obj[field].mode||'browser';for(var i=3;i<=15;i++){this.selWindow.options.add(new Option(i,i));}
this.selWindow.value=obj[field].window||this.selWindow.options[0].value;this.selWindow.onchange=function(e){if(preview)preview();};this.selMode.onchange=function(e,nopreview){this.selWindow.disabled=(this.selMode.value=='slideshow'||this.selMode.value=='tile');this.selWidth.disabled=(this.selMode.value!='slideshow');if(!nopreview&&preview)preview();}.bind(this);this.selWidth.options.add(new Option(300,300));this.selWidth.options.add(new Option(400,400));this.selWidth.options.add(new Option(500,500));this.selWidth.value=obj[field].width||this.selWidth.options[0].value;this.selWidth.onchange=function(e){if(preview)preview();};this.selMode.onchange(false,true);tr1=null;},submit:function(){obj[field]={mode:this.selMode.value,window:this.selWindow.value,width:this.selWidth.value};},deactivate:function(){this.tr1=null;this.selWidth.onchange=this.selMode.onchange=this.selWindow.onchange=null;this.selWidth=this.selMode=this.selWindow=null;html=null;}};return tmp;},selectPostType:function(field,input,obj){var tmp={html:'<tr>'+'<td nowrap valign="top"><label>內容:</label></td>'+'<td align="left">'+
((!input||input.indexOf('1')>=0)?'<input type="checkbox" value="1"/>'+Post.TypeNames[1]:'')+
((!input||input.indexOf('2')>=0)?'<input type="checkbox" value="2"/>'+Post.TypeNames[2]:'')+
((!input||input.indexOf('3')>=0)?'<input type="checkbox" value="3"/>'+Post.TypeNames[3]:'')+
((!input||input.indexOf('4')>=0)?'<input type="checkbox" value="4"/>'+Post.TypeNames[4]:'')+
((!input||input.indexOf('6')>=0)?'<input type="checkbox" value="6"/>'+Post.TypeNames[Post.TYPE_RECORD]:'')+
((!input||input.indexOf('7')>=0)?'<input type="checkbox" value="7"/>'+Post.TypeNames[Post.TYPE_BBSMSG]:'')+'<div class="instruction">須要包括內容的類型. 如不挑選將包含所有類型.</div>'+'</td>'+'</tr>',activate:function(tr1){this.tr1=tr1;this.arrChecks=fc(this.tr1,'input',{type:'checkbox'});var values=[];if(obj[field]){values=obj[field].split(',');}
for(var i=0;i<this.arrChecks.length;i++){for(var j=0;j<values.length;j++){if(this.arrChecks[i].value==values[j]){this.arrChecks[i].checked=true;}}}
tr1=null;},submit:function(){var values=[];var all=[];for(var i=0;i<this.arrChecks.length;i++){if(this.arrChecks[i].checked){values.push(this.arrChecks[i].value);}
all.push(this.arrChecks[i].value);}
if(values.length==0)values=all;obj[field]=values.join(',');},deactivate:function(){this.tr1=null;this.arrChecks=null;html=null;}};return tmp;},selectBoolean:function(field,input,obj){var input1;var tmp={html:'<tr>'+'<td nowrap><label>'+input.header+'</label></td>'+'<td align="left"><input type="checkbox" />'+input.message+'</td>'+'</tr>',activate:function(tr1){input1=tr1.childNodes[1].firstChild;if(obj[field]=='true'){input1.checked=true;}
tr1=null;},submit:function(){obj[field]=input1.checked?'true':'false';},deactivate:function(){input1=null;html=null;}};return tmp;},resetEntry:function(field,input,obj){var selReset=null;var tmp={html:['<tr>','<td><label>'+input.title+':</label></td>','<td>','<select name="selResetEntry">','<option value="keep">'+input.text_keep+'</option>','<option value="reset">'+input.text_reset+'</option>','</select>','</td>','</tr>'].join(''),activate:function(tr1,preview){selReset=fc(tr1,'select',{'name':'selResetEntry'})[0];if(obj[field]==input['default']){selReset.options[1].selected=true;}
else{selReset.options[0].selected=true;}
selReset.onchange=function(e){if(preview&&input.autopreview){preview();}};tr1=null;},submit:function(){switch(selReset.value){case'reset':obj[field]=input['default'];break;default:obj[field]=obj[field];}},deactivate:function(){selReset.onchange=null;selReset=null;html=null;}};return tmp;},selectAlbumId:function(field,input,obj){var selectAlbum=null;var selectAllow=null;var selectLinks=null;var tmp={html:['<tr>','<td valign="top"><label>相簿:</label></td>','<td>','<select name="selectAlbum" value="all">','<option value="">最新的</option>','</select> ','<span style="padding:0px 5px;font-weight:bold;white-space: nowrap;">允許選擇:','<select name="selectAllow">','<option value="yes">是</option>','<option value="no">否</option>','</select></span> ','<span style="padding:0px 5px;font-weight:bold;white-space: nowrap;">展示所有動作的鏈按:','<select name="selectLinks">','<option value="yes">是</option>','<option value="no">否</option>','</select></span>','<div class="instruction">','<div>1) 要顯示的相簿</div>','<div>2) 是否允許訪客查看其他相簿</div>','<div>3) 是否允許觀看/編輯所有顯示的鍵接</div>','</div>','</td>','</tr>'].join(''),activate:function(tr1,preview){selectAlbum=fc(tr1,'select',{'name':'selectAlbum'},null,true);selectAllow=fc(tr1,'select',{'name':'selectAllow'},null,true);selectLinks=fc(tr1,'select',{'name':'selectLinks'},null,true);selectAlbum.options[1]=new Option("Selected Album","selected");if(obj[field].albumId){selectAlbum.options[1].selected=true;}
if(obj[field].allow=='yes'){selectAllow.options[0].selected=true;}
else{selectAllow.options[1].selected=true;}
if(obj[field].link=='yes'){selectLinks.options[0].selected=true;}
else{selectLinks.options[1].selected=true;}
selectAllow.onchange=selectLinks.onchange=function(e){if(preview)preview();};tr1=null;},submit:function(){obj[field]={albumId:selectAlbum.value=="selected"?obj[field].albumId:"",allow:selectAllow.value,link:selectLinks.value};},deactivate:function(){selectAllow.onchange=null;selectLinks.onchange=null;selectAlbum=null;selectAllow=null;selectLinks=null;html=null;}};return tmp;},selectMapDisplay:function(field,input,obj){var selectMapType_el;var selectMapZoom_el;var tmp={html:['<tr>','<td valign=top><label>'+'顯示'+':</label></td>','<td>','<table>','<tr>','<td valign="top">','地圖類型:','</td>','<td>','<select name="google_map_type">','<option value="0">地圖</option>','<option value="1">衛星圖</option>','<option value="2">混合</option>','</select>','</td>','</tr>','<tr>','<td valign="top">','拉近等級:','</td>','<td>','<select name="google_map_zoom">','<option value="0">0(最遠的)</option>','<option value="1">1</option>','<option value="2">2</option>','<option value="3">3</option>','<option value="4">4</option>','<option value="5">5</option>','<option value="6">6</option>','<option value="7">7</option>','<option value="8">8(中間的)</option>','<option value="9">9</option>','<option value="10">10</option>','<option value="11">11</option>','<option value="12">12</option>','<option value="13">13</option>','<option value="14">14</option>','<option value="15">15</option>','<option value="16">16</option>','<option value="17">17(最近的)</option>','</select>','<div class="instruction">拉近等級越大, 距離越接近</div>','</td>','</tr>','</table>','</td>','</tr>'].join(''),activate:function(tr1,preview){var selects=tr1.getElementsByTagName("select");selectMapType_el=selects[0];selectMapZoom_el=selects[1];selectMapType_el.value=obj[field].type;selectMapZoom_el.value=obj[field].zoom;tr1=null;},submit:function(){obj[field]={type:selectMapType_el.value,zoom:selectMapZoom_el.value};},deactivate:function(){selectMapType_el=null;selectMapZoom_el=null;html=null;}};return tmp;}};var Class={create:function(){return function(){this.initialize.apply(this,arguments);}}};Object.extend=function(destination,source,property_list){if(source){if(property_list){for(var i=0;i<property_list.length;i++){if(typeof(source[property_list[i]])=="undefined")continue;destination[property_list[i]]=source[property_list[i]];}}
else{for(property in source){destination[property]=source[property];}}}
return destination;};var $A=Array.from=function(iterable){if(!iterable)return[];if(iterable.toArray){return iterable.toArray();}else{var results=[];for(var i=0,length=iterable.length;i<length;i++)
results.push(iterable[i]);return results;}};Function.prototype.bind=function(object){var __method=this,args=$A(arguments),object=args.shift();return function(){return __method.apply(object,args.concat($A(arguments)));}};function $(){var elements=[];for(var i=0;i<arguments.length;i++){var element=arguments[i];if(typeof element=='string')
element=document.getElementById(element);if(arguments.length==1)
return element;elements.push(element);}
return elements;};document.getElementsByClassName=function(className){var children=document.getElementsByTagName('*')||document.all;var elements=[];for(var i=0;i<children.length;i++){var child=children[i];var classNames=child.className.split(' ');for(var j=0;j<classNames.length;j++){if(classNames[j]==className){elements.push(child);break;}}}
return elements;};if(!window.Element){var Element={};}
Object.extend(Element,{remove:function(element){element=$(element);element.parentNode.removeChild(element);},hasClassName:function(element,className){element=$(element);if(!element)
return;var a=element.className.split(' ');for(var i=0;i<a.length;i++){if(a[i]==className)
return true;}
return false;},replaceClassName:function(element,delClassName,addClassName){element=$(element);if(!element)
return;var cn='';var a=element.className.split(' ');if(delClassName!=''){for(var i=0;i<a.length;i++){if((delClassName.constructor!=RegExp&&a[i]!=delClassName)||(delClassName.constructor==RegExp&&delClassName.test(a[i])==false)){if(i>0)
cn+=' ';cn+=a[i];}}}else{cn=element.className;}
if(addClassName!=''){if(cn=='')cn=addClassName;else if(addClassName!='')cn+=' '+addClassName;}
element.className=cn;},cleanWhitespace:function(element){element=$(element);for(var i=0;i<element.childNodes.length;i++){var node=element.childNodes[i];if(node.nodeType==3&&!/\S/.test(node.nodeValue))
Element.remove(node);}}});var fx=new Object();fx.Base=function(){};fx.Base.prototype={setOptions:function(options){this.options={duration:500,onComplete:'',transition:fx.sinoidal}
Object.extend(this.options,(arguments.length==1)?options:new Object());},go:function(){this.startTime=(new Date).getTime();this.timer=setInterval(this.step.bind(this),13);},step:function(){var time=(new Date).getTime();if(time>=this.options.duration+this.startTime){this.now=this.to;clearInterval(this.timer);this.timer=null;if(this.options.onComplete)setTimeout(this.options.onComplete.bind(this),10);}
else{var Tpos=(time-this.startTime)/(this.options.duration);this.now=this.options.transition(Tpos)*(this.to-this.from)+this.from;}
this.increase();},custom:function(from,to){if(this.timer!=null)return;this.from=from;this.to=to;this.go();},hide:function(){this.now=0;this.increase();},clearTimer:function(){clearInterval(this.timer);this.timer=null;},again:function(options){if(this.timer)this.clearTimer();this.initialize(this.el,options);}}
fx.Push=Class.create();fx.Push.prototype=Object.extend(new fx.Base(),{initialize:function(el,options){this.el=$(el);this.el.style.overflow="hidden";this.setOptions(options);},increase:function(){if(this.edge=='left'||this.edge=='right'){this.el.style.width=this.now+'px';}else{this.el.style.height=this.now+'px';}
this.el.childNodes[this.child].style['margin'+this.edge.ucfirst()]=(this.to>this.from?this.now-this.to:this.now-this.from)+'px';if(this.now==this.to){this.el.style.overflow='';}},push:function(from,to,edge,child){this.edge=edge;this.child=child||0;this.custom(from,to);}});fx.Custom=Class.create();fx.Custom.prototype=Object.extend(new fx.Base(),{initialize:function(el,options){this.el=$(el);this.setOptions(options);var x=this.options.fields;for(var prop in x){if(typeof x[prop].from=='undefined'){x[prop].from=parseInt(this.el.style[prop])||0;}}},increase:function(){var x=this.options.fields;for(var prop in x){this.el.style[prop]=x[prop].from+(x[prop].to-x[prop].from)*this.now+x[prop].unit;}}});fx.ScrollIntoView=Class.create();fx.ScrollIntoView.prototype=Object.extend(new fx.Base(),{initialize:function(el,options){this.el=$(el);this.setOptions(options);},increase:function(){document.documentElement.scrollTop=this.now;},start:function(){var xy=getXY(this.el);var vph=YuDom.getViewportHeight();var scrollTop=document.documentElement.scrollTop;if(xy.y<scrollTop||vph+scrollTop<xy.y){this.options.padding=this.options.padding||0;this.custom(scrollTop,xy.y>this.options.padding?xy.y-this.options.padding:0);}else{var h=this.el.offsetHeight;if(h+xy.y>scrollTop+vph){this.custom(scrollTop,h+this.options.padding*2>vph?xy.y-this.options.padding:xy.y+h+this.options.paddings-vph);}else{if(this.options.onComplete)setTimeout(this.options.onComplete.bind(this),10);}}}});fx.Layout=Class.create();fx.Layout.prototype=Object.extend(new fx.Base(),{initialize:function(el,options){this.el=$(el);this.el.style.overflow="hidden";this.el.iniWidth=this.el.offsetWidth;this.el.iniHeight=this.el.offsetHeight;this.setOptions(options);}});fx.Height=Class.create();Object.extend(Object.extend(fx.Height.prototype,fx.Layout.prototype),{increase:function(){this.el.style.height=this.now+"px";if(this.options.up)this.el.style.marginTop=-this.now+(this.options.margin||0)+'px';if(this.now==this.to){this.el.style.overflow='';if(this.to==0)this.el.style.display='none';if(this.resetHeight)this.el.style.height='';}},toggle:function(){if(this.el.offsetHeight>0)this.custom(this.el.offsetHeight,0);else this.custom(0,this.el.scrollHeight);},expand:function(html){var element=this.el;var display=element.style.display;if(display=='block'||display==''){var origHeight=element.offsetHeight;}else{var origHeight=0;}
element.style.display="block";element.style.height=origHeight+'px';element.style.marginTop=(this.options.margin||0)+'px';if(html)element.innerHTML=html;this.resetHeight=true;this.custom(origHeight,element.scrollHeight);}});fx.Replace=Class.create();Object.extend(Object.extend(fx.Replace.prototype,fx.Layout.prototype),{phase:1,html:'',increase:function(){if(this.phase==1){this.el.style.height=this.height*this.now+"px";this.el.style.marginTop=this.height*(this.now-1)+"px";}else{var height=this.el.scrollHeight;this.el.style.height=height*this.now+"px";this.el.style.marginTop=height*(this.now-1)+"px";if(!this.resetParHeight)this.el.parentNode.style.height=this.origParHeight+(height-this.height)*this.now+'px';}
if(this.now==this.to){if(this.phase==1){this.phase=2;this.el.innerHTML=this.html;this.options.onComplete=this.phase2OnComplete;this.phase2OnComplete=null;this.custom(0,1);}else{this.el.style.overflow='';this.el.style.marginTop='';if(!this.resetParHeight)this.el.parentNode.style.height='';if(!this.resetHeight)this.el.style.height='';}}},replace:function(html){this.html=html;this.resetHeight=parseInt(this.el.style.height);this.resetParHeight=parseInt(this.el.parentNode.style.height);this.padding=parseInt(YuDom.getStyle(this.el.parentNode,'padding-top'))+parseInt(YuDom.getStyle(this.el.parentNode,'padding-bottom'));this.origParHeight=this.resetParHeight||(this.el.parentNode.offsetHeight-this.padding);this.el.parentNode.style.height=this.origParHeight+'px';this.height=this.el.offsetHeight;this.phase2OnComplete=this.options.onComplete;this.options.onComplete=null;this.custom(1,0);}});fx.Width=Class.create();Object.extend(Object.extend(fx.Width.prototype,fx.Layout.prototype),{increase:function(){this.el.style.width=this.now+"px";},toggle:function(){if(this.el.offsetWidth>0)this.custom(this.el.offsetWidth,0);else this.custom(0,this.el.iniWidth);}});fx.Opacity=Class.create();fx.Opacity.prototype=Object.extend(new fx.Base(),{initialize:function(el,options){this.el=el;this.now=1;this.setOptions(options);},single:function(el){if(ie){el.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+parseInt(this.now*100)+")";}else{el.style.MozOpacity=this.now;el.style.opacity=this.now;}
if(this.now==0){el.style.visibility="hidden";if(ie)el.style.filter='none';}else if(this.now>=0.9999){if(ie)el.style.filter='none';}else el.style.visibility="visible";},increase:function(){if(this.now==1&&mz)this.now=0.9999;if(this.el.constructor==Array){for(var i in this.el){this.single(this.el[i]);}}else{this.single(this.el);}},toggle:function(){if(this.now>0)this.custom(1,0);else this.custom(0,1);}});fx.Slide=Class.create();fx.Slide.prototype=Object.extend(new fx.Base(),{initialize:function(el,options,adjust){this.el=el;this.el.style.position='absolute';this.fromxy=getXY(this.el);this.now=1;this.setOptions(options);var defaultAdjust={x:0,y:0};this.adjust=adjust||defaultAdjust;},increase:function(){if(this.now==1)this.now=0.9999;this.el.style.left=(this.toxy.x-this.fromxy.x)*this.now+this.fromxy.x+this.adjust.x+'px';this.el.style.top=(this.toxy.y-this.fromxy.y)*this.now+this.fromxy.y+this.adjust.y+'px';},slide:function(to,from){this.toxy=to;if(from)this.fromxy=from;this.custom(0,1);}});fx.Combo=Class.create();fx.Combo.prototype={setOptions:function(options){this.options={opacity:true,height:true,width:false}
Object.extend(this.options,(arguments.length==1)?options:new Object());},onComplete:function(){var _this=this.el.combo;_this.comboCount--;if(!_this.comboCount){_this.el.o=null;_this.el.h=null;_this.el.w=null;_this.el.combo=null;_this.savedOnComplete();_this.savedOnComplete=null}},initialize:function(el,options){this.el=$(el);this.setOptions(options);this.comboCount=0;this.savedOnComplete=options.onComplete;options.onComplete=this.onComplete;if(this.options.opacity){this.el.o=new fx.Opacity(el,options);this.comboCount++;}
if(this.options.height){this.el.h=new fx.Height(el,options);this.comboCount++;}
if(this.options.width){this.el.w=new fx.Width(el,options);this.comboCount++;}
this.el.combo=this;},toggle:function(){this.checkExec('toggle');},hide:function(){this.checkExec('hide');},clearTimer:function(){this.checkExec('clearTimer');},checkExec:function(func){if(this.el.o)this.el.o[func]();if(this.el.h)this.el.h[func]();if(this.el.w)this.el.w[func]();},resizeTo:function(hto,wto){if(this.el.h&&this.el.w){this.h.custom(this.el.offsetHeight,this.el.offsetHeight+hto);this.w.custom(this.el.offsetWidth,this.el.offsetWidth+wto);}},customSize:function(hto,wto){if(this.el.h&&this.el.w){this.h.custom(this.el.offsetHeight,hto);this.w.custom(this.el.offsetWidth,wto);}}}
fx.sinoidal=function(pos){return((-Math.cos(pos*Math.PI)/2)+0.5);}
fx.linear=function(pos){return pos;}
fx.cubic=function(pos){return Math.pow(pos,3);}
fx.circ=function(pos){return Math.sqrt(pos);}
document.iframeLoaders={};iframe=Class.create();iframe.prototype={initialize:function(options){if(!options)options={};this.uniqueId=new Date().getTime();this.transport=this.getTransport();this.onComplete=options.onComplete||null;this.update=(options.update&&$(options.update))||null;this.title=(options.title&&$(options.title))||null;document.iframeLoaders[this.uniqueId]=this;},submit:function(form)
{form.target='frame_'+this.uniqueId;},load:function(url)
{this.transport.firstChild.src=url;},onStateChange:function(){try{var doc=this.transport.firstChild.contentDocument.document||this.transport.firstChild.contentDocument;var html=doc.body.innerHTML;var title=doc.title;doc.close();}
catch(e){log("this.onStateChange exception");try{var html=this.transport.firstChild.contentWindow.document.body.innerHTML;var title=this.transport.firstChild.contentWindow.document.title;this.transport.firstChild.contentWindow.document.close();}
catch(e){try{var html=this.transport.firstChild.document.body.innerHTML;var title=this.transport.firstChild.document.title;this.transport.firstChild.document.body.close();}
catch(e){try{var html=window.frames['frame_'+this.uniqueId].document.body.innerText;var title=window.frames['frame_'+this.uniqueId].document.title;}
catch(e){}}}}
if(this.onComplete){setTimeout(function(){this.onComplete(html,this.update,title,this.title);this.onComplete=null;}.bind(this),10);}else if(this.update||this.title){setTimeout(function(){if(this.update){this.update.innerHTML=html;this.update=null;}
if(this.title){this.title.innerHTML=title;this.title=null;}}.bind(this),10);}
document.iframeLoaders[this.uniqueId]=null;this.transport.firstChild.onload=null;rn(this.transport);this.transport=null;},getTransport:function()
{var divElm=document.createElement('DIV');divElm.style.position="absolute";divElm.style.top="0";divElm.style.marginLeft="-10000px";if(navigator.userAgent.indexOf('MSIE')>0&&navigator.userAgent.indexOf('Opera')==-1){divElm.innerHTML='<iframe name=\"frame_'+this.uniqueId+'\" id=\"frame_'+this.uniqueId+'\" src=\"about:blank\" onload=\"setTimeout(function(){document.iframeLoaders['+this.uniqueId+'].onStateChange()},20);"></iframe>';}else{var frame=document.createElement("iframe");frame.setAttribute("name","frame_"+this.uniqueId);frame.setAttribute("id","frame_"+this.uniqueId);frame.addEventListener("load",function(){this.onStateChange();}.bind(this),false);divElm.appendChild(frame);}
document.getElementsByTagName("body").item(0).appendChild(divElm);return divElm;}};var Toolbar={menus:null,ie6:false,ie7:false,activate:function(){if(!Toolbar.menus){History.init();DesignBar.init();MsgBar.init();MsgCorner.init();BubbleTooltip.init();ImgFadeIn.init();PortalMenu.init();ClickHandler.activate();if($('wizard-div')){PkgMan.load("Iqube.SetupWizard",function(){window.wizard=new Iqube.SetupWizard($('wizard-div'));window.wizard.activate();});}else if($('tipoftheday')){StartTipoftheday.apply($('tipoftheday'));}
if($('showTipoftheday'))$('showTipoftheday').onclick=StartTipoftheday;if($("showTutorial"))$("showTutorial").onclick=StartTutorial;var ietest=ge('ietest');if(ietest&&ietest.firstChild){if(ietest.firstChild.name=='ie6')this.ie6=true;if(ietest.firstChild.name=='ie7')this.ie7=true;}
if(ietest)rn(ietest);ietest=null;if(this.ie6){(function(){try{document.execCommand("BackgroundImageCache",false,true)}catch(oh){};})();}
Toolbar.menus=[];var banner=ge('banner');var menus=fc(banner,'li',null,/\brealmenu\b/);for(var i=0;i<menus.length;i++){var menu=new Menu(menus[i]);menu.activate();Toolbar.menus.push(menu);}
banner.oncontextmenu=function(){if(window._logReader){YAHOO.log(JSON.stringify(gPortalC,true,2),'DBG','PortalC');YAHOO.log(JSON.stringify(gPortalC.portals[Current.url],true,3),'DBG','Portal');}}
menu=null;banner=null;menus=null;if($("showHelp"))
$("showHelp").onclick=Iqube.Util.Help2.showHelp.bind(Iqube.Util.Help2,$("showHelp").getAttribute("helpStart"));if($("showWizard")&&!window.wizard){$("showWizard").onclick=function(){PkgMan.load("Iqube.SetupWizard",function(){window.wizard=Iqube.SetupWizard.createWizard();window.wizard.activate();});return false;};}
var contextbar=$('contextbar');var elsearchbox=$('ID_GLOBAL_SEARCH');if(elsearchbox){PkgMan.load("Iqube.Util.SiteSearchBox",function(){var elsearchbox=$('ID_GLOBAL_SEARCH');window.searchbox=new Iqube.Util.SiteSearchBox(elsearchbox);elsearchbox=null;window.searchbox.activate();});}
elsearchbox=null;if($("edit-Mobile2")){$("edit-Mobile2").onclick=function(e){PkgMan.load("Iqube.PortletPopup",function(){var options={header:"編輯手機版主頁",events:{"saved":function(){window.editMobile2.hide();window.editMobile2.deactivate();window.editMobile2=null;},"cancelled":function(){window.editMobile2.hide();window.editMobile2.deactivate();window.editMobile2=null;}},close:false,btnOK:false,btnCancel:true,width:'666px'};window.editMobile2=new Iqube.PortletPopup(3700,gPortalC.groupid,options);window.editMobile2.activate();window.editMobile2.show();});return false;}}
var top_title=(Alias.homegroupid==gPortalC.groupid)&&$('top_title');if(top_title){top_title.style.cursor='pointer';top_title.setAttribute('title','修改網誌標題');top_title.onclick=function(){var cup=new ConfirmUrlProcess();var process=new Process();cup.encode('',{action:'blogprofileedit'});process.dispatch(cup);}}
YuEvent.addListener(window,'unload',this.deactivate,this);}},deactivate:function(e){if(window.wizard){wizard.deactivate();wizard=null;}
if($('showTipoftheday'))$('showTipoftheday').onclick=null;if($('showTutorial'))$('showTutorial').onclick=null;if(window.searchbox){searchbox.deactivate90;searchbox=null;}
for(var i=0;i<Toolbar.menus.length;i++){Toolbar.menus[i].deactivate();Toolbar.menus[i]=null;}
Toolbar.menus=null;History.deactivate();DesignBar.deactivate();MsgBar.deactivate();MsgCorner.deactivate();BubbleTooltip.deactivate();ImgFadeIn.deactivate();PortalMenu.deactivate();ClickHandler.deactivate();if(!e||e.type!='unload'){YuEvent.removeListener(window,'unload',this.deactivate);}
if($("showHelp"))$("showHelp").onclick=null;if($("showWizard"))$("showWizard").onclick=null;Iqube.Util.Help2.deactivate();var top_title=$('top_title');if(top_title){top_title.onclick=null;}
top_title=null;window.GUnload&&window.GUnload();},refresh:function(){DesignBar.refresh();}}
var CommMenu={imgOn:'',imgOff:'',init:function(){this.initialize();this.activate();},initialize:function(){this.imgPath=Config.BASEPATH+'/portal/images/communitymenu';this.imgOnUrl=this.imgPath+'/CommunityMenu_09.gif';this.imgOffUrl=this.imgPath+'/CommunityMenu_11.gif';this.elRoot=cex('div',{className:'MenuContainer',m_minWidth:9,style:{width:'9px',height:"auto"}});this.elRoot.setAttribute('helptoken',"contextmenu");ac(this.elRoot);this.elRoot.innerHTML=['<div style="width:205px;">',' <div name="IconToggle" unselectable="on" style="width:12px; cursor:pointer; -moz-user-select:none; position:absolute; left:0;"></div>',' <div name="IconPane" style="margin-left:10px;border:1px solid #aaa;padding:5px;background:#fff;">','  <div name="userlink_container" style="margin:5px 0px;">','   <div name="userlinkhead" style="font-weight:bold;background:#888;color:white;padding:3px">我的書簽</div>','   <div name="AddLink" style="cursor:pointer;font-weight:900;padding:2px 0px;color:#FF0000;">加到我的書簽</div>','   <div name="userlinkpane"><img src="'+Config.BASEPATH+'/portal/images/loading.gif" /></div>','  </div>',' </div>','</div>'].join('');this.elIconToggle=fc(this.elRoot,"div",{name:"IconToggle"},null,true);this.elIconPane=fc(this.elRoot,"div",{name:"IconPane"},null,true);this.elUserICon=fc(this.elIconPane,"div",{name:"userlink_container"},null,true);this.elUserIPane=fc(this.elUserICon,"div",{name:"userlinkpane"},null,true);this.lnkAddLink=fc(this.elUserICon,"div",{name:"AddLink"},null,true);this.oLinks={};this.syslinks=[];this.elIconToggle.innerHTML='<img class="ToggleImg" src="'+this.imgOffUrl+'"/>';this.elToggleImg=this.elIconToggle.firstChild;this.elRoot.menuController=this;},createLink:function(url,options){var text=options.text;var img=options.img;var inner=null;if(img){inner=cex("span",{innerHTML:'<img src="'+img+'" align="absmiddle" alt="'+text+'"/><span class="separator3"/>'+text});}
else{inner=cex("span",{innerHTML:text});}
var a=cex('a',{href:url,className:'LinkItem',unselectable:'on',m_url:url,m_name:text,style:{display:"block",padding:"1px 0px"}});if(options.del){var del=cex("span",{name:"DelLink",style:{cursor:"pointer"},innerHTML:"[x]",title:"刪除這捷徑"});del.setAttribute("name",del.name);ac(a,del);}
if(options.updn){var up=cex("span",{name:"UpLink",style:{color:"blue",cursor:"pointer"},innerHTML:"[&uarr;]",title:"將這個捷徑向上移"});up.setAttribute("name",up.name);var dn=cex("span",{name:"DnLink",style:{color:"blue",cursor:"pointer"},innerHTML:"[&darr;]",title:"將這個捷徑向下移"});dn.setAttribute("name",dn.name);ac(a,dn);ac(a,up);}
if(a.firstChild){ac(a,cex("span",{className:"separator2"}));}
ac(a,inner);return a;},activate:function(){if(this.activated)return;Dispatch.hook(this.elIconPane);this.elIconToggle.onclick=function(e){this.m_ma.deactivateTarget();}.bind(this);this.minPaneWidth=this.elRoot.m_minWidth;this.maxPaneWidth=200;this.m_ma=new MouseActivator(this.elIconToggle,this.elIconPane);this.m_ma.setDeactivateDelay(500);this.m_ma.setState('deactivated');this.m_ma.onActivate=(function(){this.showIconPane();if(!this._shortcutLoaded){var ajx=new AjxAction('iqube','getShortcuts');ajx.setCallback(this._getShortcutsCallback,this);ajx.fire();}}).bind(this);this.m_ma.onDeactivate=(function(){this.hideIconPane();}).bind(this);this.m_ma.activate();this.activated=true;this.lnkAddLink.onmouseover=this.lnkmouseover.bind(this);this.lnkAddLink.onmouseout=this.lnkmouseout.bind(this);this.lnkAddLink.onclick=this.addCurrentPage.bind(this);this._shortcutLoaded=false;},lnkmouseover:function(){this.lnkAddLink.style.backgroundColor="#FFFF00";},lnkmouseout:function(){this.lnkAddLink.style.backgroundColor="";},deactivate:function(){if(this.m_ma){this.m_ma.deactivate();}
Dispatch.unHook(this.elIconPane);this.elIconToggle.onclick='';if(this.hideFx){this.onShowComplete();this.hideFx.clearTimer();this.hideFx=null;}
if(this.showFx){this.onHideComplete();this.showFx.clearTimer();this.showFx=null;}
this.elRoot.menuController=null;this.elIconToggle=null;this.elToggleImg=null;this.elIconPane=null;this.elUserICon=null;this.elUserIPane=null;this.elRoot=null;for(var i=0;i<this.syslinks.length;i++){this.syslinks[i].onclick=null;}
this.syslinks=null;this.activated=false;this.lnkAddLink.onmouseover=null;this.lnkAddLink.onmouseout=null;this.lnkAddLink.onclick=null;this.lnkAddLink=null;for(var url in this.oLinks){var a=this.oLinks[url];if(!a)continue;this.deactivateShortcut(a);a=null;}
this.oLinks=null;},_getShortcutsCallback:function(result){var resp=result.getResponse();if(!resp.isException){this.elUserIPane.innerHTML="";this._shortcutLoaded=true;var shortcuts=resp.shortcuts;for(var url in shortcuts){var name=shortcuts[url];this.addShortcut(url,name);}
Dispatch.hook(this.elUserIPane);}else{}},addShortcut:function(url,name){var link=this.createLink(url,{text:name,del:true,updn:false});ac(this.elUserIPane,link);this.activateShortcut(link);this.oLinks[url]=link;link=null;},activateShortcut:function(a){var del=fc(a,"span",{name:"DelLink"},null,true);if(del){del.onclick=function(e){var con=fp(this,null,{menuController:true}).menuController;con.deleteShortcut(fp(this,"a"));YuEvent.stopEvent(YuEvent.getEvent(e));return false;};}
var up=fc(a,"span",{name:"UpLink"},null,true);if(up){up.onclick=function(e){var con=fp(this,null,{menuController:true}).menuController;con.moveupShortcut(fp(this,"a"));YuEvent.stopEvent(YuEvent.getEvent(e));return false;};}
var dn=fc(a,"span",{name:"DnLink"},null,true);if(dn){dn.onclick=function(e){var con=fp(this,null,{menuController:true}).menuController;con.movednShortcut(fp(this,"a"));YuEvent.stopEvent(YuEvent.getEvent(e));return false;};}
a.onclick=function(e){Dispatch.goUrl(a.m_url);YuEvent.stopEvent(YuEvent.getEvent(e));return false;};del=null;up=null;dn=null;},deactivateShortcut:function(a){var del=fc(a,"span",{name:"DelLink"},null,true);if(del){del.onclick=null;}
var up=fc(a,"span",{name:"UpLink"},null,true);if(up){up.onclick=null;}
var dn=fc(a,"span",{name:"DnLink"},null,true);if(dn){dn.onclick=null;}
a.onclick=null;},addCurrentPage:function(){var url=Current.url;var name=window.document.title;if(this.oLinks[url]){var msg="請為這 url 輸入一個 *新* 名稱\n"+url;name=window.prompt(msg,this.oLinks[url].m_name);if(!name)return false;this.deleteShortcut(this.oLinks[url],{confirm:false,save:false});this.addShortcut(url,name);}
else{var msg="請為這捷徑定義一個名稱\n"+url;name=window.prompt(msg,name);if(!name)return false;this.addShortcut(url,name);}
var ajx=new AjxAction('iqube','addShortcut');ajx.setCallback(this._addShortcutCallback,this);ajx.set("url",url);ajx.set("name",name);ajx.fire();},_addShortcutCallback:function(result){var resp=result.getResponse();if(!resp.isException){MsgBar.addMsg(resp.html);}else{MsgBar.addMsg(resp.html);}},deleteShortcut:function(link,options){var url=link.m_url;var options=Object.extend({confirm:true,save:true},options);if(options.confirm){var msg="繼續刪除 \""+link.m_name+"\"?";if(!confirm(msg)){return false;}}
this.deactivateShortcut(link);this.oLinks[url]=null;rn(link);if(options.save){var ajx=new AjxAction('iqube','delShortcut');ajx.setCallback(this._delShortcutCallback,this);ajx.set("url",url);ajx.fire();}},_delShortcutCallback:function(result){var resp=result.getResponse();if(!resp.isException){MsgBar.addMsg(resp.html);}else{MsgBar.addMsg(resp.html);}},showIconPane:function(animate){animate=arguments.length==0?true:animate;if(animate){if(this.hideFx){this.onShowComplete();this.hideFx.clearTimer();this.hideFx=null;}
this.showFx=new fx.Width(this.elRoot,{duration:400,onComplete:(function(){this.onShowComplete();this.elToggleImg.src=this.imgOnUrl;this.elRoot.style.width=this.maxPaneWidth+'px';}).bind(this)});this.showFx.custom(this.elRoot.offsetWidth,this.maxPaneWidth);}
else{this.onShowComplete();this.elToggleImg.src=this.imgOnUrl;this.elRoot.style.width=this.maxPaneWidth+'px';}},hideIconPane:function(animate){animate=arguments.length==0?true:animate;if(animate){if(this.showFx){this.onHideComplete();this.showFx.clearTimer();this.showFx=null;}
this.hideFx=new fx.Width(this.elRoot,{duration:400,onComplete:(function(){this.onHideComplete();this.elToggleImg.src=this.imgOffUrl;this.elRoot.style.width=this.minPaneWidth+'px';}).bind(this)});this.hideFx.custom(this.elRoot.offsetWidth,this.minPaneWidth);}
else{this.onHideComplete();this.elToggleImg.src=this.imgOffUrl;this.elRoot.style.width=this.minPaneWidth+'px';}},onShowComplete:function(){this.elIconToggle.title='關閉菜單';this.showFx=null;fmouseover=null;fmouseout=null;},onHideComplete:function(){this.elIconToggle.title='';this.hideFx=null;for(var i=0;i<this.syslinks.length;i++){var link=this.syslinks[i];YuEvent.removeListener(link,'mouseover',link.f_mouseover);YuEvent.removeListener(link,'mouseout',link.f_mouseout);link.f_mouseover=null;link.f_mouseout=null;link=null;}}};var History={last:'',historyFrame:null,add:function(url){url=encodeURIComponent(url);if(url==this.last)return;this.last=url;try{var historydoc=this.historyFrame.contentDocument;}catch(e){}
if(typeof historydoc=='undefined'){try{historydoc=this.historyFrame.contentWindow.document;}catch(e){}}
if(typeof historydoc!='undefined'){historydoc.open();historydoc.write("<html><body onload='main()'><script> function main() {try { window.parent.History.updateNow('"+escape(url)+"');} catch (e) {};}</script></body></html>");historydoc.close();}},back:function(){},forward:function(){},init:function(){this.historyFrame=ge('historyframe');},updateNow:function(url){url=unescape(url);if(url==''||url==this.last)return;url=url.replace('#','');this.last=url;var decodeurl=decodeURIComponent(url);try{new UrlProcess(decodeurl);Dispatch.goUrl(decodeurl);}catch(e){}},deactivate:function(){this.historyFrame=null;}}
var MsgBar={queue:[],head:0,tail:0,el:null,on:false,isBusy:false,fixed:false,init:function(){if(this.el)return;this.el=cex('span',{id:'td_message'});ac(this.el);this.el.style.position='fixed';this.el.style.top='40px';if(this.el.offsetTop==40){this.fixed=true;}else{this.el.style.position='absolute';}},deactivate:function(){this.el=null;var nm=ge('nm');if(nm&&nm.lastChild){nm.lastChild.onclick=null;}},addMsg:function(msg,style){this.queue[this.head++]={msg:msg||'發生錯誤, 請重試',style:(style||'')};if((this.head-this.tail)==1){this.show();}else{this.next(-1);}
return this.tail;},show:function(){if(this.head>this.tail){if(!this.on){if(!this.fixed)YuEvent.addListener(window,"scroll",this.position,this,true);YuEvent.addListener(window,"resize",this.position,this,true);this.on=true;}
var msg=this.queue[this.tail].msg;var style=this.queue[this.tail].style;var center=cex('center',{style:{display:'none'}});ac(this.el,center);center.innerHTML='<table id="rno" cellpadding="0" cellspacing="0" border="0"><tr><td nowrap="nowrap">'+'<b class="rtop '+style+'"><b class="r1"></b><b class="r2"></b></b></td></tr>'+'<tr ><td class="nm '+style+'" id="nm">'+msg+'&nbsp;&nbsp;&#187 </td></tr>'+'<tr><td nowrap="nowrap"><b class="rbottom '+style+'"><b class="r2"></b><b class="r1"></b></b></td></tr></table>';ac(fc(center,'td',null,/nm/,true),cex('a',{href:'',innerHTML:'<img src="'+Config.BASEPATH+'/portal/images/close.gif" align="absmiddle" alt="關閉"/>',onclick:function(){return MsgBar.next(-1);}}));center=null;setTimeout('MsgBar.next('+this.tail+')',30000);this.animate();this.position();this.el.style.visibility='visible';}else{this.el.style.visibility='hidden';this.el.width=0;this.el.innerHTML='';if(!this.fixed)YuEvent.removeListener(window,"scroll",this.position);YuEvent.removeListener(window,"resize",this.position);this.on=false;}},position:function(){var docwidth=document.documentElement.offsetWidth;var elwidth=this.el.offsetWidth;if(!this.fixed){this.el.style.top=document.documentElement.scrollTop+5+'px';}
this.el.style.left=elwidth>docwidth?0:(docwidth-elwidth)/2+'px';if(elwidth>docwidth)this.el.style.width=docwidth+'px';return false;},animate:function(){if(!this.el.firstChild)return;this.el.firstChild.style.display='block';if(this.el.childNodes.length>1&&!this.isBusy){var height=this.el.offsetHeight;this.el.style.height=height+'px';this.el.style.overflow='hidden';this.el.childNodes[1].style.display='block';this.isBusy=true;var myCustom=new fx.Custom(this.el.firstChild,{duration:500,fields:{marginTop:{from:0,to:-height,unit:'px'}},onComplete:function(){rn(this.el);var mb=MsgBar;mb.el.style.height='';mb.el.style.overflow='';mb.isBusy=false;mb.position();setTimeout('MsgBar.animate()',200);}});myCustom.custom(0,1);myCustom=null;}},next:function(tail){if(tail!=-1){if(tail!=MsgBar.tail)return false;}
if(MsgBar.queue[MsgBar.tail]){delete MsgBar.queue[MsgBar.tail];MsgBar.tail++;MsgBar.show();}
return false;}}
var MsgCorner={el:null,fixed:false,show:function(text){if(!this.el)this.init();this.el.innerHTML=text;if(!this.fixed){this.onscroll();YuEvent.addListener(window,"scroll",MsgCorner.onscroll);}
this.el.style.display='block';},onscroll:function(){MsgCorner.el.style.top=document.documentElement.scrollTop+'px';return false;},hide:function(){if(!this.fixed)YuEvent.removeListener(window,"scroll",MsgCorner.onscroll);this.el.style.display='none';},init:function(){this.el=cex('span',{className:'msgcorner'});ac(this.el);this.el.style.position='fixed';this.el.style.top=0;if(this.el.offsetTop==0){this.fixed=true;}else{this.el.style.position='absolute';}
this.el.style.display='none';},deactivate:function(){this.el=null;YuEvent.removeListener(window,"scroll",MsgCorner.onscroll);}}
var Tooltip={show:function(e){e=YuEvent.getEvent(e);var tipbox=ge("tooltip_box");if(!tipbox){tipbox=cex("div",{id:"tooltip_box",className:"tooltip_box hidden"});ac(tipbox);}
tipbox.innerHTML=this.getAttribute('tooltip');if(tipbox.nTimeoutId)window.clearTimeout(tipbox.nTimeoutId);tipbox.nTimeoutId=null;var xy=getXY(this,2);var x=xy.x+1;var y=xy.y;YuDom.setStyle(tipbox,'left',x+'px');YuDom.setStyle(tipbox,'top',y+'px');YuDom.replaceClass(tipbox,'hidden','visible');tipbox=null;},hide:function(e){var tipbox=ge("tooltip_box");if(!tipbox||YuDom.hasClass(tipbox,'hidden')){return;}
tipbox.nTimeoutId=window.setTimeout(function(){var tipbox=ge("tooltip_box");YuDom.replaceClass(tipbox,'visible','hidden');tipbox.innerHTML='';},100);tipbox=null;},hookThis:function(el,on,off){if(el.constructor!=Array){el=[el];}
for(var i=0;i<el.length;i++){if(el[i].getAttribute('tooltip')){YuEvent.addListener(el[i],on,Tooltip.show);YuEvent.addListener(el[i],off,Tooltip.hide);}}},unhookThis:function(el,on,off){if(el.constructor!=Array){el=[el];}
for(var i=0;i<el.length;i++){if(el[i].getAttribute('tooltip')){YuEvent.removeListener(el[i],on,Tooltip.show);YuEvent.removeListener(el[i],off,Tooltip.hide);}}},hookInput:function(el){var inputs=fc(el,'input',{tooltip:true});(function(a){YuEvent.addListener(a,'focus',Tooltip.show);YuEvent.addListener(a,'blur',Tooltip.hide);}).apply2all(inputs);var inputs=fc(el,'textarea',{tooltip:true});(function(a){YuEvent.addListener(a,'focus',Tooltip.show);YuEvent.addListener(a,'blur',Tooltip.hide);}).apply2all(inputs);},unhookInput:function(el){var inputs=fc(el,'input',{tooltip:true});(function(a){YuEvent.removeListener(a,'focus',Tooltip.show);YuEvent.removeListener(a,'blur',Tooltip.hide);}).apply2all(inputs);var inputs=fc(el,'textarea',{tooltip:true});(function(a){YuEvent.removeListener(a,'focus',Tooltip.show);YuEvent.removeListener(a,'blur',Tooltip.hide);}).apply2all(inputs);}}
var BubbleTooltip={el:null,content:null,top:null,botton:null,head:0,event:function(el,text,timeout){BubbleTooltip.show(getXY(el),text,timeout);},show:function(pos,text,timeout,point){this.hide();var obj=BubbleTooltip.el;var obj2=BubbleTooltip.content;obj2.firstChild.innerHTML=text;obj.style.display='block';var st=Math.max(document.body.scrollTop,document.documentElement.scrollTop);if(timeout){this.head=setTimeout(this.hide,timeout);}
var leftPos=pos.x-2;var margin=10;if(leftPos<0)leftPos=0;var width=obj.offsetWidth;if(leftPos+width>document.body.clientWidth){leftPos-=width-40;margin=width-32;}
if(point=='top'){this.top.style.display='block';this.top.style.marginLeft=margin+'px';this.bottom.style.display='none';var topPos=pos.y+12-document.documentElement.scrollTop+st;}else{this.bottom.style.display='block';this.bottom.style.marginLeft=margin+'px';this.top.style.display='none';var topPos=pos.y-3-obj.offsetHeight-document.documentElement.scrollTop+st;}
obj.style.left=leftPos+'px';obj.style.top=topPos+'px';ClickHandler.addListener(BubbleTooltip.el,this.hide,ClickHandler.OUTSIDE);obj=null;obj2=null;return true;},hide:function(){BubbleTooltip.el.style.display='none';BubbleTooltip.el.style.width='';Dispatch.unHook(BubbleTooltip.content);if(BubbleTooltip.head){clearTimeout(BubbleTooltip.head);BubbleTooltip.head=0;}
ClickHandler.removeListener(BubbleTooltip.el);return false;},init:function(){this.el=cex('div',{className:'bubble_tooltip',onclick:BubbleTooltip.hide});this.el.innerHTML='<b class="atop"><b class="a1"></b><b class="a2"></b><b class="a3"></b><b class="a4"></b><b class="a5"></b><b class="a6"></b><b class="a7"></b><b class="a8"></b></b>'+'<b class="rtop"><b class="r1"></b><b class="r2"></b></b>'+'<div class="content"><div></div></div>'+'<b class="rbottom"><b class="r2"></b><b class="r1"></b></b>'+'<b class="abottom"><b class="a8"></b><b class="a7"></b><b class="a6"></b><b class="a5"></b><b class="a4"></b><b class="a3"></b><b class="a2"></b><b class="a1"></b></b>';this.content=this.el.childNodes[2];this.top=this.el.childNodes[0];this.bottom=this.el.childNodes[4];ac(this.el);},deactivate:function(){this.el=null;}}
var ImgFadeIn={hook:function(element,nofadein){(function(img){if(Element.hasClassName(img,'fadein')){if(!nofadein){if(img.readyState=='complete'||img.complete){setTimeout(function(){ImgFadeIn.showImageSmoothly(img);},parseInt((Math.random()+0.1)*1000));}else{YuEvent.addListener(img,'load',function(){setTimeout(function(){ImgFadeIn.showImageSmoothly(img);},parseInt((Math.random()+0.1)*1000));this.onload=null;});}}else{if(mz){img.style.MozOpacity=1;}else{img.filters.alpha.opacity=100;}}}}).apply2all(fc(element,'IMG'));},unhook:function(element){if(!element)return;(function(img){if(img.className=='fadein'){img.onload=null;}}).apply2all(fc(element,'IMG'));},showImageSmoothly:function(img){var opacity=new fx.Opacity(img,{duration:500,onComplete:function(e){Element.replaceClassName(this.el,'fadein','');}});opacity.custom(0,1);opacity=null;},init:function(){},deactivate:function(){}}
addStyleRule("img.fadein","filter:alpha(opacity=0);-moz-opacity:0.0;opacity:0.0;");var DesignBar={el:null,eutility:null,eaddmodule:null,elowerpane:null,econtent:null,open:false,estartdesign:null,init:function(){this.estartdesign=$('startdesign');if(!this.estartdesign)return;this.el=cex('div',{id:'td_designbar'});ac(ge('contextbar'),this.el);this.el.innerHTML=['<div class="upperpane">','<div class="addmodule"></div>','<div class="utility"></div>','</div>','<div class="lowerpane"><div class="contentpane"></div><div class="close"><img src="'+Config.BASEPATH+'/portal/images/close.gif" align="absmiddle" />關閉</div></div>'].join('');fca(this.el,'div','className',['lowerpane','contentpane','utility','addmodule','close'],this,['elowerpane','econtent','eutility','eaddmodule','eclose'])
this.elowerpane.style.display='none';this.eclose.onclick=DesignBar.closeLowerPane;this.eclose.setAttribute("helpToken","toolbar_myBlog");this.eclose=null;this.econtent.style.height='180px';},clearUtility:function(){var _el=this.eutility;(function(a){a.onclick=null;}).apply2all(fc(_el,'LI'));if(this.layoutMenu){this.layoutMenu.deactivate();this.layoutMenu=null;}
if(this.exitMenu){this.exitMenu.deactivate();this.exitMenu=null;}
if(this.pageMenu){this.pageMenu.deactivate();this.pageMenu=null;}
if(this.pageMenu){this.pageMenu.deactivate();this.pageMenu=null;}},deactivate:function(){if(!this.estartdesign)return;(function(a){a.onclick=null;}).apply2all(fc(this.eaddmodule,'LI'));this.clearUtility();this.eutility=null;this.eaddmodule=null;this.elowerpane=null;this.econtent=null;this.el=null;this.estartdesign=null;},openLowerPane:function(type){if(!DesignBar.open){DesignBar.elowerpane.style.height='0px';DesignBar.elowerpane.style.overflowY='hidden';if(ie){var myPush=new fx.Push(DesignBar.elowerpane,{duration:300,onComplete:function(){DesignBar.showLowerPane();}});DesignBar.elowerpane.style.display='block';myPush.push(0,180,'top',0);}else{DesignBar.showLowerPane();}
myPush=null;var height=ge('tabTop').offsetHeight;if(height<180){var tdHeader=ge('td_header');var newHeight=tdHeader.offsetHeight+180-height;tdHeader.style.height=newHeight+'px';tdHeader=null;}}
DesignBar.open=type;DesignBar.refresh();},closeLowerPane:function(){if(DesignBar.open){PortalMenu.detachDisplayPortlet();PortalMenu.deactivatePortalMenu(DesignBar.econtent);PortalMenu.hideMiniPortal();DesignBar.elowerpane.style.height=DesignBar.elowerpane.offsetHeight+'px';DesignBar.elowerpane.style.overflowY='hidden';if(ie){var myPush=new fx.Push(DesignBar.elowerpane,{duration:300,onComplete:function(){DesignBar.hideLowerPane();}});myPush.push(180,0,'top',0);myPush=null;}else{DesignBar.hideLowerPane();}
var tdHeader=ge('td_header');tdHeader&&(tdHeader.style.height='');tdHeader=null;}
DesignBar.open=false;},showLowerPane:function(){this.elowerpane.style.display='';this.elowerpane.style.height='180px';this.elowerpane.style.overflowY='';},hideLowerPane:function(){this.elowerpane.style.display='none';PortalMenu.deactivatePortalMenu
this.elowerpane.style.height='0px';this.elowerpane.style.overflowY='';},refresh:function(){if(!this.estartdesign)return;DesignBar.refreshUtility();DesignBar.refreshAddModule();if(Current.getDesignMode()){switch(DesignBar.open){case 1:PortalMenu.displayPortalMenu(DesignBar.econtent,Current.urlProcess.getFullAction());break;case 2:PortalMenu2.displayPortalMenu(DesignBar.econtent,7);break;case false:}
PortalMenu.detachDisplayPortlet();}else{DesignBar.closeLowerPane();}},refreshAddModule:function(){var _el=DesignBar.eaddmodule;(function(a){a.onclick=null;a.onmouseout=null;a.onmouseover=null;}).apply2all(fc(_el,'LI'));_el.innerHTML='<ul></ul>';var fmouseover=function(e){Element.replaceClassName(this,'','color_y');};var fmouseout=function(e){Element.replaceClassName(this,'color_y','');};if(Current.getDesignMode()){var addModule=cex('li',{innerHTML:"增加方格",onmouseover:fmouseover,onmouseout:fmouseout});addModule.onclick=function(){if(DesignBar.open!=1)DesignBar.openLowerPane(1);else DesignBar.closeLowerPane();return false;};var addMyModule=cex('li',{innerHTML:"RSS",onmouseover:fmouseover,onmouseout:fmouseout});addMyModule.onclick=function(){if(DesignBar.open!=2)DesignBar.openLowerPane(2);else DesignBar.closeLowerPane();return false;};ac(_el.lastChild,addModule,addMyModule);addModule=null;addMyModule=null;this.estartdesign.style.display='none';this.estartdesign.onclick=Current.exitDesign;this.el.style.display='block';}else{if(Current.canEdit){this.estartdesign.style.display='block';this.estartdesign.onclick=function(){Current.swDesignMode(true);return false;};}else{this.estartdesign.style.display='none';this.estartdesign.onclick=Dispatch.disableClick;}
this.el.style.display='none';}
_el=null;},refreshUtility:function(){var _el=this.eutility;this.clearUtility();_el.innerHTML='<ul></ul>';var fmouseover=function(e){Element.replaceClassName(this,'','selected');};var fmouseout=function(e){Element.replaceClassName(this,'selected','');};if(Current.getDesignMode()){if(Current.isAdvancedEdit){var LayoutMenu={imgPath:Config.BASEPATH+'/portal/images/layoutmenu',initialize:function(parent){var html='<div class="toggle layoutmenu" toggleClass="color_y"><div>版面設計</div><table class="itemContainer compact"><tbody></tbody></table></div>';var root=cex('li',{innerHTML:html,className:'layout'});ac(parent,root);var container=fc(root,'tbody',null,null,true);if(Current.url&&(gPortalC.portals[Current.url].layoutType==Portal.LAYOUT_TYPE_COLUMN)){var minis={'2-col.GIF':'[{"width":"28.85%","content":[]},{"width":"69.64%","content":[]}]','3-col.GIF':'[{"width":"20.71%","content":[]},{"width":"56.76%","content":[]},{"width":"20.51%","content":[]}]','2-col-with-header.GIF':'[{"width":"99%","content":[{"row":[{"width":"28.2%","content":[]},{"width":"70.29%","content":[]}]}]}]','3-col-with-header.GIF':'[{"width":"99%","content":[{"row":[{"width":"20.55%","content":[]},{"width":"56.88%","content":[]},{"width":"20.56%","content":[]}]}]}]','2-col-with-header-and-footer.GIF':'[{"width":"99%","content":[{"row":[{"width":"28.2%","content":[]},{"width":"70.29%","content":[]}]},{"row":[{"width":"99%","content":[]}]}]}]','3-col-with-header-and-footer.GIF':'[{"width":"99%","content":[{"row":[{"width":"20.55%","content":[]},{"width":"56.88%","content":[]},{"width":"20.56%","content":[]}]},{"row":[{"width":"99%","content":[]}]}]}]'};var handler=function(e){DesignBar.layoutMenu.menu.hideMenu();gPortalC.portals[Current.url].applyLayout(minis[this.s_key]);};var i=0;for(var key in minis){var src=this.imgPath+'/'+key;var item=cex('td',{innerHTML:'<img src="'+src+'" />',className:'item',title:'使用這版面編排',s_key:key,onmouseover:fmouseover,onmouseout:fmouseout,onclick:handler});if(i%2==0){tr=ce('tr');}
at([container,[tr,item]]);i++;}
item=null;}else if(Current.url&&(gPortalC.portals[Current.url].layoutType==Portal.LAYOUT_TYPE_FREESTYLE)){var tr=ce('tr');var item=cex('td',{innerHTML:"自動模式",className:'item',onmouseover:fmouseover,onmouseout:fmouseout,noWrap:1,colSpan:2,onclick:function(){if(confirm('自動模式\n您確定要執行嗎？\n您將失去所有版面設置\n\n* 請按OK鍵轉換到直列版面設計\n* 退出並保留FreeStyle版面設計.')){gPortalC.portals[Current.url].swColLayout();}}});at([container,[tr,item]]);item=null;}
this.menu=new Menu(root);this.menu.activate();this.root=root;tr=item=root=container=parent=null;},deactivate:function(){this.menu.deactivate();var tds=fc(this.root,'td');for(var i in tds){var item=tds[i];item.onmouseover=null;item.onmouseout=null;item.onclick=null;}
this.root=null;this.menu=null;}};this.layoutMenu=LayoutMenu;this.layoutMenu.initialize(_el.firstChild);LayoutMenu=null;if(Current.urlProcess.view=='portal'){var PageMenu={initialize:function(parent){var html='<div class="toggle pagemenu" toggleClass="color_y"><div>頁面</div><table class="itemContainer compact"><tbody></tbody></table></div>';var root=cex('li',{innerHTML:html,className:'page'});ac(parent,root);var container=fc(root,'tbody',null,null,true);var items={'增加頁面':function(){if(!gPortalC.exitPortal(null,Current.url))return;gPortalC.newPage();},'移除網頁':function(){gPortalC.removePage(Current.url);}};var handler=function(e){DesignBar.pageMenu.menu.hideMenu();items[this.s_key]();return false;};for(var key in items){var item=cex('td',{innerHTML:key,className:'item',onmouseover:fmouseover,onmouseout:fmouseout,onclick:handler,s_key:key});var tr=ce('tr');at([container,[tr,item]]);}
this.menu=new Menu(root);this.menu.activate();this.root=root;tr=item=root=container=parent=null;},deactivate:function(){this.menu.deactivate();var tds=fc(this.root,'td');for(var i in tds){var item=tds[i];item.onmouseover=null;item.onmouseout=null;item.onclick=null;}
this.root=null;this.menu=null;}};this.pageMenu=PageMenu;this.pageMenu.initialize(_el.firstChild);PageMenu=null;}}
if(!Current.autosave){var root=cex('li',{innerHTML:'退出設計模式',className:'exitdesign',onclick:Current.exitDesign});ac(_el.firstChild,root);root=null;}}
_el=null;}}
var StartTipoftheday=function()
{var filter={uiOptions:{close:true,mode:'tip',width:'480px',height:'240px'},post_id:this.getAttribute('m_postid')||null};var options={filterConfig:filter,header:"今日提示",events:{close:function(){window.tipPop.hide();window.tipPop.deactivate();window.tipPop=null;}},close:false,btnOK:false,btnCancel:false,width:'540px'}
PkgMan.load("Iqube.PortletPopup",function(){if(!window.tipPop){window.tipPop=new Iqube.PortletPopup("3300.1",Alias.homegroupid,options);window.tipPop.activate();}
window.tipPop.show();});}
var StartTutorial=function()
{var filter={uiOptions:{close:true,mode:'tutorial',width:'540px',height:'400px'},post_id:this.getAttribute&&this.getAttribute('m_postid')||null};var options={filterConfig:filter,header:"Showme 學堂",events:{close:function(){window.tutorial.hide();window.tutorial.deactivate();window.tutorial=null;}},close:false,btnOK:false,btnCancel:false,width:'600px'}
PkgMan.load("Iqube.PortletPopup",function(){if(!window.tutorial){window.tutorial=new Iqube.PortletPopup("3300.2",gPortalC.groupid,options);window.tutorial.activate();}
window.tutorial.show();});}
var isIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;var isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;var isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;function ControlVersion()
{var version;var axo;var e;try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");version=axo.GetVariable("$version");}catch(e){}
if(!version)
{try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version="WIN 6,0,21,0";axo.AllowScriptAccess="always";version=axo.GetVariable("$version");}catch(e){}}
if(!version)
{try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version=axo.GetVariable("$version");}catch(e){}}
if(!version)
{try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version="WIN 3,0,18,0";}catch(e){}}
if(!version)
{try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");version="WIN 2,0,0,11";}catch(e){version=-1;}}
return version;}
function GetSwfVer(){var flashVer=-1;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){var swVer2=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"";var flashDescription=navigator.plugins["Shockwave Flash"+swVer2].description;var descArray=flashDescription.split(" ");var tempArrayMajor=descArray[2].split(".");var versionMajor=tempArrayMajor[0];var versionMinor=tempArrayMajor[1];if(descArray[3]!=""){tempArrayMinor=descArray[3].split("r");}else{tempArrayMinor=descArray[4].split("r");}
var versionRevision=tempArrayMinor[1]>0?tempArrayMinor[1]:0;var flashVer=versionMajor+"."+versionMinor+"."+versionRevision;}}
else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1)flashVer=4;else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1)flashVer=3;else if(navigator.userAgent.toLowerCase().indexOf("webtv")!=-1)flashVer=2;else if(isIE&&isWin&&!isOpera){flashVer=ControlVersion();}
return flashVer;}
function DetectFlashVer(reqMajorVer,reqMinorVer,reqRevision)
{versionStr=GetSwfVer();if(versionStr==-1){return false;}else if(versionStr!=0){if(isIE&&isWin&&!isOpera){tempArray=versionStr.split(" ");tempString=tempArray[1];versionArray=tempString.split(",");}else{versionArray=versionStr.split(".");}
var versionMajor=versionArray[0];var versionMinor=versionArray[1];var versionRevision=versionArray[2];if(versionMajor>parseFloat(reqMajorVer)){return true;}else if(versionMajor==parseFloat(reqMajorVer)){if(versionMinor>parseFloat(reqMinorVer))
return true;else if(versionMinor==parseFloat(reqMinorVer)){if(versionRevision>=parseFloat(reqRevision))
return true;}}
return false;}}
function AC_AddExtension(src,ext)
{if(src.indexOf('?')!=-1)
return src.replace(/\?/,ext+'?');else
return src+ext;}
function AC_Generateobj(objAttrs,params,embedAttrs)
{var str='';if(isIE&&isWin&&!isOpera)
{str+='<object ';for(var i in objAttrs)
str+=i+'="'+objAttrs[i]+'" ';for(var i in params)
str+='><param name="'+i+'" value="'+params[i]+'" /> ';str+='></object>';}else{str+='<embed ';for(var i in embedAttrs)
str+=i+'="'+embedAttrs[i]+'" ';str+='> </embed>';}
document.write(str);}
function AC_FL_RunContent(){var ret=AC_GetArgs
(arguments,".swf","movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash");AC_Generateobj(ret.objAttrs,ret.params,ret.embedAttrs);}
function AC_GetArgs(args,ext,srcParamName,classid,mimeType){var ret=new Object();ret.embedAttrs=new Object();ret.params=new Object();ret.objAttrs=new Object();for(var i=0;i<args.length;i=i+2){var currArg=args[i].toLowerCase();switch(currArg){case"classid":break;case"pluginspage":ret.embedAttrs[args[i]]=args[i+1];break;case"src":case"movie":args[i+1]=AC_AddExtension(args[i+1],ext);ret.embedAttrs["src"]=args[i+1];ret.params[srcParamName]=args[i+1];break;case"onafterupdate":case"onbeforeupdate":case"onblur":case"oncellchange":case"onclick":case"ondblClick":case"ondrag":case"ondragend":case"ondragenter":case"ondragleave":case"ondragover":case"ondrop":case"onfinish":case"onfocus":case"onhelp":case"onmousedown":case"onmouseup":case"onmouseover":case"onmousemove":case"onmouseout":case"onkeypress":case"onkeydown":case"onkeyup":case"onload":case"onlosecapture":case"onpropertychange":case"onreadystatechange":case"onrowsdelete":case"onrowenter":case"onrowexit":case"onrowsinserted":case"onstart":case"onscroll":case"onbeforeeditfocus":case"onactivate":case"onbeforedeactivate":case"ondeactivate":case"type":case"codebase":case"id":ret.objAttrs[args[i]]=args[i+1];break;case"width":case"height":case"align":case"vspace":case"hspace":case"class":case"title":case"accesskey":case"name":case"tabindex":ret.embedAttrs[args[i]]=ret.objAttrs[args[i]]=args[i+1];break;default:ret.embedAttrs[args[i]]=ret.params[args[i]]=args[i+1];}}
ret.objAttrs["classid"]=classid;if(mimeType)ret.embedAttrs["type"]=mimeType;return ret;}
9
function Process(options)
{this.form=null;this.dialog=null;this.options=options||{};this.action=null;YuEvent.addListener(window,'unload',this.deactivate,this,true);}
Process.prototype.close=function()
{if(this.onClose){this.onClose(this.options);}
this.deactivate();}
Process.prototype.submit=function(i)
{if(this.form){window.processunload(this.form);var submitBtn=fc(this.form,'input',{type:'submit'},null);if(submitBtn[i])submitBtn[i].click();}
return false;}
Process.prototype.deactivate=function(e)
{if(this.form){window.processunload(this.form);this.form.onsubmit=null;}
if(this.container){this.elBody=null;rn(this.container,true);this.container=null;}
if(this.dialog){this.dialog.hide();this.dialog.destroy();}
this.dialog=null;if(!e||e.type!='unload'){YuEvent.removeListener(window,'unload',this.deactivate);}
if(this.popProfileEdit){this.popProfileEdit.hide();this.popProfileEdit.deactivate();delete this.popProfileEdit;}
this.options=null;this.onClose=null;}
Process.prototype.handleResult=function(el)
{var result=fc(el,'div',null,'formmessage',true);if(result){MsgBar.addMsg(result.innerHTML);gPortalC.invalidate();gPortalC.updateCurrent();switch(this.action){case'blogprofileedit':var f=function(result){var resp=result.getResponse();if(!resp.isException){var banner_title=$('banner_title');if(banner_title){banner_title.innerHTML='';ac(banner_title,ctn(resp.group.displayname));}
var subtitle=$('banner_subtitle');if(subtitle){subtitle.innerHTML='';ac(subtitle,ctn(resp.group.description));}}};var ajx=new AjxAction('iqube','getGroupSettings',{groupid:Alias.homegroupid},f);ajx.fire();ajx=null;break;case'userinfo1':var f=function(result){var resp=result.getResponse();if(!resp.isException){$('banner_displayname').innerHTML=resp.displayname;$('banner_avatar').src=resp.avatarUrl;}};var ajx=new AjxAction('iqube','getAliasSettings',{aliasid:Alias.id},f);ajx.fire();ajx=null;break;}
return true;}
var error=fc(el,'div',null,'formerror',true);if(error){MsgBar.addMsg(error.innerHTML,'error');return true;}
var redirect=fc(el,'div',null,'formRedirect',true);if(redirect){document.location=redirect.innerHTML;return true;}
result=null;error=null;el=null;return false;}
Process.prototype.dispatch=function(urlProcess,title)
{title=title||this.options.title;this.action=urlProcess.action;switch(this.action){case'logout':MsgCorner.show('登出中');this.noDialog(urlProcess);return true;break;case'swlang':MsgCorner.show('轉換語言...');this.noDialog(urlProcess);return true;break;case'userinfo1':if(Config.LOVES91){PkgMan.load("Iqube.PortletPopup",function(){this.popProfileEdit=new Iqube.PortletPopup(3500,gPortalC.groupid,{close:false,width:"800px",btnOK:false,btnCancel:false,filterConfig:{alias_id:Alias.id,uiOptions:{cancel:true}},header:"編輯個人檔案",events:{save:function(){this.popProfileEdit.hide();this.popProfileEdit.deactivate();delete this.popProfileEdit;}.bind(this),cancel:function(){this.popProfileEdit.hide();this.popProfileEdit.deactivate();delete this.popProfileEdit;}.bind(this)}});this.popProfileEdit.activate();this.popProfileEdit.show();this.popProfileEdit.oDialog.autoSize();this.popProfileEdit.oDialog.center();});return true;}
break;case'memberprofile':if(Config.LOVES91){var matches=(/\/memberprofile\/(.*)$/i).exec(urlProcess.url);var aliasspec=matches[1];if(!aliasspec){alert("錯誤: 找不到用戶紀錄");return true;}
var aliasid='';var aliasname='';if(parseInt(aliasspec)){aliasid=parseInt(aliasspec);}
else{aliasname=aliasspec;}
PkgMan.load("Iqube.PortletPopup",function(){this.popProfileView=new Iqube.PortletPopup(3400,gPortalC.groupid,{close:false,width:'800px',btnOK:true,btnOKText:"關閉",btnCancel:false,filterConfig:{alias_id:aliasid,aliasname:aliasname},header:"觀看個人檔案",onOK:function(){this.popProfileView.hide();this.popProfileView.deactivate();delete this.popProfileView;}.bind(this)});this.popProfileView.activate();this.popProfileView.show();});return true;}
break;default:break;}
this.readAndDisplay(urlProcess,title);return true;}
Process.prototype.noDialog=function(urlProcess)
{var handleResult=function(o){switch(urlProcess.action){case'logout':MsgCorner.show('正在重新載入 ...');MsgBar.addMsg('成功登出. 現正重新載入 ...');document.location=Config.HOMESITE;break;case'swlang':Dispatch.refresh();break;default:break;}};var callback={success:handleResult,failure:handleResult,argument:{urlProcess:urlProcess,obj:this}};var request=YAHOO.util.Connect.asyncRequest('GET',urlProcess.url+'?iframe=1&rn='+(Math.random()),callback);}
Process.prototype.readAndDisplay=function(urlProcess,title)
{var _this=this;var handleSuccess=function(o){if(o.responseText!==undefined){var html=o.responseText;var title=html.match(/<title>(.*)<\/title>/i);log({html:html,title:title},'Process','readAndDisplay');o.argument.obj._readAndDisplayCallback(html,o.argument.urlProcess,title[1]||o.argument.title)}else{o.argument.obj.close();MsgBar.addMsg('載入失敗. 請重試','error');}};var handleFailure=function(o){o.argument.obj.close();MsgBar.addMsg('載入失敗. 請重試','error');}
var callback={success:handleSuccess,failure:handleFailure,argument:{urlProcess:urlProcess,obj:this,title:title}};var request=YAHOO.util.Connect.asyncRequest('GET',urlProcess.url+'?iframe=1&rn='+(Math.random()),callback);this.nElId='process_dialog';this.container=cex('div',{id:this.nElId,innerHTML:['<div class="hd">',title,'</div><div class="bd" id="process_dialog_bd"><img src="',Config.BASEPATH+'/portal/images/loading.gif','"/></div>'].join(''),style:{visibility:'hidden'}});ac(this.container);this.elBody=fc(this.container,"div",null,'bd',true);var dialog=new YAHOO.widget.SimpleDialog(this.nElId,{fixedcenter:true,width:'400px',visible:false,modal:true,constraintoviewport:false,close:false,postmethod:'none'});dialog.render();dialog.center();dialog.show();this.dialog=dialog;return false;}
Process.prototype._submitCallBack=function(html,el)
{if(this.form)this.form.onsubmit=null;this.form=null;this.dialog.setBody(html);this.dialog.autoSize();this.dialog.center();el.scrollTop=0;var forms=fc(el,'FORM');if(forms.length==1){var _this=this;forms[0].onsubmit=function(){var pork=new iframe({update:_this.elBody,onComplete:(function(_html,_el,_title,_eltitle){this._submitCallBack(_html,_el);}).bind(_this)});pork.submit(this);pork=null;return true;};forms[0].action+='?iframe=1&random='+(Math.random());if(forms[0].cancel){forms[0].cancel.style.display='none';}
this.form=forms[0];var submitBtns=fc(this.form,'input',{type:'submit',stay:false},null);var buttons=[];if(this.options.buttons&&this.options.buttons.length>0){for(var i=0;i<this.options.buttons.length;i++){var btn=this.options.buttons[i];if(btn.prepend)buttons.push({text:btn.text,handler:btn.handler});}}
for(var i=0;i<submitBtns.length;i++){submitBtns[i].style.display='none';buttons.push({text:submitBtns[i].value||"提交",handler:this.submit.bind(this,i),isDefault:true});}
buttons.push({text:this.options.btnCloseText||"取消",handler:this.close.bind(this)});if(this.options.buttons&&this.options.buttons.length>0){for(var i=0;i<this.options.buttons.length;i++){var btn=this.options.buttons[i];if(!btn.prepend)buttons.push({text:btn.text,handler:btn.handler});}}
this.dialog.cfg.queueProperty("buttons",buttons);this.dialog.render();window.processinit(this.form);}else{if(this.handleResult(el)){this.close();return false;}
var buttons=[{text:this.options.btnCloseText||"關閉",handler:this.close.bind(this)}];this.dialog.cfg.queueProperty("buttons",buttons);this.dialog.render();}
forms=null;el=null;return true;}
Process.prototype._readAndDisplayCallback=function(html,urlProcess,title)
{var dialog=this.dialog;dialog.form=null;dialog.setHeader(title);if(this._submitCallBack(html,this.elBody)){this.container.style.visibility='visible';}
dialog=null;}
function readSystemImages(element,scope)
{element.onmouseover=null;var sysimgselect=ge(scope);var menus=fc(sysimgselect,'div',null,/\bsysimgselect\b/);var items=fc(sysimgselect,'div',null,'item');var fOnMouseOver=function(e){if(!window._lockMouseOverEvent){this.className="itemMouseOver";var img=fc(ge("avataruploadimages"),"img",null,null,true);this._oldsrc=img.src;img.src=this.getAttribute('imgsrc');}}
var fOnMouseOut=function(e){if(!window._lockMouseOverEvent){this.className="itemMouseOut";var img=fc(ge("avataruploadimages"),"img",null,null,true);if(this._oldsrc)img.src=this._oldsrc,this._oldsrc=false;}}
var fOnClick=function(e){if(!window._lockMouseOverEvent){var img=fc(ge("avataruploadimages"),"img",null,null,true);img.src=this.getAttribute("imgsrc");var form=fp(ge("avataruploadimages"),'form');if(form){form.elements['lk'].value=this.getAttribute("code");form.elements['img'].value=this.getAttribute("imgsrc");form.elements['imagecode'].value=this.getAttribute("code");}
this._oldsrc=false;}}
for(var i=0;i<items.length;i++){items[i].onmouseover=fOnMouseOver;items[i].onmouseout=fOnMouseOut;items[i].onclick=fOnClick;}
fOnClick=fOnMouseOver=fOnMouseOut=items=sysimgselect=menus=null;return true;}
function toggleProfileDisplay(element)
{if(element.nextSibling!=null){var el_data=element.nextSibling;while(el_data.nodeType==3)el_data=el_data.nextSibling;if(el_data.style.display=='none'){el_data.style.display='block';element.firstChild.firstChild.className="expanded";}else{el_data.style.display='none';element.firstChild.firstChild.className="collapsed";}}}
function togglePermMessage(element)
{var userselect=element.value;var tdNode=element.parentNode.parentNode.nextSibling;while(tdNode.nodeType==3)tdNode=tdNode.nextSibling;var divCollection=tdNode.getElementsByTagName("DIV");for(var i=0;i<divCollection.length;i++){switch(divCollection[i].getAttribute('name')){case'perm_public':if(userselect=='perm_public'){divCollection[i].style.display='block';}else{divCollection[i].style.display='none';}
break;case'perm_logged_in':if(userselect=='perm_logged_in'){divCollection[i].style.display='block';}else{divCollection[i].style.display='none';}
break;case'perm_sn':if(userselect=='perm_sn'){divCollection[i].style.display='block';}else{divCollection[i].style.display='none';}
break;case'perm_private':if(userselect=='perm_private'){divCollection[i].style.display='block';}else{divCollection[i].style.display='none';}
break;default:alert('error !!'+divCollection[i].getAttribute('name'));break;}}}
function checkEmpty(element)
{var errorfield=fc(element.parentNode,'span',null,'errorMsg',true);element.value=(element.value).replace(/^\s+|\s+$/g,'');if(!element.value.length){if(errorfield){errorfield.innerHTML='此位置不能空白';errorfield.style.display='block';}else{alert('此位置不能空白');}}else{if(errorfield){errorfield.style.display='none';}}
errorfield=null;}
function checkAvailabilityOfUsername(element)
{var username=element.value;var tdNode=element.parentNode;var spanCollection=tdNode.getElementsByTagName('SPAN');var spanNode=null;for(var i=0;i<spanCollection.length;i++){switch(spanCollection[i].getAttribute('name')){case'usernamecheck':spanNode=spanCollection[i];break;default:break;}}
var responseSuccess=function(o){element.className='unverified';switch(o.responseText){case"Format":spanNode.innerHTML="衹接受a-z,A-Z,0-9,_,- 結成的3-60個字符，_/- 不能作為起始/結束字符";spanNode.className='errorMsg';spanNode.style.display='block';break;case"Length":spanNode.innerHTML="祇可接受3-60個字符";spanNode.className='errorMsg';spanNode.style.display='block';break;case"Unavailable":spanNode.innerHTML="您輸入的登入名稱巳被使用, 請選擇其他";spanNode.className='errorMsg';spanNode.style.display='block';break;default:spanNode.innerHTML="您輸入的登入名稱是可使用的";spanNode.className='';spanNode.style.display='none';element.className='verified';break;}}
var responseFailure=function(o){spanNode.innerHTML="There is an error in sending the request. Please try this again later.";}
var callback={success:responseSuccess,failure:responseFailure}
if(!new RegExp("^[A-Za-z0-9]{1,1}[A-Za-z0-9_-]{1,58}[A-Za-z0-9]{1,1}$").test(username)){spanNode.innerHTML="登入名稱必須包含3-60個的字母/數字/連字符(a-z,A-Z,0-9,_,-). 但(_,-)不能作為開始/結尾的字符.";spanNode.className='errorMsg';spanNode.style.display='block';element.className='unverified';}else{var cObj=YAHOO.util.Connect.asyncRequest("GET",Config.ROOTPATH+'/availabilitycheck.php?type=username&username='+username,callback,null);}}
function getCaptcha(element)
{var tablenode=element;while(tablenode.tagName!='TABLE'||!tablenode){tablenode=tablenode.parentNode;}
imgCollection=tablenode.getElementsByTagName('IMG');for(var i=0;i<imgCollection.length;i++){switch(imgCollection[i].getAttribute('name')){case'captchaimage':imgnode=imgCollection[i];break;default:break;}}
imgnode.src='/get_captcha.php?rn='+Math.random();}
function checkAvailabilityOfEmail(element)
{var email=element.value;var tdNode=element.parentNode;var spanNode=fc(element.parentNode,'SPAN',{name:'emailcheck'},null,true);if(email==''){spanNode.className='';spanNode.style.display='none';element.className='';return;}
var responseSuccess=function(o){element.className='unverified';switch(o.responseText){case"Format":spanNode.innerHTML="您輸入的電郵格式不正確";spanNode.className='errorMsg';spanNode.style.display='block';break;case"Length":spanNode.innerHTML="您輸入的電郵格式不正確";spanNode.className='errorMsg';spanNode.style.display='block';break;case"Unavailable":spanNode.innerHTML="您輸入的電郵地址巳被使用, 請選擇其他";spanNode.className='errorMsg';spanNode.style.display='block';break;default:spanNode.innerHTML="您輸入的電郵地址是可使用的";spanNode.className='';spanNode.style.display='none';element.className='verified';break;}}
var responseFailure=function(o){spanNode.innerHTML="很抱歉, 發送請求時出現錯誤. 請稍後再試.";}
var callback={success:responseSuccess,failure:responseFailure}
if(email.indexOf("@")!=-1&&(email.lastIndexOf("@")==email.indexOf("@"))&&(email.lastIndexOf(".")>email.lastIndexOf("@"))){var cObj=YAHOO.util.Connect.asyncRequest("GET",Config.ROOTPATH+'/availabilitycheck.php?type=email&email='+email,callback,null);}else{spanNode.innerHTML="您輸入的電郵格式不正確";spanNode.className='errorMsg';spanNode.style.display='block';element.className='unverified';}}
function checkRetypeOfEmail(retypeEmail)
{var origanlEmail=null;var inputCollection=retypeEmail.form.getElementsByTagName("INPUT");for(var i=0;i<inputCollection.length;i++){switch(inputCollection[i].getAttribute('name')){case'email':originalEmail=inputCollection[i];break;default:break;}}
var tdNode=retypeEmail.parentNode;var spanCollection=tdNode.getElementsByTagName('SPAN');var spanNode=null;for(var i=0;i<spanCollection.length;i++){switch(spanCollection[i].getAttribute('name')){case'emailretypecheck':spanNode=spanCollection[i];break;default:break;}}
if(originalEmail.value!=retypeEmail.value){spanNode.innerHTML="您兩次所輸入的電郵地址不相同";spanNode.className='errorMsg';spanNode.style.display='block';retypeEmail.className='unverified';}else{spanNode.style.display='none';retypeEmail.className='';}}
function chkempty(element)
{if(trim(element.value.length)<1){return false;}else{return true;}}
function registrationFormSubmit(form)
{var whiteList={'firstname':true,'lastname':true,'username':true,'email':true,'email2':true}
var hasError=false;for(var i=0;i<form.elements.length;i++){if(whiteList[form.elements[i].getAttribute('name')]){var errorMsg_el=form.elements[i].nextSibling;if(form.elements[i].value.length<1){errorMsg_el.innerHTML="此位置不能空白";errorMsg_el.className='errorMsg';errorMsg_el.style.display='block';form.elements[i].className='unverified';hasError=true;}else{errorMsg_el.style.display="none";if(form.elements[i].getAttribute('name')=="email"){email=form.elements[i].value;if(email.indexOf("@")==-1||(email.lastIndexOf("@")!=email.indexOf("@"))||(email.lastIndexOf(".")<email.lastIndexOf("@"))){errorMsg_el.innerHTML="您輸入的電郵格式不正確";errorMsg_el.className='errorMsg';errorMsg_el.style.display='block';form.elements[i].className='unverified';hasError=true;}}
if(form.elements[i].getAttribute('name')=="username"){username=form.elements[i].value;if(!new RegExp("^[A-Za-z]{1,1}[A-Za-z0-9_-]{1,58}[A-Za-z0-9]{1,1}$").test(username)){errorMsg_el.innerHTML="登入名稱必須包含3-60個的字母/數字/連字符(a-z,A-Z,0-9,_,-). 但(_,-)不能作為開始/結尾的字符.";errorMsg_el.className='errorMsg';errorMsg_el.style.display='block';form.elements[i].className='unverified';hasError=true;}}}}}
if(!hasError){form.submit();}else{return false;}}
var processinit=function(element){if(!element)element=fc(ge('content')||document.body,'form',null,null,true);if(element){var tagautocomplete=fc(element,'textarea',{tagautocomplete:true},null,true);if(tagautocomplete){switch(tagautocomplete.getAttribute("tagtype")){case'people':tagautocomplete.m_autocomplete=new Iqube.TagAutoComplete(tagautocomplete,Tag.TYPE_PEOPLE);break;case'group':tagautocomplete.m_autocomplete=new Iqube.TagAutoComplete(tagautocomplete,Tag.TYPE_GROUP);break;}}
Tooltip.hookInput(element);}
MsgBar.init();}
var processunload=function(element){if(!element)element=fc(ge('content')||document.body,'form',null,null,true);if(element){var tagautocomplete=fc(element,'textarea',{tagautocomplete:true},null,true);if(tagautocomplete&&tagautocomplete.m_autocomplete){tagautocomplete.m_autocomplete.deactivate();}
Tooltip.unhookInput(element);}}
function updateAvatarImg(url,mode,msgID){var obj=document.getElementById('avatardiv');obj.style.display='none';mode=mode?mode:'';var btn=document.getElementById('browsebtn');btn.className="";var obj2=document.getElementById('uploadresultdiv');var maxsize=obj2.getAttribute("maxsize");switch(msgID){case 1:obj2.innerHTML="檔案上載失敗, 請重試";break;case 2:obj2.innerHTML="檔案上載失敗 (不可大過 "+Math.round(maxsize/1024/1024*10)/10+" MB)";break;case 3:obj2.innerHTML="檔案上載成功";break;}
if(url&&url!='null'&&url!=''){if(mode=='logo'){var params=new Array();var temp=url.indexOf("?");var temp=url.substr(temp+1);var temp=temp.split("&");for(var i=0;i<temp.length;i++){var temp1=temp[i].split("=");if(temp1.length>1)
params[temp1[0]]=temp1[1];}
var form=fp(ge("avataruploadimages"),'form');if(form){form.elements['lk'].value=params['lk'];form.elements['img'].value=params['img'];form.elements['imagecode'].value='';}
var avataruploadimagesDiv=document.getElementById('avataruploadimages');var imgdiv=avataruploadimagesDiv.getElementsByTagName('div')[0];var image=imgdiv.getElementsByTagName('img')[0];image.src=url;image.className='loaded';}else{var params=new Array();var temp=url.indexOf("?");var temp=url.substr(temp+1);var temp=temp.split("&");for(var i=0;i<temp.length;i++){var temp1=temp[i].split("=");if(temp1.length>1)
params[temp1[0]]=temp1[1];}
var form=fp(ge("avataruploadimages"),'form');if(form){form.elements['lk'].value=params['lk'];form.elements['img'].value=params['img'];form.elements['imagecode'].value='';}
var avataruploadimagesDiv=document.getElementById('avataruploadimages');var imgdiv=avataruploadimagesDiv.getElementsByTagName('div')[0];var image=imgdiv.getElementsByTagName('img')[0];image.src=url;image.className='loaded';}}
window._lockMouseOverEvent=false;}
var _lockMouseOverEvent=false;function createUploader(uploadurl,flashvars,langs,mode,callback){langs=JSON.parse(langs);window._lockMouseOverEvent=true;var __hasFlash=DetectFlashVer(Config.REQUIRE_FLASH_MAJOR_VERSION,Config.REQUIRE_FLASH_MINOR_VERSION,Config.REQUIRE_FLASH_REVISION);mode=mode?mode:'';if(__hasFlash){var btn=document.getElementById('browsebtn');btn.className="trigger_disabled";var obj=document.getElementById('avatardiv');var obj2=document.getElementById('uploadresultdiv');obj2.innerHTML="";if(obj.style.display=='none'){obj.style.display='block';for(var i=0;i<langs.length;i++){flashvars+="&amp;LANG_"+i+"="+(langs[i]);}
flashvars+="&amp;mode="+mode;if(callback){flashvars+="&amp;callback="+callback;}
if(mz){obj.innerHTML='<embed src="'+Config.BASEPATH+'/flash/avatarUploader.swf?_v200707311936_.swf" flashvars="'+flashvars+'" quality="high" bgcolor="#ffffff" width="200" height="17" align="middle" allowScriptAccess="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" swliveconnect="false"/>';}else{obj.innerHTML='<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"200\" height=\"17\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"false\" /><param name=\"movie\" value=\"'+Config.BASEPATH+'/flash/avatarUploader.swf?_v200707311936_.swf\" /><param name=\"swliveconnect\" value=\"false\"><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" /><param name=\"flashvars\" value=\"'+flashvars+'\" /></object>';}}else{window._lockMouseOverEvent=false;obj.style.display='none';}}else{var obj=document.getElementById('avatardiv');if(obj.style.display=='none'){obj.style.display='block';obj.innerHTML='<div name="avataruploadiframes" id="avataruploadiframes"><iframe src="'+uploadurl+'" frameborder="0" scrolling="no"></iframe></div>';}else{window._lockMouseOverEvent=false;obj.style.display='none';}}}
Process.inviteChangeMode=function(obj){if(obj.value=="normal"){var from=obj.parentNode.parentNode;if(from){var normal=fc(from,'div',null,"invite_normal_div",true);var grabber=fc(from,'div',null,"invite_grabber_div",true);if(grabber)
grabber.style.display='none';if(normal)
normal.style.display='block';}}else{var from=obj.parentNode.parentNode;if(from){var normal=fc(from,'div',null,"invite_normal_div",true);var grabber=fc(from,'div',null,"invite_grabber_div",true);if(normal)
normal.style.display='none';if(grabber)
grabber.style.display='block';}}}
Process.inviteStartGrabber=function(form){var grabber_username=fc(form,"input",{type:"text",name:"grabber_username"},null,true);var grabber_password=fc(form,"input",{type:"password",name:"grabber_password"},null,true);var grabber_provider=fc(form,"select",{name:"grabber_provider"},null,true);var grabber_start_btn=fc(form,"input",{type:"button",name:"grabber_start_btn"},null,true);if(!grabber_username||!grabber_password){MsgBar.addMsg("發生錯誤");return false;}else{if(!grabber_username.value||!grabber_password.value||!grabber_provider.value){MsgBar.addMsg("請輸入你的賬戶名稱及密碼");return false;}
var post_data={};post_data.username=grabber_username.value;post_data.password=grabber_password.value;post_data.provider=grabber_provider.value;grabber_start_btn.disabled=true;form.disabled=true;var ajx=new AjxAction('iqube','grabContactList');ajx.set('jsoned_post_data',post_data);ajx.setCallback(Process._handleGrabberResponseSubmit,form);ajx.fire();}
grabber_username=null;grabber_password=null;grabber_provider=null;grabber_start_btn=null;}
Process._handleGrabberResponseSubmit=function(result){var grabber_start_btn=fc(this,"input",{type:"button",name:"grabber_start_btn"},null,true);this.disabled=false;grabber_start_btn.disabled=false;grabber_start_btn=null;var grabResult=fc(this,"div",null,"invite_grabber_result",true);var resp=result.getResponse();var errMsg="找不到聯絡名單.";if(!resp.isException){if(!resp.result||resp.result=='[]'){grabResult.innerHTML=errMsg;MsgBar.addMsg(errMsg);return false;}
var contactLists=JSON.parse(resp.result);var contactHTML="<div style='border:1px solid #CCCCCC;padding:2px 0;width:100%;'>";contactHTML+="<div style='display:block;height:1.5em;color:000000;font-weight:bold;padding:2px 0;width:100%;background:#CCCCCC;'>結果</div>";var count=0;for(var name in contactLists){contactHTML+="<div style='display:block;width:100%;overflow-x:hidden;margin: 5px;border-bottom:1px solid #E7E7E7;'>";contactHTML+="<div style='float:left;margin-right:10px;white-space: nowrap;'><input name='checkboxes[]' value='"+count+"' type='checkbox' checked='1'/><input name='contactEmails[]' value='"+contactLists[name]+"' type='hidden'/><input name='contactLabels[]' value='"+name+"' type='hidden'/></div><div style='float:left;'>"+name+"</div>";contactHTML+="<div style='float:left;margin-left: 10px;white-space: nowrap;'>&lt;"+contactLists[name]+"&gt;</div></div>";count++;}
contactHTML+="</div>";grabResult.innerHTML=contactHTML;var dialogBody=ge('process_dialog_bd');if(dialogBody){setTimeout(function(){var dialogBody=ge('process_dialog_bd');if(dialogBody){dialogBody.style.paddingRight=parseInt(YuDom.getStyle(dialogBody,'padding-right'))+1+'px';}},100);}
contactHTML=contactLists=dialogBody=null;}else{grabResult.innerHTML="errMsg";MsgBar.addMsg(resp.html);}
result=resp=grabResult=grabber_start_btn=null;}
var PostReaderC={readers:{},handlers:{},buildReaderUrl:function(portlet)
{var url=portlet.portal.url;url+=(url.indexOf('?')>0?'&':'?')+'reader='+portlet.id;return url;},addReaderToTab:function(portlet,textOnTab,url)
{var readerUrl=portlet.readerUrl;if(!readerUrl){readerUrl=portlet.readerUrl=this.buildReaderUrl(portlet);}
if(this.readers[readerUrl]){this.handlers[readerUrl].show();this.readers[readerUrl].reenter(portlet,url);}else{var tabId=tabSet.addEmptyTab(portlet.title,readerUrl);this.handlers[readerUrl]={show:function(){return tabSet.showPane(tabId);},remove:function(){return tabSet.removeTab(tabId);},reset:function(_textOnTab,_url,_loading){return tabSet.resetTab(tabId,_textOnTab,_url,_loading);}};var reader=new PostReader(portlet,url);this.readers[readerUrl]=reader;tabSet.addEventHandler(tabId,{onEnter:function(_el,_url){return PostReaderC.show(_el,_url);},onExit:function(_el,_url,remove){return PostReaderC.hide(_el,_url,remove);},onRemove:function(_el,_url){return PostReaderC.deactivate(_el,_url);}});this._showReaderTab(readerUrl);reader=null;}},showIfExists:function(url)
{if(this.handlers[url]){this.handlers[url].show();return true;}else{return false;}},startDesign:function()
{},exitDesign:function()
{},getDesignMode:function()
{return false;},_showReaderTab:function(url)
{if(this.handlers[url]){this.handlers[url].show();}},show:function(el,url)
{if(this.readers[url]){this.readers[url].show(el);Current.switchContext(this,url);Current.canEdit=false;Toolbar.refresh();}},deactivate:function(el,url)
{if(this.readers[url]){this.readers[url].deactivate(el);this.readers[url]=null;delete this.readers[url];this.handlers[url].reset=null;this.handlers[url]=null;delete this.handlers[url];}},hide:function(el,url,remove)
{if(remove!=2){if(this.readers[url]){this.readers[url].hide(el);}}
return true;}};function PostReader(portlet,url)
{this.init();this.portlet=portlet;this.readerUrl=portlet.readerUrl;this.currentUrl=url;this.busy=false;}
PostReader.GETLIMIT=3;PostReader.PRELOADLIMIT=6;PostReader.MAXY=250;PostReader.LENPOS=50;PostReader.prototype={init:function()
{this.leftPane=null,this.rightPane=null;this.posts={};this.postpanes={};this.postlinks={};this.hidden=[];this.activeId=false;this.displayId=false;this.nomore=false;this.el=null;this.first=false;this.last=false;this.el_top=null;this.el_bottom=null;this.el_selector=null;this.portletJSON=null;this.contentcontroller=null;this._ctrlCallbackId=null;this.portal={update:function(){return false;}};this.options=Portlet.OPTION_READER;this.isDisplay=false;},show:function(element)
{if(!this.contentcontroller&&!this._ctrlCallbackId){this._ctrlCallbackId=PkgMan.load('Iqube.Post.PostView',this.show.bind(this,element));return;}
if(!this.el){this.el=element;var portalFrame=cex("div",{className:'portal_frame'});var content=cex("div",{className:'portal_content'});element.innerHTML='';at([element,[portalFrame,content]]);content.innerHTML='<table cellpadding="0" cellspacing="0" border="0" class="readerTable" width="100%"><tbody><tr valign="top"><td class="tdLeftPane"><div class="top"></div><div class="control"></div><div class="wrapper"><div class="leftPane"><div class="bottom"></div></div></div></td>'+'<td class="tdRightPane"><div class="rightPane"></div></td></tr></table>';this.el_top=fc(content,'div',null,'top',true);this.control=this.el_top.nextSibling;this.wrapper=fc(content,'div',null,'wrapper',true);ac(this.control,cex('span',{innerHTML:'最前',title:'key: Home',onclick:this.onclickEvent('top')}),cex('span',{innerHTML:'向上',title:'key: Up/++Pgup',onclick:this.onclickEvent('up')}),cex('span',{innerHTML:'往下',title:'key: Down/++Pgdown',onclick:this.onclickEvent('down')}),cex('span',{innerHTML:'最後',title:'key: End',onclick:this.onclickEvent('end')}));this.leftPane=fc(content,'div',null,'leftPane',true);this.el_bottom=this.leftPane.lastChild;this.rightPane=fc(content,'div',null,'rightPane',true);this.el_selector=cex('div',{className:'selector',style:{height:'50px',top:PostReader.LENPOS+'px'}});ac(this.wrapper,this.el_selector);this.effect2=new fx.Custom(this.el_selector);this.leftPane.style.top=PostReader.LENPOS+'px';this.effect=new fx.Custom(this.leftPane);var limit=parseInt(this.portlet.filter.limit||this.portlet.lastLimit)||5;var offset=parseInt(this.portlet.filter.offset||this.portlet.lastOffset)||0;PostReaderC.handlers[this.readerUrl].reset(this.portlet.title,null,true);this.getPostAggregate(offset,limit);this.contentcontroller=new Iqube.Post.PostView(this,this.rightPane);this._ctrlCallbackId=null;element.portletObj=this;content=null;element=null;portalFrame=null;}else{this.showUrl(this.currentUrl);}
this.isDisplay=true;if(ie){YuEvent.addListener(this.wrapper,'mousewheel',this.mouseWheel,this,true);}else if(mz){YuEvent.addListener(this.wrapper,'DOMMouseScroll',this.mouseWheel,this,true);}
YuEvent.addListener(document,'keydown',this.keydownEvent,this,true);},getController:function(){return this.contentcontroller;},hide:function()
{if(this.isDisplay){YuEvent.removeListener(document,'keydown',this.keydownEvent);if(ie){YuEvent.removeListener(this.wrapper,'mousewheel',this.mouseWheel);}else if(mz){YuEvent.removeListener(this.wrapper,'DOMMouseScroll',this.mouseWheel);}}
this.isDisplay=false;},updateLens:function(height,nodelay)
{if(this.isDisplay&&(height!=parseInt(this.el_selector.style.height))){if(!nodelay){this.effect2.again({duration:300,fields:{height:{to:height,unit:'px'}}});this.effect2.custom(0,1);}else{this.el_selector.style.height=height+'px';}}},deactivate:function()
{this.hide();this.switchActive(false);this.effect=null;this.effect2=null;this.contentcontroller&&this.contentcontroller.deactivate&&this.contentcontroller.deactivate(this.rightPane);this.contentcontroller=null;if(this.leftPane)Dispatch.unHook(this.leftPane);Dispatch.unHook(this.rightPane);ImgFadeIn.unhook(this.rightPane);(function(a){a.onclick='';}).apply2all(fc(this.control,'span'));this.control=null
this.wrapper=null;for(var i=0,e=this.postpanes.length;i<e;i++){this.postpanes[i]=null;this.postlinks[i]=null;}
this.el.portletObj=null;this.hidden=null;this.init();},switchActive:function(id)
{if(this.activeId!==false){this.activeId=false;}
if(id!==false){var scrollTop=this.postlinks[id].offsetTop-PostReader.LENPOS;this.updateLens(this.postlinks[id].offsetHeight);this.effect.again({duration:300,fields:{top:{to:-scrollTop,unit:'px'}},onComplete:function(){var ereader=fp(this.el,null,{portletObj:true});if(!ereader)return;var _this=ereader.portletObj;if(_this.displayId!==false){if(!mz){var flashObject=fc(_this.postpanes[_this.displayId],'object',null,null);for(var i=0;i<flashObject.length;i++){flashObject[i].setVariable("vstatus","stop");}}
_this.postpanes[_this.displayId].style.display='none';}
if(_this.activeId!==false)_this.postpanes[_this.activeId].style.display='block';_this.displayId=_this.activeId;if(!_this.postlinks[_this.displayId].haveread){var url=_this.postlinks[_this.displayId].firstChild.href;_this.tGetData=setTimeout((function(e){this.markPostAsRead(this.displayId,url);}).bind(_this),3000);}
_this=null;ereader=null;}});this.effect.custom(0,1);this.activeId=id;ClickHandler.clearCurrent();}else{this.el_selector.style.display='none';}
if(this.tGetData)clearTimeout(this.tGetData);this.tGetData=null;},keydownEvent:function(e){var keycode=e.keyCode;switch(keycode){case 38:case 37:this.move(-1);;break;case 33:this.move(-5);break;case 40:case 39:case 9:this.move(1);break;case 34:this.move(5);break;case 36:this.showUrl(this.first);break;case 35:this.showUrl(this.last-1);break;default:return;}
YuEvent.stopEvent(e);return false;},onclickEvent:function(action){var _this=this;switch(action){case'up':return function(e){_this.move(-5);};break;case'top':return function(e){_this.showUrl(_this.first);};break;case'down':return function(e){_this.move(5);};break;case'end':return function(e){_this.showUrl(_this.last-1);};break;}},move:function(moveby){if(this.activeId===false)return;if(this.activeId+moveby<this.first){this.showUrl(this.first);}else if(this.activeId+moveby>=this.last){this.showUrl(this.last-1);}else{this.showUrl(this.activeId+moveby);}},mouseWheel:function(e){if(ie){this.move(e.wheelDelta>0?-1:1);}else{this.move(e.detail>0?1:-1);}
YuEvent.stopEvent(e);return false;},getMore:function(down){if(this.busy)return;if(this.activeId===false)return;if(down&&!this.nomore&&(this.last-this.activeId<PostReader.PRELOADLIMIT)){this.getPostAggregate(this.last,PostReader.GETLIMIT);return true;}else if(!down&&this.first>0&&(this.activeId-this.first<PostReader.PRELOADLIMIT)){var offset=this.first-PostReader.GETLIMIT;var limit=PostReader.GETLIMIT;if(offset<0){limit+=offset;offset=0;}
this.getPostAggregate(offset,limit);return true;}else{return false;}},getMorePost:function(id,down){for(var i=1;i<=PostReader.GETLIMIT;i++){if(down&&id+i<this.last&&!this.postpanes[id+i]){this.getReaderPost(id+i);break;}else if(!down&&id-i>=this.first&&!this.postpanes[id-i]){this.getReaderPost(id-i);break;}}
if(i<=PostReader.GETLIMIT){return true;}else{return false;}},reset:function(url){var element=this.el;this.deactivate();this.currentUrl=url;this.show(element);},reenter:function(portlet,url){if(!this.isDisplay){var filter=clone(portlet.filter);delete filter.limit;delete filter.offset;var portletJSON=JSON.stringify({filter:filter,menuId:portlet.menuId});if(this.portletJSON&&(portletJSON!=this.portletJSON)){this.reset(url);}else{this.showUrl(url);}}else{this.showUrl(url);}},showUrl:function(url){if(typeof url=='string'){var id=this.posts[url];}else{var id=url;}
var marginTop=parseInt(this.leftPane.style.top);for(var i=0;i<this.hidden.length;i++){this.hidden[i].style.display='block';marginTop-=this.hidden[i].offsetHeight;this.leftPane.style.top=marginTop+'px';}
this.hidden=[];if(typeof id!='undefined'){var link=this.postlinks[id];if(!link)return false;url=link.firstChild.href;if(this.postpanes[id]){if(id!==this.activeId){this.switchActive(id);this.currentUrl=url;}else{if(ie){this.updateLens(this.postlinks[id].offsetHeight);}}
do{if(this.getMorePost(id,true))break;if(this.getMore(true))break;if(this.getMorePost(id,false))break;if(this.getMore(false))break;}while(false);}else{this.getReaderPost(id,url);if(id!==this.activeId){this.switchActive(id);this.currentUrl=url;}}}else{if(typeof url=='string'&&this.activeId!==false){this.reset(url);}else{this.showUrl(this.first);if(url)MsgBar.addMsg('請將內容方格刷新來提取最新文章');}}
if(this.activeId!==false){this.el_top.innerHTML='展示第'+(this.activeId+1)+'頁 ( '+(this.first+1)+' - '+this.last+')';}},getPostAggregate:function(offset,limit)
{if(this.busy)return;this.busy=true;var portlet=this.portlet;if(!this.portletJSON){var filter=clone(portlet.filter);delete filter.limit;delete filter.offset;this.portletJSON=JSON.stringify({filter:filter,menuId:portlet.menuId});}
var ajx=new AjxAction('portal','getPostAggregate');ajx.set("portlet",this.portletJSON);ajx.set("offset",offset);ajx.set("limit",limit);ajx.set("url",portlet.portal.url);if(portlet.depend){if(!this.dependJSON){var dependPortlet=portlet.portal.portlets[portlet.depend];this.dependJSON=JSON.stringify({filter:dependPortlet.filter,menuId:dependPortlet.menuId});}
ajx.set("dependPortlet",this.dependJSON);}
ajx.setCallback(new AjxCallback(this,this._getPostAggregateCallback,[offset,limit]));ajx.fire();},_getPostAggregateCallback:function(result,args)
{if(!this.el)return;var limit=parseInt(args[1]);var offset=parseInt(args[0]);var resp=result.getResponse();this.busy=false;if(!resp.isException){var data=resp.data;var e=data.length;if(e>0){var dataurl;var tmpRightPane=cex('div',{innerHTML:resp.html});for(var i=0;i<e;i++){dataurl=data[i].url;this.posts[dataurl]=i+offset;if(data[i].haveread=='true'){var headline=cex('div',{className:'posttypeid'+data[i].typeid+' headline',haveread:true});}else{var headline=cex('div',{className:'posttypeid'+data[i].typeid+' headline unread',haveread:false});}
if((this.first!==false)&&i+offset<this.first){headline.style.display='none';this.hidden.push(headline);ib(headline,this.postlinks[this.first]);}else{ib(headline,this.el_bottom);}
ac(headline,cex('a',{href:dataurl,onclick:Dispatch.goEvent,innerHTML:data[i].title}));ac(headline,cex('div',{innerHTML:data[i].groupdn||''}));this.postlinks[i+offset]=headline;var pane=rec(tmpRightPane);if(pane&&pane.getAttribute('url')==dataurl){this.postpanes[i+offset]=pane;ac(this.rightPane,pane);ImgFadeIn.hook(pane);Dispatch.hook(pane);}}
tmpRightPane=null;if(this.currentUrl===false){this.currentUrl=data[0].url;}
if(this.first===false||offset<this.first)this.first=offset;if(this.last===false||offset+e>this.last)this.last=offset+e;if(e<limit){this.nomore=true;this.el_top.className+=' nomore';}
if(this.activeId===false)PostReaderC.handlers[this.readerUrl].reset(null,null,false);this.showUrl(this.currentUrl);}else{this.nomore=true;this.el_top.className+=' nomore';if((this.activeId===false)&&this.last)this.showUrl(this.last-1);}}else{this.nomore=true;this.el_top.className+=' nomore';MsgBar.addMsg(resp.data,'error');if(this.last){this.showUrl(this.last-1);}else{PostReaderC.handlers[this.readerUrl].remove();}}},markPostAsRead:function(id,url)
{var ajx=new AjxAction('iqube','markPostAsRead');ajx.set('url',url||getRawHref(this.postlinks[id].firstChild));ajx.setCallback(new AjxCallback(this,this._markPostAsReadCallback,[]));ajx.fire();Element.replaceClassName(this.postlinks[id],'unread','');this.postlinks[id].haveread=true;this.updateLens(this.postlinks[id].offsetHeight,true);window.gPortalC&&gPortalC.invalidate();return false;},_markPostAsReadCallback:function(result,args)
{if(!this.el)return;var resp=result.getResponse();if(resp.isException){}else{}},getReaderPost:function(id,url)
{var ajx=new AjxAction('portal','getReaderPost');ajx.set('url',url||getRawHref(this.postlinks[id].firstChild));ajx.setCallback(new AjxCallback(this,this._getReaderPostCallback,[id,url]));ajx.fire();this.postpanes[id]=cex('div',{className:'reader-block lightblue post',innerHTML:'<img src="'+Config.BASEPATH+'/portal/images/loading.gif" />'});ac(this.rightPane,this.postpanes[id]);return false;},_getReaderPostCallback:function(result,args)
{if(!this.el)return;var id=args[0];var url=args[1];var resp=result.getResponse();if(resp.isException){this.postpanes[id].className+=' error';}else{if(resp.data.groupdn){this.postlinks[id].lastChild.innerHTML=resp.data.groupdn;}}
this.postpanes[id].innerHTML=resp.html;ImgFadeIn.hook(this.postpanes[id],false);Dispatch.hook(this.postpanes[id]);if(this.activeId!==false)this.showUrl(this.activeId);}}
Iqube.AutoComplete2=function(sInputId,objDataSource)
{if(!window.encodeURIComponent||arguments.length==0){return;};var _Class=this;_Class.objDataSource=objDataSource;var oNode=sInputId;if(!oNode){alert("<input /> does not exist");return;};oNode.setAttribute("autocomplete","off");var oNodeList=document.createElement("div");if(document.body.firstChild){document.body.insertBefore(oNodeList,document.body.firstChild);}else{document.body.appendChild(oNodeList);};oNodeList.className="select-free1 AutoComplete-list";var os=oNodeList["style"];os["position"]="absolute";os["top"]=0;os["left"]=0;os["width"]="auto";os["overflow"]="hidden";os["zIndex"]=99999;os["visibility"]="hidden";_Class.tSetListPosition=setTimeout("void(0)",0);_Class.tGetData=setTimeout("void(0)",0);_Class.tBlur=setTimeout("void(0)",0);_Class.sKeyValue=_Class.trim(oNode.value);function _onInputKeyUp(e)
{if(!_Class.oNode)return;clearTimeout(_Class.tBlur);var ek=e.keyCode;if(ek==27){_clearData();}else if((ek==40||ek==38)&&(window.opera==null)){if(oNodeList.style.visibility.toLowerCase()!="hidden")
{var tds=oNodeList.getElementsByTagName("td");if(tds.length>0)
{var i=(ek==40)?1:-1;var n=oNodeList.selectedIndex;n+=i;if(n<0){n=tds.length-1}
else if(n>(tds.length-1)){n=0;};if(tds[n]){oNodeList.selectedIndex=n;_tdHover(e,tds[n]);YuEvent.stopPropagation(e);YuEvent.preventDefault(e);return false;};};}else{}}else if(_Class.inFocus){_Class.suggest();};};function suggest(bForce)
{var v=_Class.trim(oNode.value);var temp=v.split(',');var input=_Class.trim(temp[temp.length-1]);if(bForce||_Class.sKeyValue!=input)
{_clearData();clearTimeout(_Class.tGetData);if(input.length>1){_Class.tGetData=setTimeout(_getData(input),400);}
_Class.sKeyValue=input;}};function _onInputKeyDown(e)
{if(!_Class.oNode)return;clearTimeout(_Class.tBlur);var ek=e.keyCode;if(ek==40||ek==38){YuEvent.stopPropagation(e);YuEvent.preventDefault(e);return false;};if(ek==13){if(oNodeList.style.visibility.toLowerCase()!="hidden")
{var tds=oNodeList.getElementsByTagName("td");if(tds.length>0){var n=oNodeList.selectedIndex;if(tds[n])
{_tdHover(e,tds[n]);_tdSelect(e,tds[n]);YuEvent.stopPropagation(e);YuEvent.preventDefault(e);return false;};};};};};function _tdHover(e,td)
{td=td||this;if(oNodeList.selectedTD!=null){if(oNodeList.selectedTD!=td){oNodeList.selectedTD.className='';};};if(oNodeList.selectedTD!=td){oNodeList.selectedTD=td;td.className='AutoComplete-row-select';};YuEvent.stopPropagation(e);YuEvent.preventDefault(e);return false;};function encodeItem(jsObj,strKey){var jsItem={'html':"",'match':false};var strValue=jsObj;var k1=strKey;var k2=_Class.trim(strValue);if(k1!=""&&k2!="")
{var ndx=k2.toLowerCase().indexOf(strKey.toLowerCase());if(ndx>=0){var k0=k2.substr(0,ndx);k1=k2.substr(ndx,k1.length);var k3=k2.substr(ndx+k1.length);var html=['<em>',_Class.htmlEncode(k2),'</em><span>',_Class.htmlEncode(k0),'</span><strong>',_Class.htmlEncode(k1),'</strong><span>',(_Class.htmlEncode(k3)),'</span>'].join('');jsItem={'html':html,'match':k2==k1};}
else{var html=['<em>',_Class.htmlEncode(k2),'</em><span>',(_Class.htmlEncode(k2)),'</span>'].join('');jsItem={'html':html,'match':false};}}
return jsItem;};function decodeItem(html){var elTmp=cex('div',{innerHTML:html});var elEm=elTmp.getElementsByTagName('em')[0];var value=elEm.innerHTML;return value;};function _tdSelect(e,td)
{td=td||this;var temp=oNode.value.split(',');temp[temp.length-1]=_Class.decodeItem(td.innerHTML);oNode.value=temp.join(',');_Class.sKeyValue=temp[temp.length-1];YuEvent.stopPropagation(e);YuEvent.preventDefault(e);_clearData();if(_Class.onSelect){_Class.onSelect(td.jsObj);}
return false;};function _getData(tmpstr)
{if(!_Class.inFocus&&!_Class.bLazyMode)return;var f=function(){objDataSource.getData(tmpstr);};return f;};function _clearData()
{var tds=oNodeList.getElementsByTagName("td");for(var i=0;i<tds.length;i++)
{YuEvent.removeListener(tds[i],"mouseover",_tdHover);YuEvent.removeListener(tds[i],"mousedown",_tdSelect);};tds=null;if(oNodeList.style.visibility.toLowerCase()!="hidden"){oNodeList.style.visibility="hidden";oNodeList.innerHTML="";clearTimeout(_Class.tSetListPosition);};};function _showData(arrData)
{var aHTML=[];var w=oNode['offsetWidth'];if(!w||(!_Class.bLazyMode&&!_Class.inFocus))return;var x=18;var ndxSelected=0;for(var i=0;i<arrData.length;i++)
{var jsItem=_Class.encodeItem(arrData[i],_Class.sKeyValue);if(jsItem.match){ndxSelected=i;}
aHTML[i]=['\n<tr class="AutoComplete-row '+(i%2?'odd':'even')+'"><td>',jsItem.html,'</td></tr>'].join('');}
if(arrData.length>0)
{oNodeList.innerHTML=['<table class="AutoComplete-table"><tbody>',aHTML.join(''),'</tbody></table>','<!--[if lte IE 6.5]><iframe></iframe><![endif]-->'].join('');var os=oNodeList['style'];os['visibility']="visible";oNode.focus();var tds=oNodeList.getElementsByTagName("td");for(var i=0;i<tds.length;i++)
{tds[i].jsObj=arrData[i];YuEvent.addListener(tds[i],"mouseover",_tdHover);YuEvent.addListener(tds[i],"mousedown",_tdSelect);};tds[ndxSelected].className='AutoComplete-row-select';oNodeList.selectedTD=tds[ndxSelected];oNodeList.selectedIndex=ndxSelected;function __rePosition()
{clearTimeout(_Class.tSetListPosition);if(!oNode['offsetWidth'])return;var p=getXY(oNode);if(document.uniqueID&&(location.href.toLowerCase().indexOf("tw")>0||location.href.toLowerCase().indexOf("kimo")>0))
{os['top']=p.y+oNode['offsetHeight']-4+"px";os['left']=p.x+"px";os['width']=oNode['offsetWidth']+"px";}
else
{os['top']=p.y+oNode['offsetHeight']+"px";os['left']=p.x+"px";os['width']=oNode['offsetWidth']-3+"px";}
_Class.tSetListPosition=setTimeout(__rePosition,400);};clearTimeout(_Class.tSetListPosition);__rePosition();}
else
{_clearData()};};function _returnData(arrData,searchKey)
{if(_Class.sKeyValue!=""&&_Class.sKeyValue==searchKey){if(arrData.constructor==Array&&arrData.length>0){_showData(arrData);return;}}
_clearData();};function _onInputBlur(e)
{clearTimeout(_Class.tBlur);YuEvent.removeListener(oNode,"keyup",_onInputKeyUp);YuEvent.removeListener(oNode,"keydown",_onInputKeyDown);YuEvent.removeListener(oNode,'blur',_onInputBlur);YuEvent.addListener(oNode,'focus',_onInputFocus);var byebye=function(){_clearData();};_Class.tBlur=setTimeout(byebye,100);_Class.inFocus=false;};function _onInputFocus(e)
{clearTimeout(_Class.tBlur);YuEvent.addListener(oNode,'blur',_onInputBlur);YuEvent.removeListener(oNode,'focus',_onInputFocus);if(!_Class.bLazyMode){YuEvent.addListener(oNode,"keyup",_onInputKeyUp);YuEvent.addListener(oNode,"keydown",_onInputKeyDown);}
_Class.inFocus=true;};YuEvent.addListener(oNode,'focus',_onInputFocus);_Class.objDataSource.onDataReturn=function(arrData,searchKey){if(_Class.bLazyMode&&_Class.onDataReturned){_Class.onDataReturned(arrData,searchKey);}
_returnData(arrData,searchKey);};_Class.oNode=oNode;_Class.oNodeList=oNodeList;_Class._onInputFocus=_onInputFocus;_Class._onInputBlur=_onInputBlur;_Class._showData=_showData;_Class._clearData=_clearData;_Class._getData=_getData;_Class._tdSelect=_tdSelect;_Class._tdHover=_tdHover;_Class._onInputKeyDown=_onInputKeyDown;_Class._onInputKeyUp=_onInputKeyUp;_Class.suggest=suggest;_Class.encodeItem=encodeItem;_Class.decodeItem=decodeItem;};Iqube.AutoComplete2._className="Iqube.AutoComplete2";Iqube.AutoComplete2.prototype.trim=function(sString){return sString.replace(/(^\s+)|\s+$/g,"");}
Iqube.AutoComplete2.prototype.htmlEncode=function(str){str=str.replace(/&/ig,"&amp;");str=str.replace(/</ig,"&lt;");str=str.replace(/>/ig,"&gt;");str=str.replace(/\x22/ig,"&quot;");str=str.replace(/\xA0/gi,"&nbsp;");str=str.replace(/\xC6/g,"&#198;");str=str.replace(/\xE6/g,"&#230;");str=str.replace(/\xD8/g,"&#216;");str=str.replace(/\xF8/g,"&#248;");str=str.replace(/\xC5/g,"&#197;");str=str.replace(/\xE5/g,"&#229;");return str;};Iqube.AutoComplete2.prototype.htmlDecode=function(str){str=str.replace(/&amp;/ig,"&");str=str.replace(/&lt;/ig,"<");str=str.replace(/&gt;/ig,">");str=str.replace(/&quot;/ig,"x22");str=str.replace(/&nbsp;/gi,"&xA0");str=str.replace(/&#198;/g,"xC6");str=str.replace(/&#230;/g,"xE6");str=str.replace(/&#216;/g,"xD8");str=str.replace(/&#248;/g,"xF8");str=str.replace(/&#197;/g,"xC5");str=str.replace(/&#229;/g,"xE5");return str;};Iqube.AutoComplete2.prototype.deactivate=function(_Class){_Class=_Class||this;this.destruct(_Class);};Iqube.AutoComplete2.prototype.destruct=function(_Class){_Class=_Class||this;if(_Class.oNodeList){var tds=_Class.oNodeList.getElementsByTagName("td");for(var i=0;i<tds.length;i++)
{};tds=null;_Class.oNodeList.selectedTD=null;rn(_Class.oNodeList);}
YuEvent.removeListener(_Class.oNode,'focus',_Class._onInputFocus);YuEvent.removeListener(_Class.oNode,'blur',_Class._onInputBlur);_Class._onInputFocus=null;_Class._onInputBlur=null;_Class._showData=null;_Class._clearData=null;_Class._getData=null;_Class._tdSelect=null;_Class._tdHover=null;_Class._onInputKeyDown=null;_Class._onInputKeyUp=null;_Class.tSetListPosition=null;_Class.tGetData=null;_Class.tBlur=null;_Class.sKeyValue=null;_Class.oNode=null;_Class.oNodeList=null;_Class.objDataSource=null;_Class.suggest=null;_Class.onSelect=null;_Class.encodeItem=null;_Class.decodeItem=null;_Class.onDataReturned=null;_Class=null;}
Iqube.AutoComplete2.prototype.toString=function(){this._className=this._className||getClassName(this);return this._className;}
Iqube.ACDataSource=function(){};Iqube.ACDataSource.prototype.constructor=Iqube.ACDataSource;Iqube.ACDataSource.prototype.getData=function(searchKey){YAHOO.log('Error: ACDataSource.getData has been implemented!');};Iqube.ACDataSource.prototype.onDataReturn=function(arrData){YAHOO.log('Error: ACDataSource.onDataReturn has been implemented!');};Iqube.ACDataSource._className="Iqube.ACDataSource";Iqube.TagAutoComplete=function(sInputId,nTypeid){this.base=Iqube.AutoComplete2;if(arguments.length==1){var nTypeid=Tag.TYPE_POST;}
var ds=new Iqube.ACDataSource();ds.getData=function(searchKey){ds.ajxCallback=function(result){var arrData=result.getResponse().result;this.onDataReturn(arrData,searchKey);};new AjxAction('iqube','tagAutoCompletion',{key:searchKey,typeid:nTypeid},ds.ajxCallback.bind(ds)).fire();};this.base.call(this,sInputId,ds);sInputId=null;};Iqube.TagAutoComplete.prototype=new Iqube.AutoComplete2;Iqube.TagAutoComplete.prototype.constructor=Iqube.TagAutoComplete;Iqube.TagAutoComplete._className="Iqube.TagAutoComplete";Iqube.EmailAutoComplete=function(sInputId,arrData){this.base=Iqube.AutoComplete2;var ds=new Iqube.ACDataSource();ds.getData=function(searchKey){if(searchKey){var strlen=searchKey.length;var pdata=new Array();for(var i=0;i<arrData.length;i++){if(arrData[i].length<strlen){continue;}
if((arrData[i].indexOf(searchKey))==0){pdata.push(arrData[i]);}}
this.onDataReturn(pdata,searchKey);}}
this.base.call(this,sInputId,ds);sInputId=null;return;};Iqube.EmailAutoComplete.prototype=new Iqube.AutoComplete2;Iqube.EmailAutoComplete.prototype.constructor=Iqube.RssAutoComplete;Iqube.EmailAutoComplete._className="Iqube.EmailAutoComplete";Iqube.RssAutoComplete=function(sInputId){this.base=Iqube.AutoComplete2;var ds=new Iqube.ACDataSource();ds.getData=function(searchKey){ds.ajxCallback=function(result){var arrData=result.getResponse().result;this.onDataReturn(arrData,searchKey);};new AjxAction('iqube','getRssGroup',{searchKey:searchKey},ds.ajxCallback.bind(ds)).fire();};this.base.call(this,sInputId,ds);sInputId=null;};Iqube.RssAutoComplete.prototype=new Iqube.AutoComplete2;Iqube.RssAutoComplete.prototype.constructor=Iqube.RssAutoComplete;Iqube.RssAutoComplete._className="Iqube.RssAutoComplete";Iqube.GeoLocAutoComplete=function(sInputId){this.base=Iqube.AutoComplete2;var ds=new Iqube.ACDataSource();ds.getData=function(searchKey){ds.ajxCallback=function(result){var arrData=result.getResponse().result;this.onDataReturn(arrData,searchKey);};new AjxAction('iqube','geoLocLookUp',{strLocation:searchKey.replace(/,/,' ')},ds.ajxCallback.bind(ds)).fire();};this.base.call(this,sInputId,ds);sInputId=null;};Iqube.GeoLocAutoComplete.prototype=new Iqube.AutoComplete2;Iqube.GeoLocAutoComplete.prototype.constructor=Iqube.GeoLocAutoComplete;Iqube.GeoLocAutoComplete._className="Iqube.GeoLocAutoComplete";Iqube.AliasnameAutoComplete=function(sInputId){this.base=Iqube.AutoComplete2;var ds=new Iqube.ACDataSource();ds.getData=function(searchKey){var tokens=searchKey.split(',');var tok=tokens[tokens.length-1];ds.ajxCallback=function(result){var arrData=result.getResponse().result;this.onDataReturn(arrData,searchKey);};new AjxAction('iqube','userLookup',{searchKey:tok},ds.ajxCallback.bind(ds)).fire();};this.base.call(this,sInputId,ds);sInputId=null;};Iqube.AliasnameAutoComplete.prototype=new Iqube.AutoComplete2;Iqube.AliasnameAutoComplete.prototype.constructor=Iqube.AliasnameAutoComplete;Iqube.AliasnameAutoComplete._className="Iqube.AliasnameAutoComplete";Iqube.GrouppathAutoComplete=function(sInputId){this.base=Iqube.AutoComplete2;var ds=new Iqube.ACDataSource();ds.getData=function(searchKey){var tokens=searchKey.split(',');var tok=tokens[tokens.length-1];ds.ajxCallback=function(result){var arrData=result.getResponse().result;this.onDataReturn(arrData,searchKey);};new AjxAction('iqube','groupLookup',{searchKey:tok},ds.ajxCallback.bind(ds)).fire();};this.base.call(this,sInputId,ds);sInputId=null;};Iqube.GrouppathAutoComplete.prototype=new Iqube.AutoComplete2;Iqube.GrouppathAutoComplete.prototype.constructor=Iqube.GrouppathAutoComplete;Iqube.GrouppathAutoComplete._className="Iqube.GrouppathAutoComplete";Iqube.GroupName1AutoComplete=function(sInputId){this.base=Iqube.AutoComplete2;var ds=new Iqube.ACDataSource();ds.getData=function(searchKey){var tokens=searchKey.split(',');var tok=tokens[tokens.length-1];ds.ajxCallback=function(result){var arrData=result.getResponse().result;this.onDataReturn(arrData,searchKey);};new AjxAction('iqube','groupName1Lookup',{searchKey:tok},ds.ajxCallback.bind(ds)).fire();};this.base.call(this,sInputId,ds);sInputId=null;};Iqube.GroupName1AutoComplete.prototype=new Iqube.AutoComplete2;Iqube.GroupName1AutoComplete.prototype.constructor=Iqube.GroupName1AutoComplete;Iqube.GroupName1AutoComplete._className='Iqube.GroupName1AutoComplete';Iqube.PeopleAutoComplete=function(sInputId){this.base=Iqube.AutoComplete2;var ds=new Iqube.ACDataSource();ds.getData=function(searchKey){var tokens=searchKey.split(',');var tok=tokens[tokens.length-1];ds.ajxCallback=function(result){var arrData=result.getResponse().result;this.onDataReturn(arrData,searchKey);};if(tok.charAt(0)=='@'){new AjxAction('iqube','groupLookup',{searchKey:tok.substring(1)},ds.ajxCallback.bind(ds)).fire();}
else{new AjxAction('iqube','userLookup',{searchKey:tok},ds.ajxCallback.bind(ds)).fire();}};this.base.call(this,sInputId,ds);sInputId=null;};Iqube.PeopleAutoComplete.prototype=new Iqube.AutoComplete2;Iqube.PeopleAutoComplete.prototype.constructor=Iqube.PeopleAutoComplete;Iqube.PeopleAutoComplete._className="Iqube.PeopleAutoComplete";Iqube.HintBox=function(sInputId,objDataSource,rClass)
{if(!window.encodeURIComponent||arguments.length==0){return;}
var _Class=this;_Class.objDataSource=objDataSource;var oNode=sInputId;var oNodeList=document.createElement("div");if(document.body.firstChild){document.body.insertBefore(oNodeList,document.body.firstChild);}else{document.body.appendChild(oNodeList);};var os=oNodeList["style"];os["position"]="absolute";os["top"]=0;os["left"]=0;os["width"]="200px";os["overflow"]="hidden";os["zIndex"]=99999;os["visibility"]="hidden";os["border"]="5px solid #D7D7D7";_Class.objDataSource.onDataReturn=function(arrData){if(arrData&&arrData.length>0){_returnData(arrData);}};function _returnData(arrData){if(arrData&&arrData.length>0){_showData(arrData);return;}}
function _showData(arrData){YuEvent.removeListener(oNode,'focus');rClass._showData(arrData,oNode,oNodeList);}
function _onInputFocus(e){objDataSource.getData();YuEvent.addListener(oNode,"keyup",_onInputKeyUp);YuEvent.addListener(oNode,"keydown",_onInputKeyDown);}
function _onInputBlur(e){setTimeout(clearUp,400);}
function _onInputKeyDown(e){clearUp();}
function _onInputKeyUp(e){}
function clearUp(){var os=oNodeList["style"];os["visibility"]="hidden";os=null;}
objDataSource.getData();YuEvent.addListener(oNode,"keyup",_onInputKeyUp);YuEvent.addListener(oNode,"keydown",_onInputKeyDown);YuEvent.addListener(oNode,'blur',_onInputBlur);os=null;_Class=null;}
Iqube.HintBox._className="Iqube.HintBox";Iqube.HintBox.prototype.trim=function(sString){return sString.replace(/(^\s+)|\s+$/g,"");}
Iqube.HintBox.prototype.htmlEncode=function(str){str=str.replace(/&/ig,"&amp;");str=str.replace(/</ig,"&lt;");str=str.replace(/>/ig,"&gt;");str=str.replace(/\x22/ig,"&quot;");str=str.replace(/\xA0/gi,"&nbsp;");str=str.replace(/\xC6/g,"&#198;");str=str.replace(/\xE6/g,"&#230;");str=str.replace(/\xD8/g,"&#216;");str=str.replace(/\xF8/g,"&#248;");str=str.replace(/\xC5/g,"&#197;");str=str.replace(/\xE5/g,"&#229;");return str;};Iqube.HintBox.prototype.htmlDecode=function(str){str=str.replace(/&amp;/ig,"&");str=str.replace(/&lt;/ig,"<");str=str.replace(/&gt;/ig,">");str=str.replace(/&quot;/ig,"x22");str=str.replace(/&nbsp;/gi,"&xA0");str=str.replace(/&#198;/g,"xC6");str=str.replace(/&#230;/g,"xE6");str=str.replace(/&#216;/g,"xD8");str=str.replace(/&#248;/g,"xF8");str=str.replace(/&#197;/g,"xC5");str=str.replace(/&#229;/g,"xE5");return str;};Iqube.HintBox.prototype.toString=function(){this._className=this._className||getClassName(this);return this._className;}
Iqube.HottestKeysHintBox=function(sInputId){this.base=Iqube.HintBox;var ds=new Iqube.ACDataSource();ds.getData=function(){ds.ajxCallback=function(result){var arrData=result.getResponse().result;this.onDataReturn(arrData);};new AjxAction('iqube','getHottestSearchKeys',{},ds.ajxCallback.bind(ds)).fire();};this.base.call(this,sInputId,ds,this);this.sInputId=sInputId;sInputId=null;ds=null;}
Iqube.HottestKeysHintBox.prototype=new Iqube.HintBox;Iqube.HottestKeysHintBox.prototype.constructor=Iqube.HottestKeysHintBox;Iqube.HottestKeysHintBox.prototype._showData=function(arrData,oNode,oNodeList){var data="<div style='color:#000000;font-weight:bold;line-height:20px;height:20px;'>熱門搜尋字 : </div>";for(var i=0;i<arrData.length;i++){var entry=arrData[i];data+="<div style='white-space:nowrap;float:left;line-height:20px;height:20px;padding:0 3px;'><a href='#' nodispatcher='1' style='font-weight:normal;text-decoration:underline;cursor:hand;color:#333333;'>"+entry.key+"</a>"+(Config.DEBUG?"&nbsp;<font color='#FF0000'>("+entry.count+")</font>":"")+"&nbsp;</div>";}
oNodeList.innerHTML=data;var os=oNodeList['style'];var p=getXY(oNode);os['top']=p.y+oNode['offsetHeight']+"px";os['left']=p.x-oNodeList['scrollWidth']+oNode['offsetWidth']+"px";os['visibility']="visible";os['backgroundColor']="#F7F7F7";os['padding']="5px";var keys=fc(oNodeList,'a',null,null,false);for(var i=0;i<keys.length;i++){keys[i].sInputId=this.sInputId;keys[i].onclick=this.insertKey;}
if(!this.oNodeList)
this.oNodeList=oNodeList;data=null;json=null;os=null;p=null;keys=null;}
Iqube.HottestKeysHintBox.prototype.insertKey=function(e){this.sInputId.value=this.innerHTML;this.sInputId.parentNode.onsubmit(e);return false;}
Iqube.HottestKeysHintBox.prototype._showHints=function(){if(this.oNodeList){var os=this.oNodeList['style'];os['visibility']="visible";os=null;}}
Iqube.HottestKeysHintBox._className="Iqube.HottestKeysHintBox";Iqube.Validator={validate:function(element)
{var attr;var isValid=true;var value=element.value;switch(element.getAttribute("validate")){case'string':if((attr=element.getAttribute("minLen"))!==null){if(value.length<attr){isValid=false;}}
if((attr=element.getAttribute("maxLen"))!==null){if(value.length>attr){isValid=false;}}
break;default:}
return isValid;},_className:"Iqube.Validator"}
function AjxAction(sServiceType,sService,oParams,oCallback,oErrorCallback,nTimeout){narg=arguments.length;if(narg<2){throw'Error: not enough parameter! Service type and service must be specified.';}
if(!AjxAction.servicePath[sServiceType]){throw'Error: specified service type "'+sServiceType+'" is not available.';}
this.sServiceType=sServiceType;this.sService=sService;this.params={};if(oParams)for(var key in oParams){this.params[key]=oParams[key];}
this.setCallback(oCallback);this.setErrorCallback(oErrorCallback);this.setTimeout(nTimeout);var sessionId=getCookie("samy");var secondary_key=getCookie("thehero");var scope=getCookie("scope");this.url=[Config.HOMESITE+Config.BASEPATH+AjxAction.servicePath[this.sServiceType],'?service='+sService,'&samy='+escape(sessionId),'&thehero='+escape(secondary_key),'&scope='+escape(scope),'&userid='+escape(Alias.id)].join('');}
AjxAction.ERROR_ID_CHANGED=1;AjxAction.ERROR_NO_METHOD=2;AjxAction.ERROR_MISSING_PARAM=3;AjxAction.servicePath={'portal':"/service/soap/PortalService.php",'process':"/service/soap/ProcessService.php",'iqube':"/service/soap/IqubeSoapService.php"};AjxAction.prototype.toString=function(){return'AjxAction';};AjxAction.prototype.set=function(attr,value){if(attr=='method'){throw'Error: method can only specified in constructor';}
this.params[attr]=value;};AjxAction.prototype.setCallback=function(callback,owner,args){if(arguments.length>=2&&callback.constructor==Function){callback=new AjxCallback(owner,callback,args);}
if(callback==null){this.oCallback=null;}
else if(callback.constructor==Function){this.oCallback=new AjxCallback(null,callback);}
else if(callback.constructor==AjxCallback){this.oCallback=callback;}
else{var t=null;t=t.dummy;throw'Error setCallback: callback must either be function or AjxCallback';}};AjxAction.prototype.setErrorCallback=function(callback,owner,args){if(arguments.length>=2&&callback.constructor==Function){callback=new AjxCallback(owner,callback,args);}
if(callback==null){this.oErrorCallback=null;}
else if(callback.constructor==Function){this.oErrorCallback=new AjxCallback(null,callback);}
else if(callback.constructor==AjxCallback){this.oCallback=callback;}
else{var t=null;t=t.dummy;}};AjxAction.prototype.setTimeout=function(nSecond){this.nTimeout=nSecond||Config.DEBUG?0:30;};AjxAction.prototype.getQueryString=function(){var strings=[];for(var key in this.params){var value=this.params[key];if(typeof value=="object"){value=JSON.stringify(value);}
strings.push(key+'='+encodeURIComponent(value));}
return strings.join('&');};AjxAction.prototype.handleSuccess=function(o){if(this.timeoutId)clearTimeout(this.timeoutId);try{var responseObj=JSON.parse(o.responseXML.getElementsByTagName('_r')[0].childNodes[0].nodeValue);var serverError=o.responseXML.getElementsByTagName('_e')[0].childNodes[0].nodeValue;}catch(e){}
if(serverError)this.logError(serverError);this.logResult(responseObj||o.responseText);if(responseObj&&responseObj.ajaxError){if(responseObj.ajaxError==AjxAction.ERROR_ID_CHANGED){if(confirm('您的登入鑰已被修改，這有可能是因為您曾在其他視窗中瀏覽本站，或 cookies 上的遺失，或其他不尋常的動作而導致您的登入鑰有所改動。請重新登入本站 (未儲存的資料會遺失)。如不作出重新登入而繼續瀏覽，可能會引致其他不尋常的事件發生。\n\n* 重新載入目前網頁請按OK鍵\n* 取消及保持現况')){Dispatch.refresh();return;}}
responseObj.isException=true;}
var result=new AjxResult(responseObj||{isException:true});if(this.oCallback)this.oCallback.run(result);};AjxAction.prototype.handleFailure=function(o){this.logResponse(o);if(this.timeoutId)clearTimeout(this.timeoutId);var result=new AjxResult(JSON.parse(o.statusText));if(this.oErrorCallback){this.oErrorCallback.run(result);}else if(this.oCallback){this.oCallback.run(new AjxResult({isException:true,html:"發生錯誤"},false));}};AjxAction.prototype.fire=function(){var oCallback={success:this.handleSuccess.bind(this),failure:this.handleFailure.bind(this)};this.query=this.getQueryString();this.request=YAHOO.util.Connect.asyncRequest('POST',this.url,oCallback,this.query);if(this.nTimeout)this.timeoutId=setTimeout(this.onTimeout.bind(this),this.nTimeout*1000);this.logRequest();};AjxAction.prototype.onTimeout=function(){YAHOO.util.Connect.abort(this.request);var result=new AjxResult('Abort: timed out!',true);if(this.oErrorCallback){this.oErrorCallback.run(result);}else if(this.oCallback){this.oCallback.run(new AjxResult({isException:true,html:"逾時"},true));}};AjxAction.prototype.getLogHeader=function(sType){var colors={'request':'#faa','response':'#afa','result':'#5f5','error':'#f55'};var html='<div style="font-weight:bold;background:'+this.debugColor+'">'
+'<span style="float:right;background:'+colors[sType.toLowerCase()]+';">'+sType.ucfirst()+'</span>'
+'<span>'+this.sServiceType+'.'+this.sService+' -- tId:</span>'
+'<span style="padding:0px 5px;">'+this.request.tId+'</span>'
+'</div>';return html;}
AjxAction.prototype.logError=function(message){if(!window._logReader)return;var html=this.getLogHeader('Error');html+='<div style="padding:5px;">'+message+'</div>';YAHOO.log('<div style="border:1px solid #ccc;">'+html+'</div>','ajx-'+this.sServiceType,this.sService);}
AjxAction.prototype.logRequest=function(){if(!window._logReader)return;this.debugColor=randColor(150,150,100);var html=this.getLogHeader('Request');html+='<div><div style="font-weight:bold;">Url</div><div style="padding:5px;">'+this.url+'</div></div>';html+='<div><div style="font-weight:bold;">PostData</div><div style="padding:5px;">';for(var key in this.params){html+='<div><span style="font-weight:bold;">'+key+'</span><span style="padding-left:5px;">'+JSON.stringify(this.params[key],true)+'</span></div>';}
html+='</div></div>';YAHOO.log('<div style="border:1px solid #ccc;">'+html+'</div>','ajx-'+this.sServiceType,this.sService);};AjxAction.prototype.logResponse=function(o){if(!window._logReader)return;var html=this.getLogHeader('Response');html+='<div><span style="font-weight:bold;">Status:</span><span style="padding:0px 5px;">'+o.status+' ['+o.statusText+']</span></div>'
html+='<div><div style="font-weight:bold;">Response Text:</div><div style="padding:5px;"><textarea id="responseText_'+o.tId+'" style="width:100%;height:10em;">'+o.responseText+'</textarea></div></div>';YAHOO.log('<div style="border:1px solid #ccc;">'+html+'</div>','ajx-'+this.sServiceType,this.sService);};AjxAction.prototype.logResult=function(result){if(!window._logReader)return;var html=this.getLogHeader('Result');YAHOO.log(html+(typeof result=='string'?result:JSON.stringify(result,true)),'ajx-'+this.sServiceType,this.sService);};function AjxResult(response,isTimeout){this.response=response;this.isTimeout=arguments.length>=2?isTimeout:false;};AjxResult.prototype.getResponse=function(){return this.response;};AjxResult.prototype.isTimeout=function(){return this.isTimeout;};function AjxCallback(obj,fn,args){this.obj=obj;this.fn=fn;this.args=args;}
AjxCallback.prototype.run=function(result){if(this.obj){this.fn.call(this.obj,result,this.args);}
else{this.fn(result,this.args);}
this.args=null;this.obj=null;this.fn=null;};var PkgMan={nQueued:0,cQueued:0,include:function(url){var el=cex("script",{type:"text/javascript",src:url});if(!url){throw Error("try to include url : "+url);}
var elHead=document.getElementsByTagName("head")[0];ac(elHead,el);},included:{'none':true},isIncluded:function(url){return this.included[url]||false;},isLoaded:function(c){var a=window;var s=c.split('.');for(var i=0;a&&i<s.length;i++){a=a[s[i]];}
return!!a;},registerJsHandler:function(handler){if(this.getUrl(handler)!='none')return handler;var tokens=handler.split('|');var depends=[];for(var i=tokens.length-1;i>=0;i--){var token=tokens[i];var url=token;var c=url.substring(1+url.lastIndexOf('/'),url.lastIndexOf('.js')<0?url.length:url.lastIndexOf('.js'));if(url.substring(0,1)=='/'){url=window.location.href.substring(0,window.location.href.indexOf('://')+3)+window.location.hostname+url;}
else if(url.indexOf('://')<0){url=window.location.href+'/'+url;}
if(!this.class2js[c]){this.class2js[c]=url;}
if(i>0){depends.push(c);}}
if(depends.length>0){console.log("registerJsHandler#add depend for "+c+": ["+depends+"]");this.depend[c]=depends.concat(this.depend[c]||[]);}
return c;},load:function(c,callback){if(c.indexOf('/')!=-1){var url=c;}else{var url=this.getUrl(c);}
console.log('load '+c+' at '+url);if(this.isLoaded(c)||this.isIncluded(url)){if(callback){var callbackId=this.addOnloadCallback(c,callback);return callbackId;}
return false;}
if(!url){throw Error("Failed to load "+c+": url not found");}
var d=this.getDepend(c,true);for(var i=0;i<d.length;i++){var x=d[i];var u=this.getUrl(x);if(this.isLoaded(x)||this.isIncluded(u))continue;this.include(u);this.included[u]=true;}
this.include(url);this.included[url]=true;if(callback){var callbackId=this.addOnloadCallback(c,callback);return callbackId;}
return false;},classCallbacks:{},queueCallbacks:{},addOnloadCallback:function(c,callback){if(!this.classCallbacks[c]){this.classCallbacks[c]=[];}
var callbackId=++this.cQueued;this.queueCallbacks[callbackId]=callback;this.classCallbacks[c].push(callbackId);this.nQueued++;if(this.nQueued&&!this.timerId){this.timerId=setTimeout(this.timerTicked.bind(this),10);}
return callbackId;},removeOnloadCallback:function(c,callbackId){var ids=this.classCallbacks[c];if(!ids||!ids.length)return true;var ndx=indexOf(ids,callbackId);if(ndx>=0){ids.splice(ndx,1);delete this.queueCallbacks[callbackId];}
return true;},fireOnload:function(c){var callbackIds=this.classCallbacks[c];if(!callbackIds||callbackIds.length==0)return false;for(var i=0;i<callbackIds.length;i++){var callbackId=callbackIds[i];this.queueCallbacks[callbackId]();delete this.queueCallbacks[callbackId];}
delete this.classCallbacks[c];this.nQueued-=callbackIds.length;},timerTicked:function(){if(this.nQueued){for(var c in this.classCallbacks){if(this.isSatisfied(c)){this.fireOnload(c);}}
this.timerId=null;if(this.nQueued){this.timerId=setTimeout(this.timerTicked.bind(this),50);}}},isSatisfied:function(c,v){var r=true;if(!this.isLoaded(c)){r=false;}
var d=this.getDepend(c);for(var i=0;i<d.length;i++){if(!this.isLoaded(d[i])){if(v)console.log(d[i]+' is not loaded!');r=false;break;}}
return r;},searchScript:function(u){if(!u.toLowerCase().indexOf("http://")==0){u=this.getUrl(u);}
return fc(document,"script",{src:u});},hasInDocument:function(u){return this.searchScript(u).length>0;},dependCache:{},getUrl:function(c){var js=this.class2js[c];if(typeof js=="function"){try{js=js();}
catch(e){}
return js||'none';}
else{return js?((js.indexOf('://')<0?Config.SCRIPTBASEPATH:'')+js+'?v=_v200707311936_.js'):'none';}},class2js:{"GMap2":function(){return Config.GMAPJS_URL;},"YAHOO.widget.Logger":'/js/yui/logger/logger.js',"Iqube.Validator":'/js/iqube/Validator.js',"Iqube.PortletPopup":'/js/iqube/PortletPopup.js',"Iqube.PortletList":'/js/iqube/PortletList.js',"Iqube.SetupWizard":'/js/iqube/SetupWizard.js',"Iqube.FloatToolbar":'/js/iqube/FloatToolbar.js',"Iqube.Mms.MmsEntryList":'/js/iqube/mms/MmsEntryList.js',"Iqube.Mms.MmsEntryList2":'/js/iqube/mms/MmsEntryList2.js',"InlineEditor":'/js/iqube/util/InlineEditor.js',"Iqube.Util.TipOfTheDay":'/js/iqube/util/TipOfTheDay.js',"MouseActivator":'/js/iqube/util/MouseActivator.js',"AliasAddonMenu":'/js/iqube/util/AliasAddonMenu.js',"Iqube.Util.SiteSearchBox":"/js/iqube/util/SiteSearchBox.js","Menu":'/js/iqube/util/Menu.js',"Iqube.Util.Highlight":'/js/iqube/util/Highlight.js',"Chain":"/js/iqube/util/Chain.js","Iqube.Alias.AliasList":"/js/iqube/alias/AliasList.js","Iqube.Alias.ProfileView":"/js/iqube/alias/ProfileView.js","Iqube.Alias.ProfileEdit":"/js/iqube/alias/ProfileEdit.js","Iqube.Alias.UserSignup":"/js/iqube/alias/UserSignup.js","Iqube.Portal.PortalEdit":"/js/iqube/portal/PortalEdit.js","Iqube.Portal.PortalPick":"/js/iqube/portal/PortalPick.js","Iqube.Portal.PortalEditPopup":"/js/iqube/portal/PortalEditPopup.js","Iqube.Portal.WapPortalDesign":"/js/iqube/portal/WapPortalDesign.js","Iqube.Post.PostPicker":'/js/iqube/post/PostPicker.js',"Iqube.Post.PostController":'/js/iqube/post/PostController.js',"Iqube.Post.Toolbox":'/js/iqube/post/Toolbox.js',"Iqube.Post.PostView":'/js/iqube/post/PostView.js',"Iqube.Post.RecordView":'/js/iqube/post/RecordView.js',"Iqube.Post.WFPostAgg":'/js/iqube/post/WFPostAgg.js',"Iqube.Post.EditPost":'/js/iqube/post/EditPost.js',"Iqube.Post.EditAlbum":'/js/iqube/post/EditAlbum.js',"Iqube.Post.EditVideo":'/js/iqube/post/EditVideo.js',"Iqube.Post.EditWebDoc":'/js/iqube/post/EditWebDoc.js',"Iqube.Post.EditBBSMsg":'/js/iqube/post/EditBBSMsg.js',"Iqube.Post.EditRecord":'/js/iqube/post/EditRecord.js',"Iqube.Post.EditDispatcher":'/js/iqube/post/EditDispatcher.js',"Iqube.Post.ViewDispatcher":'/js/iqube/post/ViewDispatcher.js',"Iqube.Share.ShowmeAD":'/js/iqube/share/ShowmeAD.js',"Iqube.Share.ShowmeShortCut": '/js/iqube/share/ShowmeShortCut.js'
,"Iqube.Post.FavoriteEditor":'/js/iqube/post/FavoriteEditor.js',"Iqube.SPost.SPostEdit":'/js/iqube/spost/SPostEdit.js',"Iqube.SPost.Slider":'/js/iqube/spost/Slider.js',"Iqube.SPost.EditDispatcher":'/js/iqube/spost/EditDispatcher.js',"Iqube.SPost.SPostView":'/js/iqube/spost/SPostView.js',"Iqube.SPost.Survey":'/js/iqube/spost/Survey.js',"Iqube.Group.Reader":'/js/iqube/group/Reader.js',"Iqube.Group.MyFeedList":'/js/iqube/group/MyFeedList.js',"Iqube.Group.RSSEdit":'/js/iqube/group/RSSEdit.js',"Iqube.Group.RSSEditPopup":'/js/iqube/group/RSSEditPopup.js',"Iqube.Comment.HomepageComment":'/js/iqube/comment/HomepageComment.js',"Iqube.Pref.EditCss":'/js/iqube/pref/EditCss.js',"Iqube.Pref.CssPick":'/js/iqube/pref/CssPick.js',"Iqube.Pref.EditDispatcher":'/js/iqube/pref/EditDispatcher.js',"Iqube.Share.ImageScroller":'/js/iqube/share/ImageScroller.js',"Iqube.Share.AlbumSelector":'/js/iqube/share/AlbumSelector.js',"Iqube.Share.SchemaEditor":'/js/iqube/share/SchemaEditor.js',"Iqube.Share.XListEditor":'/js/iqube/share/XListEditor.js',"Iqube.Share.XListView":'/js/iqube/share/XListView.js',"Iqube.Share.Upload":'/js/iqube/share/Upload.js',"Iqube.Share.BBSPosts":'/js/iqube/share/BBSPosts.js',"Iqube.Share.BBSReply":'/js/iqube/share/BBSReply.js',"Iqube.Share.BBSMsgView":'/js/iqube/share/BBSMsgView.js',"Iqube.Share.RecordView":'/js/iqube/share/RecordView.js',"Iqube.Share.Login":'/js/iqube/share/Login.js',"Iqube.Share.Trash":'/js/iqube/share/Trash.js',"Iqube.Share.MemberList":'/js/iqube/share/MemberList.js',"Iqube.Share.MemberList2":'/js/iqube/share/MemberList2.js',"Iqube.Share.Visitors3":'/js/iqube/share/Visitors3.js',"Iqube.Share.MemberList3":'/js/iqube/share/MemberList3.js',"Iqube.Share.GoogleMap":'/js/iqube/share/GoogleMap.js',"Iqube.Share.FlickrController":'/js/iqube/share/FlickrController.js',"Iqube.Share.AlbumBrowser":'/js/iqube/share/AlbumBrowser.js',"Iqube.Share.AlbumView":'/js/iqube/share/AlbumView.js',"Iqube.Share.FavoriteList":'/js/iqube/share/FavoriteList.js',"Iqube.Share.ArchiveStat":'/js/iqube/share/ArchiveStat.js',"Iqube.Share.PostList":'/js/iqube/share/PostList.js',"Iqube.Share.BookRead":'/js/iqube/share/BookRead.js',"Iqube.Share.BookEdit":'/js/iqube/share/BookEdit.js',"Iqube.Share.SiteSearch":"/js/iqube/share/SiteSearch.js","Iqube.Share.PostSet":"/js/iqube/share/PostSet.js","Iqube.Share.TabbedSearch":'/js/iqube/share/TabbedSearch.js',"Iqube.Share.AliasSearch":'/js/iqube/share/AliasSearch.js',"Iqube.Share.GroupSearch":'/js/iqube/share/GroupSearch.js',"Iqube.Share.RssSearch":'/js/iqube/share/RssSearch.js',"Iqube.Share.PostSearch":'/js/iqube/share/PostSearch.js',"Iqube.Share.SPostSearch":'/js/iqube/share/SPostSearch.js',"Iqube.Share.FavoriteSearch":'/js/iqube/share/FavoriteSearch.js',"Iqube.Share.TagSearch":'/js/iqube/share/TagSearch.js',"Iqube.Share.PostcatList":'/js/iqube/share/PostcatList.js',"Iqube.Tag.TagList":'/js/iqube/tag/TagList.js',"Iqube.Tag.TagCloud":'/js/iqube/tag/TagCloud.js',"Iqube.Process.PostcatHome":'/js/iqube/process/PostcatHome.js',"Iqube.Process.GroupcatHome":'/js/iqube/process/GroupcatHome.js',"Iqube.Process.PostPermEdit":'/js/iqube/process/PostPermEdit.js',"Iqube.Process.HistoricalStat":'/js/iqube/process/HistoricalStat.js',"Iqube.Process.TopPosts":'/js/iqube/process/TopPosts.js',"Iqube.Process.Useragent":'/js/iqube/process/Useragent.js',"Iqube.Process.GmprofileEdit":'/js/iqube/process/GmprofileEdit.js',"Iqube.Process.GmprofileSchemaEdit":'/js/iqube/process/GmprofileSchemaEdit.js',"TestController":'/js/iqube/TestController.js',"Iqube.Form.Field":'/js/iqube/form/Field.js',"Iqube.Form.FieldEditor":'/js/iqube/form/FieldEditor.js',"Iqube.Form.FieldValidator":'/js/iqube/form/FieldValidator.js',"Iqube.Set.SetEdit":'/js/iqube/set/SetEdit.js',"Iqube.Set.SetPicker":'/js/iqube/set/SetPicker.js',"Iqube.Admin.RSSList":'/js/iqube/admin/RSSList.js',"Iqube.Admin.SetAgg":'/js/iqube/admin/SetAgg.js',"Iqube.Admin.PortalList":'/js/iqube/admin/PortalList.js',"Iqube.Admin.PortalTemplates":'/js/iqube/admin/PortalTemplates.js',"Iqube.Admin.PortalTree":'/js/iqube/admin/PortalTree.js',"Iqube.Admin.RSSTree":'/js/iqube/admin/RSSTree.js',"Iqube.Admin.PortalNodeEdit":'/js/iqube/admin/PortalNodeEdit.js',"Iqube.Admin.RSSNodeEdit":'/js/iqube/admin/RSSNodeEdit.js',"Iqube.Admin.SchemaSPostAgg":'/js/iqube/admin/SchemaSPostAgg.js',"Iqube.Admin.XListSPostAgg":'/js/iqube/admin/XListSPostAgg.js',"Iqube.Admin.SetToolbox":'/js/iqube/admin/SetToolbox.js',"Iqube.Admin.PostAgg":'/js/iqube/admin/PostAgg.js',"Iqube.Admin.DraggablePost":'/js/iqube/admin/PostAgg.js',"Iqube.Admin.PostAgg2":'/js/iqube/admin/PostAgg2.js',"Iqube.Admin.BBSMsg":'/js/iqube/admin/BBSMsg.js',"Iqube.Admin.BBSReply":'/js/iqube/admin/BBSReply.js',"Iqube.Admin.SPostAgg2":'/js/iqube/admin/SPostAgg2.js',"Iqube.Admin.GroupAgg":'/js/iqube/admin/GroupAgg.js',"Iqube.Admin.MemberAgg2":'/js/iqube/admin/MemberAgg2.js',"IqubeSearch":'/js/iqube/share/IqubeSearch.js',"Iqube.Controller":'/js/iqube/Controller.js',"YAHOO.widget.TabView":'/js/yui/tabview/tabview.js',"YAHOO.widget.Calendar":'/js/yui/calendar/calendar.js',"YAHOO.widget.TreeView":'/js/yui/treeview/treeview.js',"YAHOO.util.DragDrop":'/js/yui/dragdrop/dragdrop.js',"SortableTable":'/js/columnlist/sortabletable.js',"WebFXColumnList":'/js/columnlist/columnlist.js',"RowObject":'/js/columnlist/RowObject.js',"ColorPicker":'/js/colorpicker/ColorPicker.js',"ContentDesignController":'/portal/ContentDesignController.js',"MobPageDesign":'/portal/MobPageDesign.js',"jt_AppAlert":'/js/Dialog/jt_AppDialogs.js',"jt_AppConfirm":'/js/Dialog/jt_AppDialogs.js',"jt_AppPrompt":'/js/Dialog/jt_AppDialogs.js',"jt_DialogBox":'/js/Dialog/jt_DialogBox.js',"FocusHandler":"/js/iqube/share/FocusHandler.js","InputFocusHandler":"/js/iqube/share/FocusHandler.js","ClickHandler":"/js/iqube/share/ClickHandler.js","Iqube.AutoComplete2":'/js/iqube/auto_complete.js',"Iqube.TagAutoComplete":'/js/iqube/auto_complete.js',"Iqube.RssAutoComplete":'/js/iqube/auto_complete.js',"Iqube.GeoLocAutoComplete":'/js/iqube/auto_complete.js',"Iqube.AliasnameAutoComplete":'/js/iqube/auto_complete.js',"Iqube.GrouppathAutoComplete":'/js/iqube/auto_complete.js',"Iqube.GroupName1AutoComplete":'/js/iqube/auto_complete.js'},getDepend:function(c){if(this.dependCache[c]){return this.dependCache[c];}
var step=function(p){var l=p.length;var e=p[l-1];var d=PkgMan.depend[e]||[];if(d.constructor!=Array)d=[d];for(var i=0;i<d.length;i++){var q=$A(p);q.push(d[i]);if(indexOf(q,d[i])<q.length-1){var msg="Circular reference detected: "+JSON.stringify(q);throw Error(msg);}
if(v[d[i]]>l){continue;}
v[d[i]]=l;step(q);}}
var v={};step([c]);var o=[];for(var c1 in v){var l=v[c1];o[l]=o[l]||[];o[l].push(c1);}
var a=[];for(var i=0;i<o.length;i++){if(!o[i])continue;a=a.concat(o[i]);}
this.dependCache[c]=a.reverse();return this.dependCache[c];},depend:{"Iqube.Share.SiteSearch":["Iqube.Util.SiteSearchBox"],"Iqube.Share.TagSearch":["Iqube.Share.TabbedSearch"],"Iqube.Share.AliasSearch":["Iqube.Share.TabbedSearch","AliasAddonMenu","Iqube.AliasnameAutoComplete"],"Iqube.Share.GroupSearch":["Iqube.Share.TabbedSearch","Iqube.GroupName1AutoComplete"],"Iqube.Share.RssSearch":["Iqube.Share.TabbedSearch","Iqube.RssAutoComplete"],"Iqube.Share.PostSearch":["Iqube.Share.TabbedSearch","Iqube.AliasnameAutoComplete","Iqube.GroupName1AutoComplete"],"Iqube.Share.SPostSearch":["Iqube.Share.TabbedSearch"],"Iqube.Set.SetEdit":["Iqube.Validator"],"Iqube.Share.FavoriteSearch":["Iqube.Share.TabbedSearch","Iqube.AliasnameAutoComplete"],"Iqube.SPost.Survey":["Iqube.Form.Field"],"Iqube.SPost.SPostView":["Iqube.Post.PostController"],"Iqube.Post.PostView":["Iqube.Post.PostController"],"Iqube.Mms.MmsEntryList":["Iqube.PortletPopup"],"Iqube.Mms.MmsEntryList2":["Iqube.Mms.MmsEntryList"],"Iqube.PortletList":["YAHOO.widget.TabView"],"TestController":["Iqube.Post.PostController","Iqube.Post.PostPicker"],"Iqube.Tag.TagList":[],"Iqube.Alias.UserSignup":[],"Iqube.Alias.AliasList":["AliasAddonMenu"],"Iqube.Alias.ProfileView":["Iqube.PortletPopup"],"Iqube.Alias.ProfileEdit":["Iqube.Process.GmprofileEdit"],"Iqube.Post.PostPicker":["Iqube.PortletPopup"],"Iqube.SetupWizard":["Iqube.PortletPopup"],"Iqube.FloatToolbar":[],"Iqube.Group.MyFeedList":["Iqube.RssAutoComplete"],"Iqube.Group.RSSEditPopup":["Iqube.PortletPopup"],"Iqube.Admin.PortalTemplates":["Iqube.Admin.PortalList"],"Iqube.Admin.RSSList":["Iqube.PortletPopup"],"Iqube.Share.PostSet":["Iqube.PortletPopup","Iqube.Post.PostController","Iqube.Post.PostView"],"Iqube.Process.PostPermEdit":["Iqube.Validator"],"Iqube.Share.AlbumView":["Iqube.Post.PostView","Iqube.Share.ImageScroller","Iqube.Share.AlbumBrowser"],"Iqube.Admin.BBSMsg":["Iqube.Admin.PostAgg2","Iqube.AliasnameAutoComplete","YAHOO.widget.Calendar"],"Iqube.Admin.SetAgg":["YAHOO.widget.TreeView","YAHOO.util.DragDrop"],"Iqube.Admin.PortalTree":["YAHOO.widget.TreeView"],"Iqube.Admin.RSSTree":["YAHOO.widget.TreeView"],"Iqube.Admin.PortalNodeEdit":["Iqube.Portal.PortalEditPopup"],"Iqube.Admin.RSSNodeEdit":["Iqube.PortletPopup"],"Iqube.Portal.PortalEditPopup":["Iqube.PortletPopup"],"Iqube.Portal.WapPortalDesign":["ColorPicker","Iqube.Share.AlbumSelector","Iqube.Share.ImageScroller"],"Iqube.Admin.GroupAgg":["YAHOO.widget.TreeView","Iqube.PortletPopup"],"Iqube.Post.RecordView":["Iqube.Post.PostView"],"Iqube.Post.WFPostAgg":["Iqube.Post.PostView"],"Iqube.Post.EditPost":["Iqube.Share.Upload","Menu","Iqube.TagAutoComplete","InputFocusHandler","Iqube.Validator"],"Iqube.Post.EditAlbum":["Iqube.Post.EditPost"],"Iqube.Post.EditWebDoc":["Iqube.Post.EditPost"],"Iqube.Post.EditBBSMsg":["Iqube.Post.EditPost"],"Iqube.Post.EditRecord":["Iqube.Post.EditPost","Iqube.Form.Field"],"Iqube.Post.EditVideo":["Iqube.Post.EditPost"],"Iqube.Post.EditDispatcher":['Iqube.Post.EditPost',"Iqube.Post.EditAlbum",'Iqube.Post.EditWebDoc','Iqube.Post.EditRecord','Iqube.Post.EditBBSMsg','Iqube.Post.EditVideo'],"Iqube.Post.ViewDispatcher":['Iqube.Share.AlbumView',"Iqube.Post.PostView"],"Iqube.SPost.EditDispatcher":["Iqube.SPost.SPostEdit"],"Iqube.SPost.SPostEdit":['Iqube.Post.EditPost',"Iqube.Share.AlbumSelector",'Iqube.Share.SchemaEditor','Iqube.Share.XListEditor','Iqube.Share.ImageScroller',"Iqube.Validator","Iqube.Admin.BBSReply"],"Iqube.Share.PostList":['Iqube.RssAutoComplete'],"Iqube.Share.GoogleMap":['Iqube.GeoLocAutoComplete',"GMap2"],"Iqube.Share.SchemaEditor":['Iqube.Form.Field','Iqube.Form.FieldEditor'],"Iqube.Share.XListEditor":['Iqube.Form.Field'],"Iqube.Pref.EditDispatcher":["Iqube.Pref.EditCss"],"Iqube.Pref.EditCss":["ColorPicker","Iqube.Share.AlbumSelector","Iqube.Share.ImageScroller"],"Iqube.Pref.CssPick":["YAHOO.widget.TabView"],"InputFocusHandler":["FocusHandler"],"Iqube.TagAutoComplete":["Iqube.AutoComplete2"],"Iqube.RssAutoComplete":["Iqube.AutoComplete2"],"Iqube.GeoLocAutoComplete":["Iqube.AutoComplete2"],"Iqube.AliasnameAutoComplete":["Iqube.AutoComplete2"],"Iqube.GrouppathAutoComplete":["Iqube.AutoComplete2"],"Iqube.GroupName1AutoComplete":["Iqube.AutoComplete2"],"MobPageDesign":["ContentDesignController","ColorPicker","Iqube.Pref.EditCss","YAHOO.widget.TabView","Iqube.Share.AlbumSelector"],"Iqube.Share.TabbedSearch":["YAHOO.widget.TabView","Iqube.TagAutoComplete"],"Iqube.Process.GmprofileEdit":["Iqube.Form.Field"],"Iqube.Process.GmprofileSchemaEdit":["Iqube.Share.SchemaEditor"],"Iqube.Share.BBSReply":["AliasAddonMenu","Iqube.Post.EditPost"],"Iqube.Share.BBSMsgView":["Iqube.Post.FavoriteEditor","AliasAddonMenu"],"Iqube.Admin.BBSReply":["Iqube.Admin.PostAgg2","Iqube.AliasnameAutoComplete","YAHOO.widget.Calendar"],"Iqube.Admin.MemberAgg2":["Iqube.Admin.PostAgg2"],"Iqube.Post.FavoriteEditor":["Iqube.TagAutoComplete","InputFocusHandler"],"Iqube.Share.FavoriteList":["Iqube.TagAutoComplete","FocusHandler","Iqube.Post.FavoriteEditor"],"Iqube.Share.MemberList2":["Iqube.Share.ImageScroller"],"Iqube.Share.Visitors3":["Iqube.Share.MemberList2","AliasAddonMenu"],"Iqube.Process.HistoricalStat":[],"Iqube.Form.FieldEditor":["Iqube.Form.Field"],"Iqube.Form.Field":["Iqube.Form.FieldValidator"],"Iqube.Form.FieldValidator":[],"Iqube.Admin.PostAgg":["Iqube.Admin.DraggablePost"],"Iqube.Admin.SPostAgg2":["Iqube.Admin.PostAgg2"],"Iqube.Share.BookRead":["Iqube.Share.BookEdit","Chain"],"Iqube.Share.BookEdit":["YAHOO.widget.TreeView","YAHOO.util.DragDrop","Iqube.Admin.DraggablePost"],"Iqube.Share.AlbumBrowser":["Iqube.Share.AlbumSelector","Iqube.Share.ImageScroller"],"Iqube.Share.MemberList3":["AliasAddonMenu"],"Iqube.Share.FlickrController":["Iqube.Share.ImageScroller"],"jt_AppPrompt":["jt_AppConfirm"],"jt_AppConfirm":["jt_AppAlert"],"jt_AppAlert":["jt_DialogBox"],"WebFXColumnList":["SortableTable"],"Iqube":["IqubeCsfeCommand"]}};var YuEvent=YAHOO.util.Event;var YuDom=YAHOO.util.Dom;function loggerInit(){if(YAHOO.widget.LogReader&&!window._logReader){var w=window.open("",(""+window.location.host).replace(/[^a-zA-Z0-9]/g,''),"resizable=yes,status=yes,menubar=no,location=no,scrollbars=yes,width=560,height=680");if(!w){YAHOO.widget.Logger=null;return;}
YAHOO.widget.Logger.disableFirebug();w.document.body.innerHTML=''
+'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
+'<html lang="en" dir="ltr" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><title>Yui.Logger</title>'
+'</head><body>'
+'<div id="logReader"></div>'
+'</body></html>';var css=w.document.createElement('link');css.href=Config.HOMESITE+Config.BASEPATH+'/js/yui/logger/assets/logger.css';css.rel='stylesheet';css.type='text/css';var header=w.document.getElementsByTagName('head');header[0].appendChild(css);w.document.title='Log: '+window.location.host;var el=w.document.getElementById('logReader');window._logReader=new YAHOO.widget.LogReader(el);w=null;el=null;}}
loggerInit();if(!/mozilla\/5/i.test(navigator.userAgent)){}
var DBG={println:function(message){YAHOO.log(message,'DBG','DBG');}};YuDom.applyStyle=function(el,oProperty){for(var property in oProperty){YuDom.setStyle(el,property,oProperty[property]);}};YuDom.showStyle=function(el,aProperty){var o={};if(aProperty.constructor==String){aProperty=[aProperty];}
for(var i=0;i<aProperty.length;i++){var property=aProperty[i];o[property]=YuDom.getStyle(el,property);}
YAHOO.log(JSON.stringify(o,true),'debug','yui-compat.js');};var log=function(){if(window._logReader){if(typeof arguments[0]!='string'){arguments[0]=JSON.stringify(arguments[0],true);}
YAHOO.log.apply(YAHOO.log,arguments);}}
if(!window.console)console={log:YAHOO.log};if(YAHOO.widget&&YAHOO.widget.Node){YAHOO.widget.Node.prototype.getDepth=function(){var node=this;var depth=0;while(node&&!node.isRoot()){depth++;node=node.parent;}
return depth;};YAHOO.widget.Node.prototype.isChildOf1=function(test){var node=this.parent;while(node){if(node==test)return true;node=node.parent;}
return false;};}
var MIN_YDIALOG_WIDTH=320;var MIN_YDIALOG_HEIGHT=100;if(YAHOO.widget.Dialog){YAHOO.widget.Dialog.prototype.autoSize=function(){var pl=parseInt(YuDom.getStyle(this.body,'padding-left'));var pr=parseInt(YuDom.getStyle(this.body,'padding-right'));var pt=parseInt(YuDom.getStyle(this.body,'padding-top'));var pb=parseInt(YuDom.getStyle(this.body,'padding-bottom'));var width=this.body.scrollWidth-pl-pr;width=width<MIN_YDIALOG_WIDTH?MIN_YDIALOG_WIDTH:width;var maxWidth=YuDom.getViewportWidth()-80;width=width>maxWidth?maxWidth:width;this.cfg.setProperty('width',width+pl+pr+'px');this.body.style.height='';var height=this.body.offsetHeight-pt-pb;height=height<MIN_YDIALOG_HEIGHT?MIN_YDIALOG_HEIGHT:height;var maxHeight=YuDom.getViewportHeight()-150;height=height>maxHeight?maxHeight:height;this.body.style.height=height+pt+pb+'px';this.body.style.overflowY='auto';this.body.style.position='relative';}}
