//pointer to hand - and back;
function linkhandOn (el) {
	document.getElementById(el).style.cursor = "pointer";
}

function linkhandOff (el) {
	document.getElementById(el).style.cursor = "default";
}

//COLORS -including mousepointer
// red
function redOn (el) {
	document.getElementById(el).style.color = "red";
	linkhandOn (el)
}
//green - for plays
function greencolor(el) {
	document.getElementById(el).style.color="#51C660";
	linkhandOn (el)
}
//yellow for edit and artist links
function yellowcolor(el) {
	document.getElementById(el).style.color="#f9e396";
	linkhandOn (el)	
}
//blue color for mailing;
function bluecolor(el) {
	document.getElementById(el).style.color="#89c9ea";
	linkhandOn (el)	
}
function redcolor(el) {
	document.getElementById(el).style.color="#e77878";
	linkhandOn (el)	
}
//restore to orginal style default;
function restorecolor(el) {
	document.getElementById(el).style.color="";
	linkhandOff (el);
}
//=============================
//functions for activating icons
function saveiconLit(saveicon) {
	var icon = document.getElementById(saveicon);
	icon.src = "images/icons/save.gif";
}
function saveiconOff(saveicon) {
	var icon = document.getElementById(saveicon);
	icon.setAttribute("src", "images/icons/save2.gif");
}
//=============================
//functions for btn images
function rollOn(el,newpath) {
	var btn = document.getElementById(el);
	btn.style.cursor = "pointer";
	btn.setAttribute("src", newpath);
	alert('hello');
}
function rollOff(el,path) {
	var btn = document.getElementById(el);
	btn.setAttribute("src", path);
}

function setLinkColour(el) {
	if (el) {
		var url = "../";
	} else{
		var url = "";
	}
	var top = document.getElementById('mymusictop');
	top.style.backgroundImage = "url('"+url+"images/backgroundbars/content_on_top.gif')";
	var bot = document.getElementById('mymusicbot');
	bot.style.backgroundImage = "url('"+url+"images/backgroundbars/content_on_bottom.gif')";
	var anchors = document.getElementsByTagName("a");
	for (i=5; i<= anchors.length; i++) {
		if (anchors[i].style.color == "rgb(153, 153, 153)") {
			anchors[i].style.color="#cccccc";
		}
	}
}
function restoreLinkColour(el) {
	if (el) {
		var url = "../";
	} else{
		var url = "";
	}
	var top = document.getElementById('mymusictop');
	top.style.backgroundImage = "url('"+url+"images/backgroundbars/content_off_top.gif')";
	var bot = document.getElementById('mymusicbot');
	bot.style.backgroundImage = "url('"+url+"images/backgroundbars/content_off_bottom.gif')";
	var anchors = document.getElementsByTagName("a");
	for (i=5; i<= anchors.length; i++) {
		anchors[i].style.color="";
	}
}

//funct for chganging styling settings on mid div - ny music and new member pages

function setMinHeight(el, onoff) {
	var x = document.getElementById(el);
	if (onoff == "off") {
		x.style.minHeight = "20px";
	} else {
		x.style.minHeight = "";
	}
}


// highlighting nput backgroiunds
function highlightBG(element) {
var fields = document.getElementById(element);
fields.style.backgroundColor= "#a0c5d0"
}
function restoreBG(element) {
var fields = document.getElementById(element);
fields.style.backgroundColor= ""
}
function showeg(element) {
	var x = document.getElementById(element);
	x.style.color = "#e77878";
}

function dimeg(element) {
	var x = document.getElementById(element);
	x.style.color = "#5C5C5C";
}

// upload song form ----------------------------



function clearFileBg () {
	var fileInput = document.getElementById("song");
	var bgFileInput = fileInput.style.backgroundColor;
	fileInput.style.backgroundColor = "";
}

function restoreInput(inputName) {
	var element = document.getElementById(inputName);
	element.style.border = "1px solid #cccccc";
	var infobar = document.getElementById("hint");
	infobar.innerHTML="";

}

