// Brad: This file HAS BEEN updated with all your edits


///////////////////////////// CONTACT DATA-BASE /////////////////////////////

DB = new Array(); DB.Contact = new Array(); DB.Pkg = new Array();

DB.Contact.Company = "Hawaii Video Memories";
DB.Contact.Street = "230 Hana Hwy #11";
DB.Contact.CityStZip = "Kahului HI 96732";
DB.Contact.City = "Kahului";
DB.Contact.St = "HI";
DB.Contact.Zip = "96732";
DB.Contact.TelTollFree = "888.255.7080 Toll Free";
DB.Contact.TelDirect = "808.871.5788 Tel";
DB.Contact.Tel = "808.871.5788";
DB.Contact.Fax = "808.871.8366 Fax";
DB.Contact.Email = "info@HawaiiVideoMemories.com";
DB.Contact.EmailCommence = "commence@HawaiiVideoMemories.com";
DB.Contact.Bullet = "&nbsp;&nbsp;&#149;&nbsp;&nbsp;";
DB.Contact.BusHours = "Monday to Friday; 8:00 - 4:00";
DB.Contact.WebMaster = "david" + "@" + "DavidRegier." + "com";
DB.Contact.SendErrTo = "Info" + "@" + "HawaiiVideoMemories.com";

///////////////////////////// PRICING /////////////////////////////

DB.Pkg.AKAMAI_TIME = 2;
DB.Pkg.AKAMAI_PRICE = 1000;

DB.Pkg.ALII_TIME = 3;
DB.Pkg.ALII_PRICE = 1500;

DB.Pkg.NO_KA_OI_TIME = 4;
DB.Pkg.NO_KA_OI_PRICE = 2000;

DB.Pkg.OHANA_TIME = 5;
DB.Pkg.OHANA_PRICE = 2500;

DB.Pkg.ME_KE_ALOHA_TIME = 6;
DB.Pkg.ME_KE_ALOHA_PRICE = 3000;

DB.Pkg.KAPIOLANI_TIME = 6;
DB.Pkg.KAPIOLANI_PRICE = 6000;

DB.Pkg.ADDITIONAL_PRICE = "$500";

DB.Pkg.KAMEHAMEHA_TIME = 8;
DB.Pkg.KAMEHAMEHA_PRICE = 8000;

DB.Pkg.HOILINA_TIME = 8;
DB.Pkg.HOILINA_PRICE = 10000;

DB.Pkg.DIRECTORS_CUT_TIME = 2;
DB.Pkg.DIRECTORS_CUT_PRICE = 900;

DB.Pkg.PRESENTATION_ULTIMATE_PRICE = 1400;
DB.Pkg.PRESENTATION_DELUXE_PRICE = 1150;
DB.Pkg.PRESENTATION_BASIC_PRICE = 850;

DB.Pkg.DVD_PRICE = 200;

DB.Pkg.ADD_DVD = 50;
DB.Pkg.UNEDITED_FOOTAGE = 200;
DB.Pkg.SUPER_8_FILM = 150;

DB.Pkg.WEB_CAST = 400;

///////////////////////////// HVM SOFTWARE /////////////////////////////

cookiesOn = navigator.cookieEnabled;

IE = false, AOL = false, SF = false, MZ = false;

if( navigator.appName == "Microsoft Internet Explorer" ) {
	IE = true;
	if( navigator.userAgent.indexOf( "AOL" ) >= 0 ) AOL = true;
}
else if( navigator.userAgent.indexOf( "Safari" ) >= 0 )
	SF = true;
else if( navigator.appName == "Netscape" )
	MZ = true;

winOS = ( navigator.platform.substring( 0, 3 ) == "Win" );
winIE = ( winOS && IE );
macOS = ( navigator.platform.substring( 0, 3 ) == "Mac" );
macIE = ( macOS && IE );
//macIE = true;

var theHost = document.location.hostname;

local = ( /^\d+\.\d+\.\d+\.\d+$/.test( theHost ) || theHost == "" || theHost == "localhost" );
// if( theHost = "74.208.97.125" ) local = false; // Activate if remote site is available via an IP address
live = !local;

var framed = false;
try { if( top != self ) framed = true; } catch( e ) { framed = true; }

cookieDomain = null;
if( live && theHost ) {
	var Host = theHost.split( "." ), hLen = Host.length;
	if( hLen >= 2 )
		cookieDomain = "." + Host[ hLen - 2 ] + "." + Host[ hLen - 1 ];
}

if( winIE ) {
	document.writeln( "<script language=VBScript>" );
	document.writeln( "Function getPlugInWinIE(ClassID)" );
	document.writeln( "	on error resume next" );
	document.writeln( "	result = false" );
	document.writeln( "	result = IsObject(CreateObject(ClassID))" );
	document.writeln( "	getPlugInWinIE = result" );
	document.writeln( "End Function" );
	document.writeln( "<\/script>");
}

function getPlugIn( nameWinIE, nameOthers ) {
	var result = "undetectable";
	if( winIE ) {
		try { result = getPlugInWinIE( nameWinIE ) }
		catch( e ) {}
	}
	else if( navigator.plugins && navigator.plugins.length > 0 ) {
		result = false;
		try { result = ( navigator.mimeTypes[nameOthers].enabledPlugin != null ) }
		catch( e ) {}
	}
	return result;
}

///////////////////////////// START IMAGE LIBRARY FUNCTIONS /////////////////////////////

// ACCESSOR VARS: winIE, MZ, SF, local

//----------------------------------------------
function randompick() {
  return randompick.arguments[ Math.floor( Math.random()*randompick.arguments.length ) ];
}

function getTransition( transNum, duration ) {

	var trans = "";
	if( winIE ) {
		var d = duration;
		if( parseFloat( navigator.userAgent.split( "MSIE" )[ 1 ] ) >= 5.5 ) { //IE 5.5+

			var thisTrans = ( transNum == 1 ) ? Math.floor( Math.random() * 17 ) + 2 : transNum;

			switch ( thisTrans ) {
				case 2: trans="Fade(duration="+d+",overlap=1)"; break;
				case 3: trans="Blinds(duration="+d+",bands="+randompick(2,4,6,8)+",direction="+randompick('up','down','right','left')+")"; break;
				case 4: trans="CheckerBoard(duration="+d+",squaresX="+randompick(2,4,8,12)+",squaresY="+randompick(2,4,8,12)+",direction="+randompick('up','down','right','left')+")"; break;
				case 5: trans="Barn(duration="+d+",motion="+randompick('in','out')+",orientation=",randompick('horizontal','vertical')+")"; break;
				case 6: trans="GradientWipe(duration="+d+",gradientSize="+randompick(0,0.1,0.3,0.5,0.7,0.9,1)+",wipeStyle="+randompick(0,1)+",motion="+randompick('forward','reverse')+")"; break;
				case 7: trans="Inset(duration="+d+")"; break;
				case 8: trans="Iris(duration="+d+",irisStyle="+randompick('DIAMOND','CIRCLE','CROSS','PLUS','SQUARE','STAR')+",motion="+randompick('in','out')+")"; break;
				case 9: trans="RadialWipe(duration="+d+",wipeStyle="+randompick('CLOCK','WEDGE','RADIAL')+")"; break;
				case 10: trans="RandomBars(duration="+d+",orientation="+randompick('horizontal','vertical')+")"; break;
				case 11: trans="RandomBars(duration="+d+")"; break;
				case 12: trans="Slide(duration="+d+",pushStyle="+randompick('HIDE','PUSH','SWAP')+",bands="+randompick(1,2,3,4,5,6,7)+")"; break;
				case 13: trans="Spiral(duration="+d+",gridSizeX="+randompick(8,16,32,64)+",gridSizeY="+randompick(8,16,32,64)+")"; break;
				case 14: trans="Stretch(duration="+d+",stretchStyle="+randompick('HIDE','PUSH','SPIN')+")"; break;
				case 15: trans="Strips(duration="+d+",motion="+randompick('leftdown','leftup','rightdown','rightup')+")"; break;
				case 16: trans="Wheel(duration="+d+",spokes="+randompick(2,4,10,16,20)+")"; break;
				case 17: trans="Zigzag(duration="+d+",gridSizeX="+randompick(8,16,32,64)+",gridSizeY="+randompick(8,16,32,64)+")"; break;
				case 18: trans="RandomDissolve(duration="+d+")"; break;
        //case 19: trans="Pixelate(duration="+d+",maxSquare="+randompick(5,10,20,30,40,50)+")"; break;
				default: alert( "SWITCH/CASE ERROR: Case caught by default handler in \"getTransition\"" );
			}
			trans = "progid:DXImageTransform.Microsoft." + trans;
		}
		else { // Old IE 5 Browsers

			switch ( transNum ) {
				case 2: trans="blendTrans(duration="+d+")"; break;
				default: trans="revealTrans(duration="+d+",transition=" + Math.floor(Math.random()*23) + ")";
			}
		}
	}
	return trans;
}
//----------------------------------------------
function getRGB( abbrev ) {
	var rgb = abbrev;
	switch( abbrev ) {
		case "b": rgb = "0,0,0"; break;
		case "w": rgb = "255,255,255"; break;
	}
	return rgb;
}
//----------------------------------------------
function getOpacity( dissolveSF, dissolveMZ ) {
	var opac = "";
	if ( winIE ) opac = "visibility:hidden;";
	else if( MZ && dissolveMZ ) opac = "-moz-opacity:0;"
	else if ( SF && dissolveSF ) opac = "opacity:0;"
	return opac;
}
//----------------------------------------------
function startFade( FadeInPhoto, transNum, transDur, transDelay, dissolveSF, dissolveMZ ) {
	window.FadeInPhoto = FadeInPhoto;
	window.transNum = transNum;
	window.transDur = transDur;
	window.transDelay = transDelay;
	if( winIE ) setTimeout( "fadeInDirectX()", transDelay );
	else if( ( MZ && dissolveMZ ) || ( SF && dissolveSF ) ) {
		FadeInPhoto.onload = function() { /*cancel photo onload function*/ };
		( transDelay ) ? setTimeout( "fadeIn( FadeInPhoto )", transDelay ) : fadeIn( FadeInPhoto );
	}
	else {
		if( SF ) FadeInPhoto.style.opacity = 1.0;
		else FadeInPhoto.style.visibility = "visible";
	}
}
//----------------------------------------------
// call from startFade only, never call directly
function fadeInDirectX() {
	try {
		FadeInPhoto.style.filter = getTransition( transNum, transDur );
		FadeInPhoto.filters(0).apply();
		FadeInPhoto.style.visibility = "visible";
		FadeInPhoto.filters(0).play();
	}
	catch( Err ) {
		if( local ) {
			var eMsg = "Exception Caught in fadeInDirectX function:\n\n";
			for( var i in Err ) eMsg += i + ": " + Err[ i ] + "\n";
			alert( eMsg );
		}
		FadeInPhoto.style.visibility = "visible";
	}
}
//----------------------------------------------
// SF & MZ: Uses recursion

FadeInPhoto = null, fadeOpacity = 0, fadeOpacityTimer = 0;
function fadeIn( FadeInPhoto ) {

	if( MZ ) FadeInPhoto.style.MozOpacity = fadeOpacity;
	else FadeInPhoto.style.opacity = fadeOpacity;

	this.fadeOpacity += .05;
	if( fadeOpacity < 1 ) {
		window.FadeInPhoto = FadeInPhoto;
		fadeOpacityTimer = setTimeout( "fadeIn( FadeInPhoto )", 40 );
	}
	else {
		if( MZ ) FadeInPhoto.style.MozOpacity = 0.9999; // 1.0 causes flicker
		else FadeInPhoto.style.opacity = 0.9999;
		clearTimeout( fadeOpacityTimer );
		FadeInPhoto = null;
		fadeOpacity = 0;
		fadeOpacityTimer = 0;
	}
}

//----------------------------------------------
function dissolveDirectX( OldPhoto, newPhotoSrc, borderWid, borderCol, transNum, transDur ) {

	try {
		OldPhoto.style.filter = getTransition( transNum, transDur );
		OldPhoto.filters(0).apply();
		OldPhoto.src = newPhotoSrc;
		if( borderWid ) OldPhoto.style.borderColor = "rgb( " + getRGB( borderCol ) + " )";
		OldPhoto.filters(0).play();
	}
	catch( Err ) {
		if( local ) {
			var eMsg = "Exception Caught in dissolveDirectX function:\n\n";
			for( var i in Err ) eMsg += i + ": " + Err[ i ] + "\n";
			alert( eMsg );
		}
		OldPhoto.src = newPhotoSrc;
		if( borderWid ) OldPhoto.style.borderColor = "rgb( " + getRGB( borderCol ) + " )";
	}
}

/////////////////////////////// END IMAGE LIBRARY FUNCTIONS ///////////////////////////////

//----------------------------------- String Prototype -----------------------------------
// If key is found in strToSearch then returns its value, otherwise returns null
function getVal( key, eqDelim, fieldDelim ) {

	if( !eqDelim ) eqDelim = "=";
	if( !fieldDelim ) fieldDelim = "&";

	var value = null;
	var strToSearch = this.toString();

	var KeyVals = strToSearch.split( fieldDelim );

	for( member in KeyVals ) {
		var ThisPair = KeyVals[ member ].split( eqDelim );
		if( key == ThisPair[ 0 ] ) { value = ThisPair[ 1 ]; break; }
	}
	if( typeof value == "undefined" ) value = "";
	return value;
}
String.prototype.getVal = getVal;

//----------------------------------- String Prototype -----------------------------------

function replaceLiteral( target, replacement ) {
	var tilda = ( target == "~" ) ? "" : "~";
	var str = tilda + this.toString() + tilda;
	str = str.split( target ).join( replacement );
	return str.substring( tilda.length, str.length - tilda.length );
}
String.prototype.replaceLiteral = replaceLiteral;

//----------------------------------- STRING PROTOTYPE -----------------------------------

function removeWhiteSpace() { return this.split( " " ).join( "" ); }
String.prototype.removeWhiteSpace = removeWhiteSpace;

//----------------------------------- STRING PROTOTYPE -----------------------------------

function trim( trimStr, lTrim, rTrim ) {

	trimStr = ( trimStr ) ? trimStr : " ";
	lTrim = ( typeof lTrim == "undefined" ) ? 1 : lTrim;
	rTrim = ( typeof rTrim == "undefined" ) ? 1 : rTrim;

	var txt = this.toString();
	var trimStrLen = trimStr.length;

	while( lTrim && txt.substring( 0, trimStrLen ) == trimStr ) {
		txt = txt.substring( trimStrLen );
	}
	while( rTrim && txt.substring( txt.length - trimStrLen, txt.length ) == trimStr ) {
		txt = txt.substring( 0, txt.length - trimStrLen);
	}

	return txt;
}
String.prototype.trim = trim;

