//CONFIG: Vars that Set Element Positioning
var xs_StartPositionTopButton = 260; //95
var xs_StartPositionTopBanner = 50;//-129;
var xs_MovePositionTop=xs_StartPositionTopBanner;//used to be 91
var xs_BannerWidthPhysical = 320;
var xs_BannerWidthMiddle = xs_BannerWidthPhysical/2;
var xs_pHeightPhysical = 211;
var xs_pHeightClipped=211;
//VARS: Supporting VARs for flags, etc
var xs_bv=0;
var xs_updown=1;
var xs_endpt=0;
var xs_ranonce=0;
var xs_pDivSeen=0;
var xs_pTuck=0;
var ua=navigator.userAgent.toLowerCase()

function xsGetCookieVal (offset) {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1){endstr = document.cookie.length;}
   return unescape(document.cookie.substring(offset, endstr));
}

function xsGetCookie (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 xsGetCookieVal (j);
   i = document.cookie.indexOf(" ", i) + 1;
   if (i == 0) break; }
   return null;
}
function xsSetCookie (name,value,expires,path,domain,secure) {
document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}
var xs_exp = new Date(); xs_exp.setTime(xs_exp.getTime()+(48*60*60*1000));
if (true) {xs_bv=1}
function xs_pdEx(){
   var xs_pDiv2 = document.getElementById("xs_pDiv2");
   var xs_pDiv = document.getElementById("xs_pDiv");
   var xs_popval = xsGetCookie('seenexplilu');  
   //GB-10042008 xsSetCookie('seenexplilu', "", xs_exp, "/");
   xsSetCookie('seenexplilu', "1", xs_exp, "/");

   //GB-10042008 var xs_ctest = !(xs_popval == null);   
   var xs_ctest = !(xs_popval == null);   

   if((xs_bv)&&(!xs_ranonce)&&(xs_ctest!=null&&xs_ctest==true)){   
      //BRANCH: Occurs with ONLOAD event...sets up the DIVs
      xs_pDiv2.style.left=xs_pDiv.style.left= ((document.body.offsetWidth/2)-xs_BannerWidthMiddle); 
      xs_pDiv2.style.top=xs_StartPositionTopButton;
      xs_pDiv.style.top=xs_StartPositionTopBanner; 
      xs_pd();
   }else{
      //BRANCH: Occurs with ONRESIZE event
      if(xs_pTuck == 1){
         if (xs_pDivSeen != 1){
            xs_pDiv.style.clip="rect(0," + xs_BannerWidthPhysical + "," + xs_pHeightPhysical + ",0)";
            xs_pDiv.style.display="";
            xs_pDiv.style.top=xs_StartPositionTopBanner;
         }
         xs_endpt=(document.body.offsetWidth/2)-xs_BannerWidthMiddle;  
         xs_tuck();
      }//end if
   }//end if
}//end function

function xs_pd(){
   var xs_pDiv = document.getElementById("xs_pDiv");
   var xs_pDiv2 = document.getElementById("xs_pDiv2");
   xs_ranonce=1;
   if (((xs_pHeightClipped<xs_pHeightPhysical)&&(xs_updown==0)) || ((xs_pHeightClipped>3)&&(xs_updown==1))) {
      //BRANCH: Movement
      if(xs_pHeightClipped==xs_pHeightPhysical){xs_pDiv.style.display=""}
      (xs_updown==0)?xs_pHeightClipped+=3:xs_pHeightClipped-=3;
      (xs_updown==0)?xs_MovePositionTop-=3:xs_MovePositionTop+=3;
      xs_pDiv.style.clip="rect(" + xs_pHeightClipped + ",auto," + xs_pHeightPhysical + ",auto)";
      xs_pDiv.style.top=xs_MovePositionTop;
      setTimeout("xs_pd();",20);
   }else{
      if (xs_updown==1){
         //BRANCH: All the way DOWN position
         xs_pDiv.style.clip="rect(0,auto," + xs_pHeightPhysical + ",auto)";//width of actual drop down
         xs_pDiv.style.top=xs_MovePositionTop;//this is the space from the top of the page to the top of the banner
         xs_updown=0;
         xs_pDiv2.style.display='';
         setTimeout("xs_pd();",4500);
      }else{
         //BRANCH: All the way UP position
         xs_pDiv.style.display='none';
         xs_pDivSeen = 1;
         xs_endpt=(document.body.offsetWidth/2)-xs_BannerWidthMiddle;
         xs_tuck();
      }
   }
}
function xs_tuck(){
   var xs_pDiv2 = document.getElementById("xs_pDiv2");
   if(xs_endpt<(document.body.offsetWidth-355)){
      xs_endpt+=5;
      xs_pDiv2.style.left=xs_endpt; 
      setTimeout("xs_tuck();",20);
   }else{
      xs_pTuck = 1
   }
}
