// JavaScript Document
_mSvgEnabled = true ;
_mSvgForced  = true ;

var center ;
var centerLat;
var centerLng;
var marker = [] ;
var line ;
var geocoder ;
var icon ;
var map;
var visi = 'visible';
var visi2 = 'visible';
var visic ='visible';
var visic2 ='visible';
var marcadores = new Array();
var availabilities = new Array();
var list;

var xmlobj = null;
var city_data = null;
var region_data = null;
var country_data = null;

var forward_page = '';
var forward_var1 = null;
var forward_var2 = null;
var found = true;
      // ====== Array for decoding the failure codes ======
      var reasons=[];
      reasons[G_GEO_SUCCESS]            = "Success";
      reasons[G_GEO_MISSING_ADDRESS]    = "Missing Address: The address was either missing or had no value.";
      reasons[G_GEO_UNKNOWN_ADDRESS]    = "Unknown Address:  No corresponding geographic location could be found for the specified address.";
      reasons[G_GEO_UNAVAILABLE_ADDRESS]= "Unavailable Address:  The geocode for the given address cannot be returned due to legal or contractual reasons.";
      reasons[G_GEO_BAD_KEY]            = "Bad Key: The API key is either invalid or does not match the domain for which it was given";
      reasons[G_GEO_TOO_MANY_QUERIES]   = "Too Many Queries: The daily geocoding quota for this site has been exceeded.";
      reasons[G_GEO_SERVER_ERROR]       = "Server error: The geocoding request could not be successfully processed.";


function load()
{
	
 map = new GMap2(document.getElementById("map"));
 var start = new GLatLng(35.127771,-89.967041);
 map.setCenter(start, 1);
 centerLat = start.y;
 centerLng = start.x;
 map.addControl(new GSmallMapControl());
 map.addControl(new GScaleControl()) ;
 icon = new GIcon();
 icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
 icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
 icon.iconSize = new GSize(12, 20);
 icon.shadowSize = new GSize(22, 20);
 icon.iconAnchor = new GPoint(6, 20);
 icon.infoWindowAnchor = new GPoint(11, 11); 
 geocoder = new GClientGeocoder() ;
}

function loadMapLL(lat, lng,zoom) 
{
 map = new GMap2(document.getElementById("map"));
 centerMapLL(lat,lng,zoom);
 
 map.addControl(new GLargeMapControl());
 map.addControl(new GScaleControl()) ;
 icon = new GIcon();
 icon.image = "mm_20_red.png";
 icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
 icon.iconSize = new GSize(18, 19);
 icon.shadowSize = new GSize(22, 20);
 icon.iconAnchor = new GPoint(6, 20);
 icon.infoWindowAnchor = new GPoint(11, 11); 
 geocoder = new GClientGeocoder() ;
}


function centerMap(address,zoom){
	geocoder.getLatLng( address, function(pointer)
	{
		if (!pointer){
			alert( address + " unable to be mapped by Google.\n\nPlease confirm information is correct and proceed.");
		} 
		else{
 			centerLat = pointer.y;
 			centerLng = pointer.x;
			map.setCenter(pointer,zoom);
		}
	}) ;
}


function centerMapWMarker(addr,city,state,country,zoom){
	var address;
	if(state!='')
		address = addr + ', ' + city + ', ' + state + ', ' + country;
	else
		address = addr + ', ' + city + ', ' + country;
	geocoder.getLocations( address, function(result)
	{
		//alert(reasons[result.Status.code]);
		 if (result.Status.code == G_GEO_SUCCESS) {
			var p = result.Placemark[0].Point.coordinates;
			var pointer = new GLatLng(p[1],p[0]);
 			centerLat = pointer.y;
 			centerLng = pointer.x;
			map.setCenter(pointer,zoom); 
			var marker = new GMarker(pointer, icon);
			var html = '<div style="font-size:10px; width:190px;"><b>Property located:</b><br>' + addr + '<br>' + city +', ' + country+'</div>';
			GEvent.addListener(marker, "click", function() {
				marker.openInfoWindowHtml(html);
			});
			map.addOverlay(marker);
			marker.openInfoWindowHtml(html);
			//locationLabel(true);
			try {
				document.getElementById('propLat').value = p[1];
				document.getElementById('propLong').value = p[0];
			}catch(exc) {}
		}
		else {
			found = false;
			try {
				toConfirm();
			}catch(e) {
				try {
					toConfirmProperty();
				}catch(e) {
				}
			}
		}
	});
}

