// Silverpearweddings.co.uk javascript document
// Begin random photo changer for homepage
var photos = new Array(); 

/* To add more photos to collection, continue list below, keeping format. One line per photo is 
all that is rquired. Make sure photo is in the right directory (images/photos), and that dimensions of photo are
width 780px and height 302 pixels.
example: photos[4] = 'images/photos/photo5.jpg'
Please note that currently only one photo is used but changer remains in place in case of future demand.
*/

photos[0] = 'photos/welcome/photo1.jpg'; // Copyright Silver Pear Weddings 2005 www.silverpearweddings.co.uk
// photos[1] = 'photos/welcome/photo2.jpg'; // Copyright Silver Pear Weddings 2005 www.silverpearweddings.co.uk
// photos[2] = 'photos/welcome/photo3.jpg'; // Copyright Silver Pear Weddings 2005 www.silverpearweddings.co.uk

// DO NOT EDIT ANY FURTHER!

var p = photos.length;
var preloadBuffer = new Array();
for (i = 0; i < p; i++){
   preloadBuffer[i] = new Image();
   preloadBuffer[i].src = photos[i];
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="'+photos[whichImage]+'" width="770" height="360" border="0">');
}
// End random photograph changer

// Sets year for copyright notice on page footer
var thisYear;
today = new Date();
thisYear = today.getUTCFullYear(); // Firefox needs proper UTC construct, getYear() produces incorrect result

function copyrightYear() {
document.write(thisYear);
}

/* Menus - Top & bottom right image based
   Preloads table of contents rollover 
   images and defines rollover states */
   
toc1on = new Image();
toc2on = new Image();
toc3on = new Image();
toc4on = new Image();
toc5on = new Image();
toc6on = new Image();
toc7on = new Image();
toc8on = new Image();
toc9on = new Image();
toc10on = new Image();
toc11on = new Image();
toc12on = new Image();
toc13on = new Image();
toc14on = new Image();
toc15on = new Image();
toc16on = new Image();
// Defines mouseover state images
toc1on.src = "images/menu/civil_on.gif"; 
toc2on.src = "images/menu/smaller_on.gif"; 
toc3on.src = "images/menu/marquee_on.gif"; 
toc4on.src = "images/menu/stone_on.gif"; 
toc5on.src = "images/menu/gallery_on.gif"; 
toc6on.src = "images/menu/hints_on.gif"; 
toc7on.src = "images/menu/acknow_on.gif"; 
toc8on.src = "images/menu/home_on.gif"; 
toc9on.src = "images/menu/contact_on.gif"; 
toc10on.src = "images/menu/links_on.gif"; 
toc11on.src = "images/menu/guestbook_on.gif";
toc12on.src = "images/menu/friarscourt_on.gif"; 
toc13on.src = "images/menu/faq_on.gif"; 
toc14on.src = "images/menu/questions_on.gif"; 
toc15on.src = "images/menu/availability_on.gif"; 
toc16on.src = "images/menu/venueRates_on.gif"; 

toc1off = new Image(); 
toc2off = new Image(); 
toc3off = new Image(); 
toc4off = new Image(); 
toc5off = new Image(); 
toc6off = new Image(); 
toc7off = new Image(); 
toc8off = new Image(); 
toc9off = new Image(); 
toc10off = new Image(); 
toc11off = new Image(); 
toc12off = new Image(); 
toc13off = new Image(); 
toc14off = new Image(); 
toc15off = new Image(); 
toc16off = new Image(); 
// Defines mouseout state images
toc1off.src = "images/menu/civil_off.gif";
toc2off.src = "images/menu/smaller_off.gif";
toc3off.src = "images/menu/marquee_off.gif";
toc4off.src = "images/menu/stone_off.gif";
toc5off.src = "images/menu/gallery_off.gif";
toc6off.src = "images/menu/hints_off.gif";
toc7off.src = "images/menu/acknow_off.gif";
toc8off.src = "images/menu/home_off.gif";
toc9off.src = "images/menu/contact_off.gif";
toc10off.src = "images/menu/links_off.gif";
toc11off.src = "images/menu/guestbook_off.gif";
toc12off.src = "images/menu/friarscourt_off.gif";
toc13off.src = "images/menu/faq_off.gif";
toc14off.src = "images/menu/questions_off.gif";
toc15off.src = "images/menu/availability_off.gif";
toc16off.src = "images/menu/venueRates_off.gif";

