<!--
top.name = 'ShabzMedia';
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_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 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];}
}
//-->

/// End of JavaScript for mouseOvers



/// Function to open URL in new browser

function CHIN_Aux(URL) 
{
var the_string = /map/;
var map = URL.match(the_string);

if (map == null)
	{
        // make window for others....
        var serv=window.open(URL,'CHINAux','toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width=690,height=320');
        }
        else 
	{
	// make window for maps....
	var serv=window.open(URL,'CHINAux','toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width=643,height=530');
        }
}
// Used by the feedback.cgi script
function CHIN_Aux2(URL) {

	var myURL = URL + '?open="' + escape(location.href) + '"' + '&port=' + location.port ;

 	var serv=window.open(myURL,'CHINAux2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=500,height=330');
}


function VMCAux(URL) 
{
var serv=window.open(URL,'VMCAux','toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width=643,height=530');
}


/// End of function to open URL in new browser

// Forum stuff

function move_in(img_name,img_src) {
document[img_name].src=img_src;
}

function move_out(img_name,img_src) {
document[img_name].src=img_src;
}

function setStatus(msg){
     status = msg
     return true
     }

// End of Forum Stuff

function inlineLink(anchorName) { // Bob's addition for inline links on search results
	location.hash=anchorName;
}


// Set a Cookie to remember the Last CHIN URL for the Homepage
//var testDomain = document.domain.toLowerCase();
//if (testDomain.indexOf('chin.gc.ca') != -1) {
//	document.cookie += 'lastCHINLocation=' + escape(document.location) + '; domain=.chin.gc.ca; path=/'; 
//}
//if (testDomain.indexOf('rcip.gc.ca') != -1) {
//	document.cookie += 'lastCHINLocation=' + escape(document.location) + '; domain=.rcip.gc.ca; path=/'; 
//}

// Set a Cookie to remember the last Search Term(s)
function setSearchTerm(form) {
	document.cookie = 'lastSearch=' + escape(form.DTqb1.value) + '; domain=.chin.gc.ca; path=/';
	//window.alert("Trying to set " + document.cookie + "!");
	}

// Search term carry over
function Get_Terms() {

	var myTerms = "";
	var myCookie = document.cookie;
	if (myCookie == "") return false;
	var pos = myCookie.indexOf("lastSearch=");
	if (pos == -1) return false;
	var start = pos + 11;
	var end = myCookie.indexOf(";", start);
	if (end == -1) end = myCookie.length;
	var cookieString = unescape(myCookie.substring(start, end));

	var myTerms = cookieString;

	myTerms = myTerms.replace(/\+/g, ' ');
	myTerms = myTerms.replace(/#.*/, '');
	if (myTerms.length > 0) {
		document.search.DTqb1.value = myTerms;
		if (document.searchCentre) {
			document.searchCentre.DTqb1.value = myTerms;
		}
	}
//	window.alert("The terms I recieved were " + myTerms + "!");
}