function centerMapLL(lat, lng, zoom){
	var pointer = new GLatLng(lat,lng)
	map.setCenter(pointer,zoom);
 	centerLat = pointer.y;
 	centerLng = pointer.x;
}

function addMarker(property_id, addr, city, state, country, lat, long, beds, baths, sqft) {
	var pointer;
	var zoom = 12;
	var marker = null;
	if(lat!=0 && long!=0) {
		pointer = new GLatLng(lat, long);
		marker = new GMarker(pointer, icon);
	}
	else {
		var address;
		if(state!='')
			address = addr + ', ' + city + ', ' + state + ', ' + country;
		else
			address = addr + ', ' + city + ', ' + country;
		if(geocoder == null || geocoder == 'undefined')
			geocoder = new GClientGeocoder();
		geocoder.getLocations( address, function(result)
		{
			//alert(reasons[result.Status.code]);
			 if (result.Status.code == G_GEO_SUCCESS) {
				var p = result.Placemark[0].Point.coordinates;
				pointer = new GLatLng(p[1],p[0]);
				centerLat = pointer.y;
				centerLng = pointer.x;
				map.setCenter(pointer,zoom);
				marker = new GMarker(pointer, icon);
				//locationLabel(true);
				
			}
		});
	}
	var html = '<div style="width:280px;"><table border="0" cellpadding="0" cellspacing="3">';
	html = html + '<tr><td width="100"><img src="pictures/'+property_id+'.jpg" width="100" height="80" style="border:1px solid #000;" onerror="this.src = \'images/nopic.jpg\';"></td>';
	html = html + '<td width="180" valign="top"><div style="font-size:13px; font-weight:bold;"><a href="#">Click here for more details</a></div>';
	html = html + '<div style="margin-top:4px; font-size:10px; overflow:hidden;"><strong>address: </strong>'+addr+'</div>';
	html = html + '<div style="font-size:10px; overflow:hidden;"><strong>city: </strong>'+city+'</div>';
	html = html + '<div style="font-size:10px; overflow:hidden;"><strong>country: </strong>'+country+'</div>';
	html = html + '<div style="font-size:10px; width:48%; float:left;"><strong>bedrooms: </strong>'+beds+'</div>';
	html = html + '<div style="font-size:10px; width:48%; float:right;"><strong>bathrooms: </strong>'+baths+'</div>';
	html = html + '</td></tr></table></div>';
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(html);
	});
	map.addOverlay(marker);
	marcadores[marcadores.length] = createMarkerObject(pointer, marker, property_id, addr, city, state, country, lat, long, beds, baths, sqft);
}

function createMarkerObject(pointer, marker, property_id, addr, city, state, country, lat, long, beds, baths, sqft,date_in, date_out) {

	var x = new Array();
	x.pointer = pointer;
	x.marker = marker;
	x.id = property_id;
	x.addr = addr;
	x.city = city;
	x.state = state;
	x.country = country;
	x.lat = lat;
	x.long = long;
	x.beds = beds;
	x.baths = baths;
	x.sqft = sqft;
	if(date_in == null || date_in=='undefined')
		x.date_in = new Date();
	else
	 x.date_in = date_in;
	if(date_out == null || date_out=='undefined')
		x.date_out = new Date();
	else
	 x.date_out = date_out;

	return x;
}

// send http POST request
function sendRequest(doc, func, url_enc_param){
    if(xmlobj!=null&&xmlobj.readyState!=0&&xmlobj.readyState!=4){
        xmlobj.abort();
    }
    try{
        xmlobj=new XMLHttpRequest();
	//alert('standard mozilla ajax');

    }
    catch(e){
        try{
            xmlobj=new ActiveXObject('Microsoft.XMLHTTP');
        }
        catch(e){
            xmlobj=null;
            return false;
		//alert('no ajax');
        }
    }
    xmlobj.onreadystatechange=func;
    xmlobj.open('POST',doc,true);
	xmlobj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

    xmlobj.send(url_enc_param);
}

function sendMail(to, subject, message, handler) {
	sendRequest('sendMail.php', handler, 'email='+to+'&subject='+subject+'&message='+message);
}

