function NewWindow(bredde,hoyde,url) {
	var oNewWin = window.open(url,"ShowProdWindow","menubars=0,scrollbars=1,resizable=1,height=" + hoyde + ",width=" + bredde + ",top=0,left=0,screenX=0,screenY=0");
	oNewWin.focus();
}
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");
}
function Checkage(frmThisForm) {
	if (frmThisForm.age.selectedIndex == 0) {
		alert('COPA prohibits user registration by children below the age of 13.');
		CENewWindow("http://www.copacommission.org/",640,640,1,1,1);
		return false;
	}
}

//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;
	}
}
*/
//Author:	Sean Ogden/Publicus
//Date:		03/11/2003
//Purpose:	open a Popup window with a calendar supplied by Saxotech Publicus
function CE_ChooseDate (frmCEForm,fldCEFormField) {
	window.open('/g/kalender_eng.html?' + frmCEForm.name + '.' + fldCEFormField.name + '&nobackdate','','menubar=0,titlebar=0,width=268,height=236');
	//document.searchform.Interval.options[document.searchform.Interval.options.length-1].selected = true;
}

//Author:	Sean Ogden
//Date:		03/25/2003
//Purpose:	Return a multi-line string with browser info
function CE_BrowserInfo() {
	return (
	"Name: " + navigator.appName + 
	"\nCodeName: " + navigator.appCodeName + 
	"\nVersion: " + navigator.appVersion.substring(0,4) + 
	"\nPlatform: " + navigator.platform + 
	"\nJavaEnabled?: " + navigator.javaEnabled() + 
	"\nScreen Width: " + screen.width + 
	"\nScreen Height: " + screen.height
	);
}

//Author:	Sean Ogden
//Date:		04/07/2003
//Purpose:	This function takes an even number of parameters in the form of VALUE, "ERROR MESSAGE" and returns a list of errors, if any
function CE_ValidateFormFields () {
	var i = 0;
	var sErrMsg = "";
	var iArgLen = CE_ValidateFormFields.arguments.length;
	var aArgs = new Array();
	
	// Assign the contents of the arguments array to a local array
	aArgs = CE_ValidateFormFields.arguments;

	// There must be an even number of function arguments passed to this function,
	// passed in the order of: field, error message
	if ((iArgLen % 2) == 1) {
		return ("Invalid number of arguments passed to validation function.\n\n");
	}

	// The number of arguments passed to the function was even
	// Loop through the arguments
	for (i; i < iArgLen; i+=2) {
		// Check text type form controls for empty string
		if ((aArgs[i].type == "text") || (aArgs[i].type == "textarea") || (aArgs[i].type == "hidden") || (aArgs[i].type == "password")) {
			// Trim leading and trailing spaces
			aArgs[i].value = CETrim (aArgs[i].value, " ");
			// Add error message if the current value is an empty string
			if (aArgs[i].value == "") {
				sErrMsg += aArgs[i+1] + "\n\n";
			}
		}
	}
	return sErrMsg;
}

//Author:	Sean Ogden
//Date:		04/11/2003
//Purpose:	Trim any leading and trailing spaces. The trim variable will default to a space character if not specified
function CETrim (sString, sCharToTrim) {
	var sStartChar = "";
	var sEndChar = "";

	sCharToTrim = (sCharToTrim == "") ? " " : sCharToTrim;
	
	// Trim leading and trailing sCharToTrim characters until they are gone
	do {
		// Get the leading and trailing characters
		sStartChar = sString.charAt(0, 1);
		sEndChar = sString.charAt(sString.length - 1);
		
		// Cut any leading spaces
		sString = (sStartChar == sCharToTrim) ? sString.substr(1) : sString;
		// Cut any trailing spaces
		sString = (sEndChar == sCharToTrim) ? sString.substr(0, sString.length - 1) : sString;

	} while (sString.length > 0 && (sStartChar == sCharToTrim || sEndChar == sCharToTrim));
	
	return sString;
}
// Double space the text in a HTML textarea control for HTML e-mail submission
// Note: Moved into functions.js 20030425 SMO
function Text_DblSpace (txtString) {
	var i = 0;
	var thisArray = txtString.split("\n");
	for (i=0; i < thisArray.length; i++) {
		thisArray[i] += "\n";
	}
	// Will separate the lines the message when in HTML format
	return thisArray.join("<BR>");
}

// Return a negative number. If the referring page contains login then decrement the iBack variable. This is used in conjunction with history.go(CEPageBack());
// 20031017 SMO
function CEPageBack () {
	var sReferrer = window.document.referrer.toLowerCase();
	var iBack = -1;
	if (sReferrer.indexOf("login") > -1) {
		iBack--;
	}
	return iBack;
}

