//CONFIG: Vars that Set Element Positioning
var hbf_StartPositionTopButton=0;
var hbf_StartPositionTopBanner = 12;
var hbf_MovePositionTop=0;//used to be 91
var hbf_BannerWidthPhysical = 447;
var hbf_BannerWidthMiddle = hbf_BannerWidthPhysical/2;
var hbf_pHeightPhysical = 147;
var hbf_pHeightClipped=147;

//VARS: Supporting VARs for flags, etc
var hbf_bv=0;
var hbf_updown=1;
var hbf_endpt=0;
var hbf_ranonce=0;
var hbf_pDivSeen=0;
var hbf_pTuck=0;
var hbf_pBigSeen=0;
var ua=navigator.userAgent.toLowerCase()

function hbfGetCookieVal (offset) {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1){endstr = document.cookie.length;}
   return unescape(document.cookie.substring(offset, endstr));
}

function hbfGetCookie (name) {
   var arg = name + "=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen) {
   var j = i + alen;
   if (document.cookie.substring(i, j) == arg) return hbfGetCookieVal (j);
   i = document.cookie.indexOf(" ", i) + 1;
   if (i == 0) break; }
   return null;
}
function hbfSetCookie (name,value,expires,path,domain,secure) {
document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}
var hbf_exp = new Date(); hbf_exp.setTime(hbf_exp.getTime()+(48*60*60*1000));
if (true) {hbf_bv=1}
function hbf_pdEx(){
   var hbf_pSmall = document.getElementById("hbf_pSmall");
   var hbf_pBig = document.getElementById("hbf_pBig");
   var hbf_popval = hbfGetCookie('viewexp');
   //hbfSetCookie('viewexp', "", hbf_exp, "/");
   var hbf_ctest = !(hbf_popval == null);   
   //if((hbf_bv)&&(!hbf_ranonce)&&(hbf_ctest!=null&&hbf_ctest==true)){
      //BRANCH: Occurs with ONLOAD event...sets up the DIVs
      hbf_pSmall.style.left=hbf_pBig.style.left= ((document.body.offsetWidth/2)-hbf_BannerWidthMiddle); 
      hbf_pSmall.style.top=hbf_StartPositionTopButton;
      hbf_pBig.style.top=hbf_StartPositionTopBanner; 
      hbf_pd();
   //}else{
      //BRANCH: Occurs with ONRESIZE event
      if(hbf_pTuck == 1){
         if (hbf_pBigSeen != 1){
            hbf_pBig.style.clip="rect(0," + hbf_BannerWidthPhysical + "," + hbf_pHeightPhysical + ",0)";
            hbf_pBig.style.display="";
            hbf_pBig.style.top=hbf_StartPositionTopBanner;
         }
         hbf_endpt=(document.body.offsetWidth/2)-hbf_BannerWidthMiddle;  
         hbf_tuck();
      }//end if
  // }//end if
}//end function

function hbf_pd(){
   var hbf_pBig = document.getElementById("hbf_pBig");
   //alert(hbf_pBig.style.display)
   var hbf_pSmall = document.getElementById("hbf_pSmall");
   hbf_ranonce=1;
   if (((hbf_pHeightClipped<hbf_pHeightPhysical)&&(hbf_updown==0)) || ((hbf_pHeightClipped>3)&&(hbf_updown==1))) {
      //BRANCH: Movement
      if(hbf_pHeightClipped==hbf_pHeightPhysical){hbf_pBig.style.display=""}
      (hbf_updown==0)?hbf_pHeightClipped+=3:hbf_pHeightClipped-=3;
      (hbf_updown==0)?hbf_MovePositionTop-=3:hbf_MovePositionTop+=3;
      hbf_pBig.style.clip="rect(" + hbf_pHeightClipped + "px auto " + hbf_pHeightPhysical + "px auto)";
      hbf_pBig.style.top=hbf_MovePositionTop+"px";
      setTimeout("hbf_pd();",20);
   }else{
      if (hbf_updown==1){
         //BRANCH: All the way DOWN position
         hbf_pBig.style.clip="rect(0px auto " + hbf_pHeightPhysical + "px auto)";//width of actual drop down
         hbf_pBig.style.top=hbf_MovePositionTop;//this is the space from the top of the page to the top of the banner
         hbf_updown=0;
         hbf_pSmall.style.display='';
         setTimeout("hbf_pd();",15000);
      }else{
         //BRANCH: All the way UP position
         hbf_pBig.style.display='none';
         hbf_pBigSeen = 1;
         hbf_endpt=(document.body.offsetWidth/2)-hbf_BannerWidthMiddle;
       //  hbf_tuck();
      }
   }
}
function hbf_tuck(){
   var hbf_pBig2 = document.getElementById("hbf_pSmall");

   if(hbf_endpt<(document.body.offsetWidth-375)){
      hbf_endpt-=5;
      hbf_pSmall.style.left=hbf_endpt; 
      setTimeout("hbf_tuck();",20);
   }else{
      hbf_pTuck = 1
   }
}