function lostPasswordHanler() {
    if(xmlobj.readyState==4){
        if(xmlobj.status==200){
			var x = xmlobj.responseText;
			if(x == 'sent') {
				document.getElementById('message').innerHTML = 'Your password was sent to your e-mail.';
			}
			else {
				document.getElementById('message').innerHTML = 'Impossible to send e-mail.';
			}
        }
    }
}

function nullHandler() {
    if(xmlobj.readyState==4){
        if(xmlobj.status==200){
			//alert(xmlobj.responseText);
        }
    }
}

function cityHandler() {
    if(xmlobj.readyState==4){
        if(xmlobj.status==200){
			//alert(xmlobj.responseText);
			city_data = eval( xmlobj.responseText ); 
			if(city_json!=null){
				city_data = city_json;
				var sel = document.getElementById('city_select');
				sel.options.length = 0;
				sel.options[0] = createDefaultOption('city');
				for(var i=1; i < city_data.cities.length; i++) {
					var option = document.createElement("OPTION");
					option.value = city_data.cities[i-1].id;
					option.text = city_data.cities[i-1].name;
					sel.options[i] = option;
				}
			}
        }
    }
}

function regionHandler() {
    if(xmlobj.readyState==4){
        if(xmlobj.status==200){
			//alert(xmlobj.responseText);
			region_data = eval( xmlobj.responseText ); 
			if(region_json!=null) {
				region_data = region_json;
				var sel = document.getElementById('region_select');
				sel.options.length = 0;
				sel.options[0] = createDefaultOption('region');
				for(var i=1; i <= region_data.regions.length; i++) {
					var option = document.createElement("OPTION");
					option.value = region_data.regions[i-1].id;
					option.text = region_data.regions[i-1].name;
					sel.options[i] = option;
				}
				document.getElementById('city_select').options.length = 0;
				document.getElementById('city_select').options[0] = createDefaultOption('region first');
			}
        }
    }
}

function countryHandler() {
    if(xmlobj.readyState==4){
        if(xmlobj.status==200){
			//alert(xmlobj.responseText);
			country_data = eval( xmlobj.responseText );
			if(country_json!=null) {
				country_data = country_json;
				var sel = document.getElementById('country_select');
				sel.options.length = 0;
				sel.options[0] = createDefaultOption('country');
				for(var i=1; i <= country_data.countries.length; i++) {
					var option = document.createElement("OPTION");
					option.value = country_data.countries[i-1].id;
					option.text = country_data.countries[i-1].name;
					sel.options[i] = option;
				}
				document.getElementById('region_select').options.length = 0;
				document.getElementById('region_select').options[0] = createDefaultOption('country first');
				document.getElementById('city_select').options.length = 0;
				document.getElementById('city_select').options[0] = createDefaultOption('region first');
			}
        }
    }
}

function changeCountries(world_id) {
	//alert(world_id);
	sendRequest('GetLocationJSON.jsp', countryHandler, 'type=COUNTRY&world_id='+world_id);
}

function changeRegions(country_id) {
	sendRequest('GetLocationJSON.jsp', regionHandler, 'type=REGION&country_id='+country_id);
	if(country_id!=-1) {
		try {
			for(var i=0; i<country_data.countries.length;i++) {
				if(country_data.countries[i].id == country_id) {
					centerMapLL(country_data.countries[i].latitude,country_data.countries[i].longitude,3);
					break;
				}
			}
		}catch(e){}
	}
}

function changeCities(region_id) {
	sendRequest('GetLocationJSON.jsp', cityHandler, 'type=CITY&region_id='+region_id);
}

function centerCity(city_id) {
	if(city_id !=-1) {
		for(var i=0; i<city_data.cities.length;i++) {
			if(city_data.cities[i].id == city_id) {
				centerMapLL(city_data.cities[i].latitude,city_data.cities[i].longitude,10);
				break;
			}
		}
	}
}

function createDefaultOption(opt) {
	var option = document.createElement("OPTION");
	option.text = 'Select a '+opt;
	option.value = -1;
	return option;
}

