function emailCheck() {
		var str = document.getElementById('Email').value;
		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1){
			document.getElementById('Email').focus();
			document.getElementById('Email').style.background = 'Yellow';
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
			document.getElementById('Email').focus();
			document.getElementById('Email').style.background = 'Yellow';
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		document.getElementById('Email').focus();
			document.getElementById('Email').style.background = 'Yellow';
		   return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		 document.getElementById('Email').focus();
			document.getElementById('Email').style.background = 'Yellow';
		   return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			document.getElementById('Email').focus();
			document.getElementById('Email').style.background = 'Yellow';
		   return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){		 
			document.getElementById('Email').focus();
			document.getElementById('Email').style.background = 'Yellow';
		   return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
			document.getElementById('Email').focus();
			document.getElementById('Email').style.background = 'Yellow';
		   return false;
		 }

		 document.getElementById('Email').style.background = 'white';
 		 return true;					
}


function phoneCheck() {
	var id='Phone';
   var stripped = document.getElementById(id).value.replace(/[\(\)\.\-\ ]/g, '');    
   var error = "";

   if (document.getElementById(id) == "") {
	document.getElementById(id).focus();
        document.getElementById(id).style.background = 'Yellow';
	return false;
    } else if (isNaN(parseInt(stripped))) {
		document.getElementById(id).focus();
        document.getElementById(id).style.background = 'Yellow';
        alert("The phone number contains illegal characters.\n");
	return false;
    } else if ((stripped.length < 6)) {
        alert("The phone number is the wrong length. Make sure you included an area code.\n");
		document.getElementById(id).focus();
        document.getElementById(id).style.background = 'Yellow';
	return false;
    }
	
	document.getElementById(id).style.background = 'white';
    return true;
}

