function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function showSubMenu(id) {
	hideAll();	
	var objRef = document.getElementById(id);
	objRef.style.display = "block";
	return false;	
}

function hideSubMenu(id) {
	var objRef = document.getElementById(id);
	objRef.style.display = "none";	
}

function setUpMenu(id) {
	document.getElementById(id).style.position = "absolute";
	//document.getElementById(id).style.display = "none";	
}

function hideAll() {
	// Hide all
	hideSubMenu("submenu2");
	hideSubMenu("submenu3");
	hideSubMenu("submenu4");
}

function setUpMenus() {
	setUpMenu("submenu2");
	setUpMenu("submenu3");
	setUpMenu("submenu4");
	hideAll();
}


var ErrorBackGroundColor;
ErrorBackGroundColor="yellow";

function MakeRowYellow(OName)
{
		window.document.getElementById(OName).style.backgroundColor=ErrorBackGroundColor;  
}

function MakeRowNormal(OName)
{
		window.document.getElementById(OName).style.backgroundColor="";  
}




function SelectDepartMent(CantactName)

{

document.frmContact.DeptName.value=CantactName
}

	function VisibleOtherTextBox()
		{
		
		Category = document.frmContact.Category.value; 
		
			if ((Category=="Healthcare Professional - Other") || (Category=="other"))
				{
					document.getElementById("other").style.display="block"
					//Theform.name.select();
					//return false;
				}
			else
			{
			document.getElementById("other").style.display="none"
			}		
		}	
		
	function ClearText()
	{
	document.frmContact.Other.value=""
	
	}
	
	function SetText()
	{
	//document.frmContact.Other.value="- Please specify other category -"
	}	

	function strtrim1() 
		{
		return this.replace(/^\s+/,'').replace(/\s+$/,'');
		 }
		
	   String.prototype.trim = strtrim1;	

	function validate()
		{
	
				defaultstatus="validate" ;
				var expname = /[^\w|\s|\-|\_|\']+/;
				var forcompname = /[^\w|\s|\-|\_|\.]+/; // Allow dot operator
				//var emailexp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
				var emailexp = 	/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;	
				var expphonefax=/[^0-9|\s|\+|\-]+/;
 
				var Theform ;
				Theform=document.frmContact;
				
				title = Theform.Title.value;
				Merror=false;
				title = title.trim();
				if (title=="")
				{
					//alert("Please do not leave Title field empty.")
					//Theform.Title.focus();
					MakeRowYellow('TITLEL');
					MakeRowYellow('TITLER');
					Merror=true;
					//Theform.name.select();
					//return false;
				}
				else
				{
					MakeRowNormal('TITLEL');
					MakeRowNormal('TITLER');
				}
					
				
				name = Theform.Name.value;
				name = name.trim();
				if (name=="")
				{
					//alert("Please do not leave  Name field empty."  )
					//Theform.Name.focus();
					MakeRowYellow('NAMEL');
					MakeRowYellow('NAMER');
					//Theform.name.select();
					Merror=true;
					//return false;
				}
				else if(expname.test(name)==true)
				{
						alert(' Special characters like <> * " ` are not allowed in  Name.')
						Theform.Name.focus();
						MakeRowYellow('NAMEL');
						MakeRowYellow('NAMER');
						return false; 
					
				}
				 
				else if(isNaN(name)==false)
				{
					alert("Name cannot have numeric values.");
					Theform.Name.focus();
					MakeRowYellow('NAMEL');
					MakeRowYellow('NAMER');
					return false;
				} 
				
				else
					{
					
					MakeRowNormal('NAMEL');
					MakeRowNormal('NAMER');
					
					}
				
				Category = Theform.Category.value; 
				
				if (Category=="")
				{
					//alert("Please do not leave  Category field empty."  )
					//Theform.Category.focus();
					MakeRowYellow('CATEGORYL');
					MakeRowYellow('CATEGORYR');
					//Theform.name.select();
					Merror=true;
					//return false;
				}
				else if ((Category=="HealthcareOther") || (Category=="other"))
				{
				Other= Theform.Other.value; 
				
					if (Other=="")
						{
						//alert("Please do not leave  Other field empty."  )
						//Theform.Other.focus();
						MakeRowNormal('CATEGORYL');
						MakeRowNormal('CATEGORYR');
						MakeRowYellow('OTHERL');
						MakeRowYellow('OTHERR');
						Merror=true;
					//Theform.name.select();
						//return false;
						}
						else
						{
						MakeRowNormal('CATEGORYL');
						MakeRowNormal('CATEGORYR');
						MakeRowNormal('OTHERL');
						MakeRowNormal('OTHERR');
						}
				}
				
				else
				{
				MakeRowNormal('CATEGORYL');
				MakeRowNormal('CATEGORYR');
				
				}	
				
				Address = Theform.Address.value; 
				if (Address=="")
					{
					//alert("Please do not leave  Address field empty."  )
					//Theform.Address.focus();
					MakeRowYellow('ADDRESSL');
					MakeRowYellow('ADDRESSR');
					Merror=true;
					//Theform.name.select();
						//return false;
					}
				else
					{
					MakeRowNormal('ADDRESSL');
					MakeRowNormal('ADDRESSR');
					}	
				
				Country = Theform.Country.value; 
				if (Country=="")
					{
					//alert("Please do not leave  Country field empty."  )
						//Theform.Country.focus();
						MakeRowYellow('COUNTRYL');
						MakeRowYellow('COUNTRYR');
						Merror=true;
					//Theform.name.select();
						//return false;
					}
				else
					{
					MakeRowNormal('COUNTRYL');
					MakeRowNormal('COUNTRYR');
					}
						
				Email = Theform.Email.value;
				Email = Email.trim();
				if (Email=="")
				{
					//alert("Please do not leave the Email Address field empty.")
					//Theform.Email.focus();
					MakeRowYellow('EMAILL');
					MakeRowYellow('EMAILR');
					Merror=true;
					//Theform.Email.select();
					//return false
				}
				else if(emailexp.test(Email.replace(/ /g,''))== false) 
					{
						alert("Invalid Email Address.Please re-enter.");
						Theform.Email.select();
						MakeRowYellow('EMAILL');
						MakeRowYellow('EMAILR');
						return false;
					}
				else
					{
					MakeRowNormal('EMAILL');
					MakeRowNormal('EMAILR');
					}
					
				
				phone = Theform.Telephone.value;
				phone = phone.trim();
				
				if (phone!="")
				{
					if(expphonefax.test(phone)==true)
					{
						alert(" Invalid Telephone entered .\n Alphabets and Special characters are not allowed.");
						//alert(' Special characters like <> * " ` are not allowed in Phone.')
						Theform.Telephone.focus();
						MakeRowYellow('TELEPHONEL');
						MakeRowYellow('TELEPHONER');
						return false; 
					} 
					else
					{
					MakeRowNormal('TELEPHONEL');
					MakeRowNormal('TELEPHONER');
					}
					
				}
				
				Contact = Theform.Contact.value;
				Contact = Contact.trim();
				
				if (Contact=="")
				{
					//	alert(" Please do not leave the Contact field empty.");
						//alert(' Special characters like <> * " ` are not allowed in Phone.')
						//Theform.Contact.focus();
						MakeRowYellow('CONTACTL');
						MakeRowYellow('CONTACTR');
						Merror=true;
						//return false; 
				 
				}
				else
				{
					MakeRowNormal('CONTACTL');
					MakeRowNormal('CONTACTR');
				}
				Enquiry = Theform.Enquiry.value;
				Enquiry = Enquiry.trim();
				
				if (Enquiry=="")
				{
						//alert(" Please do not leave the Enquiry field empty.");
						//alert(' Special characters like <> * " ` are not allowed in Phone.')
						//Theform.Enquiry.focus();
						MakeRowYellow('ENQUIRYL');
						MakeRowYellow('ENQUIRYR');
						Merror=true;
						//return false; 
					
				}
				else
				{
					MakeRowNormal('ENQUIRYL');
					MakeRowNormal('ENQUIRYR');
				}
				
				if (Merror==true) 
					{
					alert("Please complete the mandatory fields.")
					return false;
					}
					
				return true;
		}


	


