
	/**************************************************************************/
	/* figure out current document height */
	function getDocHeight() {
		var D = document;
		return Math.max(
			Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
			Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
			Math.max(D.body.clientHeight, D.documentElement.clientHeight)
		);
	}
	/*************************************************************************
	/
	function clear_home_search(){
		$("#location").attr("value","");
		$("#min").attr("value","");
		$("#max").attr("value","");
		$("input[name=foreclosure]").attr("checked","");
		$("#beds option[value='0']").attr("selected","selected");
		$("#baths option[value='0']").attr("selected","selected");
		$("#property option[value='0']").attr("selected","selected");
	}*/
/**************************************************************************/
/**************************************************************************/
// BEGIN search box functionality
	//	clear input upon focus
	function input_focus(input){
		//alert(input);
		str = $("#"+input).attr('value');
		if(str=='City'  || str=='Zip Code' || str == 'MLS #' || str == 'Min' || str == 'Max' ){
			$("#"+input).val('');
		}
	}
	//restore the default value to an empty input upon blur
	function input_blur(input){
		str = $("#"+input).attr('value');
		id = $("#"+input).attr('id');
		if(str==''){
			if(id=='search_city'){
				$("#"+input).val('City');				
			}
			if(id=='search_zip'){
				$("#"+input).val('Zip Code');				
			}
			if(id=='search_mls'){
				$("#"+input).val('MLS #');				
			}
			if(id=='min'){
				$("#"+input).val('Min');				
			}
			if(id=='max'){
				$("#"+input).val('Max');				
			}
		}
	}
	//expand the search box downward
	var expand_search_open = false;
	function expand_search(){
		if(expand_search_open){	//close			
			$("#box2").animate({height:57},500);
			expand_search_open = false;
		}else{	//open			
			$("#box2").animate({height:140},500);
			expand_search_open = true;
		}
	}
	function clear_form(){
		$("#search_city").val("City");
		$("#search_mls").val("MLS #");
		$("#search_zip").val("Zip Code");
		$("#min").val("Min");
		$("#max").val("Max");
		$("#beds_input option:selected").attr("selected","");
		$("#bath_input option:selected").attr("selected","");
		$("#property_type option:selected").attr("selected","");
	}	
	
// END search box functionality
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/********************************************************************/
/* 	START functions dealing with the home page viewer	*/
	function change_main(img_num){
		current_viewer_image = img_num;
		$("#hover_title").html(main_item_title_arr[img_num]);
		$("#hover_desc").html(main_item_phrase_arr[img_num]);
		$("#viewer_arrow").css('top',thumb_numbs[img_num]);
		$(".sub_link").attr('href',image_links[img_num]);
		
		$("#image_2").attr('src',images[img_num].src);
		//alert(images[img_num]);
		$("#image_2").css('display','block');
		$("#image_2").stop().animate({top:0},400,function(){		
			$("#image_1").attr('src',images[img_num].src);
			$("#image_1").parent().attr('href',image_links[img_num]);
			$("#image_2").css('display','none');
			$("#image_2").css('top','-421px');
			$("#image_2").attr('src','');
		});
	}
	/**************************************************************************/
	function preloader(){
		 var i = 0;
		 for(i=0; i<images.length; i++){
			 imageObj = new Image();
			 imageObj.src=images[i];
			 images[i] = imageObj;
			 //alert(images[i].src);
		 }
	} 
	/**************************************************************************/
	function image_timer(){
		setInterval('advance_image();',8000);
	}
	/**************************************************************************/
	function advance_image(){
		//alert("advance_images");
		if(current_viewer_image<7){
			next_image = ++current_viewer_image;
		}else{
			next_image = 0;
		}
		change_main(next_image);
	}
/* 	END functions dealing with the home page viewer	*/
/**************************************************************************/
/********************************************************************/
	/* calls the ajax twitter update on the sidebar	*/
	function update_twitter(){
		setInterval('$("#twitter_onside").load("./content/twitter.php")',4500);
	}
/**************************************************************************/
/********************************************************************/
/* bing map */
	function GetMap(clat,clon,zoomLevel){
		map = new VEMap('myMap');
		map.SetDashboardSize(VEDashboardSize.Normal);
		map.LoadMap(new VELatLong(clat,clon));
		map.SetZoomLevel(zoomLevel);
		map.ShowDashboard();
		AddPushpin({lat:clat,lon:clon});
	}     
	function AddPushpin(p){
		var icon = new VECustomIconSpecification();	
		icon.Image ="http://www.google.com/mapfiles/marker.png";	
		var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(p['lat'],p['lon']));
		shape.SetCustomIcon(icon);
		shape.SetTitle('Jeffers Waterfront');
		shape.SetDescription('Jeffers Waterfront');
		map.AddShape(shape);
	}
	function BirdMap(p){
		bmap = new VEMap('bird_map');
		bmap.LoadMap();
		bmap.SetZoomLevel(12);
		bmap.SetCenter(new VELatLong(p['lat'],p['lon']));
		bmap.SetMapStyle(VEMapStyle.Birdseye);
		AddDetailPushpin(p);
	}     
	function AddDetailPushpin(p){
		var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(p['lat'],p['lon']));
		shape.SetCustomIcon(detail_icon);
		shape.SetTitle('<p>'+p['house_num']+' '+p['street']+'</p>');
		shape.SetDescription('<p>'+p['list_price']+'</p>');
		bmap.AddShape(shape);
	}