function toConfirm() {
	var div = document.getElementById('review');
	var text = '<span style="font-size:11px;"><b>Personal data:</b><br>name: '+document.owner.name.value+'<br>phone: '+document.owner.phone.value+'<br><br>';
	text += '<b>Login data:</b><br>email: '+document.owner.email.value+'<br>password: '+document.owner.password.value+'<br><br>';
	text += '<b>Owner\'s mailing address:</b><br>country: '+document.owner.country_select.options[document.owner.country_select.selectedIndex].text+'<br>';
	text += 'region/state: '+document.owner.region_select.options[document.owner.region_select.selectedIndex].text+'<br>'; 
	text += 'city: '+document.owner.city_select.options[document.owner.city_select.selectedIndex].text+'<br>'; 
	text += 'address: '+document.owner.address.value;
	text += '</span>';
	div.innerHTML = text;
}

function toConfirmProperty() {
	var div = document.getElementById('review');
	var text = '<span style="font-size:11px;"><b>Property data:</b><br>bedrooms: '+document.propertyy.bedrooms.value+'<br>bathrooms: '+document.propertyy.bathrooms.value+'<br>';
	text += 'square footage: '+document.propertyy.sqft.value+'<br><br>';
	text += '<b>Address data:</b><br>country: '+document.propertyy.country_select.options[document.propertyy.country_select.selectedIndex].text+'<br>';
	text += 'region/state: '+document.propertyy.region_select.options[document.propertyy.region_select.selectedIndex].text+'<br>'; 
	text += 'city: '+document.propertyy.city_select.options[document.propertyy.city_select.selectedIndex].text+'<br>'; 
	text += 'address: '+document.propertyy.address.value;
	if(!found)
		text += '<br><span style="color:#f00;">This address was not found by google maps.<br>If this is the right address you may continue.</span>';
	text += '</span>';
	div.innerHTML = text;
	found = true;
}

function registerPerson(name, address, city_id, phone, email, password, enabled, forward_p, city_name, region_name, country_id) {
	//alert(enabled);
	if(email==''){
		alert('Email is a required field.');
		return false;
	}
	if(name==''){
		alert('Name is a required field.');
		return false;
	}
	if(password=='') {
		alert('Password is a required field.');
		return false;
	}
		
	forward_page = forward_p;
	forward_var1 = email;
	forward_var2 = password;
	var param = 'operation=INSERT&name='+name+'&address='+address+'&city_id='+city_id+'&phone='+phone+'&email='+email+'&password='+password+'&city_name='+city_name+'&region_name='+region_name+'&country_id='+country_id;
	if(enabled!=null) {
		param += '&enabled='+enabled;
		//alert(param);
		sendRequest('registerOwnerS.jsp', registerHandler, param);
		sendMail(email, 'Thank you for registering at FRBO.com', 'Hello '+name+',\nThank you for registering at FRBO.com.\nYour login is: '+email+'\nYour password is: '+password+'\n\nFRBO.com\n', nullHandler);
	} else {
		sendRequest('registerOwnerS.jsp', registerHandler, param);
		sendMail(email, 'Thank you for registering at FRBO.com', 'Hello '+name+',\nThank you for registering at FRBO.com.\nYour login is: '+email+'\nYour password is: '+password+'\n\nFRBO.com\n', nullHandler);
	}
}

function updatePerson(name, address, city_id, phone, email, password, enabled, forward_p, city_name, region_name, country_id, owner_id) {
	//alert(enabled);
	forward_page = forward_p;
	forward_var1 = null;
	forward_var2 = null;
	var param = 'operation=UPDATE&name='+name+'&address='+address+'&city_id='+city_id+'&phone='+phone+'&email='+email+'&password='+password+'&city_name='+city_name+'&region_name='+region_name+'&country_id='+country_id+'&owner_id='+owner_id;
	if(enabled!=null) {
		param += '&enabled='+enabled;
		//alert(param);
		sendRequest('registerOwnerS.jsp', registerHandler, param);
	} else {
		sendRequest('servlet/RegisterRenter', registerHandler, param);
	}
}

function registerHandler() {
    if(xmlobj.readyState==4){
	//alert(xmlobj.status);
        if(xmlobj.status==200){
			//alert(xmlobj.responseText);
			forw = forward_page;
			if(forward_var1 != null && forward_var2!= null )
				forw += '?email='+forward_var1+'&password='+forward_var2;
			if(xmlobj.responseText != '' && xmlobj.responseText != null)
				forw += '?property_id='+xmlobj.responseText;
			window.location = forw;
			forward_var1 = null;
			forward_var2 = null;
			forward_page = null;
        }
    }
}

