function isMAC()
{

    return(navigator.appVersion.indexOf("Mac"));
}
function isIE()
{

    var agt=navigator.userAgent.toLowerCase();
  this.ie = (agt.indexOf("msie") != -1);
  return this.ie;
}
function isIE5Up()
{
    var agt=navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ie = (agt.indexOf("msie") != -1);
    this.ie3 = (this.ie && (this.major < 4));
    this.ie4 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0") == -1) && (agt.indexOf("msie 6.0") == -1));

    this.ie5up = (this.ie && !this.ie3 && !this.ie4);
    return this.ie5up;
}
///////////////////////poptastic function///////displays a new popup window
function poptastic(url) 
{
	
new_window=window.open(url,'new_window','menubar=no,scrollbars=yes,toolbar=no,location=no,directories=no,resizable=yes,top=0,left=0, height=200, width=500'); 
	if (window.focus) {new_window.focus();}
}//end of poptastic function

function poptasticclose(url) 
{
	
new_window=window.open(url,'new_window','menubar=no,scrollbars=yes,toolbar=no,location=no,directories=no,resizable=yes,top=0,left=0, height=200, width=500'); 
	if (window.focus) 
	{
	   new_window.focus();
	}
}//end of poptastic function

function poptasticlarge(url) 
{
	
new_window=window.open(url,'new_window','menubar=no,scrollbars=yes,toolbar=no,location=no,directories=no,resizable=yes,top=0,left=0, height=700, width=600'); 
	   new_window.focus();
return new_window;
}//end of poptastic function


function friendslink()
{
  window.opener=self;
  self.close()
  window.open('ipl_page1.php?friends=Y', 'wndtest');
}
//////////zipEntered2 function//////////////
function zipEntered()
{
        if(readCookie('temp') == 'yes')
	{
           eraseCookie('temp');
	   self.close();
	}
	else
	{
	   var URL="ipl_page1.php?Update=N";
           eraseCookie('temp');
	   newWin = window.open(URL,'newWin','menubar=no,scrollbars=no,toolbar=no,location=no,directories=no,resizable=no,top=0,left=0,height=0,width=0');
	   self.close();
	}
}
function eraseCookie(name)
{       
    createCookie(name, "", -1);
}
function readCookie(name)
{
        var nameEQ = "";
        nameEQ = name + "=";
        document.name = "damon.ipl.org";
        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 c.substring(nameEQ.length, c.length);        
	  }
        }
        return null;
}            
function createCookie(name, value, days)
{
        if(days)
        {
           var date = new Date();
           date.setTime(date.getTime()+(days*24*60*60*1000));
           var expires = "; expires="+date.toGMTString();
        }
        var expires = ""; 
        document.cookie = name+ "=" + +value+expires+"; path=/";
}   
function showZip()
{
        if(isIE() && !isMAC())
	{
	   if(!isIE5Up())
	   {
		exit;	
	   }
	}

        if(readCookie('friends'))
        {
	  ;
	}
        else
        {
        //see if can write cookie
           createCookie('test', 'test');
           if(readCookie('test'))
           {       
                eraseCookie('test');
                poptasticclose('http://damon.ipl.org:8080/ipl1.php');
           }
	}
}
function displaySolicit()
{
//Don't attempt to display the Solicit message if already displayed today
        if(readCookie('friends') && !readCookie('solicit'))
	{
	   newWin= poptasticlarge('http://damon.ipl.org:8080/ipl_page1.php?checksol=Y');
	   newWin.blur();
	   self.focus();
        }
}
