nCurrentMessage=0;
var overImage=0;
aClickMessages = new Array();
aClickMessages[0] = '';
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] = 'This image is copyright of Westcan Photography';


function SetupContact(website_description)
{
	document.write("<a href=\"mailto:info@heritagecommunityfdn.org?Subject="+website_description+" Web Site\" title=\"Contact us by Email\">Contact us by Email</a>");
}

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=700;
	height=720;

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

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

//used for opening articles

function openWeblinks()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}

function openPhotogallery()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}

function openElementary()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}
function openJunior()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}
function openMedia()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}
function openGeology()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}
function openEcosystems()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}
function openEnvironment()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}
function openNatural()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}

function openEdukitteam()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}

function openComments()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}

function openCredits()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}

function openCopyright()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}

function openThree()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}

function openFour()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}

function openFiveA()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}

function openFiveB()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}

function openSix()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}

function openEight()
{
	nHeight = 550;
	nWidth = 750;

	if(screen.width<800)
	{
		nHeight = 350;
		nWidth = 550;
	}

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


	popup.focus();
}

//Function for Flash Regions Movie
function openRegion(URL)
{
	nHeight = 450;

	if(screen.width<800)
		nHeight = 350;

	URL="../../flash/eng/regions/" + URL;

	regions=window.open(URL,"Regions","width=610,height="+nHeight+",resizable=yes,scrollbars=yes,left=30,top=30");

	regions.focus();
}

function openRegion_fr(URL)
{
	nHeight = 450;

	if(screen.width<800)
		nHeight = 350;

	URL="../../flash/fr/regions/" + URL;

	regions=window.open(URL,"Regions","width=610,height="+nHeight+",resizable=yes,scrollbars=yes,left=30,top=30");

	regions.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();
}

