var ie=document.all
var dom=document.getElementById
var ns4=document.layers

var bouncelimit=40 //40(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)? document.body.scrollTop : 
window.pageYOffset
crossobj.top=scroll_top-350
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",100)
}


function dropin(){
scroll_top=(ie)? document.body.scrollTop : 

window.pageYOffset
if (parseInt(crossobj.top)<50+scroll_top)
crossobj.top=parseInt(crossobj.top)+40
else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)
}
}
/*Función que lee el valor de la cookie y lo devuelve. Si no encuentra la cookie devuelve un valor nulo*/
function readCookie(name){
  var nameEQ=name+"=";
  var ca = document.cookie.split(';');
  for(var i=0;i<ca.length;i++){
    var c=ca[i];
    while(c.charAt(0)=='') c=c.substring(1,c.length);
    if(c.indexOf(nameEQ)==0)
      return true;
  }
  return false;
}

/*Verfica la existencia de la cookie en el ordenador, si la cookie no existe, se corre la función 
initbox. Si la cookie existe, la función no corre.*/
function verifyCookie(){
  var myCookieName = readCookie('isipnl');
  if(myCookieName)
    return null;
  else 
    setTimeout("initbox()",10000);
}

/*Genera el efecto de rebote cuando lo capa llega a su posición estable*/
function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
}
}

function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}

/*<!--Manejador de evento onLoad-->*/
window.onload=verifyCookie

