// JavaScript Document
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		xmlHttp=new XMLHttpRequest();
	}
	catch(e)
	{
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
	


//function showpininfo()
//{
//    xmlHttp=GetXmlHttpObject()
//    if(xmlHttp==null)
//    {
//    alert("Browser does not support HTTP Request")
//    return
//    }
//    //var url="loginpopup.php"
//    //url=url+"?frmid="+str
//    //url=url+"&sid="+Math.random()
//    var url="popupwindow.php"
//    xmlHttp.onreadystatechange=stateChangedshowpininfo
//    xmlHttp.open("GET",url,true)
//    xmlHttp.send(null)
//}

function checkemail1(str)
    {

        var testresults;
        //var str=document.getElementById('varuid').value;
        var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
        if (filter.test(str))
        testresults=true
        else{

        testresults=false
        }
        return (testresults)
    }



function ProcessLoader()
{
    document.getElementById('dvprocessing').innerHTML = "<img src='images/ajax-loader.gif'>";
    document.getElementById('dvprocessing').style.display = '';
    document.getElementById('dvprocessing').style.width = '';
    document.getElementById('dvprocessing').style.height = '';
    document.getElementById('dvprocessing').style.top = CalculateTop('32')+ "px";
    document.getElementById('dvprocessing').style.left = CalculateLeft('32')+ "px";
    document.getElementById('dvprocessing').style.backgroundColor = 'white';
}

function ProcessLoader1()
{
    document.getElementById('dvprocessing').innerHTML = "<img src='images/ajax-loader.gif'>";
    document.getElementById('dvprocessing').style.display = '';
    document.getElementById('dvprocessing').style.width = '';
    document.getElementById('dvprocessing').style.height = '';
    document.getElementById('dvprocessing').style.top = CalculateTop('32')+ "px";
    document.getElementById('dvprocessing').style.left = CalculateLeft('32')+ "px";
    document.getElementById('dvprocessing').style.backgroundColor = 'white';
}

//function stateChangedshowpininfo()
//{
//SetBackground();
////alert(xmlHttp.readyState);
//
//if(xmlHttp.readyState==1)
//{
//ProcessLoader();
//}
//if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
//{
////	alert(xmlHttp.responseText);
///* var str = trim(xmlHttp.responseText, ' ');
//	 var strlengthcount = str.length;
//	alert(strlengthcount);
//	if(strlengthcount>0)
//	{*/
//document.getElementById('dvprocessing').style.display='none';
//
//	   document.getElementById('dvregisterfrm').style.width = '355';
//	   document.getElementById('dvregisterfrm').style.height = '382';
//       document.getElementById('dvregisterfrm').style.top = CalculateTop('382') + "px";
//       document.getElementById('dvregisterfrm').style.left = CalculateLeft('355')+ "px";
//document.getElementById('dvregisterfrm').style.display='';
//document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;
//unhideIframe();
//	/*}*/
//}
//}



function trim(str, chars) {
return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
function body_onkeydown(evt)
{
//alert(evt);
//alert(evt.keyCode);
var key=(window.Event)?evt.which:evt.keyCode;
//alert(key);
if(key==27)
{
//alert(key);
styledPopupClose();
	}
}

function CalculateTop(Height)
{var ScrollTop=document.body.scrollTop;if(ScrollTop==0)
{if(window.pageYOffset)
ScrollTop=window.pageYOffset;else
ScrollTop=(document.body.parentElement)?document.body.parentElement.scrollTop:0;}
//alert(document.body.clientHeight);
//alert(window.innerHeight);
//alert(document.documentElement.clientHeight);
var BodyHeight=document.body.clientHeight;if(BodyHeight==0)
{BodyHeight=window.innerHeight;}
if(BodyHeight==0)
{BodyHeight=document.documentElement.clientHeight}
//alert(BodyHeight);
//alert(ScrollTop);
var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

var FinalTop=((myHeight-Height)/2)+ScrollTop;return FinalTop;}

function CalculateLeft(Weight)
{var ScrollLeft=document.body.scrollLeft;if(ScrollLeft==0)
{if(window.pageXOffset)
ScrollLeft=window.pageXOffset;else
ScrollLeft=(document.body.parentElement)?document.body.parentElement.scrollLeft:0;}
var BodyWeight=document.documentElement.clientWidth;if(BodyWeight==0)
{BodyWeight=document.body.clientWidth;}
var FinalLeft=(BodyWeight+ScrollLeft-Weight)/2;return FinalLeft;}

function SetBackground()
{
//alert(GetBodyWidth());	
//alert(GetBodyHeight());	
document.getElementById('dimmer').style.width=GetBodyWidth();
document.getElementById('dimmer').style.height=GetBodyHeight();
document.getElementById('dimmer').style.visibility="visible";
}

function init()
{
isMozilla=(document.all)?0:1;
if(isMozilla)
{
document.captureEvents(Event.MOUSEDOWN|Event.MOUSEMOVE|Event.MOUSEUP);
}
/*document.onmousedown=MouseDown;document.onmousemove=MouseMove;document.onmouseup=MouseUp;*/
}
init();
function hideIframe()
{
if(ie)
{
var theIframe=document.getElementById("fadeboxiframe")
theIframe.style.display="none";
}
}


function unhideIframe()
{
	if(ie)
	{
		var theIframe=document.getElementById("fadeboxiframe")

		var theDiv=document.getElementById("dvregisterfrm");
		theIframe.style.width=theDiv.offsetWidth+'px';
		
		theIframe.style.height=theDiv.offsetHeight+'px';
		theIframe.style.top=theDiv.offsetTop+'px';
		theIframe.style.left=theDiv.offsetLeft+'px';
		theIframe.style.display='';
				
	}
}


function GetBodyWidth()
{
var theWidth=0;
if(document.body)
{
	theWidth=document.body.clientWidth;
}
else if(document.documentElement&&document.documentElement.clientWidth)
{
	theWidth=document.documentElement.clientWidth;
}
else if(window.innerWidth)
{
	theWidth=window.innerWidth;
}
//if(isMozilla)
//{
	theWidth=theWidth-85;
//}
return theWidth+ "px";
}

function GetBodyHeight()
{
var theHeight1=0;
var theHeight2=0;
var theHeight3=0;
if(window.innerHeight)
{
theHeight1=window.innerHeight;
}
if(document.documentElement&&document.documentElement.clientHeight)
{
theHeight2=document.documentElement.clientHeight;
}
if(document.body)
{
theHeight3=document.body.clientHeight;
if(isMozilla)
{
theHeight4=0;
}
else
{
theHeight4=document.body.scrollHeight;
}
}
FinalHeight=Math.max(theHeight1,theHeight2,theHeight3,theHeight4);
//if(isMozilla)
//{
FinalHeight=FinalHeight-85;
//}
return FinalHeight+ "px";
}


function KeycheckOnlyNumeric(e)
{
   var _dom = 0;
    _dom=document.all?3:(document.getElementById?1:(document.layers?2:0));
    if(document.all) e=window.event; // for IE
    var ch='';
    var KeyID = '';
    //alert(_dom);
    if(_dom==2){                     // for NN4
        //alert(e.which);
        if(e.which>0) ch='('+String.fromCharCode(e.which)+')';
        KeyID=e.which;
    }
    else
    {
        if(_dom==3){                   // for IE
            KeyID = (window.event) ? event.keyCode : e.which;
        }
        else {                       // for Mozilla
            //alert('Mozilla:' + e.charCode);
            if(e.charCode>0) ch='('+String.fromCharCode(e.charCode)+')';
            KeyID=e.charCode;
        }
    }
    
    if((KeyID >= 65 && KeyID <= 90) || (KeyID >= 97 && KeyID <= 122) || (KeyID >= 33 && KeyID <= 47) || (KeyID >= 58 && KeyID <= 64) || (KeyID >= 91 && KeyID <= 96) || (KeyID >= 123 && KeyID <= 126))	
    {
        //alert("hello");
        return false;
    }
    
    
    return true;
}
	
//function showgmapdiv(userdo,id)
//{
//	alert("test");
//	xmlHttp=GetXmlHttpObject();
//	if(xmlHttp==null)
//	{
//		alert("Browser does not support HTTP Request");
//		return;
//	}
//	var url="google_map.tpl.php?pid="+id;
//	xmlHttp.onreadystatechange= stateChangeGmap;
//	xmlHttp.open("GET",url,true);
//	xmlHttp.send(null);
//}
	
//function stateChangeGmap()
//{
//	if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
//	{
//		 var str = trim(xmlHttp.responseText, ' ');
//	 	var strlengthcount = str.length;
//	 	alert(xmlHttp.status);
//	 alert(xmlHttp.responseText);
//
//		document.getElementById("divproperty").style.display='none';
//		//document.getElementById("divinneraddproperty").style.display='none';
//
//		document.getElementById("divaddproperty").innerHTML=xmlHttp.responseText;
//		document.getElementById("divaddproperty").style.display='';
//
//
//	}
//	document.getElementById('conformid').style.display='none';
//}
//
//
//function showaddpropertyform(userdo,id,pagenumber,srhtxt,srhopt,order_field,order_type)
//{
//	//alert(id);
//	xmlHttp=GetXmlHttpObject();
//	if(xmlHttp==null)
//	{
//		alert("Browser does not support HTTP Request");
//		return;
//	}
//	var url="addproperty.php?userdo="+userdo+"&pid="+id+"&pagenumber="+pagenumber+"&srhtxt="+srhtxt+"&srhopt="+srhopt+"&order_field="+order_field+"&order_type="+order_type;
//	xmlHttp.onreadystatechange= stateChangeaddproperty;
//	xmlHttp.open("GET",url,true);
//	xmlHttp.send(null);
//
//}


//function stateChangeaddproperty()
//{
//
//
//if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
//	{
//		 var str = trim(xmlHttp.responseText, ' ');
//	 	var strlengthcount = str.length;
//	 	//alert(xmlHttp.status);
//	// alert(xmlHttp.responseText);
//
//		document.getElementById("divproperty").style.display='none';
//
//		document.getElementById("divaddproperty").innerHTML=xmlHttp.responseText;
//		document.getElementById("divaddproperty").style.display='';
//
//		//alert(document.getElementById('fk_typeglcode').value);
//		if(document.getElementById('fk_typeglcode').value in {'159':'', '160':'','182':'','183':'','184':'','185':'','186':''})
//		//if(document.getElementById('fk_typeglcode').value==159 || document.getElementById('fk_typeglcode').value==160)
//			{
//				document.getElementById('trland').style.display='';
//				document.getElementById('trland1').style.display='';
//
//				document.getElementById('showbnt').style.display='none';
//				document.getElementById('showbntland').style.display='';
//
//			}
//			else
//			{
//				document.getElementById('trland').style.display='none';
//				document.getElementById('trland1').style.display='none';
//
//				document.getElementById('showbnt').style.display='';
//				document.getElementById('showbntland').style.display='none';
//			}
//
//		if(document.getElementById('fk_typeglcode').value==120)
//			{
//				document.getElementById('tdsmcap').style.display='';
//				document.getElementById('tdsmtext').style.display='';
//
//			}
//		else
//			{
//				document.getElementById('tdsmcap').style.display='none';
//				document.getElementById('tdsmtext').style.display='none';
//			}
//
//	}
//	document.getElementById('conformid').style.display='none';
//}

//function disoldpric()
//{
//
//	if(document.getElementById('chkold').checked==true)
//	{
//
//		document.getElementById('trold').style.display='';
//
//	}
//	else if(document.getElementById('chkold').checked==false)
//	{
//
//		document.getElementById('trold').style.display='none';
//
//	}
//}

function chgType(strid,strval)
{
	
	
	//if(strval==159 || strval==160)
	if(strval in {'159':'', '160':'','182':'','183':'','184':'','185':'','186':''})
	{
		document.getElementById('trland').style.display='';
		document.getElementById('trland1').style.display='';
		
		//document.getElementById('btnsumit').style.display='';
		//document.getElementById('btncancel').style.display='';
		//document.getElementById('btnnext').style.display='none';
		document.getElementById('showbnt').style.display='none';
		document.getElementById('showbntland').style.display='';
		
	}
	else
	{
		document.getElementById('trland').style.display='none';
		document.getElementById('trland1').style.display='none';
		document.getElementById('showbnt').style.display='';
		document.getElementById('showbntland').style.display='none';
		//document.getElementById('btnsumit').style.display='none';
		//document.getElementById('btncancel').style.display='';
		//document.getElementById('btnnext').style.display='';
		
		if(strval==120)
		{
			document.getElementById('tdsmcap').style.display='';
			document.getElementById('tdsmtext').style.display='';
		}
		else
		{
			document.getElementById('tdsmcap').style.display='none';
			document.getElementById('tdsmtext').style.display='none';
		}
		
	}
}




function funpropertydetail()
{
	
	var x=validationaddproperty();
	if(x==false)
	{
		return false;
	}
	document.getElementById('divinneraddproperty').style.display='none';
	document.getElementById('divaddpropertydetail').style.display='';
	//alert('yes');
	//alert(array_data[0]);
	//debugger
	
if(document.getElementById('fk_typeglcode').value!=159 && document.getElementById('fk_typeglcode').value!=160)
{

var checkforRL = array_data[0].replace(/\r\n/g,'');
	if( checkforRL == "R")
		{
			
			//debugger
			document.getElementById('varsquarefeet').value = array_data[8];
 			document.getElementById('intbeds').value = array_data[9];
			document.getElementById('intbaths').value = array_data[10];
			document.getElementById('varfloors').value = array_data[11];
			if(array_data[12] == "Yes")
			{
				
				var viewcnt = 0;
				for(var i = 0; i < document.getElementById("fk_fur").length; i++)
				{
					if(document.getElementById("fk_fur").options[i].text == "Furnished")
						{
							document.getElementById("fk_fur").selectedIndex = i;
							viewcnt ++;
							break;
						}
						
					
				}
				if(viewcnt == 0)
				{
					document.getElementById("fk_fur").selectedIndex = 0;
				} 
				
			}
			else
			{
				var viewcnt = 0;
				for(var i = 0; i < document.getElementById("fk_fur").length; i++)
				{
					if(document.getElementById("fk_fur").options[i].text == "Unfurnished")
						{
							document.getElementById("fk_fur").selectedIndex = i;
							viewcnt ++;
							break;
						}
						
					
				}
				if(viewcnt == 0)
				{
					document.getElementById("fk_fur").selectedIndex = 0;
				}
				
			}

			var viewcnt = 0;
			for(var i = 0; i < document.getElementById("fk_fur").length; i++)
			{
				if(document.getElementById("fk_class").options[i].text == array_data[13])
					{
						document.getElementById("fk_class").selectedIndex = i;
						viewcnt ++;
						break;
					}
			}
			if(viewcnt == 0)
			{
				document.getElementById("fk_class").selectedIndex = 0;
			}
			document.getElementById('intyearbuilt').value = array_data[14];
		}
}
		
}

function validFortype()
{
	var vartype=document.getElementById('fk_typeglcode').value;
	if(document.getElementById('fk_typeglcode').value == "PleaseSelect")
        {
            alert("Please Select Type");
            document.getElementById('fk_typeglcode').focus();
            return false;
        }
	//else if(document.getElementById('varmls').value == "")
//		{
//			alert("Please enter MLS number");
//            document.getElementById('varmls').focus();
//            return false;
//		}
}


function validationaddproperty()
{
	
	
	var vartype=document.getElementById('fk_typeglcode').value;
	/* For check any agent select or not.*/
	
	//debugger
	var cont=0;
	var id_a;
	var id_array_a;
	var flag = false;
			var mailidlist="";
			for (var i=0; i<document.frmaddproperty.length; i++)
			{
				if(document.frmaddproperty.elements[i].type == "checkbox")
				{
						//alert('yes');
						//alert(document.frmaddproperty.elements[i].id);
						id_a = document.frmaddproperty.elements[i].id;
						id_array_a = id_a.split('_');
						if ( document.frmaddproperty.elements[i].checked == true && id_array_a[0] == 'agent')
						{
							cont++;
							flag = true;
						}
				}
			}
	
	/* For check any agent select or not.*/
	
	
	/*if(cont == 0)
        {
            alert("Please select atleast one Agent");
			return false;
        }
	else*/ if(document.getElementById('fk_typeglcode').value == "PleaseSelect")
        {
            alert("Please Select Type");
            document.getElementById('fk_typeglcode').focus();
            return false;
        }	
	 else if(document.getElementById('varmls').value == "")
        {
            alert("Please enter MLS # Value");
			document.getElementById('varmls').focus();
			return false;
        }
   else if(document.getElementById('vartitle').value == "")
        {
            alert("Please enter the Title");
			document.getElementById('vartitle').focus();
			return false;
        }
    else if(document.getElementById('fk_status').value == "PleaseSelect")
        {
            alert("Please Select Status ");
            document.getElementById('fk_status').focus();
            return false;
        }

    else if(document.getElementById('fk_districtglcode').value == "PleaseSelect")
        {
            alert("Please Select District");
             document.getElementById('fk_districtglcode').focus();
            return false;
        }
		 else if(document.getElementById('fk_Sector').value == "PleaseSelect")
        {
            alert("Please Select Sector");
            document.getElementById('fk_Sector').focus();
            return false;
        }
		 else if(document.getElementById('fk_Zoning').value == "PleaseSelect")
        {
            alert("Please Select Zoning");
            document.getElementById('fk_Zoning').focus();
            return false;
        }
		else if(document.getElementById('fk_Currency').value == "PleaseSelect")
		{
			alert("Please Select Currency");
            document.getElementById('fk_Currency').focus();
            return false;
		}
		else if(trim(document.getElementById('decprice').value) == "")
		{
			alert("Please Enter Price");
            document.getElementById('decprice').focus();
            return false;
		}
		else if(document.getElementById('fk_Views').value == "PleaseSelect")
		{
			alert("Please Select Views");
            document.getElementById('fk_Views').focus();
            return false;
		}
	
	else if(trim(document.getElementById('varwidth').value) == "" && (vartype in {'159':'', '160':'','182':'','183':'','184':'','185':'','186':''}))
		{
			alert("Please Enter Width");
            document.getElementById('varwidth').focus();
            return false;
		}
		else if(trim(document.getElementById('vardepth').value) == "" && (vartype in {'159':'', '160':'','182':'','183':'','184':'','185':'','186':''}))
		{
			alert("Please Enter Depth");
            document.getElementById('vardepth').focus();
            return false;
		}
		else if(trim(document.getElementById('decacreage').value) == "" && (vartype in {'159':'', '160':'','182':'','183':'','184':'','185':'','186':''}))
		{
			alert("Please Enter Acreage");
            document.getElementById('decacreage').focus();
            return false;
		}
	else if(document.getElementById('fk_Soil').value == "PleaseSelect" && (vartype in {'159':'', '160':'','182':'','183':'','184':'','185':'','186':''}))
		{
			alert("Please Select Soil");
            document.getElementById('fk_Soil').focus();
            return false;
		}
		

}


function chkprice(e)
{
//alert("testing");
   var _dom = 0;
    _dom=document.all?3:(document.getElementById?1:(document.layers?2:0));
    if(document.all) e=window.event; // for IE
    var ch='';
    var KeyID = '';
    //alert(_dom);
    if(_dom==2){                     // for NN4
        //alert(e.which);
        if(e.which>0) ch='('+String.fromCharCode(e.which)+')';
        KeyID=e.which;
    }
    else
    {
        if(_dom==3){                   // for IE
            KeyID = (window.event) ? event.keyCode : e.which;
        }
        else {                       // for Mozilla
            //alert('Mozilla:' + e.charCode);
            if(e.charCode>0) ch='('+String.fromCharCode(e.charCode)+')';
            KeyID=e.charCode;
        }
    }

    if(KeyID==46)
        {
            return true;
        }
    else if((KeyID >= 65 && KeyID <= 90) || (KeyID >= 97 && KeyID <= 122) || (KeyID >= 33 && KeyID <= 47) || (KeyID >= 58 && KeyID <= 64) || (KeyID >= 91 && KeyID <= 96) || (KeyID >= 123 && KeyID <= 126))
    {
        //alert("hello");
        return false;
    }


    return true;
}

function propertycancel()
{
	
	document.getElementById("divproperty").style.display='';
		
	document.getElementById("divaddproperty").style.display='none';
}

function addpropertyback()
{

document.getElementById('divinneraddproperty').style.display='';
document.getElementById('divaddpropertydetail').style.display='none';
	
}


function insertgmappoint(pid)
{
	if(document.getElementById('latbox').value == "")
	{
		alert("Please Click on map for get Latitude and longitude value");
		document.getElementById('latbox').focus();
		return false;
	}
	 else if(document.getElementById('lonbox').value == "PleaseSelect")
	{
		alert("Please Click on map for get Latitude and longitude value");
		document.getElementById('lonbox').focus();
		return false;
	}
	
	
	param="&hdpid="+pid;
	param=param+"&varlatitude="+document.getElementById('latbox').value;
	param=param+"&varlongitude="+document.getElementById('lonbox').value;
	
	
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
         
		
		var url="propertysave.php?Forgmap=gmap";
		
		//alert(url+param);
		//return false;
		xmlHttp.open("GET",url+param,true)
		
		
		xmlHttp.onreadystatechange=propertygmapsave;
		xmlHttp.send(null)
	
}

function propertygmapsave()
{
	SetBackground();
	if(xmlHttp.readyState==1)
	{
	ProcessLoader();
	}
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 	
		//alert(xmlHttp.responseText);
		//reloadlistwidthalert("Your Records Are Successfully Saved");
		/*param=param+"&pagenumber="+trim(document.getElementById('pagenumber').value);
		param=param+"&order_field="+trim(document.getElementById('order_field').value);
		param=param+"&order_type="+trim(document.getElementById('order_type').value);
		param=param+"&srhopt="+trim(document.getElementById('srhopt').value);
		param=param+"&srhtxt="+trim(document.getElementById('srhtxt').value);*/
		window.location.href="propertylist.php?msg=1";
	 }
}


function chkaddprorpertydetail()
{
	
	
	
	if(document.getElementById('fk_class').value == "PleaseSelect")
        {
            alert("Please Select Class");
			document.getElementById('fk_class').focus();
			return false;
        }
    else if(document.getElementById('fk_cons').value == "PleaseSelect")
        {
            alert("Please Select Construction");
			document.getElementById('fk_cons').focus();
			return false;
        }
	  else if(document.getElementById('fk_fon').value == "PleaseSelect")
        {
            alert("Please Select Foundation Name");
			document.getElementById('fk_fon').focus();
			return false;
        }
		 else if(document.getElementById('fk_fur').value == "PleaseSelect")
        {
            alert("Please Select Furnished");
			document.getElementById('fk_fur').focus();
			return false;
        }
		
		property_submit("noland");
}

function property_submit(str)
{
	
	
	
	var i;
	var j=document.getElementById('hdneighb').value;
	var neighid="";
	for(i=1;i<=j;i++)
	{
		
		if(document.getElementById('chkNeigh'+i).checked==true)
		{
			neighid+=document.getElementById('chkNeigh'+i).value+",";
		}
	}
	
	var k;
	var l=document.getElementById('hdnagt1').value;
	var agtid="";
	for(k=1;k<=l;k++)
	{
		
		if(document.getElementById('agent_chkAgt'+k).checked==true)
		{
			agtid+=document.getElementById('agent_chkAgt'+k).value+",";
		}
	}
	if(document.getElementById('agent_chk0').checked==true)
	{
		agtid+=document.getElementById('agent_chk0').value+",";
	}
	//alert(agtid);
	
	param="&agtid="+agtid;
	param=param+"&vartitle="+document.getElementById('vartitle').value;
	param=param+"&vartitleb="+document.getElementById('vartitleb').value;
	param=param+"&varmls="+document.getElementById('varmls').value;
	param=param+"&fk_typeglcode="+document.getElementById('fk_typeglcode').value;
	param=param+"&fk_stateglcode="+document.getElementById('fk_districtglcode').value;
	param=param+"&varaddress="+document.getElementById('varaddress').value;
	param=param+"&varblock="+document.getElementById('varblock').value;
	param=param+"&varparser="+document.getElementById('varparser').value;
	param=param+"&decoldprice="+document.getElementById('decoldprice').value;
	param=param+"&decprice="+document.getElementById('decprice').value;
	param=param+"&varfulldesc="+document.getElementById('varfulldesc').value;
	param=param+"&varvideolink="+document.getElementById('varvideolink').value;
	
	param=param+"&intdisplayorder="+document.getElementById('intdisplayorder').value;
	param=param+"&varwidth="+document.getElementById('varwidth').value;
	param=param+"&vardepth="+document.getElementById('vardepth').value;
	param=param+"&decacreage="+document.getElementById('decacreage').value;
	param=param+"&status="+document.getElementById('fk_status').value;
    param=param+"&sector="+document.getElementById('fk_Sector').value; 
	param=param+"&zoning="+document.getElementById('fk_Zoning').value;
	param=param+"&currency="+document.getElementById('fk_Currency').value;
	param=param+"&views="+document.getElementById('fk_Views').value;
	param=param+"&soil="+document.getElementById('fk_Soil').value;
	param=param+"&neighid="+neighid;
	/*alert(document.getElementById('fk_Currency').value);
	alert(param);*/
	param=param+"&hduserdo="+trim(document.getElementById('hduserdo').value);
	param=param+"&hdpid="+trim(document.getElementById('hdpid').value);
	param=param+"&hiintdisplayorder="+trim(document.getElementById('hiintdisplayorder').value);
	
	if(document.getElementById('chrdisplay').checked==true)
	{
		param=param+"&chrdisplay=Y";
	}
	else
	{
		param=param+"&chrdisplay=N";
	}
	
	
	if(document.getElementById('chkagentsitefp').checked==true)
	{
		param=param+"&chragentsitefp=Y";
	}
	else
	{
		param=param+"&chragentsitefp=N";
	}
	
	
	param=param+"&hdoldstatus="+trim(document.getElementById('hdoldstatus').value);
	param=param+"&hdoldprice="+trim(document.getElementById('hdoldprice').value);
	
	param=param+"&pagenumber="+trim(document.getElementById('pagenumber').value);
	param=param+"&order_field="+trim(document.getElementById('order_field').value);
	param=param+"&order_type="+trim(document.getElementById('order_type').value);
	param=param+"&srhopt="+trim(document.getElementById('srhopt').value);
	param=param+"&srhtxt="+trim(document.getElementById('srhtxt').value);
		
	/*alert(param);*/
	
	
	if(str=="land")
	{
		
		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
         
		
		var url="propertysave.php?land=land";
		
		/*alert(url+param);*/
		
		xmlHttp.open("GET",url+param,true)
		
		
		xmlHttp.onreadystatechange=propertysavestatechange
		xmlHttp.send(null)
		
	}
	else if(str=="noland")
	{
		
		
		i=0;
		var j=document.getElementById('hdHF').value;
		var HomeF="";
		for(i=1;i<=j;i++)
		{
			
			if(document.getElementById('chkHF'+i).checked==true)
			{
				HomeF+=document.getElementById('chkHF'+i).value+",";
			}
		}
		
		i=0;
		var j=document.getElementById('hdComF').value;
		var ComF="";
		for(i=1;i<=j;i++)
		{
			
			if(document.getElementById('chkComF'+i).checked==true)
			{
				ComF+=document.getElementById('chkComF'+i).value+",";
			}
		}
		
		param=param+"&varannualtax="+document.getElementById('varannualtax').value;
		param=param+"&intyearbuilt="+document.getElementById('intyearbuilt').value;
		param=param+"&varsquarefeet="+document.getElementById('varsquarefeet').value;
		param=param+"&intbeds="+document.getElementById('intbeds').value;
		param=param+"&intbaths="+document.getElementById('intbaths').value;
		param=param+"&varfloors="+document.getElementById('varfloors').value;
		
		
		param=param+"&class="+document.getElementById('fk_class').value;
		param=param+"&cons="+document.getElementById('fk_cons').value;
		param=param+"&fon="+document.getElementById('fk_fon').value;
		param=param+"&fur="+document.getElementById('fk_fur').value;
		
		param=param+"&HomeF="+HomeF;
		param=param+"&ComF="+ComF;
		
		
		
		
		
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
         
		
		var url="propertysave.php?land=noland";
		
		//alert(url+param);
		
		xmlHttp.open("GET",url+param,true)
		
		
		xmlHttp.onreadystatechange=propertysavestatechange
		xmlHttp.send(null)
		
	}
}
function propertysavestatechange()
{
	SetBackground();
	if(xmlHttp.readyState==1)
	{
	ProcessLoader();
	}
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 	
		//alert('response is :: '+xmlHttp.responseText);
		//reloadlistwidthalert("Your Records Are Successfully Saved");
		param="";
		param=param+"&pagenumber="+trim(document.getElementById('pagenumber').value);
		param=param+"&order_field="+trim(document.getElementById('order_field').value);
		param=param+"&order_type="+trim(document.getElementById('order_type').value);
		param=param+"&srhopt="+trim(document.getElementById('srhopt').value);
		param=param+"&srhtxt="+trim(document.getElementById('srhtxt').value);
		window.location.href="propertylist.php?msg=1"+param;
	 }
}
function proprerty_sumit_land()
{
	
	var x=funpropertydetail();
	
	if(x==false)
	{
		return false;
	}
	
	property_submit("land");
	return false;
}



