

// ///////////////////////////////////////////////////////////////////
// Code for custom drop down - see DelWebb home page for example of usage.  //
// Uses jquery library.                                                                                                 //
// ////////////////////////////////////////////////////////////////////

		$(document).ready(function() {
			var $items = $('#listBox ul li');
			var $listBox = $('#listBox');
			var minWidth = $('#ddText').outerWidth() + $('#btn').outerWidth();

			$('#btn').click(function() {//alert("0");alert($('#ddText').eq(0).offset().left);
				if($listBox.css("display")=="none") {
					var left = $('#ddText').eq(0).offset().left;
				  var brVer = jQuery.browser.version;
				  //alert(brVer); alert(left);
				  left = left - 24; // IE 7 by default
				  if(brVer.substr(0,2) != "7.") {
				    if(brVer.substr(0,2) == "6.") { left = left - 4; }
				    else {
				      if (brVer.substr(0,3) == "1.9") { left = left - 7; }
				    }
				  }  
					$listBox.css("left",left).css("min-width",minWidth);
					$listBox.show("fast", function() {
						$listBox.scrollTop(0).eq(0).focus();
					});
				}
				else {
					$listBox.hide("fast");
				}
			});

			$items.click(function(e) {
				$('#ddText').val($(this).text());
				$('#ddValue').val($(this).attr("value"));
				$listBox.hide("fast");
			});
			
			$('#ddText').click(function() {
				$('#btn').click();
			});

			$items.hover(function() {
					$(this).addClass("highLight");
				}, function() {
					$(this).removeClass("highLight");
				}
			);

			$listBox.blur(function(e) {
				$listBox.hide("fast");
			});
		});
		
//////////////////////////////////////////////////////

		$(document).ready(function() {
		// this is for Delwebb home page community selection
			var $items1 = $('#listBox1 ul li');
			var $listBox1 = $('#listBox1');
			var minWidth1 = $('#ddText1').outerWidth() + $('#btn1').outerWidth();

			$('#btn1').click(function() {//alert("1"); alert($('#ddText').eq(0).offset().left);
			                              //alert(jQuery.browser.version);
				if($listBox1.css("display")=="none") {
				  var left1 = $('#ddText1').eq(0).offset().left;
				  var brVer = jQuery.browser.version;
				  //alert(brVer); alert(left1); 
				  var adj = left1 - 315;  // adjustment for window size - 315 is full size on 1024x768
				  left1 = left1 - adj - 28; // IE 7 by default
				  if(brVer.substr(0,2) != "7.") {
				    if(brVer.substr(0,2) == "6.") { left1 = left1; }
				    else {
				      if (brVer.substr(0,3) == "1.9") { left1 = left1 - 2; }
				    }
				  }  
					$listBox1.css("left",left1).css("min-width",minWidth1);
					$listBox1.show("fast", function() {
						$listBox1.scrollTop(0).eq(0).focus();
					});
				}
				else {
					$listBox1.hide("fast");
				}
			});

			$items1.click(function(e) {
				$('#ddText1').val($(this).text());
				$('#ddValue1').val($(this).attr("value"));
				$listBox1.hide("fast");
			});
			
			$('#ddText1').click(function() {
				$('#btn1').click();
			});

			$items1.hover(function() {
					$(this).addClass("highLight");
				}, function() {
					$(this).removeClass("highLight");
				}
			);

			$listBox1.blur(function(e) {
				$listBox1.hide("fast");
			});
		});

/////////////////////////////////////////////////////////////////////

		$(document).ready(function() {
		// this is for Pulte home page region selection
			var $items2 = $('#listBox2 ul li');
			var $listBox2 = $('#listBox2');
			var minWidth2 = $('#ddText2').outerWidth() + $('#btn2').outerWidth();

			$('#ddText2').click(function() {
			    //alert("2"); alert($listBox2.css("display"));
			    //alert($('#ddText2').eq(0).offset().top);
				if($listBox2.css("display")=="none") { 
					var left2 = $('#ddText2').eq(0).offset().left;
					var top2 = $('#listBox2').eq(0).offset().top;
				    var brVer = jQuery.browser.version;
			        //alert(brVer); 
			        //alert(left2);
			        var adj = left2 - 530;  // adjustment for window size - 530 is full size 
			        left2 = left2 -adj - 530; // IE 7 by default
			        top2 = top2 + 156;
			        if(brVer.substr(0,2) != "7.") {
				        if(brVer.substr(0,2) == "6.") { left2 = left2; //top2 = top2+51;
				        }
				        else {
				            if (brVer.substr(0,3) == "1.9") { left2 = left2; }
				        }
				    }  
				    //else { top2 = top2 - 186; } // IE7
				    //alert(left2); alert(minWidth2);
					$listBox2.css("left",left2).css("min-width",minWidth2);
					
					$listBox2.show("fast", function() {//alert("show");
						$listBox2.scrollTop(0).eq(0).focus();
					});
				}
				else {
					$listBox2.hide("fast");
				}
			});

			$items2.click(function(e) {
			    //alert($(this).text()); alert($(this).text().substring(0,19));
			    // Specify number of characters to display in the input box to avoid ovelapping with arrow image!
			    if($(this).text() == "Select an Area of Interest") { $('#ddText2').val($(this).text()); }
				else { $('#ddText2').val($(this).text().substring(0,24)); }
				$('#ddValue2').val($(this).attr("value"));
				$listBox2.hide("fast");
			});
			

			$items2.hover(function() {
					$(this).addClass("highLight");
				}, function() {
					$(this).removeClass("highLight");
				}
			);

			$listBox2.blur(function(e) {
				$listBox2.hide("fast");
			});
		});
		

// /////////////////////////////////////
// Process custom drop down selection //
// /////////////////////////////////////

function CustomDropDownSelected (value)
{
  document.location.href = ".." + value;
}

