var id;	
var x,y,z;
var map;

var district = '';
var lastmode = '';
var previousid = 0;
var previousplace = '';
var previoustown = '';
var previousdistrict = '';
var previouspicture = '';
var previouslongitude = 0;
var previouslatitude = 0;
var previousx = '';
var previousy = '';
var previouscategory = '';
var previousaddress = '';
var previousvolume = 0;
var currentid = 1;
var currenteventid = 0;
var currentplace = '';
var placelabel;
var activevideoid = 0;
var selecteddistrict = '';
var lastMapArgs = '1,1,1,1,1,1,1,1,1,1';

var placeLabel = new Array();
var placeHtml = new Array();
var placeDirectionsLabel = new Array();
var placeDirectionsHtml = new Array();

var eventLabel = new Array();
var eventHtml = new Array();
var eventDirectionsLabel = new Array();
var eventDirectionsHtml = new Array();

var visitorAttractionsMarkers = new Array();
var policeAndCouncilMarkers = new Array();
var accommodationMarkers = new Array();
var sportAndLeisureMarkers = new Array();
var localBusinessMarkers = new Array();
var eatingAndDrinkingMarkers = new Array();
var entertainmentMarkers = new Array();
var clubsAndAssociationsMarkers = new Array();
var corporateAndWeddingMarkers = new Array();
var areaVideoMarkers = new Array();
var eventMarkers = new Array();

var visitorAttractionsID = new Array();
var policeAndCouncilID = new Array();
var accommodationID = new Array();
var sportAndLeisureID = new Array();
var localBusinessID = new Array();
var eatingAndDrinkingID = new Array();
var entertainmentID = new Array();
var clubsAndAssociationsID = new Array();
var corporateAndWeddingID = new Array();
var areaVideoID = new Array();
var eventID = new Array();

var playlistIDArray = new Array();
var playlistRunning = false;
var playlistReady = false;
var playlistPosition = 0;
var playlistURL;
var playlistName;
var playlistID;

var fullscreenModeBefore = false;
var controlPanelVisible = false;
var widecontent = false;
var country;

var sitemode = 'places';
var displaysize = 4;
var panSpeed = 10;
var panMapUp;
var panMapDown;
var panMapLeft;
var panMapRight;

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	   myImage.outerHTML = strNewHTML	  
    }
}


function loadPlaylistArray(playlistArray) {
	playlistIDArray = playlistArray;	
}

function loadNextVideo() {
	playlistRunning = true;
	if(playlistPosition < playlistIDArray.length) {
		updatePlaceVideo(playlistIDArray[playlistPosition], false);
		setPositionMarker();
		try { updateStats(playlistIDArray[playlistPosition]); } catch(e) {}
		if(playlistPosition > 8) top.window.document.getElementById("videolistcontent").scrollTop+=18;
		playlistPosition++;
	}
	else {
		playlistPosition = 0;
		playlistEntryClick(0, playlistName);
	}
}

function setPositionMarker() {
	try {
		for (i=0; i<playlistIDArray.length; i++){
			document.getElementById("playlistentry" + i).className = 'playlistentry';
		}
		document.getElementById("playlistentry" + playlistPosition).className = 'playlistentryselected';
	}
	catch(e) {
	}
}

function playlistEntryClick(position, playlistID) {
	loadCategories();
	createPlaylist(position, playlistID);
	loadPlaylist('places-playlist-' + playlistID + '.asx');
}

function addToPlaylist(id) {
	playlistIDArray.push(id);
}

function deleteFromPlaylist(id, position) {
	if (position < playlistPosition) playlistPosition--; 
	playlistEntryClick(position, playlistName);
	var newPlaylistIDArray = new Array();
	for (i=0; i<playlistIDArray.length; i++) {
		if (playlistIDArray[i] != id) {
			newPlaylistIDArray.push(playlistIDArray[i]);
		}
	}
	if (playlistPosition >= newPlaylistIDArray.length) playlistPosition = newPlaylistIDArray.length-1;
	playlistIDArray = newPlaylistIDArray;
	setPositionMarker();
	if(playlistIDArray.length == 0) stopASF();
}

function clearPlaylist() {
	playlistIDArray = new Array();
	playlistPosition = 0;
}

function loadPlaylist(playlist){
	playlistURL = "playlists/" + playlist;
	if(!is_ie) {
		top.window.document.getElementById("mozillaplayerframe").style.visibility = 'visible';
		top.window.document.getElementById("mozillaplayerframe").contentWindow.location.href = "http://www." + country + "onvideo.com/mozillaplayer.asp?videodir=playlist&videourl=" + playlist + '&displaysize=' + displaysize;
	}
	else {
		playlistID = setInterval("checkPlaylistExists()", 50);
	} 
}

function checkPlaylistExists() {
	if(playlistReady) {
		clearInterval(playlistID);
		sovplayer.filename = playlistURL;
		showPlayer();
		playlistReady = false;
	}
}

function playlistExists() {
	playlistReady = true;	
}

function createPlaylist(startposition, playlistID){
	var loadnextvideo;
	playlistName = playlistID;
	playlistPosition = startposition;
	if(is_ie) loadnextvideo = true;
	document.getElementById("playlistgeneratorframe").contentWindow.location.href = 'http://www.' + country + 'onvideo.com/playlistgenerator.asp?startposition=' + startposition + '&playlistID=' + playlistID + '&loadnextvideo=' + loadnextvideo;
}

function addToVideoList(id){	
	document.getElementById("videolistholder").style.visibility = "visible";
	document.getElementById("videolistframe").contentWindow.location.href = 'http://www.' + country + 'onvideo.com/addtovideolist.asp?id=' + id;
	addToPlaylist(id);
}

function addDistrictToVideoList(district){	
	document.getElementById("videolistholder").style.visibility = "visible";
	document.getElementById("videolistframe").contentWindow.location.href = 'http://www.' + country + 'onvideo.com/adddistricttovideolist.asp?district=' + district;
}

function deleteVideoFromList(id, position){
	document.getElementById("videolistframe").contentWindow.location.href = 'http://www.' + country + 'onvideo.com/deletefromvideolist.asp?id=' + id;
	deleteFromPlaylist(id, position);
}

function clearVideoList(){	
	document.getElementById("videolistholder").style.visibility = "visible";
	document.getElementById("videolistframe").contentWindow.location.href = 'http://www.' + country + 'onvideo.com/clearvideolist.asp';
	clearPlaylist();
	stopASF();
}

function playlistEntryMouseOver(entry) {
	if(entry.className != 'playlistentryselected') entry.className='playlistentryhover';
}

function playlistEntryMouseOut(entry) {
	if(entry.className != 'playlistentryselected') entry.className='playlistentry';
}

function openSpecialOffer(filename){	
	window.open('uploads/specialoffers/' + filename);	
}

function getMap(mapcountry){  
	try {
		country = mapcountry;
		map = new GMap2(document.getElementById(country.toLowerCase() + "map"),{draggableCursor: 'move', draggingCursor: 'move'});
		map.setCenter(new GLatLng(54.80068486732233, -4.04296875), 5);
		map.enableContinuousZoom();
		map.enableDoubleClickZoom();	
		placelabel = document.createElement("div");
		document.getElementById(country.toLowerCase() + "map").appendChild(placelabel);
		placelabel.style.visibility="hidden";
		placelabel.style.zIndex="99";
		getVolume();
		setInterval("pingServer()", 10000);
		showSmallMapControls();
		
		panMapUp = new GSize(0,panSpeed);
		panMapDown = new GSize(0,-panSpeed);
		panMapLeft = new GSize(panSpeed,0);
		panMapRight = new GSize(-panSpeed,0);
		
		GEvent.addListener(map, "clearoverlays", function() {
			loadingMarkers(true);
	  	});
		
		GEvent.addListener(map, "addoverlay", function() {
			loadingMarkers(false);
	  	});
		
	}
	catch(e) {
	}
}

function openRSSNewsFeed(url) {
	window.open(url, 'rssnews');
}

function setSiteMode(mode) {
	if (mode == 'yourvideos') sitemode = 'yourvideos';
	else sitemode = 'places';
}

function loadingMarkers(visible){
	if(lastMapArgs != '0,0,0,0,0,0,0,0,0,0') {
		if (visible) {
			if(widecontent) top.window.document.getElementById("loadingmarkerswide").style.visibility = 'visible';
			else top.window.document.getElementById("loadingmarkers").style.visibility = 'visible';
			top.window.document.getElementById("selectcategory").style.visibility = 'hidden';
		}
		else {
			top.window.document.getElementById("selectcategory").style.visibility = 'hidden';
			top.window.document.getElementById("loadingmarkers").style.visibility = 'hidden';		
			top.window.document.getElementById("loadingmarkerswide").style.visibility = 'hidden';
		}
	}
	else {
		if (visible) {
			top.window.document.getElementById("selectcategory").style.visibility = 'visible';
			top.window.document.getElementById("loadingmarkers").style.visibility = 'hidden';
			top.window.document.getElementById("loadingmarkerswide").style.visibility = 'hidden';
		}
		else {
			top.window.document.getElementById("selectcategory").style.visibility = 'hidden';
			top.window.document.getElementById("loadingmarkers").style.visibility = 'hidden';
			top.window.document.getElementById("loadingmarkerswide").style.visibility = 'hidden';
		}
	}
}

function loadCategories() {
	if(lastMapArgs.search('0') != -1) {
		loadMapCategories('1,1,1,1,1,1,1,1,1,1');
		setMiniMapCategories('1','1','1','1','1','1','1','1','1','1');
	}
}

function addMarker(id, lat, lng, marker, information, videolink, place, town, district, picture, thumbnail, category, eventid){
	
	var gfxdir = 'places';
	if (sitemode == 'yourvideos') gfxdir = 'yourvideos';
	
	var icon = new GIcon();
	icon.image = marker;
	icon.iconSize = new GSize(10, 10);
	icon.shadowSize = new GSize(22, 10);
	icon.iconAnchor = new GPoint(6, 10);
	icon.infoWindowAnchor = new GPoint(5, 1);
	icon.infoShadowAnchor = new GPoint(18, 25);
	var bounds = map.getBounds();
	var southWest = bounds.getSouthWest();
	var northEast = bounds.getNorthEast();
	var lngSpan = northEast.lng() - southWest.lng();
	var latSpan = northEast.lat() - southWest.lat();
	var point = new GLatLng(lat, lng);
	var icon = new GMarker(point, icon);
	var tabsLabel = new Array();
	var tabsHtml = new Array();
	
	GEvent.addListener(icon, "mouseover", function() {
		showPlaceLabel(icon, place);
	  });
	  
	GEvent.addListener(icon, "mouseout", function() {
		hidePlaceLabel();
	});
	  
	GEvent.addListener(icon, "click", function() {
		updatePlaceVideo(id, false, eventid);
	  });
	
	map.addOverlay(icon);
	
	if((eval(eventid) == undefined)) {
		placeLabel[id] = 'Place Info';
		placeHtml[id] = '<table border=\"0\"><tr><td width=\"130\" valign=\"top\"><div class=\"videotext\">' + information + '</div></td><td width=\"105\" align=\"right\" valign=\"top\"><a href=\"javascript:updatePlaceVideo(' + id + ')\"><img src=\"http://www.' + country + 'onvideo.com/uploads/' + gfxdir + '/gfx/' + thumbnail + '\" width=\"96\" height=\"56\" style=\"border:1px solid #000000\"></a></td></tr><tr><td width=\"220\" colspan=\"2\"><br><div class=\"videotext\">' + videolink + '</div></td></tr></table>';
		placeDirectionsLabel[id] = 'Directions';
		placeDirectionsHtml[id] = '<div class=\"videotext\" style=\"border: 0px solid #000000;\"><form style=\"padding:0px;margin:0px\" id=\"directionsform\" action=\"http://maps.google.com\">From: <input id=\"saddr\" name=\"saddr\" type=\"text\" onkeypress=\"return handleEnter(this, event)\"><input id=\"daddr\" name=\"daddr\" type=\"hidden\" value=\"' + lat + ',' + lng + ' (' + place + ')\"><br><br><div style=\"width:200px;\">To: ' + place + '</div><br><input type=\"button\" value=\"Show Directions\" onclick=\"showDirections()\"></form></div>';
	}
	else {
		eventLabel[eventid] = 'Event Info';
		eventHtml[eventid] = '<table border=\"0\"><tr><td width=\"130\" valign=\"top\"><div class=\"videotext\">' + information + '</div></td><td width=\"105\" align=\"right\" valign=\"top\"><img src=\"http://www.' + country + 'onvideo.com/uploads/events/gfx/' + thumbnail + '\" width=\"96\" height=\"56\" style=\"border:1px solid #000000\"></td></tr><tr><td width=\"220\" colspan=\"2\"><br><div class=\"videotext\">' + videolink + '</div></td></tr></table>';
		eventDirectionsLabel[eventid] = 'Directions';
		eventDirectionsHtml[eventid] = '<div class=\"videotext\" style=\"border: 0px solid #000000;\"><form style=\"padding:0px;margin:0px\" id=\"directionsform\" action=\"http://maps.google.com\">From: <input id=\"saddr\" name=\"saddr\" type=\"text\" onkeypress=\"return handleEnter(this, event)\"><input id=\"daddr\" name=\"daddr\" type=\"hidden\" value=\"' + lat + ',' + lng + ' (' + place.replace(/&/g, ' and ') + ')\"><br><br><div style=\"width:200px;\">To: ' + place + '</div><br><input type=\"button\" value=\"Show Directions\" onclick=\"showDirections()\"></form></div>';
	}
	
	return icon;
}

