// PRE-LOAD IMAGES ------------------------------------------------------------
if (document.images) {

  btn = new Array();
  btnOn = new Array();
  
  for(i=0; i<10; i++) {
    
    btn[i] = new Image();
    btn[i].src = "/nav/img/nav"+i+".gif";
    
    btnOn[i] = new Image();
    btnOn[i].src = "/nav/img/nav"+i+"on.gif";
    
  }
}
 
function imgFlip(imageName,imageSrc) {
  if (document.images)
    document.images[imageName].src = eval(imageSrc + ".src");
}

// FORM HANDLER CODE ----------------------------------------------------------
var win = null;

function formHandle(formname, listname) {
  var l = document.forms[formname][listname];
  var i = l.selectedIndex;
  var url = l.options[i].value;
  var firstChar = url.charAt(0);
  var secondChar = url.charAt(1);
  
  var windowprops = new Array;
  windowprops[0] = "width=400,height=300,scrollbars=yes,resizable=yes";
  windowprops[1] = "width=320,height=180,screenX=30,screenY=30";
 // add new window properties here and call them by using '$' followed by the next array number and place in front of url 
 // windowprops[1] = " ";
 // windowprops[2] = " ";
  
  // do nothing if no url is selected
  if (url=='none') l.selectedIndex = 0;
  
  // open the link in a new browser window
  else if (firstChar=='+') open(url.substring(1), '_blank');
  
  // open as popup with attributes defined in the array windowprops[]
  else if (firstChar=='$') window.open(url.substring(2),"MenuPopup",windowprops[secondChar]);
  
  // just go to the URL
  else location.href = url;
}

// REGULAR EXPRESSION STRIPPER ------------------------------------------------
function valueStrip(regSearch,features)
{
	var results =  features.match(regSearch);
	if (results != null) return results[2];
	else return 0;
}

// POSITIONED POP UP WINDOW CODE ----------------------------------------------
function popper(theURL,winName,features) {
	var posWin = null;
	var gotIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;	
	var gotNS = (navigator.appName == 'Netscape') ? true : false;
	var gotNN6 = (gotNS && (parseInt(navigator.appVersion) >= 5)) ? true : false;

// REGULAR EXPRESSIONS TO STRIP OUT THE WIDTH AND HEIGHT VARS -----------------
	var widthMatch = /(width=)(\d+)/i;
	var heightMatch = /(height=)(\d+)/i;
	var scrollMatch = /(scrollbars=)([a-zA-Z0-9])/i;
	var numMatch = /\d+/;
	
	var width = valueStrip(widthMatch,features);
	var height = valueStrip(heightMatch,features);
	var scrollbars = valueStrip(scrollMatch,features);
	
	if (posWin!=null && !posWin.closed) posWin.close();
	
	if (gotIE) {
	var left = (screen.Width/2) - width/2;
	var top = (screen.Height/2) - height/2;
	posWin = window.open(theURL,winName,"scrollbars=0,left="+left+",top="+top+",width="+width+",height="+height+",scrollbars="+scrollbars);
	posWin.focus();
	}
	else if (gotNS && !gotNN6) {
	var left = (screen.availWidth/2) - width/2;
	var top = (screen.availHeight/2) - height/2;
	posWin = window.open(theURL,winName,"screenX="+left+",screenY="+top+",innerWidth="+width+",innerHeight="+height+",scrollbars="+scrollbars);
	posWin.focus();
	}
	else if (gotNN6) {
	var left = (screen.availWidth/2) - width/2;
	var top = (screen.availHeight/2) - height/2;
	posWin = window.open(theURL,winName,"screenX="+left+",screenY="+top+",width="+width+"px,height="+height+"px,scrollbars="+scrollbars);
	posWin.focus();
	}
	else {
	posWin = window.open(theURL,winName,"scrollbars=0,width="+width+",height="+height+",scrollbars="+scrollbars);
	posWin.focus();
	}
}

// RELOADER CODE --------------------------------------------------------------
function load(){
  if (parseFloat(navigator.appVersion) == 4.08) return;
  location.reload();
}

// OPEN UP PREFERENCES WINDOW -------------------------------------------------
function prefs(arg) {
  var url;

  if (!arg) url = "/reg/util/direct.jhtml?dir=popup&linkTextID=toPrefs&messageID=loginRequired&welcome=false&postLoginURL=/reg/prefs/framey.jhtml";
  else if (arg=="newsletters") url = "/reg/util/direct.jhtml?dir=popup&linkTextID=toNewsletters&messageID=loginRequired&welcome=false&postLoginURL=/reg/prefs/framey.jhtml%3Fsrc%3Dnewsletters";
  else if (arg=="fanclubs") url = "/reg/util/direct.jhtml?dir=popup&linkTextID=toFanClubs&messageID=loginRequired&welcome=false&postLoginURL=/reg/prefs/framey.jhtml%3Fsrc%3Dfanclubs";
  else url = arg;

  popper(url, "prefs", "width=640,height=500,scrollbars");
}

// VARIABLE FOR THE MY MUSIC RANDOM PICTURE -----------------------------------
RandNum = null;

// CATCHER'S MITT POP-UP CODE ----------------------------------------------
/* Var for cathcer's mitt */  RBIs = true;
// set RBIs = false; below BODY tag to disable catcher's mitt
function mittPop() {
	if (RBIs)
		popper('/onair/index.big.jhtml','catcher','width=381,height=318,scrollbars=0');
}

