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"
var variable_popup='';

function initbox(variable_popup){
if (!dom&&!ie&&!ns4)
return
crossobj=(dom)? eval('document.getElementById("' + variable_popup + '").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)<196+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 dropout(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<100+scroll_top)
crossobj.top=parseInt(crossobj.top)+40+calunits
}

function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function setCookie(cookieName, cookieValue, cookiePath, cookieExpires) 
      { 
        cookieValue = escape(cookieValue); 
        if (cookieExpires == "") 
          { 
            var nowDate = new Date(); 
            nowDate.setMonth(nowDate.getMonth() + 6); 
            cookieExpires = nowDate.toGMTString(); 
          }

        if (cookiePath != "") 
          {
            cookiePath = ";Path=" + cookiePath; 
          } 

       document.cookie = cookieName + "=" + cookieValue + ";expires=" + cookieExpires + cookiePath; 
      } 


function getCookieValue(name) 
      { 
        var cookieString = document.cookie; 
        var index = cookieString.indexOf(name + "="); 

        if (index == -1) return null; 

        index = cookieString.indexOf("=", index) + 1; 
        var endstr = cookieString.indexOf(";", index); 

        if (endstr == -1) endstr = cookieString.length; 

        return unescape(cookieString.substring(index, endstr)); 
      } 


function OpenWin(URL, winName, width, height, scroll)
		{
			var winLeft = (screen.width - width) / 3;
			var winTop = (screen.height - height) / 3;
			winData = 'height='+height+',width='+width+',top='+winTop+',left='+winLeft+',scrollbars='+scroll+',resizable';
			win = window.open(URL, winName, winData);
					
			if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
		}


  function DoPopup()
      {
	var ip = '<!--#echo var="REMOTE_ADDR"-->';
	

	var NL = getCookieValue('cisco_sell'); 
	/* var DA = getCookieValue('devalert'); 
	var DT = getCookieValue('devtext');
	var WR = getCookieValue('writers');
	var PD = getCookieValue('pdfmag'); */

if (NL == null)
        {
		//Show the newsletter signup popup
		setCookie('cisco_sell', 'true', '', '');
		initbox('cisco_sell');          
        }		
	/*
	else
	if((NL != null) && (DA == null) && (DT == null)  && (WR == null) && (PD == null))
        {
		//Show the devalert signup popup
		setCookie('devalert', 'true', '', '');
		initbox('devalert_pop');             
        }
	else
	if((NL != null) && (DA != null) && (DT == null)  && (WR == null) && (PD == null))
        {
		//Show the devtext signup popup
		setCookie('devtext', 'true', '', '');
       	initbox('devtext_pop');         
        }
	else
	if((NL != null) && (DA != null) && (DT != null)  && (WR == null) && (PD == null))
        {
		//Show the writers signup popup
		setCookie('writers', 'true', '', '');
      	initbox('writers_pop');
       }
	   /*
		else
	if((NL != null) && (DA != null) && (DT != null)  && (WR != null) && (PD == null))
        {
		//Show the writers signup popup
		setCookie('pdfmag', 'true', '', '');
      	initbox('pdf_pop');
       }
	   */
		
    }

