// added for 5/25 survey... remove when done
// from here................................

word=new Array();
word[0] = "<script language=\"JavaScript\">\n"
	+ "<!--\n"
	+ "var narDelay=200\n"
	+ "var color=0\n"
	+ "function nar() {\n"
	+ "color=color+1;\n"
	+ "if(color==1){document.linkColor='red';}\n"
	+ "if(color==1){document.vlinkColor='red';}\n"
	+ "if(color==1){document.alinkColor='red'; setTimeout(\"nar();\",narDelay);}\n"
	+ "if(color==2){document.linkColor='white';}\n"
	+ "if(color==2){document.vlinkColor='white';}\n"
	+ "if(color==2){document.alinkColor='white'; setTimeout(\"nar();\",narDelay);}\n"
	+ "if(color==3){document.linkColor='666633';}\n"
	+ "if(color==3){document.vlinkColor='666633';}\n"
	+ "if(color==3){document.alinkColor='666633'; setTimeout(\"nar();\",narDelay);}\n"
	+ "if(color==4){color=0; setTimeout(\"nar();\",narDelay);} }\n"
	+ "setTimeout(\"nar();\",narDelay);\n"
	+ "// -->\n"
	+ "</script>\n";
word[1] = "<table align='center' width=240 border=1 bgcolor='333333'><tr><td align='center'><img src='http://www.nba.com/hornets/images/nbacom_hornets_st.gif' align='center'><br />"
	+ "<a href='javascript:window.close()' onClick=\"window.open('http://www.instantsurvey.com/SC/21258_9307369200.htm','Survey','width=700,height=550,scrollbars=yes,resizeable=yes,menubar=no,toolbar=no,location=no,status=no,top=50,left=50,screenX=50,screenY=50','mainWindow')\"><font size=7  face='verdana, arial'><b>WIN</b></font></a><br /> <font size=4 color='0066cc' face='arial'><b>an NBA.com T-Shirt</b></a></font><br />"
	+ "<font size=2 color='ffffff' face='arial'>Take a few moments to answer our survey and tell us how we can improve our website.  <b>You could win an NBA.com T-Shirt.</b><br /><br />"
	+ "<a href='javascript:window.close()' onClick=\"window.open('http://www.instantsurvey.com/SC/21258_9307369200.htm','Survey','width=700,height=550,scrollbars=yes,resizeable=yes,menubar=no,toolbar=no,location=no,status=no,top=50,left=50,screenX=50,screenY=50','mainWindow')\"><font size=3  face='arial'><b>CLICK HERE!</font></b></a><br /><br />"
	+ "</td></tr></table>";
	
	function Random(N) 
	{ return Math.floor( N*Math.random() );	} 

  	function everyNth(nth)
	{
	  if ( Random(nth+2) > nth )
	    { return true; }
	  else
	    { return false; }
	}

	function popdef()
	{
	  // this determines the probability of the pop-up being served - every tenth in this case
	  if( everyNth(100)  ) 
	  {
	    defwin=window.open("","Glossary","Toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=280,height=290","mainWindow");
	    defwin.document.open();		
	    defwin.document.write("<html><head><title>Survey Popup</title></head><body bgcolor='000000' LINK='red' VLINK='red'>");
		//defwin.document.write(word[0]);
	    defwin.document.write(word[1]);
	    defwin.document.write("</body></html>");
	    defwin.document.close();
	    clearID=defwin.setTimeout("self.close()",15000);
	  }
	}
// to here.................................

// Template.js

var onChangeArray = new Array();
function onChange() {
    for (var i = 0; i < onChangeArray.length; i++) {
        eval(onChangeArray[i]);
    }
}
function addOnChangeHandler(expr) {
    onChangeArray[onChangeArray.length] = expr;
}
var onLoadArray = new Array();
function onLoad() {
    for (var i = 0; i < onLoadArray.length; i++) {
        eval(onLoadArray[i]);

    // called for 5/25 survey 
    // put in "make sure HP handlers"
    popdef();
    }
}
function addOnLoadHandler(expr) {
    onLoadArray[onLoadArray.length] = expr;
}
function silentError() {
    return true;
}
function handleReSize() {
    window.location.reload();
}
function init(verbose) {
    var theAppVersion = parseInt(navigator.appVersion);
    if (theAppVersion < 5) {
         if (navigator.appName == "Netscape") {
                window.onresize = handleReSize;
         }
    }
    if (!verbose) {
        window.onerror = silentError;
    }
}