//----------------------------------- STRING PROTOTYPE -----------------------------------

function formatCsvData() {
	var csvData = this.trim();
	csvData = csvData.replaceLiteral( '","', '", "' );
	csvData = csvData.replaceLiteral( "!^!", "" );
	return csvData;
}
String.prototype.formatCsvData = formatCsvData;

//---------------------------------------------------------------------------------------
	var dText = new Array(
"&nbsp;", // 0
"Goes back to our Home Page...", // 1
"We&rsquo;ve been setting the standard in Event Video Production since 1990", // 2
"Meet our friendly staff. We have the sensitivity & experience you deserve", // 3
"We are wedding specialist. Fill out our guest book for pricing information...", // 4
"Production &#149; Film to Video &#149; Duplication/Packaging &#149; and more!", // 5
"Get Wedding Package Pricing & check out our Spectacular Video Presentations", // 6
"Send a Wedding Inquiry Now & request a Free Sample Video", // 7
"Wedding date in mm/dd/yy format; Press up-arrow key (on keyboard) to increase/down-arrow decreases. Hold Ctrl to jump in weeks", // 8
"Check our calendar for availability & submit a request for our services!", // 9
"", // 10
"Send us e-mail; remember to provide groom&rsquo;s last name & wedding date for our reference", // 11
"Returning Visitors: Enter your password (if any) for a more personalized experience", // 12
"Opening connection to Data-Base - please wait...", // 13
"", // 14 Save as empty string, used for invalid password reporting
"Clears ALL form values that you have entered",
DB.Contact.Street + DB.Contact.Bullet + DB.Contact.CityStZip + DB.Contact.Bullet + DB.Contact.TelDirect + DB.Contact.Bullet + DB.Contact.Fax + DB.Contact.Bullet + DB.Contact.TelTollFree,
"View street map of our office location & get driving directions",
"Click to enlarge",
"Experience our work - view our portfolio of recent weddings",
"Download Windows Media Player from Microsoft",
"Aloha, our video is bandwidth intensive & requires Windows Media Player.\n\n==> Click OK to view it only if you have a high speed internet connection.",
"Check our data-base for the status of your past client&rsquo;s video",
"Check booking calendar and/or status on past client&rsquo;s video",
"Find your private wedding homepage OR order DVDs of an event (Graduation, May Day, etc.)",
"Go to your private wedding homepage",
"Order DVDs of an event like Graduation, May Day, etc.",
"Place Holder"
	);
//----------------------------------------------------------------------------------------
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
//----------------------------------------------------------------------------------------
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}
//----------------------------------------------------------------------------------------
function SetCookie (name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}
//----------------------------------------------------------------------------------------
function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}
//----------------------------------------------------------------------------------------
//Global function read everytime page loads
var expdate = new Date ();
var expdate1 = new Date ();
expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 365 * 1000)); // 1 year from now
expdate1.setTime (expdate1.getTime() + (24 * 60 * 60 * 30 * 1000)); // 30 days from now
//--------------------------------------------------------------------------------------

var hvmCook = GetCookie( "hvmCook" );
if( hvmCook != null ) {
	var firstName = hvmCook.getVal( "BG_First_Names" );
	if( firstName && firstName != "" )
		dText[ 0 ] = "Aloha " + firstName + "! Greetings from the friendly staff at Hawaii Video Memories...";
}

// Record referring page as cookie
if( !GetCookie( "hvmReferrer" ) ) {
	var qStr = getQueryStr();
	var refPageQstr = ( qStr && qStr.indexOf( "ref=" ) == 0 ) ? qStr.split( "ref=" )[ 1 ] : "";
	var docRef = document.referrer;

	if( refPageQstr ) SetCookie( "hvmReferrer", refPageQstr, null, "/" );
	else if( docRef ) {
		var externalReferrer = ( docRef.indexOf( theHost ) == -1 );
		if( externalReferrer ) SetCookie( "hvmReferrer", document.referrer, null, "/" );
	}
}
function showReferrer() {
	self.status = "Framed: " + framed + "; " + GetCookie( "hvmReferrer" );
}
//----------------------------------------------------------------------------------------
function getCleanText( input ) {
	var output = input.replaceLiteral( '^', "\"" );
	return output;
}
//--------------------------------------------------------------------------------------
function getQueryStr() {
	var qStr = unescape( document.location.search ).substring( 1 );
	return ( qStr ) ? qStr : null;
}

//--------------------------------- OBJECT CONSTRUCTOR ---------------------------------

function DynamicMsg() {

	this.timer = 0;
	this.Callout = null;

	this.msgOn = msgOn;
	this.msgOff = msgOff;
	//-------------------------------------- METHOD --------------------------------------

	function msgOn( index ) {
		clearTimeout( this.timer );
		var Callout = document.getElementById( "callout" );
		try{ Callout.innerHTML = ( index == 16 ) ? dText[ index ] : "<SPAN CLASS='fSize11'>" + dText[ index ] + "</SPAN>"; }
		catch( e ) {}
	}
	//-------------------------------------- METHOD --------------------------------------

	function msgOff() {
		this.Callout = document.getElementById( "callout" );
		this.timer = setTimeout( "try{ DynMsg.Callout.innerHTML = dText[ 16 ] } catch( e ) {}", 500 );
	}
}
var DynMsg = new DynamicMsg();

//---------------------------------------------------------------------------------------
// Allows access level to be set from query string at homepage ie: index.html?access=full

function setAccessFromQstr() {

	var qStr = getQueryStr();
	if( qStr ) {

		// Check query str; returns null string value if none
		var strToCheck = getQueryStr().toLowerCase();

		if( strToCheck.indexOf( 'access=reset' ) == 0 ) {
			DeleteCookie( 'hvmCook', '/' );
			DeleteCookie( 'hvmDisableLog', '/' );
			hvmCook = null;
		}

		else if( strToCheck.indexOf( 'access=' ) == 0 ) {

			strToCheck = strToCheck.replaceLiteral( 'ccess=', 'ccess=' );
			var accessVal = strToCheck.getVal( "access" );

			if( !cookiesOn ) alert( "Sorry, you must enable cookies to gain access to our site using the 'access=???' feature..." );
			recordData( 'access', accessVal );
			hvmCook = GetCookie( 'hvmCook' );
		}
	}

}
//---------------------------------------------------------------------------------------
function refreshCookie() {
	if( hvmCook )	SetCookie( "hvmCook", hvmCook, expdate, "/", cookieDomain );
}

//---------------------------------------------------------------------------------------
// Checks query string first, if no access level is set it then checks cookie

function getAccessLevel() {

	var accessVal = "";

	var qStr = getQueryStr();
	// Check query string but only if user not just submitted inquiry or qStr is not carrying referrer info
	if( qStr && qStr != "inquire.html" && qStr != "showWedding" && qStr.indexOf ( "ref=" ) != 0 && qStr.indexOf ( "wedDate=" ) != 0 && qStr.indexOf ( "id=" ) != 0 && qStr.indexOf( "form=" ) != 0 ) {

		var strToCheck = getQueryStr().toLowerCase();

		// Query string exists, so change = sign to »
		//if( strToCheck.indexOf( "access=" ) == 0 )
			//strToCheck = strToCheck.replaceLiteral( "=", "»" );
	}

	// No query str so check for cookie
	else strToCheck = GetCookie( "hvmCook" );

	if( strToCheck && strToCheck.indexOf( "access=" ) != -1 )
		accessVal = strToCheck.getVal( "access" );

	return accessVal;

}

var access = getAccessLevel();

//---------------------------------------------------------------------------------------
// Called by individual "hidden" pages and auto sets access level

function setAccess( newLevel ) {
	//document.title = access + "; " + newLevel
	if( newLevel == 'xp' ) { // xp = prices
		if( access != 'client' && access != 'full' ) {
			recordData( 'access', 'prices' );
			access = 'prices';
		}
	}
	else if( newLevel == 'xc' ) { // xc = client
		if( access != 'full' ) {
			recordData( 'access', 'client' );
			access = 'client';
		}
	}
	else if( newLevel == 'full' ) {
		if( access != 'full' ) {
			recordData( 'access', 'full' );
			access = 'full';
		}
	}
}
//////////////////////////// START OPEN BROWSER WIN: PopUp ////////////////////////////

//--------------------------------- OBJECT CONSTRUCTOR ---------------------------------

/*
ACCESSOR VAR: None
ACCESSOR FUN: None
*/

function PopUp() {

	this.winName = "hvmWin";

	// Do not edit past this line -------------------------
	this.Win = null;
	this.openWin = openWin;
	this.closeWin = closeWin;
	this.linkToWin = linkToWin;

	//------------------------------------ METHOD: PopUp ------------------------------------

	function openWin( theSite, tool, loc, stBar, menu, winWid, winHgt, scBars, resizable, winPos ) {

		if( arguments.length == 10 ) {

			this.closeWin();

			var avWid = screen.availWidth - 10;
			var avHgt = screen.availHeight - 30;

			if( winWid < 1 ) winWid = winWid * avWid;
			if( winHgt < 1 ) winHgt = winHgt * avHgt;

			if( winWid > avWid * 0.90 || winWid == 1 ) winWid = avWid * 0.90;
			if( winHgt > avHgt * 0.70 || winHgt == 1 ) winHgt = avHgt * 0.70;

			var leftPos = 0;
			var topPos = 0;

			switch( winPos ) {
				case 1:
					leftPos = parseInt( ( avWid - winWid ) / 2 );
					break;

				case 2:
					leftPos = parseInt( ( avWid - winWid ) / 2 );
					topPos =  parseInt( ( avHgt - winHgt ) / 2 );
					break;
			}


			this.Win = window.open(theSite,PopUp.winName,"toolbar="+tool+",location="+loc+",directories=0,status="+stBar+",menubar="+menu+",scrollbars="+scBars+",resizable="+resizable+",width="+winWid+",height="+winHgt+",top="+topPos+",left="+leftPos);
		}

		else
			alert( "ERROR: " + arguments.length + " arguments have been passed to method \"PopUp.openWin\", it accepts exactly 10 arguments." );

	}

	//------------------------------------ METHOD: PopUp ------------------------------------

	function closeWin() {
		try {
			if( this.Win && this.Win.open && !this.Win.closed ) {
				this.Win.close();
				this.Win = null;
			}
		}
		catch( e ) {}
	}
	//------------------------------------ METHOD: PopUp ------------------------------------

	function linkToWin() {
		if( PopUp && PopUp.Win && PopUp.Win.registered ) PopUp.Win.myOpener = self;
		else setTimeout( "PopUp.linkToWin()", 250 );
	}
}

PopUp = new PopUp();

////////////////////////////// END OPEN BROWSER WIN: PopUp /////////////////////////////

function getEmailLink() {

	var theLink = '';

	return ( access == "client" || access == "full" ) ?
		"<DIV CLASS='medLight'>E-Mail: <A HREF='javascript:email()' onMouseover='if( cb ) { actLink(this); activateMsg( 11 ); return true; }' onMouseout='if( cb ) { deactLink(this); deActivateMsg(); return true; }'>" + hvm.Email + "</A></DIV>" : "";

	return theLink;
}

//--------------------------------------------------------------------------------------

function linkOn( TheLink ) { TheLink.style.textDecoration = "underline"; return true; }
function linkOff( TheLink ) { TheLink.style.textDecoration = "none"; return true; }
//--------------------------------------------------------------------------------------

function getLinks( page ) {

	var pth = ( document.location.protocol == "https:" ) ? "http://www.hawaiivideomemories.com/" : "";

	var theLinks = "<NOBR><SPAN CLASS='hBarBot'>";

	theLinks += ( page == "profile.html" ) ? "<span class='fSize12'>About Us</span> | " : "<A HREF='" + pth + "profile.html' onMouseOver='if( window.DM ) DM.killOthers( this ); if( window.DynMsg ) DynMsg.msgOn( 2 ); return true;' onMouseOut='if( window.DynMsg ) DynMsg.msgOff(); return true;' class='linkBot'>About Us</A> | ";

	theLinks += ( page == "personnel.html" ) ? "<span class='fSize12'>Staff</span> | " : "<A HREF='" + pth + "personnel.html' onMouseOver='if( window.DM ) DM.killOthers( this ); if( window.DynMsg ) DynMsg.msgOn( 3 ); return true;' onMouseOut='if( window.DynMsg ) DynMsg.msgOff(); return true;' class='linkBot'>Staff</A> | ";

	theLinks += ( page == "packages.html" ) ? "<span class='fSize12'>Packages</span> | " : "<A HREF='" + pth + "packages.html' onMouseOver='if( window.DM ) DM.killOthers( this ); if( window.DynMsg ) DynMsg.msgOn( 4 ); return true;' onMouseOut='if( window.DynMsg ) DynMsg.msgOff(); return true;' class='linkBot'>Packages</A> | ";

	if( access == "prices" || access == "client" || access == "full" ) {
		theLinks += ( page == "prices.html" ) ?
			"<span class='fSize12'>Pricing</span> | " : "<A HREF='" + pth + "prices.html' onMouseOver='if( window.DM ) DM.killOthers( this ); if( window.DynMsg ) DynMsg.msgOn( 6 ); return true;' onMouseOut='if( window.DynMsg ) DynMsg.msgOff(); return true;' class='linkBot'>Pricing</A> | ";
	}

	theLinks += ( page == "video.html" ) ? "<span class='fSize12'>Movies</span> | " :  "<A HREF='" + pth + "video.html' onMouseOver='if( window.DM ) DM.killOthers( this ); if( window.DynMsg ) DynMsg.msgOn( 19 ); return true;' onMouseOut='if( window.DynMsg ) DynMsg.msgOff(); return true;' class='linkBot'>Movies</A> | ";


	if( access == "prices" || access == "client" || access == "full" ) {
		theLinks += ( page == "inquire.html" ) ?
		"<span class='fSize12'>Inquire</span> | " : "<A HREF='" + pth + "inquire.html' onMouseOver='if( window.DM ) DM.killOthers( this ); if( window.DynMsg ) DynMsg.msgOn( 7 ); return true;' onMouseOut='if( window.DynMsg ) DynMsg.msgOff(); return true;' class='linkBot'>Inquire</A> | ";
	}

	if( access == "full" ) {
		theLinks += "<A HREF='" + pth + "partners.html' onMouseOver='if( window.DM ) DM.start( this, event, \"coord\", \"above\" ); self.status=dText[23]; return true;' onMouseOut='if( window.DM ) DM.hide(); self.status=\"\"; return true;' class='linkBot'>Partners</A> | ";
	}

	theLinks += "<A HREF='javascript:PopUp.openWin(\"http://maps.google.com/maps?q=230+Hana+Highway,+Kahului+HI+96732&spn=0.028910,0.029313&hl=en\", 1, 1, 1, 1, .8, .6, 1, 1, 1 );' onMouseOver='if( window.DM ) DM.killOthers( this ); if( window.DynMsg ) DynMsg.msgOn( 17 ); return true;' onMouseOut='if( window.DynMsg ) DynMsg.msgOff(); return true;' class='linkBot'>Map</A> | ";

	theLinks += "<A HREF='find.html?showWedding' onMouseOver='if( window.DM ) DM.killOthers( this ); if( window.DynMsg ) DynMsg.msgOn( 25 ); return true;' onMouseOut='if( window.DynMsg ) DynMsg.msgOff(); return true;' class='linkBot'>Log-In</A> | ";

	if( access == "client" || access == "full" ) {
		theLinks += "<A HREF='javascript:sendMail()' onMouseOver='if( window.DM ) DM.killOthers( this ); if( window.DynMsg ) DynMsg.msgOn( 11 ); return true;' onMouseOut='if( window.DynMsg ) DynMsg.msgOff(); return true;' class='linkBot'>Email</A> | ";
	}

	theLinks += "<A HREF='" + ( ( live ) ? "https://www.hawaiivideomemories.com/event.aspx" : "event.aspx" ) + "' onMouseOver='if( window.DM ) DM.killOthers( this ); if( window.DynMsg ) DynMsg.msgOn( 26 ); return true;' onMouseOut='if( window.DynMsg ) DynMsg.msgOff(); return true;' class='linkBot'>Order</A> | ";

	theLinks += "<A HREF='event.aspx' onMouseOver='if( window.DM ) DM.killOthers( this ); if( window.DynMsg ) DynMsg.msgOn( 26 ); return true;' onMouseOut='if( window.DynMsg ) DynMsg.msgOff(); return true;' class='linkBot'>Order</A> | ";

	theLinks += ( page == "index.html" ) ? "<span class='fSize12'>Home</span> | " : "<A HREF='" + pth + "index.html' onMouseOver='if( window.DM ) DM.killOthers( this ); if( window.DynMsg ) DynMsg.msgOn( 1 ); return true;' onMouseOut='if( window.DynMsg ) DynMsg.msgOff(); return true;' class='linkBot'>Home</A> | ";

//alert( theLinks );
	theLinks = theLinks.substring( 0, theLinks.length - 2 ) + "</SPAN></NOBR>";

	return theLinks;
}
//---------------------------------------------------------------------------------------
var nLogAttempts = 0;

