			// for list, map, thumb and sort search pages.

			var noSwap = "no";

			// For image popups
			function change_search_value(selected_value) 
			{ 
				var searchTerm = "  search for ";				
				var theCoursesID = "search_courses_button";
				var theCollectionsID = "search_collections_button";
				var theOffersID = "search_offers_button";
				var theSiteID = "search_site_button";
				
				// set all images to unselected  so we only have to reset the selected image
				var theCoursesImage = "/images/golf/courses_unselected.jpg";
				var theCollectionsImage = "/images/golf/collections_unselected.jpg";
				var theOffersImage = "/images/golf/offers_unselected.jpg";
				var theSiteImage = "/images/golf/site_unselected.jpg";
				
				if (selected_value == "courses")
				{	
					var theCoursesImage = "/images/golf/courses_selected.jpg";
					var theImageHover = "/images/golf/courses_selected_hover.jpg";
					var theImageNoHover = "/images/golf/courses_selected.jpg";
					var theHoverID = "search_courses_button";
				}				
				else if (selected_value == "collections")
				{
					var theCollectionsImage = "/images/golf/collections_selected.jpg";
					var theImageHover = "/images/golf/collections_selected_hover.jpg";
					var theImageNoHover = "/images/golf/collections_selected.jpg";
					var theHoverID = "search_collections_button";
				}				
				else if (selected_value == "offers")
				{
					var theOffersImage = "/images/golf/offers_selected.jpg";
					var theImageHover = "/images/golf/offers_selected_hover.jpg";
					var theImageNoHover = "/images/golf/offers_selected.jpg";
					var theHoverID = "search_offers_button";
				}				
				else if (selected_value == "site")
				{
                    searchTerm = "  search entire ";
					var theSiteImage = "/images/golf/site_selected.jpg";
					var theImageHover = "/images/golf/site_selected.jpg";
					var theImageNoHover = "/images/golf/site_selected.jpg";
					var theHoverID = "search_site_button";
				}	
				
                MM_swapImage('search_courses_button','',theCoursesImage,1);
                MM_swapImage('search_collections_button','',theCollectionsImage,1);
                MM_swapImage('search_offers_button','',theOffersImage,1);
                MM_swapImage('search_site_button','',theSiteImage,1);
								
				if ((document.search_form.SearchType.value == selected_value) && (document.search_form.SearchType.value != "site"))
				{
					document.search_form.submit();
				}
				
				if ((document.search_form.searchString1.value == "  search for courses") || (document.search_form.searchString1.value == "  search for collections") || (document.search_form.searchString1.value == "  search for offers") || (document.search_form.searchString1.value == "  search entire site") || (document.search_form.searchString1.value == "")) 
				{
					document.search_form.searchString1.value = searchTerm + selected_value;		
				}
				
				document.search_form.SearchType.value = selected_value;	
			}

			// 
			function clearSearchBox()
			{
				if ((document.search_form.searchString1.value == "  search for courses") || (document.search_form.searchString1.value == "  search for collections") || (document.search_form.searchString1.value == "  search for offers") || (document.search_form.searchString1.value == "  search entire site") || (document.search_form.searchString1.value == "")) 
				{
					document.search_form.searchString1.value = "";
				}	
			}

			// 
			function clearSearchBox2()
			{
				if (document.detailed_search_form.searchString2.value == "  keyword") 
				{
					document.detailed_search_form.searchString2.value = "";
				}	
			}

         //////////////////////////////////////////////
         function show_allWeather(divTag)
         {
         	ed_show(divTag);
         	page_grey(0,0);
         }
			
         //////////////////////////////////////////////
         function show_offer(divTag,img)
         {
				document.getElementById('popup_offer').innerHTML = "";
         	ed_show(divTag);
         	page_grey(0,0);
         }

         function open_win(link, w, h) 
			{
				var options = "scrollbars,resizable,height=" + h + ",width=" + w;
	         window.open(link, 'ed_pop_win', options);
         }
			
			
        function open_offer_win(OfferID)
        {
            open_win('/offer_detail.php?offer_id=' + OfferID, 400, 400);		
        }

         function ed_show(layer_ref) 
			{
         	state = 'visible';

         	if (document.all) { //IS IE 4 or 5 (or 6 beta)
         		eval( "document.all." + layer_ref + ".style.visibility = state");
         	}

         	if (document.layers) { //IS NETSCAPE 4 or below
         		document.layers[layer_ref].visibility = state;
         	}

         	if (document.getElementById && !document.all) {
         		maxwell_smart = document.getElementById(layer_ref);
         		maxwell_smart.style.visibility = state;
         	}
         }
 
         function ed_hide(layer_ref) 
			{
         	var state = 'hidden';
         	var grey_ref = "grey_div";
				
				if (document.getElementById && document.all)
				{
					eval( "document.all." + layer_ref + ".style.visibility = state");
					document.getElementById(grey_ref).parentNode.removeChild(document.getElementById(grey_ref));	
				}
				else if (document.all) 
				{ //IS IE 4 or 5 (or 6 beta) 
					eval( "document.all." + layer_ref + ".style.visibility = state");
					eval( "document.all." + grey_ref + ".style.visibility = state");				
         	}
				
         	if (document.layers) { //IS NETSCAPE 4 or below
					document.layers[layer_ref].visibility = state;
					document.layers[grey_ref].visibility = state;
         	}

         	if (document.getElementById && !document.all) {
                
         		maxwell_smart = document.getElementById(layer_ref);
					if (maxwell_smart)
					{
						maxwell_smart.style.visibility = state;												
					}
					
					maxwell_smart_two = document.getElementById(grey_ref);
					if (maxwell_smart_two)
					{
						maxwell_smart_two.style.visibility = state;
						document.getElementById('grey_div').parentNode.removeChild(document.getElementById('grey_div'));
					}					
         	}
         }
			
			// these are for the google maps
			// these are var used in the createMarker function
			var gmarkers = [];
			var markerNum = 0;
			
			// A function to create the marker and set up the event window
			function createMarker(point, number,html,theNumber,theColor) 
			{
				var imageName = "";
				var baseIcon = new GIcon();
				baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
				baseIcon.iconSize = new GSize(22, 36);
				baseIcon.shadowSize = new GSize(35, 36);
				baseIcon.iconAnchor = new GPoint(11, 36);
				baseIcon.infoWindowAnchor = new GPoint(9, 2);
				baseIcon.infoShadowAnchor = new GPoint(18, 25);

				var icon = new GIcon(baseIcon);
				
                if ((theColor == "bed_icon") || (theColor == "info_icon")) 
                {
                    icon.image = "/images/golf/map_markers/" + theColor + ".png";
                }
				else if (theNumber)
				{
					if (theColor)
					{
						icon.image = "/images/golf/map_markers/marker_paddle_" + theColor + "_" + theNumber + ".png";
					}
					else
					{
						icon.image = "/images/golf/map_markers/marker_paddle_green_" + theNumber + ".png";
					}
				}
				else
				{
					if (theColor)
					{
						icon.image = "/images/golf/map_markers/marker_drop_" + theColor + ".png";
						
					}
					else
					{
						icon.image = "/images/golf/map_markers/marker_paddle_green.png";	
					}
				}

				
				var marker = new GMarker(point, icon);
				marker.id = 'marker'+point;
				GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }
				);
				
				// this is for the links to the marker
				gmarkers[markerNum] = marker;	
				markerNum++;						
									
				return marker;
			}


			// A function to create the marker and set up the event window
			function createLinksMarker(point, number,html,theNumber,theIcon) 
			{
				var imageName = "";
				var baseIcon = new GIcon();
				
				if (theIcon == "info_icon") 
				{  
					baseIcon.iconSize = new GSize(23, 22);
					baseIcon.iconAnchor = new GPoint(11, 23);
				}
				else if (theIcon == "bed_icon")
				{
					baseIcon.iconSize = new GSize(29, 21);
					baseIcon.iconAnchor = new GPoint(11, 23); 
				}
				else 
				{
					baseIcon.iconSize = new GSize(29, 21);
					baseIcon.iconAnchor = new GPoint(11, 36);
				}
				
				
				
				baseIcon.infoWindowAnchor = new GPoint(9, 2);
				baseIcon.infoShadowAnchor = new GPoint(18, 25);

				var icon = new GIcon(baseIcon);
				icon.image = "/images/golf/map_markers/" + theIcon + ".png";
				var marker = new GMarker(point, icon);
				marker.id = 'marker'+point;
				GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }
				);
				
				// this is for the links to the marker
				gmarkers[markerNum] = marker;	
				markerNum++;						
									
				return marker;
			}
			
			// This function picks up the click and opens the corresponding info window
			function myclick(i) 
			{
			  GEvent.trigger(gmarkers[i], "click");
			}						
			
			// this is code to move the map with the mouse
			function mouseMove(mousePt)
			{
				mouseLatLng = mousePt;
				var zoom = map.getZoom();
				var mousePx = normalProj.fromLatLngToPixel(mousePt, zoom);
			}
			
			// this is code to move the map with the scroll
			function wheelZoom(event) 
			{
				if (event.cancelable) event.preventDefault();
				 return false;
			}
			
			////
            function MM_swapImgSearchRestore(theButton) { 
				if (theButton == "courses")
				{
					var theID = "search_courses_button";
					
					if (document.search_form.SearchType.value == theButton)
					{
						var theImage = "/images/golf/courses_selected.jpg";
					}
					else
					{
						var theImage = "/images/golf/courses_unselected.jpg";
					}
				}				
				else if (theButton == "collections")
				{
					var theID = "search_collections_button";
					
					if (document.search_form.SearchType.value == theButton)
					{
						var theImage = "/images/golf/collections_selected.jpg";
					}
					else
					{
						var theImage = "/images/golf/collections_unselected.jpg";
					}
				}				
				else if (theButton == "offers")
				{
					var theID = "search_offers_button";
					
					if (document.search_form.SearchType.value == theButton)
					{
						var theImage = "/images/golf/offers_selected.jpg";
					}
					else
					{
						var theImage = "/images/golf/offers_unselected.jpg";
					}
				}				
				else if (theButton == "site")
				{
					var theID = "search_site_button";
					
					if (document.search_form.SearchType.value == theButton)
					{
						var theImage = "/images/golf/site_selected.jpg";
					}
					else
					{
						var theImage = "/images/golf/site_unselected.jpg";
					}
				}
				
				MM_swapImage(theID,'',theImage,1);



				// var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;	
			}

			function MM_swapSearchImage(theButton) { //v3.0
				if (theButton == "courses")
				{
					var theID = "search_courses_button";
					
					if (document.search_form.SearchType.value == theButton)
					{
						var theImage = "/images/golf/courses_selected_hover.jpg";
					}
					else
					{
						var theImage = "/images/golf/courses_unselected_hover.jpg";
					}
				}				
				else if (theButton == "collections")
				{
					var theID = "search_collections_button";
					
					if (document.search_form.SearchType.value == theButton)
					{
						var theImage = "/images/golf/collections_selected_hover.jpg";
					}
					else
					{
						var theImage = "/images/golf/collections_unselected_hover.jpg";
					}
				}				
				else if (theButton == "offers")
				{
					var theID = "search_offers_button";
					
					if (document.search_form.SearchType.value == theButton)
					{
						var theImage = "/images/golf/offers_selected_hover.jpg";
					}
					else
					{
						var theImage = "/images/golf/offers_unselected_hover.jpg";
					}
				}				
				else if (theButton == "site")
				{
					var theID = "search_site_button";
					
					if (document.search_form.SearchType.value == theButton)
					{
						var theImage = "/images/golf/site_selected.jpg";
					}
					else
					{
						var theImage = "/images/golf/site_unselected_hover.jpg";
					}
				}
				
				MM_swapImage(theID,'',theImage,1);
			}
						


			//////////////////////
			////////////////////
			////
			
			function MM_swapImgRestore() { //v3.0
				var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;	
			}
			
			function MM_preloadImages() { //v3.0
			  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
				 var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
				 if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
			}
			
			function MM_findObj(n, d) { //v4.01
			  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
				 d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
			  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
			  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
			  if(!x && d.getElementById) x=d.getElementById(n); return x;
			}
			
			function MM_swapImage() { //v3.0
			  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
				if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
			}
			
			
			function isIE6()
			{
				var agt=navigator.userAgent.toLowerCase();
				
				if(agt.indexOf("msie 6.0") != -1)
				{
					return true;
				}
				
				return false;
			}
			
			/**
			* @param mypoint string
			* @param myicon GIcon
			* @param mydesc  string(html)
			*/
			function cM(mypoint, myicon, mydesc) 
			{ 
				var marker = new GMarker(mypoint, myicon);
				GEvent.addListener(marker, "click", function()
				{
					marker.openInfoWindowHtml(mydesc) ;  
				});			
				return marker;
			}
			
			/**
			* @param sPath string(url)
			*/
			function cI(sPath)
			{

				var icon = new GIcon();
				icon.shadow = "http://www.google.com/mapfiles/shadow50.png";				
				icon.iconSize = new GSize(22, 36);
				icon.shadowSize = new GSize(35, 36);
				icon.iconAnchor = new GPoint(11, 36);
				icon.infoWindowAnchor = new GPoint(10, 10);	
				icon.infoShadowAnchor = new GPoint(18, 25);
				icon.image = sPath;
				return icon;
			}