function externalLinks(){
if(!document.getElementsByTagName)return;
var anchors=document.getElementsByTagName("a");
for(var i=0;i<anchors.length;i++){
var anchor=anchors[i];
if(anchor.getAttribute("href")&&(anchor.getAttribute("rel")=="external"))
anchor.target="_blank";
}
}


function addLoadEvent(func){
var oldonload=window.onload;
if(typeof window.onload!='function'){
window.onload=func;
}
else
{
window.onload=function(){
if(oldonload){oldonload();
}
func();
}
}
}

function selectRadioButton(id) {
	document.getElementById(id).checked = true;
}

addLoadEvent(externalLinks);

jQuery(document).ready(function() {
	//$("#divTopCentreBottom ul li:last-child").addClass("last-child");

	if (document.getElementById('fi118'))
	{
		document.getElementById('fi118').setAttribute('onclick', 'selectRadioButton(\'fi117_295\')');
	}
	else if (document.getElementById('fi140'))
	{
		document.getElementById('fi140').setAttribute('onclick', 'selectRadioButton(\'fi139_295\')');
	}
	else if (document.getElementById('fi250'))
	{
		document.getElementById('fi250').setAttribute('onclick', 'selectRadioButton(\'fi249_295\')');
	}

	if ($('#manifesto_movie').length) {
		$('#manifesto_movie').flash(
		{ src: 'http://video.libdems.org.uk/2010manifesto/player/LibDem1v1.swf',
		width: 682,
		height: 334,
		allowScriptAccess: 'sameDomain',
		allowFullScreen: false,
		quality: 'high' },
		{ version: 8,
			expressInstall: true }
		);
	};
	if ($('.alternativeText').length) {$(".alternativeText").css({display:'none'});};
	
	var strSelected
	strSelected = $('.zoom_metaform_dropdown').val();

	$('.zoom_metaform_dropdown')
		.find('option')
		.remove()
		.end()
	;

	if (strSelected == '-1')
	{
		$('.zoom_metaform_dropdown')
			.append('<option selected="selected" value="-1">All</option>')
		;
	}
	else
	{
		$('.zoom_metaform_dropdown')
			.append('<option selected="selected" value="-1">All</option>')
	;
	}

	if (strSelected == '0')
	{
		$('.zoom_metaform_dropdown')
			.append('<option selected="selected" value="0">What We Stand For/Policy</option>')
		;
	}
	else
	{
		$('.zoom_metaform_dropdown')
			.append('<option value="0">What We Stand For/Policy</option>')
	;
	}

	if (strSelected == '1')
	{
		$('.zoom_metaform_dropdown')
			.append('<option selected="selected" value="1">News/Press Releases</option>')
		;
	}
	else
	{
		$('.zoom_metaform_dropdown')
			.append('<option value="1">News/Press Releases</option>')
	;
	}

	if (strSelected == '2')
	{
		$('.zoom_metaform_dropdown')
			.append('<option selected="selected" value="2">Campaigns</option>')
		;
	}
	else
	{
		$('.zoom_metaform_dropdown')
			.append('<option value="2">Campaigns</option>')
	;
	}

	if (strSelected == '3')
	{
		$('.zoom_metaform_dropdown')
			.append('<option selected="selected" value="3">Who We Are/People</option>')
		;
	}
	else
	{
		$('.zoom_metaform_dropdown')
			.append('<option value="3">Who We Are/People</option>')
	;
	}

	if (strSelected == '4')
	{
		$('.zoom_metaform_dropdown')
			.append('<option selected="selected" value="4">Get Involved</option>')
		;
	}
	else
	{
		$('.zoom_metaform_dropdown')
			.append('<option value="4">Get Involved</option>')
	;
	}
});