
//Function to display copyright.

nCurrentMessage=0;
var overImage=0;
aClickMessages = new Array();
aClickMessages[0] = 'Image copyright the City of Edmonton Archives';
aClickMessages[1] = 'This image is copyright of the Glenbow Archives';
aClickMessages[2] = 'This image is copyright of the Provincial Archives';
aClickMessages[3] = 'This image is copyright of the Provincial Museum of Alberta';
aClickMessages[4] = 'Image copyright the Heritage Community Foundation';
aClickMessages[5] = 'Photo courtesy of Pat Tomkow';
aClickMessages[6] = 'Photo courtesy of the Albi family';
aClickMessages[7] = 'Photo courtesy of the Biamonte family and the Italians Settle in Edmonton Oral History Project and booklet of the same name';
aClickMessages[8] = 'Photo courtesy of Mary Biollo Doyle';


function over(n)
{
	overImage=n;
	
}
function disableclick(e) {

clickmessage = aClickMessages[nCurrentMessage];

if(nCurrentMessage != 0)
{
	
	if (document.all) {
		if (event.button>=2||event.button==3) {
			if (event.srcElement.tagName=="IMG"){
				alert(clickmessage);
				return false;
			}
		}
	}
	else if (document.layers) {
		if (e.which == 3) {
			if(overImage==1)
			{
			alert(clickmessage);
			return false;
			}
		}
	}
	else if (document.getElementById){
		if (e.which==3&&e.target.tagName=="IMG"){
			alert(clickmessage)
				return false;
		}
	}
}
}

function associateimages(){
	for(i=0;i<document.images.length;i++)
		document.images[i].onmousedown=disableclick;
}

function init(){
	nCurrentMessage=0;
	overImage=0;
}

if (document.all)
	document.onmousedown=disableclick
else if (document.getElementById)
{	//	document.onmouseup=disableclick
	window.captureEvents(Event.RIGHTCLICK);
	document.onclick = disableclick;
}	
else if (document.layers)
{
	//associateimages()
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=disableclick;
}
document.onmouseout=init

//Create French and English Links

frLink = window.location.href.replace('/eng/','/fr/');
frLink = '<map name="FPMap1"><area href="' + frLink + '" coords="584, 6, 639, 29" shape="rect" alt="English / Français" title="English / Français"></map>';

engLink = window.location.href.replace('/fr/','/eng/');
engLink = '<map name="FPMap1"><area href="' + engLink + '" coords="525, 6, 579, 29" shape="rect" alt="English / Français" title="English / Français"></map>';


//function that swaps pictures
function Switch(id,name)
{
if (document.images){
    if (document.images[id]){document.images[id].src=eval(name+".src");
    } else {
      if (document.layers){
        for (i=0; i < document.layers.length; i++) {
          if (document.layers[i].document.images[id]) {
          document.layers[i].document.images[id].src=eval(name+".src");
          break;
          }
        }
      }
    }
  }
}



//Function to open new windows

function openWin(URL, Width, Height)
{

aWindow=window.open(URL,"PopUp","width="+Width+",height="+Height+",resizable=yes,scrollbars=yes,left=100,top=60");
	
	aWindow.resizeTo(Width, Height);
	
	aWindow.focus();
	if(aWindow.opener == null)
	{
		aWindow.opener = window;
		aWindow.opener.name = "opener";
	}

}

//Function for Dynamic Pop Ups
function DynaPop(level,szImgSource,szDescription,nCopyrightNum)
{
    popSource = szImgSource;
    popDescription = szDescription;
    popCopyright = nCopyrightNum;

    if (popDescription == "description")
        popDescription = "";
    
    width=610;
    height=600;

    //If resolution is 640x480
    if(screen.width < 800)
	{
        height=350;
	width=550;
}
    //If resolution is 800x600
    else if(screen.width < 1024)
        height=500;

    if(level==0)
        openWin("dynapop.htm",width,height);
    
    else if(level==1)
        openWin("../dynapop.htm",width,height)

    else if(level==2)
        openWin("../../../eng/dynapop.htm",width,height)
}              

