/* Div Placement At Right Edge Of Window
   Version 1.0
   October 18, 2009
   http://www.willmaster.com/
   Copyright 2009 Bontrager Connection, LLC
*/

 /***************************/
/* Three places to customize */


// Place 1:
// Specify the width of the div and its border width.

var DivWidth = 32;
var BorderWidth = 0; // 0 (zero) if no border


// Place 2:
// Specify the id value of the div to place.

var DivID = "feedicon";


// Place 3:
// Specify how much space (number of pixels) between div and right window edge.

var SpaceAtEdge = 2;


 /* No other customizations required. */
/*************************************/
DivWidth = parseInt(DivWidth) + parseInt(SpaceAtEdge) + (parseInt(BorderWidth)*2);

function AppendOnloadResizeEvents(f)
{
   var cache = window.onload;
   if(typeof window.onload != 'function') { window.onload = f; }
   else
   {
      window.onload = function()
      {
         if(cache) { cache(); }
         f();
      };
   }
   cache = window.onresize;
   if(typeof window.onresize != 'function') { window.onresize = f; }
   else
   {
      window.onresize = function()
      {
         if(cache) { cache(); }
         f();
      };
   }
} // function AppendOnloadResizeEvents()

function WindowHasScrollbar() {
var ht = 0;
if(document.all) {
   if(document.documentElement) { ht = document.documentElement.clientHeight; }
   else { ht = document.body.clientHeight; }
   } 
else { ht = window.innerHeight; }
if (document.body.offsetHeight > ht) { return true; }
else { return false; }
} // WindowHasScrollbar()

function NailItIntoPlace(ledge) {
var did = document.getElementById(DivID);
did.style.left = ledge + "px";
did.style.display = "block";
} // function NailItIntoPlace()

function PlaceTheContent() {
if(document.documentElement && document.documentElement.clientWidth) { NailItIntoPlace(document.documentElement.clientWidth-DivWidth); }
else {
   if(navigator.userAgent.indexOf('MSIE') > 0) { NailItIntoPlace(document.body.clientWidth-DivWidth+19); }
   else {
      var scroll = WindowHasScrollbar() ? 0 : 15;
      if(typeof window.innerWidth == 'number') { NailItIntoPlace(window.innerWidth-DivWidth-15+scroll); }
      else { NailItIntoPlace(document.body.clientWidth-DivWidth+15); }
      }
   }
} // function PlaceTheContent()

AppendOnloadResizeEvents(PlaceTheContent);

// Comienza POP-UP
var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"

var bouncelimit=32 //(must be divisible by 8)
var direction="up"

function initbox(){
if (!dom&&!ie&&!ns4)
return
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-250+calunits
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",50)
}

function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<100+scroll_top)
crossobj.top=parseInt(crossobj.top)+40+calunits
else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)
}
}

function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
}
}

function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}


window.onload=initbox