function loadPlacesXML(url){
	
	var placeMarker;
	
	clearArrays();
	
	map.clearOverlays();
	
	GDownloadUrl(url, function(data, responseCode) {
	  
	  var xml = GXml.parse(data);
	  
	  try {
	  
		  var markers = xml.documentElement.getElementsByTagName("marker");
		  
		  for (var i = 0; i < markers.length; i++) {
			
			var id = parseInt(markers[i].getAttribute("id"));
			var place = markers[i].getAttribute("place");
			var address1 = markers[i].getAttribute("address1");
			var address2 = markers[i].getAttribute("address2");
			var town = markers[i].getAttribute("town");
			var postcode = markers[i].getAttribute("postcode");
			var district = markers[i].getAttribute("district");
			var picture = markers[i].getAttribute("picture");
			var thumbnail = markers[i].getAttribute("thumbnail");
			var category = markers[i].getAttribute("category");
			var lat = markers[i].getAttribute("lat");
			var lng = markers[i].getAttribute("lng");
			var point = new GLatLng(parseFloat(lat), parseFloat(lng));
			
			var pushpinicon = "PushpinMagnenta.gif";
			if(category == "Visitor Attractions") pushpinicon = "PushpinBlue.gif";
			if(category == "Accommodation") pushpinicon = "PushpinGreen.gif"; 
			if(category == "Sport & Leisure") pushpinicon = "PushpinRed.gif"; 
			if(category == "Eating & Drinking") pushpinicon = "PushpinOrange.gif"; 
			if(category == "Police & Council") pushpinicon = "PushpinYellow.gif"; 
			if(category == "Local Business") pushpinicon = "PushpinWhite.gif";
			if(category == "Entertainment") pushpinicon = "PushpinCyan.gif";
			if(category == "Clubs & Associations") pushpinicon = "PushpinMagnenta.gif";
			if(category == "Corporate & Wedding") pushpinicon = "PushpinPurple.gif";
			if(category == "Area Video") pushpinicon = "PushpinGrey.gif";
				
			var marker = "http://www." + country + "onvideo.com/gfx/pushpins/" + pushpinicon;
			var information = place + "<br>" + address1 + ((address1 != "") ? "<br>" : "") + address2 + ((address2 != "") ? "<br>" : "") + town + "<br>" + district + ((district != "") ? "<br>" : "") + postcode;
			var videolink = '<a href=\"javascript:updatePlaceVideo(' + id + ', true)\"><img src=\"http://www.' + country + 'onvideo.com/gfx/icons/playvideo.png\" border=\"0\" align=\"absbottom\"> <font size=\"1\">Play Video</font></a> <a href=\"javascript:addToVideoList(' + id + ')\"><img src=\"http://www.' + country + 'onvideo.com/gfx/icons/addtoplaylist.png\" border=\"0\" align=\"absbottom\"> <font size=\"1\">Add To Playlist</font></a>';
			
			placeMarker = addMarker(id, lat, lng, marker, information, videolink, place, town, district, picture, thumbnail, category);
			
			if(category == "Visitor Attractions") {
				visitorAttractionsMarkers.push(placeMarker);
				visitorAttractionsID[id] = visitorAttractionsMarkers.length-1;
			}
			if(category == "Accommodation") {
				accommodationMarkers.push(placeMarker);
				accommodationID[id] = accommodationMarkers.length-1;
			}
			if(category == "Sport & Leisure") {
				sportAndLeisureMarkers.push(placeMarker);
				sportAndLeisureID[id] = sportAndLeisureMarkers.length-1;
			}
			if(category == "Eating & Drinking") {
				eatingAndDrinkingMarkers.push(placeMarker);
				eatingAndDrinkingID[id] = eatingAndDrinkingMarkers.length-1;
			}
			if(category == "Police & Council") {
				policeAndCouncilMarkers.push(placeMarker);
				policeAndCouncilID[id] = policeAndCouncilMarkers.length-1;
			}
			if(category == "Local Business") {
				localBusinessMarkers.push(placeMarker);
				localBusinessID[id] = localBusinessMarkers.length-1;
			}
			if(category == "Entertainment") {
				entertainmentMarkers.push(placeMarker);
				entertainmentID[id] = entertainmentMarkers.length-1;
			}
			if(category == "Clubs & Associations") {
				clubsAndAssociationsMarkers.push(placeMarker);
				clubsAndAssociationsID[id] = clubsAndAssociationsMarkers.length-1;
			}
			if(category == "Corporate & Wedding") {
				corporateAndWeddingMarkers.push(placeMarker);
				corporateAndWeddingID[id] = corporateAndWeddingMarkers.length-1;
			}
			if(category == "Area Video") {
				areaVideoMarkers.push(placeMarker);
				areaVideoID[id] = areaVideoMarkers.length-1;
			}
			
		  }
	  }
	  catch(e){
	  	loadingMarkers(false);
	  }
	});
	
}

function loadYourVideosXML(url){

	var placeMarker;
	
	clearArrays();
	
	map.clearOverlays();
	
	GDownloadUrl(url, function(data, responseCode) {
	  
	  var xml = GXml.parse(data);
	  
	  try {
	  
		  var markers = xml.documentElement.getElementsByTagName("marker");
		  
		  for (var i = 0; i < markers.length; i++) {
			
			var id = parseInt(markers[i].getAttribute("id"));
			var title = markers[i].getAttribute("title");
			var username = markers[i].getAttribute("username");
			var usercountry = markers[i].getAttribute("usercountry");
			var uploadtime = markers[i].getAttribute("uploadtime");
			var town = markers[i].getAttribute("town");
			var district = markers[i].getAttribute("district");
			var picture = markers[i].getAttribute("picture");
			var thumbnail = markers[i].getAttribute("thumbnail");
			var category = markers[i].getAttribute("category");
			var lat = markers[i].getAttribute("lat");
			var lng = markers[i].getAttribute("lng");
			var point = new GLatLng(parseFloat(lat), parseFloat(lng));
			
			var pushpinicon = "PushpinMagnenta.gif";
			if(category == "Visitor Attractions") pushpinicon = "PushpinBlue.gif";
			if(category == "Accommodation") pushpinicon = "PushpinGreen.gif"; 
			if(category == "Sport & Leisure") pushpinicon = "PushpinRed.gif"; 
			if(category == "Eating & Drinking") pushpinicon = "PushpinOrange.gif"; 
			if(category == "Police & Council") pushpinicon = "PushpinYellow.gif"; 
			if(category == "Local Business") pushpinicon = "PushpinWhite.gif";
			if(category == "Entertainment") pushpinicon = "PushpinCyan.gif";
			if(category == "Clubs & Associations") pushpinicon = "PushpinMagnenta.gif";
			if(category == "Corporate & Wedding") pushpinicon = "PushpinPurple.gif";
			if(category == "Area Video") pushpinicon = "PushpinGrey.gif";
				
			var uploaddate = new Date(parseInt(uploadtime));
			var marker = "http://www." + country + "onvideo.com/gfx/pushpins/" + pushpinicon;
			var information = title + "<br>" + town + "<br>" + district + "<br><br>User : <img border=\"0\" src=\"http://www." + country + "onvideo.com/admin/stats/gfx/flags/" + usercountry + ".gif\" align=\"absbottom\"> " + username + "<br>Uploaded : " + uploaddate.getDate() + "/" + uploaddate.getMonth() + "/" + uploaddate.getYear();
			var videolink = '<a href=\"javascript:updatePlaceVideo(' + id + ', true)\"><img src=\"http://www.' + country + 'onvideo.com/gfx/icons/playvideo.png\" border=\"0\" align=\"absbottom\"> <font size=\"1\">Play Video</font></a> <a href=\"javascript:addToVideoList(' + id + ')\"><img src=\"http://www.' + country + 'onvideo.com/gfx/icons/videoeffects16x16.gif\" border=\"0\" align=\"absbottom\"> <font size=\"1\">Add To Playlist</font></a>';
			
			placeMarker = addMarker(id, lat, lng, marker, information, videolink, title, town, district, picture, thumbnail, category);
			
			if(category == "Visitor Attractions") {
				visitorAttractionsMarkers.push(placeMarker);
				visitorAttractionsID[id] = visitorAttractionsMarkers.length-1;
			}
			if(category == "Accommodation") {
				accommodationMarkers.push(placeMarker);
				accommodationID[id] = accommodationMarkers.length-1;
			}
			if(category == "Sport & Leisure") {
				sportAndLeisureMarkers.push(placeMarker);
				sportAndLeisureID[id] = sportAndLeisureMarkers.length-1;
			}
			if(category == "Eating & Drinking") {
				eatingAndDrinkingMarkers.push(placeMarker);
				eatingAndDrinkingID[id] = eatingAndDrinkingMarkers.length-1;
			}
			if(category == "Police & Council") {
				policeAndCouncilMarkers.push(placeMarker);
				policeAndCouncilID[id] = policeAndCouncilMarkers.length-1;
			}
			if(category == "Local Business") {
				localBusinessMarkers.push(placeMarker);
				localBusinessID[id] = localBusinessMarkers.length-1;
			}
			if(category == "Entertainment") {
				entertainmentMarkers.push(placeMarker);
				entertainmentID[id] = entertainmentMarkers.length-1;
			}
			if(category == "Clubs & Associations") {
				clubsAndAssociationsMarkers.push(placeMarker);
				clubsAndAssociationsID[id] = clubsAndAssociationsMarkers.length-1;
			}
			if(category == "Corporate & Wedding") {
				corporateAndWeddingMarkers.push(placeMarker);
				corporateAndWeddingID[id] = corporateAndWeddingMarkers.length-1;
			}
			if(category == "Area Video") {
				areaVideoMarkers.push(placeMarker);
				areaVideoID[id] = areaVideoMarkers.length-1;
			}
			
		  }
	  }
	  catch(e){
	  	loadingMarkers(false);
	  }
	});
	
}