//function showregistrationform(userdo,id,pagenumber,srhtxt,srhopt,order_field,order_type)
//{
//	document.getElementById('conformid').style.display='none';
//	xmlHttp=GetXmlHttpObject();
//	if(xmlHttp==null)
//	{
//		alert("Browser does not support HTTP Request");
//		return;
//	}
//	var url="adduser.php?userdo="+userdo+"&uid="+id+"&pagenumber="+pagenumber+"&srhtxt="+srhtxt+"&srhopt="+srhopt+"&order_field="+order_field+"&order_type="+order_type;
//	xmlHttp.onreadystatechange= stateChangeregister;
//	xmlHttp.open("GET",url,true);
//	xmlHttp.send(null);
//}

//
//function stateChangeregister()
//{
//SetBackground();
////alert(xmlHttp.readyState);
////alert(xmlHttp.responseText);
//if(xmlHttp.readyState==1)
//{
//ProcessLoader();
//}
//if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
//{
//<!--document.getElementById('dvprocessing').style.display='none';-->
////alert(xmlHttp.responseText);
//var popuph = 200;
//var popupw = 360;
//var popuph2 = popuph/2;
//var popupw2 = popupw/2;
//var winW = screen.width;
//var winH = screen.height;
//if (parseInt(navigator.appVersion)>3) {
//	if (navigator.appName=="Netscape") {
//		//winW = window.innerWidth;
//		//winH = window.innerHeight;
//		winW = document.body.offsetWidth;
//		winH = document.body.offsetHeight;
//	}
//	if (navigator.appName.indexOf("Microsoft")!=-1) {
//		winW = document.body.offsetWidth;
//		winH = document.body.offsetHeight;
//		//winW = window.innerWidth;
//		//winH = window.innerHeight;
//	}
//
//}
////alert(window.innerWidth + ":" + window.innerHeight );
//var sh = winH;
//var sw = winW;
//var sh2 = sh/2;
//var sw2 = sw/2;
//
//var topf = sh2 - popuph;
//var leftf = sw2 - popupw2;
//
//
////alert(popuph2 + ":" + popuph + ":" + sh2 + ":" + sh + ":" + topf);
////alert(popupw2 + ":" + popupw + ":" + sw2 + ":" + sw + ":" + leftf);
//
//
//document.getElementById('dvprocessing').style.display='none';
//document.getElementById('addeditpanel').style.display='';
////document.getElementById('dvregisterfrm').style.display='';
////document.getElementById('dvregisterfrm').style.height=10;
////document.getElementById('dvregisterfrm').style.width=10;
//
////document.getElementById('dvregisterfrm').style.top=CalculateTop('316')+ "px";
////document.getElementById('dvregisterfrm').style.left=CalculateLeft('392')+ "px";
//
//// binit comment
///*document.getElementById('dvregisterfrm').style.top= topf + "px";
//*/
////document.getElementById('dvregisterfrm').style.top=CalculateTop('430')+ "px";
////document.getElementById('dvregisterfrm').style.top=CalculateTop('211')+ "px";
//// binit comment end
////document.getElementById('dvregisterfrm').style.left= leftf + "px";
//	//alert(document.getElementById('dvregisterfrm').style.height);
//	//alert(document.getElementById('dvregisterfrm').style.width);
//document.getElementById("addeditpanel").innerHTML=xmlHttp.responseText;
//unhideIframe();
//document.getElementById('dimmer').style.width=0;
//document.getElementById('dimmer').style.height=0;
//document.getElementById('dimmer').style.visibility="hidden";
//}
//}
//


