var newWindow;
var newwindow2;
var newwindow3;
var newwindow7;
var newwindow8;

Image1 = new Image();
Image1.src = "../graph3d/3dmap_anim.gif"

Image2 = new Image();
Image2.src = "../graph3d/3dmap_anim2.gif"

//Image3 = new Image();
//Image3.src = "../graph3d/3dMapFlip03.jpg"

var counter = 0;


function makeWindow(url) {
	newWindow = window.open(url,'myWindow','scrollbars=no,status=no,width=290,height=140,screenX=200,screenY=50,top=50,left=200');
	if (newWindow.opener == null) newWindow.opener = self;
}
function makeWindowIND(URL) {
	newWindowIND = window.open(URL,'myWindowIND','scrollbars=no,status=no,width=510,height=500,screenX=400,screenY=50,top=50,left=400')
	if (newWindowIND.opener == null) newWindowIND.opener = self;
}
function makeWindowSCgal(URL) {
	newWindowIND = window.open(URL,'myWindowIND','scrollbars=no,status=no,width=510,height=500,screenX=400,screenY=50,top=50,left=400')
	if (newWindowIND.opener == null) newWindowIND.opener = self;
}
function makeWindowVideo(URL) {
	newWindowIND = window.open(URL,'myWindowIND','scrollbars=no,status=no,width=660,height=420,screenX=400,screenY=50,top=50,left=400')
	if (newWindowIND.opener == null) newWindowIND.opener = self;
}
function makeWindowVideo2(URL) {
	newWindowIND = window.open(URL,'myWindowIND','scrollbars=no,status=no,width=520,height=440,screenX=400,screenY=50,top=50,left=400')
	
if (newWindowIND.opener == null) newWindowIND.opener = self;

}
function makeWindowY() {
	win_pic = window.open("exphthNovCh.html", "win_pic", "width=720,height=520,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,top=30,left=20");
	//win_news.focus();
}


function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function popPic(url)
{
	newwindow=window.open(url,'pictureWindow','height=540,width=540,top=75,left=100,scrollbars=no,resizable=no');
	if (window.focus) {newwindow.focus()}
}
function popPix(url,high,wide)
{
	newwindow=window.open(url,'pictureWindow','height='+high+',width='+wide+',top=75,left=100,scrollbars=no,resizable=no');
	if (window.focus) {newwindow.focus()}
}


