// JavaScript Document

YAHOO.sea.fp.Polls=(function(){var YUD=YAHOO.util.Dom,YUE=YAHOO.util.Event;return{init:function(){var docheight=YAHOO.sea.fp.Cookie.get('sea_polls');if(docheight&&docheight!=='-1'){YAHOO.sea.fp.Cookie.set('sea_polls','-1','','','yahoo.com');}
var doc=YUD.get('pulse_iframe');YUE.on(doc,'load',function(){var docheight=YAHOO.sea.fp.Cookie.get('sea_polls');if(docheight&&docheight!=='-1'){YUD.get('pulse_iframe').height=docheight;YAHOO.sea.fp.Cookie.set('sea_polls','-1','','','yahoo.com');}});}}})();if(YAHOO.util.Dom.get('pulse_iframe')){YAHOO.sea.fp.Polls.init();}
YAHOO.sea.fp._ie=YAHOO.env.ua.ie;YAHOO.sea.fp._ie7=(YAHOO.env.ua.ie&&(YAHOO.env.ua.ie===7||YAHOO.env.ua.ie===8))?1:0;YAHOO.sea.fp._webkit=YAHOO.env.ua.webkit;YAHOO.sea.fp.Layout=(function(){return{switchPageLayout:function(layout,useRdPath){var rdPath="http://aa.rd.yahoo.com/spirit/vn/layout/";YAHOO.sea.fp.Cookie.set('FPS',layout,400*3600000,'/',YAHOO.sea.fp._region+'.yahoo.com');if(useRdPath){location.replace(rdPath+((layout=='ts')?'narrow':'wide')+'/*http://'+location.hostname+'/index'+((layout=='ts')?'_1':'')+'.php');}else{location.replace('http://'+location.hostname+'/index'+((layout=='ts')?'_1':'')+'.php');}},autoSwitchPageLayout:function(layout){this.switchPageLayout(layout,false);},togglePageLayout:function(e){var YE=YAHOO.util.Event;var t=YE.getTarget(e);if(t.id==='dims-n'){this.switchPageLayout('ts',true);}else if(t.id==='dims-w'){this.switchPageLayout('dl',true);}}};})();YAHOO.util.Event.on(window,'load',function(){var YD=YAHOO.util.Dom,YE=YAHOO.util.Event;var ohp=YD.get('iehp');var hpurl='http://'+location.hostname+location.pathname;var shp=YD.get('sethomepage');var grp=YD.get('sethpgrp');if(ohp!=null&&shp!=null){YD.setStyle(ohp,'behavior','url(#default#homepage)');if(YAHOO.sea.fp._ie){var ishp=false;ishp|=ohp.isHomePage('http://'+location.hostname);ishp|=ohp.isHomePage('http://'+location.hostname+'/');ishp|=ohp.isHomePage('http://'+location.hostname+'/index.php');ishp|=ohp.isHomePage('http://'+location.hostname+'/index_1.php');YD.setStyle(grp,'display',(ishp?'none':'inline'));}else if(YAHOO.sea.fp._ff||YAHOO.sea.fp._webkit){YD.setStyle(grp,'display',((window.history.length<=1)?'none':'inline'));}
YE.on(shp,'click',function(e){if(YAHOO.sea.fp._ie){ohp.setHomePage(hpurl);}else if(YAHOO.sea.fp._ff||YAHOO.sea.fp._webkit){var shpd=YD.get('shpd');if(!shpd){shpd=document.createElement('div');shpd.setAttribute('id','shpd');shpd.className='shdw';shpd.innerHTML=YAHOO.sea.fp.eyebrow.sethp_overlay;shp.parentNode.appendChild(shpd);YE.on(document,'click',function(){shpd.style.display='none';});}
shpd.style.display='block';}
YE.stopEvent(e);});}});(function(){var c=YAHOO.sea.fp.Cookie.get('FPS');if(c=='ts'){YAHOO.sea.fp.Layout.autoSwitchPageLayout('ts');}})();(function(){var YD=YAHOO.util.Dom,YE=YAHOO.util.Event;var ohp=YD.get('iehp');var hpurl='http://'+location.hostname+location.pathname;if(YAHOO.sea.fp._ie){if(!ohp){ohp=YD.get('shp-ie');}
YE.on(window,'beforeunload',function(e){var ishp=false;ishp|=ohp.isHomePage('http://'+location.hostname);ishp|=ohp.isHomePage('http://'+location.hostname+location.pathname);ishp|=ohp.isHomePage('http://'+location.hostname+'/');ishp|=ohp.isHomePage('http://'+location.hostname+'/index.php');ishp|=ohp.isHomePage('http://'+location.hostname+'/index_1.php');var bhp=new Image();bhp.src=(ylp?ylp:hpurl+'p.gif?t=0')+'&hp='+(ishp?'1':'0');});}
var o=YD.get('dims-w')||YD.get('dims-n');if(o){YE.on(o,'click',function(e){YAHOO.sea.fp.Layout.togglePageLayout(e);YE.stopEvent(e);});}
var searchInput=YD.get('p');if(searchInput){searchInput.focus();}})();YAHOO.sea.fp.Themes=(function(){var YUD=YAHOO.util.Dom,YUE=YAHOO.util.Event;return{setupSwitcher:function(id){var that=this;YUE.on(id,'click',function(e){var t=YUE.getTarget(e);if((t.id!='dims-n')&&(t.id!='dims-w')){that.loadScheme(t);YUE.stopEvent(e);}});},loadSearchBG:function(c){YUD.get('sf-noniebox').setAttribute('src','http://l.yimg.com/hb/i/sea/fp/img/'+c+'/whood2.png');YUD.get('falcon_toggleimg').setAttribute('src','http://l.yimg.com/hb/i/sea/fp/img/'+c+'/wlip_closed2.png');},updateControl:function(o){var themeId=0,u,l,s;if(o.tagName.toLowerCase()==='a'){themeId=o.id;u=YUD.getAncestorByTagName(o,'ul').getElementsByTagName('li');for(var j=0,n=u.length;j<n;++j){YUD.removeClass(u[j],'on');}
l=YUD.getAncestorByTagName(o,'li');YUD.addClass(l,'on');}
return themeId;},loadScheme:function(o){var themeId=this.updateControl(o);if(themeId!=0){YAHOO.sea.fp.Beacon('color/'+themeId);this.loadStyle(themeId);}},loadStyle:function(c){s=document.getElementById('theme-css');if(s){s.parentNode.removeChild(s);}
s=document.createElement('link');s.setAttribute('id','theme-css');s.setAttribute('rel','stylesheet');s.setAttribute('type','text/css');s.setAttribute('href','http://l.yimg.com/hb/i/sea/fp/css/'+c+'_2.4_ctr-min.css');document.getElementsByTagName('head')[0].appendChild(s);this.loadSearchBG(c);YAHOO.sea.fp.Cookie.set('FPT',c,400*3600000,'/',YAHOO.sea.fp._region+'.yahoo.com');}};})();YAHOO.sea.fp.TabSet=function(id,fn,loop,mouseover,todaysetArr,sticky){this.init(id,fn,loop,mouseover,todaysetArr,sticky);};YAHOO.sea.fp.TabSet.prototype={init:function(id,fn,loop,mouseover,todaysetArr,sticky){this.id=id;this.fn=fn;this.md=YAHOO.util.Dom.get(id);this.lidx=0;this.loop=loop;this.timeout=0;this.mouseover=mouseover;this.mousedelay=250;this.mouseovertimeout=0;this.tsArr=todaysetArr;this.tsRotated=false;this.sticky=sticky;var that=this;if(this.tsArr){for(var i=0;i<this.tsArr.length;i++){this.tsArr[i].registerFunction(this.stopAutoLoop,that);}}
if(this.md){this.tl=YAHOO.util.Dom.getElementsByClassName('tab-list','ul',this.md);if(this.tl&&this.tl.length){this.tl=this.tl[0];this.li=this.tl.getElementsByTagName('li');YAHOO.util.Event.on(this.tl,'click',this.handleClick,this,true);if(mouseover==true){YAHOO.util.Event.on(this.tl,'mouseover',this.handleMouseOver,this,true);YAHOO.util.Event.on(this.tl,'mouseout',this.handleMouseOut,this,true);}
if(loop==true){var that=this;this.timeout=setTimeout(function(){that.autoLoop();},10000);}}}},stopAutoLoop:function(obj){clearTimeout(obj.timeout);obj.loop=false;},autoLoop:function(){var that=this;if(this.tsArr){if(this.loop){this.tsRotated=this.tsArr[this.lidx].rotate();if(this.tsRotated==true){++this.lidx;if(this.lidx>=this.li.length){this.lidx=0;}
this.switchTab(this.li[this.lidx].id);}
this.timeout=setTimeout(function(){that.autoLoop();},10000);}}else{++this.lidx;if(this.lidx>=this.li.length){this.loop=false;this.lidx=0;}
this.switchTab(this.li[this.lidx].id);if(this.loop){this.timeout=setTimeout(function(){that.autoLoop();},7000);}}},handleMouseOut:function(e){clearTimeout(this.mouseovertimeout);},handleMouseOver:function(e){clearTimeout(this.mouseovertimeout);var t=YAHOO.util.Event.getTarget(e);if(t.tagName.toLowerCase()=='a'){var that=this;this.mouseovertimeout=setTimeout(function(){that.processMouseOver(t.parentNode.id);},this.mousedelay);}},processMouseOver:function(tabId){if(this.timeout!=0){clearTimeout(this.timeout);}
this.switchTab(tabId);if(this.fn!=null){this.fn();}},handleClick:function(e){if(this.timeout!=0){clearTimeout(this.timeout);}
var t=YAHOO.util.Event.getTarget(e);if(t.tagName.toLowerCase()=='a'){this.switchTab(t.parentNode.id);if(this.fn!=null){this.fn();}
YAHOO.util.Event.preventDefault(e);}},switchTab:function(on,forceNoSticky){var Dom=YAHOO.util.Dom;for(var i=0,n=this.li.length;i<n;++i){Dom.removeClass(this.li[i],'on');Dom.removeClass(this.li[i].id+'ct','on');}
Dom.addClass(on,'on');Dom.addClass(on+'ct','on');var curTabIdx=on.charAt(on.length-1);if(curTabIdx==2){if(YAHOO.sea.fp.FinanceTicker){YAHOO.sea.fp.FinanceTicker.initChart();}}
if(this.sticky&&!forceNoSticky){YAHOO.sea.fp.Cookie.set('sea_hdln',curTabIdx);}}};YAHOO.sea.fp.Preview=(function(){var YUD=YAHOO.util.Dom,YUE=YAHOO.util.Event;return{init:function(idList){var createSwitcher=function(node){return function(e){var t=YUE.getTarget(e),n=t.tagName.toLowerCase(),p,b,c;if(n=='p'||n=='img'||n=='a'||n=='li'){p=(n=='li')?t:YUD.getAncestorByTagName(t,'li');c=YUD.getElementsByClassName('on','',node)[0];YUD.removeClass(c,'on');YUD.removeClass(c.id+'ct','on');YUD.addClass(p,'on');YUD.addClass(p.id+'ct','on');}
YUE.preventDefault(e);};};var i,m,id,obj,pft;for(i=0,m=idList.length;i<m;++i){id=idList[i];obj=YUD.get(id);if(!obj){continue;}
pft=YUD.getElementsByClassName('pv-ft','',obj)[0];YUE.on(pft,'click',createSwitcher(pft));}}};})();YAHOO.sea.fp.Search=(function(){var YUD=YAHOO.util.Dom,YUE=YAHOO.util.Event;var labels=YAHOO.sea.fp.SearchHelper.labels;var links=YAHOO.sea.fp.SearchHelper.links;var frcodes=YAHOO.sea.fp.SearchHelper.frcodes;var btns=['sbmt','sbmt2'];var currentTab="sf-web";return{init:function(id){var that=this;YUE.on(id,'click',function(e){var t=YUE.getTarget(e);that.switchTab(t);YUE.stopEvent(e);});YUE.on('sbmt2','click',function(){var YDS=YAHOO.sea.fp.Search;if(!YUD.get('sado')){YDS.modParam('fr','yfp-t-101');}YDS.addParam('vc','countryVN');});YUE.on('sbmt','click',function(){var YDS=YAHOO.sea.fp.Search;var rlocal_rbutton=YUD.get('rlocal');if(rlocal_rbutton&&rlocal_rbutton.checked===true){YDS.addParam('vc','countryVN');}});if(YUD.get('sbmt')){YAHOO.sea.fp.Search.toggleButtons('sf-web');}},addParam:function(name,val){if(YUD.get(name)){YAHOO.sea.fp.Search.modParam(name,val);}else{var inp=document.createElement('input');inp.setAttribute('name',name);inp.setAttribute('value',val);inp.setAttribute('type','hidden');inp.setAttribute('id',name);var form_el=YUD.get('sf-bd');form_el.appendChild(inp);}},modParam:function(name,newval){if(name=='fr'&&YAHOO.sea.fp.usePartnerFR){return;}
var inp=YUD.get(name);if(inp!=null){inp.setAttribute('value',newval);}},delParam:function(name){var inp=YUD.get(name);var form_el=YUD.get('sf-bd');form_el.removeChild(inp);},switchTab:function(o){if(o.tagName.toLowerCase()==='a'){var a=YUD.getAncestorByTagName(o,'ul').getElementsByTagName('a');for(var i=0,n=a.length;i<n;++i){YUD.removeClass(a[i],'on');}
YUD.addClass(o,'on');this.toggleButtons(o.id);this.currentTab=o.id;}},toggleButtons:function(id){this.modifyForm(id);var str=labels[id];var b1=document.getElementById(btns[0]),b2=document.getElementById(btns[1]);b1.value=str[0];},modifyForm:function(id){var str=labels[id];var sm=YUD.get("sbmt"),sfForm=YUD.get("sf-bd");sm.value=str[0];sfForm.action=links[id][0];if(!YAHOO.sea.fp.usePartnerFR){YUD.get('fr').value=frcodes[id][0];}setTimeout("document.getElementById('p').focus()",1);},currentTab:currentTab};})();YAHOO.sea.fp.Drawer=(function(){var YE=YAHOO.util.Event,YD=YAHOO.util.Dom;var drawer='',openAnim=null,closeAnim=null,isOpen=false;return{init:function(drawerId,triggerId,closeId){var that=this;drawer=YD.get(drawerId);if(drawer!==null){openAnim=new YAHOO.util.Anim(drawer,{width:{to:590}},0.3,YAHOO.util.Easing.easeOutStrong);closeAnim=new YAHOO.util.Anim(drawer,{width:{to:0}},0.3,YAHOO.util.Easing.easeOutStrong);YE.on(triggerId,'click',function(e){if(isOpen===true){that.close();}else{that.open();}
isOpen=!isOpen;YE.stopEvent(e);});YE.on(closeId,'click',function(e){that.close();isOpen=false;YE.stopEvent(e);});}},open:function(){openAnim.animate();},close:function(){closeAnim.animate();}};})();YAHOO.sea.fp._fpt='t1';(function(){var switcher=YAHOO.util.Dom.get('t1');if(switcher){YAHOO.sea.fp.Themes.updateControl(YAHOO.util.Dom.get('t1'));}})();