function loadEventsXML(url){
	
	var placeMarker;
	
	hidePlaces();
	
	for (i=0; i<eventMarkers.length; i++) {
		eventMarkers[i].hide(); 
	}
	
	eventMarkers = new Array();
	
	GDownloadUrl(url, function(data, responseCode) {
	  
	  var xml = GXml.parse(data);
	  
	  try {
	  
		  var markers = xml.documentElement.getElementsByTagName("marker");
		  
		  for (var i = 0; i < markers.length; i++) {
			
			var id = parseInt(markers[i].getAttribute("id"));
			var eventid = parseInt(markers[i].getAttribute("eventid"));
			var title = markers[i].getAttribute("title");
			var place = markers[i].getAttribute("place");
			var address1 = markers[i].getAttribute("address1");
			var address2 = markers[i].getAttribute("address2");
			var town = markers[i].getAttribute("town");
			var postcode = markers[i].getAttribute("postcode");
			var district = markers[i].getAttribute("district");
			var picture = markers[i].getAttribute("picture");
			var thumbnail = markers[i].getAttribute("thumbnail");
			var category = markers[i].getAttribute("category");
			var videourl = markers[i].getAttribute("videourl");
			var lat = markers[i].getAttribute("lat");
			var lng = markers[i].getAttribute("lng");
			var point = new GLatLng(parseFloat(lat), parseFloat(lng));
			
			var pushpinicon = "PushpinMagnenta.gif";
			if(category == "Visitor Attractions") pushpinicon = "PushpinBlue.gif";
			if(category == "Accommodation") pushpinicon = "PushpinGreen.gif"; 
			if(category == "Sport & Leisure") pushpinicon = "PushpinRed.gif"; 
			if(category == "Eating & Drinking") pushpinicon = "PushpinOrange.gif"; 
			if(category == "Police & Council") pushpinicon = "PushpinYellow.gif"; 
			if(category == "Local Business") pushpinicon = "PushpinWhite.gif";
			if(category == "Entertainment") pushpinicon = "PushpinCyan.gif";
			if(category == "Clubs & Associations") pushpinicon = "PushpinMagnenta.gif";
			if(category == "Corporate & Wedding") pushpinicon = "PushpinPurple.gif";
			if(category == "Area Video") pushpinicon = "PushpinGrey.gif";
				
			var videolink;
			var marker = "http://www." + country + "onvideo.com/gfx/pushpins/" + pushpinicon;
			var information = title + "<br>" + place + "<br>" + address1 + ((address1 != "") ? "<br>" : "") + address2 + ((address2 != "") ? "<br>" : "") + town + "<br>" + district + ((district != "") ? "<br>" : "") + postcode;
			if(videourl == '') videolink = "<a href=\"javascript:showInformation('eventinformation.asp?id=" + id + "&eventid=" + eventid + "','information')\"><img src=\"http://www." + country + "onvideo.com/gfx/icons/information12x12.png\" border=\"0\" align=\"absbottom\"> <font size=\"1\">Show Information</font></a>";
			else videolink = "<a href=\"javascript:updatePlaceVideo(" + id + ", true, " + eventid + ")\"><img src=\"http://www." + country + "onvideo.com/gfx/icons/playvideo.png\" border=\"0\" align=\"absbottom\"> <font size=\"1\">Play Video</font></a>";
			
			placeMarker = addMarker(id, lat, lng, marker, information, videolink, title, town, district, picture, thumbnail, category, eventid);
			
			eventMarkers.push(placeMarker);
			eventID[eventid] = eventMarkers.length-1;
						
		  }
	  }
	  catch(e){
	  	loadingMarkers(false);
	  }
	});
	
}

function clearArrays() {
	visitorAttractionsMarkers = new Array();
	policeAndCouncilMarkers = new Array();
	accommodationMarkers = new Array();
	sportAndLeisureMarkers = new Array();
	localBusinessMarkers = new Array();
	eatingAndDrinkingMarkers = new Array();
	entertainmentMarkers = new Array();
	clubsAndAssociationsMarkers = new Array();
	corporateAndWeddingMarkers = new Array();
	areaVideoMarkers = new Array();
	eventMarkers = new Array();
	visitorAttractionsID = new Array();
	policeAndCouncilID = new Array();
	accommodationID = new Array();
	sportAndLeisureID = new Array();
	localBusinessID = new Array();
	eatingAndDrinkingID = new Array();
	entertainmentID = new Array();
	clubsAndAssociationsID = new Array();
	corporateAndWeddingID = new Array();
	areaVideoID = new Array();
	eventID = new Array();
	placeLabel = new Array();
	placeHtml = new Array();
	placeDirectionsLabel = new Array();
	placeDirectionsHtml = new Array();	
	eventLabel = new Array();
	eventHtml = new Array();
	eventDirectionsLabel = new Array();
	eventDirectionsHtml = new Array();
}

function loadMapPlacesXML(args){

	lastMapArgs = args;
	
	var categoryList = args.split(',');
	
	var c1 = categoryList[0];
	var c2 = categoryList[1];
	var c3 = categoryList[2];
	var c4 = categoryList[3];
	var c5 = categoryList[4];
	var c6 = categoryList[5];
	var c7 = categoryList[6];
	var c8 = categoryList[7];
	var c9 = categoryList[8];
	var c10 = categoryList[9];
	
	if(c1 == "" || c1 == "undefined" || c1 == "1") c1 = "1"; else c1 = "0";
	if(c2 == "" || c2 == "undefined" || c2 == "1") c2 = "1"; else c2 = "0";
	if(c3 == "" || c3 == "undefined" || c3 == "1") c3 = "1"; else c3 = "0";
	if(c4 == "" || c4 == "undefined" || c4 == "1") c4 = "1"; else c4 = "0";
	if(c5 == "" || c5 == "undefined" || c5 == "1") c5 = "1"; else c5 = "0";
	if(c6 == "" || c6 == "undefined" || c6 == "1") c6 = "1"; else c6 = "0";
	if(c7 == "" || c7 == "undefined" || c7 == "1") c7 = "1"; else c7 = "0";
	if(c8 == "" || c8 == "undefined" || c8 == "1") c8 = "1"; else c8 = "0";
	if(c9 == "" || c9 == "undefined" || c9 == "1") c9 = "1"; else c9 = "0";
	if(c10 == "" || c10 == "undefined" || c10 == "1") c10 = "1"; else c10 = "0";
	
	var querystring = (c1 == "1") ? "&visitorAttractions=1" : "&visitorAttractions=0";
	querystring += (c2 == "1") ? "&policeAndCouncil=1" : "&policeAndCouncil=0";
	querystring += (c3 == "1") ? "&accommodation=1" : "&accommodation=0";
	querystring += (c4 == "1") ? "&sportAndLeisure=1" : "&sportAndLeisure=0";
	querystring += (c5 == "1") ? "&localBusiness=1" : "&localBusiness=0";
	querystring += (c6 == "1") ? "&eatingAndDrinking=1" : "&eatingAndDrinking=0";
	querystring += (c7 == "1") ? "&entertainment=1" : "&entertainment=0";
	querystring += (c8 == "1") ? "&clubsAndAssociations=1" : "&clubsAndAssociations=0";
	querystring += (c9 == "1") ? "&corporateAndWedding=1" : "&corporateAndWedding=0";
	querystring += (c10 == "1") ? "&areaVideo=1" : "&areaVideo=0";
	
	if (sitemode == 'yourvideos') {
		loadYourVideosXML("http://www." + country + "onvideo.com/xml/yourvideos.xml.asp?district=" + district + querystring);
	}
	else {
		loadPlacesXML("http://www." + country + "onvideo.com/xml/places.xml.asp?district=" + district + querystring);
	}
	
	//location.href = "xml/yourvideos.xml.asp?district=" + district + querystring;

	top.window.document.getElementById("categoryframe").contentWindow.location.href = "http://www." + country + "onvideo.com/updatecategories.asp?c1=" + c1 + "&c2=" + c2 + "&c3=" + c3 + "&c4=" + c4 + "&c5=" + c5 + "&c6=" + c6 + "&c7=" + c7 + "&c8=" + c8 + "&c9=" + c9 + "&c10=" + c10;
	if(selecteddistrict != '') top.window.document.getElementById("placesframe").contentWindow.location.href = 'http://www.' + country + 'onvideo.com/places.asp?district=' + selecteddistrict + '&category=' + category;

	loadMapCategories(args);
}

function hidePlaces() {
	
	setMiniMapCategories('0','0','0','0','0','0','0','0','0','0');

	for (i=0; i<visitorAttractionsMarkers.length; i++) {
		visitorAttractionsMarkers[i].hide(); 
	}	 
	for (i=0; i<policeAndCouncilMarkers.length; i++) {
		policeAndCouncilMarkers[i].hide(); 
	}	
	for (i=0; i<accommodationMarkers.length; i++) {
		accommodationMarkers[i].hide(); 
	}
	for (i=0; i<sportAndLeisureMarkers.length; i++) {
		sportAndLeisureMarkers[i].hide(); 
	}
	for (i=0; i<localBusinessMarkers.length; i++) {
		localBusinessMarkers[i].hide(); 
	}
	for (i=0; i<eatingAndDrinkingMarkers.length; i++) {
		eatingAndDrinkingMarkers[i].hide(); 
	}
	for (i=0; i<entertainmentMarkers.length; i++) {
		entertainmentMarkers[i].hide(); 
	}
	for (i=0; i<clubsAndAssociationsMarkers.length; i++) {
		clubsAndAssociationsMarkers[i].hide(); 
	}
	for (i=0; i<corporateAndWeddingMarkers.length; i++) {
		corporateAndWeddingMarkers[i].hide(); 
	}
	for (i=0; i<areaVideoMarkers.length; i++) {
		areaVideoMarkers[i].hide(); 
	}

}

function loadMapCategories(args){
	
	var i;
	lastMapArgs = args;
	map.getInfoWindow().hide();
	var categoryList = args.split(',');

	var c1 = categoryList[0];
	var c2 = categoryList[1];
	var c3 = categoryList[2];
	var c4 = categoryList[3];
	var c5 = categoryList[4];
	var c6 = categoryList[5];
	var c7 = categoryList[6];
	var c8 = categoryList[7];
	var c9 = categoryList[8];
	var c10 = categoryList[9];
	
	for (i=0; i<eventMarkers.length; i++) {
		eventMarkers[i].hide(); 
	}
	
	if (c1 == "1") { 
		for (i=0; i<visitorAttractionsMarkers.length; i++) {
			visitorAttractionsMarkers[i].show(); 
		}
	}
	else {
		for (i=0; i<visitorAttractionsMarkers.length; i++) {
			visitorAttractionsMarkers[i].hide(); 
		}
	}
	
	
	if (c2 == "1") {  
		for (i=0; i<policeAndCouncilMarkers.length; i++) {
			policeAndCouncilMarkers[i].show(); 
		}
	}
	else {
		for (i=0; i<policeAndCouncilMarkers.length; i++) {
			policeAndCouncilMarkers[i].hide(); 
		}
	}
	
	
	if (c3 == "1") {  
		for (i=0; i<accommodationMarkers.length; i++) {
			accommodationMarkers[i].show(); 
		}
	}
	else {
		for (i=0; i<accommodationMarkers.length; i++) {
			accommodationMarkers[i].hide(); 
		}
	}
	
	if (c4 == "1") {  
		for (i=0; i<sportAndLeisureMarkers.length; i++) {
			sportAndLeisureMarkers[i].show(); 
		}
	}
	else {
		for (i=0; i<sportAndLeisureMarkers.length; i++) {
			sportAndLeisureMarkers[i].hide(); 
		}
	}
	
	if (c5 == "1") {  
		for (i=0; i<localBusinessMarkers.length; i++) {
			localBusinessMarkers[i].show(); 
		}
	}
	else {
		for (i=0; i<localBusinessMarkers.length; i++) {
			localBusinessMarkers[i].hide(); 
		}
	}
	
	if (c6 == "1") {  
		for (i=0; i<eatingAndDrinkingMarkers.length; i++) {
			eatingAndDrinkingMarkers[i].show(); 
		}
	}
	else {
		for (i=0; i<eatingAndDrinkingMarkers.length; i++) {
			eatingAndDrinkingMarkers[i].hide(); 
		}
	}
	
	if (c7 == "1") {  
		for (i=0; i<entertainmentMarkers.length; i++) {
			entertainmentMarkers[i].show(); 
		}
	}
	else {
		for (i=0; i<entertainmentMarkers.length; i++) {
			entertainmentMarkers[i].hide(); 
		}
	}
	
	if (c8 == "1") {  
		for (i=0; i<clubsAndAssociationsMarkers.length; i++) {
			clubsAndAssociationsMarkers[i].show(); 
		}
	}
	else {
		for (i=0; i<clubsAndAssociationsMarkers.length; i++) {
			clubsAndAssociationsMarkers[i].hide(); 
		}
	}
	
	if (c9 == "1") { 
		for (i=0; i<corporateAndWeddingMarkers.length; i++) {
			corporateAndWeddingMarkers[i].show(); 
		}
	}
	else {
		for (i=0; i<corporateAndWeddingMarkers.length; i++) {
			corporateAndWeddingMarkers[i].hide(); 
		}
	}
	
	if (c10 == "1") {  
		for (i=0; i<areaVideoMarkers.length; i++) {
			areaVideoMarkers[i].show(); 
		}
	}
	else {
		for (i=0; i<areaVideoMarkers.length; i++) {
			areaVideoMarkers[i].hide(); 
		}
	}
	
	top.window.document.getElementById("categoryframe").contentWindow.location.href = "http://www." + country + "onvideo.com/updatecategories.asp?c1=" + c1 + "&c2=" + c2 + "&c3=" + c3 + "&c4=" + c4 + "&c5=" + c5 + "&c6=" + c6 + "&c7=" + c7 + "&c8=" + c8 + "&c9=" + c9 + "&c10=" + c10;
	if(selecteddistrict != '') top.window.document.getElementById("placesframe").contentWindow.location.href = 'http://www.' + country + 'onvideo.com/places.asp?district=' + selecteddistrict + '&category=' + category;

}

