// JavaScript Document

function do_login(frm)
{
	if ( ( frm.txtlogin_email.value == '' ) || ( frm.txtlogin_password.value == '' ) )
	{		

		document.getElementById('error_logindiv').innerText = 'Email and Password are required.';
		document.getElementById('error_logindiv').textContent = 'Email and Password are required.';
		document.getElementById('error_logindiv').style.visibility = '';
		return false;

	} else {

		frm.action="login.php?action=login";
		frm.submit();

	}
}

function check_contactus(frm)
{
	if (frm.fullname.value == '') 
	{		
		alert('Full name is required.');
		frm.fullname.focus();
		return false;

	} 

	if (frm.email.value == '') 
	{		
		alert('Email Address is required.');
		frm.email.focus();
		return false;

	} 
	
	if (isValidEmail(frm.email.value == '') == false)
	{		
		alert('Email Address is not valid.');
		frm.email.focus();
		return false;

	} 	

	if (frm.comments.value == '') 
	{		
		alert('Comments are required.');
		frm.comments.focus();
		return false;

	} 
	
		return true;
}


function isValidEmail(strEmail){
  validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  strEmail = document.forms[0].email.value;

   // search email text for regular exp matches
    if (strEmail.search(validRegExp) == -1) 
   {
      //alert('A valid e-mail address is required.\nPlease amend and retry');
      return false;
    } 
    return true; 
}

function do_signup(frm)
{
	if ( ( frm.txtsignup_fullname.value == '' ) || ( frm.txtsignup_email.value == '' ) || ( frm.txtsignup_password.value == '' ) )
	{		

		document.getElementById('error_signupdiv').innerText = 'All fields are required.' ;
		document.getElementById('error_signupdiv').textContent = 'All fields are required.' ;
		document.getElementById('error_signupdiv').style.visibility = '';
		return false;

	} else {

		frm.action="signup.php?action=r";
		frm.submit();
	}
}
