


	function sanDiegoQuestion(){

		tb_show("",SITE_PATH+"component/san-diego-question.php?flag=index&height=365&width=710","");
	}


function getGeoCityList(stateAbbr)
{
	var para="action=getCityList";
	if(stateAbbr!=undefined)
	{
		para+="&stateAbbr="+stateAbbr;
	}
	$jq.ajax({
	type: "POST",
	url: SITE_PATH+"ajax/getAjax.php",
	async: true,
	global: true,
	timeout: 30000,
	data: para,
	success: function(result){
		document.getElementById('geoCity').innerHTML=result;

	},
	error: function(request, settings, execp)
	{
		$jq('#loddivcont').empty();
		$jq('#loddivcont').html("<br><b>An error occurred, please try again.</b>");

	}
	});
}

function trim(str)
{
    return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
}


function changemapView(map_type,preLat,preLng)
{

	var Location=document.getElementById('propertySearchLocation2').value;
	var propType=document.getElementById('mapAuctionType').value;
	/*if(propType=='commercial' || propType=='notes')
	{
	document.getElementById('mapMinPrice').style.display='none';

	document.getElementById('mapMaxPrice').style.display='none';
	document.getElementById('mapMinPriceTitle').style.display='none';
	}
	else
	{
	document.getElementById('mapMinPrice').style.display='';
	document.getElementById('mapMaxPrice').style.display='';
	document.getElementById('mapMinPriceTitle').style.display='';

	var minPrice=document.getElementById('mapMinPrice').value;
	var maxPrice=document.getElementById('mapMaxPrice').value;
	} */
	var para;


	if(Location == null || Location == "")
	{
	alert("Please enter location");
	}
    else
	{
			// area not found condition added here
			// check area not found here
			if(map_type==null || map_type=="")
			{
			//var addr=Location+","+Location;
                        var addr = '';
                        
                        if(Location.search(",") == -1){
                            addr=Location+", USA"+","+Location+", USA";
                        }else{
                            addrArray = Location.split(",");
                            if(trim(addrArray[1]) != ''){
                                addr=Location+","+Location;
                            }else{
                                addr=addrArray[0]+", USA"+","+addrArray[0]+", USA";
                            }                            
                        }
                        
			var point2;
			if (geocoder) {

			geocoder.getLatLng(addr,function(point2){
			if(point2== null)
			 {
				if(document.getElementById('not-found'))
				document.getElementById('not-found').style.display='';
				zoomChanged=false;
				dbclick=false;
				maploaded=true;
				document.getElementById('geoCity').value=document.getElementById('lastGeoCity').value;

			 }
			 else
			{
				//document.getElementById('geoCity').value=Location;                                
				setMapViewTypeSearch('G_NORMAL_MAP');
				loadMapSearch();
                                
                                if(Location.search(",") == -1){
                                    document.getElementById('geoCity').value=Location+", USA";
                                    LoadMapAddress(Location+", USA",Location+", USA",Location+", USA",Location+", USA",'');
                                }else{
                                    addrArray = Location.split(",");
                                    if(trim(addrArray[1]) != ''){
                                        document.getElementById('geoCity').value=Location;
                                        LoadMapAddress(Location,Location,Location,Location,'');
                                    }else{
                                        document.getElementById('geoCity').value=addrArray[1]+", USA";
                                        LoadMapAddress(addrArray[0]+", USA",addrArray[0]+", USA",addrArray[0]+", USA",addrArray[0]+", USA",'');
                                    }                            
                                }
			}

			 });



			 } // geocoder close here
			 else
                        {
				// to resolve sd landing (page  error map not working) Added by Mayank: 11-07:-2011
                            document.getElementById('geoCity').value=Location;
                            setMapViewTypeSearch('G_NORMAL_MAP');
                            loadMapSearch();
                            //LoadMapAddress(Location,Location,Location,Location,'');
                            if(Location.search(",") == -1){                                        
                                LoadMapAddress(Location+", USA",Location+", USA",Location+", USA",Location+", USA",'');
                            }else{
                                addrArray = Location.split(",");
                                if(trim(addrArray[1]) != ''){                                           
                                    LoadMapAddress(Location,Location,Location,Location,'');
                                }else{                                            
                                    LoadMapAddress(addrArray[0]+", USA",addrArray[0]+", USA",addrArray[0]+", USA",addrArray[0]+", USA",'');
                                }                            
                            }
                        }

			 }
			else
			{
	                document.getElementById('map-search-result').innerHTML="<span><img src='"+AJAX_PATH+"images/map_result_loader.gif'></span>";
			if(map_type!=null && map_type=="banner_map")
			{

			set_map_view_tye_banner('G_NORMAL_MAP');
			load_map_banner();
			//LoadMapAddress(Location,Location,Location,Location,'');
                            if(Location.search(",") == -1){                                        
                                LoadMapAddress(Location+", USA",Location+", USA",Location+", USA",Location+", USA",'');
                            }else{
                                addrArray = Location.split(",");
                                if(trim(addrArray[1]) != ''){                                           
                                    LoadMapAddress(Location,Location,Location,Location,'');
                                }else{                                            
                                    LoadMapAddress(addrArray[0]+", USA",addrArray[0]+", USA",addrArray[0]+", USA",addrArray[0]+", USA",'');
                                }                            
                            }
			}

			}

	}
}

