// Function to validate sign up form.(Developer)
function fnValidateSignUp()
{
	
	var fcheck = document.frmSignUp.filLogo.value;
	
	document.frmSignUp.txtFirstName.value = trimStr(document.frmSignUp.txtFirstName.value);
	document.frmSignUp.txtLastName.value = trimStr(document.frmSignUp.txtLastName.value);
	document.frmSignUp.txtContactName.value = trimStr(document.frmSignUp.txtContactName.value);
	document.frmSignUp.txtTitle.value = trimStr(document.frmSignUp.txtTitle.value);
	document.frmSignUp.txtUserName.value = trimStr(document.frmSignUp.txtUserName.value);
	document.frmSignUp.pwdFirst.value = trimStr(document.frmSignUp.pwdFirst.value);
	document.frmSignUp.pwdConfrm.value = trimStr(document.frmSignUp.pwdConfrm.value);
	document.frmSignUp.txtEmail.value = trimStr(document.frmSignUp.txtEmail.value);
	document.frmSignUp.txtUrl.value = trimStr(document.frmSignUp.txtUrl.value);
	document.frmSignUp.txtPhone.value = trimStr(document.frmSignUp.txtPhone.value);
	document.frmSignUp.txtStreet.value = trimStr(document.frmSignUp.txtStreet.value);
	document.frmSignUp.txtSuburb.value = trimStr(document.frmSignUp.txtSuburb.value);
	document.frmSignUp.txtCity.value = trimStr(document.frmSignUp.txtCity.value);
	document.frmSignUp.txtState.value = trimStr(document.frmSignUp.txtState.value);
	document.frmSignUp.txtZip.value = trimStr(document.frmSignUp.txtZip.value);
	
	document.frmSignUp.descDeveloper.value = trimStr(document.frmSignUp.descDeveloper.value);
	document.frmSignUp.image_vcode.value = trimStr(document.frmSignUp.image_vcode.value);
	
	var validateUrl = new RegExp();
   	validateUrl.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
	numericRegExp = /^([0-9]+)((.[0-9]+)?)$/;
	phoneRegExp = /^([0-9]+)((-[0-9]+)?)((-[0-9]+)?)$/;
	var validateUrlSecond = new RegExp();
	validateUrlSecond.compile("^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
	
	if (document.frmSignUp.txtFirstName.value == "")	
	{
		alert('Please enter Your First Name.');
		document.frmSignUp.txtFirstName.focus();
		return false;
	}
	if (document.frmSignUp.txtLastName.value == "")	
	{
		alert('Please enter Your Last Name.');
		document.frmSignUp.txtLastName.focus();
		return false;
	}
	if (document.frmSignUp.txtContactName.value == "")	
	{
		alert('Please enter Developer Contact Name.');
		document.frmSignUp.txtContactName.focus();
		return false;
	}
	if (document.frmSignUp.txtTitle.value == "")	
	{
		alert('Please enter Developer Title.');
		document.frmSignUp.txtTitle.focus();
		return false;
	}
	if (document.frmSignUp.txtUserName.value == "")	
	{
		alert('Please enter Developer User Name.');
		document.frmSignUp.txtUserName.focus();
		return false;
	}
	if (document.frmSignUp.pwdFirst.value == "")	
	{
		alert('Please enter password.');
		document.frmSignUp.pwdFirst.focus();
		return false;
	}
	if (document.frmSignUp.pwdConfrm.value == "")	
	{
		alert('Please enter Confirm Password.');
		document.frmSignUp.pwdConfrm.focus();
		return false;
	}
	if (document.frmSignUp.pwdFirst.value != document.frmSignUp.pwdConfrm.value)
	{
		alert('Password mis-match, Please Enter again.');
		document.frmSignUp.pwdConfrm.value = '';
		document.frmSignUp.pwdConfrm.focus();
		return false;
	}
	if (document.frmSignUp.txtEmail.value == "")	
	{
		alert('Please enter Developer E-mail.');
		document.frmSignUp.txtEmail.focus();
		return false;
	}
	if (!validateEmail(document.frmSignUp.txtEmail.value))
	{
		alert('Please enter Valid E-mail.');
		document.frmSignUp.txtEmail.focus();
		return false;
	}
	if (document.frmSignUp.txtUrl.value == "")	
	{
		alert('Please enter Web-site URL.');
		document.frmSignUp.txtUrl.focus();
		return false;
	}
	/*if (!validateUrl.test(document.frmSignUp.txtUrl.value))
	{
		alert('Please enter valid URL.');
		document.frmSignUp.txtUrl.focus();
		return false;
	}*/
	if (!validateUrl.test(document.frmSignUp.txtUrl.value) && !validateUrlSecond.test(document.frmSignUp.txtUrl.value))
	{
		alert('Please Enter valid URL.');
		document.frmSignUp.txtUrl.focus();
		return false;
	}
	if (document.frmSignUp.txtPhone.value == "")	
	{
		alert('Please enter phone no.');
		document.frmSignUp.txtPhone.focus();
		return false;
	}
	if (document.frmSignUp.txtStreet.value == "")	
	{
		alert('Please enter Developer Street Address.');
		document.frmSignUp.txtStreet.focus();
		return false;
	}
	if (document.frmSignUp.txtSuburb.value == "")	
	{
		alert('Please enter Developer Subrub.');
		document.frmSignUp.txtSuburb.focus();
		return false;
	}
	if (document.frmSignUp.txtCity.value == "")	
	{
		alert('Please enter Developer City.');
		document.frmSignUp.txtCity.focus();
		return false;
	}
	if (document.frmSignUp.txtState.value == "")	
	{
		alert('Please enter Developer State.');
		document.frmSignUp.txtState.focus();
		return false;
	}
	if (document.frmSignUp.txtZip.value == "")	
	{
		alert('Please enter Developer Postal Code.');
		document.frmSignUp.txtZip.focus();
		return false;
	}
	if(document.getElementById('lstCountry').selectedIndex <= 0)
	{
		alert('Please select the country.');
		document.getElementById('lstCountry').focus();
		return false;
	}
	
	if	(fcheck!='')
	{
		if(fcheck.indexOf(".jpg")==-1 && fcheck.indexOf(".jpeg")==-1 && fcheck.indexOf(".JPG")==-1 && fcheck.indexOf(".JPEG")==-1 &&fcheck.indexOf(".png")==-1 && fcheck.indexOf(".PNG")==-1  && fcheck.indexOf(".gif")==-1 && fcheck.indexOf(".GIF")==-1)
		{
			alert("Please upload only jpg,gif,png format Image");
			return false;
		}
	} 
	else
	{
		alert("Please browse the Image.");
		return false;
	} 
	
	if (document.frmSignUp.descDeveloper.value == "")	
	{
		alert('Please enter Developer Description.');
		document.frmSignUp.descDeveloper.focus();
		return false;
	}
	if (document.frmSignUp.image_vcode.value == "")	
	{
		alert('Please enter Security image code.');
		document.frmSignUp.image_vcode.focus();
		return false;
	}
	return true;
}

// Function to validate Developer Project Advertise.
function fnValidateProjectAdvertise()
{  

    var fcheck1 = document.frmAdvertise.filImage1.value;
	  var fcheck2 = document.frmAdvertise.filImage2.value;
	    var fcheck3 = document.frmAdvertise.filImage3.value;
		  var fcheck4 = document.frmAdvertise.filImage4.value;
   
	document.frmAdvertise.txtPrjName.value = trimStr(document.frmAdvertise.txtPrjName.value);
	document.frmAdvertise.txtSSContact.value = trimStr(document.frmAdvertise.txtSSContact.value);
	document.frmAdvertise.txtSSPhone.value = trimStr(document.frmAdvertise.txtSSPhone.value);
	document.frmAdvertise.txtSSEmail.value = trimStr(document.frmAdvertise.txtSSEmail.value);
	document.frmAdvertise.txtSSWebsite.value = trimStr(document.frmAdvertise.txtSSWebsite.value);
	document.frmAdvertise.txtSPrice.value = trimStr(document.frmAdvertise.txtSPrice.value);
	document.frmAdvertise.txtEPrice.value = trimStr(document.frmAdvertise.txtEPrice.value);
	document.frmAdvertise.txtSSize.value = trimStr(document.frmAdvertise.txtSSize.value);
	document.frmAdvertise.txtESize.value = trimStr(document.frmAdvertise.txtESize.value);
	document.frmAdvertise.txtMinBed.value = trimStr(document.frmAdvertise.txtMinBed.value);
	document.frmAdvertise.txtMaxBed.value = trimStr(document.frmAdvertise.txtMaxBed.value);
	document.frmAdvertise.txtMinBath.value = trimStr(document.frmAdvertise.txtMinBath.value);
	document.frmAdvertise.txtMaxBath.value = trimStr(document.frmAdvertise.txtMaxBath.value);
	document.frmAdvertise.txtStoreys.value = trimStr(document.frmAdvertise.txtStoreys.value);
	document.frmAdvertise.txtCommunity.value = trimStr(document.frmAdvertise.txtCommunity.value);
	document.frmAdvertise.txtBuildType.value = trimStr(document.frmAdvertise.txtBuildType.value);
	document.frmAdvertise.txtBuildStage.value = trimStr(document.frmAdvertise.txtBuildStage.value);
	document.frmAdvertise.txtUrl.value = trimStr(document.frmAdvertise.txtUrl.value);
	document.frmAdvertise.descProject.value = trimStr(document.frmAdvertise.descProject.value);
	
	var validateUrl = new RegExp();
    validateUrl.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
	
	var validateUrlSecond = new RegExp();
	validateUrlSecond.compile("^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
	
	phoneRegExp = /^([0-9]+)((-[0-9]+)?)((-[0-9]+)?)$/;
	numericRegExp = /^([0-9]+)((.[0-9]+)?)$/;
	
	if(document.frmAdvertise.txtPrjName.value == "")
	{
		alert('Please enter Project Name.');
		document.frmAdvertise.txtPrjName.focus();
		return false;
	}
	if (document.getElementById('lstStyle').selectedIndex <= 0)
	{
		alert('Please select the Project Style.');
		document.getElementById('lstStyle').focus();
		return false;	
	}
	if(document.frmAdvertise.txtSSContact.value == "")
	{
		alert('Please enter Show Suite Contact.');
		document.frmAdvertise.txtSSContact.focus();
		return false;
	}
	if(document.frmAdvertise.txtSSPhone.value == "")
	{
		alert('Please enter Show Suite Phone.');
		document.frmAdvertise.txtSSPhone.focus();
		return false;
	}
	if(document.frmAdvertise.txtSSEmail.value == "")
	{
		alert('Please enter Show Suite Email ID.');
		document.frmAdvertise.txtSSEmail.focus();
		return false;
	}
	if(!validateEmail(document.frmAdvertise.txtSSEmail.value))
	{
		alert('Please enter valid Show Suite Email ID.');
		document.frmAdvertise.txtSSEmail.focus();
		return false;
	}
	if(document.frmAdvertise.txtSSWebsite.value == "")
	{
		alert('Please enter Show Suite Website Url.');
		document.frmAdvertise.txtSSWebsite.focus();
		return false;
	}
	/*if(!validateUrl.test(document.frmAdvertise.txtSSWebsite.value) && !validateUrlSecond.test(document.frmAdvertise.txtSSWebsite.value))
	{
		alert('Please enter correct Show Suite Website Url.');
		document.frmAdvertise.txtSSWebsite.focus();
		return false;
	}*/
	if(document.frmAdvertise.txtSPrice.value == "")
	{
		alert('Please enter Start Price Range.');
		document.frmAdvertise.txtSPrice.focus();
		return false;
	}
	if (!numericRegExp.test(document.frmAdvertise.txtSPrice.value))
	{
		alert('Start Price Range must be numeric.');
		document.frmAdvertise.txtSPrice.focus();
		return false;
	}
	if(document.frmAdvertise.txtEPrice.value == "")
	{
		alert('Please enter End Price Range.');
		document.frmAdvertise.txtEPrice.focus();
		return false;
	}
	if (!numericRegExp.test(document.frmAdvertise.txtEPrice.value))
	{
		alert('End Price Range must be numeric.');
		document.frmAdvertise.txtEPrice.focus();
		return false;
	}
 
	if (parseInt(document.frmAdvertise.txtSPrice.value) > parseInt(document.frmAdvertise.txtEPrice.value))
	{
		alert('End Price Range value must be greater than Start Price Range.');	
		document.frmAdvertise.txtEPrice.focus();
		return false;
	}
	if(document.frmAdvertise.txtSSize.value == "")
	{
		alert('Please enter Start Size Range.');
		document.frmAdvertise.txtSSize.focus();
		return false;
	}
	if (!numericRegExp.test(document.frmAdvertise.txtSSize.value))
	{
		alert('Start Size Range must be numeric.');
		document.frmAdvertise.txtSSize.focus();
		return false;
	}
	if(document.frmAdvertise.txtESize.value == "")
	{
		alert('Please enter End Size Range.');
		document.frmAdvertise.txtESize.focus();
		return false;
	}
	if (!numericRegExp.test(document.frmAdvertise.txtESize.value))
	{
		alert('End Size Range must be numeric.');
		document.frmAdvertise.txtESize.focus();
		return false;
	}
	if (parseInt(document.frmAdvertise.txtSSize.value) > parseInt(document.frmAdvertise.txtESize.value))
	{
		alert('End Size Range value must be greater than Start Size Range.');
		document.frmAdvertise.txtESize.focus();
		return false;
	}
	if(document.frmAdvertise.txtMinBed.value == "")
	{
		alert('Please enter minimum Bedrooms.');
		document.frmAdvertise.txtMinBed.focus();
		return false;
	}
	if(document.frmAdvertise.txtMaxBed.value == "")
	{
		alert('Please enter maximum Bedrooms.');
		document.frmAdvertise.txtMaxBed.focus();
		return false;
	}
	if (parseInt(document.frmAdvertise.txtMinBed.value) > parseInt(document.frmAdvertise.txtMaxBed.value))
	{
		alert ('Maximum Bedrooms value must be greater than Minimum Bedrooms.');
		document.frmAdvertise.txtMaxBed.focus()
		return false;	
	}
	if(document.frmAdvertise.txtMinBath.value == "")
	{
		alert('Please enter minimum Bathrooms.');
		document.frmAdvertise.txtMinBath.focus();
		return false;
	}
	if(document.frmAdvertise.txtMaxBath.value == "")
	{
		alert('Please enter maximum Bathrooms.');
		document.frmAdvertise.txtMaxBath.focus();
		return false;
	}
	if (parseInt(document.frmAdvertise.txtMinBath.value) > parseInt(document.frmAdvertise.txtMaxBath.value))
	{
		alert ('Maximum Bathrooms value must be greater than Minimum Bathrooms.');
		document.frmAdvertise.txtMaxBath.focus();
		return false;	
	}

	if(document.frmAdvertise.txtStoreys.value == "")
	{
		alert('Please enter total Storeys.');
		document.frmAdvertise.txtStoreys.focus();
		return false;
	}
	if(document.frmAdvertise.txtCommunity.value == "")
	{
		alert('Please enter Project Community.');
		document.frmAdvertise.txtCommunity.focus();
		return false;
	}
	if(document.frmAdvertise.txtBuildType.value == "")
	{
		alert('Please enter Building Type.');
		document.frmAdvertise.txtBuildType.focus();
		return false;
	}
	if(document.frmAdvertise.txtBuildStage.value == "")
	{
		alert('Please enter Building Stage.');
		document.frmAdvertise.txtBuildStage.focus();
		return false;
	}
	if(document.frmAdvertise.txtCompltnDate.value == "")
	{
		alert('Please enter valid date.');
		document.frmAdvertise.txtCompltnDate.focus();
		return false;
	}
	if(document.frmAdvertise.descProject.value == "")
	{
		alert('Please enter project description.');
		document.frmAdvertise.descProject.focus();
		return false;
	}
	
	if	(fcheck1!='')
	{
		if(fcheck1.indexOf(".jpg")==-1 && fcheck1.indexOf(".jpeg")==-1 && fcheck1.indexOf(".JPG")==-1 && fcheck1.indexOf(".JPEG")==-1 &&fcheck1.indexOf(".png")==-1 && fcheck1.indexOf(".PNG")==-1  && fcheck1.indexOf(".gif")==-1 && fcheck1.indexOf(".GIF")==-1)
		{
			alert("Please upload only jpg,gif,png format Image");
			return false;
		}
	} 
	if	(fcheck2!='')
	{
		if(fcheck2.indexOf(".jpg")==-1 && fcheck2.indexOf(".jpeg")==-1 && fcheck2.indexOf(".JPG")==-1 && fcheck2.indexOf(".JPEG")==-1 &&fcheck2.indexOf(".png")==-1 && fcheck2.indexOf(".PNG")==-1  && fcheck2.indexOf(".gif")==-1 && fcheck2.indexOf(".GIF")==-1)
		{
			alert("Please upload only jpg,gif,png format Image");
			return false;
		}
	} 
	if	(fcheck3!='')
	{
		if(fcheck3.indexOf(".jpg")==-1 && fcheck3.indexOf(".jpeg")==-1 && fcheck3.indexOf(".JPG")==-1 && fcheck3.indexOf(".JPEG")==-1 &&fcheck3.indexOf(".png")==-1 && fcheck3.indexOf(".PNG")==-1  && fcheck3.indexOf(".gif")==-1 && fcheck3.indexOf(".GIF")==-1)
		{
			alert("Please upload only jpg,gif,png format Image");
			return false;
		}
	} 
	if	(fcheck4!='')
	{
		if(fcheck4.indexOf(".jpg")==-1 && fcheck4.indexOf(".jpeg")==-1 && fcheck4.indexOf(".JPG")==-1 && fcheck4.indexOf(".JPEG")==-1 &&fcheck4.indexOf(".png")==-1 && fcheck4.indexOf(".PNG")==-1  && fcheck4.indexOf(".gif")==-1 && fcheck4.indexOf(".GIF")==-1)
		{
			alert("Please upload only jpg,gif,png format Image");
			return false;
		}
	} 
	
	if(document.frmAdvertise.txtUrl.value == "")
	{
		alert('Please enter Google Map Url(project).');
		document.frmAdvertise.txtUrl.focus();
		return false;
	}
	/*if (!validateUrl.test(document.frmAdvertise.txtUrl.value) && !validateUrlSecond.test(document.frmAdvertise.txtUrl.value))
	{
     	alert("Please enter a valid Google Map Url.");
		document.frmAdvertise.txtUrl.focus();
        return false;
    }*/
	return true;
}

// Automatic Click Function.(Developer Project Advertise)
function checkProvinceList(listObj)
{
	document.getElementById('tempProvinceSubmit').click();
}

function checkCityList(listObj)
{
	document.getElementById('tempCitySubmit').click();
}

// Function to validate friend email page.
function fnValidateEmailForm()
{
	document.frmEmail.txtName.value = trimStr(document.frmEmail.txtName.value);
	document.frmEmail.txtEmail.value = trimStr(document.frmEmail.txtEmail.value);
	document.frmEmail.descText.value = trimStr(document.frmEmail.descText.value);
	
	if (document.frmEmail.txtName.value == "")
	{
		alert('Please enter your friend name.');
		document.frmEmail.txtName.focus();
		return false;
	}
	if (document.frmEmail.txtEmail.value == "")
	{
		alert('Please enter Your friend e-mail.');
		document.frmEmail.txtEmail.focus();
		return false;
	}
	if ( validateEmail(document.frmEmail.txtEmail.value) == false )
	{
		alert('Please enter a valid e-mail.');
		document.frmEmail.txtEmail.focus();
		return false;
	}
	if (document.frmEmail.descText.value.length == 0)
	{
		alert('Please enter the message.');
		document.frmEmail.descText.focus();
		return false;
	}
	return true;
}
function fnValidateEmailContactForm()
{
	document.ContactfrmEmail.txtName.value = trimStr(document.ContactfrmEmail.txtName.value);
	document.ContactfrmEmail.txtEmail.value = trimStr(document.ContactfrmEmail.txtEmail.value);
	document.ContactfrmEmail.txtPhone.value = trimStr(document.ContactfrmEmail.txtPhone.value);
	document.ContactfrmEmail.descText.value = trimStr(document.ContactfrmEmail.descText.value);
	
	if (document.ContactfrmEmail.txtName.value == "")
	{
		alert('Please enter your name.');
		document.ContactfrmEmail.txtName.focus();
		return false;
	}
	if (document.ContactfrmEmail.txtEmail.value == "")
	{
		alert('Please enter Your e-mail.');
		document.ContactfrmEmail.txtEmail.focus();
		return false;
	}
	if (document.ContactfrmEmail.txtPhone.value == "")
	{
		alert('Please enter Your Phone number');
		document.ContactfrmEmail.txtPhone.focus();
		return false;
	}
	if ( validateEmail(document.ContactfrmEmail.txtEmail.value) == false )
	{
		alert('Please enter a valid e-mail.');
		document.ContactfrmEmail.txtEmail.focus();
		return false;
	}
	if (document.ContactfrmEmail.descText.value.length == 0)
	{
		alert('Please enter the message.');
		document.ContactfrmEmail.descText.focus();
		return false;
	}
	return true;
}
// Function to validate forgot password.
function fnValidateForgotPass()
{
	document.frmForgotPass.txtEmail.value = trimStr(document.frmForgotPass.txtEmail.value);
	
	if(document.frmForgotPass.txtEmail.value=='')
	{
	alert("Enter the Email-ID.");
	document.frmForgotPass.txtEmail.focus();
	return false;
	}
	if(validateEmail(document.frmForgotPass.txtEmail.value)==false)
	{
	alert("please Enter the vaid Email-ID.");
	document.frmForgotPass.txtEmail.focus();
	return false;
	}
	return true;
}

// Function to validate the Login page.
function fnValidateLogin()
{
	document.frmLogin.txtName.value = trimStr(document.frmLogin.txtName.value);
	document.frmLogin.pwdUser.value = trimStr(document.frmLogin.pwdUser.value);
	
	if (document.frmLogin.txtName.value == "")	
	{
		alert('Please enter the user name.');
		document.frmLogin.txtName.focus();
		return false;
	}
	if (document.frmLogin.pwdUser.value == "")	
	{
		alert('Please enter the password.');
		document.frmLogin.pwdUser.focus();
		return false;
	}
	return true;
}
// Function to validate text(entered for search).
function fnValidateText(textId)
{
	
	document.frmText.txtSearch.value = trimStr(document.frmText.txtSearch.value);
	if (document.frmText.txtSearch.value == "")
	{
		alert('Please enter the Searched Text.');
		document.frmText.txtSearch.focus();
		return false;
	}
	var srcText = document.frmText.txtSearch.value;
	window.location = "SearchResult.php?str="+srcText;
	return true;
}

// Function To sort the Project info according to (Area, City and Price).{ProjectInfo.php}
function fnSortPage(colName)
{
	if(document.getElementById('hdnColumnName').value == colName)
		if(document.getElementById('hdnSortOrder').value == 'asc')
			document.getElementById('hdnSortOrder').value = 'desc';
		else
			document.getElementById('hdnSortOrder').value = 'asc';
	else
		document.getElementById('hdnSortOrder').value = 'asc';
		
	document.getElementById('hdnColumnName').value = colName;		
	document.getElementById('btnSubmitSort').click();
	return false;
}

// Function to Automatic Click.	
function fnType(strType)
{ 
	document.getElementById('hdnType').value = strType;
	document.getElementById('btnSubmitType').click();
	return false;
}
	
//remove the preceeding and ending spaces from a string.
function trimStr(str)
{
	var i, pBegin, pEnd, strTemp
 	//find the preceeding spaces
 	for (i = 0 ; i < String(str).length; i++)
 	{
		if (String(str).charAt(i) != " ")
		{
			pBegin = i;
	 		break;
		}
 	}
 
 	//find ending spaces
 	for (i = String(str).length -1; i >= 0; i--)
 	{
		if (String(str).charAt(i) != " ")
		{
			pEnd = i;
	 		break;
		} 
	}
 
 	//the new string.
 	strTemp = String(str).substr(pBegin, pEnd - pBegin +1 );
 	return (strTemp);
}

//FUNCTION TO VALIDATE EMAIL
function validateEmail(email)
{
//a valid email would have only one @ and one . after the @ in the string and a value before and after @ and .
	var iAtF = 0;
 	var iDotF = 0;
 	var iDotL = 0;
 	var iSpace = 0;
 	var iStrLength = 0; //for length of string

 	iAtF = String(email).indexOf("@");
 	iAtL = String(email).lastIndexOf("@");
 	if (iAtF < 1 )
		return (false);
 	if (iAtF != iAtL)
		return(false);
	
 	iDotL = String(email).lastIndexOf(".");
 	if (iDotL < iAtF + 2)
		return(false);

 	iSpace = String(email).indexOf(" ");
	 if (iSpace > 0 )
		return(false);

 	iStrLength = String(email).length;
 	if(iDotL==iStrLength-1 ||iDotL==iStrLength-2) 
		return(false);
		
	 return(true);
}