function img_act(imgName) {
	imgOn = eval(imgName + "on.src");
	document [imgName].src = imgOn;
	}

function img_inact(imgName) {
	imgOff = eval(imgName + "off.src");
	document [imgName].src = imgOff;
}

// Write bottom right table and states
var tableSet = '<table width="175" height="244" border="0" cellpadding="0" cellspacing="0" valign="top">';
var topCell  = '<tr><td valign="top"><img src="images/spacer.gif" width="176" height="30" border="0"></td></tr>';
var firstItm = "<tr><td valign=\"top\" height=\"24\"><a href=\"civil.html\" onMouseover = \"img_act('toc1')\"  onMouseout = \"img_inact('toc1')\"><img border=\"0\" name=\"toc1\" src=\"images/menu/civil_off.gif\" width=\"176\" height=\"24\" alt=\"Civil Ceremonies\"></a></td></tr>";
var seconItm = "<tr><td valign=\"top\"><a href=\"smreceptions.html\" onMouseover = \"img_act('toc2')\"  onMouseout = \"img_inact('toc2')\"><img border=\"0\" name=\"toc2\" src=\"images/menu/smaller_off.gif\" width=\"176\" height=\"24\" alt=\"Smaller Receptions\"></a></td></tr>";
var thirdItm = "<tr><td valign=\"top\"><a href=\"marquee.html\" onMouseover = \"img_act('toc3')\"  onMouseout = \"img_inact('toc3')\"><img border=\"0\" name=\"toc3\" src=\"images/menu/marquee_off.gif\" width=\"176\" height=\"24\" alt=\"Marquee Receptions\"></a></td></tr>";
var fourtItm = "<tr><td valign=\"top\"><a href=\"stone.html\" onMouseover = \"img_act('toc4')\"  onMouseout = \"img_inact('toc4')\"><img border=\"0\" name=\"toc4\" src=\"images/menu/stone_off.gif\" width=\"176\" height=\"24\" alt=\"Stone Barn\"></a></td></tr>";
var fifthItm = "<tr><td valign=\"top\"><a href=\"gallery.html\" onMouseover = \"img_act('toc5')\"  onMouseout = \"img_inact('toc5')\"><img border=\"0\" name=\"toc5\" src=\"images/menu/gallery_off.gif\" width=\"176\" height=\"24\" alt=\"Gallery\"></a></td></tr>";
var sixthItm = "<tr><td valign=\"top\"><a href=\"hints.html\" onMouseover = \"img_act('toc6')\"  onMouseout = \"img_inact('toc6')\"><img border=\"0\" name=\"toc6\" src=\"images/menu/hints_off.gif\" width=\"176\" height=\"24\" alt=\"Hints & History\"></a></td></tr>";
var sevenItm = "<tr><td valign=\"top\"><a href=\"calendar.html\" onMouseover = \"img_act('toc15')\"  onMouseout = \"img_inact('toc15')\"><img border=\"0\" name=\"toc15\" src=\"images/menu/availability_off.gif\" width=\"176\" height=\"24\" alt=\"Availability\"></a></td></tr>";
var eightItm = "<tr><td valign=\"top\"><a href=\"faq.html\" onMouseover = \"img_act('toc14')\"  onMouseout = \"img_inact('toc14')\"><img border=\"0\" name=\"toc14\" src=\"images/menu/questions_off.gif\" width=\"176\" height=\"24\" alt=\"Your Questions Answered\"></a></td></tr>";
var nineItm  = "<tr><td valign=\"top\"><a href=\"venuerates.html\" onMouseover = \"img_act('toc16')\"  onMouseout = \"img_inact('toc16')\"><img border=\"0\" name=\"toc16\" src=\"images/menu/venueRates_off.gif\" width=\"176\" height=\"24\" alt=\"Venue Rates\"></a></td></tr>";
var tableEnd = '<tr><td><img src="images/spacer.gif" width="176" height="23" border="0"></td></tr></table>';