function loadMapEventsXML(ts, hideinformation, mode){
	map.getInfoWindow().hide();
	var url = "http://www." + country + "onvideo.com/xml/events.xml.asp?ts=" + ts + "&mode=" + mode;
	loadEventsXML(url);
	zoomCountry(country.toLowerCase());
	if(hideinformation == true) hideInformation();
}

function setMiniMapCategories(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10){
	
	if(c1 == "" || c1 == "undefined" || c1 == "1") c1 = 1; else c1 = 0;
	if(c2 == "" || c2 == "undefined" || c2 == "1") c2 = 1; else c2 = 0;
	if(c3 == "" || c3 == "undefined" || c3 == "1") c3 = 1; else c3 = 0;
	if(c4 == "" || c4 == "undefined" || c4 == "1") c4 = 1; else c4 = 0;
	if(c5 == "" || c5 == "undefined" || c5 == "1") c5 = 1; else c5 = 0;
	if(c6 == "" || c6 == "undefined" || c6 == "1") c6 = 1; else c6 = 0;
	if(c7 == "" || c7 == "undefined" || c7 == "1") c7 = 1; else c7 = 0;
	if(c8 == "" || c8 == "undefined" || c8 == "1") c8 = 1; else c8 = 0;
	if(c9 == "" || c9 == "undefined" || c9 == "1") c9 = 1; else c9 = 0;
	if(c10 == "" || c10 == "undefined" || c10 == "1") c10 = 1; else c10 = 0;
	
	try {	
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("blueIcon._visible", (c1 == 0) ? 1 : 0);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("blueIconSelected._visible", (c1 == 0) ? 0 : 1);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("visitorAttractionsVisible", (c1 == 0) ? 0 : 1);
		
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("yellowIcon._visible", (c2 == 0) ? 1 : 0);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("yellowIconSelected._visible", (c2 == 0) ? 0 : 1);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("policeAndCouncilVisible", (c2 == 0) ? 0 : 1);	
		
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("greenIcon._visible", (c3 == 0) ? 1 : 0);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("greenIconSelected._visible", (c3 == 0) ? 0 : 1);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("accommodationVisible", (c3 == 0) ? 0 : 1);	
		
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("redIcon._visible", (c4 == 0) ? 1 : 0);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("redIconSelected._visible", (c4 == 0) ? 0 : 1);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("sportAndLeisureVisible", (c4 == 0) ? 0 : 1);
		
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("whiteIcon._visible", (c5 == 0) ? 1 : 0);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("whiteIconSelected._visible", (c5 == 0) ? 0 : 1);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("localBusinessVisible", (c5 == 0) ? 0 : 1);
		
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("orangeIcon._visible", (c6 == 0) ? 1 : 0);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("orangeIconSelected._visible", (c6 == 0) ? 0 : 1);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("eatingAndDrinkingVisible", (c6 == 0) ? 0 : 1);
		
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("cyanIcon._visible", (c7 == 0) ? 1 : 0);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("cyanIconSelected._visible", (c7 == 0) ? 0 : 1);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("entertainmentVisible", (c7 == 0) ? 0 : 1);
		
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("magnentaIcon._visible", (c8 == 0) ? 1 : 0);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("magnentaIconSelected._visible", (c8 == 0) ? 0 : 1);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("clubsAndAssociationsVisible", (c8 == 0) ? 0 : 1);
		
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("purpleIcon._visible", (c9 == 0) ? 1 : 0);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("purpleIconSelected._visible", (c9 == 0) ? 0 : 1);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("corporateAndWeddingVisible", (c9 == 0) ? 0 : 1);
		
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("greyIcon._visible", (c10 == 0) ? 1 : 0);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("greyIconSelected._visible", (c10 == 0) ? 0 : 1);
		top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("areaVideoVisible", (c10 == 0) ? 0 : 1);
		
		if(c1 && c2 && c3 && c4 && c5 && c6 && c7 && c8 && c9 && c10){
			top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("showAllIcon._visible", 0);
			top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("showAllIconSelected._visible", 1);
		}
		else {
			top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("showAllIcon._visible", 1);
			top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("showAllIconSelected._visible", 0);
		}
	}
	catch(e){
		//alert(e);
	}
	
}

function searchCategory(category, resetMarkers){
	if(resetMarkers != true) {
		setMiniMapCategories('1','1','1','1','1','1','1','1','1','1');
		loadMapCategories('1,1,1,1,1,1,1,1,1,1');
	}
	var text = document.getElementById("searchtext").value;
	document.getElementById("placesframe").contentWindow.document.location.href = 'http://www.' + country + 'onvideo.com/category.asp?category=' + escape(category);
	zoomCountry(country.toLowerCase());
}

function toggleVideoList(){
	if(top.window.document.getElementById("videolistholder").style.visibility == "hidden") {
		top.window.document.getElementById("videolistholder").style.visibility = "visible";
		top.window.document.getElementById("categorymenu").style.visibility = "hidden";
	}
	else {
		top.window.document.getElementById("videolistholder").style.visibility = "hidden";
		top.window.document.getElementById("categorymenu").style.visibility = "visible";
	}
}

function showQuickLinks(){
	top.window.document.getElementById("videolistholder").style.visibility = "hidden";
	top.window.document.getElementById("eventscalenderholder").style.visibility = "hidden";
	top.window.document.getElementById("categorymenu").style.visibility = "visible";
}


function showEvents(){
	top.window.document.getElementById("videolistholder").style.visibility = "hidden";
	top.window.document.getElementById("categorymenu").style.visibility = "hidden";	
	top.window.document.getElementById("eventscalenderholder").style.visibility = "visible";
	top.window.document.getElementById("eventscalenderframe").contentWindow.loadMonth();
}

function showPlaylist(){
	top.window.document.getElementById("eventscalenderholder").style.visibility = "hidden";
	top.window.document.getElementById("categorymenu").style.visibility = "hidden";
	top.window.document.getElementById("videolistholder").style.visibility = "visible"
}

var scrolluptimer;
var scrolldowntimer;

function startScrollUp(){
	scrolluptimer = setInterval('scrollPlaylistUp()', 10);
}

function scrollPlaylistUp(){
	top.window.document.getElementById("videolistcontent").scrollTop--;
}

function startScrollDown(){
	scrolldowntimer = setInterval('scrollPlaylistDown()', 10);
}

function scrollPlaylistDown(){
	top.window.document.getElementById("videolistcontent").scrollTop++;
}

function stopScroll(){
	clearInterval(scrolluptimer);
	clearInterval(scrolldowntimer);
}


var QLscrolluptimer;
var QLscrolldowntimer;

function QLstartScrollUp(){
	QLscrolluptimer = setInterval('QLscrollPlaylistUp()', 10);
}

function QLscrollPlaylistUp(){
	top.window.document.getElementById("quicklinkscontent").scrollTop--;
}

function QLstartScrollDown(){
	QLscrolldowntimer = setInterval('QLscrollPlaylistDown()', 10);
}

function QLscrollPlaylistDown(){
	top.window.document.getElementById("quicklinkscontent").scrollTop++;
}

function QLstopScroll(){
	clearInterval(QLscrolluptimer);
	clearInterval(QLscrolldowntimer);
}


function showDirections(){
	var saddr = document.getElementById("directionsform").saddr.value;
	var daddr = document.getElementById("directionsform").daddr.value;
	if(saddr.length > 0) window.open('http://maps.google.com/?saddr=' + saddr + '&daddr=' + daddr, 'directions','channelmode=1,fullscreen=1,scollbar=0');	
	else alert('Enter your location eg. London');
}

function handleEnter(field, event) {
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13) {
		showDirections();
		return false;
	} 
	return true;
}

function handleSearchEnter(field, event) {
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13) {
		searchVideos();
		return false;
	} 
	return true;
}

function updatePlaceVideo(id, playVideo, eventid){
	if (location.host == "localhost") {
		document.getElementById("getplaceinfoframe").contentWindow.location.href = '/iframemedia/scotlandonvideo/getplaceinfo.asp?id=' + id + '&playVideo=' + playVideo + '&eventid=' + eventid;
	}
	else document.getElementById("getplaceinfoframe").contentWindow.location.href = 'http://www.' + country + 'onvideo.com/getplaceinfo.asp?id=' + id + '&playVideo=' + playVideo + '&eventid=' + eventid;
}

function openInfoWindow(id, category, eventid){
	if (category != "Events") getPlaceIcon(id, category).openInfoWindowTabsHtml([new GInfoWindowTab(placeLabel[id],placeHtml[id]),new GInfoWindowTab(placeDirectionsLabel[id],placeDirectionsHtml[id])]);	
	else getPlaceIcon(id, category, eventid).openInfoWindowTabsHtml([new GInfoWindowTab(eventLabel[eventid],eventHtml[eventid]),new GInfoWindowTab(eventDirectionsLabel[eventid],eventDirectionsHtml[eventid])]);	
}

function getPlaceIcon(id, category, eventid) {
	
	if (category == 'Visitor Attractions') {
		return visitorAttractionsMarkers[visitorAttractionsID[id]]; 
	}	 
	if (category == 'Police & Council') {
		return policeAndCouncilMarkers[policeAndCouncilID[id]]; 
	}	
	if (category == 'Accommodation') {
		return accommodationMarkers[accommodationID[id]]; 
	}
	if (category == 'Sport & Leisure') {
		return sportAndLeisureMarkers[sportAndLeisureID[id]]; 
	}
	if (category == 'Local Business') {
		return localBusinessMarkers[localBusinessID[id]]; 
	}
	if (category == 'Eating & Drinking') {
		return eatingAndDrinkingMarkers[eatingAndDrinkingID[id]]; 
	}
	if (category == 'Entertainment') {
		return entertainmentMarkers[entertainmentID[id]]; 
	}
	if (category == 'Clubs & Associations') {
		return clubsAndAssociationsMarkers[clubsAndAssociationsID[id]]; 
	}
	if (category == 'Corporate & Wedding') {
		return corporateAndWeddingMarkers[corporateAndWeddingID[id]]; 
	}
	if (category == 'Area Video') {
		return areaVideoMarkers[areaVideoID[id]]; 
	}
	if (category == 'Events') {
		return eventMarkers[eventID[eventid]]; 
	}
	return false;

}

function loadPlace(id, place, town, district, picture, latitude, longitude, category, address, eventid) {
	
	var gfxdir = 'places';
	if (sitemode == 'yourvideos') gfxdir = 'yourvideos';
	if((eval(eventid) != undefined)) gfxdir = 'events';
	
	var url = 'url(http://www.' + country + 'onvideo.com/uploads/' + gfxdir + '/gfx/' + picture + ')';
	if (url != top.window.document.getElementById("player").style.background && eval(eventid) == undefined) hideInformation();
	
	if (!is_ie) {
		top.window.document.getElementById("mozillaplayerframe").contentWindow.document.getElementById("player").style.background = url.replace(/ /g, '%20');
		top.window.document.getElementById("player").style.background = url.replace(/ /g, '%20');
	}
	else top.window.document.getElementById("player").style.background = url;
	
	updatePlaceStats(id);
	hideFeaturedVideo();
	resetMiniRegions();
	top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable(district.replace(/ /g, '').toLowerCase() + "Button._alpha", 30);
	var districtTokens = district.split();
	
	for(var i=0; i<districtTokens.length; i++){
		districtTokens[i] = districtTokens[i].substring(0,1).toUpperCase() + districtTokens[i].substring(1);
	}
	district = "";
	for(var j=0; j<districtTokens.length; j++){
		district += districtTokens[j] + ' ';
	}
	
	try {
		top.window.document.getElementById(country.toLowerCase() + "onvideotitle").SetVariable("siteLogoMC", district.replace(/ /g, ''));
		top.window.document.getElementById("headertitle").innerHTML = '<img src=\"http://www.' + country + 'onvideo.com/gfx/title/districts/' + country.toLowerCase() + '/' + district.replace(/ /g, '') + 'OnVideo.png\" border=\"0\" width=\"993\" height=\"100\" onload=\"fixPNG(this)\">';
	}
	catch(e){
	}
	
	if((eval(eventid) == undefined)) getPlaceIcon(id, category, eventid).openInfoWindowTabsHtml([new GInfoWindowTab(placeLabel[id],placeHtml[id]),new GInfoWindowTab(placeDirectionsLabel[id],placeDirectionsHtml[id])]);
	else getPlaceIcon(id, category, eventid).openInfoWindowTabsHtml([new GInfoWindowTab(eventLabel[eventid],eventHtml[eventid]),new GInfoWindowTab(eventDirectionsLabel[eventid],eventDirectionsHtml[eventid])]);
	
	currentid = id;
	if((eval(eventid) != undefined)) currenteventid = eventid;
	else currenteventid = '';
	currentplace = place;
	previousid = id;
	previousplace = place;
	previoustown = town;
	previousdistrict = district;
	previouslatitude = latitude;
	previouslongitude = longitude;
	previouscategory = category;
	previousaddress = address;
	selecteddistrict = district;
}

