// JavaScript Document
function addTIYL()
{
		if (document.getElementById('myTIYLDiv')) {
			var ni = document.getElementById('myTIYLDiv');
			var numi = document.getElementById('theTIYLValue');
			var num = (document.getElementById("theTIYLValue").value -1)+ 2;
			numi.value = num;
			if (num>5) {
				alert ("There is a maximum of 5 TIYLs");
				return;
			}
			var divIdName = "my"+num+"TIYLDiv";
			var newdiv = document.createElement('div');
			newdiv.setAttribute("id",divIdName);
			newdiv.innerHTML = "<input id=\"tiyl"+num+"\" type=\"text\" name=\"tiyl["+num+"]\" size=\"24\" maxlength=\"55\" />";
			ni.appendChild(newdiv);
		}
		else 
			return;
}

function removeEvent(divNum)
{
	var d = document.getElementById('myDiv');
	var olddiv = document.getElementById(divNum);
	d.removeChild(olddiv);
}

function addCategory()
{
	if (document.getElementById('myCatDiv')) {
		var ni = document.getElementById('myCatDiv');
		var numi = document.getElementById("theCat");	
		var num = (document.getElementById("theCat").value -1)+2;
		if (numi.value>3) {
			alert ("There is a maximum of 3 Categories.");
			return;
		}
		numi.value = num;
		var divIdName = "my"+num+"CatDiv";
		var newdiv = document.createElement('div');
		newdiv.setAttribute("id",divIdName);
		newdiv.innerHTML = "<select name=\"category["+num+"]\" id=\"category"+num+"\"><option value=\"-\">Choose One...</option><option value='1'>Rock</option><option value='2'>Roots</option><option value='3'>Electronic</option><option value='4'>Punk</option><option value='5'>World</option><option value='6'>Jazz</option><option value='7'>Metal</option><option value='8'>Folk</option><option value='9'>Blues</option><option value='10'>Hip-Hop</option><option value='11'>Pop</option><option value='12'>Emo</option><option value='13'>Singer/Songwriter</option></select>";
		ni.appendChild(newdiv);
	}
	else
		return;
}

function addMyMedia()
{
	var ni = document.getElementById('myMediaDiv');
	var numi = document.getElementById('theMediaValue');
	var num = (document.getElementById("theMediaValue").value -1)+ 2;
	numi.value = num;
	var divIdName = "my"+num+"MediaDiv";
	var newdiv = document.createElement('fieldset');
	newdiv.setAttribute("id",divIdName);
	newdiv.innerHTML = "<legend>Link "+num+":</legend><ol><li><label for=\"bandwidth\">Bandwidth:</label><select name=\"media["+num+"][bandwidth]\" size=\"1\"><option value=\"\">Choose...</option><option value=\"high\">High</option><option value=\"med\">Medium</option><option value=\"low\">Low</option><option>Not Applicable</option></select></li><li><label for=\"link\">Link:</label><input type=\"text\" name=\"media["+num+"][link]\" size=\"30\" maxlength=\"250\" value=\"http://\" /></li></ol>";
	ni.appendChild(newdiv);
}

/* Toggle visibility function */
function t(i) {
			var e = document.getElementById(i);
			var t = e.className;
			if (t.match('invisible')) { t = t.replace(/invisible/gi, 'visible'); }
			else { t = t.replace(/visible/gi, 'invisible'); }
			e.className = t;
		}
		
/* var ids=new Array('review','audio','video'); */
var ids=new Array('biography','interview');
function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}
		
// Clear default text from a text box.
function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
	thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
	thisfield.value = defaulttext;
	}
}

function toggle_visibility(elName) {
	var el = document.getElementById (elName);
	var isVisible = (el.style.visibility == "hidden") ? true : false;
	el.style.visibility = isVisible ? "visible" : "hidden";
	el.style.display = isVisible ? "inline" : "none";
	elIMG = elName + "IMG";
	if (isVisible == true) 
		document.images[elIMG].src = "/images/misc/open.png";
	else if (isVisible == false)
		document.images[elIMG].src = "/images/misc/closed.png";
}

