// JavaScript Document
var xmlHttp;
function validateforward()
	{
		var field_name  		= 	new Array("message","sname","smail","rmail");
		var display_name		= 	new Array("Message","Sender Name","Sender Mail","Recipient Mail");
		var count_array=4;
		if(check_fields('form1',field_name,display_name,count_array))
		{
			var smail			=	document.form1.smail.value;
			var rmail			=	document.form1.rmail.value;		
			
			if(checkEmail(smail))
			{
				if(checkEmail(rmail))
				{
				document.form1.submit();	
				}
				else
				{
				return false;	
				}
			}
			else
			{
				return false;
			}
		}
		else
		{
		  return false; 
		}
	}
	
function validatecontact()
	{
		var field_name  		= 	new Array("sname","smail","sphone","message");
		var display_name		= 	new Array("Sender Name","Sender Mail","Sender Phone","Message");
		var count_array=4;
		if(check_fields('form1',field_name,display_name,count_array))
		{
			var smail			=	document.form1.smail.value;
						
			if(checkEmail(smail))
			{
				document.form1.submit();	
			}
			else
			{
				return false;
			}
		}
		else
		{
		  return false; 
		}
	}

function validatesms()
	{
		var field_name  		= 	new Array("smobile","message");
		var display_name		= 	new Array("Sender Mobile","Message");
		var count_array=2;
		if(check_fields('form1',field_name,display_name,count_array))
		{
			var sender_mob		=	document.form1.smobile.value;
			var sender_msg		=	document.form1.message.value;
			var propid			=	document.form1.propid.value;
						
			var url="pushsms.php?message="+sender_msg+"&from="+sender_mob+"&propid="+propid;		
			xmlHttp=GetXmlHttpObject(stateChangedUpdateSms)
			xmlHttp.open("GET", url , true)
			xmlHttp.send(null)
		}
		else
		{
		  return false; 
		}
	}
	
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}
	
function stateChangedUpdateSms() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 			
			//document.getElementById("greetid").value=xmlHttp.responseText;
			document.getElementById("smscontainer").innerHTML='<br><br><br><span class="txt_userHome_red">SMS Sent successfully</span><br><br><br>';
		} 
	}
 
	
function validatereport()
{
	var field_name  		= 	new Array("sname","smail","sphone","message");
	var display_name		= 	new Array("Sender Name","Sender Mail","Sender Phone","Message");
	var count_array=4;
	if(check_fields('form1',field_name,display_name,count_array))
	{
		var smail			=	document.form1.smail.value;
					
		if(checkEmail(smail))
		{
			document.form1.submit();	
		}
		else
		{
			return false;
		}
	}
	else
	{
	  return false; 
	}	
}


function openforwardcounter(int)
{
	document.getElementById('premiumBtmLinkDiv1').style.display = 'block';
	document.getElementById('premiumBtmLinkDiv2').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv3').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv4').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv5').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv6').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv7').style.display = 'none';
	
	document.getElementById('frwlink').style.color='#000';
	document.getElementById('frwlink').style.background='#d5f7ff';
	document.getElementById('frwlink').style.border='#2fb8da dotted 1px';
	
	document.getElementById('shrlink').style.color='#0099FF';
	document.getElementById('shrlink').style.textDecoration='none';
	document.getElementById('shrlink').style.padding='3px 5px 3px 5px';
	document.getElementById('shrlink').style.margin='3px';
	document.getElementById('shrlink').style.border='#fff dotted 1px';
	document.getElementById('shrlink').style.background='';
	
	document.getElementById('maillink').style.color='#0099FF';
	document.getElementById('maillink').style.textDecoration='none';
	document.getElementById('maillink').style.padding='3px 5px 3px 5px';
	document.getElementById('maillink').style.margin='3px';
	document.getElementById('maillink').style.border='#fff dotted 1px';
	document.getElementById('maillink').style.background='';
	
	document.getElementById('smslink').style.color='#0099FF';
	document.getElementById('smslink').style.textDecoration='none';
	document.getElementById('smslink').style.padding='3px 5px 3px 5px';
	document.getElementById('smslink').style.margin='3px';
	document.getElementById('smslink').style.border='#fff dotted 1px';
	document.getElementById('smslink').style.background='';
	
	document.getElementById('errorlink').style.color='#0099FF';
	document.getElementById('errorlink').style.textDecoration='none';
	document.getElementById('errorlink').style.padding='3px 5px 3px 5px';
	document.getElementById('errorlink').style.margin='3px';
	document.getElementById('errorlink').style.border='#fff dotted 1px';
	document.getElementById('errorlink').style.background='';
		
	var url="setforwardcounter.php"
	url=url+"?propid="+int
	
	xmlHttp=GetXmlHttpObject(stateChangedfwd)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function stateChangedfwd() 
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("premiumBtmLinkDiv1").
 innerHTML=xmlHttp.responseText;
 } 
}

