var publisherId = 12;
runningmapInit();	
var isShowingAds = true;
		
function runningmapInit(){
	try { Lat49.initAds(publisherId);}
	catch(e){}
	var runningmapFlashVars = {routeID:getQueryVariable("id")}
	var runningmapFlashParams = {scale:"exactFit", AllowScriptAccess:"always", wmode:"transparent"};
	swfobject.embedSWF(	"media/flash/runningmap.swf", 
						"rm-application", 
						"100%", 
						"100%", 
						"9.0.124", 
						"scripts/expressInstall.swf", 
						runningmapFlashVars, 
						runningmapFlashParams);
}
	
function getQueryVariable(variable) {
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split("=");
			if (pair[0] == variable) return pair[1];
	}
}

function runningmapShowAds(p_isShowingAds){
	isShowingAds = p_isShowingAds;
	if (isShowingAds) document.getElementById("lat49_AD").style.display = "block";
	else  document.getElementById("lat49_AD").style.display = "none";
}
	


function notifyPosition(lat,lon,zoom){
	if ((lat==0&&lon==0) || !isShowingAds){
		 document.getElementById("lat49_AD").style.display = "none";
	}
	else{ 
		document.getElementById("lat49_AD").style.display = "block";
		var convertedZoom = Lat49.Tile.convertYahooZoom(zoom);
		Lat49.updateAdByLatLon("lat49_AD",lat,lon,convertedZoom);
	}
}	
			
