
var curHmType = "";

function selectHomeType(grptype)
	{
		$('#lnkSFH').css({'font-weight':'normal'});
		$('#lnkTH').css({'font-weight':'normal'});
		$('#lnkVL').css({'font-weight':'normal'});
		$('#lnkQDH').css({'font-weight':'normal'});
	
		switch (grptype)
       	{
        	case "singlefamily":
                    
				$('#lnkSFH').css({'font-weight':'bold'});	
            	$('#divVillas').hide();
				$('#divQuick').hide();
				$('#divSFHomes').show();
				
				displayHomes("pipernewengland");
                
                break;
                    
            case "townhomes":
                
				$('#lnkTH').css({'font-weight':'bold'});
				$('#divSFHomes').hide();
				$('#divVillas').hide();
				$('#divQuick').hide();
				
				displayHomes(grptype);
				
                break;
					
            case "villas":
                
				$('#lnkVL').css({'font-weight':'bold'});
				$('#divSFHomes').hide();
				$('#divQuick').hide();
				$('#divVillas').show();
				
				displayHomes("villasamherst");
					
                break;
				
			case "quick":
                
				$('#lnkQDH').css({'font-weight':'bold'});
				$('#divSFHomes').hide();
				$('#divVillas').hide();
				$('#divQuick').show();
				
				displayHomes("lot80");
					
                break;
                    
            default:
                
        };
	
	};
	
	function displayHomes(hmtype)
	{
		
		$("img[homenav='true']").each(function(){
            	
				$(this).attr('src', '/images/clear.gif');
                
            });
			
		$("a[homenav='true']").each(function(){
            	
				$(this).css('color', '#aa9d71');
                
            });
		
		
		$("img[homessf='" + hmtype + "']").attr('src', '/images/red_arrow.gif');
		$("a[homessf='" + hmtype + "']").css('color', '#7a0026');
	
		if(hmtype.indexOf("piper") >= 0)
		{
			
			$("#div_VT_Stover").hide();
			$("#div_VT_Doyle").hide();
			$("#div_VT_Bentley").hide();
			
			if(curHmType.indexOf("piper") == -1)
			{
				
				$("#div_VT_Piper").show();
				
				$('.slideshow').cycle({
					fx: 'fade',
					timeout: 1000
				});
				
			};
		}
		else if(hmtype.indexOf("stover") >= 0)
		{
			
			$("#div_VT_Piper").hide();
			$("#div_VT_Doyle").hide();
			$("#div_VT_Bentley").hide();
			
			if(curHmType.indexOf("stover") == -1)
			{
				
				$("#div_VT_Stover").show();
				
				$('.slideshow').cycle({
					fx: 'fade',
					timeout: 1000
				});
				
			};
		}
		else if(hmtype.indexOf("bentley") >= 0)
		{
			
			$("#div_VT_Piper").hide();
			$("#div_VT_Doyle").hide();
			$("#div_VT_Stover").hide();
			
			if(curHmType.indexOf("bentley") == -1)
			{
				
				$("#div_VT_Bentley").show();
				
				$('.slideshow').cycle({
					fx: 'fade',
					timeout: 1000
				});
				
			};
		}
		else if(hmtype.indexOf("doyle") >= 0)
		{
			
			$("#div_VT_Piper").hide();
			$("#div_VT_Bentley").hide();
			$("#div_VT_Stover").hide();
			
			if(curHmType.indexOf("doyle") == -1)
			{
				
				$("#div_VT_Doyle").show();
				
				$('.slideshow').cycle({
					fx: 'fade',
					timeout: 1000
				});
				
			};
		}
		else
		{
			$("#div_VT_Piper").hide();
			$("#div_VT_Stover").hide();
			$("#div_VT_Doyle").hide();
			$("#div_VT_Bentley").hide();
		};
	
		$("#divHomesDisplay").load("/homes/" + hmtype + ".html");
		
		curHmType = hmtype;
		
	};
	
	function openFloorPlan(hmtype)
	{
	
		$("#divFloorPlan").html("<table style='width:775px;' align='center' border='0'><tr>" +
									"<td align='left'><a class='darkred' href='/pdf/" + hmtype + "_floorplan.pdf' target='_blank'>Download PDF</a></td>" +
									"<td align='right'><a class='darkred' href='javascript:void(0);' onclick='$.unblockUI();return false;'>Close Window</a></td>" +
									"</tr>" +
									"<tr><td colspan='2' style='vertical-align:center;'><br><img src='/images/homes/popup_" + hmtype + "_plan.gif'></td></tr></table>");
		
		$.blockUI({ message: $('#divFloorPlan'), css: {}, 
                                                overlayCSS:  { 
                                                        backgroundColor:'#333333', 
                                                        opacity: '0.7' }, 
                                                fadeIn: 500 });
												
										
	
	};
	
	function thumbSwap(divid,mouse)
	{
		if(mouse == "over")
		{
			document.getElementById(currThumbOverDivId).style.borderColor = "#ffffff";
		
			currThumbOverDivId = divid;
		
			document.getElementById(divid).style.borderColor = "#7a0026";
			document.getElementById(divid).style.cursor = "pointer";
			document.getElementById("HomesMainImg").src="/images/homes/" + divid + "_lrg.jpg";
		}
		else
		{
			document.getElementById(currThumbOverDivId).style.cursor = "default";
		};
	};
	
	function goToVTLink(hmtype)
	{
		
		var vtLink = "";
		
		switch(hmtype)
		{
			case "piper" :
      			vtLink = "http://www.visualtour.com/showvt.asp?t=2173436&sk=16";
      			break;
			case "doyle" :
      			vtLink = "http://www.visualtour.com/showvt.asp?t=2227159&sk=16";
      			break;
			case "stover" :
      			vtLink = "http://www.visualtour.com/showvt.asp?t=2220570&sk=16";
      			break;
			case "bentley" :
      			vtLink = "http://www.visualtour.com/show.asp?t=2221582&prt=10003";
      			break; 	
		}
		
		var popupWindow;
		popupWindow = window.open(vtLink, "showPopUp", "width=750,height=500,top=10,left=10,resizable=yes,scrollbars=yes,location=yes");
		popupWindow.focus();
		
	};
