 $(function() {
        var settings = { containerResizeSpeed: 350
            };
            $('#gallery a').lightBox(settings);
        });
function bookmark()
{
	var BookmarkURL="http://brighthomevietnam.com"
	var BookmarkTitle="Brighthomevietnam"       
	// If the browser is Internet Explorer  
	if (document.all)  
	{  
			// Add to Favorites (Internet Explorer)  
			window.external.AddFavorite(BookmarkURL,BookmarkTitle)  
	}  
	else  
	{  
			// Add to Bookmarks (Mozilla Firefox)  
			window.sidebar.addPanel(BookmarkTitle, BookmarkURL, '');  
	}  
}
function rent_apartment(type,district)
{
	if(type=='office_space')
	{
		//document.districtform.submit();
		window.location='http://www.brighthomevietnam.com/office_space_for_rent_vietnam/rent_office_space_in_ho_chi_minh_city_vietnam.html';
		
	}
	else
	{
	if(district == 0)
	{
		if(type==0)
		{
			window.location='http://www.brighthomevietnam.com/house_apartment_for_rent_vietnam/rent_house_apartment_in_ho_chi_minh_city_vietnam/all.html';
		}
		else
		{
			window.location='http://www.brighthomevietnam.com/'+type+'_for_rent_vietnam/rent_'+type+'_in_ho_chi_minh_city_vietnam/all.html';
		}
		
	}
	else
	{
		if(type==0)
		{
			window.location='http://www.brighthomevietnam.com/house_apartment_for_rent_vietnam/rent_house_apartment_in_ho_chi_minh_city_vietnam_district_'+district+'/all.html';
		}
		else
		{
			window.location='http://www.brighthomevietnam.com/'+type+'_for_rent_vietnam/rent_'+type+'_in_ho_chi_minh_city_vietnam_district_'+district+'/all.html';
		}
	}
	}
	
}
function rent_apartment2(type,district)
{
	if(type=='office_space')
	{
		document.districtform.submit();
		//window.location='http://www.brighthomevietnam.com/office_space_for_rent_vietnam/rent_office_space_in_ho_chi_minh_city_vietnam.html';
		
	}
	else
	{
	if(district == 0)
	{
		if(type==0)
		{
			window.location='http://www.brighthomevietnam.com/house_apartment_for_rent_vietnam/rent_house_apartment_in_ho_chi_minh_city_vietnam/all.html';
		}
		else
		{
			window.location='http://www.brighthomevietnam.com/'+type+'_for_rent_vietnam/rent_'+type+'_in_ho_chi_minh_city_vietnam/all.html';
		}
		
	}
	else
	{
		if(type==0)
		{
			window.location='http://www.brighthomevietnam.com/house_apartment_for_rent_vietnam/rent_house_apartment_in_ho_chi_minh_city_vietnam_district_'+district+'/all.html';
		}
		else
		{
			window.location='http://www.brighthomevietnam.com/'+type+'_for_rent_vietnam/rent_'+type+'_in_ho_chi_minh_city_vietnam_district_'+district+'/all.html';
		}
	}
	}
	
}
function sale_apartment(type,district)
{
	if(district == 0)
	{
		if(type==0)
		{
			window.location='http://www.brighthomevietnam.com/house_apartment_for_sale_vietnam/sale_house_apartment_in_ho_chi_minh_city_vietnam.html';
		}
		else
		{
			window.location='http://www.brighthomevietnam.com/'+type+'_for_sale_vietnam/sale_'+type+'_in_ho_chi_minh_city_vietnam.html';
		}
		
	}
	else
	{
		if(type==0)
		{
			$("#house").html("<center><img src='http://www.brighthomevietnam.com/images/ajax.gif'></center>");
			$("#house").load("http://www.brighthomevietnam.com/home/sale_district/"+district);
			$.post("http://www.brighthomevietnam.com/home/sale_district2/"+district, function(data){
					$("#pagecount").val(data.split(":")[1]);
					$("#page").val("sale_district/"+district);
					$("#nums").html(data.split(":")[0]);
					
			});
		}
		else
		{
			document.district.submit();
		}
	}
	
}
function guidebook(id)
{
	$("#main").load("http://www.brighthomevietnam.com/guide/guide_book_ho_chi_minh_city_vietnam/"+id+".html");
}
function searchhouse()
{
	if($("#code").val() != '')
	{
		document.code.code.value = $("#code").val();
		document.code.submit();
	}
	else
	{
		document.search.submit();
	}
}
function min(str)
{
	$("#Price1").val(str);
	document.search.price1.value = str;
}
function maphcm(str)
{
	document.getElementById('map').src = "../images/"+str;
}
function max(str)
{
	$("#Price2").val(str);
	document.search.price2.value = str;
}
function changeaction2()
{
	if($("#district2").val() != '0')
			{
			str = $("#district2").val();
			if(str == "2_an_phu")
			{
				document.districtform.quan.value = "2";
			}
			else
			{
				if(str == "binh_thanh")
				{
					document.districtform.quan.value = "16";
				}
				else
				{
					if(str == "phu_nhuan")
					{
						document.districtform.quan.value = "17";
					}
					else
					{
						if(str == "7_phu_my_hung")
						{
							document.districtform.quan.value = "7";
						}
						else
						{
							if(str == "tan_binh")
							{
								document.districtform.quan.value = "15";
							}
							else
							{
								if(str == "other")
								{
									document.districtform.quan.value = "100"
								}
								else
								{
									document.districtform.quan.value = str;
								}
							}
							
						}
					}
				}
			}
				}
			else 
			{
				document.districtform.quan.value = "";
			}
}
function changeaction()
{
	
	if($("#type").val() == 'office_space')
	{
		document.search.action = 'http://www.brighthomevietnam.com/office_space_for_'+$("#kieusearch").val()+'_vietnam/'+$("#kieusearch").val()+'_office_space_in_ho_chi_minh_city_vietnam.html';
	}
	else
	{
		if($("#kieusearch").val() != 'sale')
		{
		if($("#district").val() == '0')
		{
			document.search.action = 'http://www.brighthomevietnam.com/'+$("#type").val()+'_for_'+$("#kieusearch").val()+'_vietnam/'+$("#kieusearch").val()+'_'+$("#type").val()+'_in_ho_chi_minh_city_vietnam.html';
		}
		else
		{
			document.search.action = 'http://www.brighthomevietnam.com/'+$("#type").val()+'_for_'+$("#kieusearch").val()+'_vietnam/'+$("#kieusearch").val()+'_'+$("#type").val()+'_in_ho_chi_minh_city_vietnam_district_'+$("#district").val()+'.html';

		}
		}
		else
		{
			document.search.action = 'http://www.brighthomevietnam.com/'+$("#type").val()+'_for_'+$("#kieusearch").val()+'_vietnam/'+$("#kieusearch").val()+'_'+$("#type").val()+'_in_ho_chi_minh_city_vietnam.html';
			if($("#district").val() != '0')
			{
			str = $("#district").val();
			if(str == "2_an_phu")
			{
				document.search.quan.value = "2";
			}
			else
			{
				if(str == "binh_thanh")
				{
					document.search.quan.value = "16";
				}
				else
				{
					if(str == "phu_nhuan")
					{
						document.search.quan.value = "17";
					}
					else
					{
						if(str == "7_phu_my_hung")
						{
							document.search.quan.value = "7";
						}
						else
						{
							if(str == "tan_binh")
							{
								document.search.quan.value = "15";
							}
							else
							{
								document.search.quan.value = str;
							}
						}
					}
				}
			}
				}
			else 
			{
				document.search.quan.value = "";
			}
			}
		}
}
function landlords()
{
	if(document.datnha.street.value == '')
	{
		alert("Please input Renting Address");
		return false;
	}
	else
	{
		if(document.datnha.name.value == '')
		{
			alert("Please input Your name");
			return false;
		}
		else
		{
			if(document.datnha.cellphone.value == '')
			{
				alert("Please input Your Phone");
				return false;
			}
			else
			{
				return true;
			}
		}
	}
}
function checkform()
{
	if(document.muanha.name.value == '')
		{
			alert("Please input Your name");
			return false;
		}
		else
		{
			if(document.muanha.email.value == '')
			{
				alert("Please input Your Email");
				return false;
			}
			else
			{
				return true;
			}
		}
}
function emailtofriend()
{
	if(document.email.name.value == '')
		{
			alert("Please input Your name");
			return false;
		}
		else
		{
			if(document.email.email.value == '')
			{
				alert("Please input Your Email");
				return false;
			}
			else
			{
				if(document.email.emailto.value == '')
				{
					alert("Please input Your Friend's Email");
					return false;
				}
				else
				{
					return true;
				}
			}
		}
}