function logIn() {

	if( cookiesOn ) {

		var pw = prompt( "Password provided by Hawaii Video Memories:", "" );

		if( pw == null || pw == '' ) return;

		else {
			if( pw == 'reset' || pw == 'none' || pw == 'prices' || pw == 'client' || pw == 'full' )
				document.location.href = 'index.html?access=' + pw;
			else {
				dText[ 14 ] = "<SPAN CLASS='red'>\"" + pw + "\"" +  "is not a valid password...</SPAN>";
				DynMsg.msgOn( 14 );
				nLogAttempts++;
				if( nLogAttempts == 3 ) {
					toggleSection( 'logIn' );
					SetCookie( 'hvmDisableLog', 'true', null, '/' ); // Session cookie
				}
			}
		}
	}
	else alert( 'Sorry, you must enable cookies to use this feature...' );
}

//--------------------------------------------------------------------------------------

function sendMail() {

	var subject = prompt( "For our reference, the Groom's Last Name and Wedding Date is:\nAnswer in this format please: Smith 12-2-06", "" );

	if( subject ) {
		subject = escape( subject + " Wedding; Hawaii Video Memories" );
		document.location.href = "mailto:" + DB.Contact.Email + "?subject=" + subject;
	}
	else
		document.location.href = "mailto:" + DB.Contact.Email;
}
//---------------------------------------------------------------------------------------

function showHawaiiTime() {

	var gmtOffset = 10; // for Hawaii
	var now = new Date();
	var difhrs = now.getTimezoneOffset()/60;
	var lochrs = now.getHours();
	GMThours = (difhrs < 0) ? lochrs - difhrs : lochrs + difhrs;
	now.setHours( GMThours - gmtOffset );

	var am_pm = "AM";
	var hours = now.getHours();

	if( hours >= 12 ) am_pm = "PM";
	if( hours >= 13 ) hours -= 12;
	if( hours == 0 ) hours = "12";

	var minutes = now.getMinutes();
	if( minutes < 10 ) minutes = "0" + minutes;

	var seconds = now.getSeconds();
	if( seconds < 10 ) seconds = "0" + seconds;

	try {
		var Time = document.getElementById( "time" );
		Time.innerHTML = hours + ":"  + minutes + ":"  + seconds + " " + am_pm;
		setTimeout( "showHawaiiTime()", 1000 );
	}
	catch( e ) {
		setTimeout( "showHawaiiTime()", 100 );
	}


}
//--------------------------------------------------------------------------------------

function getFormatedTime( hours, minutes, seconds ) {

	var am_pm = "AM";

	if( hours >= 12 ) am_pm = "PM";
	if( hours >= 13 ) hours -= 12;
	if( hours == 0 ) hours = "12";

	if( minutes < 10 ) minutes = "0" + minutes;

	if( seconds ) {
		if( seconds < 10 ) seconds = "0" + seconds;
		seconds = ":" + seconds;
	}
	return hours + ":" + minutes + seconds + "" + am_pm;
}

//---------------------------------------------------------------------------------------
function toggleSection( dSection ) {

	dSection = document.getElementById( dSection );

	if ( dSection.className == "off" ) { dSection.className = "on"; }
	else { dSection.className = "off"; }

}
//---------------------------------------------------------------------------------------
function changeHTML( newHTML, theID ) {

	var objID = null;
	objID = document.getElementById( theID );
	if( objID != null && eval( 'typeof objID' ) == 'object' ) objID.innerHTML = newHTML;

}
//---------------------------------------------------------------------------------------

function recordData( key, value ) {

	// In unlikely event user input special delimiter characters remove them
	if( eval( "typeof key" ) == 'string' ) {
		key = key.replaceLiteral( "&", "and" );
		key = key.replaceLiteral( "=", "is" );
	}
	if( eval( "typeof value" ) == 'string' ) {
		value = value.replaceLiteral( "&", "and" );
		value = value.replaceLiteral( "=", "is" );
	}

	var newCookie = '';
	var oldCookie = GetCookie( 'hvmCook' );

	var target = key + '=';
	var newKeyValPair = target + value;

	if( oldCookie != null ) {

		var startPos = oldCookie.indexOf( target );
		var endPos = oldCookie.indexOf( '&', startPos );

		// If there is only one key/value pair in cookie
		if( endPos == -1 ) endPos = oldCookie.length;

		// key already exists; so update it with this new value
		if( startPos != -1 ) {

			var slice1 = oldCookie.substring( 0, startPos );
			var slice2 = oldCookie.substring( endPos, oldCookie.length );
			newCookie = slice1 + newKeyValPair + slice2;

		}
		else // Key does not exist in existing cookie so append this new key/value pair
			newCookie += oldCookie + '&' + newKeyValPair;

		SetCookie( "hvmCook", newCookie, expdate, "/", cookieDomain );
	}
	else // No existing cookie so make one
		SetCookie( "hvmCook", newKeyValPair, expdate, "/", cookieDomain );

//alert( 'Resulting Cookie: |' + GetCookie( "hvmCook" ) + '|' )

}

//--------------------------------- OBJECT CONSTRUCTOR ---------------------------------
// ACCESOR FUNCTIONS: None
// ACCESSOR CLASSES: offP, onP
function PrinterFriendly() {

	this.dText = [
		"Printer-Friendly", // 0
		"Reformat Page Back To Default Web-Layout", // 1
		"Compacts page and maximizes it for your printer..", // 2
		"Reformat page back to default \"web\" layout..." // 3
	];

	this.getElemArr = getElemArr;
	this.setView = setView;
	this.printPage = printPage;

	//-------------------------------------- METHOD --------------------------------------
	// Scans page and returns array of elements (as objects) that start with elemNameStr
	function getElemArr( elemNameStr ) {

		var elemArr = new Array();

		var allElements = document.getElementsByTagName( "*" );

		var k = 0;

		for ( var i = 0; i < allElements.length; i++ ) {
			if( allElements[ i ].id.indexOf( elemNameStr ) == 0 ) {
				elemArr[ k ] = allElements[ i ];
				k++;
			}
		}

		return elemArr;
	}
	//-------------------------------------- METHOD --------------------------------------
	function setView( ThisPrnFrnLink, bkgImg, printPullDowns ) {

		var hide = ( ThisPrnFrnLink.innerHTML == this.dText[ 0 ] ) ? true : false;

		var prnFrnLinksArr = getElemArr( "printer_friendly" );

		for( member in prnFrnLinksArr ) {
			if( hide ) {
				prnFrnLinksArr[ member ].innerHTML = this.dText[ 1 ];
				prnFrnLinksArr[ member ].title = this.dText[ 3 ];
			}
			else {
				prnFrnLinksArr[ member ].innerHTML = this.dText[ 0 ];
				prnFrnLinksArr[ member ].title = this.dText[ 2 ];
			}
		}

		var divArr = getElemArr( "PRN_" );

		// Show or Hide all elements starting with "PRN_"
		for( member in divArr ) {
			if( hide ) divArr[ member ].className = "offP";
			else divArr[ member ].className = "onP";
		}

		if( hide ) {
			if( bkgImg ) document.body.style.backgroundImage = "url( none )";
		}
		else {
			if( bkgImg ) document.body.style.backgroundImage = "url( " + bkgImg + " )";
		}
		if( ThisPrnFrnLink.focus ) {
			ThisPrnFrnLink.focus();
			ThisPrnFrnLink.blur();
		}
	}
	//-------------------------------------- METHOD --------------------------------------
	function printPage( TheLink ) {
		if( window.print && TheLink.innerHTML == this.dText[ 1 ] ) {
			document.title += "; " + DB.Contact.TelTollFree + " & " + DB.Contact.TelDirect;
			self.print();
		}
	}
}
//--------------------------------------------------------------------------------------

var activeColor = "rgb( 0,0,0 )";
var staticColor = "rgb( 255,255,255 )";

document.write("<STYLE>.borderImage{ border:1px solid " + staticColor + "; }</STYLE>");

function borderIm( image, color ) { image.style.borderColor = color; }

//////////////////////////////// START IMAGE VIEWER: IV ////////////////////////////////

/*
ACCESSOR CLS: off, on, iv*
ACCESSOR FUN: replaceLiteral, getRGB, startFade
ACCESSOR VAR: macIE, IE, winIE, MZ
*/

//--------------------------------- OBJECT CONSTRUCTOR ---------------------------------

