function _twTrack(a){var b={success:function(){},failure:function(){}};YAHOO.util.Connect.asyncRequest("POST","http://www.ioage.com/revision/download-tracker.php?t="+Math.random().toFixed(3),b,"addon="+a+"&hl="+PLUGIN_I18N.LANG);return true}
if(!window.ioage){window.ioage={ui:{},util:{},lang:{},browser:{}};ioage.ui._uniqueIdIterator=0;ioage.ui.generateId=function(){return"twuiUniqueId"+ioage.ui._uniqueIdIterator++};var SimpleTabbedPane=function(a){this._tabUIs=[];this._tabContentUIs=[];this._tabStates=[];this._elapsedIndex=this._selectedIndex=-1;this._option=a||{};this._onStyle=this._option.onStyle?this._option.onStyle:"on";this.onTabChange=null};SimpleTabbedPane.prototype={_checkIndex:function(a){return a>=0&&a<this._tabUIs.length},
addTab:function(a,b){a.setAttribute("index",this._tabUIs.length);this._tabUIs.push(a);this._tabContentUIs.push(b);this._tabStates.push(true);var c=this;a.onclick=function(){var d=parseInt(this.getAttribute("index"));c.setSelectedTabIndex(d)}},setEnable:function(a,b){if(a in this._tabUIs&&typeof b=="boolean"){this._tabStates[a]=b;var c=YAHOO.util.Dom;b?c.removeClass(this._tabUIs[a],"disabled"):c.addClass(this._tabUIs[a],"disabled")}},getSelectedTabIndex:function(){return this._selectedIndex},setSelectedTabIndex:function(a,
b){if(!(a==this._selectedIndex||!this._checkIndex(a)))if(this._tabStates[a]){this._selectedIndex!=-1&&this.setUIActiveByIndex(this._selectedIndex,false);this.setUIActiveByIndex(a,true);this._elapsedIndex=this._selectedIndex;this._selectedIndex=a;!b&&typeof this.onTabChange=="function"&&this.onTabChange.call(this,this._elapsedIndex,this._selectedIndex)}},setUIActiveByIndex:function(a,b){if(this._checkIndex(a)){var c=YAHOO.util.Dom;if(b){c.addClass(this._tabUIs[a],this._onStyle);this._option.triggerOnly||
c.setStyle(this._tabContentUIs[a],"display","block")}else{c.removeClass(this._tabUIs[a],this._onStyle);this._option.triggerOnly||c.setStyle(this._tabContentUIs[a],"display","none")}}},getTabUIByIndex:function(a){return!this._checkIndex(a)?null:this._tabUIs[a]},getTabLabelByIndex:function(a){return!this._checkIndex(a)?null:this._tabUIs[a].textContent?this._tabUIs[a].textContent:this._tabUIs[a].innerText},getTabContentUIByIndex:function(a){return!this._checkIndex(a)?null:this._tabContentUIs[a]}};ioage.ui.SimpleTabbedPane=
SimpleTabbedPane;var DataItem=function(a,b){this._clickHanderId=ioage.ui.generateId();this._data=a;this._option=b||{}};DataItem.prototype={toString:function(){return this.toHTML()},toHTML:function(){var a=['<li><div class="plugin-item dark-green-border"><h3>'+this._data.addonLangName+'</h3><dl class="plugin-properties">'];a.push('<dt><a href="http://www.ioage.com/tw'+(PLUGIN_I18N.LANG.toLowerCase()=="en"?"en":"")+"/addon/"+this._data.addonName.toLowerCase()+'.html"><img title="'+this._data.addonLangName+
'" alt="'+this._data.addonLangName+'" src="'+this._data.addonCapture+'" /></a></dt>');a.push('<dd class="description"><a class="detail" href="http://www.ioage.com/tw'+(PLUGIN_I18N.LANG.toLowerCase()=="en"?"en":"")+"/addon/"+this._data.addonName.toLowerCase()+'.html">'+PLUGIN_I18N.VIEW_DETIAL+"</a>"+this._data.addonDescription+"</dd>");a.push('<dd class="download"><a id="'+this._clickHanderId+'" addon-downloads="'+this._data.addonTrend+'" addon-lastmodified="'+this._data.addonLastModified+'" addon-name="'+
this._data.addonName+'" addon-langname="'+this._data.addonLangName+'" addon-version="'+this._data.addonVersion+'" addon-minbrowserversion="'+this._data.addonTWMinSupportVersion+'" addon-maxbrowserversion="'+this._data.addonTWMaxSupportVersion+'" rel="nofollow" addon-downloadurl="'+this._data.addonDownloadURL+'" href="'+this._data.addonDownloadURL+'" hidefocus="true" class="click-to-download click-to-download-disabled" title="'+PLUGIN_I18N.DOWNLOAD+'">'+PLUGIN_I18N.DOWNLOAD+'</a><span id="'+this._clickHanderId+
'2" class="tip gray">'+PLUGIN_I18N.DETECTING+"</span></dd>");a.push('<dd class="trend trend-'+this._getDownloadRate(this._data.addonTrend)+'"><span style="width:'+62*parseInt(this._data.addonTrend)/100+'px">'+this._data.addonTrend+"</span></dd></dl></div></li>");return a.join("")},_getDownloadRate:function(a){a=parseInt(a);return isNaN(a)||a<=200?1:a<=800&&a>200?2:a<=2000&&a>800?3:a<=5000&&a>2000?4:5},init:function(){var a=document.getElementById(this._clickHanderId),b=document.getElementById(this._clickHanderId+
"2");a.onclick=function(){if(this.className.indexOf("disabled")!=-1)return false;_twTrack(this.getAttribute("addon-name"));return true};var c=a.getAttribute("addon-name"),d=a.getAttribute("addon-version"),e=a.getAttribute("addon-minbrowserversion"),f=a.getAttribute("addon-maxbrowserversion");c=ioage.browser.TWToolkit.getInstance().getAddonHostingState(c,d,e,f);d=YAHOO.util.Dom;switch(c){case ioage.browser.TWToolkit.ADDON_HOSTING_STATE_NOT_SUPPORT:b.style.display="none";d.removeClass(a,"click-to-download-disabled");
break;case ioage.browser.TWToolkit.ADDON_HOSTING_STATE_OUT_OF_SUPPORT:d.setStyle(a,"display","none");d.addClass(a.parentNode,"out");b.innerHTML=PLUGIN_I18N.STATE_OUT_OF_SUPPORT;break;case ioage.browser.TWToolkit.ADDON_HOSTING_STATE_NOT_INSTALLED:case ioage.browser.TWToolkit.ADDON_HOSTING_STATE_BLOCKED:b.style.display="none";d.removeClass(a,"click-to-download-disabled");a.onclick=function(){ioage.browser.TWToolkit.getInstance().installAddon(this.getAttribute("addon-name"),this.getAttribute("addon-langname"),
this.getAttribute("addon-downloadurl"),this.getAttribute("addon-version"));_twTrack(this.getAttribute("addon-name"));return false};break;case ioage.browser.TWToolkit.ADDON_HOSTING_STATE_OUT_OF_DATE:b.innerHTML=PLUGIN_I18N.STATE_OUT_OF_DATE;d.removeClass(a,"click-to-download-disabled");a.onclick=function(){ioage.browser.TWToolkit.getInstance().installAddon(this.getAttribute("addon-name"),this.getAttribute("addon-langname"),this.getAttribute("addon-downloadurl"),this.getAttribute("addon-version"));
_twTrack(this.getAttribute("addon-name"));return false};break;case ioage.browser.TWToolkit.ADDON_HOSTING_STATE_APPROPRIATE:d.setStyle(a,"display","none");d.addClass(a.parentNode,"out");b.innerHTML=PLUGIN_I18N.STATE_INSTALLED;break;default:}}};ioage.ui.DataItem=DataItem;var ParamHolder=function(){this._data={};this._propertyChangeListeners=[]};ParamHolder.prototype={addParam:function(a,b){if(typeof a!="undefined"&&a!=null)this._data[a]=b},existParam:function(a){if(typeof a=="undefined"||a==null)return false;
return typeof this._data[a]!="undefined"&&this._data[a]!=null},removeParam:function(a){if(this.existParam(a))this._data[a]=null},replaceParam:function(a,b,c){this.existParam(b)&&this.removeParam(b);if(typeof a!="undefined"&&a!=null)this._data[a]=c},getParamValue:function(a){if(this.existParam(a))return this._data[a];return null},firePropertyChanged:function(a){for(var b=0,c=this._propertyChangeListeners.length;b<c;b++)a instanceof Array?this._propertyChangeListeners[b].apply(this,a):this._propertyChangeListeners[b].call(this,
a)},addPropertyChangeListener:function(a){typeof a=="function"&&this._propertyChangeListeners.push(a)},toQueryString:function(){var a=[];for(var b in this._data)typeof this._data[b]!="undefined"&&this._data[b]!=null&&a.push(b+"="+this._data[b]);return a.join("&")},toString:function(){var a=[];for(var b in this._data)typeof this._data[b]!="undefined"&&this._data[b]!=null&&a.push(b+","+this._data[b]);return"[("+a.join("),(")+")]"}};ioage.util.ParamHolder=ParamHolder;var DataSetMgr=function(a,b){this._UIContainer=
a;this._dns=b;this._paramHolder=new ioage.util.ParamHolder;this._cacheData={};this.onDataParsingError=this.onDataParsing=this.onAfterDataParse=this.onBeforeDataParse=null};DataSetMgr.PROGRESS_INIT=0;DataSetMgr.PROGRESS_TERM=1;DataSetMgr.prototype={toString:function(){return"{datadns:"+this._dns+",paramHolder:"+this._paramHolder.toQueryString()+"}"},getDataSourceDNS:function(){return this._dns},updateUI:function(a){for(var b=[],c=null,d=0,e=a.length;d<e;d++){c=new ioage.ui.DataItem(a[d]);b.push(c)}this._UIContainer.innerHTML=
b.join("");d=0;for(e=b.length;d<e;d++)b[d].init();typeof this.onAfterDataParse=="function"&&this.onAfterDataParse.call(this)},query:function(){var a=this,b=this._paramHolder.toQueryString();if(this._cacheData[b]){this.updateUI(this._cacheData[b]);typeof this.onDataParsing=="function"&&this.onDataParsing.call(this,ioage.util.DataSetMgr.PROGRESS_TERM)}else{var c={success:function(d){try{var e=typeof JSON!="undefined"&&JSON.parse?JSON.parse(d.responseText):eval("("+d.responseText+")");a._cacheData[b]=
e;a.updateUI(e);typeof a.onDataParsing=="function"&&a.onDataParsing.call(a,ioage.util.DataSetMgr.PROGRESS_TERM)}catch(f){typeof a.onDataParsingError=="function"&&a.onDataParsingError.call(a,f.message)}},failure:function(d){typeof a.onDataParsing=="function"&&a.onDataParsing.call(a,ioage.util.DataSetMgr.PROGRESS_TERM);typeof a.onDataParsingError=="function"&&a.onDataParsingError.call(a,d.message)}};YAHOO.util.Connect.asyncRequest("GET",this._dns+"?rnd="+Math.random().toFixed(3)+"&"+this._paramHolder.toQueryString(),
c);typeof this.onDataParsing=="function"&&this.onDataParsing.call(this,ioage.util.DataSetMgr.PROGRESS_INIT)}},getParamHolder:function(){return this._paramHolder}};ioage.util.DataSetMgr=DataSetMgr;var DefaultPaginatingUI=function(a){this.parentUI=a.parentUI?a.parentUI:document.body;this.componentStyle=a.componentStyle?a.componentStyle:"pages";this.cellOnStyle=a.cellOnStyle?a.cellOnStyle:"on";this.cellOffStyle=a.cellOffStyle?a.cellOffStyle:"off";this.cellPreviousStyle=a.cellPreviousStyle?a.cellPreviousStyle:
"prev";this.cellNextStyle=a.cellNextStyle?a.cellNextStyle:"next";this.linkOn=a.linkOn?a.linkOn:false;this.linkBaseURI=a.linkBaseURI?a.linkBaseURI:location.href;this.elapsedActivePage=-1;this.UIComponent=null};DefaultPaginatingUI.prototype={setParentUI:function(a){if(a)this.parentUI=a},setCellStyle:function(a,b){if(a&&b)if(a=="on")this.cellOnStyle=b;else this.cellOffStyle=b},setComponentStyle:function(a){if(a)this.componentStyle=a},setLinkActive:function(a){if(a)this.linkOn=a},getElapsedActivePage:function(){return this.elapsedActivePage},
setUIComponent:function(a){this.UIComponent=a},paintUI:function(a,b,c){var d=document.createElement("ul");d.className=this.componentStyle;var e=[];if(c-1>=a)e.push('<li class="'+this.cellPreviousStyle+'"><a unselectable="on" pid="'+(c-1)+'" href="'+(this.linkOn?this.linkBaseURI.indexOf("?")==-1?this.linkBaseURI+"?page="+(c-1):this.linkBaseURI+"&page="+(c-1):"javascript:void(0)")+'">&lt;</a></li>');a=a;for(var f=b;a<=f;a++)a==c?e.push('<li class="'+this.cellOnStyle+'"><a unselectable="on" pid="'+a+
'" onclick="return false" href="'+(this.linkOn?this.linkBaseURI.indexOf("?")==-1?this.linkBaseURI+"?page="+a:this.linkBaseURI+"&page="+a:"javascript:void(0)")+'">'+a+"</a></li>"):e.push('<li class="'+this.cellOffStyle+'"><a unselectable="on" pid="'+a+'" href="'+(this.linkOn?this.linkBaseURI.indexOf("?")==-1?this.linkBaseURI+"?page="+a:this.linkBaseURI+"&page="+a:"javascript:void(0)")+'">'+a+"</a></li>");if(parseInt(c)+1<=parseInt(b))e.push('<li class="'+this.cellNextStyle+'"><a unselectable="on" pid="'+
(c+1)+'" href="'+(this.linkOn?this.linkBaseURI.indexOf("?")==-1?this.linkBaseURI+"?page="+(parseInt(c)+1):this.linkBaseURI+"&page="+(parseInt(c)+1):"javascript:void(0)")+'">&gt;</a></li>');d.innerHTML=e.join("");this.elapsedActivePage=c;this.parentUI.hasChildNodes()?this.parentUI.replaceChild(d,this.parentUI.childNodes[0]):this.parentUI.appendChild(d);if(!this.linkOn&&this.UIComponent){b=d.getElementsByTagName("a");var g=this;a=0;for(c=b.length;a<c;a++)if(!b[a].getAttribute("onclick"))b[a].onclick=
function(){g.UIComponent.paint(parseInt(this.getAttribute("pid")))}}}};ioage.ui.DefaultPaginatingUI=DefaultPaginatingUI;var Paginating=function(a,b){this.pageCount=a;this.currentPage=-1;this.componentUI=b.componentUI?b.componentUI:new ioage.ui.DefaultPaginatingUI({parentUI:b.parentUI});this.componentUI.setUIComponent(this);this.beforeChangeListener=[];this.changeListener=[]};Paginating.prototype={getUI:function(){return this.componentUI},addBeforeChangeListener:function(a){typeof a=="function"&&this.beforeChangeListener.push(a)},
getBeforeChangeListeners:function(){return this.beforeChangeListeners},fireBeforeChangeEvent:function(a){for(var b=0,c=this.beforeChangeListener.length;b<c;b++)this.beforeChangeListener[b].call(this,a)},addChangeListener:function(a){typeof a=="function"&&this.changeListener.push(a)},getChangeListeners:function(){return this.changeListeners},fireChangeEvent:function(a,b){for(var c=0,d=this.changeListener.length;c<d;c++)this.changeListener[c].call(this,a,b)},getPageCount:function(){return this.pageCount},
setPageCount:function(a){if(a>0)this.pageCount=a},getCurrentPage:function(){return this.currentPage},setCurrentPage:function(a){if(a>0&&a<=this.pageCount)this.currentPage=a},paint:function(a,b){this.setCurrentPage(a);this.currentPage=Math.max(1,this.currentPage);this.currentPage=Math.min(this.currentPage,this.pageCount);a=this.currentPage-3;a=Math.max(a,1);var c=this.currentPage+6;c=Math.min(c,this.pageCount);if(c-a+1<10)if(this.pageCount-this.currentPage>this.currentPage-0)c=Math.min(10+a-1,this.pageCount);
else a=Math.max(1,c+1-10);var d=this.componentUI.getElapsedActivePage();b||this.fireBeforeChangeEvent(d);this.componentUI.paintUI(a,c,this.currentPage);b||this.fireChangeEvent(d,this.componentUI.getElapsedActivePage())}};ioage.ui.Paginating=Paginating;var TWToolkit=function(){this._browserVersion=this._sid=null;this._browserEnvInit=false;this.PATTERN={series2:/^2\./gi,series3:/^3\./gi}};TWToolkit._singleton=null;TWToolkit.getInstance=function(){return ioage.browser.TWToolkit._singleton?ioage.browser.TWToolkit._singleton:
(ioage.browser.TWToolkit._singleton=new ioage.browser.TWToolkit)};TWToolkit.ADDON_HOSTING_STATE_NOT_SUPPORT=0;TWToolkit.ADDON_HOSTING_STATE_OUT_OF_SUPPORT=1;TWToolkit.ADDON_HOSTING_STATE_NOT_INSTALLED=3;TWToolkit.ADDON_HOSTING_STATE_BLOCKED=4;TWToolkit.ADDON_HOSTING_STATE_OUT_OF_DATE=5;TWToolkit.ADDON_HOSTING_STATE_APPROPRIATE=6;TWToolkit.prototype={inExecutableEnv:function(){this._browserEnvInit||this._initEnv();return!!this._sid},getVersion:function(){this._browserEnvInit||this._initEnv();return this._browserVersion},
getSID:function(){this._browserEnvInit||this._initEnv();return this._sid},getINIValue:function(a,b){this._browserEnvInit||this._initEnv();try{return external.GetOptionValue(this._sid,a,b)}catch(c){return null}},setINIValue:function(a,b,c){this._browserEnvInit||this._initEnv();try{external.SetOptionValue(this._sid,a,b,c)}catch(d){}},greatThanVersion:function(a){this._browserEnvInit||this._initEnv();try{return this._browserVersion>a}catch(b){return false}},installedAddon:function(a){return!!this.getAddonVersion(a)},
isAddonBlocked:function(){return false},getAddonVersion:function(a){this._browserEnvInit||this._initEnv();try{return external.twGetExtVersion(this._sid,a)}catch(b){return null}},getAddonHostingState:function(a,b,c,d){if(!this.inExecutableEnv())return ioage.browser.TWToolkit.ADDON_HOSTING_STATE_NOT_SUPPORT;var e=this.getVersion();if(d&&e>d)return ioage.browser.TWToolkit.ADDON_HOSTING_STATE_OUT_OF_SUPPORT;if(c&&e<c)return ioage.browser.TWToolkit.ADDON_HOSTING_STATE_OUT_OF_SUPPORT;if(!this.installedAddon(a))return ioage.browser.TWToolkit.ADDON_HOSTING_STATE_NOT_INSTALLED;
if(this.isAddonBlocked(a))return ioage.browser.TWToolkit.ADDON_HOSTING_STATE_BLOCKED;if(this.lessThanAddonVersion(a,b))return ioage.browser.TWToolkit.ADDON_HOSTING_STATE_OUT_OF_DATE;return ioage.browser.TWToolkit.ADDON_HOSTING_STATE_APPROPRIATE},equalAddonVersion:function(a,b){this._browserEnvInit||this._initEnv();a=this.getAddonVersion(a);if(!a)return false;return a==b},lessThanAddonVersion:function(a,b){this._browserEnvInit||this._initEnv();a=this.getAddonVersion(a);if(!a)return false;return a<
b},installAddon:function(a,b,c,d){this._browserEnvInit||this._initEnv();try{external.twInstallExt(this._sid,a,b,c,d)}catch(e){}},greatThanAddonVersion:function(a,b){this._browserEnvInit||this._initEnv();a=this.getAddonVersion(a);if(!a)return false;return a>b},isGeneration2:function(){this._browserEnvInit||this._initEnv();this.PATTERN.series2.lastIndex=0;return this._browserVersion?this.PATTERN.series2.test(this._browserVersion):false},isGeneration3:function(){this._browserEnvInit||this._initEnv();
this.PATTERN.series3.lastIndex=0;return this._browserVersion?this.PATTERN.series3.test(this._browserVersion):false},_initEnv:function(){try{this._sid=external.twGetSecurityID(window);this._browserVersion=external.twGetVersion(this._sid)}catch(a){}this._browserEnvInit=true}};ioage.browser.TWToolkit=TWToolkit;var InformMessenger=function(a,b,c){this._UI=a||{};this._option=c||{};this._type=b;this._inTransition=false;this._transitionDistance=0;this._timer=null;this._timerInterval=1000;this._init()};InformMessenger.NORMAL_MESSAGE=
0;InformMessenger.PERSISIT_MESSAGE=1;InformMessenger.prototype={_init:function(){var a=this;this._option.expandDelay=this._option.expandDelay||0;if(!this._UI.bar)throw new Error("InformMessenger UI Missing");if(this._type!=InformMessenger.PERSISIT_MESSAGE){var b=function(){if(a._timer){clearTimeout(a._timer);a._timer=null}},c=function(){a._timer&&clearTimeout(a._timer);a._timer=setTimeout(function(){a.setVisible(false)},a._timerInterval)};this._UI.bar.onmouseover=b;this._UI.bar.onmouseout=c;this._option.collapseDelay=
this._option.collapseDelay||0;b=this._option.expandDelay+this._option.collapseDelay;this._timer=setTimeout(function(){a.setVisible(false)},b)}if(this._option.expandDelay&&this._option.autoExpand)setTimeout(function(){a.setVisible(true)},this._option.expandDelay);else this._option.autoExpand&&this.setVisible(true)},setVisible:function(a){if(!this._inTransition){var b=YAHOO.util.Dom,c=this;this._inTransition=true;if(!this._transitionDistance)this._transitionDistance=this._UI.bar.getElementsByTagName("div")[0].offsetHeight;
if(a){b.setStyle(this._UI.bar,"display","block");a=new YAHOO.util.Anim(this._UI.bar,{height:{from:0,to:this._transitionDistance}},0.3,YAHOO.util.Easing.easeOut);a.onComplete.subscribe(function(){c._inTransition=false})}else{a=new YAHOO.util.Anim(this._UI.bar,{height:{to:0,from:this._transitionDistance}},0.3,YAHOO.util.Easing.easeOut);a.onComplete.subscribe(function(){c._inTransition=false;b.setStyle(c._UI.bar,"display","none")})}a.animate()}}};ioage.ui.InformMessenger=InformMessenger};
