// JavaScript Document

 	
	function MM_goToURL() { //v3.0
	  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	}	
	
	
	function showElement(elem)
	{
		document.getElementById(elem).style.display="block";
	}
	function hideElement(elem)
	{
		document.getElementById(elem).style.display="none";
	}
	function changeBackground(elem, background)
	{
		document.getElementById(elem).style.backgroundImage="url("+background+")";
	}

	function openWin(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}
	function MM_goToURL() { //v3.0
	  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	}



	function popup(mylink, windowname, features)
	{
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	   href=mylink;
	else
	   href=mylink.href;
	window.open(href, windowname, features);
	return false;
	}


    function checkMe()
    {
    if(document.form1.clientName.value == '')
        {
        alert('Please fill in your name');
        document.form1.clientName.focus();
        }
    else if(document.form1.clientPhone.value == '')
        {
        alert('Please supply a contact phone number');
        document.form1.clientPhone.focus();
        }
    else
        {
        document.form1.submit();
        }
    }
	
	function closepopup()
	{
		if(false == my_window.closed)
	 	{
			my_window.close ();
	 	}
	 	else
	 	{
			alert('Window already closed!');
	 	}
	}
	
	
	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 Email Address")
			   return false
			}
	
			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
			   alert("Invalid Email Address")
			   return false
			}
	
			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
				alert("Invalid Email Address")
				return false
			}
	
			 if (str.indexOf(at,(lat+1))!=-1){
				alert("Invalid Email Address")
				return false
			 }
	
			 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
				alert("Invalid Email Address")
				return false
			 }
	
			 if (str.indexOf(dot,(lat+2))==-1){
				alert("Invalid Email Address")
				return false
			 }
			
			 if (str.indexOf(" ")!=-1){
				alert("Invalid Email Address")
				return false
			 }
	
			 return true					
		}
	
	function ValidateForm(){
		var emailTo = document.form1.emailTo
		
		if ((emailTo.value==null)||(emailTo.value=="")){
			alert("Please Enter An Email Address")
			emailTo.focus()
			return false
		}
		if (echeck(emailTo.value)==false){
			emailTo.value=""
			emailTo.focus()
			return false
		}
		
		
		var fromName = document.form1.fromName
		
		if ((fromName.value==null)||(fromName.value=="")){
			alert("Please Enter Your Name")
			fromName.focus()
			return false
		}		
		
		
		var emailFrom = document.form1.emailFrom
		
		if ((emailFrom.value==null)||(emailFrom.value=="")){
			alert("Please Enter Your Email Address")
			emailFrom.focus()
			return false
		}
		if (echeck(emailFrom.value)==false){
			emailFrom.value=""
			emailFrom.focus()
			return false
		}		

		document.form1.submit();
	 }	
	
	
	
