/* ---------------------------------------------------------------
 initMap() - Initalizes objects for an embedded Google Map. 
 --------------------------------------------------------------- */

var markerSchool;
var markerArena; 

// bubble messages
var strMsgSchool = "";
var strMsgArena = "";

function initMap() {
	// alert("Go fire!");
	if (GBrowserIsCompatible()) {        
	  
	  // map center
	  var cntrLatLon = new GLatLng(44.854469,-93.645);
//						
	  var baseZoom = 15;
	  
	  // markers ll=37.0625,-95.677068
	  markerSchool = new GMarker( new GLatLng(44.8579,-93.6453) );
	  markerArena = new GMarker( new GLatLng(44.8511,-93.64554) );

	  
	  var isZoomed = false;
	  var objSize = new GSize(500,350);
	  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(markerArena );
	  
	  // Register event listeners
	  GEvent.addListener(markerSchool , "click", function(){markerSchool.openInfoWindowHtml(strMsgSchool);});
	  GEvent.addListener(markerArena , "click", function(){markerArena.openInfoWindowHtml(strMsgArena);});
	
	  // display Message
	  markerArena.openInfoWindowHtml(strMsgArena);  
	  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;
		strMsgArena = document.getElementById("msg_arena").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=4239512;
var sc_invisible=1;
// 		0 - false (visible), 1 - true (invisible)
var sc_partition=49;
var sc_security="879b924c";
//var sc_text=2;

