var agt=navigator.userAgent.toLowerCase();

var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
            && (agt.indexOf('webtv')==-1));
var NS4 = (is_nav && (is_major >= 4));
var is_ie   = (agt.indexOf("msie") != -1);
var is_ie3  = (is_ie && (is_major < 4));
var is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) );
var IE4  = (is_ie  && (is_major >= 4));
var IE5  = (is_ie  && !is_ie3 && !is_ie4);
var ver4 = (NS4 || IE4) ? true : false;

function NewWindow(bredde,hoyde,url) {
	window.open(url,"ShowProdWindow","menubars=0,scrollbars=1,resizable=1,height=" + hoyde + ",width=" + bredde + ",top=0,left=0,screenX=0,screenY=0");
}
function NewWindowMultimedia(bredde,hoyde,url) {
	window.open(url,"ShowProdWindow","menubars=0,scrollbars=1,resizable=1,height=" + hoyde + ",width=" + bredde + ",top=0,left=0,screenX=0,screenY=0");
}
function NewWindowWMenu(bredde,hoyde,url) {
	window.open(url,"ShowProdWindowM","menubars=0,menu=1,scrollbars=1,resizable=1,height=" + hoyde + ",width=" + bredde + ",top=0,left=0,screenX=0,screenY=0");
}
function GuideWindow(url) {
	window.open(url, "","top=100,left=100,screenX=100,screenY=100,width=500,height=400,scrollbars=1,resizable=1,toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=0,titlebar=0,dependant=1");
}
//Date:		03/25/2002
//Purpose:	Open a new window with variables for the window options
function CENewWindow(url,width,height,menubars,scrollbars,resizable) {
	window.open(url,"","menubars=" + menubars + ",scrollbars=" + scrollbars + ",resizable=" + resizable + ",height=" + height + ",width=" + width + ",top=0,left=0,screenX=0,screenY=0");
}
//Author:	Sean Ogden
//Date:		09/27/2002
//Purpose:	Used for the two graphics' rollover in leftmenu.inc. Updated for browser compatiblilty
function SwapImg (ImgID,NewSrc) { 
	ImgID.src = NewSrc;
}
//Author:	Sean Ogden
//Date:		02/04/2002
//Purpose:	Translate the beginning Publication code and replace it with the actual newspaper name
function CETransPubCode(sPubSectionName) {
	var i;
	var aPubCodes = new Array("TT","TS","TP","DG","LE","TJ");
	var aPubNames = new Array("Times &amp; Transcript","SJ Telegraph-Journal","NB Telegraph-Journal","Daily Gleaner","L'Étoile","Telegraph-Journal");
	var sPubCode = sPubSectionName.substr(0,2); 				//Get the pub code (2 characters)
	var sPubCat = sPubSectionName.substr(sPubCode.length + 1);	//Get the name of the section starting after the pubcode
	
	for (i = 0; i < aPubCodes.length; i++) {
		//Translate the pub code to the full newspaper name
		if (aPubCodes[i] == sPubCode) {
			sPubCode = aPubNames[i];
			break;
		}
	}
	//Free up resources?
	aPubCodes = null;
	aPubNames = null; 
	
	//If the pub code was translated then it will be greater than 2 characters. Separate the newspaper 
	//name and category with a pipe. If there is no pubcode in the category description then send back
	//the value passed into to the function
	return (sPubCode.length > 2) ? (sPubCode + " | " + sPubCat) : sPubSectionName;
}
//Author:	Sean Ogden
//Date:		11/20/2002
//Purpose:	Send a string to the function and it overrides the title of the calling document
function CEChangePageTitle (sNewTitle) {
	if (document.title) {
		document.title = sNewTitle;
	}
}
//Author:	Sean Ogden
//Date:		01/01/2002
//Purpose:	Used for the two graphics' rollover in leftmenu.inc
//Note:		Stopped using this on 09/26/2002
function OLD_LowSrc_SwapImg (Img) { 
	var tempImg;

	if (Img.src == Img.lowsrc) {
		tempImg = Img.lowsrc;
		Img.lowsrc = Img.src;
		Img.src = tempImg;
	}
	else {
		tempImg = Img.src;
		Img.src = Img.lowsrc;
		Img.lowsrc = tempImg;
	}
}
//Is this being used? 
// Note: 	Not being used. SMO - 20021120
function CESkipLoginPrompt (sAddr) {
	if (sAddr.indexOf("AboType=SUBSCRIBE") > -1) {
		history.go(-1);
	}
}
