// CometZone Cut-and-Paste Code 
// $Revision: 13 $
// $Date: 7/13/00 3:13p $

var popupURL;
var URLsSet=false;
var globalSponsorNum;
var Loaded=false;
var Flag=false;

window.onerror=isError;        
function isError(msg){
    //alert("ERROR");
    return true;
}

function Is () {        // Browser Sniffer
    var agt=navigator.userAgent.toLowerCase();           
    this.major = parseInt(navigator.appVersion);
    this.nav = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1)));
    this.nav3 = (this.nav && (this.major == 3)); 
    this.nav4 = (this.nav && (this.major == 4));
    this.nav6 = (this.nav && (this.major >= 5)); 
    this.win95 =((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));  
    this.ie = ( agt.indexOf("aol")!=-1 && agt.indexOf("c-aol")==-1 )|| (agt.indexOf("msie")!=-1); 
    this.ie3 =(this.ie && (this.major == 2)); 
    this.ie4 = (this.ie && ((agt.indexOf('4')!=-1) && agt.indexOf('5.')==-1));
    this.ie5 = (this.ie && (agt.indexOf('5.')!=-1));
    this.win98 =((agt.indexOf("win98")!=-1)||(agt.indexOf("windows 98")!=-1)); 
    this.winnt =((agt.indexOf("winnt")!=-1)||(agt.indexOf("windows nt")!=-1)); 
    this.win32 = this.win95 || this.winnt || this.win98 ||((this.major >= 4) && (navigator.platform == "Win32")) || (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1);
    this.compatibleIE = ( this.win32 && (this.ie4 || this.ie3 || this.ie5)); 
    this.compatibleNS = ( this.win32 && (this.nav3||this.nav4));
    this.compatible = (this.compatibleIE || this.compatibleNS); 
}
var is = new Is();
if(is.compatible) Flag=true;

function NSEmbed(cursorTag, mode, script) {
    if (is.compatibleNS) {
        if (navigator.mimeTypes["application/x-comet"]) {
            var hasMime=GetMime();
            if(hasMime==true) {
                document.write('<embed name="CurNS" type="application/x-comet" width=2 height=1 ');
                document.write(cursorTag);
                document.writeln('></embed>');
            }
            else {
                if(!GetCookie("RejectedCursor")) OfferUpgrade();
            }
        }
        else if(!GetCookie("RejectedCursor")) showPopUp(21);
    }
}  
        
function GetMime() {
    var mime=navigator.mimeTypes;
    var i;
    for (i=0;i<mime.length;i++) {
        if (mime[i].type.indexOf("x-comet#") >=0) {
            return true;
        }
    }
    return false;
}
        
function OfferUpgrade() {
    var msg="This site uses CometZone Cursors!\nYou must upgrade your CometCursor software to view this content\n\Upgrade Now?";
    if(confirm(msg)) {
        if (is.ie3 ) window.location="http://download.cometsystems.com"; 
        else showPopUp(22);
    }
    else setReject(0);
}        
        
function showPopUp(code) {
    //var gifURL="http%3A//content.cometsystems.com/users/"+userid+"/pop"+acctnum+".gif";
    popupURL="http://download.cometsystems.com/popupsplash.asp?RejectDuration=0&RefererUserCode="+code+"&RefererSite=popup&Referer=" + escape(document.location);
    popupWin=window.open(popupURL,"popupwindow","resizable=yes,location=no,toolbar=no,scrollbars=no,height=300,width=300");
}
        
function GetCookie(name) {
    var arg = name+"=";
    var arglength=arg.length;
    var cookielength=document.cookie.length;
    var i=0;
    while(i<cookielength) {
        var valStart=i+arglength;
        if(document.cookie.substring(i,valStart)==arg) {
            var end=document.cookie.indexOf (";",valStart);
            if(end==-1) end=document.cookie.length;
            return unescape(document.cookie.substring(valStart,end));
        }
        i=document.cookie.indexOf(" ",i)+1;
        if(i==0) break;
    }
    return null;
}
        

function setReject(days) {
   document.cookie = "RejectedCursor=true";
}

var Loaded=true;
var buttonPlaced=false;
function Button(sponsorNum) {

        globalSponsorNum = sponsorNum;
        buttonPlaced=true;
        buttonURL="";
        
        if(is.ie){
                document.write("\n");
                str="";
                document.write(str);
        }
        if(is.nav) {
                document.write("<SCRIPT SRC='http://files.cometsystems.com/javascript/MakeNSBanner2000.js' LANGUAGE=JAVASCRIPT></" + "SCRIPT>");
        }
        Flag=true;
}

var globalCometPackageName;

function TheCometCursor(packageName, sponsorNum)
{      
    if(buttonPlaced) {
        var LicenseKey;
        LicenseKey="022098a57a7b8a2530c2951038ccfc00a7ed25162b0bef-00029d-cometsystems.com;cometzone.com;akamaitech.net";
    
        var cpfURL;
        var packageURL;
        cpfURL="http://content.cometsystems.com/czcontent/cpfs/" + packageName + ".cpf";
        globalCometPackageName=packageName;
        
        if(is.compatibleIE)
        {
            if(!is.ie3)
            {
                //CC 2.0 support
                document.write("<META comet_src=\"http://files.cometsystems.com/javascript/cz_license.html\" >");
            }
            //CC 1.X support
            document.write("<");
            document.write("object id='CurIE' width=1 height=1 classid='CLSID:1678F7E1-C422-11D0-AD7D-00400515CAAA' CODEBASE='http://files.cometsystems.com/cometcursor/21_cometzone/comet.cab#Version=1,5,0,0'>");
            document.write("<");
            document.write('param name="Pkg" value="<Name=pkg Url=');
            document.write(cpfURL)
            document.write('>">');
            document.write('</object>');
        }
        if(is.compatibleNS)
        {
            if (is.compatible&&!is.ie3) 
            { 
                     NSEmbed('Pkg="<Name=pkg Url='+cpfURL+'>"  ' , 'auto' , 'region' ); 
            }
        }
    }        
}

//if(is.nav3) {
//	Loaded=false;
//	Button(20);
//}