// Login.js

function launchWindow(url, name, height, width) {
  var str = "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  return window.open(url, name, str);
}

// MediaPopup.js

function aviWin(src,title,brandImage,brandImageLink) {
path = "/media/popup_avi.jhtml?src=" + src + "&title=" +title;
attrs = 'toolbar=0,menubar=0,scrollbars=0,scrolling=no,resizable="no",width=310';
brand(427,347,brandImage,brandImageLink);
gallery=window.open(path,"graph",attrs);
gallery.focus();
}

function movWin(src,title,brandImage,brandImageLink) {
path = "/media/popup_mov.jhtml?src=" + src + "&title=" +title;
attrs = 'toolbar=0,menubar=0,scrollbars=0,scrolling=no,resizable="no",width=310';
brand(427,347,brandImage,brandImageLink);
gallery=window.open(path,"graph",attrs);
gallery.focus();
}

function rmWin(src,title,brandImage,brandImageLink) {
path = "/media/popup_rm.jhtml?src=" + src + "&title=" +title;
attrs = 'toolbar=0,menubar=0,scrollbars=0,scrolling=no,resizable="no",width=300';
brand(435,355,brandImage,brandImageLink);
gallery=window.open(path,"graph",attrs);
gallery.focus();
}

function raWin(src,title,brandImage,brandImageLink) {
path = "/media/popup_ra.jhtml?src=" + src + "&title=" +title;
attrs = 'toolbar=0,menubar=0,scrollbars=0,scrolling=no,resizable="no",width=310';
brand(427,347,brandImage,brandImageLink);
gallery=window.open(path,"graph",attrs);
gallery.focus();
}

function wavWin(src,title,brandImage,brandImageLink) {
path = "/media/popup_wav.jhtml?src=" + src + "&title=" +title;
attrs = 'toolbar=0,menubar=0,scrollbars=0,scrolling=no,resizable="no",width=310';
brand(427,347,brandImage,brandImageLink);
gallery=window.open(path,"graph",attrs);
gallery.focus();
}

function ipxWin(src,title,brandImage,brandImageLink) {
path = "/media/popup_ipx.jhtml?src=" + src + "&title=" +title;
attrs = 'toolbar=0,menubar=0,scrollbars=0,scrolling=no,resizable="no",width=400';
brand(520,420,brandImage,brandImageLink);
gallery=window.open(path,"graph",attrs);
gallery.focus();
}

function swfWin(src,title,brandImage,brandImageLink) {
path = "/media/popup_swf.jhtml?src=" + src + "&title=" +title;
attrs = 'toolbar=0,menubar=0,scrollbars=0,scrolling=no,resizable="no",width=310';
brand(427,347,brandImage,brandImageLink);
gallery=window.open(path,"graph",attrs);
gallery.focus();
}

function newWindow(url,title) {
  gallery=window.open(url, title, 'scrollbars=no,width=470,height=650,left=0,top=0')
}

function gif_jpg_Win(src,title,brandImage,brandImageLink) {
path = "/media/popup_gif_jpg.jhtml?src=" + src + "&title=" +title;
attrs = 'toolbar=0,menubar=0,scrollbars=0,scrolling=no,resizable="no",width=310';
brand(427,347,brandImage,brandImageLink);
gallery=window.open(path,"graph",attrs);
gallery.focus();
}

function slideshowWin(src,title,brandImage,brandImageLink) {
path = "/media/popup_ss.jhtml?src=" + src + "&title=" +title + "&slidenum=1";
attrs = 'toolbar=0,menubar=0,scrollbars=0,scrolling=no,resizable="no",width=480';
brand(680,600,brandImage,brandImageLink);
gallery=window.open(path,"graph",attrs);
gallery.focus();
}

