// JavaScript Document
function opener(page1,page2){
	open(page1,"introFrame")
	open(page2,"mainFrame")
}

// JavaScript Document - names were changed from "introFrame" to "menuFrame"
// keep opener (original) to ensure no other calls to opener function
function opener2(page1,page2){
	open(page1,"menuFrame")
	open(page2,"Home_mainFrame")
}

function sendEmail(emailAddress){
	var aWindow = "mailto:" + emailAddress
	window.open(aWindow)
}

function imagePopup(imageurl,title,xWidth,xHeight) {
//unable to display title with spaces

   var url = imageurl
	var windowName = title
   var windowprops = "toolbar=0,location=0,directories=0,status=0, " +
   "menubar=0,scrollbars=0,resizable=0,width=" + xWidth + ",height=" + xHeight;

   openwindow = window.open(url,windowName,windowprops);
   openwindow.focus();
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// Creating a function which will open a QuickTime video file
// for playback
function openVideoWindow(videoName,imageDescription,xWidth,xHeight){
alert("#0")
	
	// window slightly larger than image
	var windowWidth = parseInt(xWidth) + 20
	var windowHeight = parseInt(xHeight) + 100
	
	// increase height if controller is enabled
//	alert("xHeight" + xHeight)
	var videoHeight = parseInt(xHeight) + 30
//	alert("videoHeight = " + videoHeight)
	
	var windowprops = "toolbar=0,location=0,directories=0,status=0, " +
	"menubar=0,scrollbars=0,resizable=0,width=" + windowWidth + ",height=" + windowHeight;

	var windowTitle = "<TITLE>" + "Ile Omode" + "</TITLE>"
	var videoTag = "<EMBED SRC='" + videoName + "'"
	
	var videoSize = "HEIGHT=" + videoHeight + " WIDTH=" + xWidth
	
	var description = "<font color='#333333' size='2' face='Arial, Helvetica, sans-serif'>" + imageDescription + "</font>"		
alert("#1")
	OpenWindow=window.open("", "newwin", windowprops);
	OpenWindow.document.write(windowTitle)
	OpenWindow.document.write("<BODY BGCOLOR=white>")
alert("#2")
	OpenWindow.document.write(videoTag)
	OpenWindow.document.write(videoSize)
	OpenWindow.document.write("TYPE='video/quicktime'")
	OpenWindow.document.write("PLUGINSPAGE='http://www.apple.com/quicktime/download/'") 
	OpenWindow.document.write("AUTOPLAY='true'")
	OpenWindow.document.write("LOOP='false'")
	OpenWindow.document.write("CONTROLLER='true'")
	OpenWindow.document.write("/>")	
alert("#3")	
	OpenWindow.document.write("<br>")
	OpenWindow.document.write(description)
	OpenWindow.document.write("<FORM><INPUT TYPE='BUTTON' VALUE='Close Window' onClick='window.close()'>")
	OpenWindow.document.write("</FORM>")
	OpenWindow.document.write("</BODY>")
	OpenWindow.document.write("</HTML>")
	
	OpenWindow.document.close()
	self.name="main"

}

function openImageWindow(imageName,imageDescription,xWidth,xHeight) {
	var imageTag = "<img src="	
	imageTag = imageTag + imageName + " width=" + xWidth + " height=" + xHeight + "align='center'>"
	
	// window slightly larger than image
	var windowWidth = parseInt(xWidth) + 20
	var windowHeight = parseInt(xHeight) + 100
	
	var windowprops = "toolbar=0,location=0,directories=0,status=0, " +
	"menubar=0,scrollbars=0,resizable=0,width=" + windowWidth + ",height=" + windowHeight;

	var windowTitle = "<TITLE>" + "Ile Omode" + "</TITLE>"

	var description = "<font color='#333333' size='2' face='Arial, Helvetica, sans-serif'>" + imageDescription + "</font>"		

	OpenWindow=window.open("", "newwin", windowprops);
	OpenWindow.document.write(windowTitle)
	OpenWindow.document.write("<BODY BGCOLOR=white>")
	OpenWindow.document.write(imageTag)
	OpenWindow.document.write("<br>")
	OpenWindow.document.write(description)
	OpenWindow.document.write("<FORM><INPUT TYPE='BUTTON' VALUE='Close Window' onClick='window.close()'>")
	OpenWindow.document.write("</FORM>")
	OpenWindow.document.write("</BODY>")
	OpenWindow.document.write("</HTML>")
	
	OpenWindow.document.close()
	self.name="main"
}
//First simple showing gallery
function showGallery(thePage){
	window.open(thePage,"","width=550, height=310");
} 

//Creating gallery function to avoid having to create individual files for each gallery
function openGalaryWindow(imageNameDirectory,galleryTitle,galleryDescription,numImages,windowWidth,windowHeight) {
//	alert("HERE 1")
	var windowprops = "toolbar=0,location=0,directories=0,status=0, " +
	"menubar=1,scrollbars=0,resizable=0,width=" + windowWidth + ",height=" + windowHeight;

	var windowTitle = "<TITLE>" + "Ile Omode Events Gallery" + "</TITLE>"

	var scriptInclude = "<SCRIPT LANGUAGE='JavaScript' SRC='../code/imageGallery.js'></SCRIPT>"

//	alert("HERE 2")
	var bodyTag = "<BODY BGCOLOR='#FFFFFF' text='#000000' " 
	bodyTag = bodyTag + "onLoad='InitializeGallery(" + numImages + "," + "\"" 
	bodyTag = bodyTag + imageNameDirectory + "\")'>"

	var imagePath = imageNameDirectory + "image0.jpg"
//	alert("HERE 3")
	
	OpenWindow=window.open("", "newwin", windowprops);
	
	//Open document for more writing
//	OpenWindow.document.open()
	//HEADER
	OpenWindow.document.write("<HTML>")
	OpenWindow.document.write("<HEAD>")
	OpenWindow.document.write(windowTitle)
	OpenWindow.document.write(scriptInclude)
	OpenWindow.document.write("</HEAD>")
//	alert("HERE 4")
	
	//BODY	
	OpenWindow.document.write(bodyTag)
//OpenWindow.document.write("<BODY>")

	//TABLE IN BODY
	OpenWindow.document.write("<table border='0'><tr><td width='203'><table width='98%' border='0'>")
	OpenWindow.document.write("<tr><td><div align='center'><img src='../images/logo/Logo_small.jpg' width='60' height='73' border='0'></div></td>")
	OpenWindow.document.write("</tr><tr><td>")

	//TITLE OF ENTRY
	OpenWindow.document.write("<div align='center'><font size='2' face='Verdana, Arial, Helvetica, sans-serif'><strong>")
	OpenWindow.document.write(galleryTitle)
	OpenWindow.document.write("</strong></font></div></td>")
	OpenWindow.document.write("</tr><tr><td valign='top'>")
//	alert("HERE 5")

	//GALLERY DESCRIPTION
	OpenWindow.document.write("<div align='left'><font size='2' face='Verdana, Arial, Helvetica, sans-serif'>")
	OpenWindow.document.write(galleryDescription)
	OpenWindow.document.write("</font></div></td></tr></table></td><td>")
	//Assumes first image is image0, and size is 320x240
	OpenWindow.document.write("<p><img src=")
	OpenWindow.document.write(imagePath)
	OpenWindow.document.write(" NAME='photo' width='320' height='240' border='1'></p>")
    OpenWindow.document.write("</td></tr><tr><td >&nbsp;</td><td>")
	OpenWindow.document.write("<input type='button' name='btPrevious' value='Previous' onClick='DoPrevious()'>")
	OpenWindow.document.write("<input type='button' name='btNext' value='Next' onClick='DoNext()'></td></tr></table>")

	// CLOSING TAGS
	OpenWindow.document.write("</BODY>")
	OpenWindow.document.write("</HTML>")
//	alert("HERE 6")
	
	OpenWindow.document.close()
//	self.name="galleryMain"
// 	alert("HERE 7")
}
