////////////////////////////////////////////////////////////////////////////
function SetVariables(sLanguage){
	//This function initializes the variables and then sends the user to the home page
	document.UpdateContent.Language.value = sLanguage;
	document.UpdateContent.Content.value = "ContentDefinitionFiles\\default.xml";
	document.UpdateContent.submit();
}

function PrintPage()
{
	var objWindow=window.open( "", "PrintWindow", "toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=500,left="+((screen.availWidth - 600 - 10) * .5) + ",top=" + ((screen.availHeight - 500 - 100) * .5) );
	objWindow.focus();	
	document.PrintContent.submit();	
}

function ChangeLanguage(sLanguage){
	//This function submits a hidden form on the page to change the language
	document.UpdateContent.Language.value = sLanguage;
	document.UpdateContent.submit();	
}

function BookmarkPage(sLanguage){
	//This function opens up the bookmark input box allowing a use to create a bookmark
	var sBookMark = document.title;
	var sMessage;

	if(sBookMark == "") {
		sBookMark = "NavCanada";
	}

	if(GetBrowserName() == 'ie') {
		window.external.AddFavorite(document.location.href, sBookMark);
	}
	else {
		if(document.UpdateContent.Language.value == 'EN') {
			sMessage = 'Hit CTRL-D to bookmark this page';
		}
		else {
			sMessage = 'Pressez CTRL-D à marquer cette page d\'un signet.';
		}
		alert(sMessage);
	}
}

// Returns "ns" if current browser is Netscape and "ie" if current browser is "ie".
// If neither, function returns "Unknown".
function GetBrowserName() {
	if(navigator.appName == "Netscape") {
		return("ns")
	}
	if(navigator.appName == "Microsoft Internet Explorer") {
		return("ie")
	}
	else {
		return("Unknown")
	}
}

function GetBrowserMaxVersion()
{
	version=parseInt(navigator.appVersion);
	document.write(version);
}

// Functions generated by DreamWeaver for rollover images
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;
}

// This function exists to remove the clutter from the asp scripts.
function PreloadImages() {
	MM_preloadImages('/images/main/Landing_en_22.jpg', '/images/main/Landing_en_23.jpg', '/images/main/Landing_en_24.jpg',
	                 '/images/main/Landing_en_25.jpg', '/images/main/landing_en_27.gif', '/images/main/Landing_en_32.gif',
	                 '/images/main/landing_en_35.gif', '/images/main/landing_fr_22.jpg', '/images/main/landing_fr_23.jpg',
					 '/images/main/Landing_fr_24.jpg', '/images/main/Landing_fr_25.jpg',
					 '/images/Top/Landing_en_01.jpg', '/images/Top/Landing_en_02.gif', '/images/Top/Landing_en_03.gif',
					 '/images/Top/Landing_en_04.gif', '/images/Top/Landing_en_05.gif', '/images/Top/Landing_en_06.gif',
					 '/images/Top/Landing_en_07.gif', '/images/Top/Landing_en_08.gif', '/images/Top/Landing_en_09.gif',
					 '/images/Top/Landing_en_11.gif', '/images/Top/Landing_en_13.gif', '/images/Top/Landing_en_15.gif',
					 '/images/Top/Landing_en_17.gif', '/images/Top/Landing_en_19.gif', '/images/Top/Landing_en_21.gif',
					 '/images/Top/LandingMO_en_11.gif', '/images/Top/LandingMO_en_13.gif',
					 '/images/Top/LandingMO_en_15.gif', '/images/Top/LandingMO_en_17.gif', '/images/Top/LandingMO_en_19.gif',
					 '/images/Top/LandingMO_en_21.gif', '/images/Top/Landing_fr_01.jpg', '/images/Top/Landing_fr_02.gif',
                     '/images/Top/Landing_fr_03.gif', '/images/Top/Landing_fr_04.gif', '/images/Top/Landing_fr_05.gif',
                     '/images/Top/Landing_fr_06.gif', '/images/Top/Landing_fr_07.gif', '/images/top/Landing_en_08.gif',
                     '/images/Top/Landing_fr_09.gif', '/images/Top/Landing_fr_11.gif', '/images/Top/Landing_fr_13.gif',
                     '/images/Top/Landing_fr_15.gif', '/images/Top/Landing_fr_17.gif', '/images/Top/Landing_fr_19.gif',
                     '/images/Top/Landing_fr_21.gif', '/images/Top/LandingMO_fr_14.gif', '/images/Top/LandingMO_fr_16.gif',
                     '/images/Top/LandingMO_fr_18.gif', '/images/Top/LandingMO_fr_20.gif', '/images/Top/LandingMO_fr_12.gif',
                     '/images/Top/LandingMO_fr_23.gif');
}

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_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_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 SubmitSearchForm() {
	if(document.SearchForm.CiRestriction.value.length > 0){
		document.SearchForm.submit();
	}
}