function openshortlistcounter(int)
{
	document.getElementById('premiumBtmLinkDiv1').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv2').style.display = 'block';
	document.getElementById('premiumBtmLinkDiv3').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv4').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv5').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv6').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv7').style.display = 'none';
	
	document.getElementById('shrlink').style.color='#000';
	document.getElementById('shrlink').style.background='#d5f7ff';
	document.getElementById('shrlink').style.border='#2fb8da dotted 1px';
	
	document.getElementById('frwlink').style.color='#0099FF';
	document.getElementById('frwlink').style.textDecoration='none';
	document.getElementById('frwlink').style.padding='3px 5px 3px 5px';
	document.getElementById('frwlink').style.margin='3px';
	document.getElementById('frwlink').style.border='#fff dotted 1px';
	document.getElementById('frwlink').style.background='';
	
	document.getElementById('maillink').style.color='#0099FF';
	document.getElementById('maillink').style.textDecoration='none';
	document.getElementById('maillink').style.padding='3px 5px 3px 5px';

	document.getElementById('maillink').style.margin='3px';
	document.getElementById('maillink').style.border='#fff dotted 1px';
	document.getElementById('maillink').style.background='';
	
	document.getElementById('smslink').style.color='#0099FF';
	document.getElementById('smslink').style.textDecoration='none';
	document.getElementById('smslink').style.padding='3px 5px 3px 5px';
	document.getElementById('smslink').style.margin='3px';
	document.getElementById('smslink').style.border='#fff dotted 1px';
	document.getElementById('smslink').style.background='';
	
	document.getElementById('errorlink').style.color='#0099FF';
	document.getElementById('errorlink').style.textDecoration='none';
	document.getElementById('errorlink').style.padding='3px 5px 3px 5px';
	document.getElementById('errorlink').style.margin='3px';
	document.getElementById('errorlink').style.border='#fff dotted 1px';
	document.getElementById('errorlink').style.background='';
	
	var url="setshortlistcounter_premium.php"
	url=url+"?propid="+int	
	xmlHttp=GetXmlHttpObject(stateChangedslist)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function stateChangedslist() 
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("premiumBtmLinkDiv2").
 innerHTML=xmlHttp.responseText;
 } 
}


function opensharecounter(int)
{
	document.getElementById('premiumBtmLinkDiv1').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv2').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv3').style.display = 'block';
	document.getElementById('premiumBtmLinkDiv4').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv5').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv6').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv7').style.display = 'none';
	 
	var url="setsharecounter.php"
	url=url+"?propid="+int	
	xmlHttp=GetXmlHttpObject(stateChangedshare)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	
}

function stateChangedshare() 
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("premiumBtmLinkDiv3").
 innerHTML=xmlHttp.responseText;
 } 
}

