// JavaScript Document
<!--

function mywindow(c,w,h)
{
window.open(c,'','toolbar=no, status=no, scrollbars=no, location=no, menubar=no, directories=no, top=0, left=0, width='+w+', height='+h+'');
}




function deactivate()
{
	document.quickcontact.submitbtn.disabled=true;
}

function activate()
{
if(document.quickcontact.name.value!=""&&document.quickcontact.email.value!=""&&document.quickcontact.comments.value!=""&& emailCheck("home"))
	{document.quickcontact.submitbtn.disabled=false;}
else
	{document.quickcontact.submitbtn.disabled=true;}
}


function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;
else if ((("0123456789").indexOf(keychar) > -1))
   return true;
else if (dec && (keychar == "."))
   {
   myfield.form.elements[dec].focus();
   return false;
   }
else
   return false;
}

function emailCheck (formid) 
{

	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	if(formid=="home")
	{var matchArray=document.quickcontact.email.value.match(emailPat);}
	else
	{var matchArray=document.online.email.value.match(emailPat);}

	if (matchArray==null)
		{
		//alert("Email address seems incorrect (check @ and .'s)");
		return false;
		}
	var user=matchArray[1];
	var domain=matchArray[2];

	for (i=0; i<user.length; i++) 
		{
		if (user.charCodeAt(i)>127)
			{
			//alert("Ths username contains invalid characters.");
			return false;
   			}
		}
	for (i=0; i<domain.length; i++) 
		{
		if (domain.charCodeAt(i)>127) 
			{
			//alert("Ths domain name contains invalid characters.");
			return false;
   			}
		}

	if (user.match(userPat)==null) 
		{
		//alert("The username doesn't seem to be valid.");
		return false;
		}


		var IPArray=domain.match(ipDomainPat);
		if (IPArray!=null) 
			{
			for (var i=1;i<=4;i++)
				{
				if (IPArray[i]>255) 
					{
					//alert("Destination IP address is invalid!");
					return false;
   					}
				}
			return true;
			}


	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) 
		{
		if (domArr[i].search(atomPat)==-1) 
			{
			//alert("The domain name does not seem to be valid.");
			return false;
   			}
		}
	if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) 
		{
		//alert("The address must end in a well-known domain or two letter " + "country.");
		return false;
		}

	if (len<2) 
		{
		//alert("This address is missing a hostname!");
		return false;
		}
	return true;
}


function isnull()
{	
	scroll(20,600);
	var msg="";
	var flag=true;
	var emailresult=true;

	if(document.online.name.value=="")
		{
			msg+=" name,"; flag=false;
			document.online.name.style.backgroundColor="#378635";
		}
	else{document.online.name.style.backgroundColor="#99D698";}
	
	if(document.online.email.value=="")
		{
			msg+=" email,"; flag=false;
			document.online.email.style.backgroundColor="#378635";
		}
	else{document.online.email.style.backgroundColor="#99D698";}
		
	if(document.online.date.value=="")
		{
			msg+=" date,"; flag=false;
			document.online.date.style.backgroundColor="#378635";
		}	
	else{document.online.date.style.backgroundColor="#99D698";}

		
	if(flag == false)
		{document.message.msg.value="Please Enter Your "+msg;}
	
	if(flag == true && document.online.email.value!="")
	  	{
			emailresult=emailCheck("main");
			if(emailresult == false)
				{
					document.online.email.style.backgroundColor="#378635";
					document.message.msg.value="Please Enter Valid Email address";
				}
			else
				{
					document.online.email.style.backgroundColor="#99D698";
					document.message.msg.value="";
				}	
		}
	
		
	if(flag == true && emailresult == true)
		{
			for(var i=0;i<2;i++)
			{
				var sexvalue;
				if (document.online.sex[i].checked==true)
         		{
           			 sexvalue =document.online.sex[i].value;
         		}
				
			}
			
			if (document.online.transportation.checked==true)
         		{
           			 var transport =document.online.transportation.value;
				}
			else{ transport="No"; }	
				
			if (document.online.accomodation.checked==true)
         		{
           			 var accomodation =document.online.accomodation.value;
				}
			else{ 	 accomodation="No"; }
				
				
			document.message.msg.value=" ";
			window.open("sendmail.php?name="+document.online.name.value+"&age="+document.online.age.value+"&sex="+sexvalue+"&email="+document.online.email.value+"&phone="+document.online.phone.value+"&address="+document.online.address.value+"&occupation="+document.online.occupation.value+"&date="+document.online.date.value+"&treatment="+document.online.treatment.value+"&transportation="+transport+"&accomodation="+accomodation+"&comments="+document.online.comments.value,"_self");
		}
		
}