function registerProperty(owner_id, address, city_id, d_property, d_location, beds, baths, sqft, forward_p, lat, long, name, email, city_name) {
	if(address==''){
		alert('Address is a required field.');
		return false;
	}
	if(city_id <= 0){
		alert('City is a required field.');
		return false;
	}
	if(beds==''){
		alert('Bedrooms is a required field.');
		return false;
	}
	if(baths==''){
		alert('Bathrooms is a required field.');
		return false;
	}
		
	forward_page = forward_p;
	var param = 'operation=INSERT&owner_id='+owner_id+'&address='+address+'&city_id='+city_id+'&description_property='+d_property+'&description_location='+d_location+'&bedrooms='+beds+'&bathrooms='+baths+'&sqft='+sqft+'&lat='+lat+'&long='+long;
	sendRequest('registerPropertyS.jsp', registerHandler, param);
	if(email!=null && email!='undefined') {
		sendMail(email, 'Thank you for registering at FRBO.com', 'Hello '+name+',\n\nThe listing was successful. You can manage your listing in the owner area once you log in.\n\nThanks.\n\nThe FRBO.com Team\n', nullHandler);
	}
}

function updateProperty(owner_id, address, city_id, d_property, d_location, beds, baths, sqft, forward_p, lat, long, property_id, enabled) {
	forward_page = forward_p;
	var compl = '';
	if(enabled!=null && enabled!='undefined')
		compl = '&enabled='+enabled;
	var param = 'operation=UPDATE&owner_id='+owner_id+'&address='+address+'&city_id='+city_id+'&description_property='+d_property+'&description_location='+d_location+'&bedrooms='+beds+'&bathrooms='+baths+'&sqft='+sqft+'&lat='+lat+'&property_id='+property_id+'&long='+long+compl;
	//alert(param);
	sendRequest('registerPropertyS.jsp', registerHandler, param);
}

function goto() {
	var cit = document.getElementById("city_select");
	var coun = document.getElementById("country_select");
	if(cit.options[cit.selectedIndex].value != -1) {
		window.location = 'city.jsp?city_id='+cit.options[cit.selectedIndex].value;
	}
	else if (coun != null) {
		window.location = 'country.jsp?country_id='+coun.options[coun.selectedIndex].value;
	}
}

function emptyMarkers() {
	marcadores = new Array();
}

function insertMarker(property_id, addr, city, state, country, lat, long, beds, baths, sqft, date_in, date_out) {
	var pointer;
	var marker = null;
	if(lat!=0 && long!=0) {
		pointer = new GLatLng(lat, long);
		marker = new GMarker(pointer, icon);
		marcadores[marcadores.length] = createMarkerObject(pointer, marker, property_id, addr, city, state, country, lat, long, beds, baths, sqft, date_in, date_out);
	}
	else {
		var address;
		if(state!='')
			address = addr + ', ' + city + ', ' + state + ', ' + country;
		else
			address = addr + ', ' + city + ', ' + country;
		if(geocoder == null || geocoder == 'undefined')
			geocoder = new GClientGeocoder();
		geocoder.getLocations( address, function(result)
		{
			 //alert(reasons[result.Status.code]);
			 if (result.Status.code == G_GEO_SUCCESS) {
				var p = result.Placemark[0].Point.coordinates;
				pointer = new GLatLng(p[1],p[0]);
				marker = new GMarker(pointer, icon);
				//locationLabel(true);
				marcadores[marcadores.length] = createMarkerObject(pointer, marker, property_id, addr, city, state, country, lat, long, beds, baths, sqft, date_in, date_out);
			}
		});
	}

}

function showMarkers(bed_min, bed_max, bath_min, bath_max, date_in, date_out, close_search) {
	var point=null;
	map.clearOverlays();
	for(var i=0; i < marcadores.length; i ++) {
		if(bed_min <= marcadores[i].beds && bed_max >= marcadores[i].beds) {
			if(bath_min <= marcadores[i].baths && bath_max >= marcadores[i].baths) {
				var dtobj = availabilities[marcadores[i].id];
				if(dtobj == null || (date_in==null || date_out==null) ) {
					plotMarker(marcadores[i]);
					point = marcadores[i].pointer;
				}
				else if(dtobj!=null){
					for(var j=0; j < dtobj.length; j++) {
						if(( date_in >= dtobj[j].date_in && date_out <= dtobj[j].date_out )|| date_in==null || date_out==null) {
							plotMarker(marcadores[i]);
							point = marcadores[i].pointer;
							break;
						}
					}
				}
				//if(( date_in <= marcadores[i].date_in && date_out >= marcadores[i].date_out )|| date_in==null || date_out==null) {
					//plotMarker(marcadores[i]);
					//point = marcadores[i].pointer;
				//}
			}
		}
	} 
	if(close_search!=null && close_search != 'undefined') {
		map.setCenter(point,11);
	} 
	else if(point!=null) {
		map.setCenter(point,5);
	}
}