function latLongMapView(lat,lng,distance,southWest_lat,southWest_lng,northEast_lat,northEast_lng,globalSearchProCount,globalMapSearch,trusteeSale)
{

	var Location=document.getElementById('propertySearchLocation2').value;
	var propType=document.getElementById('mapAuctionType').value;

	if(trusteeSale != undefined && trusteeSale=='Yes')
	{
	propType='trustee';

	}

	
	document.getElementById('map-search-result').innerHTML="<span style='font-size:11px;color:green'><img src='"+AJAX_PATH+"images/map_result_loader.gif'>  Loading....</span>";
	 if (objHttpFileDataRequest !=null ) // abort request to call ajax multiple time when zoom or move
		{
		// Abort the AJAX Search request.
		objHttpFileDataRequest.abort();
		}
	objHttpFileDataRequest=null;
	mm.clearMarkers();
	var para='';
        var propTypeCheckList='';
        
        var chks = document.getElementsByName('mapSearchCheckBox[]');   
        for (var i = 0; i < chks.length; i++)
        {
        if (chks[i].checked)
        {        
        propTypeCheckList+=chks[i].value+'|';
        //hasChecked = true;
        }
        }
       

					if(lat!=undefined)
					{
						para+="&lat="+lat;
						// show result as a list changes
						document.getElementById('lat').value=lat;
					}

					if(lng!=undefined)
					{
						para+="&lng="+lng;
						// show result as a list changes
						document.getElementById('lng').value=lng;
					}
					if(distance!=undefined)
					{
						para+="&distance="+distance;
						// show result as a list changes
						document.getElementById('distance').value=distance;
					}

					if(Location!=undefined)
					{
						para+="&location="+Location;
					}
					if(propType!=undefined)
					{
						para+="&propType="+propType;
						// show result as a list changes
						document.getElementById('propType').value=propType;
					}
                                        if(propTypeCheckList!='')
					{
						para+="&propTypeCheckList="+propTypeCheckList;
						// show result as a list changes
						//document.getElementById('propType').value=propType;
					}
                                                                              
					// To search records in the bound Area Conditon
					if(southWest_lng!=undefined)
					{
					// show result as a list changes
						document.getElementById('southWest_lat').value=southWest_lat;
						document.getElementById('southWest_lng').value=southWest_lng;
						document.getElementById('northEast_lat').value=northEast_lat;
						document.getElementById('northEast_lng').value=northEast_lng;
						// end here
						para+="&southWest_lat="+southWest_lat+"&southWest_lng="+southWest_lng+"&northEast_lat="+northEast_lat+"&northEast_lng="+northEast_lng;
					}
					// pass site path varialbe to get segment on map
					if(SITE_PATH!=undefined)
					{
						para+="&SITE_PATH="+SITE_PATH;
					}

					if(document.getElementById('globalMap_auctionType'))
					var auctionType=document.getElementById('globalMap_auctionType').value;

					if(document.getElementById('mapAuctionType'))
					{
					var map_auctionType=document.getElementById('mapAuctionType').value;
					para+="&map_auctionType="+map_auctionType;
					}
                                             
					if(document.getElementById('globalMapSearch') && document.getElementById('globalMapSearch').value == "1")
					{
					// global search paramerts added here
					if(document.getElementById('globalMap_propertyType'))
					{
					para+="&propertyType="+document.getElementById('globalMap_propertyType').value;
					}

					if(auctionType!=undefined && auctionType=="allAssetType")
					{
					  para+="&propertyType_Res="+document.getElementById('globalMap_propertyType_Res').value;
					  para+="&propertyType_Com="+document.getElementById('globalMap_propertyType_Com').value;
					   para+="&propertyType_Notes="+document.getElementById('globalMap_propertyType_Notes').value;
					}
					// ANY TYPE SEARCH


					if(document.getElementById('globalMap_YearBuilt'))
					para+="&YearBuilt="+document.getElementById('globalMap_YearBuilt').value;
					if(document.getElementById('globalMap_area'))
					para+="&area="+document.getElementById('globalMap_area').value;

					//if(document.getElementById('globalMap_maxPrice'))
					//para+="&maxPrice="+document.getElementById('globalMap_maxPrice').value;
					//if(document.getElementById('globalMap_minPrice'))
					//para+="&minPrice="+document.getElementById('globalMap_minPrice').value;
					if(document.getElementById('globalMap_minbath'))
					para+="&minbath="+document.getElementById('globalMap_minbath').value;
					if(document.getElementById('globalMap_maxbath'))
					para+="&maxbath="+document.getElementById('globalMap_maxbath').value;
					if(document.getElementById('globalMap_minbed'))
					para+="&minbed="+document.getElementById('globalMap_minbed').value;
					if(document.getElementById('globalMap_maxbed'))
					para+="&maxbed="+document.getElementById('globalMap_maxbed').value;


					}
					if(document.getElementById('updateGmapCache').value=='Yes')
					{
					para+="&updateGmapCache=Yes";

					}

                                        if(document.getElementById('start'))
					para+="&start="+parseInt(document.getElementById('start').value);



		objHttpFileDataRequest=$jq.ajax({
			type: "POST",
			url: AJAX_PATH+"ajax/getMapSearch.php",
			async: true,
			global: true,
			timeout: 30000,
			data: para,
			success: function(result){
			// update quick search
			//document.getElementById('quick-search').innerHTML="Quick Search: show results within 50 miles of "+Location;


			//if(document.getElementById('updateGmapCache').value=="Yes")
			//{
			//document.getElementById('propertySearchLocation').value=Location;
			document.getElementById('updateGmapCache').value='';
			//}
			//document.getElementById("quick-search").onclick = function(){
			//quickSearch(Location);
				//}

			// ******
			// update code start from here 
		      // alert(result) ;

			        var propMarkersDelay;
                                var mainArr = result.split('~~~');
				var addrsArr=mainArr[0].split('|||');
				var addrsLen=addrsArr.length;
				if(addrsLen<=1)
				addrsLen=0;
                                else
                                    {
                                var addrUnitArr=addrsArr[0].split("!!!");                               
                                var auctionTypes=addrUnitArr[20];
                                var typeArr=auctionTypes.split("-");                    
                                
                                if(typeArr.length>1)
                                 {   
                                    var LuxaryMapFilter=false;
                                    var BankownedMapFilter=false;
                                    var TrusteeMapFilter=false;
                                 }
                                 else
                                 {
                                    var LuxaryMapFilter=true;
                                    var BankownedMapFilter=true;
                                    var TrusteeMapFilter=true;
                                 }
                                for(var k=0;k<typeArr.length-1;k++)
                                    {
                                      
                                        if(typeArr[k]=='trustee')
                                        TrusteeMapFilter=true;
                                        else if(typeArr[k]=='bankOwnedHomes')
                                        BankownedMapFilter=true;
                                        else if(typeArr[k]=='luxury')
                                        LuxaryMapFilter=true;                             
                                     
                                    }                             

                                    }
				var fullAddress='';
                                
				for(var i=0;i<addrsLen;i++)
				{


					if(addrsArr[i]!='')
					{
						var addrUnitArr=addrsArr[i].split("!!!");
						fullAddress=addrUnitArr[0]+" "+addrUnitArr[1]+" "+addrUnitArr[2]+" "+addrUnitArr[3];
                                                
                                                
						showMapAddressSearch(addrUnitArr[0],addrUnitArr[1],addrUnitArr[2],fullAddress,addrUnitArr[4],addrUnitArr[5],addrUnitArr[6],addrUnitArr[7],addrUnitArr[8],addrUnitArr[9],addrUnitArr[10],addrUnitArr[11],addrUnitArr[12],addrUnitArr[13],addrUnitArr[14],addrUnitArr[15],addrUnitArr[16],addrUnitArr[17],addrUnitArr[18],addrUnitArr[19],addrUnitArr[20],addrUnitArr[21],TrusteeMapFilter,BankownedMapFilter,LuxaryMapFilter);


					}
				}
			      if(document.getElementById('map-search-result'))
				   {
                                      if(mainArr.length>1)
                                         var totalCount=parseInt(mainArr[1]);
                                       else
                                          var totalCount=0;
				 //   totalCount=totalCount-1;
				    if(totalCount<0)
				    totalCount=0;
				   document.getElementById('map-search-result').innerHTML='<span class="class="flotright red bold f13 pr10">'+totalCount+' listings found</span>';
				   if(document.getElementById('yellow-box-msg'))
				   document.getElementById('yellow-box-msg').style.display='none';

				   // show no result within 100mi in case of global search
				   if(addrsLen==0 && globalMapSearch==true)
					{
					document.getElementById('noresult100mi').style.display='';
				   document.getElementById('noresult100mi').innerHTML="No results within 100 miles of "+Location+". You can browse the map to see the rest of the "+globalSearchProCount+" results in other areas.";
				   }


                                if(document.getElementById('start'))
                                    document.getElementById('start').value =0;

                                    if(totalCount>100 &&  document.getElementById('map_pagination'))
                                        {
                                              document.getElementById('map_pagination').style.display='';
                                              var ptmp = '';
                                              var prev = parseInt(mainArr[3]);
                                              var nxt  = parseInt(mainArr[2]);


                                              if(prev==-1)
                                                  {
                                                      ptmp=ptmp + '<a href="javascript:void(0);" class="results_last_dis"><span>Last 100</span></a>';
                                                  }
                                                  else
                                                  {
                                                       var prev_f =  'prev('+lat+','+lng+','+distance+','+southWest_lat+','+southWest_lng+','+northEast_lat+','+northEast_lng+','+globalSearchProCount+','+globalMapSearch+','+trusteeSale+','+prev+')';
                                                       ptmp=ptmp + '<a href="javascript:void(0);" onclick="'+prev_f+';" class="results_last"><span>Last 100</span></a>';
                                                  }
                                              if(nxt==-1)
                                                  {
                                                    ptmp=ptmp + '<a href="javascript:void(0);" class="results_next_dis"><span>Next 100</span></a>';
                                                  }
                                                  else
                                                  {
                                                      var nxt_f =   'next('+lat+','+lng+','+distance+','+southWest_lat+','+southWest_lng+','+northEast_lat+','+northEast_lng+','+globalSearchProCount+','+globalMapSearch+','+trusteeSale+','+nxt+')';
                                                      ptmp=ptmp + '<a href="javascript:void(0);" onclick="'+nxt_f+';" class="results_next"><span>Next 100</span></a>';
                                                  }

                                               document.getElementById('map_pagination').innerHTML = ptmp;
                                        }
                                        else
                                        {
                                             if(document.getElementById('map_pagination'))
                                                  document.getElementById('map_pagination').style.display='none';
                                        }


				   }



			},
			error: function(request, settings, execp)
			{
				$jq('yellow-box-msg').empty();
				$jq('yellow-box-msg').html("<br><b>An error occurred, please try again.</b>");

			},
			timeout: function()
			{
			  $jq('yellow-box-msg').empty();
			  $jq('yellow-box-msg').html("<br><b>An error occurred, please try again.</b>");
			}
			});
}

