
url_cat = "../musiccatalog";
url_search = "../search";
url_about = "../about";
url_license = "../license";
url_reg = "../register/";
url_contact = "../contact";
url_logout = "../goodbye";
url_projects = "../myprojects";
url_download = "../mydownloadcenter";
url_info = "../register/default.asp?phase=2";//"../myinformation";
url_history = "../myhistory";

function menuItem(theLink,displayText){
	this.theLink = theLink;
	this.displayText = displayText;
}

mapMainNav = new Array()
	mapMainNav[0] = "mainNav"
	mapMainNav[1] = "mainNavLoggedIn"

mainNav = new Array()
	mainNav[0] = new menuItem(url_cat,"Music Catalog"); //Music Catalog
	mainNav[1] = new menuItem(url_search,"Music Search"); //Music Search
	mainNav[2] = new menuItem(url_about,"About Us"); //About Us
	mainNav[3] = new menuItem(url_license,"Licensing Info"); //Licensing Info
	//mainNav[4] = new menuItem(url_reg,"Register"); //Register
	mainNav[4] = new menuItem(url_contact,"Contact Us"); //Contact Us

mainNavLoggedIn = new Array();
	mainNavLoggedIn[0] = new menuItem(url_cat,"Music Catalog"); //Music Catalog
	mainNavLoggedIn[1] = new menuItem(url_search,"Music Search"); //Music Search
	mainNavLoggedIn[2] = new menuItem(url_about,"About Us"); //About Us
	mainNavLoggedIn[3] = new menuItem(url_license,"Licensing Info"); //Licensing Info
	mainNavLoggedIn[4] = new menuItem(url_contact,"Contact Us"); //Contact Us
	mainNavLoggedIn[5] = new menuItem(url_logout,"Logout"); //Logout

loggedNav = new Array()
	loggedNav[0] = new menuItem(url_projects,"My Projects"); //My Projects
	//loggedNav[1] = new menuItem(url_download,"My Download Center"); //My Download Center
	loggedNav[1] = new menuItem(url_info,"My Information"); //My Information
	loggedNav[2] = new menuItem(url_history,"My History"); //My History

function doNav(ele,state){
	if(state > 0){
		ele.style.backgroundColor = "#CCDDF1";
	}else{
		ele.style.backgroundColor = "#ffffff";
	}
}
function doNavLogged(ele,state){
	if(state > 0){
		ele.style.backgroundColor = "#CCDDF1";
	}else{
		ele.style.backgroundColor = "#FEFCF7";
	}
}

