    function ClearBrowseForm(){
     document.BrowseForm.noofmuso.value="";
     document.BrowseForm.resperpage.value="10";
     document.BrowseForm.geoarea.value="";
     document.BrowseForm.category.value="";
     document.BrowseForm.genre.value="";
     document.BrowseForm.capacity.value="";
    }

   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("Please enter a valid email address");
      return(false);
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Please enter a valid email address");
      return(false);
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    alert("Please enter a valid email address");
	    return(false);
	}
	 if (str.indexOf(at,(lat+1))!=-1){
	    alert("Please enter a valid email address");
	    return(false);
	 }
	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    alert("Please enter a valid email address");
	    return(false);
	 }
	 if (str.indexOf(dot,(lat+2))==-1){
	    alert("Please enter a valid email address");
	    return(false);
	 }		
	 if (str.indexOf(" ")!=-1){
	    alert("Please enter a valid email address");
	    return(false);
	 }
      return(true);
    }

	function navhover(onoff,obj,sp1,sp2) {
		
		if(onoff=='on'){
			 var dom = document.getElementById(obj).style;
			 dom ['color'] = '#FFFFBE';
			 var dom = document.getElementById(obj).style;
			 dom ['background'] = '#0F1129';
			 var dom = document.getElementById(sp1).style;
			 dom ['display'] = 'none';
			 var dom = document.getElementById(sp2).style;
			 dom ['display'] = 'none';
		}
		if(onoff=='off'){
			 var dom = document.getElementById(obj).style;
			 dom ['color'] = 'black';
			 var dom = document.getElementById(obj).style;
			 dom ['background'] = '#DEDDDF';
			 var dom = document.getElementById(sp1).style;
			 dom ['display'] = 'block';
			 var dom = document.getElementById(sp2).style;
			 dom ['display'] = 'block';
		}
    }
	
    function lbhover(onoff,obj) {
		
		if(onoff=='on'){
			 var dom = document.getElementById(obj).style;
			 dom ['color'] = '#FFFFBE';
			 var dom = document.getElementById(obj).style;
			 dom ['background'] = 'url(http://www.mstring.co.za/images/leftbar11.jpg)';
		}
		if(onoff=='off'){
			 var dom = document.getElementById(obj).style;
			 dom ['color'] = '#EAEAE9';
			 var dom = document.getElementById(obj).style;
			 dom ['background'] = 'url(http://www.mstring.co.za/images/leftbar1.jpg)';
		}
    }
	
    function changestyle(obj,sname,ch) {
     var dom = document.getElementById(obj).style;
     dom [sname] = ch;
    }

//login.php

    function ValidateLoginForm(LoginForm){
     var emailID = LoginForm.username;
     if ((emailID.value==null)||(emailID.value=="")){
      alert("Please enter your username, this should be the same as your email address.")
      emailID.focus()
      return(false);
     }
     if (echeck(emailID.value)==false){
      emailID.value=""
      emailID.focus()
      return(false);
     }
     if (LoginForm.password.value == ""){
      alert("Please enter your password.");
      LoginForm.password.focus();
      return(false);
     }
      document.LoginForm.submit();
    }
	
	function submitenter(myfield,e)
	{
		var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
		else return true;
		
		if (keycode == 13)
	   {
			ValidateLoginForm(myfield.form);
		   return false;
	   }
		else
		   return true;
	}
	

//join mailinglist.php

    function ValidateMailinglistForm(MailinglistForm){
     if (MailinglistForm.custname.value == ""){
      alert("Please enter your name.");
      MailinglistForm.custname.focus();
      return(false);
     }
     var emailID = MailinglistForm.custemail;
     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);
     }
     if (MailinglistForm.geoarea.selectedIndex < 1){
      alert("Please select your geographical area.");
      MailinglistForm.geoarea.focus();
      return(false);
     }
	 document.MailinglistForm.submit();
    }
	

//invitefriends.php

    function ValidateInviteForm(InviteForm){
     if (InviteForm.friendname.value == ""){
      alert("Please enter your name.");
      InviteForm.friendname.focus();
      return(false);
     }
	 var emailID = InviteForm.emailaddr;
     if ((emailID.value==null)||(emailID.value=="")){
      alert("Please enter your friend's email address.")
      emailID.focus()
      return(false);
     }
     if (echeck(emailID.value)==false){
      emailID.value=""
      emailID.focus()
      return(false);
     }
     document.InviteForm.submit();
    }
