








function check_login() {
	ok = 1;
    
    if (ok == 1)
       checkEmail()
    if (ok == 1)
       checkPass()
    if (ok == 1)
    { 	
       	return true;
    }return false;
			
		
}

function checkEmail()
{
   var itemname = document.login.email.value;
   
    if (itemname == "")
    {
        alert("Please type in your Username");
	document.login.email.focus();
	ok=0;
	return (false);
    }
    
    if (itemname.indexOf("@")==-1 || itemname.indexOf(".")==-1)
    {
        alert("Your username will be a Email address");
      	document.login.email.focus();
      	ok=0;
      	return (false);
    }
       
}


function checkForEmail()
{
   var itemname = document.login.email.value;
   
    if (itemname == "")
    {
        alert("Please type in your Email Address");
	document.login.email.focus();
	ok=0;
	return (false);
    }
    
    if (itemname.indexOf("@")==-1 || itemname.indexOf(".")==-1)
    {
        alert("Not a valid Email address");
      	document.login.email.focus();
      	ok=0;
      	return (false);
    }
       
}

function checkPass()
{
   var itemname = document.login.password.value;
   
    if (itemname == "")
    {
        alert("Please type in a Password");
	document.login.password.focus();
	ok=0;
	return (false);
    }
   
}






function checkComments() {
	ok = 1;
    if (ok == 1)
       checkVal8("name")
    if (ok == 1)
    	checkVal8("contact")
    if (ok == 1)
       checkVal8("email")
    if (ok == 1)
       checkVal8("comments")
    
    if (ok == 1)
    { 	
       	return true;
    }return false;
		
}

function checkArticle() {
	ok = 1;
    if (ok == 1)
       checkVal8("name")
    if (ok == 1)
    	checkVal8("contact")
    if (ok == 1)
       checkVal8("email")
    if (ok == 1)
       checkVal8("link")
    if (ok == 1)
       checkVal8("comments")
    
    if (ok == 1)
    { 	
       	return true;
    }return false;
		
}



function checkVal8(name)
{
   
   var itemname = document.form1[name].value;
   
       if (itemname == "")
    {
	if (name == "id" && ok ==1){alert("Please type in your ID Number");ok=0;}
	if (name == "area_telephone" && ok ==1){alert("Please type in your Telephone Number Area Code");ok=0;}
	if (name == "add1" && ok ==1){alert("Please type in your Address Line 1");ok=0;}
	if (name == "suburb" && ok ==1){alert("Please type in your Suburb");ok=0;}
	if (name == "city" && ok ==1){alert("Please type in your City");ok=0;}
	if (name == "ocity" && ok ==1){alert("Please type in your City");ok=0;}
	if (name == "code" && ok ==1){alert("Please type in your Postal Code");ok=0;}
	if (name == "contact" && ok ==1){alert("Please type in your Contact Number");ok=0;}
        if (name == "cellphone" && ok ==1){alert("Please type in your Cellphone Number");ok=0;}
	if (name == "name" && ok ==1){alert("Please type in your Name");ok=0;}
	if (name == "link" && ok ==1){alert("Please type in the link to source");ok=0;}
	if (name == "email" && ok ==1){alert("Please type in your Email Address");ok=0;}
	if (name == "comments" && ok ==1){alert("Please type in your Comments");ok=0;}
	if (name == "contact_person" && ok ==1){alert("Please type the Contact Person");ok=0;}
	if (name == "d_add1" && ok ==1){alert("Please type the Delivery Address Line 1");ok=0;}
	if (name == "d_suburb" && ok ==1){alert("Please type the Delivery Suburb");ok=0;}
	if (name == "docity" && ok ==1){alert("Please type the Delivery City");ok=0;}
	if (name == "d_code" && ok ==1){alert("Please type the Delivery Postal Code");ok=0;}
	document.form1[name].focus();
	return (false);
    }
}




function checkContact()
{
   
    if (document.form1["telephone"].value == "" && document.form1["cellphone"].value=="")
    {
	alert("You need to type in a Cellphone or Telephone number!");
	ok=0;
	return (false);
    }
    if (document.form1["telephone"].value != "")
    {
    	checkVal8("area_telephone");
    	return (false);
    }
   
}