function closeMap(id)
{
      if(id==0)
          {
              document.getElementById('requestUrlMap').value=getPathFromUrl(document.location.href);
              document.getElementById('map-index').action=document.location.href;
              document.getElementById('map-index').submit();
          }
          else
         {
	//document.getElementById('geoCity').value=document.getElementById('propertySearchLocation2').value;
	if(document.getElementById('globalMapSearch'))
	document.getElementById('globalMapSearch').value="0";
	//saveLocationPreference(document.getElementById('propertySearchLocation2').value,false);
        var Location = document.getElementById('propertySearchLocation2').value;
        var para="action=saveMapLocation";
	submitToSearch=false;
	if(Location!=undefined)
	{
		para+="&location="+Location;
	}
	//alert(HTTP_PATH+"ajax/getAjax.php"+para);
	$jq.ajax({
	type: "POST",
	url: SITE_PATH+"ajax/getAjax.php",
	async: true,
	global: true,
	timeout: 30000,
	data: para,
	success: function(result){
		//if(submitToSearch=="true")
		//{
			document.getElementById('requestUrlMap').value=getPathFromUrl(document.location.href);
                        document.getElementById('map-index').action=document.location.href;
                        document.getElementById('map-index').submit();
		//}

	},
	error: function(request, settings, execp)
	{
		$jq('#loddivcont').empty();
		$jq('#loddivcont').html("<br><b>An error occurred, please try again.</b>");

	}
	});


              }
	//document.getElementById('light').style.display='none';
//	document.getElementById('fade').style.display='none';

}