// Construct bottom right menu
function placeMenu() {
	//document.write(tableSet + topCell + firstItm + seconItm + thirdItm + fourtItm + fifthItm + sixthItm + sevenItm + eightItm + nineItm + tableEnd);
	document.write(tableSet + topCell + firstItm + seconItm + thirdItm + fourtItm + fifthItm + sevenItm  + nineItm  + eightItm + sixthItm + tableEnd);
}

// Construct top bar menu
function topMenu() {
	document.write(tableTopSt + treeCell + homeItm + contactItm + fcItm + guestItm + linksItm + acknowItm + tableTopEn);
}

// Guestbook window opening
function launch(newURL, newName, newFeatures, orgName) {
  		  var guestbook = open(newURL, newName, newFeatures);
  		  if (guestbook.opener == null)
 		  guestbook.opener = window;
		  guestbook.opener.name = orgName;
		  return guestbook;
		}

		function launchGuestbook() {
 		 myInfo = launch("http://www.silverpearweddings.co.uk/spw_GB",
                    "ContentsGuestbook",
                    "height=640,width=770,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizeable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,z-lock=0","myWindow");
		}
		
// Write top bar menu
var tableTopSt  = '<table width="250" height="29" border="0" cellpadding="0" cellspacing="0">';
var treeCell    = '<tr><td width="38" height="29" valign="top"><img src="images/menu/tinyTree.gif" border="0"></td>';
var homeItm     = "<td valign=\"top\"><a href=\"main.html\" onMouseover = \"img_act('toc8')\"  onMouseout = \"img_inact('toc8')\"><img border=\"0\" name=\"toc8\" src=\"images/menu/home_off.gif\" alt=\"Home\"></a></td>";
var faqItm      = "<td valign=\"top\"><a href=\"faq.html\" onMouseover = \"img_act('toc13')\"  onMouseout = \"img_inact('toc13')\"><img border=\"0\" name=\"toc13\" src=\"images/menu/faq_off.gif\" alt=\"Frequently Asked Questions\"></a></td>";
var contactItm  = "<td valign=\"top\"><a href=\"contact.html\" onMouseover = \"img_act('toc9')\"  onMouseout = \"img_inact('toc9')\"><img border=\"0\" name=\"toc9\" src=\"images/menu/contact_off.gif\" alt=\"Contact\"></a></td>";
var linksItm    = "<td valign=\"top\"><a href=\"links.html\" onMouseover = \"img_act('toc10')\"  onMouseout = \"img_inact('toc10')\"><img border=\"0\" name=\"toc10\" src=\"images/menu/links_off.gif\" alt=\"Links\"></a></td>";
var guestItm    = "<td valign=\"top\"><a href=\"javascript:launchGuestbook();\" onMouseover = \"img_act('toc11')\"  onMouseout = \"img_inact('toc11')\"><img border=\"0\" name=\"toc11\" src=\"images/menu/guestbook_off.gif\" alt=\"Guestbook\"></a></td>";
var fcItm       = "<td valign=\"top\"><a href=\"http://www.friarscourt.com\" target=\"_blank\" onMouseover = \"img_act('toc12')\"  onMouseout = \"img_inact('toc12')\"><img border=\"0\" name=\"toc12\" src=\"images/menu/friarscourt_off.gif\" alt=\"Friars Court\"></a></td>";
var acknowItm   = "<td valign=\"top\"><a href=\"acknowledgements.html\" onMouseover = \"img_act('toc7')\"  onMouseout = \"img_inact('toc7')\"><img border=\"0\" name=\"toc7\" src=\"images/menu/acknow_off.gif\" alt=\"Acknowledgements\"></a></td>";
var tableTopEn  = '</tr></table>';

