//-----------------------------------
// CometZone Cut-and-Paste Code 
// $Revision: 3 $
// $Date: 6/04/03 4:31p $

//alert('js');
var popupURL;
var URLsSet=false;
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 pluginspage="http://download.cometsystems.com/getplugin.asp" ');
                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";
}

function TheCometCursor(packageName, normalCursor, hyperCursor, sponsorNum)
{      
    if (sponsorNum > 0) return;
       
    var LicenseKey;
    //1.x key for default Angelfire instantiates
    LicenseKey="02205872e1b589cf3fb3d2db88b15a33682a1c162b0bef-000095-cometsystems.com;akamaitech.net";
    
    var normalCursorURL;
    var hyperCursorURL;
    var packageURL;
    normalCursorURL	=	"http://content.cometsystems.com/afcontent/cursors/" + normalCursor;
    hyperCursorURL	=	"http://content.cometsystems.com/afcontent/cursors/" + hyperCursor;
    packageURL	=	"http://content.cometsystems.com/afcontent/packages/" + packageName + ".xml";
    
    if(is.compatibleIE)
    {
        if(!is.ie3)
        { 
            //CC 2.0 support
            document.write("<META comet_src=\"http://files.cometsystems.com/genesis/licenses/license_angelfire_cursorserve.html\" comet_package=\"af_package\" comet_url=" + packageURL +">");
            document.body.setAttribute("comet_normal", "af_package.normal");
            document.body.setAttribute("comet_ibeam", "af_package.ibeam");
            document.body.setAttribute("comet_hyperlink", "af_package.hyperlink");
            document.body.setAttribute("comet_wait", "af_package.wait");
        }
        //CC 1.X support	1.x key for default Angelfire instantiates
		if(!is.ie3) { 		//Codebase pushing MCC
			document.write("<object id='CurIE' width=1 height=1 classid='CLSID:1678F7E1-C422-11D0-AD7D-00400515CAAA' CODEBASE='http://files.cometsystems.com/cometcursor/cobrand/comet.cab?"+Math.random()+new Date().getTime()+"#Version=1,5,0,0'>");
			document.write("<param name='Key' value='"+LicenseKey+"'>");
			document.write("<param name='Normal' value='"+normalCursorURL+"'>");
			document.write("<param name='Ibeam' value='"+normalCursorURL+"'>");
			document.write("<param name='Hyperlink' value='"+hyperCursorURL+"'>");
			document.write("<param name='Wait' value='"+normalCursorURL+"'>");
			document.write('</object>');
        }
		else { 				//Codebase pushing Comet 1.x
			document.write("<object id='CurIE' width=1 height=1 classid='CLSID:1678F7E1-C422-11D0-AD7D-00400515CAAA' CODEBASE='http://files.cometsystems.com/cometcursor/comet.cab#Version=1,5,0,0''>");
			document.write("<param name='Key' value='"+LicenseKey+"'>");
			document.write("<param name='Normal' value='"+normalCursorURL+"'>");
			document.write("<param name='Ibeam' value='"+normalCursorURL+"'>");
			document.write("<param name='Hyperlink' value='"+hyperCursorURL+"'>");
			document.write("<param name='Wait' value='"+normalCursorURL+"'>");
			document.write('</object>');
		}

    }
    if(is.compatibleNS)
    {
        if (is.compatible&&!is.ie3) 
        { 
			NSEmbed(' key='+LicenseKey+' Normal='+normalCursorURL+' Hyperlink='+hyperCursorURL+' , "auto" , "region">' ); 
        }
    }        
}

var Loaded=true;