function Popup1(picname) {
	var newwindow;
	if (!newwindow) {
		newwindow = window.open('','newwindow','width=383,height=620,left=50,top=50');
		//newwindow.document.Image1.src="../graphgal/gal02_B.jpg"
		newwindow.document.write('<head>')
		newwindow.document.write('<!--<title>Hockey Hall of Fame - Exhibits Tour - Great Hall</title> -->')
		newwindow.document.write('</head>')
		newwindow.document.write('<body MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" TOPMARGIN="0">')
		newwindow.document.write('<IMG name="Image1"  WIDTH="383" HEIGHT="600" ALT="" BORDER="0">')
		newwindow.document.write('<a href="#" onclick="self.close();return false;"><IMG src="../graphics/closeExPics.gif"  WIDTH="383" HEIGHT="24" ALT="" BORDER="0"></a>')
		newwindow.Image1.src=picname
		if (window.focus) {newwindow.focus()};
	};
}
function Popup2(picname) {
	var newwindow;
	if (!newwindow) {
		newwindow = window.open('','newwindow','width=500,height=400,left=50,top=50');
		//newwindow.document.Image1.src="../graphgal/gal02_B.jpg"
		newwindow.document.write('<head>')
		newwindow.document.write('<!--<title>Hockey Hall of Fame - Spirit of Hockey Retail Store</title> -->')
		newwindow.document.write('')
		newwindow.document.write('<body MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" TOPMARGIN="0">')
		newwindow.document.write('<IMG name="Image1" src="'+picname+'" WIDTH="500" HEIGHT="375" ALT="" BORDER="0">')
		newwindow.document.write('<div align="center"><a href="#" onclick="self.close();return false;"><IMG src="../graphics/closeExPics.gif"  WIDTH="383" HEIGHT="24" ALT="" BORDER="0"></a></div>')
		newwindow.Image1.src=picname
		if (window.focus) {newwindow.focus()};
	};
}
function Popup3(picname) {
	var newwindow;
	if (!newwindow) {
		newwindow = window.open('','newwindow','width=600,height=424,left=50,top=50');
		//newwindow.document.Image1.src=""
		newwindow.document.write('<head>')
		newwindow.document.write('<!--<title>Hockey Hall of Fame Facility Rentals - Event Gallery</title>-->')
		newwindow.document.write('</head>')
		newwindow.document.write('<body MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" TOPMARGIN="0">')
		newwindow.document.write('<IMG name="Image1" src="'+picname+'" WIDTH="600" HEIGHT="400" ALT="" BORDER="0">')
		newwindow.document.write('<a href="#" onclick="self.close();return false;"><IMG src="../graphFacRental/closePicWide.gif"  WIDTH="600" HEIGHT="24" ALT="" BORDER="0"></a>')
		newwindow.Image1.src=picname
		if (window.focus) {newwindow.focus()};
	};
}
function Popup4(picname) {
	var newwindow;
	if (!newwindow) {
		newwindow = window.open('','newwindow','width=400,height=624,left=50,top=50');
		//newwindow.document.Image1.src=""
		newwindow.document.write('<head>')
		newwindow.document.write('<!--<title>Hockey Hall of Fame Facility Rentals - Event Gallery</title>-->')
		newwindow.document.write('</head>')
		newwindow.document.write('<body MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" TOPMARGIN="0">')
		newwindow.document.write('<IMG name="Image1" src="'+picname+'" WIDTH="400" HEIGHT="600" ALT="" BORDER="0">')
		newwindow.document.write('<a href="#" onclick="self.close();return false;"><IMG src="../graphFacRental/closePicHigh.gif"  WIDTH="400" HEIGHT="24" ALT="" BORDER="0"></a>')
		newwindow.Image1.src=picname
		if (window.focus) {newwindow.focus()};
	};
}

function popupVideo(url)
{
	newwindow2=window.open(url,'popupVideo','height=325,width=512,top=75,left=100,scrollbars=no,resizable=no');
	if (window.focus) {newwindow2.focus()}
}
function popupVideo2(url)
{
	newwindow=window.open(url,'pictureWindow','height=520,width=640,top=75,left=100,scrollbars=no,resizable=no');
	if (window.focus) {newwindow.focus()}
}
function popupVideo4(url)
{
	newwindow=window.open(url,'pictureWindow','height=400,width=640,top=75,left=100,scrollbars=no,resizable=no');
	if (window.focus) {newwindow.focus()}
}
function popupVideo3(url)
{
	newwindow2=window.open(url,'popupVideo','height=280,width=320,top=75,left=100,scrollbars=no,resizable=no');
	if (window.focus) {newwindow2.focus()}
}

function popupVideoLetterbox(url)
{
	newwindow7=window.open(url,'pictureWindow','height=420,width=720,top=75,left=100,scrollbars=no,resizable=no');
	if (window.focus) {newwindow7.focus()}
}

function popupVideoLetterbox2(url)
{
	newwindow8=window.open(url,'pictureWindow','height=400,width=640,top=75,left=100,scrollbars=no,resizable=no');
	if (window.focus) {newwindow8.focus()}
}

function popupVideoX(url,high,wide)
{
	newwindow3=window.open(url,'popupVideoX','height='+high+',width='+wide+',top=75,left=100,scrollbars=no,resizable=no');
	if (window.focus) {newwindow3.focus()}
}