function ImageViewer( transNum, transDur ) {

	this.dissolveSF = 1;
	this.transNum = ( transNum ) ? transNum :   2;
	this.transDur = ( transDur ) ? transDur : 0.8;

	this.Link = null;
	this.setSectVis = setSectVis;
	this.hideOtherPhotos = hideOtherPhotos;
	this.show = show;
	this.swapLgImg = swapLgImg;
	this.hideLgImg = hideLgImg;
	this.setImgTitle = setImgTitle;
	this.removeOverlay = removeOverlay;
	this.getNumLinesInTitle = getNumLinesInTitle;
	this.preloadNext = preloadNext;
	this.getImgIndexArr = getImgIndexArr;
	this.setBotImgFromTop = setBotImgFromTop;
	this.scrollFromTop = 0;
	this.scrollFromLeft = 0;
	this.lgPhotoShowing = false;
	this.ImgOverlay = null;
	this.NextLgImage = null;
	this.forward = -1;
	this.nextImgTimer = 0;
	this.tnPage = false;
	this.maxImgArea = Math.pow( 450, 2 );
	var path = document.location.pathname;
	var delimeter = ( path.indexOf( "\\" ) >= 0 ) ? "\\" : "/";
	var Path = path.split( delimeter );
	var thisPage = Path[ Path.length - 1 ];

	if( thisPage && thisPage.indexOf( "." ) >= 0 && thisPage.toLowerCase().indexOf( "thumbnails" ) == 0 )
		this.tnPage = true;

	window.onresize = this.setBotImgFromTop;

	//------------------------------------- METHOD IV -------------------------------------
	// Loops thru any section(s) that are to be hidden when large image is displayed AND
	// Loops thru any section(s) that are to be re-shown when large image is is hidden

	function setSectVis( sectName, className ) {
		var i = 0;
		while( document.getElementById( sectName + i ) ) {
			Section = document.getElementById( sectName + i );
			Section.className = className;
			i++;
		}
	}
	//------------------------------------- METHOD IV -------------------------------------
	// Scroll image data file to find requested image & return indexes. Fails if same image is repeated 2 or more times in same data file
	function getImgIndexArr( imgPath ) {

		var maxIndex = Images.length - 1;
		var delimeter = ( imgPath.indexOf( "\\" ) >= 0 ) ? "\\" : "/";

		var lastSlash = imgPath.lastIndexOf( delimeter );

		var imgName = ( lastSlash >= 0 ) ? imgPath.substring( lastSlash + 1, imgPath.length ) : imgPath;

		for( var i = 0; i <= maxIndex; i++ ) {
			if( imgName == Images[ i ][ 0 ] ) {
				if( this.forward ) var newIndex = ( i < maxIndex ) ? i + 1 : 0;
				else var newIndex = ( i > 0 ) ? i - 1 : maxIndex;
				var thisIndex = i;
				break;
			}
		}

		return[ thisIndex, newIndex, maxIndex ];
	}
	//------------------------------------- METHOD IV -------------------------------------
	function preloadNext( Img ) {
		if( this.tnPage ) {
			var ImgIndexArr = this.getImgIndexArr( Img.src );
			var newIndex  = ImgIndexArr[ 1 ];
			var PreLoadImage = new Image(Images[ newIndex ][ 1 ], Images[ newIndex ][ 2 ]);
			PreLoadImage.src = Settings.folder + Images[ newIndex ][ 0 ];
		}
	}
	//------------------------------------- METHOD IV -------------------------------------
	function getNumLinesInTitle( imgTitle ) {

		var imgtitle = imgTitle.toLowerCase();
		var nLinesInTitle = imgtitle.split( "<br>" ).length;
		var lineBrks = "";
		for( var i = 0; i < nLinesInTitle; i++ ) lineBrks += "<BR>";
		return lineBrks;
	}
	//------------------------------------- METHOD IV -------------------------------------
	function setBotImgFromTop( keepOverlay ) {
		// Moz/SF only; top image showing, bottom image inherits its' values
		if( IV.ImgOverlay ) {
			var TopImage = document.images.imageIVNew;
			var BotImage = document.images.thumbnailsIV;
			BotImage.src = TopImage.src;
			BotImage.style.borderColor = TopImage.style.borderColor;
			BotImage.style.borderWidth = TopImage.style.borderWidth;
			if( typeof keepOverlay != "number" ) IV.removeOverlay();
		}
	}
	//------------------------------------- METHOD IV -------------------------------------
	// If there is an overlay image, then remove it
	function removeOverlay() {
		if( this.ImgOverlay ) {
			document.body.removeChild( this.ImgOverlay );
			this.ImgOverlay = null;
		}
	}
	//------------------------------------- METHOD IV -------------------------------------
	// Lets user go back & forward on large images on TN page
	function swapLgImg() {

		var Img = document.getElementById( "imgLargeIV" );
		if( Img ) {
			Img.onload = null;

			this.setBotImgFromTop( 1 );

			var ImgIndexArr = this.getImgIndexArr( Img.src );
			var thisIndex = ImgIndexArr[ 0 ];
			var newIndex  = ImgIndexArr[ 1 ];
			var maxIndex  = ImgIndexArr[ 2 ];

			// User clicked "<<" OR ">>" so preload requested image
			if( !this.NextLgImage ) {
				this.NextLgImage = new Image(Images[ newIndex ][ 1 ], Images[ newIndex ][ 2 ]);
				this.NextLgImage.src = Settings.folder + Images[ newIndex ][ 0 ];
			}

			if( this.NextLgImage.complete ) {

				var thisImgWid = Images[ thisIndex ][ 1 ] + ( 2 * Settings.borderWid );
				var newImgWid = Images[ newIndex ][ 1 ] + ( 2 * Settings.borderWid );

				var thisImgHgt = Images[ thisIndex ][ 2 ] + ( 2 * Settings.borderWid );
				var newImgHgt = Images[ newIndex ][ 2 ] + ( 2 * Settings.borderWid );

				var sameDim = ( thisImgWid == newImgWid && thisImgHgt == newImgHgt ); diffDim = !sameDim;

				var newImgArea = newImgWid * newImgHgt;

				// Old & New images have diff dimensions so make img transparent & fade in from bkg
				if( diffDim ) {
					if( winIE ) Img.style.visibility = "hidden";
					else if( MZ && newImgArea <= this.maxImgArea ) Img.style.MozOpacity = 0;
					else if( SF && this.dissolveSF ) Img.style.opacity = 0;
				}

				var imgTitle = Images[ newIndex ][ 3 ];

				IV.setImgTitle( imgTitle, newIndex, maxIndex );

				////////////////////////////// IE TRANS //////////////////////////////
				if( winIE ) {
					if( sameDim )
						dissolveDirectX( Img, Settings.folder + Images[ newIndex ][ 0 ], Settings.borderWid, Images[ newIndex ][ 4 ], this.transNum, this.transDur );
					else {
						Img.src = Settings.folder + Images[ newIndex ][ 0 ];
						Img.width = Images[ newIndex ][ 1 ];
						Img.height = Images[ newIndex ][ 2 ];
						Img.style.border = Settings.borderWid + "px solid rgb( " + getRGB( Images[ newIndex ][ 4 ] ) + " )";
						startFade( Img, IV.transNum, IV.transDur, 0, 0, 0 );
					}
				}

				////////////////////////////// MZ & SF TRANS //////////////////////////////

				else if( ( MZ && newImgArea <= this.maxImgArea ) || ( SF && this.dissolveSF ) ) {

					if( sameDim ) {

						var opac = getOpacity( this.dissolveSF, 1 );

						var imgStyle = ( Settings.borderWid ) ? " style='border:" + Settings.borderWid + "px solid rgb(" + getRGB( Images[ newIndex ][ 4 ] ) + "); " + opac + "'" : " style='" + opac + "'";

						var newImg = "<img name='imageIVNew' src='" + Settings.folder + Images[ newIndex ][ 0 ] + "' width='" + Images[ newIndex ][ 1 ] + "' height='" + Images[ newIndex ][ 2 ] + "'" + imgStyle + " onClick='IV.hideLgImg( \"thumbnails\" );' onMouseOver='this.style.cursor=\"pointer\"; self.status=this.title; return true;' onMouseOut='this.style.cursor=\"default\"; self.status=\"\"; return true;' TITLE='Go back to thumbnails'>";

						if( !this.ImgOverlay ) {
							this.ImgOverlay = document.createElement( "DIV" );
							document.body.appendChild( this.ImgOverlay );
							this.ImgOverlay.style.zIndex = 1000;
							this.ImgOverlay.style.position = "absolute";
						}

						// Get on screen position of slide-show image so we can lay new one on top
						var x = 0, y = 0, TheElement = Img;
						while( TheElement != document.body ) {
							y += TheElement.offsetTop;
							x += TheElement.offsetLeft;
							y -= TheElement.scrollTop;
							x -= TheElement.scrollLeft;
							TheElement = TheElement.offsetParent;
						}

						this.ImgOverlay.style.top = y + "px";
						this.ImgOverlay.style.left = x + "px";

						this.ImgOverlay.innerHTML = newImg;
						fadeIn( document.images.imageIVNew );

					}

					else { // MZ/SF & images have different dimensions so trans from bkg
						this.removeOverlay();
						Img.src = Settings.folder + Images[ newIndex ][ 0 ];
						Img.width = Images[ newIndex ][ 1 ];
						Img.height = Images[ newIndex ][ 2 ];
						Img.style.border = Settings.borderWid + "px solid rgb( " + getRGB( Images[ newIndex ][ 4 ] ) + " )";
						fadeIn( Img );
					}
				}

				////////////////////////// NO TRANS: macIE & SF //////////////////////////

				else {
					this.removeOverlay();
					Img.src = Settings.folder + Images[ newIndex ][ 0 ];
					Img.width = Images[ newIndex ][ 1 ];
					Img.height = Images[ newIndex ][ 2 ];
					Img.style.border = Settings.borderWid + "px solid rgb( " + getRGB( Images[ newIndex ][ 4 ] ) + " )";
				}
				this.forward = 1;
				this.preloadNext( this.NextLgImage );
				this.NextLgImage = null;
				clearInterval( this.nextImgTimer );
				this.nextImgTimer = 0;
			}
			else { // Next image still loading
				if( this.nextImgTimer == 0 ) {
					this.nextImgTimer = setInterval( "IV.swapLgImg()", 250 );
					var lineBrks = getNumLinesInTitle( Images[ newIndex ][ 3 ] );
					IV.setImgTitle( "Downloading image, please wait..." + lineBrks, null, null );
				}
			}
		}
		else { // ERROR: Image not present
			this.NextLgImage = null;
			clearInterval( this.nextImgTimer );
			this.nextImgTimer = 0;
		}
	}
	//------------------------------------- METHOD IV -------------------------------------
	// Loops thru other open photos (if any) and hides them.
	// Keeps more than 1 large photos from showing simultaneously

	function hideOtherPhotos() {
		if( !this.tnPage ) {
			var OtherDivs = document.getElementsByTagName( "DIV" );
			for( var i = 0; i < OtherDivs.length; i++ ) {
				if( OtherDivs[i].id.indexOf( "bigIV" ) == 0 )
					this.hideLgImg( OtherDivs[i].id.substring( 5, OtherDivs[i].id.length ) );
			}
		}
	}
	//------------------------------------- METHOD IV -------------------------------------
	// [ 'images/', 'princeWFReid.jpg', 347, 351, 'Maui Prince', 'b', 1, BackLink , 'sectName' ]
	//      0               1            2    3           4       5   6     7           8

	// Displays full size image on the current page
	function show( ImgInfoArr ) {

		if( document.getElementById ) {

			// Record where page is scrolled to so it can be reset back later
			var ieCSS = ( IE && document.compatMode) ? document.compatMode ==  "CSS1Compat" : false;
			if( IE ) var IeBody = ieCSS ? document.documentElement : document.body;
			this.scrollFromTop = ( IE ) ? IeBody.scrollTop : window.pageYOffset;
			this.scrollFromLeft = ( IE ) ? IeBody.scrollLeft : window.pageXOffset;

			if( this.tnPage ) this.Link = ImgInfoArr[ 7 ];

			this.hideOtherPhotos();
			var sectName = ImgInfoArr[ 8 ];
			this.setSectVis( sectName, "off" );

			ImgInfoArr[ 5 ] = getRGB( ImgInfoArr[ 5 ] );
			var tableHgt = 1;

			if( this.tnPage ) {

				tableHgt = ( IE ) ? document.body.clientHeight - 60 : window.innerHeight - 60;
				this.lgPhotoShowing = true;
				var BodyStyle = document.body.style;
				BodyStyle.backgroundImage = "url( none )";
				BodyStyle.backgroundColor = Settings.TN.bkgColOn;
				BodyStyle.marginTop = "0px";
				BodyStyle.marginRight = "0px";
				BodyStyle.marginBottom = "0px";
				BodyStyle.marginLeft = "0px";

			}

			var html = "<DIV ID='bigIV" + sectName + "'>" + "<TABLE BORDER='0' CELLSPACING='0' CELLPADDING='0' WIDTH='100%' HEIGHT='" + tableHgt + "'><TR><TD ALIGN='center' VALIGN='middle'>";

				html +=
				"<TABLE BORDER='0' CELLSPACING='0' CELLPADDING='0'>" +
					"<TR>" +
						"<TD>" +
							"<A HREF='javascript:void(0);' ID='topFocalPt'></A><BR>" +
						"</TD>" +
					"</TR>" +
					"<TR>";

						var bkgStyle = ( this.tnPage ) ? " STYLE='background-color:" + Settings.TN.bkgColOn + ";'" : " ";

						if( this.tnPage ) {
							var ImgIndexArr = this.getImgIndexArr( ImgInfoArr[ 0 ] + ImgInfoArr[ 1 ] );
							var thisIndex = ImgIndexArr[ 0 ];
							var maxIndex  = ImgIndexArr[ 2 ];
							var backMsg = "Back to thumbnails";
						}
						else {
							var thisIndex = null;
							var maxIndex  = null;
							var backMsg = "Back to thumbnail";
						}
						var imgTitle = ImgInfoArr[ 4 ];

						var lineBrks = getNumLinesInTitle( imgTitle );


						html +=
						"<TD ALIGN='center'" + bkgStyle + ">" +

							"<A HREF='javascript:IV.hideLgImg( \"" + sectName + "\" );' onMouseOver='self.status=this.title; return true;' onMouseOut='self.status=\"\"; return true;' TITLE='" + backMsg + "'" + bkgStyle + ">";

								var dissolveMZ = ( ImgInfoArr[ 2 ] * ImgInfoArr[ 3 ] <= this.maxImgArea );

								html += "<IMG ID='imgLargeIV' NAME='" + sectName + "IV' SRC='" + ImgInfoArr[ 0 ] + ImgInfoArr[ 1 ] + "' BORDER='0' WIDTH='" + ImgInfoArr[ 2 ] + "' HEIGHT='" + ImgInfoArr[ 3 ] + "' HSPACE=0 VSPACE=0 STYLE='border:" + ImgInfoArr[ 6 ] + "px solid rgb( " + ImgInfoArr[ 5 ] + " );" + getOpacity( IV.dissolveSF, dissolveMZ ) + "' onAbort='this.src=this.src;' onLoad='startFade( this, IV.transNum, IV.transDur, 0, IV.dissolveSF, " + dissolveMZ + " ); IV.setImgTitle( \"" + imgTitle + "\", " + thisIndex + "," + maxIndex + " ); IV.preloadNext( this );'>" +

							"</A>" +

						"</TD>" +
					"</TR>" +
					"<TR>" +
						"<TD ALIGN='center' width='" + ImgInfoArr[ 2 ] + "'>" +
							"<DIV ID='imgTitleIV' CLASS='ivLgImgTitle'>Loading image, please wait..." + lineBrks + "</DIV><DIV STYLE='line-height:4px;'> &nbsp;</DIV>" +
						"</TD>" +
					"</TR>" +
					"<TR>" +
						"<TD ALIGN='center'>";

							if( this.tnPage ) html +=
								"<A HREF='javascript:IV.forward = 0; IV.swapLgImg();' onMouseOver='self.status=this.title; style.textDecoration=\"underline\"; return true;' onMouseOut='self.status=\"\"; style.textDecoration=\"none\"; return true;' style='text-decoration:none;' TITLE='Previous image'>&lt;&lt;</A>&nbsp;&nbsp;";

							html +=
							"<A HREF='javascript:IV.hideLgImg( \"" + sectName + "\" );' onMouseOver='self.status=this.title; style.textDecoration=\"underline\"; return true;' onMouseOut='self.status=\"\"; style.textDecoration=\"none\"; return true;' style='text-decoration:none;' TITLE='" + backMsg + "'>" + ( ( this.tnPage ) ? "Thumbnails" : "Back" ) + "</A>";

							if( this.tnPage ) html +=
								"&nbsp;&nbsp;<A HREF='javascript:IV.forward = 1; IV.swapLgImg();' onMouseOver='self.status=this.title; style.textDecoration=\"underline\"; return true;' onMouseOut='self.status=\"\"; style.textDecoration=\"none\"; return true;' style='text-decoration:none;' TITLE='Next image'>&gt;&gt;</A>";

							html +=

						"</TD>" +
					"</TR>" +
					"<TR>" +
						"<TD>" +
							"<A HREF='javascript:void(0);' ID='botFocalPt'></A><BR>" +
						"</TD>" +
					"</TR>" +
				"</TABLE><BR>";

			if( this.tnPage ) html += "</TD></TR></TABLE><BR>";
			html += "</DIV>";
			var ImgConsole = document.getElementById( sectName );
			ImgConsole.innerHTML = html;
			ImgConsole.className = "on";
			if( !macIE ) {
				var FocuserTop = document.getElementById( "topFocalPt" ); FocuserTop.focus();
				var FocuserBot = document.getElementById( "botFocalPt" ); FocuserBot.focus();
			}
			return false;
		}
		else { // Old Browsers
			document.location.href = ImgInfoArr[ 0 ] + ImgInfoArr[ 1 ];
			return false;
		}
	}

	//------------------------------------- METHOD IV -------------------------------------
	// Set page back to default state by hiding large image
	function hideLgImg( sectName ) {

		var ImgConsole = document.getElementById( "bigIV" + sectName );
		ImgConsole.innerHTML = "";
		ImgConsole.className = "off";
		if( this.tnPage ) {
			this.removeOverlay();
			this.lgPhotoShowing = false;
			var BodyStyle = document.body.style;
			BodyStyle.backgroundImage = Settings.TN.PageStyle.bkgImg;
			BodyStyle.backgroundColor = Settings.TN.PageStyle.bkgCol;
			BodyStyle.marginTop = Settings.TN.PageStyle.marTop;
			BodyStyle.marginRight = Settings.TN.PageStyle.marRgt;
			BodyStyle.marginBottom = Settings.TN.PageStyle.marBot;
			BodyStyle.marginLeft = Settings.TN.PageStyle.marLft;
		}

		IV.setSectVis( sectName, "on" );
		if( this.tnPage && typeof this.Link == "object" ) {
			this.Link.focus();
			this.Link.blur();
		}
		// Scroll window back to where it was before
		window.scroll( this.scrollFromLeft, this.scrollFromTop );
	}
	//------------------------------------- METHOD IV -------------------------------------

	function setImgTitle( imgTitle, newIndex, maxIndex ) {

		if( this.tnPage ) {

			if( imgTitle == "*" )
				imgTitle = Settings.pageTitle;
			else if( imgTitle.indexOf( "*+" ) == 0 )
				imgTitle = Settings.pageTitle + imgTitle.split( "+" )[ 1 ];
			else if( imgTitle.indexOf( "+*" ) >= 0 )
				imgTitle = imgTitle.split( "+" )[ 0 ] + Settings.pageTitle;
			else if( imgTitle == "_" )
				imgTitle = Images[ newIndex ][ 0 ].split( "." )[ 0 ];

			if( newIndex != null ) {
				var colon = ( imgTitle != "&nbsp; <BR>" && imgTitle != "" ) ? ": " : "";
				imgTitle = ( newIndex + 1 ) + " of " + ( maxIndex + 1 ) + colon + imgTitle;
			}
		}

		if( !imgTitle ) imgTitle = "&nbsp; <br>";
		var ImgTitle = document.getElementById( "imgTitleIV" );
		imgTitle = imgTitle.replaceLiteral( '^^', "'" );
		imgTitle = imgTitle.replaceLiteral( '^', "\"" );
		ImgTitle.innerHTML = imgTitle;

	}
}
////////////////////////////////// END IMAGE VIEWER: IV //////////////////////////////////

