$(document).ready( function()
{	
	// toggles the slickbox on clicking the noted link
	$('a#login-toggle').click(function() {
		$('#login').toggle(50);
		return false; });
});

function validateEmail(emField)
{
	var fieldValue = emField;
	
		if(fieldValue != "")
		{
			var atSymbol = 0;
		
			for(var a = 0; a < fieldValue.length; a++)
			{
				if(fieldValue.charAt(a) == "@")
				{
					atSymbol++
				}
			}
			
			if(atSymbol > 1)
			{ // if more than 1 @ symbol exists
				//alert("Please Enter A Valid Email Address") // then cancel
				return false
			}
			
			if(atSymbol == 1 && fieldValue.charAt(0) != "@")
			{  // if @ symbol was found, and it is not the 1st character in string
				var period = fieldValue.indexOf(".",fieldValue.indexOf("@")+2) //look for period at 2nd character after @ symbol
				var twoPeriods = (fieldValue.charAt((period+1)) == ".") ? true : false // "."  immediately following 1st "." ?
			
				//if period was not found OR 2 periods together OR field contains less than 5 characters OR period is in last position
				if(period == -1 || twoPeriods || fieldValue.length < period + 2 || fieldValue.charAt(fieldValue.length-1)==".")
				{
					//alert("Please Enter A Valid Email Address") // then cancel
					return false
				}
			}
			else
			{  // no @ symbol exists or it is in position 0 (the first character of the field)
				//alert("Please Enter A Valid Email Address")
				return false
			}
		}
		else
		{
			//alert("Please Enter A Valid Email Address")
			return false
		}
	//alert("VALID EMAIL ADDRESS!")
	return true
}