function showPlaceLabel(icon, place){
	try {
		placelabel.innerHTML = '<div style=\"background:#EEEEEE;border:1px solid #000000;font-size:9pt;text-align:left;padding:3px;z-index:99\">' + place + '</div>';
		var point = map.getCurrentMapType().getProjection().fromLatLngToPixel(map.getBounds().getSouthWest(), map.getZoom());
		var offset = map.getCurrentMapType().getProjection().fromLatLngToPixel(icon.getPoint(),map.getZoom());
		var anchor = icon.getIcon().iconAnchor;
		var width = icon.getIcon().iconSize.width;	
		var pos = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(offset.x - point.x - anchor.x + width,- offset.y + point.y +anchor.y));
		pos.apply(placelabel);
		placelabel.style.visibility = 'visible';
	}
	catch(e){
	}
}

function hidePlaceLabel(){
	placelabel.style.visibility = 'hidden';
}

function zoomMap(latitude, longitude, zoom) {
	map.getInfoWindow().hide();
	map.checkResize();
	map.setCenter(new GLatLng(latitude, longitude),zoom);
	top.window.document.getElementById("zoomlevel").style.backgroundImage = 'url(http://www.' + country + 'onvideo.com/gfx/' + country + 'OnVideoZoomLevel' + zoom + '.gif)';
}

function setMapStyle(maptype){
	var s = map.getCurrentMapType();
	if (s == G_HYBRID_MAP && maptype == 'G_NORMAL_MAP') {
		map.setMapType(G_NORMAL_MAP);
		toggleButton('toggleroads', 'ToggleButtonUnchecked');   
		toggleButton('togglesatellite', 'ToggleButtonChecked');
	}
	if (s == G_NORMAL_MAP && maptype == 'G_HYBRID_MAP') {
		map.setMapType(G_HYBRID_MAP);
		toggleButton('toggleroads', 'ToggleButtonChecked');   
		toggleButton('togglesatellite', 'ToggleButtonUnchecked'); 
	}
}

function toggleMapStyle(){
	var s = map.getCurrentMapType();        
	if (s==G_HYBRID_MAP) {               
		map.setMapType(G_NORMAL_MAP);  
		toggleButton('toggleroads', 'ToggleButtonChecked');   
		toggleButton('togglesatellite', 'ToggleButtonUnchecked');      
	}            
	else {               
		map.setMapType(G_HYBRID_MAP);  
		toggleButton('toggleroads', 'ToggleButtonUnchecked');   
		toggleButton('togglesatellite', 'ToggleButtonChecked');           
	}
}

function togglePlayer(state){	
		if(state) {
			loadinginfo.innerHTML = '';
			statuslayer.style.visibility = 'visible';	
			loadinginfo.style.visibility = 'visible';	
			progressbar.style.visibility = 'visible';
			top.window.document.getElementById(country + "onvideoplayer").style.visibility = 'hidden';
			var id = setInterval("writeBufferInfo()",500);
		}
		else {	
			top.window.document.getElementById(country + "onvideoplayer").width = '384px';
			top.window.document.getElementById(country + "onvideoplayer").height = '216px';
			top.window.document.getElementById(country + "onvideoplayer").style.visibility = 'visible';	
			statuslayer.style.visibility = 'hidden';
			loadinginfo.style.visibility = 'hidden';	
			progressbar.style.visibility = 'hidden';
			progressbar.style.width = '0%';
			clearInterval(id);
		}
	
}

function writeBufferInfo(){	
	var html;
	
	try {
		if (top.window.document.getElementById(country.toLowerCase() + "onvideoplayer").BufferingProgress == 0 || top.window.document.getElementById(country.toLowerCase() + "onvideoplayer").BufferingProgress == 100) {}
		else {		
			var mins = Math.round(top.window.document.getElementById(country.toLowerCase() + "onvideoplayer").Duration/60);
			var secs = Math.round(top.window.document.getElementById(country.toLowerCase() + "onvideoplayer").Duration%60);
			if(top.window.document.getElementById(country.toLowerCase() + "onvideoplayer").Duration < 60) mins = 0;

			html = "<div class=\"videotext\" style=\"color:#EEEEEE;font-weight:bold;text-align:center;\">";
			html += "Loading..." + top.window.document.getElementById(country.toLowerCase() + "onvideoplayer").BufferingProgress + "%";
			html += "</div>";
		
			progressbar.style.width = top.window.document.getElementById(country.toLowerCase() + "onvideoplayer").BufferingProgress + '%';
			loadinginfo.innerHTML = html;	
		}
	}
	catch(e) {
	}	
	
}

function resetMap(){
	top.window.document.getElementById(country.toLowerCase() + "onvideotitle").SetVariable("siteLogoMC", country.replace(/ /g, ''));
}

function loadPage(url){
	placesframe.location.href = url;
}

function searchVideos(){
	try {
		setMiniMapCategories('1','1','1','1','1','1','1','1','1','1');
		loadMapCategories('1,1,1,1,1,1,1,1,1,1');
	}
	catch(e){
	}
	var text = document.getElementById("searchtext").value;
	document.getElementById("placesframe").contentWindow.document.location.href = 'http://www.' + country + 'onvideo.com/searchresults.asp?searchtext=' + text;
}



function loadPlaceVideo(id, district, category){
	if(id != 0){
		document.getElementById("placesframe").contentWindow.document.location.href = 'http://www.' + country + 'onvideo.com/places.asp?district=' + district + '&id=' + id;
	}
}

function loadEvent(eventid, district, category, start){
	if(eventid != 0){
		document.getElementById("placesframe").contentWindow.document.location.href = 'http://www.' + country + 'onvideo.com/events.asp?district=' + district + '&eventid=' + eventid + "&start=" + start;
	}
}

function fullscreenMode(){
	displaysize = 3;
	if(!is_ie) {
		alert('Double Click Video Screen to Enter Fullscreen Mode');
	}
	else {
		if(!fullscreenModeBefore) alert('Entering Fullscreen Video Mode (Press \'Esc\' To Return To Normal Mode)');
		sovplayer.DisplaySize = displaysize;
	}
	fullscreenModeBefore = true;
}

function stopASF(){
	if(!is_ie) {
		top.window.document.getElementById("mozillaplayerframe").contentWindow.document.getElementById("player").innerHTML = '';
		top.window.document.getElementById("mozillaplayerframe").style.visibility = 'hidden';
		top.window.document.getElementById("player").style.visibility = 'visible';
	}
	else {
		sovplayer.Stop();	
		hidePlayer();
	}
}

function playASF(){
	try {
		if(!is_ie) {
			top.window.document.getElementById("mozillaplayerframe").contentWindow.location.reload();
			top.window.document.getElementById("mozillaplayerframe").style.visibility = 'visible';
		}
		else {
			if(activevideoid != currentid && activevideoid != 0) {
				updatePlaceVideo(currentid, true);
				showPlayer();
			}
			else { 
				sovplayer.Play();	
				showPlayer();
			}
		}
	}
	catch(e) {
	}
}

function pauseASF(){
	try {
		if(!is_ie) {
			top.window.document.getElementById("mozillaplayerframe").contentWindow.document.getElementById("player").innerHTML = '';
			top.window.document.getElementById("mozillaplayerframe").style.visibility = 'hidden';
			top.window.document.getElementById("player").style.visibility = 'visible';
		}
		else {
			sovplayer.Pause();	
		}
	}
	catch(e) {
	}
}

function toggleMuteVolume(){
	if(document.getElementById("mutebutton").className == "mutebutton") {
		document.getElementById("mutebutton").className = 'mutebuttondown';
		previousVolume = sovplayer.Volume;
		setVolume(0);
	}
	else {
		document.getElementById("mutebutton").className = 'mutebutton';
		updateVolume();
	}
}

function setVolume(volume){
	try	{
		volumeScale = volume / 100;
		dbLevel = -(4200 - (volumeScale * 4200));
		
		if(dbLevel < -4200) dbLevel= -4200;
		if(dbLevel > 0) dbLevel= 0;
		
		if(volume < 5) volume = 0;
		sovplayer.Volume = dbLevel;
	}
	catch (e) {
	}
}

function updateVolume(){
	setVolume(top.window.document.getElementById("volumecontrol").GetVariable("volumePosition._x"));
}

function getVolume(){
	top.window.document.getElementById("volumecontrol").SetVariable("volumePosition._x", 66);
}

function showSite(){
	try{
		//top.window.document.getElementById("loadingsite").style.visibility = 'hidden';	
		top.window.document.getElementById("player").style.visibility = 'visible';
	}
	catch(e){
	}
}

function printMap(){
		var latlong = map.getCenter();
		var zoom = map.getZoom();
		var maptype = map.getCurrentMapType();
		window.open('http://www.' + country + 'onvideo.com/printmap.asp?id=' + currentid + '&eventid=' + currenteventid + '&lat=' + latlong.Latitude + '&long=' + latlong.Longitude + '&zoom=' + zoom + '&maptype=' + maptype + '&place=' + currentplace, 'printmap');
}

function fullscreenMap(){
		var latlong = map.getCenter();
		var zoom = map.getZoom();
		var maptype = map.getCurrentMapType();
		window.open('http://www.' + country + 'onvideo.com/fullscreenmap.asp?id=' + currentid + '&eventid=' + currenteventid + '&lat=' + latlong.Latitude + '&long=' + latlong.Longitude + '&zoom=' + zoom + '&maptype=' + maptype + '&place=' + currentplace, 'printmap','channelmode=1,fullscreen=1,scollbar=0');
}

function updateStats(id) {
	try	{
		var head = top.window.document.getElementById("videostatsframe").contentWindow.document.getElementsByTagName('head').item(0);
		var scriptTag = top.window.document.getElementById("videostatsframe").contentWindow.document.getElementById('loadScript');
		if (scriptTag) head.removeChild(scriptTag);
		var script = top.window.document.getElementById("videostatsframe").contentWindow.document.createElement('script');
		script.src = 'http://www.' + country + 'onvideo.com/videostats.asp?videoid=' + id;
		script.type = 'text/javascript';
		script.id = 'loadScript';
		head.appendChild(script);
	}
	catch(e){
	}
}

function pingServer() {
	try	{
		var head = top.window.document.getElementById("pingserverframe").contentWindow.document.getElementsByTagName('head').item(0);
		var scriptTag = top.window.document.getElementById("pingserverframe").contentWindow.document.getElementById('loadScript');
		if (scriptTag) head.removeChild(scriptTag);
		var script = top.window.document.getElementById("pingserverframe").contentWindow.document.createElement('script');
		script.src = 'http://www.' + country + 'onvideo.com/pingserver.asp';
		script.type = 'text/javascript';
		script.id = 'loadScript';
		head.appendChild(script);
	}
	catch(e){
	}
}


function updatePlaceStats(id) {
	try	{
		var head = top.window.document.getElementById("placestatsframe").contentWindow.document.getElementsByTagName('head').item(0);
		var scriptTag = top.window.document.getElementById("placestatsframe").contentWindow.document.getElementById('loadScript');
		if (scriptTag) head.removeChild(scriptTag);
		var script = top.window.document.getElementById("placestatsframe").contentWindow.document.createElement('script');
		script.src = 'http://www.' + country + 'onvideo.com/placestats.asp?placeid=' + id;
		script.type = 'text/javascript';
		script.id = 'loadScript';
		head.appendChild(script);
	}
	catch(e){
	}
}