function showaddpropertyimageform(id)
{
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="propertylistimage.php?Protyid="+id;
	xmlHttp.onreadystatechange= stateChangeaddimage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
}


function stateChangeaddimage(id)
{
	/*SetBackground();*/
if(xmlHttp.readyState==1)
{
ProcessLoader1();
}

if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
	{
		 var str = trim(xmlHttp.responseText, ' ');
	 	var strlengthcount = str.length;
		//alert(str);
	 	//alert(xmlHttp.status);
	 /*alert(xmlHttp.responseText);*/
	 // var str = trim(xmlHttp.responseText, ' ');
	 //var strlengthcount = str.length;
	 //alert(strlengthcount);
		
		document.getElementById('dvregisterfrm').style.display = '';
	   document.getElementById('divpropertyimage').style.display = 'block';
	   document.getElementById('divaddpropertyimage').style.display = 'none';
	   document.location.href= 'propertylistimage.php?Protyid='+document.getElementById('Protyid').value;
	   //document.getElementById('divpropertyimage').style.display = 'none';
	    
 if(strlengthcount > 3300)
	 {
	   /*document.getElementById('dvregisterfrm').style.display = '';
	   document.getElementById('divpropertyimage').style.display = 'none';
	   document.location.href= 'propertylistimage.php?Protyid='+document.getElementById('Protyid').value;
	   document.getElementById('divpropertyimage').style.display = 'none';
	    document.getElementById('divaddpropertyimage').style.display = 'block';*/
	   //document.getElementById('dvregisterfrm').style.width = '395';
	   //document.getElementById('dvregisterfrm').style.height = '';
       //document.getElementById('dvregisterfrm').style.top = CalculateTop('493')+ "px";
       //document.getElementById('dvregisterfrm').style.left = CalculateLeft('392')+ "px";
	   //document.getElementById('dvregisterfrm').style.backgroundColor = '#FFFFFF';
	   //document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;
	   //unhideIframe();
	 }
	 else
	 {
		 document.getElementById('dvregisterfrm').style.display = "none";
		 document.location.href= 'propertylistimage.php?Protyid='+document.getElementById('Protyid').value;
	 }
		
		
		
	}
}
function isToDateLessThenFromDate(str1, str2)
{
   var aToDate = str2.split("/");
    var tdd = aToDate[1]; //get the day part
    var tmm = aToDate[0]; //get the month part
    var tyyyy = aToDate[2]; //get the year part

//    alert(tmm);
//    alert(tdd);
//    alert(tyyyy);

    var aFromDate = str1.split("/");
    var fdd = aFromDate[1]; //get the day part
    var fmm = aFromDate[0]; //get the month part
    var fyyyy = aFromDate[2]; //get the year part
//    alert(fmm);
//    alert(fdd);
//    alert(fyyyy);
    //
    //
//    var fromDate = new Date();
//    fromDate.setUTCDate(fdd);
//    fromDate.setUTCMonth(fmm-1);
//    fromDate.setUTCFullYear(fyyyy);
//    var toDate = new Date();
//    toDate.setUTCDate(tdd);
//    toDate.setUTCMonth(tmm-1);
//    toDate.setUTCFullYear(tyyyy);
//    alert(toDate.getTime());
//    alert(fromDate.getTime());
//    var difference = toDate.getTime() - fromDate.getTime();
//    var daysDifference = Math.floor(difference/1000/60/60/24);
//    difference -= daysDifference*1000*60*60*24;
//    alert(daysDifference);
//        if(daysDifference > 366 || daysDifference < 0)
//        {
//        return false;
//        }
//        else
//        {
//        return true;
//        }

        var date1 = new Date(fyyyy, fmm-1, fdd);
        var date2 = new Date(tyyyy, tmm-1, tdd);
//        alert(date1);
//        alert(date2);
       if(date2 <= date1)
       {
          //alert("To date cannot be greater than from date");
          return false;
       }
       else
       {
          //alert("Submitting ...");
          //document.form1.submit();
          return true;
       }
    
}
// returns true if the string contains only whitespace
function chkuserdetail()
{
	if(trim(document.getElementById('txtstartdate').value) == "")
        {
            alert("Please Enter Start Date.");
			document.getElementById('txtstartdate').focus();
			return false;
        }
    else if(!isDate(document.getElementById('txtstartdate').value))
    {
        alert("Please Enter Valid Start Date.");
        document.getElementById('txtstartdate').focus();
        return false;
    }
    else if(trim(document.getElementById('txtenddate').value) == "")
        {
            alert("Please Enter End Date.");
			document.getElementById('txtenddate').focus();
			return false;
        }
    else if(!isDate(document.getElementById('txtenddate').value))
    {
        alert("Please Enter Valid End Date.");
        document.getElementById('txtenddate').focus();
        return false;
    }
    else if(!isToDateLessThenFromDate(document.getElementById('txtstartdate').value,document.getElementById('txtenddate').value))
        {
            alert("End Date Should Be Greater Than Start Date.");
            document.getElementById('txtenddate').focus();
            return false;
        }
    else if(document.getElementById('txtweekcharge').value=="")
        {
            alert("Please Enter Per Week Charge.");
            document.getElementById('txtweekcharge').focus();
            return false;
        }
	else if(document.getElementById('txtdaycharge').value=="")
        {
            alert("Please Enter Per Night Charge.");
            document.getElementById('txtdaycharge').focus();
            return false;
        }
		
	param="&txtstartdate="+document.getElementById('txtstartdate').value;
	param=param+"&txtenddate="+document.getElementById('txtenddate').value;
	param=param+"&txtweekcharge="+document.getElementById('txtweekcharge').value;
	param=param+"&txtdaycharge="+document.getElementById('txtdaycharge').value;

	param=param+"&userdo="+trim(document.getElementById('hduserdo').value);
	
	param=param+"&uid="+trim(document.getElementById('hduid').value);
	
		param=param+"&pagenumber="+trim(document.getElementById('pagenumber').value);
		param=param+"&order_field="+trim(document.getElementById('order_field').value);
		param=param+"&order_type="+trim(document.getElementById('order_type').value);
		param=param+"&srhopt="+trim(document.getElementById('srhopt').value);
		param=param+"&srhtxt="+trim(document.getElementById('srhtxt').value);
	
	
	
	xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
         
		
		var url="addrates.php?QT=1";
		
//		alert(url+param);
		
		xmlHttp.open("GET",url+param,true)
		
		
		xmlHttp.onreadystatechange=stateChangeregisterpopup
		xmlHttp.send(null)
	
}