function prev(lat,lng,distance,southWest_lat,southWest_lng,northEast_lat,northEast_lng,globalSearchProCount,globalMapSearch,trusteeSale,start)
{
    document.getElementById('start').value=start;
    latLongMapView(lat,lng,distance,southWest_lat,southWest_lng,northEast_lat,northEast_lng,globalSearchProCount,globalMapSearch,trusteeSale);
}

function next(lat,lng,distance,southWest_lat,southWest_lng,northEast_lat,northEast_lng,globalSearchProCount,globalMapSearch,trusteeSale,start)
{
      document.getElementById('start').value=start;
     latLongMapView(lat,lng,distance,southWest_lat,southWest_lng,northEast_lat,northEast_lng,globalSearchProCount,globalMapSearch,trusteeSale);
}


function getPathFromUrl(url) {
  return url.split("?")[0];
}

// Global Search Map :  to display result in global search : Added by Mayank
function changemapViewGlobalSearch(trusteeSale)
{
// get hidden variable to show list view
var propertyCounty;
var cityVal;
var propertyType;
var location;
var propCount;
var propertyState;
var YearBuilt;
var area;
var auctionType;
//var maxPrice;
//var minPrice;
var minbath;
var maxbath;
var minbed;
var maxbed;

if(trusteeSale != undefined && trusteeSale=='Yes')
	{

	document.getElementById('mapAuctionType').value='trustee';
	}

if(document.getElementById('globalMap_propertyState'))
propertyState=document.getElementById('globalMap_propertyState').value;
if(document.getElementById('globalMap_propertyCounty'))
propertyCounty=document.getElementById('globalMap_propertyCounty').value;



if(document.getElementById('globalMap_cityVal'))
cityVal=document.getElementById('globalMap_cityVal').value;
if(document.getElementById('globalMap_propertyType'))
propertyType=document.getElementById('globalMap_propertyType').value;
if(document.getElementById('globalMap_location'))
location=document.getElementById('globalMap_location').value;

if(propertyState == "" && cityVal == "" && location !="")
{
var cityStaArr;
cityStaArr=location.split(',');
cityVal=trim(cityStaArr[0]);
propertyState=trim(cityStaArr[1]);
}

if(document.getElementById('globalMap_propCount_outer')) // outer use always before propCount
propCount=document.getElementById('globalMap_propCount_outer').value;
if(document.getElementById('globalMap_propCount'))
propCount=document.getElementById('globalMap_propCount').value;

if(document.getElementById('globalMap_YearBuilt'))
YearBuilt=document.getElementById('globalMap_YearBuilt').value;
if(document.getElementById('globalMap_area'))
area=document.getElementById('globalMap_area').value;
if(document.getElementById('globalMap_auctionType'))
auctionType=document.getElementById('globalMap_auctionType').value;

//if(document.getElementById('globalMap_maxPrice'))
//maxPrice=document.getElementById('globalMap_maxPrice').value;
//if(document.getElementById('globalMap_minPrice'))
//minPrice=document.getElementById('globalMap_minPrice').value;
if(document.getElementById('globalMap_minbath'))
minbath=document.getElementById('globalMap_minbath').value;

if(document.getElementById('globalMap_maxbath'))
maxbath=document.getElementById('globalMap_maxbath').value;
if(document.getElementById('globalMap_minbed'))
minbed=document.getElementById('globalMap_minbed').value;
if(document.getElementById('globalMap_maxbed'))
maxbed=document.getElementById('globalMap_maxbed').value;

// changes here

			setMapViewTypeSearch('G_NORMAL_MAP');
			loadMapSearch();
			var para='';
			// set map center point here
			// var addr=location+","+location;
                         var addr = '';
                        
                        if(location.search(",") == -1){
                            addr=location+", USA"+","+location+", USA";
                        }else{
                            addrArray = location.split(",");
                            if(trim(addrArray[1]) != ''){
                                addr=location+","+location;
                            }else{
                                addr=addrArray[0]+", USA"+","+addrArray[0]+", USA";
                            }                            
                        }
			 var point2;
			 if (geocoder) {
			 geocoder.getLatLng(addr,function(point2){
			 map.setCenter(point2,9);
			document.getElementById('geoCity').value=location;
			var bounds = map.getBounds();
		   // (27.44004046509707->southWest.lat, 73.388671875->southWest.lng), (29.897805610155874->northEast.lat, 81.5185546875->northEast.lng)
			var southWest = bounds.getSouthWest();
			var northEast = bounds.getNorthEast();
			var southWest_lat=southWest.lat();
			var southWest_lng=southWest.lng();
			var northEast_lat=northEast.lat();
			var northEast_lng=northEast.lng();
			if(document.getElementById('yellow-box-msg'))
			document.getElementById('yellow-box-msg').style.display='';
			mm = new MarkerManager(map,{borderPadding:1});
		    zoomChanged=false;
			// set the hidden variable to check we are using global search map
			document.getElementById('globalMapSearch').value="1";
                        document.getElementById('start').value=0;
			latLongMapView(map.getCenter().lat(),map.getCenter().lng(),100, southWest_lat,southWest_lng,northEast_lat,northEast_lng,propCount,true,trusteeSale);
			});
			}




}