function openSupport(){
	showInformation('support/aspchatnow', 'support');
}


function toggleMapSize(){
	if(widecontent) {
		showSmallMap();
		showSmallInformation();
	}
	else {
		showLargeMap();
		showLargeInformation();
	}
}

function toggleInformationSize(){
	if(widecontent) {
		showSmallMap();
		showSmallInformation();
	}
	else {
		showLargeMap();
		showLargeInformation();
	}
}


function toggleMapControls(){
	if(widecontent) {
		showSmallMapControls();
		showSmallMap();
	}
	else {
		showLargeMapControls();
		showLargeMap();
	}
}

function showSmallMap(){
	showSmallMapControls();
	centerMap();
	widecontent = false;
}

function showLargeMap(){
	showLargeMapControls();
	centerMap();
	widecontent = true;
}

function showSmallInformation(){
	showSmallMapControls();
	if (!is_ie) {
		top.window.document.getElementById("informationpanel").style.width = '320px';
		top.window.document.getElementById("informationframe").style.width = '320px';
		top.window.document.getElementById("informationpanel").className = 'informationpanel';
	}
	else {
		top.window.document.getElementById("informationpanel").style.width = '322px';
		top.window.document.getElementById("informationframe").style.width = '322px';
	}
	top.window.document.getElementById("informationframe").contentWindow.document.body.className = lastmode + 'body';
	top.window.document.getElementById("informationframe").contentWindow.document.getElementById("toggleinformationbutton").innerHTML = "<img src=\"http://www." + country + "onvideo.com/gfx/toggleLargeMap.png\" width=\"6\" height=\"40\" border=\"0\" alt=\"Large Information\" onClick=\"top.window.toggleInformationSize()\" style=\"cursor:pointer\">";
	top.window.document.getElementById("informationframe").contentWindow.document.getElementById("toggleinformationbutton").style.left = "314px";
	top.window.document.getElementById("informationframe").contentWindow.document.getElementById("information").className = 'information';
	try	{
		var reviewboxArray = top.window.document.getElementById("informationframe").contentWindow.document.getElementsByTagName('div');
		for (var i=0; i<reviewboxArray.length; i++){
			if(reviewboxArray[i].className == 'reviewboxwide') reviewboxArray[i].className = 'reviewbox';
		}
	}
	catch(e) {
	}
	widecontent = false;
}

function showLargeInformation(){
	showLargeMapControls();	
	if (!is_ie) {
		top.window.document.getElementById("informationpanel").style.width = '591px';
		top.window.document.getElementById("informationframe").style.width = '591px';
		top.window.document.getElementById("informationpanel").className = 'informationpanelwide';
	}
	else {
		top.window.document.getElementById("informationpanel").style.width = '593px';
		top.window.document.getElementById("informationframe").style.width = '593px';
	}
	top.window.document.getElementById("informationframe").contentWindow.document.body.className = lastmode + 'widebody';
	top.window.document.getElementById("informationframe").contentWindow.document.getElementById("toggleinformationbutton").innerHTML = "<img src=\"http://www." + country + "onvideo.com/gfx/toggleSmallMap.png\" width=\"6\" height=\"40\" border=\"0\" alt=\"Small Information\" onClick=\"top.window.toggleInformationSize()\" style=\"cursor:pointer\">";
	top.window.document.getElementById("informationframe").contentWindow.document.getElementById("toggleinformationbutton").style.left = "585px";
	top.window.document.getElementById("informationframe").contentWindow.document.getElementById("information").className = 'informationwide';
	try	{
		var reviewboxArray = top.window.document.getElementById("informationframe").contentWindow.document.getElementsByTagName('div');
		for (var i=0; i<reviewboxArray.length; i++){
			if(reviewboxArray[i].className == 'reviewbox') reviewboxArray[i].className = 'reviewboxwide';
		}		
	}
	catch(e) {
	}
	widecontent = true;
	centerMap();
}

function showSmallMapControls(){
	if(widecontent){
		top.window.document.getElementById(country.toLowerCase() + "map").className = country.toLowerCase() + 'map';
		top.window.document.getElementById("navigationpanel").className = 'navigationpanel';
		top.window.document.getElementById("navigationpanel").innerHTML = "<img src=\"http://www." + country + "onvideo.com/gfx/" + country.toLowerCase() + "OnVideoMapNavigationPanel.gif\" width=\"320\" height=\"44\" border=\"0\" usemap=\"#Map\" onMouseMove=\"return false;\" alt=\"\">";
		top.window.document.getElementById("pandownbutton").className = 'pandownbutton';
		top.window.document.getElementById("panupbutton").className = 'panupbutton';
		top.window.document.getElementById("panleftbutton").className = 'panleftbutton';
		top.window.document.getElementById("panrightbutton").className = 'panrightbutton';
		top.window.document.getElementById("pandownleftbutton").className = 'pandownleftbutton';
		top.window.document.getElementById("pandownrightbutton").className = 'pandownrightbutton';
		top.window.document.getElementById("panupleftbutton").className = 'panupleftbutton';
		top.window.document.getElementById("panuprightbutton").className = 'panuprightbutton';
		top.window.document.getElementById("zoominbutton").className = 'zoominbutton';
		top.window.document.getElementById("zoomlevel").className = 'zoomlevel';
		top.window.document.getElementById("zoomoutbutton").className = 'zoomoutbutton';
		top.window.document.getElementById("toggleroadsbutton").className = 'toggleroadsbutton';
		top.window.document.getElementById("togglesatellitebutton").className = 'togglesatellitebutton';					
		top.window.document.getElementById("togglemapbutton").innerHTML = "<img src=\"http://www." + country + "onvideo.com/gfx/toggleLargeMap.png\" width=\"6\" height=\"40\" border=\"0\" alt=\"Large Map\" onClick=\"toggleMapSize()\" style=\"cursor:pointer\">";
		top.window.document.getElementById("togglemapbutton").style.left = "710px";
	}
}

function showLargeMapControls(){
	if(!widecontent){
		top.window.document.getElementById(country.toLowerCase() + "map").className = country.toLowerCase() + 'mapwide';
		top.window.document.getElementById("navigationpanel").className = 'navigationpanelwide';
		top.window.document.getElementById("navigationpanel").innerHTML = "<img src=\"http://www." + country + "onvideo.com/gfx/" + country.toLowerCase() + "OnVideoMapNavigationPanelWide.gif\" width=\"591\" height=\"44\" border=\"0\" usemap=\"#Map\" onMouseMove=\"return false;\" alt=\"\">";	
		top.window.document.getElementById("pandownbutton").className = 'pandownbuttonwide';
		top.window.document.getElementById("panupbutton").className = 'panupbuttonwide';
		top.window.document.getElementById("panleftbutton").className = 'panleftbuttonwide';
		top.window.document.getElementById("panrightbutton").className = 'panrightbuttonwide';
		top.window.document.getElementById("pandownleftbutton").className = 'pandownleftbuttonwide';
		top.window.document.getElementById("pandownrightbutton").className = 'pandownrightbuttonwide';
		top.window.document.getElementById("panupleftbutton").className = 'panupleftbuttonwide';
		top.window.document.getElementById("panuprightbutton").className = 'panuprightbuttonwide';
		top.window.document.getElementById("zoominbutton").className = 'zoominbuttonwide';
		top.window.document.getElementById("zoomlevel").className = 'zoomlevelwide';
		top.window.document.getElementById("zoomoutbutton").className = 'zoomoutbuttonwide';
		top.window.document.getElementById("toggleroadsbutton").className = 'toggleroadsbuttonwide';
		top.window.document.getElementById("togglesatellitebutton").className = 'togglesatellitebuttonwide';			
		top.window.document.getElementById("togglemapbutton").innerHTML = "<img src=\"http://www." + country + "onvideo.com/gfx/toggleSmallMap.png\" width=\"6\" height=\"40\" border=\"0\" alt=\"Small Map\" onClick=\"toggleMapSize()\" style=\"cursor:pointer\">";
		top.window.document.getElementById("togglemapbutton").style.left = "981px";
	}
}

function showInformation(url, mode){
	if (url.match('id=') == null && url.match('country=') == null && url.match('place=') == null && url.match('start=') == null) top.window.document.getElementById("informationframe").contentWindow.location.href = url + "?wide=" + widecontent;
	else top.window.document.getElementById("informationframe").contentWindow.location.href = url + "&wide=" + widecontent;
	if(lastmode == mode && top.window.document.getElementById("informationpanel").style.left == '395px'){	
		if (top.window.document.getElementById("informationframe").contentWindow.location.href == url) hideInformation();
	}
	else{
		top.window.document.getElementById("informationpanel").style.left = '395px';
		top.window.document.getElementById(country.toLowerCase() + "map").style.left = '-1000px';
		top.window.document.getElementById("togglemapbutton").style.visibility = "hidden";
	}
	lastmode = mode;
}

function showInformationWindow(mode){
	top.window.document.getElementById("informationpanel").style.left = '395px';
	top.window.document.getElementById(country.toLowerCase() + "map").style.left = '-1000px';
	top.window.document.getElementById("togglemapbutton").style.visibility = "hidden";
	lastmode = mode;
}

function hideInformation(){
	if(top.window.document.getElementById("informationpanel").style.left == '395px') {
		top.window.document.getElementById("informationpanel").style.left = '-1000px';
		top.window.document.getElementById(country.toLowerCase() + "map").style.left = '395px';
		top.window.document.getElementById("togglemapbutton").style.visibility = "visible";
	}
	lastmode = 'hidden';
	centerMap();
}

function showMap(){
	top.window.document.getElementById("informationpanel").style.left = '-1000px';
	top.window.document.getElementById(country.toLowerCase() + "map").style.left = '395px';
	top.window.document.getElementById("togglemapbutton").style.visibility = "visible";
	lastmode = 'hidden';
	centerMap();
}

function centerMap(){
	var latlong = map.getCenter();
	var zoom = map.getZoom();
	map.checkResize();
	map.setCenter(latlong, parseInt(zoom));
}

function toggleFeaturedVideo(){
	if(top.window.document.getElementById("featuredvideo").style.left == '721px'){	
		hideFeaturedVideo();
	}
	else{
		top.window.document.getElementById("featuredvideo").style.visibility = 'visible';
		top.window.document.getElementById("featuredvideo").style.left = '721px';
		top.window.document.getElementById("districtinfo").style.left = '-1000px';
		top.window.document.getElementById("minimap").style.left = '-1000px';
	}
}

function hideFeaturedVideo(){
	if(top.window.document.getElementById("featuredvideo").style.left == '721px') {
		top.window.document.getElementById("featuredvideo").style.visibility = 'hidden';
		top.window.document.getElementById("featuredvideo").style.left = '-1000px';
		top.window.document.getElementById("districtinfo").style.left = '721px';
		top.window.document.getElementById("minimap").style.left = '824px';
	}
}

function showPlayer(){
	sovplayer.style.visibility='visible';	
}

function hidePlayer(){
	sovplayer.style.visibility='hidden';	
}

function playVideo(url, district, id, eventid){
	var videourl;
	var videodir = 'places';
	if (sitemode == 'yourvideos') videodir = 'yourvideos';
	if(eval(eventid) != undefined) videodir = 'events';
	activevideoid = id;
	if(!is_ie) top.window.document.getElementById("mozillaplayerframe").contentWindow.document.getElementById("player").style.background = '#000000';
	if (location.host == "localhost") {
		if(url.substring(url.length - 4, url.length) == '.gif' || url.substring(url.length - 4, url.length) == '.jpg') 
			videourl = "http://localhost/iframemedia/scotlandonvideo/uploads/" + videodir + "/asf/" + url;
		else
			videourl = "http://localhost/iframemedia/scotlandonvideo/uploads/" + videodir + "/asf/" + url;
	}
	else {
		if(url.substring(url.length - 4, url.length) == '.gif' || url.substring(url.length - 4, url.length) == '.jpg') 
			videourl = "http://www." + country.toLowerCase() + "onvideo.com/uploads/" + videodir + "/asf/" + url;
		else
			videourl = "mms://www." + country.toLowerCase() + "onvideo.com/" + videodir + "/" + url;
	}
	
	if(!is_ie) {
		if(!is_ie) top.window.document.getElementById("mozillaplayerframe").style.visibility = 'visible';
		top.window.document.getElementById("mozillaplayerframe").contentWindow.location.href = "http://www." + country + "onvideo.com/mozillaplayer.asp?videourl=" + url + '&videodir=' + videodir + '&displaysize=' + displaysize;
	}
	else sovplayer.filename = videourl;
	showPlayer(); 
	updateStats(id);
}

