	function validateContactus(page)
	{ 
		if($('contactus_sent').value == '0')
		{
			if($('contactusMsgDiv')) $('contactusMsgDiv').innerHTML = '';
			if($('txtFromEmail')) $('txtFromEmail').className = '';
			if($('txtName')) $('txtName').className = '';
			if($('txtPhone')) $('txtPhone').className = '';
			if($('txtMinPrice')) $('txtMinPrice').className = '';
			if($('txtMaxPrice')) $('txtMaxPrice').className = '';
			if($('txtComments')) $('txtComments').className = '';

			var sent = false;
			var name  = trim($('txtName').value);
			var email = trim($('txtFromEmail').value);
			var phone = trim($('txtPhone').value);
			var comments = trim($('txtComments').value);
			var specialchars = "!@#$%^&*()+=-[]\\\;,/{}|\":<>?``";

			if(name == '')
			{
				$('contactusMsgDiv').innerHTML = "Please specify name.";
				$('txtName').focus();
				$('txtName').className="textboxRed";
				return false;
			}
			else if(name)
			{
				for (var charNo = 0; charNo < name.length; charNo++) 
				{
					if (specialchars.indexOf(name.charAt(charNo)) != -1)
					{
						errorMsg = "Name should not contain special characters.";
						$('contactusMsgDiv').innerHTML = errorMsg;
						$('txtName').className 	= "textboxRed";
						$('txtName').focus();
						return false ;	  				
					}
				}
			}

/*				if(phone == '')
			{
				$('contactusMsgDiv').innerHTML = "Please specify phone.";
				$('txtPhone').focus();
				$('txtPhone').className="textboxRed";
				return false;
			}			
			else*/ if(!validatePhone('txtPhone',''))
			{
				$('contactusMsgDiv').innerHTML = alertErrorMsg;
				$('txtPhone').focus();
				$('txtPhone').className="textboxRed";
				return false;
			}

			if(email == '')
			{
				$('contactusMsgDiv').innerHTML = "Please specify email.";
				$('txtFromEmail').focus();
				$('txtFromEmail').className="textboxRed";
				return false;
			}			
			else if(!emailIsValid("txtFromEmail"))
			{
				$('contactusMsgDiv').innerHTML = "Please specify valid email.";
				$('txtFromEmail').focus();
				$('txtFromEmail').className="textboxRed";
				return false;
			}
			
			var city = '', minP = '', maxP = '', beds = '', baths = '', interest = '', proptype = '';
			if($('txtMinPrice')) 
			{
				minP = Number(money2num($('txtMinPrice').value));
				maxP = Number(money2num($('txtMaxPrice').value));

				if(minP<0 || maxP<0)
				{
					alert("Please enter valid price range");
					$('txtMinPrice').value = '';
					$('txtMaxPrice').value = '';
					$('txtMinPrice').className 	= "textboxRed";
					$('txtMaxPrice').className 	= "textboxRed";
					return false;
				}
				else if(!numberIsValid('txtMinPrice','Only numeric values allowed for minimum price.','txtMinPrice',null,null))
				{
						alert(alertErrorMsg);
						$("txtMinPrice").value = "";
						$('txtMinPrice').className 	= "textboxRed";
						$("txtMinPrice").focus();
						return false;
				}
				else if(!numberIsValid('txtMaxPrice','Only numeric values allowed for maximum price.','txtMinPrice',null,null))
				{
						alert(alertErrorMsg);
						$("txtMaxPrice").value = "";
						$('txtMaxPrice').className 	= "textboxRed";
						$("txtMaxPrice").focus();
						return false;
				}
				else if((minP>=maxP) && (minP != "" && maxP != ""))
				{
					alert("Please enter valid price range");
					$('txtMinPrice').value = '';
					$('txtMaxPrice').value = '';
					$('txtMinPrice').className 	= "textboxRed";
					$('txtMaxPrice').className 	= "textboxRed";
					return false;
				}
			}else{
				var res = captchaCode();	//Function call to verify the Captcha Security Code.
						if(!res)
						{
							document.getElementById('security_code').value = '';
							document.getElementById('security_code').style.border= '1px solid red';
							document.getElementById('security_code').focus();
							return false;
						}
						if(res){ 
							document.getElementById('security_code').value = '';
							document.getElementById('security_code').style.border= '1px solid';
						}							// Function for captcha call over
			      }

/*			if(comments == '')
			{
				$('contactusMsgDiv').innerHTML = "Please specify suggestions.";
				$('txtComments').focus();
				$('txtComments').className="textboxRed";
				return false;
			}
			else*/ if(comments)
			{			
				var specialchars = "#%^()+=[]\\\'/{}|\"<>``";
				for (var charNo = 0; charNo < comments.length; charNo++) 
				{
					if (specialchars.indexOf(comments.charAt(charNo)) != -1)
					{
						errorMsg = "Comments should not contain special characters.";
						$('contactusMsgDiv').innerHTML = errorMsg;
						$('txtComments').className 	= "textboxRed";
						$('txtComments').focus();
						return false ;	  				
					}
				}
			}
			
			

			if($('txtBeds'))
				beds = $('txtBeds').value;
			if($('txtBaths'))
				baths = $('txtBaths').value;
			if($('txtCity'))
				city = $('txtCity').options[$('txtCity').selectedIndex].value;
			if($('txtInterest'))
				interest = $('txtInterest').options[$('txtInterest').selectedIndex].value;
			if($('txtPropType'))
				proptype = $('txtPropType').options[$('txtPropType').selectedIndex].value;

			var queryString = "&action=" + page + "&name=" + name + "&email=" + email + "&phone=" + phone + "&minprice=" + minP + "&maxprice=" + maxP + "&beds=" + beds + "&baths=" + baths + "&comments=" + encodeURI(comments) + "&city=" + city + "&interest=" + interest + "&proptype=" + proptype;

			sendEmail(queryString);
		}
	}
	function sendEmail(queryString)
	{
		var url = './sendemail.php';
		$('contactus_sent').value = '1';
		ajaxRequest(url, queryString, function(reqobj) { 
			var emailSent = false;
			var response = reqobj.responseText;
			var resArr = response.split("|==|");

			for(var resArrCnt = 0; resArrCnt < resArr.length; resArrCnt++)
			{
				if(resArr[resArrCnt] == 1)
				{
					emailSent = true;
					break;
				}
			}
			if(emailSent)
			{	
				//$('contactusMsgDiv').innerHTML = '<span class="moduleLableText" style="color:gray;">Your request has been submitted! </span>';
				alert("Thanks for submitting your request. We will contact you shortly.");
			}
			else
				alert("Sorry !! Please try again later.");

			$('contactus_sent').value = '0';
			setTimeout('resetContactus();',800);
		});
	}
	function resetContactus()
	{
		$('contactusMsgDiv').innerHTML = '';
		$('contactus_sent').value = '0';
		if($('txtName')) $('txtName').value = '';
		if($('txtFromEmail')) $('txtFromEmail').value = '';
		if($('txtPhone')) $('txtPhone').value = '';
		if($('txtComments')) $('txtComments').value = '';

		if($('txtBeds')) $('txtBeds').value = '';
		if($('txtBaths')) $('txtBaths').value = '';
		if($('txtMinPrice')) {
			$('txtMinPrice').value = '';
			$('txtMinPrice').className = '';
		}
		if($('txtMaxPrice')) {
			$('txtMaxPrice').value = '';
			$('txtMaxPrice').className = '';
		}
		if($('txtCity')) $('txtCity').selectedIndex = 0;
		if($('txtInterest')) $('txtInterest').selectedIndex = 0;
		if($('txtPropType')) $('txtPropType').selectedIndex = 0;

		captchaDivRefresh();
	}

	function openPage(page)
	{
			
		if(page == 'compHistory' || page == 'none')
		{
			$('divCompanyHistoryMarketing').style.display = '';
			$('divCompanyHistoryMarketingDet').style.display = '';
			$('divCompHistory').style.display = '';
			$('divCompHistoryDet').style.display = '';
			$('divCompIntRealty').style.display = 'none';
			$('divCompIntRealtyDet').style.display = 'none';
			$('divCompAffiliates').style.display = 'none';
			$('divCompAffiliatesDet').style.display = 'none';
			$('divCompAffiliatesPic').style.display = 'none';
			$('companyhistory').style.fontWeight = 'bold';

			$('companyhistory').style.textDecoration = 'none';
			$('realestateservice').style.textDecoration = 'underline';
			$('internationalrealty').style.textDecoration = 'underline';
			$('marketing').style.textDecoration = 'underline';

			
			$('companyhistory').style.cursor = 'text';
			$('realestateservice').style.cursor = 'pointer';
			$('internationalrealty').style.cursor = 'pointer';
			$('marketing').style.cursor = 'pointer';

			$('internationalrealty').style.fontWeight = 'normal';
			$('realestateservice').style.fontWeight = 'normal';
			$('marketing').style.fontWeight = 'normal';
			$('divMarketing').style.display = 'none';
			$('divMarketingDet').style.display = 'none';
			

		}

		else if(page == 'services')
		{
			$('divCompanyHistoryMarketing').style.display = 'none';
			$('divCompanyHistoryMarketingDet').style.display = 'none';
			$('divCompHistory').style.display = 'none';
			$('divCompHistoryDet').style.display = 'none';
			$('divCompIntRealty').style.display = 'none';
			$('divCompIntRealtyDet').style.display = 'none';
			$('divCompAffiliates').style.display = '';
			$('divCompAffiliatesDet').style.display = '';
			$('divCompAffiliatesPic').style.display = '';
			$('companyhistory').style.fontWeight = 'normal';
			$('internationalrealty').style.fontWeight = 'normal';
			$('realestateservice').style.fontWeight = 'bold';
			$('marketing').style.fontWeight = 'normal';
			$('companyhistory').style.cursor = 'pointer';
			$('divMarketing').style.display = 'none';
			$('divMarketingDet').style.display = 'none';
			$('companyhistory').style.textDecoration = 'underline';
			$('realestateservice').style.cursor = 'text';

			$('companyhistory').style.textDecoration = 'underline';
			$('internationalrealty').style.textDecoration = 'underline';
			$('marketing').style.textDecoration = 'underline';
			$('realestateservice').style.textDecoration = 'none';

		
			$('companyhistory').style.cursor = 'pointer';
			$('realestateservice').style.cursor = 'text';
			
			$('internationalrealty').style.cursor = 'pointer';
			$('marketing').style.cursor = 'pointer';

			
			
		}

		else if(page == 'aboutUs')
		{
			$('divCompanyHistoryMarketing').style.display = 'none';
			$('divCompanyHistoryMarketingDet').style.display = 'none';
			$('divCompHistory').style.display = 'none';
			$('divCompHistoryDet').style.display = 'none';
			$('divCompIntRealty').style.display = '';
			$('divCompIntRealtyDet').style.display = '';
			$('divCompAffiliates').style.display = 'none';
			$('divCompAffiliatesDet').style.display = 'none';
			$('divCompAffiliatesPic').style.display = 'none';
			$('companyhistory').style.fontWeight = 'normal';
			$('companyhistory').style.textDecoration = 'underline';

			$('internationalrealty').style.fontWeight = 'bold';
			$('internationalrealty').style.cursor = 'text';
			$('internationalrealty').style.textDecoration = 'none';
			

			$('realestateservice').style.fontWeight = 'normal';
			$('companyhistory').style.cursor = 'pointer';
			$('marketing').style.fontWeight = 'normal';
			$('divMarketing').style.display = 'none';
			$('divMarketingDet').style.display = 'none';

			
			$('companyhistory').style.textDecoration = 'underline';
			$('realestateservice').style.textDecoration = 'underline';
			$('marketing').style.textDecoration = 'underline';
			$('internationalrealty').style.textDecoration = 'none';

			$('companyhistory').style.cursor = 'pointer';
			$('realestateservice').style.cursor = 'pointer';
			$('internationalrealty').style.cursor = 'text';
			$('marketing').style.cursor = 'pointer';


			
			

		}
		
		else if(page == 'marketing')
		{
			$('divCompanyHistoryMarketing').style.display = 'none';
			$('divCompanyHistoryMarketingDet').style.display = 'none';
			$('divCompHistory').style.display = 'none';
			$('divCompHistoryDet').style.display = 'none';
			$('divCompIntRealty').style.display = 'none';
			$('divCompIntRealtyDet').style.display = 'none';
			$('divCompAffiliates').style.display = 'none';
			$('divCompAffiliatesDet').style.display = 'none';
			$('divCompAffiliatesPic').style.display = 'none';
			$('companyhistory').style.fontWeight = 'normal';
			$('internationalrealty').style.fontWeight = 'normal';
			$('realestateservice').style.fontWeight = 'normal';
			$('marketing').style.fontWeight = 'bold';
			$('companyhistory').style.cursor = 'pointer';
			$('divMarketing').style.display = '';
			$('divMarketingDet').style.display = '';


			$('companyhistory').style.textDecoration = 'underline';
			$('realestateservice').style.textDecoration = 'underline';
			$('internationalrealty').style.textDecoration = 'underline';
			$('marketing').style.textDecoration = 'none';

			$('companyhistory').style.cursor = 'pointer';
			$('realestateservice').style.cursor = 'pointer';
			$('internationalrealty').style.cursor = 'pointer';
			$('marketing').style.cursor = 'text';
			
		
		}
	
	}

	function getAgentDetails(agentUid)
	{
		window.frames['agentDetails'].location = "./agentInfo.php?id=" + agentUid;
		//document.getElementsByClassName('link_bold12_blackSel')[0].className = 'link_bold12_black';
		//document.getElementById("agt_" + agentUid).className = 'link_bold12_blackSel';
	}
