var numberOfImages = 17;

var contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
		for (var i = 0; i < words.length; ++i)	{
			if (isNaN(parseInt(words[i])))
			continue;
			var pluginVersion = words[i];
		}
		var flashCanPlay = pluginVersion >= contentVersion;
} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript>\n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next\n');
	document.write('flashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & contentVersion)))\n');
	document.write('</SCR' + 'IPT>\n');
}

function bannerScript()	{
	if ( flashCanPlay ) {
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
	document.write(' ID="banner" WIDTH="455" HEIGHT="117" ALIGN="">');
	document.write(' <PARAM NAME=movie VALUE="banner/banner.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF>  ');
	document.write(' <EMBED src="banner/banner.swf" quality=high bgcolor=#FFFFFF  ');
	document.write(' swLiveConnect=FALSE WIDTH="455" HEIGHT="117" NAME="banner" ALIGN=""');
	document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
	document.write(' </EMBED>');
	document.write(' </OBJECT>');
	} else {
	var randomNumber = Math.floor(Math.random()*numberOfImages)+1;
	document.write('<img src="banner/picture'+randomNumber+'.jpg" width="455" height="117" border="0">');
	}
}

function soundScript()	{
	if ( flashCanPlay ) {
  	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
 	document.write(' ID="music" WIDTH="282" HEIGHT="20" ALIGN="">');
	document.write(' <PARAM NAME=movie VALUE="sound/sound.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF>  ');
	//document.write(' <PARAM NAME=FlashVars VALUE="musicPref=0"> ');
	document.write(' <EMBED src="sound/sound.swf" quality=high bgcolor=#FFFFFF  ');
	//document.write(' FlashVars="musicPref=0" ');
	document.write(' swLiveConnect=FALSE WIDTH="282" HEIGHT="20" NAME="music" ALIGN=""');
	document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
	document.write(' </EMBED>');
	document.write(' </OBJECT>');
	} else{
	document.write('<img id="sound" src="images/nosound.png" width="282" height="20" border="0">');
	}
}

function projectsScript()	{
	if ( flashCanPlay ) {
  	document.write('<p class="pplist"><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
 	document.write(' ID="projects" WIDTH="241" HEIGHT="241" ALIGN="">');
	document.write(' <PARAM NAME=movie VALUE="projects/projects.swf?123"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF>  ');
	document.write(' <EMBED src="projects/projects.swf?123" quality=high bgcolor=#FFFFFF  ');
	document.write(' swLiveConnect=FALSE WIDTH="241" HEIGHT="241" NAME="projects" ALIGN=""');
	document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
	document.write(' </EMBED>');
	document.write(' </OBJECT></p>');
	} else{
	document.write('<p class="pplist">Project highlights:<br /><br />Beatles \'Anthology\' & \'1\' (EMI)<br />Cantamus \'Aurora\' (Warner)<br />Celine Dion \'The Reason\' (Sony)<br />Chunky Monkey (Open Road Films)<br />John Lennon \'Grow Old With Me\' (EMI)<br />George Martin & the LA Philharmonic at the Hollywood Bowl<br />George Martin \'In My Life\' (Echo)<br />Party and Prom at the Palace (Virgin/EMI)<br />State of the Planet (BBC)<br />Sandstone Veterans (Num Num Sounds)<br />Hayley Westenra 2 albums (Decca/Universal)<br />Willard White \'My Way\' (Sony)<br />The Beatles in Las Vegas<br />Roobarb & Custard Too</p>');
	}
}

function setEnquiry()	{
if (location.search) {
	var id = location.search.split("=");
	for (a=0; a<document.cf.cam_enquiry.options.length; a++)	{
		if (id[1] == document.cf.cam_enquiry.options[a].value){
		document.cf.cam_enquiry.options[a].selected = true;
		}
	}
}
}

function toggleLayer(whichLayer)	{
	if (document.getElementById)	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
	} else if (document.all) {
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
	} else if (document.layers) {
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
}

function checkForm()	{

var chosen = document.cf.cam_enquiry.options[document.cf.cam_enquiry.options.selectedIndex].value;

if (chosen == 0)	{ document.cf.cam_type.value = "General Enquiry";}
if (chosen == 1)	{ document.cf.cam_type.value = "Jon Atkinson";}
if (chosen == 2)	{ document.cf.cam_type.value = "Sir George Martin";}
if (chosen == 3)	{ document.cf.cam_type.value = "Giles Martin";}

var datacheck = true;

	if (datacheck)	{
		if (document.cf.cam_name.value == "")	{
		alert ("Please enter your name.");
		datacheck = false;
		}
	}

	if (datacheck)	{
		if (document.cf.cam_email.value == "")	{
		alert ("Please enter your email address.");
		datacheck = false;
		}
	}

	if (datacheck)	{
		if (document.cf.cam_message.value == "")	{
		alert ("Please enter your message.");
		datacheck = false;
		}
	}

	if (datacheck)	{
		document.cf.submit();
	}

	

}