function stateChangeregisterpopup()
{
SetBackground();
if (xmlHttp.readyState == 1)
{
	ProcessLoader();
}
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	 document.getElementById('dvprocessing').style.display = 'none';
	 
	 var str = trim(xmlHttp.responseText, ' ');
	 var strlengthcount = str.length;
     var array=str.split("****");
//	 alert(array[1]);//1 = confliction
//     if(array[1]==0)
//     {
//        document.location.href="rates.php?msg=1"+param;
//     }
     if(array[1]==1)
     {
         document.location.href="rates.php?msg=5"+param;
     }
     else
     {
         document.location.href="rates.php?msg=1"+param;
     }
	 if(strlengthcount > 3300)
	 {
	   
	   		var popuph = 200;
			var popupw = 360;
			var popuph2 = popuph/2;
			var popupw2 = popupw/2;
			var winW = screen.width;
			var winH = screen.height;
			if (parseInt(navigator.appVersion)>3) {
				if (navigator.appName=="Netscape") {
					
					winW = document.body.offsetWidth;
					winH = document.body.offsetHeight;
				}
				if (navigator.appName.indexOf("Microsoft")!=-1) {
					winW = document.body.offsetWidth;
					winH = document.body.offsetHeight;
					
				}
				
			}
			
			var sh = winH;
			var sw = winW;
			var sh2 = sh/2;
			var sw2 = sw/2;
			
			var topf1 = sh2 - popuph;
			var leftf1 = sw2 - popupw2;
	
		
		document.getElementById('dvprocessing').style.display='none';
		
		//document.getElementById('dvregisterfrm').style.display='';
		
		//document.getElementById('dvregisterfrm').style.top=topf1 + "px";
		//document.getElementById('dvregisterfrm').style.left=leftf1 + "px";
		//document.getElementById('dvregisterfrm').style.top=CalculateTop('430')+ "px";
		//document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;
		//var messagepanel = '<table width=98% border=0 cellpadding=0 cellspacing=0 class=message_panel><tr>'+
		//					'<td height=30px><span class=errormessage>asdasdasd</span></td></tr></table>';
	     //var messagepanel = "error";		
		//document.getElementById("dvmessagepanel").innerHTML=messagepanel;					
		//document.getElementById("dvmessagepanel").style.display='';					
		unhideIframe();
		
		/*document.getElementById('dimmer').style.width=0;
		document.getElementById('dimmer').style.height=0;
        document.getElementById('dimmer').style.visibility="hidden";
		alert('This email id is already exist.');
		document.getElementById('varemail').focus();*/
	 }
	 else
	 {
		param=param+"&pagenumber="+trim(document.getElementById('pagenumber').value);
		param=param+"&order_field="+trim(document.getElementById('order_field').value);
		param=param+"&order_type="+trim(document.getElementById('order_type').value);
		param=param+"&srhopt="+trim(document.getElementById('srhopt').value);
		param=param+"&srhtxt="+trim(document.getElementById('srhtxt').value);
//		 document.location.href="rates.php?msg=1"+param;
	 }
 } 
}


	
function reloadlist()
{
	
	location.reload( true );
	
}
function reloadlistwidthalert(msg)
{
	alert(msg);
	location.reload( true );
	
}

function showagentaddform(userdo,id)
{
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="addagent.php?userdo="+userdo+"&uid="+id;
	xmlHttp.onreadystatechange= stateChangeaddagent;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
}


function stateChangeaddagent()
{

if (xmlHttp.readyState == 1)
{
	ProcessLoader1();
}

		
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
	{
		 var str = trim(xmlHttp.responseText, ' ');
	 	var strlengthcount = str.length;
	 	//alert(xmlHttp.status);
	 /*alert(xmlHttp.responseText);*/
		
		document.getElementById("divagent").style.display='none';
		
		document.getElementById("addagent").innerHTML=xmlHttp.responseText;
		document.getElementById("addagent").style.display='';
		//unhideIframe();
		document.getElementById('dvprocessing').style.display = 'none';
	}
}

function chkaddagent()
{
	
	
	var testresults;
        //var str=document.getElementById('varuid').value;
        var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
        if (filter.test(document.getElementById('varemail').value))
        testresults=true
        else{

        testresults=false
        }
		
		
	
	if(trim(document.getElementById('varfname').value) == "")
        {
            alert("Please Enter First Name");
			document.getElementById('varfname').focus();
			return false;
        }
    else if(trim(document.getElementById('varlname').value) == "")
        {
            alert("Please Enter Last Name");
			document.getElementById('varlname').focus();
			return false;
        }
	else if(testresults==false)
        {
            alert("Please enter a valid email address");
			document.getElementById('varemail').focus();
			return false;
        }
	
	else if(trim(document.getElementById('intdisplayorder').value)=="" || document.getElementById('intdisplayorder').value==0)
        {
            alert("Please enter Display Order");
            document.getElementById('intdisplayorder').focus();
            return false;
        }
	 else if(trim(document.getElementById('hduserdo').value) == "Add" && document.getElementById('file1').value=="")
        {
            alert("Please Select Image");
			document.getElementById('file1').focus();
			return false;
        }	
		
		
	param="&varfname="+document.getElementById('varfname').value;
	param=param+"&varlname="+document.getElementById('varlname').value;
	param=param+"&varemail="+document.getElementById('varemail').value;
	param=param+"&varsitename="+document.getElementById('varsitename').value;
	param=param+"&varphone="+document.getElementById('varphone').value;
	
	if(document.getElementById('chrdisplay').checked==true)
	{
		param=param+"&chrdisplay=true";
	}
	else
	{
		param=param+"&chrdisplay=false";
	}
	
	if(document.getElementById('varblock').checked==true)
	{
		param=param+"&varblock=true";
	}
	else
	{
		param=param+"&varblock=false";
	}
	
	param=param+"&varmobileno="+document.getElementById('varmobileno').value;
	param=param+"&intdisplayorder="+trim(document.getElementById('intdisplayorder').value);
	param=param+"&hiintdisplayorder="+trim(document.getElementById('hiintdisplayorder').value);
	param=param+"&userdo="+trim(document.getElementById('hduserdo').value);
	param=param+"&uid="+trim(document.getElementById('hduid').value);
	
/*	param=param+"&file1="+document.getElementById('file1');*/
param=param+"&file1="+document.frmagent.file1;
	
	var inst = FCKeditorAPI.GetInstance("FCKeditor1");
	var sValue = inst.GetHTML();
	param=param+"&FCKeditor1="+sValue;
	
	
	xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
         
		
		var url="addagent.php?QT=1";
		
		//alert(url+param);
		
		xmlHttp.open("GET",url+param,true)
		
		
		xmlHttp.onreadystatechange=stateChangeagentsave
		xmlHttp.send(null)
		

}
function stateChangeagentsave()
{

		
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
	{
		 reloadlistwidthalert("Your Records Are Successfully Saved");
		
	}
}

function shownewimageform(id)
{
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="addimage.php?imagecode="+id;
	param="&File1="+document.getElementById('file1').value;
	//alert(url +param);
	//xmlHttp.setRequestHeader("Content-type", "multipart/form-data;");
	xmlHttp.onreadystatechange= stateChangenewimage;
	xmlHttp.open("GET",url +param,true);
	xmlHttp.send(null);
	
}


function stateChangenewimage()
{

		
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
	{
		 //var str = trim(xmlHttp.responseText, ' ');
	 	var str=xmlHttp.responseText;
      // alert(str);

		 var array=str.split("$");
        //alert(array[1]);

        //alert(array[2]);
        //alert(array[0]);
		document.getElementById("divagent").style.display='none';
		
		document.getElementById("testWrap").innerHTML=xmlHttp.responseText;
		document.getElementById("testWrap").style.display='';
		
	}
}
function showcropimageform()
{
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="simplecrop.php?x1="+document.getElementById('x1').value;
	param="&y1="+document.getElementById('y1').value;
	param=param+"&x2="+document.getElementById('x2').value;
	param=param+"&y2="+document.getElementById('y2').value;
	param=param+"&imagename="+document.getElementById('imagename').value;
	param=param+"&intglcode="+document.getElementById('intglcode').value;
	param=param+"&Protyid="+document.getElementById('Protyid').value;
	param=param+"&intdisplayorder="+document.getElementById('intdisplayorder').value;
	//alert(url +param);
	xmlHttp.onreadystatechange= stateChangecropimage;
	xmlHttp.open("GET",url +param,true);
	xmlHttp.send(null);
	
}


