//javascript functions
//find_home/find_spec function
function formValidate()
	{
		
		var state_sel = document.getElementById('state_val');
		var count_sel = document.getElementById('county');
		var homet_sel = document.getElementById('home_type');
		var sqrft_sel = document.getElementById('sqr_feet');
		var strpr_sel = document.getElementById('home_price');
		var immde_sel = document.getElementById('spec_home');
		
		
		if (state_sel.value=="" && count_sel.value=="" && homet_sel.value=="" && sqrft_sel.value=="" && strpr_sel.value=="" && immde_sel.value=="")
		{
				alert("Please select your search criteria.");
				return false;
		}
							
	}

function formValidate2()
	{
				
		var state_sel = document.getElementById('state_val');
		var count_sel = document.getElementById('county');
		var homet_sel = document.getElementById('home_type');
		var sqrft_sel = document.getElementById('sqr_feet');
		var strpr_sel = document.getElementById('home_price');		
		
		if (state_sel.value=="" && count_sel.value=="" && homet_sel.value=="" && sqrft_sel.value=="" && strpr_sel.value=="" )
		{
				alert("Please select your search criteria.");
				return false;
		}
							
	}


	function linkSubmit(column, direction)
	{
		

		document.find_home.srt_column.value = column;
		document.find_home.srt_direction.value = direction;				
		document.find_home.submit();
		
	}


//function for slides		
		function HideShowDivs(div_obj,div_int)
		{
			
			var obj = document.getElementById(div_obj);
			var obj2;			
			var div_int2;
			
			ShowObj(obj);						
			if (! document.getElementById('displayed_div').value == "")
			{			
				
				div_int2 = document.getElementById('displayed_div').value;				
				if (div_int2 != div_int)
				{					
					obj2 = document.getElementById("slide"+div_int2);
					HideObj(obj2);				
					
				}
			
			}
			
			document.getElementById('displayed_div').value = div_int;			
			
		}

function HideShowDivs3(div_obj,div_int)
		{
			
			var obj = document.getElementById(div_obj);
			var obj2;			
			var div_int2;

			ShowObj(obj);	
					
			if (! document.getElementById('displayed2_div').value == "")
			{			
				
				div_int2 = document.getElementById('displayed2_div').value;				
				if (div_int2 != div_int)
				{					
					obj2 = document.getElementById("slide_popup"+div_int2);
					HideObj(obj2);				
					
				}
			
			}
			
			document.getElementById('displayed2_div').value = div_int;
			
		}	

//function for emergency contacts
function HideShowDivs2()
		{

			//get index 
			var ndx = document.emc.community.selectedIndex;
			var div_int = document.emc.community.options[ndx].value;
			//var obj = document.getElementById(div_obj);
			var obj = document.getElementById("slide"+div_int);
			var obj2;			
			var div_int2;
						
			ShowObj(obj);
						
			if (! document.getElementById('displayed_div').value == "")
			{			
				
				div_int2 = document.getElementById('displayed_div').value;				
				if (div_int2 != div_int)
				{					
					obj2 = document.getElementById("slide"+div_int2);
					HideObj(obj2);				
					
				}
			
			}
			
			document.getElementById('displayed_div').value = div_int;			
			
		}		
		
		function ShowObj(obj)
		{			
			obj.style.visibility = "visible";
			obj.style.display = "block";			
		}
		
		function HideObj(obj)
		{
			obj.style.visibility = "hidden";
			obj.style.display = "none";					
		}
		
		
function pdf_popup(filename)
{

	win = window.open("templates/inc/pdf_popup.php?fname="+filename,"POPUP","menubar=0");
	win.focus();

}

function img_popup(filename, img_type,action)
{
	var ht = 500;
	var wth = 600;
	if (img_type=="model_plans" || img_type=="land_agreement" || img_type=="land_docs" || img_type=="land_brochure")
	{
		ht = 650;
		wth = 625;
	}
	
	win = window.open("templates/inc/pdf_popup.php?fname="+filename+"&img_type="+img_type+"&action="+action,"POPUP","menubar=0 ,width="+wth+", height="+ht+", resizable=1");
	win.focus();

}

function img_popup2(recid,action, imgid)
{

	var ht = 500;
	var wth = 600;
		
	win = window.open("index.php?component=msc&action=popup&recid="+recid+"&pgaction="+action+"&imgid="+imgid,"POPUP","menubar=0 ,width="+wth+", height="+ht+", resizable=1,statusbar=0,location=no");
	win.focus();

}

function forgot_password()
{

	var ht = 500;
	var wth = 600;

	win = window.open("index.php?component=msc&action=iforgot","POPUP","menubar=0 ,width="+wth+", height="+ht+", resizable=1,statusbar=0,location=no");
	win.focus();

}