


function loadMap( mapdivs ){
	mapdivs.each(function () {
		var mapdiv = $(this);
	if (GBrowserIsCompatible()) {
		var infoTabs = [];

		
		var table = mapdiv.children('table');
		var tbody = table.children('tbody');
		tbody.children('tr').each(function (){ 
			var tabname = $(this).children("td:first").html();
			var tabcontents = $(this).children("td:last").html();
			infoTabs.push( new GInfoWindowTab(tabname, tabcontents));
			});
				
		var map = new GMap2(mapdiv.get(0));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng( mapdiv.attr("data-lat"), mapdiv.attr("data-lon")), 13);

		// Our info window content

		                

		// Place a marker in the center of the map and open the info window
		// automatically
		var marker = new GMarker(map.getCenter());
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowTabsHtml(infoTabs);
		});
		map.addOverlay(marker);
		//marker.openInfoWindowTabsHtml(infoTabs);
	}
	});
}

//Read a page's GET URL variables and return them as an associative array.
function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
 
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
 
    return vars;
}

//Add a fixtures live panel using the key as the start page.
function addFixturesLivePanel( title, key ){

    document.write('<div class="panel">\n<div class="panel-wrapper">\n<h2 class="title">');
	document.write(title);
	document.write('</h2><iframe src ="fixturesPanel.html?key=');
	document.write(key);
	document.write('" class="frame"> <p>Your browser does not support iframes.</p></iframe>\n</div>\n</div>\n');	
}
//Add a fixtures live panel using the key as the start page.

function addFixturesLiveSlider( title, key ){

    var result = '<li id="';
	result += title;
	result += '">';
	result += '<iframe src ="fixturesPanel.html?key=';
	result += key;
	result += '" class="frame"> <p>Your browser does not support iframes.</p></iframe>\n</li>\n';
	
	return result
}