function writeMainNav(highLight, whichNav){
	outMainNav = "";
	outMainNav += "<a href=\"../home\"><img src=\"../images/logo.gif\" width=\"189\" height=\"76\" border=\"0\" alt=\"American Music Company - Music that skips a beat!\"></a><br>";
	outMainNav += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"189\" background=\"../images/spacer.gif\">";
	theMainNav = eval(mapMainNav[whichNav]);
	for(i = 0; i < theMainNav.length; i ++){
		trOnClick = "onClick=\"location='" + theMainNav[i].theLink + "';\"";
		if(i == highLight){
			outMainNav += "<tr " + trOnClick + ">";
			background = " background=\"../images/nav/flag.jpg\"";
			lastRow = "";
		}else{
			outMainNav += "<tr onMouseOver=\"doNav(this,1);\" onMouseOut=\"doNav(this,0);\" " + trOnClick + ">";
			background = "";
			lastRow = "<tr><td width=\"189\" bgcolor=\"#C0C0C0\"><img src=\"../images/spacer.gif\" width=\"1\" height=\"1\"></td></tr>";
		}
		outMainNav += "<td width=\"189\"" + background + " class=\"nav\"><a href=\"" + theMainNav[i].theLink + "\"><img src=\"../images/spacer.gif\" width=\"23\" height=\"28\" border=\"0\" align=\"absmiddle\">" + theMainNav[i].displayText + "</a></td></tr>";
		outMainNav += lastRow;
	}
	outMainNav += "</table>";
	//outMainNav += "<img src=\"../images/spacer.gif\" width=\"190\" width=\"190\" height=\"1\" border=\"0\">";
	//alert(outMainNav);
	document.write(outMainNav);
}
function writeLoggedNav(highLight,needLine){
	highLight += 10;
	outLoggedNav = "";
	outLoggedNav += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"189\" bgcolor=\"#FEFCF7\" background=\"../images/spacer.gif\">";
	if(needLine > 0){
		outLoggedNav += "<tr><td width=\"189\" bgcolor=\"#C0C0C0\"><img src=\"../images/spacer.gif\" width=\"1\" height=\"1\"></td></tr>";
	}
	theMainNav = loggedNav;
	for(i = 0; i < theMainNav.length; i ++){
		checkHighLight = i + 10;
		trOnClick = "onClick=\"location='" + theMainNav[i].theLink + "';\"";
		if(checkHighLight == highLight){
			outLoggedNav += "<tr " + trOnClick + ">";
			background = " background=\"../images/nav/flag.jpg\"";
			lastRow = "";
		}else{
			outLoggedNav += "<tr onMouseOver=\"doNavLogged(this,1);\" onMouseOut=\"doNavLogged(this,0);\" " + trOnClick + ">";
			background = ""; //"bgcolor='#FEFCF7'";
			lastRow = "<tr><td width=\"189\" bgcolor=\"#C0C0C0\"><img src=\"../images/spacer.gif\" width=\"1\" height=\"1\"></td></tr>";
		}
		outLoggedNav += "<td width=\"189\"" + background + " class=\"nav\"><a href=\"" + theMainNav[i].theLink + "\"><img src=\"../images/spacer.gif\" width=\"23\" height=\"28\" border=\"0\" align=\"absmiddle\">" + theMainNav[i].displayText + "</a></td></tr>";
		outLoggedNav += lastRow;
	}
	outLoggedNav += "</table>";
	outLoggedNav += "<img src=\"../images/spacer.gif\" width=\"190\" width=\"190\" height=\"1\" border=\"0\">";
	document.write(outLoggedNav);
}

function checkLogin(f){
formName = f.name;
cool = true;
fields = "";
i = 0;
focusField = "";
	if(isStringWhitespace(f.username.value)){
		setAlert("username","Username",formName);
	}
	if(isStringWhitespace(f.password.value)){
		setAlert("password","Password",formName);
	}
	if(cool){
		//alert("submit form");
		return true;
	}else{
		s = "";
		if(i > 1){
			s = "s";
		}
		alert("Please enter the following field" + s + ":\n" + fields);
		focusField.focus();
		return false;
	}
}

function checkGenreMood(f){
	
	
	if(f.genre.selectedIndex == 0 && isStringWhitespace(f.mood.value) && (f.myTempo.selectedIndex == 0) ){
		alert("Please select a Genre, Keyword or Tempo");
		f.genre.focus();
		return false;
	}

return true;
}

function checkDownload(f){
	if(f.theClip.selectedIndex == 0){
		alert("Please select a Clip to Download");
		f.theClip.focus();
		return false;
	}
	if(f.theClip.value == "nogo"){
		alert("Sorry, there are currently no Clips of this Track available for Download");
		f.theClip.focus();
		return false;
	}
	//location = f.theClip.value;
	window.open(f.theClip.value)
	return false;
	/*if(f.clip_length.selectedIndex == 0){
		alert("Please select a Clip Length");
		f.clip_length.focus();
		return false;
	}
	if(f.digital_format.selectedIndex == 0){
		alert("Please select a Digital Format");
		f.digital_format.focus();
		return false;
	}*/
	//alert("You can now download the file.\nUnder Construction");
	//return false;
}

function makePhone(formFieldName,digits){
	this.formFieldName = formFieldName;
	this.digits = digits;
}

function openWin(page,name,width,height,scroll,resize){
window.open(page,name,"toolbar=0,location=0,status=0,menubar=0,scrollbars=" + scroll + ",resizable=" + resize + ",top=0,left=0,width=" + width + ",height=" + height)
}