function highlightInputBackground (inputName) {
	var element = document.getElementById(inputName);
	element.style.background = "url(images/messagebox_bg.png) repeat";
	if (inputName != "song") {
		clearFileBg ();
	}
}
function restoreInputBackground (inputName) {
	var element = document.getElementById(inputName);
	element.style.background = "";

}
//------ Misc functions
function clearFullDes(tcell) {
document.getElementById('desBox').style.visibility="hidden";
document.getElementById('desBox').style.position="absolute";
document.getElementById(tcell).style.color = "";
document.getElementById(tcell).style.cursor = "";
}
function showFullDes(event, description, tcell)
{
	document.getElementById(tcell).style.color = "#f9e396";
	document.getElementById(tcell).style.cursor = "default";
	document.getElementById('desBox').style.visibility="visible";
	document.getElementById('desBox').style.position="absolute";
	document.getElementById('desBox').style.background="url(images/backgroundbars/desbox.png) repeat";
	if (navigator.appName == "Microsoft Internet Explorer") {
		var p = document.documentElement.scrollTop;
		document.getElementById('desBox').style.left=(event.clientX +20)+"px";
		document.getElementById('desBox').style.top=(event.clientY + p +16 )+"px";
	} else {
		var p = window.pageYOffset;
		document.getElementById('desBox').style.left=(event.clientX + 20)+"px";
		document.getElementById('desBox').style.top=(event.clientY + p + 16 )+"px";
	}
	description = description.replace(/\\/g, '');
	document.getElementById('desBox').innerHTML = description
}

function showFullDesNoYel(event, description, tcell)
{
	document.getElementById('desBox').style.visibility="visible";
	document.getElementById('desBox').style.position="absolute";
	document.getElementById('desBox').style.background="url(images/backgroundbars/desbox.png) repeat";
	if (navigator.appName == "Microsoft Internet Explorer") {
		var p = document.documentElement.scrollTop;
		document.getElementById('desBox').style.left=(event.clientX +20)+"px";
		document.getElementById('desBox').style.top=(event.clientY + p +16 )+"px";
	} else {
		var p = window.pageYOffset;
		document.getElementById('desBox').style.left=(event.clientX + 20)+"px";
		document.getElementById('desBox').style.top=(event.clientY + p + 16 )+"px";
	}
	
	description = description.replace(/\\/g, '');
	document.getElementById('desBox').innerHTML = description;
}

//insert note about back button
function backButtonNote() {
	var x = document.createElement("div");
	x.setAttribute("id", "note");
	var bdy = document.body.appendChild(x);
	var txt = document.createTextNode("Do not use the back button to go to previous pages. Using the back button will return you to the login page. Please use the menus provided to navigate around this site. (");
	var noteBox = document.getElementById("note");
	noteBox.appendChild(txt);
	var sp = document.createElement("span");
	sp.setAttribute("id", "noteCDown");
	noteBox.appendChild(sp);
	spt = document.createTextNode("14");
	var s = document.getElementById("noteCDown");
	s.appendChild(spt);
	endBracket = document.createTextNode(")");
	noteBox.appendChild(endBracket);
	 cd = setInterval("clearNote()", 1000);
	//varclearNote();
}

function clearNote() {
	var txt = document.getElementById("noteCDown").innerHTML;
	txt--;
	document.getElementById("noteCDown").innerHTML = txt;
	if (txt <7) {
		document.getElementById("note").style.color = "#e77878";
	}
	if (txt < 1) {
		var el = document.getElementById("note");
		el.innerHTML = "";
		document.body.removeChild(el);
		clearInterval(cd);
	}
}
	

//functions for populating country options on the Com search page

function fillcountry(el) { 
	var countrylist = Array("Argentina","Armenia","Aruba ","Australia", "Austria","Bahamas","Bahrain","Barbados","Belgium","Brazil","Bulgaria","Canada","Cape Verde","Cayman Islands","Chile","China","Colombia","Costa Rica","Croatia (Hrvatska)","Cuba","Cyprus","Czech Republic","Denmark","Dominican Republic","Ecuador","Egypt","England","Estonia","Fiji","Finland","France","Georgia","Germany","Gibraltar", "Greece","Greenland", "Grenada","Haiti","Hong Kong","Hungary","Iceland","India","Indonesia", "Israel","Italy","Jamaica", "Japan","Korea","Latvia","Lithuania","Luxembourg","Macau","Malta","Mexico","Monaco","Montserrat","Morocco", "Netherlands","New Caledonia","New Zealand","Northern Ireland","Northern Mariana Islands","Norway","Pakistan","Poland","Portugal","Republic of Ireland","Romania","Russian Federation","San Marino","Saudi Arabia","Scotland","Seychelles","Singapore","South Africa","Spain","Sri Lanka","Sweden","Switzerland","Taiwan","Thailand","Turkey","Ukraine","United States","Uruguay","Venezuela", "Wales","Zimbabwe");

	var sel = document.getElementById(el);
	
	
	var n = countrylist.length;
	var countryopt = document.createElement("option");
	//countryopt.setAttribute("value", "none");
	countryopt.setAttribute("id", "countrynull");
	var countryText = document.createTextNode("country");
	sel.appendChild(countryopt)
	var tmp = document.getElementById("countrynull");
	tmp.appendChild(countryText);
	for (i=0; i<n; i++) {
		var opt = document.createElement("option");
		opt.setAttribute("value", countrylist[i]);
		opt.setAttribute("id", countrylist[i]);
		//opt.setAttribute("onclick", "insertRegion(this.value)");
		
		sel.appendChild(opt);
		var optText = document.createTextNode(countrylist[i]);
		var opEl = document.getElementById(countrylist[i]);
		opEl.onclick = function () {insertRegion(this.value)};
		opEl.appendChild(optText);
	}/**/

}