function stateChangecropimage()
{
//SetBackground();
//if (xmlHttp.readyState == 1)
//{
//	ProcessLoader();
//}
if ((xmlHttp.readyState==4 || xmlHttp.readyState=="complete") && (xmlHttp.status == 200))
    {

	   var str=xmlHttp.responseText;
       //alert(str);

		 //var array=str.split("$");
        //alert(array[1]);

        //alert(array[2]);
        //alert(array[0]);
     //document.getElementById('inputbox'+array[1]).style.display="none";
      document.getElementById('cropimagediv').innerHTML=str;


    }

		
 }




/*function showviewflyerform(intglcode,seltype)
{
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="viewflyer.php?intglcode="+intglcode+"&seltype="+seltype;
	//alert(url);
	xmlHttp.onreadystatechange= stateChangeviewflyerform;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}*/
function showviewflyerform(intglcode,ssstype)
{
	//alert(ssstype);
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="viewflyer.php?intglcode="+intglcode+"&seltype="+ssstype;
	xmlHttp.onreadystatechange= stateChangeviewflyerform;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function stateChangeviewflyerform()
{
SetBackground();
//alert(xmlHttp.readyState);
//alert(xmlHttp.responseText);
if(xmlHttp.readyState==1)
{
ProcessLoader();
}
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
{
<!--document.getElementById('dvprocessing').style.display='none';-->
//alert(xmlHttp.responseText);
var popuph = 200;
var popupw = 360;
var popuph2 = popuph/2;
var popupw2 = popupw/2;
var winW = screen.width;
var winH = screen.height;
if (parseInt(navigator.appVersion)>3) {
	if (navigator.appName=="Netscape") {
		//winW = window.innerWidth;
		//winH = window.innerHeight;
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
	}
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
		//winW = window.innerWidth;
		//winH = window.innerHeight;
	}
	
}
//alert(window.innerWidth + ":" + window.innerHeight );
var sh = winH;
var sw = winW;
var sh2 = sh/2;
var sw2 = sw/2;

var topf = sh2 - popuph;
var leftf = sw2 - popupw2;


//alert(popuph2 + ":" + popuph + ":" + sh2 + ":" + sh + ":" + topf);
//alert(popupw2 + ":" + popupw + ":" + sw2 + ":" + sw + ":" + leftf);


document.getElementById('dvprocessing').style.display='none';
document.getElementById('dvregisterfrm').style.display='';
//document.getElementById('dvregisterfrm').style.height=10;
document.getElementById('dvregisterfrm').style.width=10;

//document.getElementById('dvregisterfrm').style.top=CalculateTop('316')+ "px";
//document.getElementById('dvregisterfrm').style.left=CalculateLeft('392')+ "px";

// binit comment
/*document.getElementById('dvregisterfrm').style.top= topf + "px";
*/
document.getElementById('dvregisterfrm').style.top=CalculateTop('550')+ "px";
document.getElementById('dvregisterfrm').style.left= leftf + "px";
// binit comment enddocument.getElementById('dvregisterfrm').style.left= leftf + "px";
	//alert(document.getElementById('dvregisterfrm').style.height);
	//alert(document.getElementById('dvregisterfrm').style.width);
document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;
unhideIframe();
}
}

function checkalluser()
	{
		var a,sel;

		
		if (document.frmflyeremaillist.chkHeader.checked == true)
		{
			sel = true;
		}
		else
		{
			sel = false;
		}
		for(var i=0;i<document.frmflyeremaillist.length;i++)
			{
                
				if (document.frmflyeremaillist.elements[i].type == "checkbox")
				{
					document.frmflyeremaillist.elements[i].checked = sel;
				
				}
			}
		//	alert(upperid);
	}
	
	function funsbmtviewflyer()
		{

			var testresults;
			var str=document.frmflyeremaillist.txtfrom.value;
			var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
			if (filter.test(str))
			testresults=true
			else{
	
			testresults=false
			}
			
		
			var con=0;
			var mailidlist="";
			for (var i=0; i<document.frmflyeremaillist.length; i++)
			{
				if(document.frmflyeremaillist.elements[i].type == "checkbox")
				{
					if ( document.frmflyeremaillist.elements[i].checked == true )
					{
						if(document.frmflyeremaillist.elements[i].value!="on")
						{
						mailidlist+=document.frmflyeremaillist.elements[i].value+",";
						con++;
						}
					}
				}
			}
			
			if (con==0 && document.frmflyeremaillist.txtareaemail.value=="")
			{
				alert('Please select atleast one Email Address');
				return false;
			}
			else
			{
				
				if(testresults==false)
				{
					alert("Please Enter Valid From Address");
					document.frmflyeremaillist.txtfrom.focus();
					return false;
				}
				else if(document.frmflyeremaillist.txtsubject.value=="")
				{
					alert("Please Enter Subject");
					document.frmflyeremaillist.txtsubject.focus();
					return false;
				}
				else if(document.frmflyeremaillist.txtmessage.value=="")
				{
					alert("Please Enter Text Message");
					document.frmflyeremaillist.txtmessage.focus();
					return false;
				}
				//alert("viewflyer.php?submit=submit&stype="+document.frmflyeremaillist.stype.value+"&mailidlist="+mailidlist);
				/*document.frmflyeremaillist.action="viewflyer.php?submit=submit&mailidlist="+mailidlist+"&stype="+document.frmflyeremaillist.stype.value;
				document.frmflyeremaillist.submit();*/
				
				var url="";
				if(document.frmflyeremaillist.seltype.value=="R")
				{
					url="recentemail.php";
					
				
				}
				else if(document.frmflyeremaillist.seltype.value=="M")
				{
					url="viewflyer.php";
				}
				else if(document.frmflyeremaillist.seltype.value=="S")
				{
					url="singlepropertyflyer.php";
				}
				
				url+="?submit=submit&mailidlist="+mailidlist+"&finlanintglcode="+document.frmflyeremaillist.finlanintglcode.value;
				url+="&txtareaemail="+document.frmflyeremaillist.txtareaemail.value+"&txtfrom="+document.frmflyeremaillist.txtfrom.value+"&txtsubject="+document.frmflyeremaillist.txtsubject.value+"&txtmessage="+document.frmflyeremaillist.txtmessage.value;
/*				alert(url);
*/				/*alert("in");*/
				xmlHttp=GetXmlHttpObject();
				if(xmlHttp==null)
				{
					alert("Browser does not support HTTP Request");
					return;
				}
				
				xmlHttp.open("GET",url,true);
				xmlHttp.onreadystatechange= stateChangeviewflyerformpop;
				
				xmlHttp.send(null);
				
			}
            return false;
		}
function stateChangeviewflyerformpop()
{
SetBackground();
if (xmlHttp.readyState == 1)
{
	ProcessLoader();
}
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	 document.getElementById('dvprocessing').style.display = 'none';
	 
	 var str = trim(xmlHttp.responseText, ' ');
	 var strlengthcount = str.length;
	 //alert(strlengthcount);
	 if(strlengthcount > 100)
	 {
	   
	   var popuph = 316;
			var popupw = 360;
			var popuph2 = popuph/2;
			var popupw2 = popupw/2;
			var winW = screen.width;
			var winH = screen.height;
			if (parseInt(navigator.appVersion)>3) {
				if (navigator.appName=="Netscape") {
					
					winW = document.body.offsetWidth;
					winH = document.body.offsetHeight;
				}
				if (navigator.appName.indexOf("Microsoft")!=-1) {
					winW = document.body.offsetWidth;
					winH = document.body.offsetHeight;
					
				}
				
			}
			
			var sh = winH;
			var sw = winW;
			var sh2 = sh/2;
			var sw2 = sw/2;
			
			var topf1 = sh2 - popuph;
			var leftf1 = sw2 - popupw2;
	
		
		document.getElementById('dvprocessing').style.display='none';
		document.getElementById('dvregisterfrm').style.display='';
		document.getElementById('dvregisterfrm').style.top=CalculateTop('470')+ "px";
		//document.getElementById('dvregisterfrm').style.top=topf1 + "px";
		document.getElementById('dvregisterfrm').style.left=leftf1 + "px";
			
		document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;
		unhideIframe();
	 }
	 else
	 {
		document.getElementById('dvregisterfrm').style.display = "none";
		if(trim(xmlHttp.responseText)=="Flyer")
		{
		 document.location.href= 'flyeremail.php?msg=1';
		}
		else
		{
			document.location.href= 'recentlyadded.php?msg=1';
		}
		 //unhideIframe();
	 }
 } 
}

function SendflyerEmail(userdo,id)
{
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	
	param="&finlanintglcode="+document.getElementById('finlanintglcode');
	param=param+"&mailidlist="+document.getElementById('mailidlist').value;
	param=param+"&txtareaemail="+document.getElementById('txtareaemail').value;
	
	param=param+"&txtfrom="+document.getElementById('txtfrom').value;
	param=param+"&txtsubject="+document.getElementById('txtsubject').value;
	param=param+"&txtmessage="+document.getElementById('txtmessage').value;
	
	var url="viewflyer.php?submit=submit";
	xmlHttp.setRequestHeader("Content-type", "multipart/form-data;");
	xmlHttp.onreadystatechange= stateChangeflyeremail;
	xmlHttp.open("GET",url+param,true);
	xmlHttp.send(null);
	
}


function stateChangeflyeremail()
{

		
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
	{
		 var str = trim(xmlHttp.responseText, ' ');
	 	var strlengthcount = str.length;
	 	//alert(xmlHttp.status);
	 /*alert(xmlHttp.responseText);*/
		
		reloadlistwidthalert("Emails are successfully send");
		
	}
}


function showfuturepropertyform(userdo,id)
{
	
	document.getElementById('conformid').style.display='none';
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	
	var url="addfeatureproperty.php?userdo="+userdo+"&uid="+id;
	
	xmlHttp.onreadystatechange= stateChangefuture;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function stateChangefuture()
{
SetBackground();
//alert(xmlHttp.readyState);
//alert(xmlHttp.responseText);
if(xmlHttp.readyState==1)
{
ProcessLoader();
}
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
{
<!--document.getElementById('dvprocessing').style.display='none';-->
//alert(xmlHttp.responseText);

var popuph = 200;
var popupw = 360;
var popuph2 = popuph/2;
var popupw2 = popupw/2;
var winW = screen.width;
var winH = screen.height;
if (parseInt(navigator.appVersion)>3) {
	if (navigator.appName=="Netscape") {
		//winW = window.innerWidth;
		//winH = window.innerHeight;
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
	}
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
		//winW = window.innerWidth;
		//winH = window.innerHeight;
	}
	
}
//alert(window.innerWidth + ":" + window.innerHeight );
var sh = winH;
var sw = winW;
var sh2 = sh/2;
var sw2 = sw/2;

var topf = sh2 - popuph;
var leftf = sw2 - popupw2;


//alert(popuph2 + ":" + popuph + ":" + sh2 + ":" + sh + ":" + topf);
//alert(popupw2 + ":" + popupw + ":" + sw2 + ":" + sw + ":" + leftf);


document.getElementById('dvprocessing').style.display='none';
document.getElementById('dvregisterfrm').style.display='';
document.getElementById('dvregisterfrm').style.height=10;
document.getElementById('dvregisterfrm').style.width=10;

//document.getElementById('dvregisterfrm').style.top=CalculateTop('316')+ "px";
//document.getElementById('dvregisterfrm').style.left=CalculateLeft('392')+ "px";

// binit comment
/*document.getElementById('dvregisterfrm').style.top= topf + "px";
*/
document.getElementById('dvregisterfrm').style.top=CalculateTop('211')+ "px";
// binit comment end
document.getElementById('dvregisterfrm').style.left= leftf + "px";
	//alert(document.getElementById('dvregisterfrm').style.height);
	//alert(document.getElementById('dvregisterfrm').style.width);
document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;
unhideIframe();
}


}