function PopUpWindow(URL) {
	var popupAd = window.open(URL,'myWindow','scrollbars=no,status=no,width=350,height=500,screenX=400,screenY=50,top=50,left=400')
	if (popupAd.opener == null) popupAd.opener = self;
}
function PopUpWindow2(URL) {
	var popupAd = window.open(URL,'myWindow','scrollbars=no,status=no,width=350,height=470,screenX=400,screenY=50,top=50,left=400')
	if (popupAd.opener == null) popupAd.opener = self;
}
function PopUpWindow3(URL) {
	var popupAd = window.open(URL,'myWindow','scrollbars=no,status=no,width=350,height=460,screenX=400,screenY=50,top=50,left=400')
	if (popupAd.opener == null) popupAd.opener = self;
}


function printCoupon() {
	newWindow = window.open('bottomLineCoupon.html','prtWindow','scrollbars=no,status=no,width=620,height=130,screenX=100,screenY=50,top=50,left=100')
	if (newWindow.opener == null) newWindow.opener = self;
}

function SlideShow()
{
	counter++;
	if (counter==3) counter = 1;
	img = eval("Image" + counter + ".src");		
	document.flipper.src = img;
	timerID = setTimeout("SlideShow()",4000)	
}


function submitForm() {
	parent.giGroupBookingRequestThanks.location = "http://www.legendsofhockey.net/Insider/pages/hhofFormEmailer.jsp";
}


<!-- hide this script from non-javascript-enabled browsers
if (document.images) {
}
function di(id,name){
  if (document.images) {document.images[id].src=eval(name+".src"); }
}

// function that displays status bar message

function dm(msgStr) {
  document.returnValue = false;
  if (document.images) { 
     window.status = msgStr;
     document.returnValue = true;
  }
}
var showMsg = navigator.userAgent != "Mozilla/4.0 (compatible; MSIE 4.0; Mac_PowerPC)";
function dmim(msgStr) {
  document.returnValue = false;
  if (showMsg) { 
    window.status = msgStr;
    document.returnValue = true;
  }
}

// stop hiding -->


/* This script is Copyright (c) Paul McFedries and 
Logophilia Limited (http://www.mcfedries.com/).
Permission is granted to use this script as long as 
this Copyright notice remains in place.*/

function CalculateTotal(frm) {
    var order_total = 0
	var guest_total = 0

    // Run through all the form fields
    for (var i=0; i < frm.elements.length; ++i) {

        // Get the current field
        form_field = frm.elements[i]

        // Get the field's name
        form_name = form_field.name

        // Is it a "product" field?
        if (form_name.substring(0,4) == "PROD") {

            // If so, extract the price from the name
            item_price = parseFloat(form_name.substring(form_name.lastIndexOf("_") + 1))

            // Get the quantity
            item_quantity = parseInt(form_field.value)

            // Update the order total and the guest total
            if (item_quantity >= 0) {
                order_total += item_quantity * item_price
				guest_total += item_quantity
            }
        }
    }

    // Display the total rounded to two decimal places
    frm.TOTAL.value = round_decimals(order_total, 2)
	frm.TotalGuests.value = guest_total
}

function round_decimals(original_number, decimals) {
    var result1 = original_number * Math.pow(10, decimals)
    var result2 = Math.round(result1)
    var result3 = result2 / Math.pow(10, decimals)
    return pad_with_zeros(result3, decimals)
}

function pad_with_zeros(rounded_value, decimal_places) {

    // Convert the number to a string
    var value_string = rounded_value.toString()
    
    // Locate the decimal point
    var decimal_location = value_string.indexOf(".")

    // Is there a decimal point?
    if (decimal_location == -1) {
        
        // If no, then all decimal places will be padded with 0s
        decimal_part_length = 0
        
        // If decimal_places is greater than zero, tack on a decimal point
        value_string += decimal_places > 0 ? "." : ""
    }
    else {

        // If yes, then only the extra decimal places will be padded with 0s
        decimal_part_length = value_string.length - decimal_location - 1
    }
    
    // Calculate the number of decimal places that need to be padded with 0s
    var pad_total = decimal_places - decimal_part_length
    
    if (pad_total > 0) {
        
        // Pad the string with 0s
        for (var counter = 1; counter <= pad_total; counter++) 
            value_string += "0"
        }
    return value_string
}
