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(){
	
clearInterval(dropdelay);

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-350+calunits        //-350
crossobj.visibility=(dom||ie)? "visible" : "show"
// 
document.cookie="initbox=yes;"
//
dropstart=setInterval("dropin()",50)  // 50
}

function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
// if (parseInt(crossobj.top)<100+scroll_top)
if (parseInt(crossobj.top)<0+scroll_top)
crossobj.top=parseInt(crossobj.top)+250+calunits
else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)  // 50
//
document.cookie="dropin=yes;"
//
}
}

function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
dropout=setInterval("dropend()",300000)  // 5 min.
//
document.cookie="bouncein=yes;"

//
}
}

function dropend(){
crossobj.visibility= "hidden"
}

function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}


function get_cookie(Name) {
var search = Name + "="
var returnvalue = ""
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function dropornot(){
var exp = new Date();	

if (get_cookie("droppedin")==""){		
	dropdelay=setInterval("initbox()",40000);	
	exp.setTime(exp.getTime() +  (24*60*60*1000 )); //exire in one day // 24 * 60 * 60 * 1000 * 45
	document.cookie="droppedin=yes; expires=" + exp.toGMTString();
	}
}

function signup(){ 
	dismissbox();
	var exp = new Date();	
	exp.setTime(exp.getTime() +  (45* 24*60*60*1000 )); //if signup, cookie expired in 45 days	
	document.cookie="droppedin=yes; expires=" + exp.toGMTString();	
}


var ct;

function loadandclear() {
 dropornot();
 clearTimeout(ct);
}

ct = setTimeout('loadandclear()',3000);