
function verify(form) {
	
	var themessage = "You are required to complete the following fields: ";
	
	if (document.form.name.value=="") {
		themessage = themessage + "\n - Name";
	}

	if (document.form.email.value=="") {
		themessage = themessage + "\n - E-mail";
	}
	
	if (document.form.comments.value=="") {
		themessage = themessage + "\n - Comments";
	}

	//alert if fields are empty and cancel form submit
	if (themessage == "You are required to complete the following fields: ") {
		alert("Your message has been sent successfully");
		document.form.submit();
	}

	else {
		alert(themessage);
		form.name.focus(); 
		return false;
   }
}


function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }
		 
		 alert("Your email address has been sent successfully");
 		 return true					
	}

function ValidateForm(){
	var emailID=document.formEmail.email
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email Address")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
 
 
 function applySelectedTo(link) {
	
	var allDivs = document.getElementById('main_center').getElementsByTagName("div");
	for (var k=0; k<allDivs.length; k++) {
		allDivs[k].className = "";	
	}
	
	var allDivs2 = document.getElementById('menu_frame').getElementsByTagName("div");
	for (var h=0; h<allDivs2.length; h++) {
		allDivs2[h].className = "";	
	}
	
	var lyricId = link.getAttribute("href").split("#")[1];
	
	if (lyricId == "people" || lyricId == "people_jenny" || lyricId == "people_brett") {
		document.getElementById('menu_2').className = "on";
	}

	lyricId2 = document.getElementById(lyricId);
	lyricId2.className = "on";
		

	var div = document.getElementsByTagName("div")[5]; // get the five div tag on the page
	var allLinks = div.getElementsByTagName("a"); // get all the links within that a
	for (var i=0; i<allLinks.length; i++) { // iterate through all those links
		allLinks[i].className = ""; // and assign their class names to nothing
	}

	if (lyricId == "people" || lyricId == "people_jenny" || lyricId == "people_brett") {
		
		allLinks[2].className = "selected";

		if (lyricId == "people") {
			allLinks[4].className = "selected";
		}
	}
	link.className = "selected";  // finally, assign class="selected" to our chosen link

}

