
function validate_my_inputs(){
	var txt = document.downloadform.txtEmail.value;
	var i, atPos, periodPos, invalidChars, badChar;

	for (i = 0; i < document.downloadform.elements.length ; i++){
		if ((document.downloadform.elements[i].type == "text") || (document.downloadform.elements[i].type == "password")) {
			if (document.downloadform.elements[i].value == ""){
				alert ("Please fill all required field before submiting");
				document.downloadform.elements[i].focus();
				return false;
				}
		} 
	}
	
	if ((document.downloadform.txtPassword.value) != (document.downloadform.txtReTypePassword.value)){
		alert ("Password does not match");
		document.downloadform.txtReTypePassword.select();
		return false;		
		}
		
	if (isNaN(document.downloadform.txtPhone.value)){
		alert ("Invalid Phone Number");
		document.downloadform.txtPhone.select();
		return false;		
		}
	
    if (txt != "") {
   
		invalidChars = " /|\:,;-?!~^#$%*&()+=><[]{}";
       
		for (i=0; i<invalidChars.length; i++)	{
			badChar = invalidChars.charAt(i);
			//alert("Current Bad Character == " + badChar);
			if (txt.indexOf(badChar,0) != -1) {
				alert(txt + " - Invalid Characters in Email field");
				return false;
            }
		}

		if ( (txt.indexOf('@@',0)!=-1) || (txt.indexOf('..',0)!=-1)) {
		    alert(txt + " - Invalid Email Address");
			return false;             
		}
              
		atPos = txt.indexOf("@",1);
		if (atPos == -1) {
		    alert(txt + " - Invalid Email Address");
			return false;             
		}
       
		if (txt.indexOf("@",atPos+1) != -1) {
			alert(txt + " - Invalid Email Address, More Than one '@' found");
			return false;
        }
		
		periodPos = txt.indexOf(".",atPos);
		if (periodPos == -1) {
			alert(txt + " - Invalid Email Address");
			return false;
        }
                   
		if (periodPos+3 > txt.length) {
			alert(txt + " - Invalid Email Address");
			return false;
        }                                
	}
	if (confirm("Clicking Submit indicates that you agree to the Terms and Conditions")){
		document.downloadform.action = "phpFiles/process.php";
    	return true;
	} else {
		return false;}
	
}

function validate_login(){
	if (loginform.txtLoginName.value == ""){
		alert("Please enter your Login Name");
		loginform.txtLoginName.focus();
		return false;
		}
	else if (loginform.txtUserPassword.value == ""){
		alert("Please enter your Password");
		loginform.txtUserPassword.focus();
		return false;
		}
	else {
		document.loginform.action = "phpFiles/login_process.php"
		return true;
		}
}



function page_Init(){
	document.downloadform.txtFullName.focus();
	}

function loginPage_Init(){
	document.loginform.txtLoginName.focus();
	}