function controlMovie( start ) {
	try {
		var MediaPlayer = document.getElementById( "MediaPlayerWinIE" );
		( start ) ? MediaPlayer.play() : MediaPlayer.stop();
	}
	catch( Err ) {}
}

//--------------------------------------------------------------------------------------
// Called onLoad and plays movie from qStr if properly set: client=2007-04-20-smith
function playClientMovie() {

	if( qStr && qStr.getVal( "client" ) ) {
		var client = qStr.getVal( "client" );
		var rePattern = /^\d{4}-\d{2}-\d{2}-.+$/;

		if( rePattern.test( client ) ) {
			document.getElementById( "videoID" ).innerHTML = getPlayerGUI( client + ".wmv" );
			controlMovie( 1 );
		}
	}

}
//--------------------------------------------------------------------------------------

function getPlayerGUI( vidFile ) {

	htm = "" +

	"<table align='center' border='0' cellspacing='0' cellpadding='0'>" +
		"<tr>" +
			"<td align='center' width=200>" +
				"&nbsp;" +
			"</td>" +
			"<td align='center' style='width:320px; background-color:rgb(0,0,0); border:2px solid rgb(0,0,0);'>" +

					// Markup for windows internet explorer
					"<object id='MediaPlayerWinIE' classid='clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95' codebase=' http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' STANDBY='Loading Microsoft Windows Media Player components...' TYPE='application/x-oleobject' style='width:320px; height:309px;'>" +
						"<param name='filename' value='http://mfile.akamai.com/29065/wmv/multicastmed.download.akamai.com/29065/video/webcast/" + vidFile + "'>" +
						"<param name='animationatstart' value='true'>" +
						"<param name='transparentatstart' value='false'>" +
						"<param name='autostart' value='true'>" +
						"<param name='showcontrols' value='true'>" +
						"<param name='showstatusbar' value='true'>" +
						"<param name='enableContextMenu' value='" + ( ( live ) ? false : true ) + "'>" +
						"<param name='displaysize' value='0'>" +

							// Markup for all browsers other than windows internet explorer
							"<embed id='MediaPlayer' style='width:320px; height:309px;' type='application/x-mplayer2' pluginspage='http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=media&sba=plugin&' src='http://mfile.akamai.com/29065/wmv/multicastmed.download.akamai.com/29065/video/webcast/" + vidFile + "' autosize=1 showcontrols=1 showtracker=1 showstatusbar=1 EnableContextMenu=" + ( ( live ) ? 0 : 1 ) + " autostart='1'></embed>" +

					"</object>" +

			"</td>" +
			"<td align='center' width=200>" +
				"&nbsp;" +
			"</td>" +
		"</tr>" +
	"</table>";

	return htm;

}
//--------------------------------------------------------------------------------------