function loadRegion(district, category) {
	hideInformation();
	resetMiniRegions();
	map.getInfoWindow().hide();
	var url = 'url(http://www.' + country + 'onvideo.com/uploads/districts/gfx/' + district.replace(/ /g, '').toLowerCase() + 'districtpanel.gif)';
	if (!is_ie) {
		top.window.document.getElementById("mozillaplayerframe").contentWindow.document.getElementById("player").style.background = url;
		top.window.document.getElementById("player").style.background = url;
	}
	else top.window.document.getElementById("player").style.background = url;
	zoomDistrict(district.toLowerCase());
	var districtTokens = district.split();
	for(var i=0; i<districtTokens.length; i++){
		districtTokens[i] = districtTokens[i].substring(0,1).toUpperCase() + districtTokens[i].substring(1);
	}
	district = "";
	for(var j=0; j<districtTokens.length; j++){
		district += districtTokens[j] + ' ';
	}
	document.getElementById("placesframe").contentWindow.document.location.href = 'http://www.' + country + 'onvideo.com/places.asp?district=' + district + '&category=' + category;
	
	try {
		top.window.document.getElementById(country.toLowerCase() + "onvideotitle").SetVariable("siteLogoMC", district.replace(/ /g, ''));
		top.window.document.getElementById("headertitle").innerHTML = '<img src=\"http://www.' + country + 'onvideo.com/gfx/title/districts/' + country.toLowerCase() + '/' + district.replace(/ /g, '') + 'OnVideo.png\" border=\"0\" width=\"993\" height=\"100\" onload=\"fixPNG(this)\">';
	}
	catch(e){
	}
	
	top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable(district.replace(/ /g, '').toLowerCase() + "Button._alpha", 30);
	top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("selectedDistrict", district.toUpperCase().replace(/ AND /g, ' & '));
	top.window.document.getElementById(country.toLowerCase() + "onvideominimap").SetVariable("hoverDistrict", district.toUpperCase().replace(/ AND /g, ' & '));
	hideFeaturedVideo();
	
	selecteddistrict = district;
	
	//setMiniMapCategories('1','1','1','1','1','1','1','1','1','1');
	//loadMapCategories('1,1,1,1,1,1,1,1,1,1');
	
}

function loadCountry(country, loadheader) {
	hideInformation();
	resetMiniRegions();
	var url = 'url(http://www.' + country + 'onvideo.com/uploads/countries/gfx/' + country.replace(/ /g, '').toLowerCase() + 'panel.gif)';
	top.window.document.getElementById("player").style.backgroundImage = url;
	var hostname = document.getElementById("placesframe").contentWindow.document.location.hostname;
	var countryurl = 'http://' + hostname + ((hostname == 'localhost') ? '/iframemedia/scotlandonvideo' : '') + '/country.asp?country=' + country;
	if (document.getElementById("placesframe").contentWindow.document.location.href != countryurl) document.getElementById("placesframe").contentWindow.document.location.href = '/country.asp?country=' + country;
	if(loadheader != false) {
		try {
			top.window.document.getElementById("headertitle").innerHTML = '<img src=\"http://www.' + country + 'onvideo.com/gfx/title/districts/' + country.toLowerCase() + '/' + country.toLowerCase() + 'OnVideo.png\" border=\"0\" width=\"993\" height=\"100\" onload=\"fixPNG(this)\">';
		}
		catch(e){
		}
		try {
			top.window.document.getElementById(country.toLowerCase() + "onvideotitle").SetVariable("siteLogoMC", district.replace(/ /g, ''));
			top.window.document.getElementById("headertitle").innerHTML = '<img src=\"http://www.' + country + 'onvideo.com/gfx/title/districts/' + country.toLowerCase() + '/' + country.toLowerCase() + 'OnVideo.png\" border=\"0\" width=\"993\" height=\"100\" onload=\"fixPNG(this)\">';
		}
		catch(e){
		}
	}
	zoomCountry(country.toLowerCase());
	hideFeaturedVideo();
}

function buttonUp(button) {
	var url = 'url(http://www.' + country + 'onvideo.com/gfx/' + country + 'OnVideo' + button + 'Button.gif) no-repeat';
	top.window.document.getElementById(button + 'button').style.background = url;
	top.window.document.getElementById(button + 'button').style.cursor='pointer';
}

function buttonDown(button) {
	var url = 'url(http://www.' + country + 'onvideo.com/gfx/' + country + 'OnVideo' + button + 'ButtonDown.gif) no-repeat';
	top.window.document.getElementById(button + 'button').style.background = url;
	top.window.document.getElementById(button + 'button').style.cursor='pointer';
}

function toggleButton(button, img) {
	var url = 'url(http://www.' + country + 'onvideo.com/gfx/' + img + '.gif) no-repeat';
	top.window.document.getElementById(button + 'button').style.background = url;
	top.window.document.getElementById(button + 'button').style.cursor='pointer';
}

function zoomCountry(country){
	
	switch (country){
		case 'scotland':
			setZoomCoordinates(56.93298739609704, -4.21875, 6);
			break;
		case 'england':
			setZoomCoordinates(53.09402405506325, -1.8017578125, 6);
			break;
		case 'ireland':
			setZoomCoordinates(56.67899824795831, -2.6375512695312513, 9);
			break;
		case 'wales':
			setZoomCoordinates(56.16024271567375, -5.361484120080503, 7);
			break;
		default:
			break;
	}
}

function zoomDistrict(district){
	try {
		if(country == "Scotland") {	
			switch (district){
				case 'aberdeen':
					setZoomCoordinates(57.14195952034235, -2.088921508789061, 10);
					break;
				case 'aberdeenshire':
					setZoomCoordinates(57.215650139668085, -2.5874261474609445, 8);
					break;
				case 'angus':
					setZoomCoordinates(56.67899824795831, -2.6375512695312513, 9);
					break;
				case 'argyll and bute':
					setZoomCoordinates(56.16024271567375, -5.361484120080503, 7);
					break;
				case 'clackmannanshire':
					setZoomCoordinates(56.13803345821964, -3.757470092773459, 11);
					break;
				case 'dumfries and galloway':
					setZoomCoordinates(55.5903275521603, -4.033163921374556, 7);
					break;
				case 'dundee':
					setZoomCoordinates(56.461106995057676, -2.9410485839843705, 10);
					break;
				case 'east ayrshire':
					setZoomCoordinates(55.5108864500846, -4.134438476562491, 9);
					break;
				case 'east dunbartonshire':
					setZoomCoordinates(55.94202997528614, -4.298890075683572, 11);
					break;
				case 'east lothian':
					setZoomCoordinates(55.94202997528609, -2.593605957031219, 9);
					break;
				case 'east renfrewshire':
					setZoomCoordinates(55.797123473483026, -4.425318679809554, 11);
					break;
				case 'edinburgh':
					setZoomCoordinates(55.95779303166558, -3.2109002685546714, 11);
					break;
				case 'falkirk':
					setZoomCoordinates(56.001741123425255, -3.7709632355764952, 11);
					break;
				case 'fife':
					setZoomCoordinates(56.311720293479794, -3.2665185546874733, 8);
					break;
				case 'glasgow':
					setZoomCoordinates(55.880839355144765, -4.295113525390623, 10);
					break;
				case 'highland':
					setZoomCoordinates(57.4646576168288, -4.749672851562475, 7);
					break;
				case 'inverclyde':	
					setZoomCoordinates(55.93779977071865, -4.791987380981441, 11);
					break;
				case 'midlothian':
					setZoomCoordinates(55.91393225916222, -3.1662683105468607 ,10);
					break;
				case 'moray':
					setZoomCoordinates(57.54301645334947, -3.311390032762003, 8);
					break;
				case 'north ayrshire':
					setZoomCoordinates(55.69010840224831, -4.957039794921854, 9);
					break;
				case 'north lanarkshire':
					setZoomCoordinates(55.883361150979915, -3.952758538733317, 10);
					break;
				case 'orkney islands':
					setZoomCoordinates(59.067161452782656, -2.995980224609361, 8);
					break;
				case 'perth and kinross':
					setZoomCoordinates(56.554318298932245, -3.911965332031283, 8);
					break;
				case 'renfrewshire':
					setZoomCoordinates(55.89162206763678, -4.440682373046893, 10);
					break;
				case 'scottish borders':
					setZoomCoordinates(55.52990495745404, -2.786381861765637, 8);
					break;
				case 'shetland islands':
					setZoomCoordinates(60.35526918236094, -1.326058349609373, 8);
					break;
				case 'south ayrshire':
					setZoomCoordinates(55.28942064912847, -4.724953613281245, 9);
					break;
				case 'south lanarkshire':
					setZoomCoordinates(55.569471586247594, -3.839350931528071, 9);
					break;
				case 'stirling':
					setZoomCoordinates(56.28848048796, -4.193489990234354, 9);
					break;
				case 'west dunbartonshire':
					setZoomCoordinates(56.28848048796, -4.193489990234354, 9);
					break;
				case 'west lothian':
					setZoomCoordinates(55.939338080378306, -3.5494165039062344, 10);
					break;
				case 'western isles':
					setZoomCoordinates(57.6106047385593, -6.913979492187475, 7);
					break;
				default:
					break;
			}	
		}
		if(country == "England") {	
			// find the latitude, longitude and zoom level for each district
			switch (district){
				case 'bedfordshire':
					setZoomCoordinates(52.08288179572668, -0.55755615234375, 9);
					break;
				case 'berkshire':
					setZoomCoordinates(51.587309751245456, -1.3568115234375, 8);
					break;
				case 'buckinghamshire':
					setZoomCoordinates(51.76953957596099, -0.933837890625, 9);
					break;
				case 'cambridgeshire':
					setZoomCoordinates(52.35882859009118, -0.164794921875, 8);
					break; 
				case 'cheshire':
					setZoomCoordinates(53.21590163025062, -2.9168701171875, 9);
					break; 
				case 'cleveland':
					setZoomCoordinates(54.61184559302163, -1.12335205078125, 9);
					break; 
				case 'cornwall':
					setZoomCoordinates(50.49595785216966, -4.9053955078125, 8);
					break; 
				case 'cumbria':
					setZoomCoordinates(54.651590680027134, -2.8839111328125, 8);
					break; 
				case 'derbyshire':
					setZoomCoordinates(52.99164388840451, -1.62322998046875, 9);
					break; 
				case 'devon':
					setZoomCoordinates(50.73297844827752, -4.010009765625, 8);
					break; 
				case 'dorset':
					setZoomCoordinates(50.73124000713507, -2.4993896484375, 9);
					break; 
				case 'durham':
					setZoomCoordinates(54.779306126086226, -1.481781005859375, 10);
					break; 
				case 'essex':
					setZoomCoordinates(51.85274593491392, 0.5987548828125, 8);
					break; 
				case 'gloucestershire':
					setZoomCoordinates(51.6248374617432, -1.966552734375, 8);
					break; 
				case 'hampshire':
					setZoomCoordinates(51.07246834624617, -1.3568115234375, 8);
					break; 
				case 'herefordshire':
					setZoomCoordinates(52.00179230422271, -2.6641845703125, 9);
					break; 
				case 'worcestershire':
					setZoomCoordinates(52.14023120108506, -2.25494384765625, 9);
					break; 
				case 'hertfordshire':
					setZoomCoordinates(51.82729091455115, -0.1922607421875, 9);
					break; 
				case 'isle of man':
					setZoomCoordinates(54.23955053156179, -4.55108642578125, 9);
					break;
				case 'isle of wight':
					setZoomCoordinates(50.70167663576478, -1.329345703125, 9);
					break; 
				case 'kent':
					setZoomCoordinates(51.155231611562264, 0.8074951171875, 8);
					break; 
				case 'lancashire':
					setZoomCoordinates(53.986780183052055, -2.779541015625, 9);
					break;
				case 'leicestershire':
					setZoomCoordinates(52.633062890594374, -1.14532470703125, 9);
					break;
				case 'lincolnshire':
					setZoomCoordinates(53.16324027106289, -0.3900146484375, 8);
					break;
				case 'london':
					setZoomCoordinates(51.50532341149335, -0.12908935546875, 9);
					break; 
				case 'manchester':
					setZoomCoordinates(53.47987379799574, -2.2357177734375, 9);
					break;
				case 'merseyside':
					setZoomCoordinates(53.50601781925379, -2.823486328125, 9);
					break; 
				case 'norfolk':
					setZoomCoordinates(52.7163309360463, 1.0107421875, 8);
					break;
				case 'northamptonshire':
					setZoomCoordinates(52.2378923494213, -0.7470703125, 8);
					break;
				case 'northumberland':
					setZoomCoordinates(55.275986376948325, -2.1258544921875, 8);
					break;
				case 'yorkshire':
					setZoomCoordinates(54.178511788181325, -0.714111328125, 8);
					break;
				case 'nottinghamshire':
					setZoomCoordinates(53.0643258276055, -1.197509765625, 8);
					break; 
				case 'oxfordshire':
					setZoomCoordinates(52.00179230422271, -1.4447021484375, 8);
					break; 
				case 'shropshire':
					setZoomCoordinates(52.82434224121616, -2.6312255859375, 9);
					break;
				case 'somerset':
					setZoomCoordinates(51.28597042110153, -3.2135009765625, 8);
					break;
				case 'staffordshire':
					setZoomCoordinates(52.784492347358785, -2.07916259765625, 9);
					break;
				case 'suffolk':
					setZoomCoordinates(52.295042284537324, 1.131591796875, 8);
					break;
				case 'surrey':
					setZoomCoordinates(51.186229626386805, -0.3955078125, 9);
					break; 
				case 'sussex':
					setZoomCoordinates(51.14144802734404, 0.3021240234375, 8);
					break;
				case 'tyne and wear':
					setZoomCoordinates(54.99337311367353, -1.52984619140625, 10);
					break; 
				case 'warwickshire':
					setZoomCoordinates(52.20760667286523, -1.3128662109375, 8);
					break;
				case 'west midlands':
					setZoomCoordinates(52.43759500093111, -1.94732666015625, 9);
					break;
				case 'wiltshire':
					setZoomCoordinates(51.16556659836182, -2.1807861328125, 8);
					break; 
				default:
					break;
			}
		}
	}
	catch(e){
	}
	
}