function showfindpropertyform(id,value)
{
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="findproperty.php?id="+value+"&tycode="+id;
	//param="&File1="+document.getElementById('file1').value;
	//alert(url);
	//xmlHttp.setRequestHeader("Content-type", "multipart/form-data;");
	xmlHttp.onreadystatechange= stateChangefindproperty;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
}


function stateChangefindproperty()
{

		
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
	{
		 //var str = trim(xmlHttp.responseText, ' ');
	 	var str=xmlHttp.responseText;
       //alert(str);

		 var array=str.split("$");
        //alert(array[1]);

        //alert(array[2]);
        //alert(array[2]);

		document.getElementById("propertylistbox").innerHTML=array[2];
		
	
		
	}
}


function chkfeaturepropertydetail()
{
	
	if(document.getElementById('fk_typeglcode').value == "PleaseSelect")
        {
            alert("Please Select Sell/Rent Type");
			document.getElementById('fk_typeglcode').focus();
			return false;
        }
    else if(document.getElementById('propertylist').value == "PleaseSelect")
        {
            alert("Please Select Property");
			document.getElementById('propertylist').focus();
			return false;
        }
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
         
	
		var url="addfeatureproperty.php?QT=1";
	param="&fk_listingglcode="+document.getElementById('propertylist').value;
	param=param+"&intdisplayorder="+document.getElementById('intdisplayorder').value;
	param=param+"&hiintdisplayorder="+trim(document.getElementById('hiintdisplayorder').value);
	param=param+"&userdo="+trim(document.getElementById('hduserdo').value);
	
	param=param+"&uid="+trim(document.getElementById('hduid').value);
	
		//alert(url+param);
		
		xmlHttp.open("GET",url+param,true)
		
		
		xmlHttp.onreadystatechange=stateChangefeaturepropertypopup
		xmlHttp.send(null)
	
}

function stateChangefeaturepropertypopup()
{
SetBackground();
if (xmlHttp.readyState == 1)
{
	ProcessLoader();
}
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	 document.getElementById('dvprocessing').style.display = 'none';
	 
	 var str = trim(xmlHttp.responseText, ' ');
	 var strlengthcount = str.length;
	 //alert(str);
	 //alert(strlengthcount);
	 if(strlengthcount > 3300)
	 {
	   
	   		var popuph = 200;
			var popupw = 360;
			var popuph2 = popuph/2;
			var popupw2 = popupw/2;
			var winW = screen.width;
			var winH = screen.height;
			if (parseInt(navigator.appVersion)>3) {
				if (navigator.appName=="Netscape") {
					
					winW = document.body.offsetWidth;
					winH = document.body.offsetHeight;
				}
				if (navigator.appName.indexOf("Microsoft")!=-1) {
					winW = document.body.offsetWidth;
					winH = document.body.offsetHeight;
					
				}
				
			}
			
			var sh = winH;
			var sw = winW;
			var sh2 = sh/2;
			var sw2 = sw/2;
			
			var topf1 = sh2 - popuph;
			var leftf1 = sw2 - popupw2;
	
		
		document.getElementById('dvprocessing').style.display='none';
		document.getElementById('dvregisterfrm').style.display='';
		
		//document.getElementById('dvregisterfrm').style.top=topf1 + "px";
		document.getElementById('dvregisterfrm').style.top=CalculateTop('211')+ "px";
		document.getElementById('dvregisterfrm').style.left=leftf1 + "px";
			//document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;
		document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;
		unhideIframe();
	 }
	 else
	 {
		/* document.getElementById('dvregisterfrm').style.display = "";*/
		 document.location.href= 'featurepropertylist.php?msg=1';
		/* alert("Your Records Are Successfully Saved");
		 reloadlist();*/
	 }
 } 
}

function showdevelopmentform(userdo,id)
{
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="adddevelopment.php?userdo="+userdo+"&uid="+id;
	xmlHttp.onreadystatechange= stateChangedevelopment;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function stateChangedevelopment()
{

		
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
	{
		 var str = trim(xmlHttp.responseText, ' ');
	 	var strlengthcount = str.length;
	 	//alert(xmlHttp.status);
	 /*alert(xmlHttp.responseText);*/
		
		document.getElementById("divuser").style.display='none';
		
		document.getElementById("addagent").innerHTML=xmlHttp.responseText;
		document.getElementById("addagent").style.display='';
		
	}
}



function chkdevelopmentdetail()
{
	
	if(document.getElementById('vardevelopment').value == "")
        {
            alert("Please Enter Development Name");
			document.getElementById('vardevelopment').focus();
			return false;
        }
   /* else if(document.getElementById('propertylist').value == "PleaseSelect")
        {
            alert("Please Select Property");
			document.getElementById('propertylist').focus();
			return false;
        }*/
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
         
	
		var url="adddevelopment.php?QT=1";
	param="&vardevelopment="+document.getElementById('vardevelopment').value;
	//param=param+"&chrhome="+document.getElementById('chrhome').value;
	//param=param+"&chrdisplay="+document.getElementById('chrdisplay').value;
	//param=param+"&FCKeditor1="+trim(document.getElementById('FCKeditor1').value);
	param=param+"&varpreviewdesc="+trim(document.getElementById('varpreviewdesc').value);
	param=param+"&intdisplayorder="+document.getElementById('intdisplayorder').value;
	param=param+"&hiintdisplayorder="+trim(document.getElementById('hiintdisplayorder').value);
	param=param+"&userdo="+trim(document.getElementById('hduserdo').value);
	param=param+"&uid="+trim(document.getElementById('hduid').value);
	if(document.getElementById('chrdisplay').checked==true)
	{
		param=param+"&chrdisplay=true";
	}
	else
	{
		param=param+"&chrdisplay=false";
	}
	
	if(document.getElementById('chrhome').checked==true)
	{
		param=param+"&chrhome=true";
	}
	else
	{
		param=param+"&chrhome=false";
	}
	
	
		var inst = FCKeditorAPI.GetInstance("FCKeditor1");
		var sValue = inst.GetHTML();
	param=param+"&FCKeditor1="+sValue;
	
		//alert(url+param);
		
		xmlHttp.open("GET",url+param,true)
		
		
		xmlHttp.onreadystatechange=stateChangedevelopmentpopup
		xmlHttp.send(null)
	
}

function stateChangedevelopmentpopup()
{
SetBackground();
if (xmlHttp.readyState == 1)
{
	ProcessLoader();
}
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	 document.getElementById('dvprocessing').style.display = 'none';
	 
	 var str = trim(xmlHttp.responseText, ' ');
	 var strlengthcount = str.length;
	 //alert(str);
	 //alert(strlengthcount);
	 if(strlengthcount > 3300)
	 {
	   
	   		var popuph = 200;
			var popupw = 360;
			var popuph2 = popuph/2;
			var popupw2 = popupw/2;
			var winW = screen.width;
			var winH = screen.height;
			if (parseInt(navigator.appVersion)>3) {
				if (navigator.appName=="Netscape") {
					
					winW = document.body.offsetWidth;
					winH = document.body.offsetHeight;
				}
				if (navigator.appName.indexOf("Microsoft")!=-1) {
					winW = document.body.offsetWidth;
					winH = document.body.offsetHeight;
					
				}
				
			}
			
			var sh = winH;
			var sw = winW;
			var sh2 = sh/2;
			var sw2 = sw/2;
			
			var topf1 = sh2 - popuph;
			var leftf1 = sw2 - popupw2;
	
		
		document.getElementById('dvprocessing').style.display='none';
		document.getElementById('dvregisterfrm').style.display='';
		
		//document.getElementById('dvregisterfrm').style.top=topf1 + "px";
		document.getElementById('dvregisterfrm').style.top=CalculateTop('211')+ "px";
		document.getElementById('dvregisterfrm').style.left=leftf1 + "px";
			//document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;
		document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;
		unhideIframe();
	 }
	 else
	 {
		/* document.getElementById('dvregisterfrm').style.display = "";
		 document.location.href= 'addfeatureproperty.php';*/
		 alert("Your Records Are Successfully Saved");
		 reloadlist();
	 }
 } 
}




function showimagepopup(imgpath,type)
{
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="showimg.php?imgpath="+imgpath+"&type="+type;
	xmlHttp.onreadystatechange= stateChangeshowimg;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function stateChangeshowimg()
{
SetBackground();
//alert(xmlHttp.readyState);
//alert(xmlHttp.responseText);
if(xmlHttp.readyState==1)
{
ProcessLoader();
}
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
{
<!--document.getElementById('dvprocessing').style.display='none';-->
//alert(xmlHttp.responseText);
var popuph = 200;
var popupw = 360;
var popuph2 = popuph/2;
var popupw2 = popupw/2;
var winW = screen.width;
var winH = screen.height;
if (parseInt(navigator.appVersion)>3) {
	if (navigator.appName=="Netscape") {
		//winW = window.innerWidth;
		//winH = window.innerHeight;
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
	}
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
		//winW = window.innerWidth;
		//winH = window.innerHeight;
	}
	
}
//alert(window.innerWidth + ":" + window.innerHeight );
var sh = winH;
var sw = winW;
var sh2 = sh/2;
var sw2 = sw/2;

var topf = sh2 - popuph;
var leftf = sw2 - popupw2;


//alert(popuph2 + ":" + popuph + ":" + sh2 + ":" + sh + ":" + topf);
//alert(popupw2 + ":" + popupw + ":" + sw2 + ":" + sw + ":" + leftf);


document.getElementById('dvprocessing').style.display='none';
document.getElementById('dvregisterfrm').style.display='';
//document.getElementById('dvregisterfrm').style.height=100;
document.getElementById('dvregisterfrm').style.width=10;

//document.getElementById('dvregisterfrm').style.top=CalculateTop('316')+ "px";
//document.getElementById('dvregisterfrm').style.left=CalculateLeft('392')+ "px";

// binit comment
/*document.getElementById('dvregisterfrm').style.top= topf + "px";
*/
document.getElementById('dvregisterfrm').style.top=CalculateTop('600')+ "px";
//document.getElementById('dvregisterfrm').style.top=CalculateTop('211')+ "px";
// binit comment end
document.getElementById('dvregisterfrm').style.left= leftf + "px";
	//alert(document.getElementById('dvregisterfrm').style.height);
	//alert(document.getElementById('dvregisterfrm').style.width);
document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;
unhideIframe();
}
}

function showchangegraphform(id)
{
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="graph.php?id="+id;
	//param="&File1="+document.getElementById('file1').value;
	alert(url);
	//xmlHttp.setRequestHeader("Content-type", "multipart/form-data;");
	xmlHttp.onreadystatechange= stateChangechangegraph
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	
}


function stateChangechangegraph()
{

		
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
	{
		 //var str = trim(xmlHttp.responseText, ' ');
	 	var str=xmlHttp.responseText;
       //alert(str);

		 var array=str.split("$");
        //alert(array[1]);

        //alert(array[2]);
        //alert(array[2]);

		document.getElementById('graphimage').src=array[1];
		
	
		
	}
}