function insertRegion(c) {
	
	var english= Array("Avon","Bedfordshire","Berkshire","Buckinghamshire","Cambridgeshire","Cheshire","Cleveland","Cornwall","Cumbria","Derbyshire","Devon","Dorset","Durham","East Sussex","Essex","Gloucestershire","Hampshire","Herefordshire","Hertfordshire","Humberside","Isle of Wight","Kent","Lancashire","Leicestershire","Lincolnshire","London","Manchester","Merseyside","Norfolk","Northamptonshire","Northumberland","North Yorkshire","Nottinghamshire","Oxfordshire","Rutland","Shropshire","Somerset","South Yorkshire","Staffordshire","Suffolk","Surrey","Tyne and Wear","Warwickshire","West Midlands","West Sussex","West Yorkshire","Wiltshire","Worcestershire");
	
	var welsh = Array("Blaenau Gwent","Bridgend","Caerphilly","Cardiff","Carmarthenshire","Ceredigion","Conwy","Denbighshire","Flintshire","Gwynedd","Isle of Anglesey","Merthyr Tydfil","Monmouthshire","Neath Port Talbot","Newport","Pembrokeshire","Powys","Rhondda Cynon Taff","Swansea","Torfaen","Vale of Glamorgan","Wrexham");
	
	var scottish = Array("Aberdeenshire","Angus","Argyllshire","Ayrshire","Banffshire","Berwickshir","Borders","Bute","Caithness","Central","Clackmannanshire","Dumfries-shire","Dumfries and Galloway","Dunbartonshire","East Lothian","Fife","Grampian","Highland","Inverness-shire","Kincardine","Kinross","Kirkcudbrightshire","Lanarkshire","Lothian","Midlothian","Morayshire","Nairn","Orkney","Peebles-shire","Perth","Renfrewshire","Ross and Cromarty","Roxburghshire","Selkirkshire","Shetland","Strathclyde","Stirlingshire","Sutherland","Tayside","West Lothian","Western Isles","Wigtownshire");
	
	var american = Array("Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","D.C.","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming");

	var region = document.getElementById("region");
	var addcounties = false;
	var counties = new Array();
	
	if (c=="England") {
		var counties = english;
		addcounties = true;
	}
	if (c=="Wales") {
		var counties = welsh;
		addcounties = true;
		
	}
	if (c=="Scotland") {
		var counties = scottish;
		addcounties = true;
	}
	if (c=="United States") {
		var counties = american;
		addcounties = true;
	}
	var count = counties.length;
	if (addcounties == true) {
		region.disabled = false;
		region.innerHTML = "";
		//add a blank option incase want to search by country only without sel region
		var noRegOp = document.createElement("option");
		noRegOp.setAttribute("id", "regionnull");
		region.appendChild(noRegOp);
		var tmp = document.getElementById("regionnull");
		tmp.setAttribute("value", "");
		var nullOptTxt = document.createTextNode("region/state");
		tmp.appendChild(nullOptTxt);
		//now fill rest of region select with values
		for (x=0; x<count; x++) {
			var o = document.createElement("option");
			o.setAttribute("value", counties[x]);
			oTxt = document.createTextNode(counties[x]);
			region.appendChild(o);
			o.appendChild(oTxt);
		}
		
	
	} else {
		region.innerHTML = "";
		var o = document.createElement("option");
		o.setAttribute("id", "regionnull");
		//o.setAttribute("value", "none");
		region.appendChild(o);
		var regnoneText = document.createTextNode("region/state");
		var tmp = document.getElementById("regionnull");
		tmp.appendChild(regnoneText);
		region.disabled = true;
	}/**/
	
		

}