function opencontactcounter(int)
{
	document.getElementById('premiumBtmLinkDiv1').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv2').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv3').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv4').style.display = 'block';
	document.getElementById('premiumBtmLinkDiv5').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv6').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv7').style.display = 'none';
	
	document.getElementById('maillink').style.color='#000';
	document.getElementById('maillink').style.background='#d5f7ff';
	document.getElementById('maillink').style.border='#2fb8da dotted 1px';
	
	document.getElementById('frwlink').style.color='#0099FF';
	document.getElementById('frwlink').style.textDecoration='none';
	document.getElementById('frwlink').style.padding='3px 5px 3px 5px';
	document.getElementById('frwlink').style.margin='3px';
	document.getElementById('frwlink').style.border='#fff dotted 1px';
	document.getElementById('frwlink').style.background='';
	
	document.getElementById('shrlink').style.color='#0099FF';
	document.getElementById('shrlink').style.textDecoration='none';
	document.getElementById('shrlink').style.padding='3px 5px 3px 5px';
	document.getElementById('shrlink').style.margin='3px';
	document.getElementById('shrlink').style.border='#fff dotted 1px';
	document.getElementById('shrlink').style.background='';
	
	document.getElementById('smslink').style.color='#0099FF';
	document.getElementById('smslink').style.textDecoration='none';
	document.getElementById('smslink').style.padding='3px 5px 3px 5px';
	document.getElementById('smslink').style.margin='3px';
	document.getElementById('smslink').style.border='#fff dotted 1px';
	document.getElementById('smslink').style.background='';
	
	document.getElementById('errorlink').style.color='#0099FF';
	document.getElementById('errorlink').style.textDecoration='none';
	document.getElementById('errorlink').style.padding='3px 5px 3px 5px';
	document.getElementById('errorlink').style.margin='3px';
	document.getElementById('errorlink').style.border='#fff dotted 1px';
	document.getElementById('errorlink').style.background='';
		
	var url="setcontactcounter.php"
	url=url+"?propid="+int	
	xmlHttp=GetXmlHttpObject(stateChangedcontact)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function stateChangedcontact() 
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("premiumBtmLinkDiv4").
 innerHTML=xmlHttp.responseText;
 } 
}

function opensmscounter(int)
{
	document.getElementById('premiumBtmLinkDiv1').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv2').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv3').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv4').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv5').style.display = 'block';
	document.getElementById('premiumBtmLinkDiv6').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv7').style.display = 'none';
	
	document.getElementById('smslink').style.color='#000';
	document.getElementById('smslink').style.background='#d5f7ff';
	document.getElementById('smslink').style.border='#2fb8da dotted 1px';
	
	document.getElementById('frwlink').style.color='#0099FF';
	document.getElementById('frwlink').style.textDecoration='none';
	document.getElementById('frwlink').style.padding='3px 5px 3px 5px';
	document.getElementById('frwlink').style.margin='3px';
	document.getElementById('frwlink').style.border='#fff dotted 1px';
	document.getElementById('frwlink').style.background='';
	
	document.getElementById('shrlink').style.color='#0099FF';
	document.getElementById('shrlink').style.textDecoration='none';
	document.getElementById('shrlink').style.padding='3px 5px 3px 5px';
	document.getElementById('shrlink').style.margin='3px';
	document.getElementById('shrlink').style.border='#fff dotted 1px';
	document.getElementById('shrlink').style.background='';
	
	document.getElementById('maillink').style.color='#0099FF';
	document.getElementById('maillink').style.textDecoration='none';
	document.getElementById('maillink').style.padding='3px 5px 3px 5px';
	document.getElementById('smslink').style.margin='3px';
	document.getElementById('maillink').style.border='#fff dotted 1px';
	document.getElementById('maillink').style.background='';
	
	document.getElementById('errorlink').style.color='#0099FF';
	document.getElementById('errorlink').style.textDecoration='none';
	document.getElementById('errorlink').style.padding='3px 5px 3px 5px';
	document.getElementById('errorlink').style.margin='3px';
	document.getElementById('errorlink').style.border='#fff dotted 1px';
	document.getElementById('errorlink').style.background='';
		
	var url="setsmscounter.php"
	url=url+"?propid="+int	
	xmlHttp=GetXmlHttpObject(stateChangedsms)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function stateChangedsms() 
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("premiumBtmLinkDiv5").
 innerHTML=xmlHttp.responseText;
 } 
}