function funpaymenthistory()
{
	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="paymenthistory.php";
	//alert(url);
	xmlHttp.onreadystatechange= stateChangepaymenthistory;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function stateChangepaymenthistory()
{
SetBackground();
//alert(xmlHttp.readyState);
//alert(xmlHttp.responseText);
if(xmlHttp.readyState==1)
{
ProcessLoader();
}
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
{
<!--document.getElementById('dvprocessing').style.display='none';-->
 //alert(xmlHttp.responseText);
var popuph = 200;
var popupw = 360;
var popuph2 = popuph/2;
var popupw2 = popupw/2;
var winW = screen.width;
var winH = screen.height;
if (parseInt(navigator.appVersion)>3) {
	if (navigator.appName=="Netscape") {
		//winW = window.innerWidth;
		//winH = window.innerHeight;
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
	}
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
		//winW = window.innerWidth;
		//winH = window.innerHeight;
	}
	
}
//alert(window.innerWidth + ":" + window.innerHeight );
var sh = winH;
var sw = winW;
var sh2 = sh/2;
var sw2 = sw/2;

var topf = sh2 - popuph;
var leftf = sw2 - popupw2;


//alert(popuph2 + ":" + popuph + ":" + sh2 + ":" + sh + ":" + topf);
//alert(popupw2 + ":" + popupw + ":" + sw2 + ":" + sw + ":" + leftf);


document.getElementById('dvprocessing').style.display='none';
document.getElementById('dvregisterfrm').style.display='';
//document.getElementById('dvregisterfrm').style.height=10;
document.getElementById('dvregisterfrm').style.width=332;

//document.getElementById('dvregisterfrm').style.top=CalculateTop('316')+ "px";
//document.getElementById('dvregisterfrm').style.left=CalculateLeft('392')+ "px";

// binit comment
/*document.getElementById('dvregisterfrm').style.top= topf + "px";
*/
document.getElementById('dvregisterfrm').style.top=CalculateTop('430')+ "px";
//document.getElementById('dvregisterfrm').style.top=CalculateTop('211')+ "px";
// binit comment end
document.getElementById('dvregisterfrm').style.left= leftf + "px";
	//alert(document.getElementById('dvregisterfrm').style.height);
	//alert(document.getElementById('dvregisterfrm').style.width);
document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;
unhideIframe();
}
}



function funflyerarray(id,type,checkin)
{
	//alert(id+type+checkin)
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	
	var url="flyersession.php?id="+id+"&type="+type+"&checkin="+checkin;
	xmlHttp.onreadystatechange= stateChangefunflyerarray;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function stateChangefunflyerarray()
{
//SetBackground();
//alert(xmlHttp.readyState);
//alert(xmlHttp.responseText);
if(xmlHttp.readyState==1)
{
//ProcessLoader();
}
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
{
document.getElementById('dvprocessing').style.display='none';
//alert(xmlHttp.responseText);
document.getElementById('ids').value=xmlHttp.responseText;

}
}


function funinquire(id)
{
	//alert(id)
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	
	var url="showinquiry.php?id="+id;
	//alert(url);
	xmlHttp.onreadystatechange= stateChangeinquire;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function stateChangeinquire()
{
SetBackground();
//alert(xmlHttp.readyState);
//alert(xmlHttp.responseText);
if(xmlHttp.readyState==1)
{
ProcessLoader();
}
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
{
<!--document.getElementById('dvprocessing').style.display='none';-->
 //alert(xmlHttp.responseText);
var popuph = 200;
var popupw = 360;
var popuph2 = popuph/2;
var popupw2 = popupw/2;
var winW = screen.width;
var winH = screen.height;
if (parseInt(navigator.appVersion)>3) {
	if (navigator.appName=="Netscape") {
		//winW = window.innerWidth;
		//winH = window.innerHeight;
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
	}
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
		//winW = window.innerWidth;
		//winH = window.innerHeight;
	}
	
}
//alert(window.innerWidth + ":" + window.innerHeight );
var sh = winH;
var sw = winW;
var sh2 = sh/2;
var sw2 = sw/2;

var topf = sh2 - popuph;
var leftf = sw2 - popupw2;


//alert(popuph2 + ":" + popuph + ":" + sh2 + ":" + sh + ":" + topf);
//alert(popupw2 + ":" + popupw + ":" + sw2 + ":" + sw + ":" + leftf);


document.getElementById('dvprocessing').style.display='none';
document.getElementById('dvregisterfrm').style.display='';
//document.getElementById('dvregisterfrm').style.height=10;
document.getElementById('dvregisterfrm').style.width=332;

//document.getElementById('dvregisterfrm').style.top=CalculateTop('316')+ "px";
//document.getElementById('dvregisterfrm').style.left=CalculateLeft('392')+ "px";

// binit comment
/*document.getElementById('dvregisterfrm').style.top= topf + "px";
*/
document.getElementById('dvregisterfrm').style.top=CalculateTop('430')+ "px";
//document.getElementById('dvregisterfrm').style.top=CalculateTop('211')+ "px";
// binit comment end
document.getElementById('dvregisterfrm').style.left= leftf + "px";
	//alert(document.getElementById('dvregisterfrm').style.height);
	//alert(document.getElementById('dvregisterfrm').style.width);
document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;
unhideIframe();
}
}


/*  For NEWS ADD edit delete*/
function showAddnewNewsForm(userdo,id,pagenumber,srhtxt,srhopt,order_field,order_type)
{
		//alert("For open opop");
	document.getElementById('conformid').style.display='none';
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="addnews.php?userdo="+userdo+"&uid="+id+"&pagenumber="+pagenumber+"&srhtxt="+srhtxt+"&srhopt="+srhopt+"&order_field="+order_field+"&order_type="+order_type;
	xmlHttp.onreadystatechange= stateChangeNewsList;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function stateChangeNewsList()
{
SetBackground();
//alert(xmlHttp.readyState);
//alert(xmlHttp.responseText);
if(xmlHttp.readyState==1)
{
ProcessLoader();
}
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
{
<!--document.getElementById('dvprocessing').style.display='none';-->
//alert(xmlHttp.responseText);
var popuph = 200;
var popupw = 360;
var popuph2 = popuph/2;
var popupw2 = popupw/2;
var winW = screen.width;
var winH = screen.height;
if (parseInt(navigator.appVersion)>3) {
	if (navigator.appName=="Netscape") {
		//winW = window.innerWidth;
		//winH = window.innerHeight;
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
	}
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
		//winW = window.innerWidth;
		//winH = window.innerHeight;
	}
	
}
//alert(window.innerWidth + ":" + window.innerHeight );
var sh = winH;
var sw = winW;
var sh2 = sh/2;
var sw2 = sw/2;

var topf = sh2 - popuph;
var leftf = sw2 - popupw2;


//alert(popuph2 + ":" + popuph + ":" + sh2 + ":" + sh + ":" + topf);
//alert(popupw2 + ":" + popupw + ":" + sw2 + ":" + sw + ":" + leftf);


document.getElementById('dvprocessing').style.display='none';
document.getElementById('addeditpanel').style.display='';
//document.getElementById('dvregisterfrm').style.display='';
//document.getElementById('dvregisterfrm').style.height=10;
//document.getElementById('dvregisterfrm').style.width=10;

//document.getElementById('dvregisterfrm').style.top=CalculateTop('316')+ "px";
//document.getElementById('dvregisterfrm').style.left=CalculateLeft('392')+ "px";

// binit comment
/*document.getElementById('dvregisterfrm').style.top= topf + "px";
*/
//document.getElementById('dvregisterfrm').style.top=CalculateTop('430')+ "px";
//document.getElementById('dvregisterfrm').style.top=CalculateTop('211')+ "px";
// binit comment end
//document.getElementById('dvregisterfrm').style.left= leftf + "px";
	//alert(document.getElementById('dvregisterfrm').style.height);
	//alert(document.getElementById('dvregisterfrm').style.width);

document.getElementById("addeditpanel").innerHTML=xmlHttp.responseText;

document.getElementById('dimmer').style.width=0;
document.getElementById('dimmer').style.height=0;
//document.getElementById('dimmer').style.visibility="hidden";
document.getElementById('dimmer').style.dispalay="none";

unhideIframe();

//document.getElementById('dimmer').style.width=0;
//document.getElementById('dimmer').style.height=0;
//document.getElementById('dimmer').style.visibility="hidden";
//document.getElementById('dimmer').style.dispalay="none";
//alert(document.getElementById('dimmer').style.dispalay=="none");
}
}



function AddNewNews()
{
	
		
	
	if(trim(document.getElementById('vartitle').value) == "")
        {
            alert("Please Enter News Title");
			document.getElementById('vartitle').focus();
			return false;
        }
    else if(trim(document.getElementById('varcontent').value) == "")
        {
            alert("Please Enter News Content");
			document.getElementById('varcontent').focus();
			return false;
        }
			
	param="&vartitle="+document.getElementById('vartitle').value;
	param=param+"&varcontent="+document.getElementById('varcontent').value;
	
	if(document.getElementById('chrdisplay').checked==true)
	{
		param=param+"&chrdisplay=Y";
	}
	else
	{
		param=param+"&chrdisplay=N";
	}


	if(document.getElementById('chrhomepage').checked==true)
	{
		param=param+"&chrhomepage=Y";
	}
	else
	{
		param=param+"&chrhomepage=N";
	}


	//param=param+"&intdisplayorder="+trim(document.getElementById('intdisplayorder').value);
	param=param+"&hiintdisplayorder="+trim(document.getElementById('hiintdisplayorder').value);
	param=param+"&userdo="+trim(document.getElementById('hduserdo').value);
	
	param=param+"&uid="+trim(document.getElementById('hduid').value);
	
		param=param+"&pagenumber="+trim(document.getElementById('pagenumber').value);
		param=param+"&order_field="+trim(document.getElementById('order_field').value);
		param=param+"&order_type="+trim(document.getElementById('order_type').value);
		param=param+"&srhopt="+trim(document.getElementById('srhopt').value);
		param=param+"&srhtxt="+trim(document.getElementById('srhtxt').value);
	
	
	xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
         
		
		var url="addnews.php?QT=1";
		
		//alert(url+param);
		
		xmlHttp.open("GET",url+param,true)
		
		
		xmlHttp.onreadystatechange=stateChangeAddnewNews;
		xmlHttp.send(null)
	
}

function stateChangeAddnewNews()
{
SetBackground();
if (xmlHttp.readyState == 1)
{
	ProcessLoader();
}
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	 document.getElementById('dvprocessing').style.display = 'none';
	 
	 var str = trim(xmlHttp.responseText, ' ');
	 var strlengthcount = str.length;
	 //alert(strlengthcount);
	 if(strlengthcount > 3300)
	 {
	   
	   		var popuph = 200;
			var popupw = 360;
			var popuph2 = popuph/2;
			var popupw2 = popupw/2;
			var winW = screen.width;
			var winH = screen.height;
			if (parseInt(navigator.appVersion)>3) {
				if (navigator.appName=="Netscape") {
					
					winW = document.body.offsetWidth;
					winH = document.body.offsetHeight;
				}
				if (navigator.appName.indexOf("Microsoft")!=-1) {
					winW = document.body.offsetWidth;
					winH = document.body.offsetHeight;
					
				}
				
			}
			
			var sh = winH;
			var sw = winW;
			var sh2 = sh/2;
			var sw2 = sw/2;
			
			var topf1 = sh2 - popuph;
			var leftf1 = sw2 - popupw2;
	
		
		document.getElementById('dvprocessing').style.display='none';
		
		//document.getElementById('dvregisterfrm').style.display='';
		
		//document.getElementById('dvregisterfrm').style.top=topf1 + "px";
		//document.getElementById('dvregisterfrm').style.left=leftf1 + "px";
		//document.getElementById('dvregisterfrm').style.top=CalculateTop('430')+ "px";
		//document.getElementById("dvregisterfrm").innerHTML=xmlHttp.responseText;
		//var messagepanel = '<table width=98% border=0 cellpadding=0 cellspacing=0 class=message_panel><tr>'+
		//					'<td height=30px><span class=errormessage>asdasdasd</span></td></tr></table>';
	     //var messagepanel = "error";		
		//document.getElementById("dvmessagepanel").innerHTML=messagepanel;					
		//document.getElementById("dvmessagepanel").style.display='';					
		unhideIframe();
		
		document.getElementById('dimmer').style.width=0;
		document.getElementById('dimmer').style.height=0;
        document.getElementById('dimmer').style.visibility="hidden";
	//	alert('This email id is already exist.');
	 }
	 else
	 {
		 param=param+"&pagenumber="+trim(document.getElementById('pagenumber').value);
		param=param+"&order_field="+trim(document.getElementById('order_field').value);
		param=param+"&order_type="+trim(document.getElementById('order_type').value);
		param=param+"&srhopt="+trim(document.getElementById('srhopt').value);
		param=param+"&srhtxt="+trim(document.getElementById('srhtxt').value);
		
		 document.location.href="newslist.php?msg=1"+param;
	 }
 } 
}

 /*rates*/

