 
    var mapLoaded = 0;
	var map;
	var geocoder;
	
     google.load("maps", "2"); 

// The CSS classes to use for active/inactive elements.
var activeClass = 'current';
var inactiveClass = 'inactive';

    /*
 
      // Call this function when the page has been loaded 
      function initialize() { 
        var map = new google.maps.Map2(document.getElementById("map")); 
        map.setCenter(new google.maps.LatLng(38.899634, -94.70758), 13); 
 
    
      } 
      google.setOnLoadCallback(initialize); 
	  */

	function initMap()
	{
		map = new GMap2(document.getElementById('mapTabContents')); 
		map.addControl(new google.maps.SmallMapControl()); 
		geocoder = new GClientGeocoder(); 
	}

   //-----------------------------------------------------
	function showAddress(address,map,geocoder,pinHTML,postingCompany,industry) 
	{ 
	  geocoder.getLatLng( 
		address, 
		function(point) 
		  { 
		  
		  if (!point) { 
			//alert(address + " not found"); 
		  } else { 
                        if (mapLoaded == 0)
                        {
			map.setCenter(point, 10); 
                        mapLoaded = 1;
                        }
			
			var marker;
			if (postingCompany == 'care.com')
			{
				 var blueIcon = new GIcon(G_DEFAULT_ICON);
//baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
        //blueIcon.shadowSize = new GSize(37, 34);
		blueIcon.iconSize = new GSize(32,32);
      
			
				 if (industry == 'pets')
				 {
					 
					  blueIcon.image = "http://www.hailongame.com/rover/care_pet_icon.png";
				 }
				 else if (industry == 'adult and seniors')
				 {
					  
					  blueIcon.image = "http://www.hailongame.com/rover/care_adult_icon.png";
				 }
				 else if (industry == 'home and lifestyle')
				 {
					 
					  blueIcon.image = "http://www.hailongame.com/rover/care_home_icon.png";
				 }
				 else if (industry == 'children')
				 {
					   
					  blueIcon.image = "http://www.hailongame.com/rover/care_child_icon.png";
				 }
				 else
				 {
					 
					  blueIcon.image = "http://www.hailongame.com/rover/care_home_icon.png";
				 }

				
				markerOptions = { icon:blueIcon };
				marker = new GMarker(point,markerOptions); 
			}
			else
			{
					marker = new GMarker(point);
			 }
		
			GEvent.addListener(marker, "mouseover", function()
			{
				
			  marker.openInfoWindowHtml(pinHTML); 
		
			});
			map.addOverlay(marker); 
			
		  } 
		} 
	  ); 
	}  // end showAddress
	
	//-----------------------------------


	//-----------------------------------
	function getEventSrc(e)
	{
		var srcEl;
		if (window.event) 
		{
			srcEl = window.event.srcElement; 
		}
		else
		{
			srcEl = e.target;
		}
		return srcEl;
	}


	//-----------------------------------
	function tabSelected(e)
	{
	
		 var obj= getEventSrc(e).parentNode;
		 
		 if (obj.id == 'oneTab')
		 {
			document.getElementById('oneTab').style.background= "url('/images/tab_selected.png')";
 			document.getElementById('twoTab').style.background = "url('/images/tab_unselected.png')";
 			document.getElementById('searchText').style.color = "#FFF";
  			document.getElementById('mapText').style.color = "#000";
			document.getElementById('searchTabContents').className = 'shown';
			document.getElementById('mapTabContents').className = 'hidden';
		}
		
		 else if (obj.id == 'twoTab')
		 {
		
 			document.getElementById('oneTab').style.background = "url('/images/tab_unselected.png')";
			document.getElementById('twoTab').style.background= "url('/images/tab_selected.png')";
  			document.getElementById('searchText').style.color = "#000";
  			document.getElementById('mapText').style.color = "#FFF";
  			document.getElementById('searchTabContents').className = 'hidden';
			document.getElementById('mapTabContents').className = 'shown';

			if (mapLoaded == 0)
			{
				initMap();
				bottomFunct();
			}
		}


		
	}
	
	//-----------------------------------
	/*
	function tabSelected(e)
	{
		 var obj= getEventSrc(e);
		 
		 //alert(obj.id + " " + obj.className);
		 
		 if (obj.id == 'searchTab')
		 {
			document.getElementById('mapTabContainer').className = '';
			document.getElementById('searchTabContainer').className = 'current';
 			document.getElementById('searchTabContents').className = 'shown';
			document.getElementById('mapTabContents').className = 'hidden';
		}
		else if (obj.id == 'mapTab')
		{
 			document.getElementById('mapTabContainer').className = 'current';
 			document.getElementById('searchTabContainer').className = '';
 			document.getElementById('searchTabContents').className = 'hidden';
			document.getElementById('mapTabContents').className = 'shown';

			if (mapLoaded == 0)
			{
				initMap();
				bottomFunct();
			}
		}		 
		 */
		 /* OLD
		 if (obj.id == 'searchTab')
		 {
			document.getElementById('mapTab').style.background = "url('http://www.hailongame.com/rover/tab_unselected.png')";
 			document.getElementById('searchTab').style.background = "url('http://www.hailongame.com/rover/tab_selected.png')";
			document.getElementById('searchTabContents').className = 'shown';
			document.getElementById('mapTabContents').className = 'hidden';
		}
		
		 else if (obj.id == 'mapTab')
		 {
 			document.getElementById('mapTab').style.background = "url('http://www.hailongame.com/rover/tab_selected.png')";
			document.getElementById('searchTab').style.background=  "url('http://www.hailongame.com/rover/tab_unselected.png')";
			document.getElementById('searchTabContents').className = 'hidden';
			document.getElementById('mapTabContents').className = 'shown';

			if (mapLoaded == 0)
			{
			initMap();
			}
		}
		
		*/
		
/*	}*/

//--------------------------------
//---------------------------------------------------
/*
//---------------------------------------------------
function search()
{

alert("hit search");
     mapLoaded = 0;
	var url= '/a/jobs/find-jobs';
	var searchStr = document.getElementById('searchTB').value;
	var searchIt = false;
	if (searchStr.length > 0)
	{
		if (searchStr != "Job Title, Skills or Company")
		{
			searchIt = true;
			url +='/q-'+encodeURI(searchStr);
		}
	}
	var zipStr = document.getElementById('zipTB').value;
	if (zipStr.length > 0)
	{
		if (zipStr != "City, State or ZIP")
		{
			searchIt = true;
			url +='/l-'+encodeURI(zipStr);
			url += '/mi-'+document.getElementById('radius').value; 

		}
	}
	//alert("url="+url);
	if (searchIt == true)
	{
		window.location = url;
	}
	else
	{
		//alert("no search");
	}
}	


*/
//---------------------------------------
function ajaxSearch(url)
{
	var xmlhttp=GetXmlHttpObject();
	
	if (xmlhttp==null)
	{
		alert ("Your browser does not support XMLHTTP!");
		return;
	}

	var d = new Date();
	url = url + "&date="+d.getMilliseconds();


	//xmlhttp.onreadystatechange = function(evt) {stateChanged(command,xmlhttp);}
	xmlhttp.open("GET",url,false);
	xmlhttp.send(null);


}

//--------------------------------------------
function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject)
	{
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}