function saveListingsMap(propertyId,auctionID,auctionType,lat,lng)
{
    var paraSaveList="action=saveListingsMap";
	paraSaveList+="&propertyId="+propertyId;
	paraSaveList+="&auctionID="+auctionID;
	paraSaveList+="&auctionType="+auctionType;
        $jq.ajax({
	type: "POST",
	url: AJAX_PATH+"ajax/getAjax.php",
	async: true,
	global: true,
	timeout: 30000,
	data: paraSaveList,
	success: function(result){
	saveListingsMapAjax(auctionID,propertyId,result);
	}
	});



}

function saveListingsMapAjax(auctionID,propertyID,resultAjax)
{
var address='';
// save the property here
var addrUnitArr=resultAjax.split("!!!");
var fullAddress=addrUnitArr[0]+" "+addrUnitArr[1]+" "+addrUnitArr[2]+" "+addrUnitArr[3];
//address1,address2,address3,addressF,bimage,auctionType,bedroom,bathroom,propID,auctID,venueId,startingbid,detailLink,lat,lng
address=getAddressHtmlToSaveList(addrUnitArr[0],addrUnitArr[1],addrUnitArr[2],fullAddress,addrUnitArr[4],addrUnitArr[5],addrUnitArr[6],addrUnitArr[7],addrUnitArr[8],addrUnitArr[9],addrUnitArr[10],addrUnitArr[11],addrUnitArr[12],addrUnitArr[13],addrUnitArr[14]);
//alert(address);

// save property on map using Gmap Library of google
  var point = new GLatLng(addrUnitArr[13],addrUnitArr[14]); // lat and lng
  var icon = new GIcon(G_DEFAULT_ICON);
			icon.image = IMAGE_BASE_PATH+addrUnitArr[5]+"-16x16.gif";
			icon.shadow = null;
			icon.iconSize = new GSize(17, 20);
			var marker = new GMarker(point,icon);
			GEvent.addListener(marker, "mouseover", function()
			{marker.openInfoWindowHtml(address);

			   });
			GEvent.addListener(marker, "mouseout", function()
			{

			});

	map.addOverlay(marker); // store marker in the marker manager
	var para="action=saveListings";
	if(propertyID!=null && auctionID!=null)
	{
		para+="&propertyId="+propertyID;
		para+="&auctionID="+auctionID;
		para+="&userId="+userID;
		para+="&mapView=true";
	}

	var para;
	$jq.ajax({
	type: "POST",
	url: AJAX_PATH+"ajax/getAjax.php",
	async: true,
	global: true,
	timeout: 30000,
	data: para,
	success: function(result){
	$jq('#mapsave').empty();
	$jq('#mapsave').html(result);

	},
	error: function(request, settings, execp)
	{
		//$jq('#loddivcont').empty();
		//$jq('#loddivcont').html("<br><b>An error occurred, please try again.</b>");
	}
	});
}
function getAddressHtmlToSaveList(address1,address2,address3,addressF,bimage,auctionType,bedroom,bathroom,propID,auctID,venueId,startingbid,detailLink,lat,lng)
{
var address = "<table cellpadding='0' cellspacing='4' border='0' ><tr><td rowspan='4'><img src='"+bimage+"' class='imgbr' border='0' width='55' height='50' /></td></tr><tr><td valign='top'><table cellpadding='0' cellspacing='0' border='0' ><tr><td align='left'  style='color:#000000;'>&nbsp;Starting price "+startingbid+"</td></tr>";
			if(auctionType!='notes' && auctionType!='commercial')
			address+="<tr><td align='left' style='color:#000000;'>&nbsp;Bedroom "+bedroom+", Bathroom "+bathroom+"</td></tr>";

			address+="<tr><td style='color:#000000;' align='left'>&nbsp;";

			//address+="<a href='javascript:void(0);' onClick=saveListingsMap("+propID+","+auctID+",'"+bimage+"','"+auctionType+"',"+bedroom+","+bathroom+","+propID+","+auctID+","+venueId+","+startingbid+",'"+detailLink+"',"+lat+","+lng+")>";


			address+="<a href='javascript:void(0);'><span id='mapsave'>Saved</span></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='"+detailLink+"'>See  details</a></td></tr></table></td></tr></table>";
			return address;
}


