
// alert("FozImage JavaScript file running");

MastHeadImages = new Array("Mastheads/MH2 950x100.gif", "Mastheads/MH3 950x100.gif", "Mastheads/MH4 950x100.gif", "Mastheads/MH5 950x100.gif", "Mastheads/MH6 950x100.gif", "Mastheads/MH7 950x100.gif", "Mastheads/MH8 950x100.gif", "Mastheads/MH9 950x100.gif", "Mastheads/MH10 950x100.gif", "Mastheads/MH11 950x100.gif", "Mastheads/MH12 950x100.gif", "Mastheads/MH13 950x100.gif", "Mastheads/MH14 950x100.gif", "Mastheads/MH15 950x100.gif", "Mastheads/MH16 950x100.gif", "Mastheads/MH17 950x100.gif", "Mastheads/MH18 950x100.gif", "Mastheads/MH19 950x100.gif", "Mastheads/MH20 950x100.gif", "Mastheads/MH21 950x100.gif", "Mastheads/MH22 950x100.gif" )

MastHeadImageCount = MastHeadImages.length;

HomePageImages = new Array("Display_Jpegs/IMG_6362_800x533-6.jpg", "Display_jpegs/IMG_6453_800x533-6.jpg", "Display_Jpegs/IMG_7955_800x533-6.jpg", "London2008/img_7238-600x400.jpg", "Zapcats2007/img_4482-600x400.jpg", "Display_jpegs/IMG_9560_800x533-6.jpg", "Display_jpegs/IMG_0319-800x533-6.jpg", "Display_jpegs/253-11-800x533-6.jpg", "Luggers2007/IMG_7849-600x400.jpg", "July-2007-jpegs/img_8551-600x400.jpg" , "Brittany2007/img_0573-600x400.jpg", "Brittany2007/img_0871-600x400.jpg","Luggers2009/IMG_3017-600x400.jpg");
HomePageAlt = new Array("Danescombe Luggers - East Looe","Looe - Festival of the Sea - RNLI Rescue display","Zeller Zee","London - St Pauls and the city at dusk","Zapcat racing - Watergate bay","Red Arrows at Fowey","Eden - Time of Gifts","Ghost Gums Mutijulu waterhole","Looe Lugger Regatta - CM 2924 - La Nebuleuse","West Pentire - Poppies and Cornflowers","Abbaye de Beauport - Poppies","Bugueles","La Cancalaise leaving the port of Looe");

HomeImageCount = HomePageImages.length;

var vlandscapeviewer = null;

var vportraitviewer = null;


function SwitchPicture()
{
//   alert("this is the SwitchPicture script running");
   
   randomNumber = Math.floor( Math.random() * HomeImageCount);
   
   var rno = "Randon number = ";
   
//   alert(rno + randomNumber);

   window.document.getElementById("Home_Picture_1").src = HomePageImages[randomNumber];
	
   window.document.getElementById("Home_Picture_1").alt = HomePageAlt[randomNumber];
   
   window.document.getElementById("Home_Picture_1").title = HomePageAlt[randomNumber];
   
//   alert("SwitchPicture finished");
   
}

function SwitchTagPicture(arg1,arg2,arg3)
{
//   alert("this is the SwitchTagPicture script running");
   
   window.document.getElementById("Tag_Picture_1").src = arg1;
	
   window.document.getElementById("Tag_Picture_1").alt = arg2;

   window.document.getElementById("Tag_Picture_1_href").href = arg3;
   
//   alert("SwitchTagPicture finished");
   
}



