// JavaScript Document
function formvalidation()
{
	var name = document.frm.name.value;
	if(name == "" || name == 0 || name == 'Full Name'  )
	{
		alert('Please enter your Name');
		document.frm.name.select();
		return false;
	}
	var contactno = document.frm.no.value;
	
	if(contactno == "" || contactno == 0 || contactno == 'Contact Number')
	{
		//alert(contactno.length+contactno.charAt(3));
		var len = contactno.length;
		
		var i;
		for(i=0;i<len;i++) {
			if(i==0){
            if ((contactno.charAt(i) != "") && (!parseInt(contactno.charAt(i)))) {
		alert('Please enter your Contact No.'); 
			}}
		}
		document.frm.no.select();return false;	
	}
	
	
	var email = document.frm.email.value;
	if(email == "" || email == 0 || email == 'Email')
	{
		alert('Please enter your Email address.');
		document.frm.email.select();return false;
	}
	if(email != "Email" )
	{
	   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	   var address = document.frm.email.value;
	   if(reg.test(address) == false) {
		  alert('Invalid Email Address');
		  document.frm.email.select();return false;
	   }
	}
	
	var comments = document.frm.comments.value;
	if(comments == "" || comments == 0 || comments == 'Notes (Please give us an idea of what you are looking for)')
	{
		alert('Please Enter Comments'); 
		document.frm.comments.select();return false;
	} 
	return true;
}


function click_name()
	{
		var frm = document.frm;
		if(frm.name.value == "Full Name")
		{			frm.name.value = "";
		}
	}
	function click_no()
	{
		var frm = document.frm;
		if(frm.no.value == "Contact Number")
		{
			frm.no.value = "";
		}
	}
	function click_email()
	{
		var frm = document.frm;
		if(frm.email.value == "Email")
		{
			frm.email.value = "";
		}
	}
	function click_comments()
	{
		var frm = document.frm;
		//alert (frm.comments.value+"\nNotes (Please give us an idea of what you are looking for)" );
		if(frm.comments.value == "Notes (Please give us an idea of what you are looking for)")
		{
			frm.comments.value = "";
		}
	}
	

function clear_comments()
{
	if(document.frm.comments.value == "" )
	{
		document.frm.comments.value ="Notes (Please give us an idea of what you are looking for)";
	}
}

function restore_name()
{
	if(document.frm.name.value == "")
	{
		document.frm.name.value = "Full Name";
	}
}

function restore_contactno()
{
	if(document.frm.no.value == "")
	{
		document.frm.no.value = "Contact Number";
	}
}

function restore_email()
{
	if(document.frm.email.value == "")
	{
		document.frm.email.value = "Email";
	}
}