

//var holding selected top nav item
var selected_top_nav = null;
var selected_top_nav_img = null;

//function to roll top nav item
function rollTopNav(item_no,status) 
{
	
	//turn off any existing highlights
	if (selected_top_nav != null) selected_top_nav.style.background = '#8BB9E6';
	if (selected_top_nav_img != null) selected_top_nav_img.src = 'http://www.portoflondon.co.uk/images/top_nav_round_corner_off.gif';
	
	// if status is on then highlight appropriate item
	if (status == 'on') 
	{
		if (document.getElementById) 
		{
			//do td highlight
			document.getElementById('topNavItem' + item_no).style.background = '#6699CC';// : '#84B5E7';
			selected_top_nav = document.getElementById('topNavItem' + item_no);
			//do img highlight (corner - if first item)
			if (item_no == 0)
			{
				document.getElementById('nav_corner').src = 'http://www.portoflondon.co.uk/images/top_nav_round_corner_on.gif';
				selected_top_nav_img = document.getElementById('nav_corner');
			}
		}
		else if (document.all) 
		{
			document.all['topNavItem' + item_no].style.background = '#6699CC';
			selected_top_nav = document.all['topNavItem' + item_no];
			if (item_no == 0)
			{
				document.images['nav_corner'].src = 'http://www.portoflondon.co.uk/images/top_nav_round_corner_on.gif';
				selected_top_nav_img = document.getElementById['nav_corner'];
			}
		}
	}
	//if status off then set selected values to null
	else if (status == 'off')
	{
		selected_top_nav != null;
		selected_top_nav_img = null
	}
	
}


var imgs_preloaded = false;	//preload status of main nav images

//preload main nav images
function preloadImgs(root_path, img_array) {
	for (var i=0;i<img_array.length;i++) {
		eval (img_array[i] + '_off = new Image();');
		eval (img_array[i] + '_off.src = "' + root_path + img_array[i] + '_off.gif"');
		eval (img_array[i] + '_on = new Image();');
		eval (img_array[i] + '_on.src = "' + root_path + img_array[i] + '_on.gif"');
	}
	return true;
}


//image rollover function
function rollImg(img_name, img_path, state) {
	if (document.getElementById) document.getElementById(img_name).src = eval(img_name+'_'+state+'.src');
	else document.images[img_name].src = eval(img_name+'_'+state+'.src');
}


//function get xy (returns string for pop up properties)
function getWinXY (pop_width,pop_height) {
	
		var screen_width = screen.availWidth;
		var screen_height = screen.availHeight;
		
		var xpos = Math.round(((screen_width - pop_width)/2));
		var ypos = Math.round(((screen_height - pop_height)/2));	

		//if (document.layers) return ",screenX=" + xpos + ",screenY=" + ypos;
		//else return ",left=" + xpos + ",top=" + ypos;
		
		return xpos + "," + ypos;
}


//function to set position of season greetings layer
function setSeasons() {
	
	var window_width;
	var lyrRef;
	
	if (document.layers) {
		window_width = document.body.clientWidth;
		lyrRef = document.layers['seasonLayer'];
		lyrRef.left = (window_width - lyrRef.width);
		lyrRef.visibility = 'visibile';
	}
	else if (document.all) {
		window_width = window.innerWidth;
		lyrRef = document.getElementById('seasonLayer');
		lyrRef.style.left = (window_width - lyrRef.style.width);
		lyrRef.style.visibility = 'visbile';
	}
	else if (document.getElementById) {
		window_width = window.innerWidth;
		lyrRef = document.getElementById('seasonLayer');
		lyrRef.style.left = (window_width - lyrRef.style.width);
		lyrRef.style.visibility = 'visbile';
	}

}