function openreportcounter(int)
{
	document.getElementById('premiumBtmLinkDiv1').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv2').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv3').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv4').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv5').style.display = 'none';
	document.getElementById('premiumBtmLinkDiv6').style.display = 'block';
	document.getElementById('premiumBtmLinkDiv7').style.display = 'none';
	
	document.getElementById('errorlink').style.color='#000';
	document.getElementById('errorlink').style.background='#d5f7ff';
	document.getElementById('errorlink').style.border='#2fb8da dotted 1px';
	
	document.getElementById('frwlink').style.color='#0099FF';
	document.getElementById('frwlink').style.textDecoration='none';
	document.getElementById('frwlink').style.padding='3px 5px 3px 5px';
	document.getElementById('frwlink').style.margin='3px';
	document.getElementById('frwlink').style.border='#fff dotted 1px';
	document.getElementById('frwlink').style.background='';
	
	document.getElementById('shrlink').style.color='#0099FF';
	document.getElementById('shrlink').style.textDecoration='none';
	document.getElementById('shrlink').style.padding='3px 5px 3px 5px';
	document.getElementById('shrlink').style.margin='3px';
	document.getElementById('shrlink').style.border='#fff dotted 1px';
	document.getElementById('shrlink').style.background='';
	
	document.getElementById('maillink').style.color='#0099FF';
	document.getElementById('maillink').style.textDecoration='none';
	document.getElementById('maillink').style.padding='3px 5px 3px 5px';
	document.getElementById('smslink').style.margin='3px';
	document.getElementById('maillink').style.border='#fff dotted 1px';
	document.getElementById('maillink').style.background='';
	
	document.getElementById('smslink').style.color='#0099FF';
	document.getElementById('smslink').style.textDecoration='none';
	document.getElementById('smslink').style.padding='3px 5px 3px 5px';
	document.getElementById('smslink').style.margin='3px';
	document.getElementById('smslink').style.border='#fff dotted 1px';
	document.getElementById('smslink').style.background='';
	
	var url="setreportcounter.php"
	url=url+"?propid="+int	
	xmlHttp=GetXmlHttpObject(stateChangedreport)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)	
}

function stateChangedreport() 
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("premiumBtmLinkDiv6").
 innerHTML=xmlHttp.responseText;
 } 
}

function validateloanform()
{
	var field_name  		= 	new Array("name","email","lamount","mincome","occupation");
	var display_name		= 	new Array("Name","EMail","Loan Amount","Monthly Income","Occupation");
	var count_array=5;
	if(check_fields('form1',field_name,display_name,count_array))
	{
		var gend			=	document.form1.gend.value;
		var name			=	document.form1.name.value;
		var dob				=	document.form1.dob.value;
		var mob				=	document.form1.mob.value;
		var yob				=	document.form1.yob.value;
		var city			=	document.form1.city.value;
		var email			=	document.form1.email.value;
		var mobile			=	document.form1.mobile.value;
		var lamount			=	document.form1.lamount.value;
		var mincome			=	document.form1.mincome.value;
		var occupation		=	document.form1.occupation.value;
					
		if(checkEmail(email))
		{
			var url	=	"sendloanmail.php"
			url		=	url+"?gend="+gend+"&name="+name+"&dob="+dob+"&mob="+mob+"&yob="+yob+"&city="+city+"&email="+email+"&mobile="+mobile+"&lamount="+lamount+"&mincome="+mincome+"&occupation="+occupation
			xmlHttp	=	GetXmlHttpObject(stateChangedLoanmail)
			xmlHttp.open("GET", url , true)
			xmlHttp.send(null)
		}
		else
		{
			return false;
		}
	}
	else
	{
	  return false; 
	}		
}

function stateChangedLoanmail() 
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("loanarea").
 innerHTML='<br><br><br><span class="style1">Your Request Sent successfully</span><br><br><br>';
 } 
}

function GetXmlHttpObject(handler)
	{ 
		if (navigator.userAgent.indexOf("Opera")>=0)
		{
			alert("This example doesn't work in Opera") 
			return 
		}
		if (navigator.userAgent.indexOf("MSIE")>=0)
		{ 
			var strName="Msxml2.XMLHTTP"
			if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
			{
				strName="Microsoft.XMLHTTP"
			} 			
			try
			{ 
				objXmlHttp=new ActiveXObject(strName)	
				objXmlHttp.onreadystatechange=handler 
				return objXmlHttp
			} 
			catch(e)
			{ 
				//alert("Error. Scripting for ActiveX might be disabled") 
				return 
			} 
		} 
			if (navigator.userAgent.indexOf("Mozilla")>=0)
			{
				objXmlHttp=new XMLHttpRequest()
				objXmlHttp.onload=handler
				objXmlHttp.onerror=handler 
				return objXmlHttp
			}
	}
