function print_page() {
window.print();
}


function FN50_quick_link_fly()
{
if (document.forms.quickLinks.quick_links.options[document.forms.quickLinks.quick_links.selectedIndex].value.length > 0)
	{
	location.href = '/FN50/'+document.forms.quickLinks.quick_links.options[document.forms.quickLinks.quick_links.selectedIndex].value+'/';
	}
}


function swap_visible_blocks(div_to_hide, div_to_show)
{
hide_div = div_to_hide;
show_div = div_to_show;

var h = document.getElementById(hide_div);
var s = document.getElementById(show_div);

h.style.display = 'none';
s.style.display = 'block';
}


function hide_div_block(div_to_hide)
{
hide_div = div_to_hide;

var h = document.getElementById(hide_div);

h.style.display = 'none';
}

function show_div_block(div_to_show)
{
show_div = div_to_show;

var h = document.getElementById(show_div);

h.style.display = 'block';
}



function swap_news_top_ten_tabs_container(read_or_sent)
{
rs = read_or_sent;
var a = document.getElementById("top_ten_tabs_container");

if (rs == "s")
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_news_top10_sent.gif)";
	}
else
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_news_top10_read.gif)";
	}
}


function swap_fleetvan_top_ten_tabs_container(read_or_sent)
{
rs = read_or_sent;
var a = document.getElementById("top_ten_tabs_container");

if (rs == "s")
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_fleetvan_top10_sent.gif)";
	}
else
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_fleetvan_top10_read.gif)";
	}
}


function swap_FN50_top_ten_tabs_container(read_or_sent)
{
rs = read_or_sent;
var a = document.getElementById("top_ten_tabs_container");

if (rs == "s")
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_fleetvan_top10_sent.gif)";
	}
else
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_fleetvan_top10_read.gif)";
	}
}


function swap_fne_top_ten_tabs_container(read_or_sent)
{
rs = read_or_sent;
var a = document.getElementById("top_ten_tabs_container");

if (rs == "s")
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_fne_top10_sent.gif)";
	}
else
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_fne_top10_read.gif)";
	}
}

function swap_IndustryResearch_top_ten_tabs_container(read_or_sent)
{
rs = read_or_sent;
var a = document.getElementById("top_ten_tabs_container");

if (rs == "s")
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_IndustryResearch_top10_sent.gif)";
	}
else
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_IndustryResearch_top10_read.gif)";
	}
}

function swap_risk_management_top_ten_tabs_container(read_or_sent)
{
rs = read_or_sent;
var a = document.getElementById("top_ten_tabs_container");

if (rs == "s")
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_rm_top10_sent.gif)";
	}
else
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_rm_top10_read.gif)";
	}
}


function swap_roadtests_top_ten_tabs_container(read_or_sent)
{
rs = read_or_sent;
var a = document.getElementById("top_ten_tabs_container");

if (rs == "s")
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_roadtests_top10_sent.gif)";
	}
else
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_roadtests_top10_read.gif)";
	}
}


function swap_contact_tabs_container(team_or_contact)
{
tc = team_or_contact;
var a = document.getElementById("contact_tabs_container");

if (tc == "t")
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_contact_team.gif)";
	}
else
	{
	a.style.backgroundImage = "url(/_images/buttons/bt_contact_contact.gif)";
	}
}


function enter_key_form_submit(e, which_form)
{ //e is event object passed from initialising function
var characterCode
var which_form

if (e && e.which)
	{ //if which property of event object is supported (NN4)
	e = e
	characterCode = e.which //character code is contained in NN4's which property
	}
else
	{
	e = event
	characterCode = e.keyCode //character code is contained in IE's keyCode property
	}

if (characterCode == 13)
	{ //if generated character code is equal to ascii 13 (if enter key)
	eval(which_form+'.submit()') //submit the form
	return false 
	}
else
	{
	return true 
	}
}


function rt_show_video(which_vid)
{
var a = which_vid;
var surround_div_var = "rtVid"+a+"_d";
var flash_div_var = "flashcontentrtVid"+a;

var surround_div = document.getElementById(surround_div_var);
var flash_div = document.getElementById(flash_div_var);

var current_shown_div_var = document.forms.vidForm.current_vid.value;
var current_shown_div = document.getElementById(current_shown_div_var);

current_shown_div.style.display = "none";
surround_div.style.display = "block";
document.forms.vidForm.current_vid.value = "rtVid"+a+"_d";

var so = new SWFObject("http://www.youtube.com/v/"+a+"&rel=1", "rtVid"+a+"", "224", "187", "8", "#000000");
so.write(flash_div);
}


function expand_collapse_roadtest_thumb_factsheet()
{
var a = document.getElementById("roadtest_story_thumb_factsheet_container");
var b = document.getElementById("roadtest_story_thumb_factsheet_collapsed_container");
var c = document.getElementById("roadtest_story_bottom_left");
var d = document.getElementById("roadtest_story_key_quote");

if (b.style.display == "block")
	{
	a.style.display = "block";
	b.style.display = "none";
	c.style.marginTop = "28px";
	if (d)
		{
		d.style.borderBottom = "none";
		}
	}
else
	{
	a.style.display = "none";
	b.style.display = "block";
	c.style.marginTop = "0px";
	if (d)
		{
		d.style.borderBottom = "1px solid #e7e7e7";
		}
	}
}


function expand_collapse_roadtest_large_image()
{
var a = document.getElementById("roadtest_story_thumb_factsheet_left");
var b = document.getElementById("roadtest_story_thumb_factsheet_middle");
var c = document.getElementById("roadtest_story_enlarged_image");
var d = document.forms.imgForm.current_imgID.value;
var e = document.forms.imgForm.current_imgFolder.value;
var f = document.forms.imgForm.current_imgType.value;
var g = document.getElementById("l_img");

if (b.style.display == "block")
	{
	g.src = "http://images.automotive.co.uk/_images/__imageBank/"+e+"/"+d+"."+f;
	a.style.width = "23px";
	a.innerHTML = '<a href="javascript:expand_collapse_roadtest_large_image();"><img src="/_images/buttons/bt_roadtests_large_img_hide.gif" alt="back to thumbnails" /></a>';
	b.style.display = "none";
	c.style.display = "block";
	}
else
	{
	a.style.width = "35px";
	a.innerHTML = '<a href="javascript:expand_collapse_roadtest_thumb_factsheet();"><img src="/_images/buttons/bt_roadtests_factsheet_hide.gif" alt="hide factsheet" /></a>';
	c.style.display = "none";
	b.style.display = "block";
	l_img.src = "";
	}
}


function hide_roadtest_factsheet_image()
{
expand_collapse_roadtest_thumb_factsheet();
var a = document.getElementById("roadtest_story_thumb_factsheet_collapsed_container");
a.style.display = "none";
}




function IsDigit( e )
{
	e = e || event ;
	var iCode = ( e.keyCode || e.charCode ) ;

	return 	(
			( iCode >= 48 && iCode <= 57 )		// Numbers
			|| iCode == 8		// Backspace
			|| iCode == 46		// Delete
		) ;
}