//used for opening articles

function openPictureboard()
{
	nHeight = 350;
	nWidth = 650;

	if(screen.width<800)
	{
		nHeight = 250;
		nWidth = 450;
	}

	popup=window.open("picture_board.htm","FlashPopUp","width=" + nWidth + ",height="+nHeight+",resizable=yes,scrollbars=yes,left=10,top=10");


	popup.focus();
}

function openFortedmonton()
{
	nHeight = 500;
	nWidth = 600;

	if(screen.width<800)
	{
		nHeight = 400;
		nWidth = 450;
	}

	popup=window.open("fort_edmonton.htm","FlashPopUp","width=" + nWidth + ",height="+nHeight+",resizable=yes,scrollbars=yes,left=10,top=10");


	popup.focus();
}

function openPioneerlife()
{
	nHeight = 500;
	nWidth = 600;

	if(screen.width<800)
	{
		nHeight = 400;
		nWidth = 450;
	}

	popup=window.open("pioneer_life.htm","FlashPopUp","width=" + nWidth + ",height="+nHeight+",resizable=yes,scrollbars=yes,left=10,top=10");


	popup.focus();
}



function openWebLinks()
{
	nHeight = 430;
	nWidth = 650;

	if(screen.width<800)
	{
		nHeight = 430;
		nWidth = 450;
	}

	popup=window.open("web_links.htm","FlashPopUp","width=" + nWidth + ",height="+nHeight+",resizable=yes,scrollbars=yes,left=10,top=10");


	popup.focus();
}


function openHcflinks()
{
	nHeight = 430;
	nWidth = 650;

	if(screen.width<800)
	{
		nHeight = 430;
		nWidth = 450;
	}

	popup=window.open("hcf_links.htm","FlashPopUp","width=" + nWidth + ",height="+nHeight+",resizable=yes,scrollbars=yes,left=10,top=10");


	popup.focus();
}

function openBookfair()
{
	nHeight = 430;
	nWidth = 650;

	if(screen.width<800)
	{
		nHeight = 430;
		nWidth = 450;
	}

	popup=window.open("book_fair.htm","FlashPopUp","width=" + nWidth + ",height="+nHeight+",resizable=yes,scrollbars=yes,left=10,top=10");


	popup.focus();
}



//This is so NetSCape 4 doesn't sketch out when resized
function WM_netscapeCssFix()
{
    // This part was inspired by Matthew_Baird@wayfarer.com
    // It gets around another unfortunate bug whereby Netscape
    // fires a resize event when the scrollbars pop up. This
    // checks to make sure that the window's available size
    // has actually changed.

    if (document.WM.WM_netscapeCssFix.initWindowWidth != window.innerWidth ||             document.WM.WM_netscapeCssFix.initWindowHeight != window.innerHeight)
        {
        document.location = document.location;
        }
}

function WM_netscapeCssFixCheckIn()
{
    // This function checks to make sure the version of Netscape
    // in use contains the bug; if so, it records the window's
    // width and height and sets all resize events to be handled
    // by the WM_netscapeCssFix() function.

    if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4))
        {
        if (typeof document.WM == 'undefined')
            {
            document.WM = new Object;
            }

        if (typeof document.WM.WM_scaleFont == 'undefined')
            {
            document.WM.WM_netscapeCssFix = new Object;
            document.WM.WM_netscapeCssFix.initWindowWidth = window.innerWidth;
            document.WM.WM_netscapeCssFix.initWindowHeight = window.innerHeight;
            }

        window.onresize = WM_netscapeCssFix;
        }
}

WM_netscapeCssFixCheckIn()

function openFootnote(footnote) 
{
	var PopUpString =
         "width=350,height=150,left=100,top=100,scrollbars=yes";
	
	winFootnote = window.open('footnotes.html', "Footnote", PopUpString);
	
	if(winFootnote.opener == null)
	{
		winFootnote.opener = window;
		winFootnote.opener.name = "opener";
	}
	winFootnote.opener.footnote=footnote;
	winFootnote.location.reload();
	winFootnote.focus();
}

