function showWorld() {
	document.getElementById('world-tab-expanded').style.display = 'block'; 
	document.getElementById('world-tab').style.visibility = 'hidden';
}

function hideWorld() {
	document.getElementById('world-tab-expanded').style.display = 'none'; 
	document.getElementById('world-tab').style.visibility = 'visible';
}

function initialize() {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("busdir_entry_map"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		
		if(ukbased) {
			map.setCenter(new GLatLng(54.813348417419284, -4.081298828125), 5);			
		}
		else {
			map.setCenter(new GLatLng(addresses[-1][0], addresses[-1][1]), 5);
		}
	
		for(i=-1;i<(addresses.length);i++) {
			if(addresses[i][0]!=0 && addresses[i][1]!=0) {
				markers[i] = new createMarker(addresses[i][0],addresses[i][1],addresses[i][2]);
				map.addOverlay(markers[i]);
			}
		}
	}
}

function createMarker(latitude, longitude, html) {
	var point = new GLatLng(latitude, longitude);
	var marker = new GMarker(point);
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(html);
		});
	return marker;
}

function showAddress(id) {
	markers[id].openInfoWindowHtml(addresses[id][2]);
}

function showSponsor(id) {
	document.getElementById('sponsor'+id).style.display = 'block';	
}

function hideSponsor(id) {
	document.getElementById('sponsor'+id).style.display = 'none';	
}

function clearBox(f) {
	if(f.defaultValue==f.value) {
		f.value = '';	
	}
}

function restoreBox(f) {
	if(f.value=='') {
		f.value = f.defaultValue;	
	}
}

function checkSearch(f) {
	if(f.q.value!='') {
		if(f.q.value!=f.q.defaultValue)	 {
			return truel
		}	
	}
	return false;
}

var player = null;
var currentindex = 0;
var previousfile;
function playerReady(thePlayer) {
	player = document.getElementById(thePlayer.id);
	
}

function printPlaylistData() {
	var plst = null;
	plst = player.getPlaylist();
	if (plst) {
		var txt = '';
		for(var itm in plst) { 
			//txt += '<a href="JavaScript:player.sendEvent(\'LOAD\', {file: \''+plst[itm].file+'\', link: \''+plst[itm].link+'\'})"><img src="'+plst[itm].image+'" /></a>';
			//txt += '<a href="'+plst[itm].link+'"><img src="'+plst[itm].image+'" /></a>';
			txt += '<ul>';
			txt += '<li><a href="JavaScript:player.sendEvent(\'LOAD\', {file: \''+plst[itm].file+'\', link: \''+plst[itm].link+'\'})"><strong>'+plst[itm].title+'</strong></a></li>';
			//txt += '<li><a href="'+plst[itm].link+'"><strong>'+plst[itm].title+'</strong></a></li>';
			//txt += '<li>'+plst[itm].description+'</li>';
			txt += '</ul>';
		}
		var tmp = document.getElementById("plstDat");
		if (tmp) { tmp.innerHTML = txt; }
	} else {
		setTimeout("printPlaylistData()",100);
	}	
}