function showratesform(userdo,id,pagenumber,srhtxt,srhopt,order_field,order_type)
{
	document.getElementById('conformid').style.display='none';
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url="addrates.php?userdo="+userdo+"&uid="+id+"&pagenumber="+pagenumber+"&srhtxt="+srhtxt+"&srhopt="+srhopt+"&order_field="+order_field+"&order_type="+order_type;
//    alert(url);
	xmlHttp.onreadystatechange= stateChangerates;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


function stateChangerates()
{
SetBackground();
//alert(xmlHttp.readyState);
//alert(xmlHttp.responseText);
if(xmlHttp.readyState==1)
{
ProcessLoader();
}
if((xmlHttp.readyState==4||xmlHttp.readyState=="complete")&&(xmlHttp.status==200))
{
<!--document.getElementById('dvprocessing').style.display='none';-->
//alert(xmlHttp.responseText);
var popuph = 200;
var popupw = 360;
var popuph2 = popuph/2;
var popupw2 = popupw/2;
var winW = screen.width;
var winH = screen.height;
if (parseInt(navigator.appVersion)>3) {
	if (navigator.appName=="Netscape") {
		//winW = window.innerWidth;
		//winH = window.innerHeight;
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
	}
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		winW = document.body.offsetWidth;
		winH = document.body.offsetHeight;
		//winW = window.innerWidth;
		//winH = window.innerHeight;
	}

}
//alert(window.innerWidth + ":" + window.innerHeight );
var sh = winH;
var sw = winW;
var sh2 = sh/2;
var sw2 = sw/2;

var topf = sh2 - popuph;
var leftf = sw2 - popupw2;


//alert(popuph2 + ":" + popuph + ":" + sh2 + ":" + sh + ":" + topf);
//alert(popupw2 + ":" + popupw + ":" + sw2 + ":" + sw + ":" + leftf);


document.getElementById('dvprocessing').style.display='none';
document.getElementById('addeditpanel').style.display='';
//document.getElementById('dvregisterfrm').style.display='';
//document.getElementById('dvregisterfrm').style.height=10;
//document.getElementById('dvregisterfrm').style.width=10;

//document.getElementById('dvregisterfrm').style.top=CalculateTop('316')+ "px";
//document.getElementById('dvregisterfrm').style.left=CalculateLeft('392')+ "px";

// binit comment
/*document.getElementById('dvregisterfrm').style.top= topf + "px";
*/
//document.getElementById('dvregisterfrm').style.top=CalculateTop('430')+ "px";
//document.getElementById('dvregisterfrm').style.top=CalculateTop('211')+ "px";
// binit comment end
//document.getElementById('dvregisterfrm').style.left= leftf + "px";
	//alert(document.getElementById('dvregisterfrm').style.height);
	//alert(document.getElementById('dvregisterfrm').style.width);
document.getElementById("addeditpanel").innerHTML=xmlHttp.responseText;
//unhideIframe();
//here
document.getElementById('dimmer').style.width=0;
document.getElementById('dimmer').style.height=0;
document.getElementById('dimmer').style.visibility="hidden";
}
}

function KeycheckOnlyPhonenumber(e)
	{
		alert('hello');
	   var _dom = 0;
		_dom=document.all?3:(document.getElementById?1:(document.layers?2:0));
		if(document.all) e=window.event; // for IE
		var ch='';
		var KeyID = '';
		
		if(_dom==2){                     // for NN4
			//alert(e.which);
			if(e.which>0) ch='('+String.fromCharCode(e.which)+')';
			KeyID=e.which;
		}
		else
		{
			if(_dom==3){                   // for IE
				KeyID = (window.event) ? event.keyCode : e.which;
			}
			else {                       // for Mozilla
				//alert('Mozilla:' + e.charCode);
				if(e.charCode>0) ch='('+String.fromCharCode(e.charCode)+')';
				KeyID=e.charCode;
			}
		}
	
		if((KeyID >= 65 && KeyID <= 90) || (KeyID >= 97 && KeyID <= 122) || (KeyID >= 33 && KeyID <= 39) || (KeyID >= 42 && KeyID <= 44) || (KeyID >= 46 && KeyID <= 47) || (KeyID >= 58 && KeyID <= 64) || (KeyID >= 91 && KeyID <= 96) || (KeyID >= 123 && KeyID <= 126))	
		{
			//alert("hello");
			return false;
		}
		
		return true;
	}
////////////vishnu patel///////////////////////
function onlyNumeric(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
	//alert(charCode);

	if(charCode == 40 || charCode == 41 || charCode == 45 || charCode == 32)
	{
		return true;
	}
	else if (charCode > 31 && (charCode < 48 || charCode > 57))
	{
		return false;
	}
	else
	{
		return true;
	}
}
/* ---------- Added by Ravi - 19 FEB 10-----------------*/
//This function caculates the all the charges for reservation and set it to hidden fields
function calculate_amount_new()
{
    var total_nights = document.reservation.night.value;
    var totoal_weeks = 0;
    var days_to_calculate = 0;
    var total_cost = 0;

    var arrival_date_str = document.reservation.arrival.value;
    var departure_date_str = document.reservation.depture.value;
    var arrival_date = new Date(arrival_date_str);
    var departure_date = new Date(departure_date_str);
    var arrival_month = arrival_date.getMonth();
    var departure_month = departure_date.getMonth();
        var i=0;
    var two_durations_exists = 0;
    var first_duration_cost = 0;
    var second_duration_cost = 0;

    var cost_for_current_duration = 0;
    var last_duration = false;

    var update_arrival_date = new Date(arrival_date_str);

        for(i=0;i<fixed_rates.length;i++)
        {
            cost_for_current_duration = 0;
            
//            alert('arrival : '+arrival_date+', depart : '+departure_date+', start : '+fixed_rates[i][0]+', end : '+fixed_rates[i][1]+', i : '+i+', update arrive date : '+update_arrival_date);
            
            if(arrival_date >= fixed_rates[i][0] && arrival_date <= fixed_rates[i][1] && departure_date >= fixed_rates[i][0] && departure_date <= fixed_rates[i][1])
            {//start date and end date in same fixed_rates array durations
                days_to_calculate = total_nights % 7;
                totoal_weeks = parseInt(total_nights / 7);
                total_cost += (totoal_weeks * fixed_rates[i][2]) + (days_to_calculate * fixed_rates[i][3]);
                two_durations_exists++;
            }
            else if(arrival_date >= fixed_rates[i][0] && arrival_date <= fixed_rates[i][1])
            {
                var total_days_in_this_duration = ((fixed_rates[i][1] - arrival_date) / (1000*60*60*24));
                total_days_in_this_duration = total_days_in_this_duration + 1;
                days_to_calculate = total_days_in_this_duration % 7;
                totoal_weeks = parseInt(total_days_in_this_duration / 7);
//                if(days_to_calculate!=0 && days_to_calculate!=6)
//                {
//                    days_to_calculate = days_to_calculate + 1;
//                }
//                if(days_to_calculate==6)
//                {
//                    days_to_calculate = 0;
//                    totoal_weeks = totoal_weeks + 1;
//                }
                
                //total_cost += (totoal_weeks * fixed_rates[i][2]) + (days_to_calculate * fixed_rates[i][3]);

//                alert('totoal_weeks : '+totoal_weeks+', days_to_calculate : '+days_to_calculate+', total_days_in_this_duration2 : '+total_days_in_this_duration2);

                cost_for_current_duration = (totoal_weeks * fixed_rates[i][2]) + (days_to_calculate * fixed_rates[i][3]);
                first_duration_cost = parseFloat(fixed_rates[i][3]);
                two_durations_exists++;
                update_arrival_date = fixed_rates[i+1][0];
                last_duration = true;
//                alert('case 1 : '+i);
            }
            else if(departure_date >= fixed_rates[i][0] && departure_date <= fixed_rates[i][1] && last_duration==true)
            {
                var total_days_in_this_duration2 = ((departure_date - fixed_rates[i][0]) / (1000*60*60*24));

                days_to_calculate = total_days_in_this_duration2 % 7;
                totoal_weeks = parseInt(total_days_in_this_duration2 / 7);
                
                //total_cost += (totoal_weeks * fixed_rates[i][2]) + (days_to_calculate * fixed_rates[i][3]);
                cost_for_current_duration = (totoal_weeks * fixed_rates[i][2]) + (days_to_calculate * fixed_rates[i][3]);
                two_durations_exists++;
                second_duration_cost = parseFloat(fixed_rates[i][3]);
//                alert('case 2 : '+i);
            }
            else if(update_arrival_date >= fixed_rates[i][0] && update_arrival_date <= fixed_rates[i][1])
            {//for inner durations
                var total_days_in_this_duration = ((fixed_rates[i][1] - update_arrival_date) / (1000*60*60*24));


                total_days_in_this_duration = total_days_in_this_duration + 1;
                days_to_calculate = total_days_in_this_duration % 7;
                totoal_weeks = parseInt(total_days_in_this_duration / 7);
//                if(days_to_calculate!=0 && days_to_calculate!=6)
//                {
//                    days_to_calculate = days_to_calculate + 1;
//                }
//                if(days_to_calculate==6)
//                {
//                    days_to_calculate = 0;
//                    totoal_weeks = totoal_weeks + 1;
//                }

                
                //total_cost += (totoal_weeks * fixed_rates[i][2]) + (days_to_calculate * fixed_rates[i][3]);
                cost_for_current_duration = (totoal_weeks * fixed_rates[i][2]) + (days_to_calculate * fixed_rates[i][3]);
                first_duration_cost = parseFloat(fixed_rates[i][3]);
                two_durations_exists++;
                update_arrival_date = fixed_rates[i+1][0];
//                alert('case 3 : '+i);
                last_duration = true;
            }
            else
            {

            }
            
            total_cost += cost_for_current_duration;
//            alert('cost_for_current_duration : '+cost_for_current_duration+' and i '+i);
        }

//        if(two_durations_exists > 1)
//        {
//            total_cost = (total_cost + first_duration_cost);
//        }
//        else
//        {
//        }
//        alert('two_durations_exists : '+two_durations_exists);
//        alert('first_duration_cost : '+first_duration_cost);

//        alert('total_cost : '+total_cost);
        document.reservation.hdtotaldayamount.value = total_cost;
        if(total_nights<=additionalcleaningfeenights)
        {
            total_cost = total_cost + cleaningfee;
            document.reservation.hdcleaningfee.value = cleaningfee;
        }
        else
        {
            document.reservation.hdcleaningfee.value = '0';
        }
//        alert('2 : '+total_cost);

        
        //add grill
        if(document.getElementById('barbecuegrill').checked)
        {
            total_cost = total_cost + barbecue_cost;
            document.reservation.hdgrillamount.value = barbecue_cost;
        }

        if(document.getElementById('poolheat').checked)
        {
            var final_pool_heat = (decpoolheat*total_nights);
            total_cost = total_cost + final_pool_heat;
            document.reservation.hdpoolheat.value = final_pool_heat;
        }
        else
        {
            document.reservation.hdpoolheat.value = "0";
        }

//        alert('3 : '+total_cost);
        var finaltax = (total_cost*additionaltax/100);
        document.reservation.hdaddtax.value = finaltax;
        total_cost = total_cost+finaltax;//add 13%
//        alert('addpoolheat is : '+addpoolheat);
        
        

        if(document.getElementById('sdi').checked)
        {
            total_cost = total_cost + securitydepositinsurance;//39
            document.reservation.hddeposit123.value = securitydepositinsurance;
        }
        else
        {
            total_cost = total_cost + securitydeposits;//250
            document.reservation.hddeposit123.value = securitydeposits;
        }
        
        document.reservation.amount.value = total_cost;
        document.reservation.dbamount.value = total_cost;

        
        
}

var popupWindow = null;
function positionedPopup(url,winName,w,h,t,l,scroll){
settings =
'height='+h+',width='+w+',top='+t+',left='+l+',scrollbars='+scroll+',resizable'
popupWindow = window.open(url,winName,settings)
}

/* ---------- Added by Ravi ------------------*/


