/**
 * FocusSearch script for the BonusThemes.com Focus Template
 *
 * @package bt_focus
 * @version 1.0
 * @copyright BonusThemes.com 2008
 * @link http://www.bonusthemes.com/goto/bt_focus
 */


function FocusSearch(){this.hd_tag=document.getElementById('focus_search_tag');this.wdg=document.getElementById('focus_search_wdg');this.speed=5;this.interval=20;this.state=0;this.timer=0;this.progress=0;this.y_start=27;this.y_end=44;this.y_extend=this.y_end-this.y_start;this.hd_tag.style.position='absolute';this.hd_tag.style.overflow='hidden';this.hd_tag.style.left='0px';this.hd_tag.style.top='0px';this.hd_tag.style.visibility='hidden';this.hd_tag.style.display='block';this.hd_tag_width=this.hd_tag.offsetWidth;this.hd_tag.style.display='none';this.hd_tag.style.visibility='visible';this.wdg.style.position='absolute';this.wdg.style.overflow='hidden';this.wdg.style.left='0px';this.wdg.style.top='0px';this.wdg.style.visibility='hidden';this.wdg.style.display='block';this.wdg_width=this.wdg.offsetWidth;this.wdg.style.display='none';this.wdg.style.visibility='visible';}
FocusSearch.prototype.set_position=function(){if(this.wdg.style.display=='block'){this.x=744;this.y=117;var aa=document.getElementById('r2');while(aa){this.x+=aa.offsetLeft;this.y+=aa.offsetTop;aa=aa.offsetParent;}
this.hd_tag.style.left=this.x+'px';this.hd_tag.style.top=this.y+'px';this.wdg.style.left=(this.x-this.wdg_width+this.hd_tag_width)+'px';this.wdg.style.top=(this.y+this.hd_tag.offsetHeight)+'px';}}
FocusSearch.prototype.h_click=function(){this.state=this.state<1?2:-1;if(this.timer==0)this.h_timer();}
FocusSearch.prototype.h_timer=function(){this.timer=0;if(this.state==2){this.progress+=this.speed;if(this.progress>=100){this.progress=100;this.state=1;document.getElementById('focus_search_input').focus();}}
else if(this.state==-1){this.progress-=this.speed;if(this.progress<=0){this.progress=0;this.state=0;}}
if(this.state==0){this.hd_tag.style.display='none';this.wdg.style.display='none';}
else{if(this.wdg.style.display!='block'){this.hd_tag.style.display='block';this.wdg.style.display='block';this.set_position();}
var ba=Math.round(this.progress);if(ba==0)ba=1;this.hd_tag.style.opacity=ba/100;this.hd_tag.style.filter='alpha(opacity='+ba+')';this.wdg.style.opacity=ba/100;this.wdg.style.filter='alpha(opacity='+ba+')';this.wdg.style.height=Math.round(this.y_start+this.y_extend*ba/100)+'px';}
if(this.state==-1||this.state==2)this.timer=setTimeout('document["focusSearch"].h_timer()',this.interval);}