function setZoomCoordinates(latitude, longitude, zoom){
	map.setCenter(new GLatLng(latitude, longitude),zoom);
	top.window.document.getElementById("zoomlevel").style.backgroundImage = 'url(http://www.' + country + 'onvideo.com/gfx/' + country + 'OnVideoZoomLevel' + zoom + '.gif)';
}

function resetMiniRegions(){
	try {
		if(country == "Scotland") {
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("highlandButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("morayButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("aberdeenshireButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("aberdeenButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("angusButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("dundeeButton._alpha", 100);
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("perthandkinrossButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("fifeButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("clackmannanshireButton._alpha", 100);
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("stirlingButton._alpha", 100);
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("argyllandbuteButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("northayrshireButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("southlanarkshireButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("southayrshireButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("eastayrshireButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("eastlothianButton._alpha", 100);
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("midlothianButton._alpha", 100);
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("edinburghButton._alpha", 100);
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("westlothianButton._alpha", 100);
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("falkirkButton._alpha", 100);
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("northlanarkshireButton._alpha", 100);
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("scottishbordersButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("dumfriesandgallowayButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("renfrewshireButton._alpha", 100);
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("eastrenfrewshireButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("glasgowButton._alpha", 100);
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("eastdunbartonshireButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("westdunbartonshireButton._alpha", 100);	
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("westernislesButton._alpha", 100);
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("inverclydeButton._alpha", 100);
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("orkneyislandsButton._alpha", 100);
			top.window.document.getElementById("scotlandonvideominimap").SetVariable("shetlandislandsButton._alpha", 100);	
		}
		if(country == "England") {
			top.window.document.getElementById("englandonvideominimap").SetVariable("bedfordshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("berkshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("buckinghamshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("cambridgeshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("cheshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("clevelandButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("cornwallButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("cumbriaButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("derbyshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("devonButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("dorsetButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("durhamButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("essexButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("gloucestershireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("hampshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("herefordshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("worcestershireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("hertfordshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("isleofmanButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("isleofwightButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("lancashireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("leicestershireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("lincolnshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("londonButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("manchesterButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("merseysideButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("norfolkButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("northamptonshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("northumberlandButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("staffordshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("suffolkButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("surreyButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("tyneandwearButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("warwickshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("westmidlandsButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("sussexButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("westyorkshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("wiltshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("nottinghamshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("shropshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("devonButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("somersetButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("wiltshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("dorsetButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("kentButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("oxfordshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("hampshireButton._alpha", 100);
			top.window.document.getElementById("englandonvideominimap").SetVariable("yorkshireButton._alpha", 100);
		}
	}
	catch(e){
			//alert(e);
	}
}

function validateContactForm(){
	
	var name = document.contactform.name.value;
	var email = document.contactform.address.value;
	var information = document.contactform.information.value;

	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email) && name.length > 0 && information.length > 0)
	{
		document.contactform.submit();
	}
	else {
		alert("Please fill in all the fields")
	}

}

function validateSendVideoForm(){
	
	var validAddresses = false;
	var email = document.emailtofriend.emailaddress.value;
	var friends = document.emailtofriend.friendsaddress.value;
	
	friendsArray = friends.split(";");
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) {
		validAddresses = true;											 
	}
	
	for(i=0; i<friendsArray.length; i++){
		if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(friendsArray[i])) validAddresses = true;
		else {
			validAddresses = false;
			i = friendsArray.length;
		}
	}

	if (validAddresses == true)
	{
		document.emailtofriend.submit();
	}
	else {
		alert("Please enter valid email addresses");
	}

}

function validateSendLinkForm(){
	
	var email = document.emaillinktofriend.emailaddress.value;
	var friend = document.emaillinktofriend.friendsaddress.value;

	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email) && /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(friend))
	{
		document.emaillinktofriend.submit();
	}
	else {
		alert("Please enter 2 valid email addresses")
	}

}

function validateSendAdvertiseForm(){
	
	var validAddress = false;
	var name = document.advertiseform.name.value;
	var company = document.advertiseform.company.value;
	var email = document.advertiseform.email.value;
	var message = document.advertiseform.message.value;
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) {
		validAddress = true;											 
	}
	
	if (name.length > 1 && company.length > 1 && email.length > 1 && message.length > 1 && validAddress == true)
	{
		document.advertiseform.submit();
	}
	else {
		if (!validAddress) alert("Enter valid email address!");
		else alert("Please fill in all the fields");
	}

}

function validateReviewForm(){
	
	var name = document.reviewform.name.value;
	var review = document.reviewform.review.value;

	if (name.length > 1 && review.length > 1)
	{
		document.reviewform.submit();
	}
	else {
		alert("Please fill in all the fields");
	}

}

var buttonArray = new Array();

function initPage(){
	preloadImages(
	"http://www.ukonvideo.com/gfx/icons/emailvideoicon.png", "http://www.ukonvideo.com/gfx/icons/emailvideoicondown.png",
	"http://www.ukonvideo.com/gfx/icons/mapdirectionsicon.png", "http://www.ukonvideo.com/gfx/icons/mapdirectionsicondown.png",
	"http://www.ukonvideo.com/gfx/icons/informationicon.png", "http://www.ukonvideo.com/gfx/icons/informationicondown.png",
	"http://www.ukonvideo.com/gfx/icons/readreviewsicon.png", "http://www.ukonvideo.com/gfx/icons/readreviewsicondown.png",
	"http://www.ukonvideo.com/gfx/icons/writereviewicon.png", "http://www.ukonvideo.com/gfx/icons/writereviewicondown.png",
	"http://www.ukonvideo.com/gfx/icons/printmapicon.png", "http://www.ukonvideo.com/gfx/icons/printmapicondown.png",
	"http://www.ukonvideo.com/gfx/icons/fullscreenmapicon.png", "http://www.ukonvideo.com/gfx/icons/fullscreenmapicondown.png",
	"http://www.ukonvideo.com/gfx/icons/addtoplaylisticon.png", "http://www.ukonvideo.com/gfx/icons/addtoplaylisticondown.png",
	"http://www.ukonvideo.com/gfx/icons/specialoffersicon.png", "http://www.ukonvideo.com/gfx/icons/specialoffersicondown.png",
	"http://www.ukonvideo.com/gfx/icons/eventsicon.png", "http://www.ukonvideo.com/gfx/icons/eventsicondown.png"
	);
}

function preloadImages(){ 
  for (var i=0; i<preloadImages.arguments.length;i++){ 
    buttonArray[i]=new Image(); 
    buttonArray[i].src=preloadImages.arguments[i]; 
  } 
} 

function placeButtonUp(id, button) {
	switch(id){
		case'email':
			button.src = buttonArray[0].src;
			break;
		case'map':
			button.src = buttonArray[2].src;
			break;
		case'information':
			button.src = buttonArray[4].src;
			break;
		case'readreviews':
			button.src = buttonArray[6].src;
			break;
		case'writereview':
			button.src = buttonArray[8].src;
			break;
		case'printmap':
			button.src = buttonArray[10].src;
			break;
		case'fullscreenmap':
			button.src = buttonArray[12].src;
			break;
		case'addtoplaylist':
			button.src = buttonArray[14].src;
			break;
		case'specialoffers':
			button.src = buttonArray[16].src;
			break;
		case'events':
			button.src = buttonArray[18].src;
			break;
	default:
	}
}

function placeButtonDown(id, button) {
	switch(id){
		case'emaildown':
			button.src = buttonArray[1].src;
			break;
		case'mapdown':
			button.src = buttonArray[3].src;
			break;
		case'informationdown':
			button.src = buttonArray[5].src;
			break;
		case'readreviewsdown':
			button.src = buttonArray[7].src;
			break;
		case'writereviewdown':
			button.src = buttonArray[9].src;
			break;
		case'printmapdown':
			button.src = buttonArray[11].src;
			break;
		case'fullscreenmapdown':
			button.src = buttonArray[13].src;
			break;
		case'addtoplaylistdown':
			button.src = buttonArray[15].src;
			break;
		case'specialoffersdown':
			button.src = buttonArray[17].src;
			break;
		case'eventsdown':
			button.src = buttonArray[19].src;
			break;
	default:
	}
}

function hideConsole() {
	// prevent mozilla console from opening
}

initPage();

// mousewheel code

function handleQL(delta) {
	if (delta < 0)
		top.window.document.getElementById("quicklinkscontent").scrollTop+=30;
	else
		top.window.document.getElementById("quicklinkscontent").scrollTop-=30;
}

function wheelQL(event){
	var delta = 0;
	if (!event) event = window.event;
	if (event.wheelDelta) {
		delta = event.wheelDelta/120; 
		if (window.opera) delta = -delta;
	} else if (event.detail) {
		delta = -event.detail/3;
	}
	if (delta)
		handleQL(delta);
        if (event.preventDefault)
                event.preventDefault();
        event.returnValue = false;
}

function handleVL(delta) {
	if (delta < 0)
		top.window.document.getElementById("videolistcontent").scrollTop+=10;
	else
		top.window.document.getElementById("videolistcontent").scrollTop-=10;
}

function wheelVL(event){
	var delta = 0;
	if (!event) event = window.event;
	if (event.wheelDelta) {
		delta = event.wheelDelta/120; 
		if (window.opera) delta = -delta;
	} else if (event.detail) {
		delta = -event.detail/3;
	}
	if (delta)
		handleVL(delta);
        if (event.preventDefault)
                event.preventDefault();
        event.returnValue = false;
}

function zoomLevelClick(e){
	var windowWidth;
	if(is_ie) windowWidth = document.body.clientWidth;
	else windowWidth = window.innerWidth;
	var marginWidth = Math.round((windowWidth - 993) / 2);
	var zoomLevel = Math.round((e.clientX - 625 - marginWidth) / 4);
	map.setZoom(zoomLevel);
	document.getElementById("zoomlevel").style.backgroundImage = 'url(http://www.' + country + 'onvideo.com/gfx/' + country + 'OnVideoZoomLevel' + map.getZoom() + '.gif)';
}

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com


/*
var message="<%=country%> On Video";

function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")
*/