function plotMarker(mark) {
	var html = '<div style="width:280px;"><table border="0" cellpadding="0" cellspacing="3">';
	html = html + '<tr><td width="100"><img src="pictures/'+mark.id+'.jpg" width="100" height="80" style="border:1px solid #000;" onerror="this.src = \'images/nopic.jpg\';"></td>';
	html = html + '<td width="180" valign="top"><div style="font-size:13px; font-weight:bold;"><a href="property.jsp?id='+mark.id+'">Click here for more details</a></div>';
	html = html + '<div style="margin-top:4px; font-size:10px; overflow:hidden;"><strong>address: </strong>'+mark.addr+'</div>';
	html = html + '<div style="font-size:10px; overflow:hidden;"><strong>city: </strong>'+mark.city+'</div>';
	html = html + '<div style="font-size:10px; overflow:hidden;"><strong>country: </strong>'+mark.country+'</div>';
	html = html + '<div style="font-size:10px; width:48%; float:left;"><strong>bedrooms: </strong>'+mark.beds+'</div>';
	html = html + '<div style="font-size:10px; width:48%; float:right;"><strong>bathrooms: </strong>'+mark.baths+'</div>';
	html = html + '</td></tr></table></div>';
	GEvent.addListener(mark.marker, "click", function() {
		mark.marker.openInfoWindowHtml(html);
	});
	map.addOverlay(mark.marker);
}

function insertAvailability(property_id, date_in, date_out) {
	var p_id = property_id + '';
	if(availabilities[p_id] == null)
		availabilities[p_id] = new Array();
	availabilities[p_id][availabilities[p_id].length] =	createAvailObject(property_id, date_in, date_out);
}

function createAvailObject(property_id, date_in, date_out) {
	var x = new Array();
	x.id = property_id;
	x.date_in = date_in;
	x.date_out = date_out;
	return x;
}

function searchCity() {
	var bed_min = document.cityf.bed_min.options[document.cityf.bed_min.selectedIndex].value;
	var bed_max = document.cityf.bed_max.options[document.cityf.bed_max.selectedIndex].value;
	var bath_min = document.cityf.bath_min.options[document.cityf.bath_min.selectedIndex].value;	
	var bath_max = document.cityf.bath_max.options[document.cityf.bath_max.selectedIndex].value;
	var year_min = document.cityf.year_min.options[document.cityf.year_min.selectedIndex].value;
	var month_min = document.cityf.month_min.options[document.cityf.month_min.selectedIndex].value;	
	var day_min = document.cityf.day_min.options[document.cityf.day_min.selectedIndex].value;
	var year_max = document.cityf.year_max.options[document.cityf.year_max.selectedIndex].value;
	var month_max = document.cityf.month_max.options[document.cityf.month_max.selectedIndex].value;	
	var day_max = document.cityf.day_max.options[document.cityf.day_max.selectedIndex].value;
	
	var date_in = new Date(parseInt(year_min),parseInt(month_min), parseInt(day_min)); 
	var date_out = new Date(parseInt(year_max),parseInt(month_max), parseInt(day_max)); 
	
	showMarkers(bed_min, bed_max, bath_min, bath_max, date_in, date_out, true);
}

function searchCountry() {
	/*
	var year_min = '2007';
	var month_min = '1';
	var day_min = '1';
	var year_max = '2015';
	var month_max = '12';
	var day_max = '31';
	
	var date_in = new Date(parseInt(year_min),parseInt(month_min), parseInt(day_min)); 
	var date_out = new Date(parseInt(year_max),parseInt(month_max), parseInt(day_max)); 
	*/
	showMarkers(1, 99, 1, 99, null, null, true);
}