
var screen_width, screen_height;

function getDimensions() {
	//get window dimensions
	win_width = (is_ie) ? document.body.clientWidth : window.innerWidth;
	win_height = (is_ie) ? document.body.clientHeight : window.innerHeight;
	//get screen dimesnsions
	screen_width = screen.availWidth;
	screen_height = screen.availHeight;
}



function centrePopUp(pop_width,pop_height) {
		var xpos = Math.round(((screen_width - pop_width)/2));
		var ypos = Math.round(((screen_height - pop_height)/2));
		var dim_string = 'width=' + pop_width + ',height=' + pop_height;
		//set strings depending on client browser
		if (is_nav && (is_major <= 4)) return (dim_string + ",screenX=" + xpos + ",screenY=" + ypos);
		else return (dim_string + ",left=" + xpos + ",top=" + ypos);
}



function popupRivermap() {
	getDimensions();

	var force;
	force = false;
	
	if (plugin || force)
		{
			if (!plugin)
			{
				if(is_ie && is_win)
				{
					var override = window.confirm('The flash 6 plugin was not detecteded\nIf you have already downloaded the plugin,\nclick OK to view the flash content anyway')
					if (!override) return
				}
				else
				{
					window.alert('You do not have the flash 6 plugin\nPlease click on the download link\n to get the free plugin');
					return
				}
			}
			
			if (screen_width >= 1024)	// pop 800*600 window
			{
				var dim_string = centrePopUp(948,677) + ',scrollbars=no,resize=yes';
				var flash_file = '/rivermap/flash_popup.asp?pop_width=948&pop_height=677';
			}
			else	// pop 800*600 window
			{
				var dim_string = centrePopUp(772,528) + ',scrollbars=no,resize=yes';
				var flash_file = '/rivermap/flash_popup.asp?pop_width=772&pop_height=528';
			}
			
			//var dim_string = centrePopUp(772,528) + ',scrollbars=no,resize=yes';
			//var flash_file = 'http://www.pola.co.uk/rivermap/flash_popup.asp?pop_width=772&pop_height=528';
			
			//window.alert(dim_string);
			var crnt_win = window.open(flash_file,'flash_popup',dim_string);
			crnt_win.focus();
			
			//flash detected return true
			return
		}
		
		//flash not detected return true
		return
	
}

function toggleRollover(imgName, mode) {

	if (mode == 'on') {
		document.images[imgName].src = "/new_images/rm_title_on.gif";
	}
	else {
		document.images[imgName].src = "/new_images/rm_title_off.gif";
	}

}
function toggleRollover2(imgName, mode) {

	if (mode == 'on') {
		document.images[imgName].src = "/new_images/ca_title_on.gif";
	}
	else {
		document.images[imgName].src = "/new_images/ca_title_off.gif";
	}
}
function toggleRollover3(imgName, mode) {

	if (mode == 'on') {
		document.images[imgName].src = "/new_images/lm_title_on.gif";
	}
	else {
		document.images[imgName].src = "/new_images/lm_title_off.gif";
	}
}

	//plugin = false;
	
	function popFlashMovie(force) {
		getDimensions();
		if (plugin || force)
		{
			if (!plugin)
			{
				if(is_ie && is_win)
				{
					var override = window.confirm('The flash 6 plugin was not detecteded\nIf you have already downloaded the plugin,\nclick OK to view the flash content anyway')
					if (!override) return
				}
				else
				{
					window.alert('You do not have the flash 6 plugin\nPlease click on the download link\n to get the free plugin');
					return
				}
			}
			
			if (screen_width >= 1024)	// pop 800*600 window
			{
				var dim_string = centrePopUp(948,677) + ',scrollbars=no,resize=yes';
				var flash_file = '/connections/flash_popup.asp?pop_width=948&pop_height=677';
			}
			else	// pop 800*600 window
			{
				var dim_string = centrePopUp(772,528) + ',scrollbars=no,resize=yes';
				var flash_file = '/connections/flash_popup.asp?pop_width=772&pop_height=528';
			}
			
			//var dim_string = centrePopUp(772,528) + ',scrollbars=no,resize=yes';
			//var flash_file = 'flash_popup.asp?pop_width=772&pop_height=528';
			
			//window.alert(dim_string);
			var crnt_win = window.open(flash_file,'flash_popup',dim_string);
			crnt_win.focus();
			
			//flash detected return true
			return
		}
		
		//flash not detected return true
		return
	}
	
/*	function init() {
		getDimensions();	//gets window and screen dimension & sets to global variables
		
		//if plugin detected pop flash movie
		popFlashMovie(false);
		
	}*/
	
	function launch(w,h)
	{
		getDimensions();
		var dim_string = centrePopUp(w,h) + ',scrollbars=no,resize=yes';
		var flash_file = 'flash_popup.asp?pop_width=' + w + '&pop_height=' + h;
		
		var crnt_win = window.open(flash_file,'flash_popup',dim_string);
		crnt_win.focus();
	}
	
	
	function popLeisureFlashMovie(force) {
		getDimensions();
		if (plugin || force)
		{
			if (!plugin)
			{
				if(is_ie && is_win)
				{
					var override = window.confirm('The flash 6 plugin was not detecteded\nIf you have already downloaded the plugin,\nclick OK to view the flash content anyway')
					if (!override) return
				}
				else
				{
					window.alert('You do not have the flash 6 plugin\nPlease click on the download link\n to get the free plugin');
					return
				}
			}
			
			if (screen_width >= 1024)	// pop 800*600 window
			{
				var dim_string = centrePopUp(948,677) + ',scrollbars=no,resize=yes';
				var flash_file = '/leisuremap/flash_popup.asp?pop_width=948&pop_height=677';
			}
			else	// pop 800*600 window
			{
				var dim_string = centrePopUp(772,528) + ',scrollbars=no,resize=yes';
				var flash_file = '/leisuremap/flash_popup.asp?pop_width=772&pop_height=528';
			}
			
			var crnt_win = window.open(flash_file,'flash_popup',dim_string);
			crnt_win.focus();
			
			//flash detected return true
			return
		}
		
		//flash not detected return true
		return
	}