// ButtonTel Call-Me drop-in boxes.
// Version2.1 Date 15-11-2006

// Modify lines to suit individual site requirement. Do not modify below the Don't edit beyond here ********* line
// unless you really know what you are doing with Javascript

// Both boxes
var dropspeed=15; //set speed of drop animation (larger=faster)

// Time delay dropin box
var tdboxleft=100; //set left position of box (in px)
var tdboxtop=0; //set top position of box (in px)
var tddropdelay=0.25; // set delay before box appears (minutes)

//Specify display mode. 3 possible values are:
//1) "always"- This makes the fade-in box load each time the page is displayed
//2) "oncepersession"- This uses cookies to display the fade-in box only once per browser session
//3) integer (ie: 5)- Finally, you can specify an integer to display the box randomly via a frequency of 1/integer...
// For example, 2 would display the box about (1/2) 50% of the time the page loads.

var tddisplaymode="always";

// Call me dropin box
var cmboxleft=470; //set left position of box (in px)
var cmboxtop=360; //set top position of box (in px)

// Exit contact dropin box
var ecboxleft=200; //set left position of box (in px)
var ecboxtop=0; //set top position of box (in px)

///Don't edit beyond here ********* ///////////
var flagcm=0;var flagec=0;var ecdropdelay=0;var ecdisplaymode="always";if(parseInt(tddisplaymode)!=NaN){var tdrandom_num=Math.floor(Math.random()*tddisplaymode);}if(parseInt(ecdisplaymode)!=NaN){var ecrandom_num=Math.floor(Math.random()*ecdisplaymode);}var ie=document.all;var dom=document.getElementById;if((document.getElementById('tdboxcover'))||(document.all.tdboxcover)){if(tddisplaymode=="oncepersession"&&get_cookie("c_tdbox")==""&&get_cookie("c_ecbox")!=="yes"||tddisplaymode=="always"&&get_cookie("c_ecbox")!=="yes"||parseInt(tddisplaymode)!=NaN&&tdrandom_num==0){if(window.addEventListener){window.addEventListener("load",tdsetbox,false);}else if(window.attachEvent){window.attachEvent("onload",tdsetbox);}else if(document.getElementById||document.all){window.onload=tdsetbox;}}}if((document.getElementById('ecboxcover'))||(document.all.ecboxcover)){if(ecdisplaymode=="oncepersession"&&get_cookie("c_ecbox")=="yes"||ecdisplaymode=="always"&&get_cookie("c_ecbox")=="yes"){if(window.addEventListener){window.addEventListener("load",ecsetbox,false);}else if(window.attachEvent){window.attachEvent("onload",ecsetbox);}else if(document.getElementById||document.all){window.onload=ecsetbox;}}}function initboxtd(){if(!dom&&!ie){return;}xtdboxcover=(dom)?document.getElementById("tdboxcover"):document.all.tdboxcover;xtdbox=(dom)?document.getElementById("tdbox"):document.all.tdbox;tdscroll_top=(ie)?truebody().scrollTop:window.pageYOffset;xtdbox.height=xtdbox.offsetHeight;xtdboxcover.style.height=parseInt(xtdbox.height)+"px";xtdbox.style.top=xtdbox.height*(-1)+"px";xtdboxcover.style.left=tdboxleft+"px";xtdboxcover.style.top=tdboxtop+"px";xtdboxcover.style.visibility=(dom||ie)?"visible":"show";tddropstart=setInterval("dropintd()",50);}function dropintd(){tdscroll_top=(ie)?truebody().scrollTop:window.pageYOffset;if(parseInt(xtdbox.style.top)<0){if((flagcm==1)||(flagec==1)){return;}else{xtdboxcover.style.top=tdscroll_top+tdboxtop+"px";xtdbox.style.top=parseInt(xtdbox.style.top)+dropspeed+"px";}}else{clearInterval(tddropstart);xtdbox.style.top=0;}}function dismissboxtd(){xtdboxcover=(dom)?document.getElementById("tdboxcover"):document.all.tdboxcover;if(window.tddropstart)clearInterval(tddropstart);xtdboxcover.style.visibility="hidden";xtdboxcover.zIndex="-1";if(tddisplaymode=="oncepersession"){document.cookie="c_tdbox=yes";}}function tdsetbox(){setTimeout("initboxtd()",60000*tddropdelay)}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 initboxec(){if(!dom&&!ie){return;}xecboxcover=(dom)?document.getElementById("ecboxcover"):document.all.ecboxcover;xecbox=(dom)?document.getElementById("ecbox"):document.all.ecbox;ecscroll_top=(ie)?truebody().scrollTop:window.pageYOffset;xecbox.height=xecbox.offsetHeight;xecboxcover.style.height=parseInt(xecbox.height)+"px";xecbox.style.top=xecbox.height*(-1)+"px";xecboxcover.style.left=ecboxleft+"px";xecboxcover.style.top=ecboxtop+"px";xecboxcover.style.visibility=(dom||ie)?"visible":"show";ecdropstart=setInterval("dropinec()",50);}function dropinec(){ecscroll_top=(ie)?truebody().scrollTop:window.pageYOffset;if(parseInt(xecbox.style.top)<0){if(flagcm==1||flagec==1){return;}else{xecboxcover.style.top=ecscroll_top+ecboxtop+"px";xecbox.style.top=parseInt(xecbox.style.top)+dropspeed+"px";}}else{clearInterval(ecdropstart);xecbox.style.top=0;}}function dismissboxec(){xecboxcover=(dom)?document.getElementById("ecboxcover"):document.all.ecboxcover;if(window.ecdropstart)clearInterval(ecdropstart);xecboxcover.style.visibility="hidden";xecboxcover.zIndex=-1;if(ecdisplaymode=="oncepersession"||ecdisplaymode=="always"){document.cookie="c_ecbox=no";}}function ecsetbox(){setTimeout("initboxec()",60000*ecdropdelay)}function initboxcm(){flagcm=1;if(!dom&&!ie){return;}xcmboxcover=(dom)?document.getElementById("cmboxcover"):document.all.cmboxcover;xcmbox=(dom)?document.getElementById("cmbox"):document.all.cmbox;cmscroll_top=(ie)?truebody().scrollTop:window.pageYOffset;xcmbox.height=xcmbox.offsetHeight;xcmboxcover.style.height=parseInt(xcmbox.height)+"px";xcmbox.style.top=xcmbox.height*(-1)+"px";xcmboxcover.style.left=cmboxleft+"px";xcmboxcover.style.top=cmboxtop+"px";xcmboxcover.style.visibility=(dom||ie)?"visible":"show";cmdropstart=setInterval("dropincm()",50);}function dropincm(){cmscroll_top=(ie)?truebody().scrollTop:window.pageYOffset;if(parseInt(xcmbox.style.top)<0){xcmboxcover.style.top=cmscroll_top+cmboxtop+"px";xcmbox.style.top=parseInt(xcmbox.style.top)+dropspeed+"px";}else{clearInterval(cmdropstart);xcmbox.style.top=0;}}function dismissboxcm(){xcmboxcover=(dom)?document.getElementById("cmboxcover"):document.all.cmboxcover;if(window.cmdropstart)clearInterval(cmdropstart);xcmboxcover.style.visibility="hidden";xcmboxcover.zIndex=-1;}function truebody(){return(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;}

/***********************************************
* This script is based on and modified from (by iimco uk ltd - www.iim.co.uk) the
* Amazon style Drop-in content box- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
* Go to http://www.dynamicdrive.com/ for full original source code
***********************************************/