var submitToSearch='';
function saveLocationPreference(Location,submitTo)
{
	var para="action=saveMapLocation";
	submitToSearch=submitTo;
	if(location!=undefined)
	{
		para+="&location="+Location;
	}
	//alert(HTTP_PATH+"ajax/getAjax.php"+para);
	$jq.ajax({
	type: "POST",
	url: SITE_PATH+"ajax/getAjax.php",
	async: true,
	global: true,
	timeout: 30000,
	data: para,
	success: function(result){
		if(submitToSearch=="true")
		{
			document.getElementById('map-form').submit();
		}

	},
	error: function(request, settings, execp)
	{
		$jq('#loddivcont').empty();
		$jq('#loddivcont').html("<br><b>An error occurred, please try again.</b>");

	}
	});
}

function toSearch()
{
	var Location=document.getElementById('propertySearchLocation2').value;
        
        if(Location.search(",") == -1){
            saveLocationPreference(Location+", USA",'true');
        }else{
            addrArray = Location.split(",");
            if(trim(addrArray[1]) != ''){
                saveLocationPreference(Location,'true');
            }else{
                saveLocationPreference(Location+", USA",'true');
            }                            
        }
	//saveLocationPreference(Location,'true');
}

function makeParam()
{
    var para ="auctionType="+document.getElementById("auctionTypeForMap").value ;
      para+="&GlobalSearch=Yes";
     var pageNum=$jq("#pageNum").attr("value");

			if(pageNum!=undefined){
			   para+="&page="+pageNum;
			   locate+="&page="+pageNum;
			}

			var pageGroup=$jq("#pageGroup").attr("value");
			if(pageGroup!=undefined){
				para+="&pagegroup="+pageGroup;
				locate+="&pagegroup="+pageGroup;
			}
		   var getVenueId=$jq("#getVenueId").attr("value");
		if(getVenueId!=undefined){
		para+="&getVenueId="+getVenueId;
	}

	//show records per page
				var recsPerPage=$jq("#recsPerPage").attr("value");
				if(recsPerPage!=undefined){
					resetPageVars();
					para+="&listPaging="+recsPerPage;
					locate+="&listPaging="+recsPerPage;
				}

		  	//listing view type list or grid
	var viewType=$jq("#viewType").attr("value");
	if(viewType!=undefined){
	   para+="&view="+viewType;
	   locate+="&view="+viewType;
	}

    //show late addition properties
	var lateAdditions=$jq("#lateAdditions").attr("value");
	if(lateAdditions!=undefined){
	   para+="&lateAdditions="+lateAdditions;
	}

	//viewUpdatedProperties
	var viewUpdatedProperties=$jq("#viewUpdatedProperties").attr("value");
	if(viewUpdatedProperties!=undefined){
	   para+="&viewUpdatedProperties="+viewUpdatedProperties;
	}


	 //show State
	var aucTState=$jq("#auctionState").attr("value");
	var State=$jq("#State").attr("value");
	if(aucTState!=undefined)
	{
		para+="&propertyState="+aucTState;
		milesSpanText=State;
		if(srchParas!=""){
			srchParas+=" > ";
		}
		if($jq("#countyName").attr("value"))
		{
			srchParas+="<a href='"+SITE_PATH+State.replace(" ","-")+"/residential-real-estate-home-auctions.html'>"+State+"</a>";
		}
		else
		{
			srchParas+=State;
		}

	}


	//show State
	var countyName=$jq("#countyName").attr("value");
	if(countyName!=undefined)
	{
		para+="&propertyCounty="+countyName;
		milesSpanText=milesSpanText+", "+countyName;
		if(countyName!=""){
			srchParas+=" > ";
		}
		if($jq("#cityName").attr("value"))
		{
			srchParas+="<a href='"+SITE_PATH+State.replace(" ","-")+"/"+countyName.replace(" ","-")+"-County/residential-real-estate-home-auctions.html'>"+countyName+"</a>";
		}
		else
		{
			srchParas+=countyName;
		}
	}

	//show city
	var cityVal=$jq("#cityName").attr("value");
	if(cityVal!=undefined){
		para+="&cityVal="+cityVal;
		milesSpanText=milesSpanText+", "+cityVal;
		if(cityVal!="")
		{
			srchParas+=" > ";
		}
		srchParas+=cityVal;
	}


	//nrDate
	var nrDt=$jq("#nrDt").attr("value");

	if(nrDt!=undefined){
	   para+="&nrDt="+nrDt;
	}
	//alertType
	var alertType=$jq("#alertType1").attr("value");

	if(alertType!=undefined){
	   para+="&alertType="+alertType;
	}

	//yearBuilt crieteria
	var minYearBuilt=$jq("#minYearBuilt").attr("value");
	if(minYearBuilt!=undefined){
	   para+="&minYearBuilt="+minYearBuilt;
	}

	var maxYearBuilt=$jq("#maxYearBuilt").attr("value");
	if(maxYearBuilt!=undefined){
	   para+="&maxYearBuilt="+maxYearBuilt;
	}

	//venueCode crieteria
	var venueCode=$jq("#venueCode").attr("value");
	if(venueCode!=undefined){
	   para+="&venueCode="+venueCode;
	}

	//propertyID crieteria
	var propertyID=$jq("#propertyID").attr("value");
	if(propertyID!=undefined){
	   para+="&propertyID="+propertyID;
	}

	 var minbed = $jq("span#minbed").html() ;
    var maxbed = $jq("span#maxbed").html() ;

	if(document.getElementById("minbed") &&  minbed!="")
	{
       	   para+="&minbed="+eval(minbed);
	}

    if(document.getElementById("maxbed") && maxbed!="")
	 {
       	   para+="&maxbed="+eval(maxbed);
	 }

    var minbath = $jq("span#minbath").html() ;
    var maxbath = $jq("span#maxbath").html() ;

    if(document.getElementById("minbath") && minbath!="")
	{
       	   para+="&minbath="+eval(minbath);
	}

	if(document.getElementById("maxbath") && maxbath!="")
	{
       	   para+="&maxbath="+eval(maxbath);
	}


	if(document.getElementById('minPrice'))
	{
		if(document.getElementById('minPrice').value!="")
		{
			var minPrice=document.getElementById('minPrice').value;
			minPrice=minPrice.replace(/\,/g,'');
		}
		else
		{
			var minPrice='';
		}
	}

	if(minPrice)
	{
		if(minPrice!=undefined){
			   para+="&minPrice="+minPrice;
		}
	}
	if(document.getElementById('maxPrice'))
	{
		if(document.getElementById('maxPrice').value!="")
		{
			var maxPrice=document.getElementById('maxPrice').value;
			maxPrice=maxPrice.replace(/\,/g,'');
		}
		else
		{
			var maxPrice='';
		}
	}
	if(maxPrice)
	{
		if(maxPrice!=undefined){
			   para+="&maxPrice="+maxPrice;
		}
	}

	var area=$jq("#area").val() ;

	if(area!=undefined)
	{
	    para+="&area="+area;
	}
	var YearBuilt=$jq("#YearBuilt").val() ;
	if(YearBuilt!=undefined)
	{
	    para+="&YearBuilt="+YearBuilt;
	}


	var total=Array();
	var j=0;
	var el = document.getElementsByName('propertyType[]');
	  for(var i=0; i < el.length; i++){
		if(el[i].checked){
			total[j]="'"+el[i].value+"'";
			if(j==0){
				var propType=el[i].value;
			}
			j++;
		}
	  }
  	var propertyType=total.join(",");
  	para+="&propertyType="+propertyType;

   //Auction Type condition
	var auctType=$jq("#auctType").attr("value");
	if(auctType!=undefined){
		para+="&auctType="+auctType;
		var auctType=$jq('#auctType option:selected').text();
	}

	//property location crieteria
	var srchdist=$jq("#srchdist").attr("value");
	var srchdistTxt=$jq('#srchdist option:selected').text()

	if(srchdist!=undefined)
	{
		para+="&srchdist="+srchdist;
	}

	//venueCode crieteria
	var venueCode=$jq("#venueCode").attr("value");
	if(venueCode!=undefined){
	   para+="&venueCode="+venueCode;
	}
	//propertyID crieteria
	var propertyID=$jq("#propertyID").attr("value");
	if(propertyID!=undefined){
	   para+="&propertyID="+propertyID;
	}


	//show property type(commercial)
	var propTypeComm=$jq("#propertyTypeC").attr("value");
	if(propTypeComm!=undefined){
		para+="&propTypeCommVal="+propTypeComm;
	}

	//show property region(commercial)
	var propRegionComm=$jq("#propertyRegionC").attr("value");
	if(propRegionComm!=undefined){
		para+="&propRegionCommVal="+propRegionComm;
	}

// These checkbox will be settled down in left panel later
	var featured='';
	if(document.getElementById('featured') && document.getElementById('featured').checked==true)
	{
		featured='Yes';
		document.getElementById('featured').value="Yes";
		para+="&featured="+featured;
	}

	var trusteeSale='';
	if(document.getElementById('trusteeSale') && document.getElementById('trusteeSale').checked==true)
	{
		trusteeSale='Yes';
		document.getElementById('trusteeSale').value=trusteeSale;
		document.getElementById('beadcrumbId').innerHTML="Trustee";

		para+="&trusteeSale="+trusteeSale;

		if(document.getElementById('urlLogin') && document.getElementById('urlLogin').value)
		     para+="&urlLogin="+document.getElementById('urlLogin').value;

	}
	else if(document.getElementById('chkViewPresaleProp') && document.getElementById('chkViewPresaleProp').checked==false)
	{
		document.getElementById('beadcrumbId').innerHTML="Residential";
	}

	var presale='';
	if(document.getElementById('chkViewPresaleProp') && document.getElementById('chkViewPresaleProp').checked==true)
	{
		presale='Yes';
		document.getElementById('chkViewPresaleProp').value="1";
		para+="&chkViewPresaleProp="+presale;
	}

    return para ;
}