/*
//insert region NOTE copied from profilepage.js
function insertRegionBKUP(c, regsel) { // c stands for country
	//define the arrays
	
	var english= Array("Avon","Bedfordshire","Berkshire","Buckinghamshire","Cambridgeshire","Cheshire","Cleveland","Cornwall","Cumbria","Derbyshire","Devon","Dorset","Durham","East Sussex","Essex","Gloucestershire","Hampshire","Herefordshire","Hertfordshire","Humberside","Isle of Wight","Kent","Lancashire","Leicestershire","Lincolnshire","London","Manchester","Merseyside","Norfolk","Northamptonshire","Northumberland","North Yorkshire","Nottinghamshire","Oxfordshire","Rutland","Shropshire","Somerset","South Yorkshire","Staffordshire","Suffolk","Surrey","Tyne and Wear","Warwickshire","West Midlands","West Sussex","West Yorkshire","Wiltshire","Worcestershire");
	
	var welsh = Array("Blaenau Gwent","Bridgend","Caerphilly","Cardiff","Carmarthenshire","Ceredigion","Conwy","Denbighshire","Flintshire","Gwynedd","Isle of Anglesey","Merthyr Tydfil","Monmouthshire","Neath Port Talbot","Newport","Pembrokeshire","Powys","Rhondda Cynon Taff","Swansea","Torfaen","Vale of Glamorgan","Wrexham");
	
	var scottish = Array("Aberdeenshire","Angus","Argyllshire","Ayrshire","Banffshire","Berwickshir","Borders","Bute","Caithness","Central","Clackmannanshire","Dumfries-shire","Dumfries and Galloway","Dunbartonshire","East Lothian","Fife","Grampian","Highland","Inverness-shire","Kincardine","Kinross","Kirkcudbrightshire","Lanarkshire","Lothian","Midlothian","Morayshire","Nairn","Orkney","Peebles-shire","Perth","Renfrewshire","Ross and Cromarty","Roxburghshire","Selkirkshire","Shetland","Strathclyde","Stirlingshire","Sutherland","Tayside","West Lothian","Western Isles","Wigtownshire");
	
	var american = Array("Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","D.C.","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming");
	
	addcounties = false;
	addSelectInput = false;
	//from the profile page - 
	if (c == "region") {
		var c = document.getElementById("countrylink").innerHTML;
		addSelectInput = true;
		if (c == "none") {
			alert('Please select a country that has regions or states.');
		}
	}
	
	
	if (c=="England") {
		var counties = english;
		addcounties = true;
	}
	if (c=="Wales") {
		var counties = welsh;
		addcounties = true;
	}
	if (c=="Scotland") {
		var counties = scottish;
		addcounties = true;
	}
	if (c=="United States") {
		var counties = american;
		addcounties = true;
	}
	
	
	var region = document.getElementById("region");
	if (c=="country") {
		region.innerHTML = "<option>country</option>";
	}
	
	if (addcounties==true) {
		region.innerHTML = "<option>region/state</option>";
		var count = counties.length;
		
		if (addSelectInput == true) {
			var oldel = document.getElementById("region");
			var newsel = document.createElement("select");
			newsel.setAttribute("id", "region");
			newsel.setAttribute("name", "region");
			var father = oldel.parentNode;
			father.replaceChild(newsel, oldel);
			var region = document.getElementById("region");
			for (x=0; x<count; x++) {
					var o = document.createElement("option");
					o.setAttribute("value", counties[x]);
					if (counties[x] == regsel) {
						o.setAttribute("selected","selected");	
					}
					oTxt = document.createTextNode(counties[x]);
					region.appendChild(o);
					o.appendChild(oTxt);
				}
				region.disabled = false;
		}
		
		if (addSelectInput == false) {
			alert("here");
				for (x=0; x<count; x++) {
					var o = document.createElement("option");
					o.setAttribute("value", counties[x]);
					if (counties[x] == regsel) {
						o.setAttribute("selected","selected");	
					}
					oTxt = document.createTextNode(counties[x]);
					region.appendChild(o);
					o.appendChild(oTxt);
				}
				region.disabled = false;
		
		
		}
		
		
	} else {
		if (addSelectInput == false) {
			region.innerHTML = "<option>region/state</option>";
			region.disabled = true;
		} else {
			var region = document.getElementById("region").innerHTML;
			if (region != "none") {
				return true;
			} else {
				return false;
			}
				
		}
	}
	
}*/