function showClientMovie( Form ) {

	// Ex: 2007-04-20-Smith.wmv

	var gLast = Form.Groom_Last_Name.value.toLowerCase();
	gLast = gLast.replace( /^\s*|\s*$/g, "" );
	gLast = gLast.replace( /'/g, "" );
	Form.Groom_Last_Name.value = gLast;

	if( gLast == "" ) {
		alert( "Please enter Groom's Last Name" );
		Form.Groom_Last_Name.focus();
		return false;
	}

	if( gLast == "olson" ) gLast = "olson-new";

	var vidFile = Form.Wedding_Year[ Form.Wedding_Year.selectedIndex ].value + "-" + Form.Wedding_Month[ Form.Wedding_Month.selectedIndex ].value + "-" + Form.Wedding_Day[ Form.Wedding_Day.selectedIndex ].value + "-" + gLast + ".wmv";

	DW.removeWin();
	document.getElementById( "videoID" ).innerHTML = getPlayerGUI( vidFile );
	controlMovie( 1 );
	return false;

}

//--------------------------------------------------------------------------------------

videoInstructions = "";

function playVideo( id ) {


	var vidFile, loc, bg, wedDate, pkg;

	if( !videoInstructions )
		videoInstructions = document.getElementById( "videoID" ).innerHTML;

	// Sync with video.help.html
	if( id ) {
		switch( id ) {

			case "fkl":
				vidFile = "The_Fairmont_Kea_Lani.wmv";
				loc = "Fairmont Kea Lani";
				bg = "Julie & Michael"
				wedDate = "September 22nd";
				pkg = "Directors Cut";
				break;

			case "fsrOFL":
				vidFile = "The_Four_Seasons_Resort_Maui.wmv";
				loc = "Four Seasons Resort<br>Oceanfront Lawn";
				bg = "Jenny & Thomas"
				wedDate = "September 12th";
				pkg = "Directors Cut/8mm Film";
				break;

			case "gwr":
				vidFile = "Grand_Wailea_Resort.wmv";
				loc = "Grand Wailea Resort";
				bg = "Dorita & Shervin"
				wedDate = "May 28th";
				pkg = "Kamehameha/8mm Film";
				break;

			case "hok":
				vidFile = "Hokulani.wmv";
				loc = "Hokulani House<br>Makena";
				bg = "Sara & Jessie"
				wedDate = "May 28th";
				pkg = "Directors Cut";
				break;

			case "mbh":
				vidFile = "Makena_Beach_House.wmv";
				loc = "Makena Beach House<br>7010 Makena Road";
				bg = "Jennifer & Steven"
				wedDate = "September 20th";
				pkg = "Akamai";
				break;

			case "olowalu":
				vidFile = "Olowalu.wmv";
				loc = "Olowalu Plantation House";
				bg = "Lee & Nicole"
				wedDate = "November 19th";
				pkg = "Directors Cut";
				break;

			case "ritz":
				vidFile = "Ritz_Carlton_Kapalua.wmv";
				loc = "The Ritz Carlton<br>Napili Lawn";
				bg = "Asia & Mark"
				wedDate = "March 5th";
				pkg = "Directors Cut";
				break;

			case "westin":
				vidFile = "Westin.wmv";
				loc = "The Westin Maui";
				bg = "Daniela & Doug"
				wedDate = "July 22nd";
				pkg = "Directors Cut";
				break;

			case "webcast":
				break;

			case "stop":
				vidFile = "";
				loc = "";
				bg = ""
				wedDate = "";
				pkg = "";
				break;

			default:
				alert( "SWITCH/CASE ERROR: Cannot find a match for the id value \"" + id + "\" @ function playVideo" );
		}

		var htm = "";

		if( id == "stop" ) {
			controlMovie( 0 );
			document.getElementById( "videoID" ).innerHTML = videoInstructions;
		}
		else if( id == "webcast" ) {
			controlMovie( 0 );
			document.getElementById( "videoID" ).innerHTML = videoInstructions;
			var htm =

			"<form name='form' style='margin:10px 0px 10px 0px;' onSubmit='return showClientMovie( this );'>" +
			"<table align='center' border='0' cellspacing='0' cellpadding='0'>" +
				"<tr>" +
					"<td align='left' style='font-size:10pt; padding:0px 5px 0px 0px;'>" +
			"Wedding Date" +
					"</td>" +
					"<td>" +
						"<select name='Wedding_Month' id='Wedding_Month' class='pullDown'>" +
							"<option value='01'>January" +
							"<option value='02'>February" +
							"<option value='03'>March" +
							"<option value='04'>April" +
							"<option value='05'>May" +
							"<option value='06'>June" +
							"<option value='07'>July" +
							"<option value='08'>August" +
							"<option value='09'>September" +
							"<option value='10'>October" +
							"<option value='11'>November" +
							"<option value='12'>December" +
						"</select> &nbsp;" +

						"<select name='Wedding_Day' title='Please select your Wedding Day' class='pullDown'>" +
							"<option value='01'>1" +
							"<option value='02'>2" +
							"<option value='03'>3" +
							"<option value='04'>4" +
							"<option value='05'>5" +
							"<option value='06'>6" +
							"<option value='07'>7" +
							"<option value='08'>8" +
							"<option value='09'>9" +
							"<option value='10'>10" +
							"<option value='11'>11" +
							"<option value='12'>12" +
							"<option value='13'>13" +
							"<option value='14'>14" +
							"<option value='15'>15" +
							"<option value='16'>16" +
							"<option value='17'>17" +
							"<option value='18'>18" +
							"<option value='19'>19" +
							"<option value='20'>20" +
							"<option value='21'>21" +
							"<option value='22'>22" +
							"<option value='23'>23" +
							"<option value='24'>24" +
							"<option value='25'>25" +
							"<option value='26'>26" +
							"<option value='27'>27" +
							"<option value='28'>28" +
							"<option value='29'>29" +
							"<option value='30'>30" +
							"<option value='31'>31" +
						"</select> &nbsp;" +


						"<select name='Wedding_Year'>";

							var thisYear = new Date().getFullYear();
							var lastYear = thisYear - 1;

							htm +=
							"<option value='" + thisYear + "'>" + thisYear + "</option>" +
							"<option value='" + lastYear + "'>" + lastYear + "</option>" +

						"</select>" +
					"</td>" +
				"</tr>" +
				"<tr>" +
					"<td align='left' style='white-space:nowrap; font-size:10pt; padding:10px 10px 0px 0px;'>" +
			"Groom's Last Name" +
					"</td>" +
					"<td style='padding:10px 0px 0px 0px;'>" +
						"<input type='text' name='Groom_Last_Name' id='Groom_Last_Name' style='width:214px;'>" +
					"</td>" +
				"</tr>" +

			"</table>" +
			"<table align='center' border='0' cellspacing='0' cellpadding='0'>" +

				"<tr>" +
					"<td align='left' colspan='2' style='text-align:justify; font-size:9pt; padding:10px 10px 0px 10px;'>" +
						"If your movie does not start within a minute of pressing &ldquo;Search&rdquo; double-check the wedding date & spelling of the Groom's last name & try again. If it still fails to play, <A HREF='mailto:" + DB.Contact.Email + "?subject=" + escape( "Webcast Log-In Problems; Hawaii Video Memories" ) + "' style='text-decoration:underline;'>e-mail us</A> for assistance." +
					"</td>" +
				"</tr>" +

				"<tr>" +
					"<td align='center' colspan='2' style='padding:10px 0px 0px 0px;'>" +
						"<input type='submit' value='Search'>" +
					"</td>" +
				"</tr>" +

			"</table>" +
			"</form>";


			DW.createWindow( [ "<span style='font-variant:small-caps;'>Webcast Log-In</span>", htm ], null, null, [5,30,-50 ], [0,400,0], 6 );
			setPullDownToToday();
			setTimeout( "document.getElementById( 'Wedding_Month' ).focus()", 100 );

		}

		else {

			controlMovie( 0 );

			htm = "" +

			"<table align='center' border='0' cellspacing='0' cellpadding='0'>" +
				"<tr>" +
					"<td align='center' width=200>" +
						"&nbsp;" +
					"</td>" +
					"<td align='center' style='width:320px; background-color:rgb(0,0,0); border:2px solid rgb(0,0,0);'>" +

							// Markup for windows internet explorer
							"<object id='MediaPlayerWinIE' classid='clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95' codebase=' http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' STANDBY='Loading Microsoft Windows Media Player components...' TYPE='application/x-oleobject' style='width:320px; height:309px;'>" +
								"<param name='filename' value='http://mfile.akamai.com/29065/wmv/multicastmed.download.akamai.com/29065/video/" + vidFile + "'>" +
								"<param name='animationatstart' value='true'>" +
								"<param name='transparentatstart' value='false'>" +
								"<param name='autostart' value='true'>" +
								"<param name='showcontrols' value='true'>" +
								"<param name='showstatusbar' value='true'>" +
								"<param name='enableContextMenu' value='" + ( ( live ) ? false : true ) + "'>" +
								"<param name='displaysize' value='0'>" +

									// Markup for all browsers other than windows internet explorer
									"<embed id='MediaPlayer' style='width:320px; height:309px;' type='application/x-mplayer2' pluginspage='http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=media&sba=plugin&' src='http://mfile.akamai.com/29065/wmv/multicastmed.download.akamai.com/29065/video/" + vidFile + "' autosize=1 showcontrols=1 showtracker=1 showstatusbar=1 EnableContextMenu=" + ( ( live ) ? 0 : 1 ) + " autostart='1'></embed>" +

							"</object>" +

					"</td>" +
					"<td align='left' width=200>" +
						"<div style='margin:0px 0px 0px 10px;'>" +
							"<dl class='fSize11 fgGray102'>";

								if( loc ) htm +=
									"<dt class='fSize10'><b>Location</b></dt>" +
									"<dd style='margin:0px 0px 8px 12px;'>" + loc + "</dd>";

								if( pkg ) htm +=
									"<dt class='fSize10'><b>Package</b></dt>" +
									"<dd style='margin:0px 0px 8px 12px;'>" + pkg + "</dd>";

								if( bg ) htm +=
									"<dt class='fSize10'><b>Bride & Groom</b></dt>" +
									"<dd style='margin:0px 0px 8px 12px;'>" + bg + "</dd>";

								if( wedDate ) htm +=
									"<dt class='fSize10'><b>Date</b></dt>" +
									"<dd style='margin:0px 0px 0px 12px;'>" + wedDate + "</dd>";

							htm +=
							"</dl>" +
						"</div>" +
					"</td>" +
				"</tr>" +
			"</table>";

			document.getElementById( "videoID" ).innerHTML = htm;
			controlMovie( 1 );
		}

	}
}
//--------------------------------------------------------------------------------------

function writeImageMap() {

	document.write( "<MAP NAME='navTop'><AREA SHAPE='rectangle' COORDS='115,113,212,244' HREF='index.html' onMouseover='self.status=this.title; return true;' onMouseout='if( window.DM ) DM.hide(); self.status=\"\"; return true;' onClick='if( window.DM ) { DM.start( this, event, \"navTop\", \"relative\" ); return false; }' title='Navigate Our Site'></AREA></MAP>" +

	"<img src='images/clear.gif' border='0' width='212' height='244' hspace='0' vspace='0' onAbort='this.src=this.src;' align='left' usemap='#navTop'>" );
}

//////////////////////////////// START DYNAMIC MENU ////////////////////////////////

/*
ACCESSOR VARIABLES: IE, MZ, winIE, macIE, SF
ACCESSOR FUNCTIONS: None
CLASSES           : .dm*
*/

//-------------------------------- OBJECT CONSTRUCTOR DM --------------------------------

function DynamicMenu( FormElements ) {

	var pth = ( document.location.protocol == "https:" ) ? "http://www.hawaiivideomemories.com/" : "";
	var evtURL = ( live ) ? "https://www.hawaiivideomemories.com/event.aspx" : "event.aspx";

	// Begin User Settings
	this.Links = new Array();


	//Match values (keys) to same keys used by function setCompany() at C:\Inetpub\wwwroot\hvm\HawaiiScreeningRoom\hsr0.js
	this.Links[ "movies" ] =
	[
		[ "Fairmont Kea Lani", "javascript:playVideo(\"fkl\")", "" ],
		[ "Four Seasons Resort", "javascript:playVideo(\"fsrOFL\")", "" ],
		[ "Grand Wailea Resort", "javascript:playVideo(\"gwr\")", "" ],
		[ "Hokulani House", "javascript:playVideo(\"hok\")", "" ],
		[ "Makena Beach House", "javascript:playVideo(\"mbh\")", "" ],
		[ "Olowalu Plantation House", "javascript:playVideo(\"olowalu\")", "" ],
		[ "The Ritz Carlton", "javascript:playVideo(\"ritz\")", "" ],
		[ "The Westin Maui", "javascript:playVideo(\"westin\")", "" ],
		[ "View Webcast", "javascript:playVideo(\"webcast\")", "" ],
		[ "STOP", "javascript:playVideo(\"stop\")", "" ],
		[  "",     [5,8],   [0, -2], [0, 0], [0, 2], [0,0] ]
		// Title, relative, above,   right,  below,  left: [xPos, yPos]
	];

	this.Links[ "coord" ] =
	[
		[ "Editing Room", pth + "edit-room.html", dText[22] ],
		[ "Booking Calendar", pth + "calendar.html", dText[9] ],
		[  "",     [5,8],   [0, -2], [0, 0], [0, 4], [0,0] ]
		// Title, relative, above,   right,  below,  left: [xPos, yPos]
	];

	this.Links[ "navTop" ] = new Array();
	this.Links[ "navTop" ][ 0 ] = [ "About Us", pth + "profile.html", dText[ 2 ] ];
	this.Links[ "navTop" ][ 1 ] = [ "Staff", pth + "personnel.html", dText[ 3 ] ];
	this.Links[ "navTop" ][ 2 ] = [ "Packages", pth + "packages.html", dText[ 4 ] ];

	var nMenuItems = 3;

	if( access == "prices" || access == "client" || access == "full" ) {
		this.Links[ "navTop" ][ nMenuItems ] = [ "Pricing", pth + "prices.html", dText[ 6 ] ];
		nMenuItems++;
	}

	this.Links[ "navTop" ][ nMenuItems ] = [ "Movies", pth + "video.html", dText[ 19 ] ];
	nMenuItems++;

	if( access == "prices" || access == "client" || access == "full" ) {
		this.Links[ "navTop" ][ nMenuItems ] = [ "Inquire", pth + "inquire.html", dText[ 7 ] ];
		nMenuItems++;
	}

	if( access == "full" ) {
		this.Links[ "navTop" ][ nMenuItems ] = [ "Editing Room", pth + "edit-room.html", dText[ 22 ] ];
		nMenuItems++;
		this.Links[ "navTop" ][ nMenuItems ] = [ "Booking Calendar", pth + "calendar.html", dText[ 9 ] ];
		nMenuItems++;
	}

	this.Links[ "navTop" ][ nMenuItems ] = [ "Map", "javascript:PopUp.openWin(\"http://maps.google.com/maps?q=230+Hana+Highway,+Kahului+HI+96732&spn=0.028910,0.029313&hl=en\", 1, 1, 1, 1, .8, .6, 1, 1, 1 );", dText[ 17 ] ];
	nMenuItems++;

	this.Links[ "navTop" ][ nMenuItems ] = [ "Events", evtURL, "Order DVDs from an event (Graduation, May Day, Proms, David Malo Day, etc.)" ];
	nMenuItems++;
	this.Links[ "navTop" ][ nMenuItems ] = [ "Weddings", pth + "find.html?showWedding", "Find your private wedding homepage" ];
	nMenuItems++;

	if( access == "client" || access == "full" ) {
		this.Links[ "navTop" ][ nMenuItems ] = [ "E-mail", "javascript:sendMail();", dText[ 11 ] ];
		nMenuItems++;
	}

	this.Links[ "navTop" ][ nMenuItems ] = [ "Home", pth + "index.html", dText[ 1 ] ];
	nMenuItems++;

	this.Links[ "navTop" ][ nMenuItems ] = [  "", [2,5], [0, -2], [0, 0], [0, 4], [0,0] ];

	this.formElements = ( FormElements ) ? FormElements : null;

	// Do not edit past this line -------------------------
	this.Menu = null;
	this.OldLink = null;
	this.timer = 0;
	this.start = start;
	this.hide = hide;
	this.killOthers = killOthers;
	this.keepInWin = keepInWin;
	this.show = show;
	this.setElemVis = setElemVis;
	this.resetTimer = resetTimer;

	//------------------------------------- METHOD DM -------------------------------------
	function start( Link, theEvent, arrName, menuPosition, keepInWin ) {
		killOthers( Link );
		show( Link, theEvent, arrName, menuPosition, keepInWin );
	}
	//------------------------------------- METHOD DM -------------------------------------
	function hide( delay ) {
		if( !arguments.length ) delay = 1000;
		if( DM.timer == 0 && DM.Menu ) {
			DM.timer = setTimeout( "" +
				"DM.Menu.innerHTML = '';" +
				"DM.Menu = null;" +
				"DM.timer = 0;" +
				"DM.setElemVis( '', 'visible' );",
				delay
			);
		}
	}
	//------------------------------------- METHOD DM -------------------------------------
	function killOthers( NewLink ) {
		resetTimer();
		if( DM.Menu && DM.OldLink && DM.OldLink != NewLink ) {
			DM.Menu.innerHTML = '';
			DM.Menu = null;
			DM.timer = 0;
			DM.OldLink = null;
			DM.setElemVis( "", "visible" );
		}
	}
	//------------------------------------- METHOD DM -------------------------------------
	function keepInWin( topEdge, leftEdge, IeBody ) {

		var bodyHgt = ( IE ) ? IeBody.clientHeight : window.innerHeight;
		var bodyWid = ( IE ) ? IeBody.clientWidth : window.innerWidth;

		// Prevent menu from going off bottom & top of page
		var menuHgt = DM.Menu.offsetHeight;
		var yOffset = ( IE ) ? IeBody.scrollTop : window.pageYOffset;
		var vScreenPos = topEdge - yOffset;
		var vSkew = bodyHgt - vScreenPos;
		if( vSkew < menuHgt + 10 ) topEdge -= menuHgt - vSkew + 10; // bottom edge
		else if( vScreenPos < 10 ) topEdge = 10 + yOffset; // top edge

		// Prevent menu from going off right & left edges
		var menuWid = DM.Menu.offsetWidth;
		var xOffset = ( IE ) ? IeBody.scrollLeft : window.pageXOffset;
		var hScreenPos = leftEdge - xOffset;
		var hSkew = bodyWid - hScreenPos;
		if( hSkew < menuWid + 10 ) leftEdge -= menuWid - hSkew + 10; // right edge
		else if( hScreenPos < 10 ) leftEdge = 10 + xOffset; // left edge

		return[ topEdge, leftEdge ];
	}
	//------------------------------------- METHOD DM -------------------------------------
	function show( Link, theEvent, arrName, menuPosition, keepInWin ) {

		if( !DM.Menu ) {

			DM.setElemVis( arrName, "hidden" );

			var e = ( window.event ) ? event : theEvent;

			var nLinks = DM.Links[ arrName ].length - 1;

			var menuTitle = DM.Links[ arrName ][ nLinks ][ 0 ];

			var table = "" +

			"<table align='left' border='0' cellspacing='0' cellpadding='0' class='dmBorder' onMouseover='DM.resetTimer();' onMouseout='DM.hide( 0 );'>";
				for( var i = 0; i < nLinks; i++ ) {

					if( menuTitle && i == 0 ) {
						table +=
						"<tr>" +
							"<td nowrap class='dmTitleBg'>" +
								"<div style='width:100%;'>" +
									"<div class='dmTitleFg'>" + menuTitle + "</div>" +
								"</div>" +
							"</td>" +
						"</tr>";
					}

					table += "<tr align='left' valign='middle'>";

						var content = "link";
						if( DM.Links[ arrName ][ i ][ 1 ] == "-" ) content = "separator";
						else if( DM.Links[ arrName ][ i ][ 1 ] == "text" ) content = "text";

						var target = ( DM.Links[ arrName ][ i ][ 4 ] ) ? DM.Links[ arrName ][ i ][ 4 ] : "_self";
						var domTarget = ( target.indexOf( "_" ) == 0 ) ? target.substring( 1, target.length ) : "parent." + target;

						var thePage = eval( domTarget + ".document.location.href" );
						var newPage = eval( "!" + domTarget + ".document.location.hash" );

						var pageShowing = ( ( thePage.substring( thePage.length - DM.Links[ arrName ][ i ][ 1 ].length, thePage.length ) == DM.Links[ arrName ][ i ][ 1 ] && newPage ) || DM.pageShowing == DM.Links[ arrName ][ i ][ 1 ] );
						// HACK
if( pageShowing && DM.Links[ arrName ][ i ][ 1 ] == "javascript:playVideo(\"webcast\")" )
	pageShowing = false;
						var selfStatusCode = "";

						if( DM.Links[ arrName ][ i ][ 2 ] && !pageShowing )
								selfStatusCode = "self.status = \"" + DM.Links[ arrName ][ i ][ 2 ] + "\"; ";

						var mouseOutCode = ( DM.Links[ arrName ][ i ][ 2 ] ) ? "self.status = \"\"; " : "";

						var cursorType = ( pageShowing ) ? "default" : ( IE ) ? "hand" : "pointer";

						var onClickMore = ( DM.Links[ arrName ][ i ][ 3 ] ) ? DM.Links[ arrName ][ i ][ 3 ] : " return true;";

						/////////////// MAKE MENU LINK ///////////////
						if( content == "link" ) { table +=

							"<td nowrap class='dmMenuBgOff' onMouseOver='" + selfStatusCode + "firstChild.firstChild.className=\"" + ( ( pageShowing ) ? "dmMenuFgDisable" : "dmMenuFgOn" ) + "\"; className=\"" + ( ( pageShowing )  ? "dmMenuBgOff" : "dmMenuBgOn" ) + "\"; return true;' onMouseOut='" + mouseOutCode + "firstChild.firstChild.className=\"" + ( ( pageShowing ) ? "dmMenuFgDisable" : "dmMenuFgOff" ) + "\";  className=\"dmMenuBgOff\"; return true;'>" +

								"<a href='" + ( ( pageShowing ) ? "javascript:void(0);" : DM.Links[ arrName ][ i ][ 1 ] ) + "' TARGET='" + target + "' style='text-decoration:none;' onClick='if( href != \"javascript:void(0);\" ) { DM.hide( 0 ); DM.pageShowing = this.href; " + onClickMore + " } else return false;' onMouseOver='style.cursor = \"" + cursorType + "\"; return true;'>" +

									"<div style='width:100%;' class='" + ( ( pageShowing ) ? "dmMenuFgDisable" : "dmMenuFgOff" ) + "'>" +
										"" + DM.Links[ arrName ][ i ][ 0 ] + "" +
									"</div>" +

								"</a>" +

							"</td>";
						}
						/////////////// MAKE SEPARATOR ///////////////
						else if( content == "separator" ) { table +=
							"<td align='center' class='dmMenuBgOff'>" +
								"<table border='0' cellspacing='0' cellpadding='0' style='width:100%; margin:2px 0px 2px 0px;'>" +
									"<tr>" +
										"<td style='height:1px; width:100%;' class='dmSepCol'></td>" +
									"</tr>" +
								"</table>" +
							"</td>";
						}
						/////////////// MAKE READ-ONLY CONTENT ///////////////
						else {  table +=
							"<td align='center' class='dmMenuBgOff'>" +
								"<div class='dmTxt' onClick='self.status=\"" + DM.Links[ arrName ][ i ][ 2 ] + "\"; return true;' onMouseout='self.status=\"\"; return true;'>" +
									DM.Links[ arrName ][ i ][ 0 ] +
								"</div>" +
							"</td>";
						}

					table += "</tr>";
				}

			table += "</table><br>"; // Trailing <br> for macIE

			DM.Menu = document.createElement( "DIV" );
			document.body.appendChild( DM.Menu );

			DM.OldLink = Link;
			DM.Menu.style.zIndex = 20000;
			DM.Menu.style.visibility = "hidden";
			DM.Menu.style.position = "absolute";
			DM.Menu.style.top = ( screen.height * -1 ) + "px";
			DM.Menu.style.left = ( screen.width * -1 ) + "px";
			DM.Menu.innerHTML = table;

			var ieCSS = ( IE && document.compatMode) ? document.compatMode ==  "CSS1Compat" : false;
			var IeBody = null;
			if( IE ) IeBody = ( ieCSS ) ? document.documentElement : document.body;

			var useLnkPos = ( winIE || MZ || SF ), useEvtPos = !useLnkPos;

			var x = 0, y = 0;
			if( useEvtPos || menuPosition == "relative" ) {
				x = ( IE ) ? e.clientX + IeBody.scrollLeft : e.pageX;
				y = ( IE ) ? e.clientY + IeBody.scrollTop  : e.pageY;
			}
			else {
				var ThisLink = Link;
				var parPosAbs = false;
				while( ThisLink ) {
					if( SF ) {
						if( !parPosAbs ) parPosAbs = ( ThisLink.style.position == "absolute" );
						if( parPosAbs && ThisLink == document.body ) break;
					}
					y += ThisLink.offsetTop;
					x += ThisLink.offsetLeft;
					ThisLink = ThisLink.offsetParent;
				}
			}

			switch( menuPosition ) {

				case "relative":
					var topEdge = ( IE ) ? e.clientY + IeBody.scrollTop : e.pageY;
					topEdge += DM.Links[ arrName ][ nLinks ][ 1 ][ 1 ];
					var leftEdge = ( IE ) ? e.clientX + IeBody.scrollLeft : e.pageX;
					leftEdge += DM.Links[ arrName ][ nLinks ][ 1 ][ 0 ];
					break;

				case "above":
					var skewY = ( useEvtPos ) ? parseInt( Link.offsetHeight / 2 ) : 0;
					var skewX = ( useEvtPos ) ? parseInt( DM.Menu.offsetWidth / 2 ) : 0;
					var topEdge = y - skewY - DM.Menu.offsetHeight + DM.Links[ arrName ][ nLinks ][ 2 ][ 1 ];
					var leftEdge = x - skewX + DM.Links[ arrName ][ nLinks ][ 2 ][ 0 ];
					break;

				case "right":
					var skewX = ( useEvtPos ) ? Link.offsetWidth : 0;
					var topEdge = y + DM.Links[ arrName ][ nLinks ][ 3 ][ 1 ];
					var leftEdge = x - skewX + Link.offsetWidth + DM.Links[ arrName ][ nLinks ][ 3 ][ 0 ];
					break;

				case "below":
					var skewY = ( useEvtPos ) ? parseInt( Link.offsetHeight / 2 ) : 0;
					var skewX = ( useEvtPos ) ? parseInt( DM.Menu.offsetWidth / 2 ) : 0;
					var topEdge = y - skewY + Link.offsetHeight + DM.Links[ arrName ][ nLinks ][ 4 ][ 1 ];
					var leftEdge = x - skewX + DM.Links[ arrName ][ nLinks ][ 4 ][ 0 ];
					break;

				case "left":
					var topEdge = y + DM.Links[ arrName ][ nLinks ][ 5 ][ 1 ];
					var leftEdge = x - DM.Menu.offsetWidth + DM.Links[ arrName ][ nLinks ][ 5 ][ 0 ];
					break;

				default:
					alert( "SWITCH/CASE ERROR: menuPosition \"" + menuPosition + "\" is invalid." );

			}
			var MenuPos = ( typeof keepInWin == "undefined" ) ? DM.keepInWin( topEdge, leftEdge, IeBody ) : [ topEdge, leftEdge ];
			DM.Menu.style.top = MenuPos[ 0 ] + "px";
			DM.Menu.style.left = MenuPos[ 1 ] + "px";
			DM.Menu.style.visibility = "visible";

		}
	}
	//------------------------------------- METHOD DM -------------------------------------

	function setElemVis( arrName, vis ) {
		if( winIE && DM.formElements ) {
			for( member in DM.formElements ) {
				if( vis == "visible" || arrName == DM.formElements[ member ][ 0 ] ) {
					if( document.getElementById( DM.formElements[ member ][ 1 ] ) )
						document.getElementById( DM.formElements[ member ][ 1 ] ).style.visibility = vis;
				}
			}
		}
	}
	//------------------------------------- METHOD DM -------------------------------------
	function resetTimer() {
		clearTimeout( DM.timer );
		DM.timer = 0;
	}
}

////////////////////////////////// END DYNAMIC MENU //////////////////////////////////


////////////////////////// START COLLAPSABLE/EXPANDABLE INDEX CE //////////////////////////

/*
ACCESSOR VARIABLES: None
ACCESSOR FUNCTIONS: None
ACCESSOR STYLES: Yes, see "COLLAPSABLE INDEX STYLES"
*/

//-------------------------------- OBJECT CONSTRUCTOR CE --------------------------------

function ColExpIndex( showToggleAllLink ) {

	// Begin User Settings -------------------------
	this.msg = new Array();
	this.msg[ "show" ] = "Click to expose content";
	this.msg[ "hide" ] = "Click to hide content";

	this.toggleLink = new Array();
	this.toggleLink[ "show" ] = [ "Show All Content", "Show (expose) all content on page" ];
	this.toggleLink[ "hide" ] = [ "Hide All Content", "Hide (collapse) all content on page" ];

	// Do not edit past this line -------------------------
	this.getPlusMinus = getPlusMinus;
	this.switchDisplay = switchDisplay;
	this.showTip = showTip;
	this.toggleAll = toggleAll;
	this.init = init;

	if( showToggleAllLink ) {
		var Link = document.getElementById( "ceToggleAllLink" );
		Link.innerHTML = "<A HREF='javascript:void( 0 );' onClick='CE.toggleAll( this ); return false;' onMouseover='self.status=this.title; return true;' onMouseout='self.status=\"\"; return true;' TITLE='" + this.toggleLink.show[ 1 ] + "' CLASS='toggleAllLink'>" + this.toggleLink.show[ 0 ] + "</A>";

	}

	//------------------------------------ METHOD CE ------------------------------------

	function init() {

		// Use the file name as cookie name
		var path = document.location.pathname;
		var delimeter = ( path.indexOf( "\\" ) >= 0 ) ? "\\" : "/";
		var Path = path.split( delimeter );
		var fileName = Path[ Path.length - 1 ];
		this.cookieName = fileName.split( "." )[ 0 ];
		var ceState = GetCookie( this.cookieName );

		if( ceState ) {

			var AllLinks = document.getElementsByTagName( "a" );
			var CeState = ceState.split( "_" );

			// Loop all links on page
			for ( var i = 0; i < AllLinks.length; i++ ) {
				for( var k in CeState ) {
					if( CeState[ k ] && parseInt( CeState[ k ] ) == i ) {
						try{ CE.switchDisplay( AllLinks[ i ] ) } catch( e ){};
					}
				}
			}
		}
	}

	//------------------------------------ METHOD CE ------------------------------------

	function getPlusMinus( Link ) { return Link.parentNode.firstChild; }

	//------------------------------------ METHOD CE ------------------------------------

	function switchDisplay( Link ) {

		var PlusMinus = getPlusMinus( Link );
		var expanding = ( PlusMinus.innerHTML == "+" ), contracting = !expanding;
		PlusMinus.innerHTML = ( expanding ) ? "-" : "+";

		var AllLinks = document.getElementsByTagName( "a" );

		var valOld = GetCookie( this.cookieName ), valNew = "";

		// Record State; loop all links on page
		for ( var i = 0; i < AllLinks.length; i++ ) {

			// Found link just clicked
			if( AllLinks[ i ] == Link ) {

				// Existing cookie present
				if( valOld ) {
					var key = "_" + i + "_";
					// this i value already recorded
					if( valOld.indexOf( key ) >= 0 ) {
						// Remove this entry
						if( contracting ) {
							var ValOld = valOld.split( key );
							valNew = ( ( ValOld[ 0 ] ) ? ValOld[ 0 ] : "" ) + "_" + ( ( ValOld[ 1 ] ) ? ValOld[ 1 ] : "" );
							valNew == ( "_" ) ? DeleteCookie( this.cookieName ) : SetCookie( this.cookieName, valNew );
						}
						break;
					}
					if( expanding ) valNew = valOld + i + "_";
				}
				else // First expansion; no cookie set
					valNew = "_" + i + "_";

				SetCookie( this.cookieName, valNew );
				break;
			}
		}

		var Content = ( Link.parentNode.nextSibling.style ) ?
			Link.parentNode.nextSibling :
			Link.parentNode.nextSibling.nextSibling;

		Content.style.display = ( Content.style.display == "block" ) ? "none" : "block";
		showTip( Link );

	}


	//------------------------------------ METHOD CE ------------------------------------

	function showTip( Link ) {

		var PlusMinus = getPlusMinus( Link );

		if( PlusMinus.innerHTML == "+" ) {
			Link.title = CE.msg.show;
			self.status = CE.msg.show;
		}
		else {
			Link.title = CE.msg.hide;
			self.status = CE.msg.hide;
		}

	}
	//------------------------------------ METHOD CE ------------------------------------

	function toggleAll( Link ) {

		var Divs = document.getElementsByTagName( "span" );

		var showAll = ( Link.innerHTML == CE.toggleLink.show[ 0 ] ) ? true : false;

		for ( var i = 0; i < Divs.length; i++ ) {

			if( Divs[i].className == "cePlusMinus" ) {

				var TheLink = Divs[i].parentNode.firstChild;

				if( showAll ) {
					if( Divs[i].innerHTML == "+" ) switchDisplay( TheLink );
				}

				else {
					if ( Divs[i].innerHTML == "-" ) switchDisplay( TheLink );
				}
			}

		}

		if( showAll ) {
			Link.innerHTML = CE.toggleLink.hide[ 0 ];
			Link.title = CE.toggleLink.hide[ 1 ];
			Link.focus();
			window.scrollBy( 0, 10 );
		}
		else {
			Link.innerHTML = CE.toggleLink.show[ 0 ];
			Link.title = CE.toggleLink.show[ 1 ];
			Link.focus();
		}
	}
}
////////////////////////// END COLLAPSABLE/EXPANDABLE CE //////////////////////////

function hideBkg() {
	var Element = document.getElementById( "bkg" );
	Element.style.backgroundImage = "none";
}

//--------------------------------------------------------------------------------------

function largePic( cap, wid, hgt, Link, evt ) {

	if( window.DW ) {
		DW.createWindow( [ cap, "imgSrc=" + Link.href ], Link, evt, [ 1, 10, 10 ], [ 0, wid, hgt ] );
		return false;
	}
	else
		return true;
}
///////////////////////////////// DYNAMIC WINDOW DW /////////////////////////////////
/*
	ACCESSOR VARS:  IE, MZ, SF, macIE, winIE
	ACCESSOR FUNC:  String.replaceLiteral
	ACCESSOR CLASS: dw*, off
*/
//--------------------------------------------------------------------------------------

function getCloseLinkDW( divStyle ) {
	return "<div style='" + divStyle + "'>" +
		"<a href='javascript:DW.removeWin();' onMouseOver='self.status=this.title; return true;' onMouseOut='self.status=\"\"; return true;' title='Close this pop-up window' class='dwCloseLink'>Close</a>" +
	"</div>";
}

//--------------------------------- OBJECT CONSTRUCTOR DW ---------------------------------

function DynamicWindow( transNum, transDur ) {

	// Editable Settings
	this.dissolveMZ = 1;
	this.dissolveSF = 1;
	this.gDisableContextImgMenu = false;

	this.Msg = new Array();
	this.Msg[ "fullSize" ] = "View this image full-size";

	// Do not edit past this line -------------------------
	this.transNum = ( transNum ) ? transNum :   2;
	this.transDur = ( transDur ) ? transDur : 0.8;

	// Variables
	this.dWinOffsetX = 0;
	this.dWinOffsetY = 0;
	this.Window = null;
	this.overTitleBar = false;
	this.Photo = null;
	this.disableContextImgMenu = false;

	// Methods
	this.createWindow = createWindow;
	this.showImg = showImg;
	this.keepInWin = keepInWin;
	this.getClickPosition = getClickPosition;
	this.getIeBody = getIeBody;
	this.getData = getData;
	this.mouseDown = mouseDown;
	this.mouseMove = mouseMove;
	this.removeWin = removeWin;
	this.mouseUp = mouseUp;
	this.dissolve = dissolve;

	document.onmousedown = this.mouseDown;
	document.onmousemove = this.mouseMove;
	document.onmouseup = this.mouseUp;

	//------------------------------------- METHOD DW -------------------------------------

	function createWindow( dataSrc, TheLink, theEvent, RequestedPos, WinDim, bodyMargin, disableContextImgMenu ) {

		if( TheLink ) TheLink.blur();

		if( !bodyMargin ) bodyMargin = 0;
		this.disableContextImgMenu = ( typeof disableContextImgMenu == "boolean" ) ? disableContextImgMenu : this.gDisableContextImgMenu;

		var Data = getData( dataSrc, TheLink ), title, body;
		title = Data[ 0 ].replaceLiteral( '^^', "'" );
		title = title.replaceLiteral( '^', "\"" );
		body =  Data[ 1 ].replaceLiteral( '^^', "'" );
		body =  body.replaceLiteral( '^', "\"" );

		// Read vals from 4-member RequestedPosition
		var clickPos     = ( RequestedPos[ 0 ] == 1 );
		var aboveClkPos  = ( RequestedPos[ 0 ] == 2 );
		var topCent      = ( RequestedPos[ 0 ] == 3 );
		var center       = ( RequestedPos[ 0 ] == 4 );
		var botCent      = ( RequestedPos[ 0 ] == 5 );
		var xOffset    = RequestedPos[ 1 ];
		var yOffset    = RequestedPos[ 2 ];

		// Read vals from 3-member WindowDimension, if image then get wid/hgt from tag
		var showImg = ( body.indexOf( "imgSrc=" ) == 0 );
		// overflow:auto creates vert scroll bars if content does not fit
		var scrollStyle = ( WinDim[ 0 ] ) ? " overflow:auto;" : "";
		var winWid = WinDim[ 1 ];
		var winHgt = WinDim[ 2 ];

		if( showImg ) {

			var mzDissolve = ( MZ && this.dissolveMZ && this.dissolve( winWid, winHgt ) );
			var sfDissolve = ( SF && this.dissolveSF );

			// Create image tag
			var body = "<img src='" + body.split( "imgSrc=" )[ 1 ] + "' width='" + winWid + "' height='" + winHgt + "' border='0' hspace='0' vspace='0' galleryimg='no' style='" + getOpacity( sfDissolve, mzDissolve ) + "' onload='DW.showImg( this );' onAbort='this.src=this.src;'" + ">";

			this.title = title; // Store actual title

			var titleLC = title.toLowerCase(), lineBrks = "";
			var nLinesInTitle = titleLC.split( "<br>" ).length;
			for( var i = 0; i < nLinesInTitle; i++ ) lineBrks += "<br>";

			title = "Loading Image..." + lineBrks;
		}


		var Window = document.getElementById( "dWinID" );
		if( Window ) document.body.removeChild( Window );

		var NewWindow = document.createElement( "DIV" ), scrollSt, bodyHgtSt;

		bodyHgtStyle = ( winHgt ) ? " height:" + winHgt + "px;" : "";
		NewWindow.id = "dWinID";
		NewWindow.className = "dwWin";
		document.body.appendChild( NewWindow );
		NewWindow.style.visibility = "hidden"
		NewWindow.style.position = "absolute";
		NewWindow.style.width = ( IE ) ? ( winWid + 2 * parseInt( NewWindow.currentStyle[ "borderWidth" ] ) ) + "px" : winWid + "px";
		NewWindow.style.top = ( screen.height * -1 ) + "px";
		NewWindow.style.left = ( screen.width * -1 ) + "px";
		NewWindow.style.zIndex = 10000;

		var myWindow = "" +

		"<div class='dwTitleRow' id='dwTitleRowID'>" +
			"<table align='center' border='0' cellspacing='0' cellpadding='0'>" +
				"<tr>" +
					"<td class='dwTitle' style='width:100%; text-align:center;' onmouseover='DW.overTitleBar=true; if( macIE ) style.cursor=\"text\";' onmouseout='DW.overTitleBar=false;' id='dwTitleTd1ID'>" +
						"<div id='dwTitleBarID'>" +
							title +
						"</div>" +
					"</td>" +
					"<td valign='top' id='dwTitleTd2ID'>" +
						"<a href='javascript:DW.removeWin();' onMouseOver='self.status=this.title; return true;' onMouseOut='self.status=\"\"; return true;' onClick='this.blur(); return true;' title='Close this pop-up window' class='dwX' style='font-size:" + ( ( macIE ) ? 100 : 130 ) + "%;'>&times;</a>" +
					"</td>" +
				"</tr>" +
			"</table>" +
		"</div>" +

		"<div class='" + ( ( showImg ) ? "dwBodyParentImg" : "dwBodyParent" ) + "' style='width:100%;" + bodyHgtStyle + scrollStyle + "'>" +
			"<div class='dwBody' id='dwBodyID' style='margin:" + bodyMargin + "px;'>" +
				body +
			"</div>" +
		"</div>";

		NewWindow.innerHTML = myWindow;
		var xPos, yPos;

		// 1) Place at click position & add offset (if any)
		if( clickPos ) {
			var ClickPos = getClickPosition( theEvent );
			xPos = ClickPos[ 0 ] + xOffset;
			yPos = ClickPos[ 1 ] + yOffset;
		}

		// 2) Place above click position & add offset (if any)
		else if ( aboveClkPos ) {
			var ClickPos = getClickPosition( theEvent );
			xPos = ClickPos[ 0 ] + xOffset;
			yPos = ClickPos[ 1 ] - NewWindow.offsetHeight + yOffset;
		}


		// 3, 4 or 5) vAlign: Top center (3), Center (4) or Bot Center (5)
		else if( topCent || center || botCent ) {

			var IeBody, scrollX, scrollY, bodyWid, bodyHgt;

			if( IE ) {
				IeBody = getIeBody();
				scrollX = IeBody.scrollLeft;
				scrollY = IeBody.scrollTop;
				bodyWid = IeBody.clientWidth;
				bodyHgt = IeBody.clientHeight;
			}
			else {
				scrollX = window.pageXOffset;
				scrollY = window.pageYOffset;
				bodyWid = window.innerWidth;
				bodyHgt = window.innerHeight;
			}

			winHgt = NewWindow.offsetHeight;
			winWid = NewWindow.offsetWidth;

			xPos = parseInt( ( bodyWid - winWid ) / 2 + scrollX + xOffset );
			if( topCent ) yPos = parseInt( scrollY + yOffset );
			else if( center ) yPos = parseInt( ( bodyHgt - winHgt ) / 2 + scrollY + yOffset );
			else yPos = parseInt( bodyHgt - winHgt + scrollY + yOffset );

		}

		var NewWindowPos = keepInWin( NewWindow, xPos, yPos );
		xPos = NewWindowPos[ 0 ];
		yPos = NewWindowPos[ 1 ];

		NewWindow.style.left = xPos + "px";
		NewWindow.style.top  = yPos + "px";
		NewWindow.style.visibility = "visible";

	}

	//------------------------------------- METHOD DW -------------------------------------

	function showImg( Photo ) {

		Photo.onclick = DW.removeWin;
		Photo.oncontextmenu = function() { if( DW.disableContextImgMenu ) return false; };
		Photo.onmouseover = function() {
			Photo.title = "Click to close this pop-up window";
			self.status = Photo.title;
			Photo.style.cursor = ( IE ) ? "hand" : "pointer";
			return true;
		};
		Photo.onmouseout = function() { self.status = ""; return true; };

		if( local ) {
			var imgNum = -1;
			for( var i = 0; i < document.images.length; i++ ) { if( document.images[ i ] == Photo ) { imgNum = i; break; } }

			var ImgReal = new Image();
			ImgReal.src = eval( "document.images[" + imgNum + "].src;" );

			if( ImgReal.complete ) {
				var realWid = ImgReal.width, realHgt = ImgReal.height;
				if( realWid > 1 && realHgt > 1 && ( realWid != Photo.width || realHgt != Photo.height ) )
					alert( ImgReal.src + " has incorrect dimensions set: \n\n  1) " + Photo.width + " x " + Photo.height + " are the errant values \n  2) " + realWid + " x " + realHgt + " are the true values" );
			}
		}

		document.getElementById( "dwTitleBarID" ).innerHTML = this.title;

		var mzDissolve = ( MZ && this.dissolveMZ && this.dissolve( Photo.width, Photo.height ) );
		var sfDissolve = ( SF && this.dissolveSF );

		startFade( Photo, this.transNum, this.transDur, 0, sfDissolve, mzDissolve );

	}

	//------------------------------------- METHOD DW -------------------------------------

	function keepInWin( NewWindow, leftEdge, topEdge ) {

		if( IE ) var IeBody = getIeBody();

		var bodyHgt = ( IE ) ? IeBody.clientHeight : window.innerHeight;
		var bodyWid = ( IE ) ? IeBody.clientWidth : window.innerWidth;

		// Prevent window from going off bottom & top of page
		var winHgt = NewWindow.offsetHeight;
		var yOffset = ( IE ) ? IeBody.scrollTop : window.pageYOffset;
		var vScreenPos = topEdge - yOffset;
		var vSkew = bodyHgt - vScreenPos;
		if( vSkew < winHgt + 10 ) topEdge -= winHgt - vSkew + 10; // bottom edge
		else if( vScreenPos < 10 ) topEdge = 10 + yOffset; // top edge

		// Prevent window from going off right & left edges
		var winWid = NewWindow.offsetWidth;
		var xOffset = ( IE ) ? IeBody.scrollLeft : window.pageXOffset;
		var hScreenPos = leftEdge - xOffset;
		var hSkew = bodyWid - hScreenPos;
		if( hSkew < winWid + 10 ) { // right edge
			leftEdge -= winWid - hSkew + 10;
			// Vert scroll bar is present
			if( !IE && document.body.scrollHeight > bodyHgt ) leftEdge -= 15;
		}
		else if( hScreenPos < 10 ) leftEdge = 10 + xOffset; // left edge

		return[ leftEdge, topEdge ];
	}
	//------------------------------------- METHOD DW -------------------------------------

	function getIeBody() {
		var ieCSS = ( document.compatMode) ? document.compatMode ==  "CSS1Compat" : false;
		return ( ieCSS ) ? document.documentElement : document.body;
	}
	//------------------------------------- METHOD DW -------------------------------------

	function getClickPosition( theEvent ) {

		try {
			if( IE ) IeBody = getIeBody();
			var x = ( IE ) ? event.clientX + IeBody.scrollLeft : theEvent.pageX;
			var y = ( IE ) ? event.clientY + IeBody.scrollTop  : theEvent.pageY;
		}
		// Catch exceptions when action does not create an event, like when
		// creating window from MZ selecting pull-down
		catch( err ) {
			var x = 0;
			var y = 0;
		}

		return[ x, y ];
	}
	//------------------------------------- METHOD DW -------------------------------------

	function getData( dataSrc, TheLink ) {

		// Get the data...
		if( dataSrc == "nextSibling" ) {

			// If we have old innerHTML then put it back where it belongs
			if( eval( "typeof this.LastSrc" ) == "object" )
				eval( "this.LastSrc.innerHTML = this.lastData" );

			try {
				var DataSource = ( TheLink.nextSibling.innerHTML ) ? TheLink.nextSibling : TheLink.nextSibling.nextSibling;
			}
			catch( err ) { alert( "EXCEPTION: Data source not found" ); return false; }

			try {
				var Title = ( DataSource.firstChild.innerHTML ) ? DataSource.firstChild : DataSource.firstChild.nextSibling;
				var title = Title.innerHTML;
			}
			catch( err ) { alert( "EXCEPTION: Title source not found" ); return false; }

			try {
				var Body = ( Title.nextSibling.innerHTML ) ? Title.nextSibling : Title.nextSibling.nextSibling;
				var body = Body.innerHTML;
			}
			catch( err ) { alert( "EXCEPTION: Body source not found" ); return false; }

			// Record this Source as Object & record innerHTML
			eval( "this.LastSrc = DataSource" );
			eval( "this.lastData = DataSource.innerHTML" );
			DataSource.innerHTML = "";

		}
		else {
			var title = dataSrc[ 0 ];
			var body  = dataSrc[ 1 ];
		}

		return[ title, body ];

	}

	//------------------------------------- METHOD DW -------------------------------------
	// Record x & y offset within dWin and set this.Window
	function mouseDown( e ) {

		if( DW.overTitleBar && !macIE ) {

			this.Window = document.getElementById("dWinID");

			if( IE ) {
				this.dWinOffsetX = event.offsetX;
				this.dWinOffsetY = event.offsetY;
			}
			else {
				this.dWinOffsetX = e.layerX;
				this.dWinOffsetY = e.layerY;
				return false;
			}
		}
	}

	//------------------------------------- METHOD DW -------------------------------------

	function mouseMove( e ) {
		if( this.Window ) {

			var ClickPos = getClickPosition( e );
			// Don not let user move menu off left or top edge of screen
			if( ClickPos[ 0 ] <= 0 ||  ClickPos[ 1 ] <= 0 ) {
				this.Window = null;
				return false;
			}

			if( IE ) {
				if( event.button != 1 ) return false; // mouse moved off screen
				this.Window.style.left = event.clientX - this.dWinOffsetX + document.body.scrollLeft;
				this.Window.style.top = event.clientY - this.dWinOffsetY + document.body.scrollTop;
				return false;
			}

			else {
				this.Window.style.top = e.pageY - this.dWinOffsetY;
				this.Window.style.left = e.pageX - this.dWinOffsetX;
			 }
		 }
	}

	//------------------------------------- METHOD DW -------------------------------------

	function removeWin() { // called by x only or clicking photo
		var Window = document.getElementById( "dWinID" );
		if( Window ) {
			Window.innerHTML = "";
			document.body.removeChild( Window );
		}
	}

	//------------------------------------- METHOD DW -------------------------------------

	function mouseUp() { this.Window = null; }

	//------------------------------------- METHOD DW -------------------------------------

	function dissolve( wid, hgt ) {
		var imgArea = wid * hgt;
		var maxImgArea = 450 * 450;
		return ( imgArea <= maxImgArea );
	}

}

////////////////////////////////// END DYNAMIC WINDOW //////////////////////////////////

//--------------------------------------------------------------------------------------

function reportErr( sub, msg, msgType ) {

	function eMail() {
		document.location.href = "mailto:" + DB.Contact.SendErrTo + "?subject=" + escape( DB.Contact.Company + "; " + sub ) + "&body=" + escape( msg + " \n\nDIAGNOSTICS: This info may be used to help us troubleshoot any technical problems" + diagnostics );
	}

	var Now = new Date();

	var diagnostics = " \nURL: " + document.location.href;

	try{ var topURL = top.document.location.href; }
	catch( e ){ var topURL = "Exception thrown while reading top URL"; }

	diagnostics += " \nTop URL: " + topURL;
	diagnostics += " \nTime: " + Now.toLocaleString() + " (client's time)";
	diagnostics += " \nGMT Offset: " + Now.getTimezoneOffset() / 60 + " hours";
	diagnostics += " \nMonitor: " + screen.width + "x" + screen.height + "x" + screen.colorDepth;
	diagnostics += " \nJava Enabled: " + navigator.javaEnabled();
	for( i in navigator ) { if( typeof navigator[ i ] != "object" ) diagnostics += " \n" + i + ": " + navigator[ i ]; }

	diagnostics += "\n\nINSTALLED PLUG-INS: " +
	"\n1. Scalable Vector Graphics Viewer: " + getPlugIn( "Adobe.SVGCtl", "image/svg-xml" ) +
	"\n2. Shockwave Director: " + getPlugIn( "SWCtl.SWCtl.1", "application/x-director" ) +
	"\n3. Shockwave Flash: " + getPlugIn( "ShockwaveFlash.ShockwaveFlash.1", "application/x-shockwave-flash" ) +
	"\n4. RealPlayer: " + getPlugIn( "rmocx.RealPlayer G2 Control.1", "audio/x-pn-realaudio-plugin" ) +
	"\n5. QuickTime: " + getPlugIn( "QuickTimeCheckObject.QuickTimeCheck.1", "video/quicktime" ) +
	"\n6. Windows Media Player: " + getPlugIn( "MediaPlayer.MediaPlayer.1", "application/x-mplayer2" ) +
	"\n7. Acrobat Reader: " + getPlugIn( "PDF.PdfCtrl.5", "application/pdf" );

	switch( msgType ) {

		case 0:
			eMail();
			break;

		case 1:
			if( confirm ( sub + "\n\n" + msg + "\n\nPlease help us improve our site, click OK to report this problem to our Web Site Administrator..." ) )
				eMail();
			break;

		case 2:
			if( confirm ( "Help us improve our site: Please report a technical issue to the Web Master.\n\nNOTE: Your e-mail will be delivered to the Web Master. If you are trying to contact the web-site owner or staff, click Cancel and use the e-mail link and/or contact form found on our web site." ) )
				eMail();
			break

	}
}
//--------------------------------------------------------------------------------------

function getErrLink() {

	return "<A HREF='javascript:reportErr( \"A Web Site Problem\", \"PLEASE DESCRIBE THE PROBLEM YOU EXPERIENCED: \", 2 )' onMouseOver='self.status=this.title; return true;' onMouseOut='self.status=\"\"; return true;' onContextMenu='showReferrer(); return false;' TITLE='Report a technical problem to the WebMaster' style='text-decoration:underline; font-size:9pt;'>Report a Problem</a>";

}

//--------------------------------------------------------------------------------------

function goToPWH( wedDate, gLast, Link, evt ) {
	if( gLast ) {
		document.location.href = ( live ) ? "https://www.hawaiivideomemories.com/client.aspx?wedDate=" + wedDate + "&grLast=" + gLast : "client.aspx?wedDate=" + wedDate + "&grLast=" + gLast;
		return false;
	}
}