// check loction existence for search box: Added by Mayank: 12-07-2011

function checkLocationExistence(location,preLoc)
{
		 if(document.getElementById('windowLoad').value=='true')
		 {
		    setMapViewTypeSearch('G_NORMAL_MAP');
			loadMapSearch();
			var para='';
			// set map center point here
			 var addr=location+","+location;
			 var point2;
			if (geocoder) {
			geocoder.getLatLng(addr,function(point2){
			if(point2== null)
			 {
			 para+="propertySearchLocation=wrong&preLoc="+preLoc;

					$jq.ajax({
					type: "POST",
					url: SITE_PATH+"ajax/changeSearchLocation.php",
					async: true,
					global: true,
					timeout: 30000,
					data: para,
					success: function(result){                                          
                                       
					document.getElementById('srch1').submit();
					}
					});
					//saveLocationPreference(document.getElementById('propertySearchLocation').value,false);

			 }
			 else
			 {
			    var userID="<?=$_SESSION['sess_userid'];?>";
				if(userID!="")
				saveLocationPreference(document.getElementById('propertySearchLocation').value,false);
				document.getElementById('srch1').submit();
			 }
			 });
			 }
		}
		else
		{
		document.getElementById('clickSearch').value=true;
		 document.getElementById('Searchfade').style.display='block';
		}

}

