window.onload = loader; 

function loader() {
    if (GBrowserIsCompatible()) { 

      // A function to create the marker and set up the event window
      // Dont try to unroll this function. It has to be here for the function closure
      // Each instance of the function preserves the contends of a different instance
      // of the "marker" and "html" variables which will be needed later when the event triggers.    
      function createMarker(point,html) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        return marker;
      }

      // Display the map, with some controls and set the initial location 
      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(42.136232,-87.79722),13);
    
      // Set up three markers with info windows 
    
      var point = new GLatLng(42.136232,-87.79722);
      var marker = createMarker(point,'<p style="white-space: nowrap;">Northbrook Montessori<br /><a href="http://www.google.com/maps?q=Northbrook+Ave,+Northbrook,+IL+60062,+USA&ie=UTF8&ll=42.136232,-87.79722&spn=0.008051,0.011823&z=16&iwloc=addr&om=1">Need Directions?</a></p>')
      map.addOverlay(marker);

    }
    
    // display a warning if the browser was not compatible
    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }


}

		
		var IE = (document.all) ? 1 : 0;
var DOM = 0; 
if (parseInt(navigator.appVersion) >=5) {DOM=1};

        function txtShow( cId, txt2show ) {
            // Detect Browser
            if (DOM) {
							var viewer = document.getElementById(cId);
              viewer.innerHTML=txt2show;
            } else if(IE) {
               document.all[cId].innerHTML=txt2show;
            }
        }//txtshow
        
        function getTxt( cId ) {
            var output = "";
            // Detect Browser
            if (DOM) {
		var viewer = document.getElementById(cId);
		output = viewer.value;
            }
            else if(IE) {
                output = document.all[cId].value;
            }
            return output;
        }//getTxt
		
		function countChars(cBoxName, cTxtName, maxKeys) {
			var str = new String(getTxt(cBoxName));
			var len = str.length;
			var showstr = '<span class="alert-pos">' + len + ' characters of ' + maxKeys + ' entered</span>';
			if (len > maxKeys) showstr = '<span class="alert">' + len + ' characters of ' + maxKeys + ' entered</span><br /><span class="alert">Too many characters, please edit content</span>';
			txtShow( cTxtName, showstr );
		}
		
		function ValidChars(sText,ValidChars) {
			var IsNumber=true;
			var Char;
			for (i = 0; i < sText.length && IsNumber == true; i++) { 
				Char = sText.charAt(i); 
				if (ValidChars.indexOf(Char) == -1)  {
					IsNumber = false;
				}
			}
			return IsNumber;
		}
		
		function checkform (form) {
			
			if (form.fullname.value == "") {
			 alert( "Please enter your full name" );
			 form.fullname.focus();
				return false;
			}
		
			if (form.email.value.length < 5) {
			 alert( "Please enter your email" );
			 form.email.focus();
				return false;
			}
		
			if (form.comments.value.length < 10) {
			 alert( "Please enter 10 or more characters for the comments" );
			 form.comments.focus();
				return false;
			}
		
		}