function brand(bSize,noBSize,brandImage,brandImageLink) {
   if (brandImage != '') {
       path += "&brandImage="+brandImage;
       if (brandImageLink != '') {
	   path += "&brandImageLink="+brandImageLink;
       }
       attrs += ",height="+bSize;
   } else {
       attrs += ",height="+noBSize;
   }
}

// LegacyPopup.js

function basicwrapsmall(slideshow) {
    path = "/wrappers/theater/wrappers/" + slideshow + ".html"; 
    gallery=window.open(path,"graph",'toolbar=0,menubar=0,scrollbars=0,SCROLLING=NO,resizable=no,width=270,height=392')
} 

function basicwraplarge(slideshow) {
    path = "/wrappers/theater/wrappers/" + slideshow + ".html"; 
    gallery=window.open(path,"graph",'toolbar=0,menubar=0,scrollbars=0,SCROLLING=NO,resizable=no,width=330,height=420,left=5,top=30')
} 

function nbatvwrapsmall(slideshow) {
    path = "/wrappers/nbatv/wrappers/" + slideshow + ".html"; 
    gallery=window.open(path,"graph",'toolbar=0,menubar=0,scrollbars=0,SCROLLING=NO,resizable=no,width=215,height=300')
} 

function nbatvwraplarge(slideshow) {
    path = "/wrappers/nbatv/wrappers/" + slideshow + ".html"; 
    gallery=window.open(path,"graph",'toolbar=0,menubar=0,scrollbars=0,SCROLLING=NO,resizable=no,width=310,height=400,left=5,top=30')
}

function allstarwrapsmall(slideshow) {
    path = "/wrappers/allstar2000/theater/wrappers/" + slideshow + ".html"; 
    gallery=window.open(path,"graph",'toolbar=0,menubar=0,scrollbars=0,SCROLLING=NO,resizable=no,width=270,height=370')
} 

function allstarwraplarge(slideshow) {
    path = "/wrappers/allstar2000/theater/wrappers/" + slideshow + ".html"; 
    gallery=window.open(path,"graph",'toolbar=0,menubar=0,scrollbars=0,SCROLLING=NO,resizable=no,width=330,height=420,left=5,top=30')
}

function courtsidewrap(slideshow) {
    path = "/wrappers/theater/courtside/wrappers/" + slideshow + ".html"; 
    gallery=window.open(path,"graph",'toolbar=0,menubar=0,scrollbars=0,SCROLLING=NO,resizable=no,width=270,height=392')
} 

function usabsmall(slideshow) {
    path = "/wrappers/usab/theater/wrappers/" + slideshow + ".html"; 
    gallery=window.open(path,"graph",'toolbar=0,menubar=0,scrollbars=0,SCROLLING=NO,resizable="no",width=270,height=392')
} 

function usablarge(slideshow) {
    path = "/wrappers/usab/theater/wrappers/" + slideshow + ".html"; 
    gallery=window.open(path,"graph",'toolbar=0,menubar=0,scrollbars=0,SCROLLING=NO,resizable="no",width=330,height=420')
}

function open_window(url) {
    var path = url;
    if( url.search(/^http:/) == -1 ) {
        path = "/popups/" + url;
    } else {
        var nbaDomain = new RegExp("/^http:\/\/www.nba.com\/([.*]*)/");
        var result = url.match(nbaDomain);
        if( result != null ) {
            path = "/popups/" + result[1];
        } else {
            path = url;
        }
    }
    mywin=window.open(path,"win",'toolbar=yes,location=yes,directories=0,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=600,height=600');
}

function open_window_ex(url, title, height, width) {
    var path = url;
    if( url.search(/^http:/) == -1 ) {
        path = "/popups/" + url;
    } else {
        var nbaDomain = new RegExp("/^http:\/\/www.nba.com\/([.*]*)/");
        var result = url.match(nbaDomain);
        if( result != null ) {
            path = "/popups/" + result[1];
        } else {
            path = url;
        }
    }
    var opts = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes';
    opts += ',width=' + width;
    opts += ',height=' + height;
    mywin=window.open(path,title,opts);
}


	