function open_popup(page) {
//  if (is_nav && is_mac){
    // IS Netscape-Mac
  //  window_handle = window.open(page,'remote','scrollbars,resizable,width=500,height=500,left=0,top=0');
  //}
  //else
  //{
    // NOT Netscape-Mac
    window_handle = window.open(page,'remote','scrollbars,resizable,width=100,height=100,left=0,top=0');
  //}
  return false;
}
// Resize a window to the specified width and height and bring that window to the front
function myload(wide,high){
  self.resizeTo(wide,high);
  self.focus();
}

var CE_SubmitClicked = 0;
function CE_HasClicked() {
	if (CE_SubmitClicked == 1) {
		return false;
	}
}
function CE_DoSubmit(frmThisForm,NewAction) {
 	if (NewAction != "") {
 		frmThisForm.action = NewAction;
 	}
 	frmThisForm.submit();
 	CE_SubmitClicked = 1;
}

// These functions and variables belong to omista
var win=null;

function OmistaNewWindow(mypage,myname,w,h,scroll,pos)
{
	if(pos=="random")
	{
	LeftPosition=(screen.availWidth)?Math.floor(Math.random()*(screen.availWidth-w)):50;TopPosition=(screen.availHeight)?Math.floor(Math.random()*((screen.availHeight-h)-75)):50;
	}
	
	if(pos=="center")
	{
	LeftPosition=(screen.availWidth)?(screen.availWidth-w)/2:50;TopPosition=(screen.availHeight)?(screen.availHeight-h)/2:50;
	}
	
	if(pos=="default")
	{
	LeftPosition=50;TopPosition=50
	}
	else if((pos!="center" && pos!="random" && pos!="default") || pos==null)
	{
	LeftPosition=0;TopPosition=20
	}
	
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
	if(win.focus)
	{
	win.focus();
	}
}

function CloseNewWin()
{
if(win!=null && win.open)win.close()
}
window.onfocus=CloseNewWin;


/*
//*************************** UpdateCookie ***************************
 PARAMETERS:	
  CookieName   (String) The name of the cookie to set/update. 
			   Is also the name of the .js file that contains code to output.
  iMaxViews	   (Int) The maximum allowed number of views for the cookie.  Defaults to 1.
  DaysToExpire (Int) The number of days before the cookie expires. Defaults to 1.

   NOTE:		
   * A cookie is set during the last view that expires in the number of days specifed by DaysToExpire
   * ONEDAY = 1000 milliseconds * 60 seconds * 60 minutes * 24 hours = 86400000
*/ 
function UpdateCookie (CookieName, iMaxViews, DaysToExpire) {
	var ONE = 1;
	var ONEDAY = 86400000;
	var dExpiry = new Date();
	var iViews = Get_Cookie(CookieName); // Get the value of the cookie
	
	// Only show the ad when the cookie value is null or the number of views is less than the maximum allowed
	if (iViews == null || (iViews < iMaxViews)) {
		// If the cookie value read is not a number then default to 1
		// Else convert the value read to a number and increment by 1
		iViews = (isNaN(parseInt(iViews)) ? ONE : (parseInt(iViews) + ONE));
		// Set the expiry date of the cookie (in milliseconds) to 1 day times the value of DaysToExpire
		dExpiry.setUTCMilliseconds(ONEDAY * (isNaN(DaysToExpire) ? ONE : DaysToExpire));
		
		Set_Cookie(CookieName, iViews, dExpiry);
		// Write a script tag that uses the name of the cookie as the name of the file in the script tags's src. 
		// This file will contain specific code for the item being displayed.
		document.write("<SCRIPT language='JavaScript' src='/includes/ads/vokens/" + CookieName + ".js'><\/SCRIPT>");
		
		// Return a string that can be outputted from the calling function. Uncomment the return at the end of this function
		//return "<SCRIPT language='JavaScript' src='/includes/ads/vokens/" + CookieName + ".js'><\/SCRIPT>";
	}
}

//The functions Get_Cookie,Set_Cookie, Delete_Cookie were obtained from http://tech.irt.org/articles/js064/index.htm and based on the public domain cookie code produced by Bill Dortch
function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}
function Set_Cookie(name,value,expires,path,domain,secure) {
	document.cookie = name + "=" + escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}
function Delete_Cookie(name,path,domain) {
    if (Get_Cookie(name)) document.cookie = name + "=" +
        ( (path) ? ";path=" + path : "") +
        ( (domain) ? ";domain=" + domain : "") +
        ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
function changeBG(whichColor){
document.bgColor = whichColor;
}
