/* ---------------------------------------------------------------
 initMap() - Initalizes objects for an embedded Google Map. 
 --------------------------------------------------------------- */

var markerSchool;
var markerVarsity; 
var markerBsquad;
var markerNinth;

// bubble messages
var strMsgSchool = "";
var strMsgVarsity = "";
var strMsgBsquad = "";
var strMsgNinth = "";

function initMap() {
	// alert("Go fire!");
	if (GBrowserIsCompatible()) {        
	
	  
	  // map center
	  var cntrLatLon = new GLatLng(44.854469,-93.651023);
//						44.85337,-93.65304
	  var baseZoom = 15;
	  
	  // markers
	  markerSchool = new GMarker( new GLatLng(44.8579,-93.6453) );
	  markerVarsity = new GMarker( new GLatLng(44.85327,-93.65811) );
	  markerBsquad = new GMarker( new GLatLng(44.851156,-93.642768) );
	  markerNinth = new GMarker( new GLatLng(44.851823,-93.642762) );

	  
	  var isZoomed = false;
	  var objSize = new GSize(750,300);
	  var map = new GMap2(document.getElementById("map_canvas"), {size:objSize} );
	  var cntrlOverview = new GOverviewMapControl();
	
	  
	  map.addControl( new GLargeMapControl() );
	  map.addControl( cntrlOverview );
	  map.addControl( new GMapTypeControl() );
	  map.setCenter(cntrLatLon, baseZoom);
	  map.setMapType(G_HYBRID_MAP);
	
	  map.addOverlay(markerSchool );
	  map.addOverlay(markerVarsity );
	  map.addOverlay(markerBsquad );
	  map.addOverlay(markerNinth );
	  
	  // Register event listeners
	  GEvent.addListener(markerSchool , "click", function(){markerSchool .openInfoWindowHtml(strMsgSchool);});
	  GEvent.addListener(markerVarsity , "click", function(){markerVarsity .openInfoWindowHtml(strMsgVarsity );});
	  GEvent.addListener(markerBsquad , "click", function(){markerBsquad .openInfoWindowHtml(strMsgBsquad );});
	  GEvent.addListener(markerNinth , "click", function(){markerNinth .openInfoWindowHtml(strMsgNinth );});
	
	  // display Message
	  markerVarsity.openInfoWindowHtml(strMsgVarsity);  
	  document.body.onUnload = GUnload;
	/*
	*/
	}
}


/* ---------------------------------------------------------------
 popWin(strIn, width, height) - Opens a new browser window
 --------------------------------------------------------------- */
function popWin(strIn, width, height) {
	if (width = void(0)) width = 520
	else width = width+20;

	if (height= void(0)) height= 320
	else height= height+20;

	var strArgs = 'left=50,height=500,width=800,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes';
	var newWin = window.open('', newWin, strArgs);
	newWin.location = strIn;
	newWin.focus();
}

/* ---------------------------------------------------------------
 showImg(strSrc, strTargetId) - swaps the source of the target image with the 
 arg received.
 --------------------------------------------------------------- */
var targetImage = null;

function showImg(strSrc, strTargetId, objIn) {
	popWin(strSrc);

/*
	if (strTargetId == void(0)) strTargetId = "targetPic";
	if (targetImage == null) targetImage = findDOM(strTargetId, false); 
	targetImage.src = strSrc;
*/
}


/* ---------------------------------------------------------------
 getUrlValue - feed in the name of a request parameter, get back
 the string value of the parameter, or a blank string if not found.
 --------------------------------------------------------------- */
function getUrlValue(strNameIn) {
	var arrParms = window.location.search.split("&");
	var strReturn = "";
	for(var i=0; i<arrParms.length; i++) {
		if ( arrParms[i].indexOf(strNameIn) > -1)  {
			arrTmp = arrParms[i].split("=");
			strReturn = arrTmp[1];
			break;
		}
	}	
	return strReturn;
}

/* ---------------------------------------------------------------
 This function is the empty hook for other onload actions to be
 overridden elsewhere.
 --------------------------------------------------------------- */
function onLoadHook() {
	if ( document.getElementById("map_canvas") ) {
		strMsgSchool = document.getElementById("msg_school").innerHTML;
		strMsgVarsity = document.getElementById("msg_varsity").innerHTML;
		strMsgBsquad = document.getElementById("msg_Bsquad").innerHTML;
		strMsgNinth = document.getElementById("msg_ninth").innerHTML;
		initMap();
	} 
}

/* ---------------------------------------------------------------
 This function overrides the stock function, but adds a hook for
 other onload actions.
 --------------------------------------------------------------- */

function doPageLoad(aMessage,ifConfirm,ifClose,errField){
	// hook to blank function
	onLoadHook();
    window.focus();
    if(aMessage!=null){
        if(ifConfirm){
            ifClose=confirm(aMessage);
        }else{
            doAlert(aMessage);
        }
        if(ifClose){
            window.close();
            return;
        }
    }
    submitAction=false;
    var targetField=doPageFocus(errField);
    if(targetField!=null) try {
        targetField.focus();
    }catch(ignore) {}

}


/* Settings for Statcounter counter
var sc_project=3011836;
var sc_invisible=1;		// 0 - false (visible), 1 - true (invisible)
var sc_partition=32;
var sc_security="08511a4e";
//var sc_text=2;
*/