function SwitchMastHead()
{
//   alert("this is the SwitchMsstHead script running");
   
   randomNumber1 = Math.floor( Math.random() * MastHeadImageCount);
   
   var rno1 = "Randon number = ";
   
//   alert(rno1 + randomNumber1);

   window.document.getElementById("MastHeadPicture").src = MastHeadImages[randomNumber1];
	
	var MastHeadFile = MastHeadImages[randomNumber1];
	
	
	if (randomNumber1 == 0 )  {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Zeller Zee Boats"; }
	if (randomNumber1 == 1 )  {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Sails"; }	
	if (randomNumber1 == 2 )  {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Hot Air Balloon"; }	
	if (randomNumber1 == 3 )  {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Franz Joesfs Hohe - Austria"; }	
	if (randomNumber1 == 4 )  {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Heron"; }
	if (randomNumber1 == 5 )  {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Inshore Lifeboat"; }
	if (randomNumber1 == 6 )  {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Tulips"; }
	if (randomNumber1 == 7 )  {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - St Pirans Flag"; }	
	if (randomNumber1 == 8 )  {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Fireworks"; }
	if (randomNumber1 == 9 )  {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Millennium centre Cardiff"; }
	if (randomNumber1 == 10 ) {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Millennium stadium Cardiff"; }
	if (randomNumber1 == 11 ) {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Abstract"; }
	if (randomNumber1 == 12)  {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Abstract"; }
	if (randomNumber1 == 13 ) {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Looe Lugger - FY7 – Our Daddy"; }
	if (randomNumber1 == 14 ) {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Launceston – Arial View"; }
	if (randomNumber1 == 15 ) {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Ponte Santa Trinata -River Arno - Florence"; }
	if (randomNumber1 == 16 ) {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Duomo - Florence"; }
	if (randomNumber1 == 17 ) {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Campanile - Florence"; }
	if (randomNumber1 == 18 ) {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Hot Air Balloon"; }	
	if (randomNumber1 == 19 ) {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Tulip"; }
	if (randomNumber1 == 20 ) {   window.document.getElementById("MastHeadPicture").alt = "Fozimage – Masthead - Sandymouth"; }

	if (randomNumber1 == 0 )  {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Zeller Zee Boats"; }
	if (randomNumber1 == 1 )  {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Sails"; }	
	if (randomNumber1 == 2 )  {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Hot Air Balloon"; }	
	if (randomNumber1 == 3 )  {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Franz Joesfs Hohe - Austria"; }	
	if (randomNumber1 == 4 )  {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Heron"; }
	if (randomNumber1 == 5 )  {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Inshore Lifeboat"; }
	if (randomNumber1 == 6 )  {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Tulips"; }
	if (randomNumber1 == 7 )  {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - St Pirans Flag"; }	
	if (randomNumber1 == 8 )  {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Fireworks"; }
	if (randomNumber1 == 9 )  {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Millennium centre Cardiff"; }
	if (randomNumber1 == 10 ) {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Millennium stadium Cardiff"; }
	if (randomNumber1 == 11 ) {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Abstract"; }
	if (randomNumber1 == 12)  {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Abstract"; }
	if (randomNumber1 == 13 ) {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Looe Lugger - FY7 – Our Daddy"; }
	if (randomNumber1 == 14 ) {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Launceston – Arial View"; }
	if (randomNumber1 == 15 ) {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Ponte Santa Trinata -River Arno - Florence"; }
	if (randomNumber1 == 16 ) {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Duomo - Florence"; }
	if (randomNumber1 == 17 ) {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Campanile - Florence"; }
	if (randomNumber1 == 18 ) {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Hot Air Balloon"; }	
	if (randomNumber1 == 19 ) {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Tulip"; }
	if (randomNumber1 == 20 ) {   window.document.getElementById("MastHeadPicture").title = "Fozimage – Masthead - Sandymouth"; }


//   alert("SwitchMastHead finished");
   
}

function SwitchGalleryPicture(arg1,arg2)
{
//   alert("this is the SwitchGalleryPicture script running");
	
	var vgalleryfile = arg1; 
	var vgalleryalt = arg2;
	
   window.document.getElementById("Gallery_Picture_1").src = vgalleryfile;
	
   window.document.getElementById("Gallery_Picture_1").alt = vgalleryalt;

   window.document.getElementById("Gallery_Picture_1").title = vgalleryalt;


//   alert("SwitchGalleryPicture finished");
   
}

function SwitchGalleryThumbList(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19,arg20)
{
//  alert("this is the SwitchGalleryThumbList script running");

//	var str = window.document.getElementById("Thumb1-href").href;
//	alert(str);	

	var vthumbfile1  = arg1; 
	var vthumbalt1   = arg2;
	var vthumbfile2  = arg5; 
	var vthumbalt2   = arg6;
	var vthumbfile3  = arg9; 
	var vthumbalt3   = arg10;	
	var vthumbfile4  = arg13; 
	var vthumbalt4   = arg14;
	var vthumbfile5  = arg17; 
	var vthumbalt5   = arg18;

// change thumbnail sizes to landscape or portrait 

	if ( arg3 == "Thumb-Image-P" )
		{
		window.document.getElementById("Thumb1").style.width  = "56px";
		window.document.getElementById("Thumb1").style.height = "84px";
		}		
	else
		{		
		window.document.getElementById("Thumb1").style.width  = "125px";
		window.document.getElementById("Thumb1").style.height = "84px";		 
		}
	
	if ( arg7 == "Thumb-Image-P" )
		{
		window.document.getElementById("Thumb2").style.width  = "56px";
		window.document.getElementById("Thumb2").style.height = "84px";
		}		
	else
		{		
		window.document.getElementById("Thumb2").style.width  = "125px";
		window.document.getElementById("Thumb2").style.height = "84px";		 
		}

	if ( arg11== "Thumb-Image-P" )
		{
		window.document.getElementById("Thumb3").style.width  = "56px";
		window.document.getElementById("Thumb3").style.height = "84px";
		}		
	else
		{		
		window.document.getElementById("Thumb3").style.width  = "125px";
		window.document.getElementById("Thumb3").style.height = "84px";		 
		}

	if ( arg15 == "Thumb-Image-P" )
		{
		window.document.getElementById("Thumb4").style.width  = "56px";
		window.document.getElementById("Thumb4").style.height = "84px";
		}		
	else
		{		
		window.document.getElementById("Thumb4").style.width  = "125px";
		window.document.getElementById("Thumb4").style.height = "84px";		 
		}

	if ( arg19 == "Thumb-Image-P" )
		{
		window.document.getElementById("Thumb5").style.width  = "56px";
		window.document.getElementById("Thumb5").style.height = "84px";
		}		
	else
		{		
		window.document.getElementById("Thumb5").style.width  = "125px";
		window.document.getElementById("Thumb5").style.height = "84px";		 
		}

// set 1

	window.document.getElementById("Thumb1").src = vthumbfile1;
	
	window.document.getElementById("Thumb1").alt = vthumbalt1;
 
	window.document.getElementById("Thumb1").title = vthumbalt1;
 
 	var vthumbhref1 = "javascript:SwitchGalleryPicture(" + "'" + arg4 + "','" + vthumbalt1 + "')";
	
//	alert(vthumbhref1);
	
	window.document.getElementById("Thumb1-href").href = vthumbhref1;

// set 2

	window.document.getElementById("Thumb2").src = vthumbfile2;
	
	window.document.getElementById("Thumb2").alt = vthumbalt2;
	
	window.document.getElementById("Thumb2").title = vthumbalt2;
	
 	var vthumbhref2 = "javascript:SwitchGalleryPicture(" + "'" + arg8 + "','" + vthumbalt2 + "')";
	
//	alert(vthumbhref2);
	
	window.document.getElementById("Thumb2-href").href = vthumbhref2;	

// set 3

	window.document.getElementById("Thumb3").src = vthumbfile3;
	
	window.document.getElementById("Thumb3").alt = vthumbalt3;
	
	window.document.getElementById("Thumb3").title = vthumbalt3;
	
 	var vthumbhref3 = "javascript:SwitchGalleryPicture(" + "'" + arg12 + "','" + vthumbalt3 + "')";
	
//	alert(vthumbhref3);
	
	window.document.getElementById("Thumb3-href").href = vthumbhref3

// set 4

	window.document.getElementById("Thumb4").src = vthumbfile4;
	
	window.document.getElementById("Thumb4").alt = vthumbalt4;
	
	window.document.getElementById("Thumb4").title = vthumbalt4;
	
 	var vthumbhref4 = "javascript:SwitchGalleryPicture(" + "'" + arg16 + "','" + vthumbalt4 + "')";
	
//	alert(vthumbhref4);
	
	window.document.getElementById("Thumb4-href").href = vthumbhref4;
	
// set 5	
	
	window.document.getElementById("Thumb5").src = vthumbfile5;
	
	window.document.getElementById("Thumb5").alt = vthumbalt5;
	
	window.document.getElementById("Thumb5").title = vthumbalt5;
	
 	var vthumbhref5 = "javascript:SwitchGalleryPicture(" + "'" + arg20 + "','" + vthumbalt5 + "')";
	
//	alert(vthumbhref5);
	
	window.document.getElementById("Thumb5-href").href = vthumbhref5;
   
   
//   alert("SwitchGalleryThumbList  finished");
   
}

function open_landscape_viewer (arg1,arg2)
	{
//   alert("open_landscape_viewer started");

// set up variables for the popup window

				var ls1 = "<html><head><title>FozImage - Image Viewer - Landscape</title>";
				var ls2 = "<script type = \"text/javascript\" src=\"FozImage_Java_Scripts/fozimage.js\"></script>";
				var ls3 = "<link rel = \"stylesheet\" title = \"FozImage Styles\" type=\"text/css\" href=\"FozImage_CSS/fozimage2.css\">";
				var ls4 = "</head>";
				var ls5 = "<body><div id=\"portraitviewer\"><h1 id=\"pviewerh1\" class = \"style7\">Fozimage - Landscape Viewer</h1>";
				var ls6 = "<p><img src=" + arg1 + " alt=" + arg2 + " class = \"Viewer-float-left\" id=\"lviewerimage\"></p>";
//				var ls7 = "<p class = \"style4 p-clear-left\"><a href=\"javascript:close_portrait_viewer()\">Close Window</a></p>";
				var ls7 = "<p class = \"style4 p-clear-left\"><a href=\"javascript:window.close()\">Close Window</a></p>";
				var ls8 = "</div></body></html>";
				
// if the user has closed the popup the variable is not reset to null - we need to recreate the popup

	if ( vlandscapeviewer && vlandscapeviewer.closed) 
			{
				vlandscapeviewer=window.open("", "vplandscapeviewer", "toolbar=no,scrollbars=no,menubar=no,status=no,height=600,width=700");
				vlandscapeviewer.document.write(ls1+ls2+ls3+ls4+ls5+ls6+ls7+ls8);
				vlandscapeviewer.document.close();
			}			
// If the popup window is already open - change the image	

   if (vlandscapeviewer && vlandscapeviewer.open)
		{ 
//		 alert("window - landscapeviewer is open"); 
		 vlandscapeviewer.document.getElementById("lviewerimage").src = arg1;
		 vlandscapeviewer.document.getElementById("lviewerimage").alt = arg2;
		 vlandscapeviewer.focus();
		}

// if the window variable is null it has not been created - therefore lets create it
	
	if (vlandscapeviewer == null)
			{ 
				vlandscapeviewer=window.open("", "vlandscapeviewer", "toolbar=no,scrollbars=no,menubar=no,status=no,height=600,width=700");
				vlandscapeviewer.document.write(ls1+ls2+ls3+ls4+ls5+ls6+ls7+ls8);
				vlandscapeviewer.document.close();
			}

    
			
//   alert("open_landscape_viewer  finished");
	}
	

function open_portrait_viewer (arg1,arg2)
	{
//   alert("open_portrait_viewer started");

// set up variables for the popup window

				var ps1 = "<html><head><title>FozImage - Image Viewer - Portrait</title>";
				var ps2 = "<script type = \"text/javascript\" src=\"FozImage_Java_Scripts/fozimage.js\"></script>";
				var ps3 = "<link rel = \"stylesheet\" title = \"FozImage Styles\" type=\"text/css\" href=\"FozImage_CSS/fozimage2.css\">";
				var ps4 = "</head>";
				var ps5 = "<body><div id=\"portraitviewer\"><h1 id=\"pviewerh1\" class = \"style7\">Fozimage - Portrait Viewer</h1>";
				var ps6 = "<p><img src=" + arg1 + " alt=" + arg2 + " class = \"Viewer-float-left-portrait\" id=\"pviewerimage\"></p>";
//				var ps7 = "<p class = \"style4 p-clear-left\"><a href=\"javascript:close_portrait_viewer()\">Close Window</a></p>";
				var ps7 = "<p class = \"style4 p-clear-left\"><a href=\"javascript:window.close()\">Close Window</a></p>";
				var ps8 = "</div></body></html>";
				
// if the user has closed the popup the variable is not reset to null - we need to recreate the popup

	if ( vportraitviewer && vportraitviewer.closed) 
			{
				vportraitviewer=window.open("", "vportraitviewer", "toolbar=no,scrollbars=no,menubar=no,status=no,height=600,width=350");
				vportraitviewer.document.write(ps1+ps2+ps3+ps4+ps5+ps6+ps7+ps8);
				vportraitviewer.document.close();
			}			
// If the popup window is already open - change the image	

   if (vportraitviewer && vportraitviewer.open)
		{ 
//		 alert("window - portraitviewer is open"); 
		 vportraitviewer.document.getElementById("pviewerimage").src = arg1;
		 vportraitviewer.document.getElementById("pviewerimage").alt = arg2;
		 vportraitviewer.focus();
		}

// if the window variable is null it has not been created - therefore lets create it
	
	if (vportraitviewer == null)
			{ 
				vportraitviewer=window.open("", "vportraitviewer", "toolbar=no,scrollbars=no,menubar=no,status=no,height=600,width=350");
				vportraitviewer.document.write(ps1+ps2+ps3+ps4+ps5+ps6+ps7+ps8);
				vportraitviewer.document.close();
			}


			
//   alert("open_portrait_viewer  finished");
	}
	
	
	