function checkFormEnterKeySearch(e)
{ var key;
if(window.event)
key = window.event.keyCode; //IE
else
key = e.which; //firefox
if(key == 13)
return true;
else
return false;
} 




function checkLocationExistence(location,preLoc,searchbox)
{
		 if(document.getElementById('windowLoad').value=='true')
		 {
		    setMapViewTypeSearch('G_NORMAL_MAP');
			loadMapSearch();
			var para='';
			// set map center point here
			 var addr=location+","+location;
			 var point2;
			if (geocoder) {
			geocoder.getLatLng(addr,function(point2){
			if(point2== null)
			 {
			 para+="propertySearchLocation=wrong&preLoc="+preLoc;

					$jq.ajax({
					type: "POST",
					url: SITE_PATH+"ajax/changeSearchLocation.php",
					async: true,
					global: true,
					timeout: 30000,
					data: para,
					success: function(result){                                          
                                       
					document.getElementById('srch1').submit();
                                          return true;
					}
					});
					//saveLocationPreference(document.getElementById('propertySearchLocation').value,false);

			 }
			 else
			 {
			    var userID="<?=$_SESSION['sess_userid'];?>";
				if(userID!="")
				saveLocationPreference(document.getElementById('propertySearchLocation').value,false);
				document.getElementById('srch1').submit();
                                   return true;
			 }
			 });
			 }
		}
		else
		{
		document.getElementById('clickSearch').value=true;
		 document.getElementById('Searchfade').style.display='block';
		}
                
              return false; 
             

}

