// BROWSER COMPATIBILITY GLOBALS
var ns4 = false;
var ie4 = false;
var ns5 = false;

if (navigator.appName == "Netscape") {
	ns4 = true;
	if (navigator.appVersion.substring(0,3) == "5.0")
		ns5 = true;
} else {
	ie4 = true;
}
//alert("ns4: " + ns4 + "\nns5: " + ns5);
// END GLOBALS

var weekdays = new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

function createStateList(selectedState) {

	var selected = "";
	var states = new Array ("", "AL", "AR", "AZ", "CA", "CO", "CT",
							"DC", "DE", "FL", "GA", "IA", "ID", "IL", "IN", "KS",
							"KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO", "MS",
							"MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY",
							"OH", "OK", "OR", "PA", "RI", "SC", "SD",
							"TN", "TX", "UT", "VA", "VT", "WA", "WI", "WV", "WY"
							);
							
	for (var i = 0; i < states.length; i++ ) {
	
		if (selectedState == states[i])  selected = "selected";
		else selected = "";
		
		document.write('<OPTION CLASS=allinputs value="' + states[i] + '" ' + selected + '>' + states[i] + '\n');
	}
	
	return;


}


function displayDollars (number) {

	document.write(getDollars(number));
	
}


function getDollars (number) {

	// sloppy to have these two I know, but no time now to fix
	// first round the values past 2 decimals
	var roundedNum = Math.round(number*Math.pow(10,2))/Math.pow(10,2);
	var textNum = new String(roundedNum);
	
	// then pad if necessary
	var decimalPlace = textNum.lastIndexOf('.');
	
	
	if (decimalPlace == -1) { 							// no decimals, pad
		//alert ("adding .00");
		return (textNum + ".00");
	} else if (textNum.length - decimalPlace == 2) {	// one decimal...pad
		//alert ("adding 0");
		return (textNum + "0");
	} else if (textNum.length - decimalPlace == 3) {	// two decimals...return
		//alert ("number okay");
		return (textNum);
	} else {											// error: return
		//alert ("something's wrong");
		return (textNum);
	}
	
}

// LAYER UTILITIES

function hide (name) {

    hideLayerName = name

    if (ns4) {
			document.layers[hideLayerName].visibility = "hidden";
		}
    else if (ie4) {
			document.all[hideLayerName].style.visibility = "hidden";
		}
}
 
function show (name)  {

    showLayerName = name;

		if (ns4) {
			document.layers[showLayerName].visibility = "visible";
		}
    else if (ie4) {
			document.all[showLayerName].style.visibility = "visible";
		}
}

function getClubInfo(Vid) {
	var windowProps = "directories=no,height=220,width=380,left=50,top=50," +
						"screenX=50,screenY=50,toolbar=no,scrollable=auto";
	//clubWindow =  window.open("/shows/" + file, "ClubInfo", windowProps);
	if (Vid == "") {
		return
	} else {
		var windowTarget = "/shows/clubDetails.asp?id=" + Vid;
		clubWindow =  window.open(windowTarget, "ClubInfo", windowProps);
		clubWindow.focus();
	}
}

// These are from Netscape's Client-Side JavaScript Guide.
// setCookie() is altered to make it easier to set expiry.


function getCookie(Name) {
	var search = Name + "="
	if (document.cookie.length > 0) { // if there are any cookies
		offset = document.cookie.indexOf(search)
		if (offset != -1) { // if cookie exists
			offset += search.length
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset)
			// set index of end of cookie value
			if (end == -1)
				end = document.cookie.length
			return unescape(document.cookie.substring(offset, end))
		}
	}
}

function setCookie(name, value, daysExpire) {
	if(daysExpire) {
		var expires = new Date();
		expires.setTime(expires.getTime() + 1000*60*60*24*daysExpire);
	}
	document.cookie = name + "=" + escape(value) + (daysExpire == null ? "" : (";expires=" + expires.toGMTString())) + ";path=/";
}

function legalDisclaimerLink (linkTarget) {

	if (confirm('MUST BE 18 YEARS OF AGE TO VIEW THIS CONTENT. CLICK OK TO CONFIRM LEGAL AGE.')) {
	
		location.href=linkTarget
		
	}

}

function loadsong (title) {
	document.writeln('<object width="200" height="30" bgcolor="black">');
	document.writeln('<embed src="/listen/' + title + '" wmode="transparent" loop="false" autostart="true" controller="true" width="200" height="30"></embed>');
	document.writeln('</object>');
}
