//-----Make an Enquiry Form --------------//
function validateenquiry()
	{
		
				//---------- FName  ----------
		if ( document.frmenquiryform.first_name.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiryform.first_name,"Please enter the First Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiryform.first_name))
   		 {if (!(PrintMesg(document.frmenquiryform.first_name,"Please enter First Name other than space.")))
    		{return false;}}
		 }

		//---------- LName  ----------
		if ( document.frmenquiryform.last_name.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiryform.last_name,"Please enter the Last Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiryform.last_name))
   		 {if (!(PrintMesg(document.frmenquiryform.last_name,"Please enter Last Name other than space.")))
    		{return false;}}
		 }


		//--------e-mail
	mail = ""
	mail = document.frmenquiryform.submit_by.value
 	if (mail  == "")
    {if (!(PrintMesg(document.frmenquiryform.submit_by,"Please enter E-mail Address.")))
    {return false;}}
	 else { 
   	n = mail.indexOf("@")
   	if (n >= 0)
   	{ newstr = mail.substring(n)
	 n= newstr.indexOf(".")
	 if (n<0)
	    {if (!(PrintMesg(document.frmenquiryform.submit_by,"Please enter a valid E-mail Address.")))
	    {return false;}}
   	} 
   	else
    {if (!(PrintMesg(document.frmenquiryform.submit_by,"Please enter a valid E-mail Address.")))
    {return false;}}
 	}


	//---------- Postcode  ----------
		if ( document.frmenquiryform.postcode.value == ""  )
  		 {if (!(PrintMesg(document.frmenquiryform.postcode,"Please enter the Postcode.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmenquiryform.postcode))
   		 {if (!(PrintMesg(document.frmenquiryform.postcode,"Please enter Postcode other than space.")))
    		{return false;}}
		 }


		return true;
	}


//prints messages
function PrintMesg(ctrlvar,mesg)
{ alert(mesg); ctrlvar.focus(); return false }

// function to check spaces
function SpaceChk(ctrlvar)
{
   chkstr     = ctrlvar.value
   stlength   = chkstr.length
   spacecount = 0
   if (stlength >0)  {
    for(i=0;i<=stlength;i++)
     if ( chkstr.charAt(i)==" ") { spacecount=spacecount+1  }
    if (stlength == spacecount) { return false }
   return true }
}

//---------------popup 04-06-2008

function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=635,height=530,scrollbars=Yes');
return false;
}


//---------------

