var bow="n";
var bow1="n";

bName = navigator.appName;
bVer = parseInt(navigator.appVersion);

if (bName == "Netscape" && bVer >= 3)
{
	bow = "ok";
	bow1 = "ok";
}
else if (bName == "Microsoft Internet Explorer" && bVer > 3)
{
	bow = "ok";
	bow1="ok";
}
else if (bName == "Microsoft Internet Explorer" && bVer >=2)
{
	bow = "ok";
}

var IS_AOL=0;

if (navigator.userAgent)
{
	if (navigator.userAgent.indexOf("AOL") >=0)
	{
		IS_AOL=1;
		bow1="n";
	}
}
else
{
	bow="n"
	bow1="n";
}
/* END JS Browser detect code */

/* changeImage function modified to work with the open/close images on the schedule page */
function changeImage(row,s,sched)
{
	var h = (s==1)?"r":"";
	var row_src = (parseInt(sched)>=1)?'r'+sched:row;

	if(document.images) document.images[row].src = eval(h + row_src + ".src");
}

/* go to a page in the main window */
function openPageInMain(pageUrl){
	if(!window.opener || window.opener.closed){
		window.opener = window.open(pageUrl,'','');
		return false;
	}else{
		window.opener.document.location.href = pageUrl;
		window.opener.focus();
		return false;
	}
}

/* general utility function that accepts parameters for url of filename (f),
target Window (t), 
menubar (m - yes/no), location (l - yes/no), 
scrollbars (s - yes/no), resizeable (r - yes/no), 
window width (w), window height (h). 
Default values are laid out in the function.

23/10: add directories and toolbar options (fred)*/
function openGallery(strLink,strWindowName){
	return openWindow(strLink,strWindowName,"no","no","no","yes","500","486","no","no","no");	
}


function openWindow(f, t, m, l, s, r, w, h, st, tool, d)
{
	var fn_filename = "";
	var fn_target = "_blank";
	var fn_menubar = "no";
	var fn_location = "no";
	var fn_scrollbars = "yes";
	var fn_resizable = "yes";
	var fn_width = "600";
	var fn_height = "400";
	var fn_status = "no";
	var fn_toolbar = "no";
	var fn_directories = "no";
	
	if (arguments.length > 0)
	{
		if (f != "" || f != null) fn_filename = f;
		if (t != "" || t != null) fn_target = t;
		if (m == "no") fn_menubar = m;
		if (l == "no") fn_location = l;
		if (s == "no") fn_scrollbars = s;
		if (r == "no") fn_resizable = r;
		if (w > 0) fn_width = w;
		if (h > 0) fn_height = h;
		if (st == "no") fn_status = st;
		if (tool == "no") fn_toolbar = tool;
		if (d == "no") fn_directories = d;
	}
	
	self.name="mainWin";
	
    if (bow!="ok") return (true);
	
	argumentString = 'menubar='+fn_menubar+',location='+fn_location+',scrollbars='+fn_scrollbars+',resizable='+fn_resizable+',width='+fn_width+',height='+fn_height+',status='+fn_status+',toolbar='+fn_toolbar+',directories='+fn_directories;
	
	remote =  window.open(fn_filename,fn_target,argumentString);

    if (remote == null) return true;

    if(bow1 == "ok"){
		window.setTimeout('focusWin()',1000);
	}
	return (false);
}

function focusWin(){
	if(!remote.closed){
		remote.focus();
	}
}

/* short cut function for opening banner ad or external link windows 
uses the openWindow general utility which should be above */
function openLinkWin(fName,targetName,winWidth,winHeight)
{
    if (bow!="ok") return (true);

	var fn_fName = "";
	var fn_targetName = "_blank";
	var fn_winWidth = 620;
	var fn_winHeight = 400;

	if (arguments.length > 0)
	{
		if (fName != "" || fName != null) fn_fName = fName;
		if (targetName != "" || targetName != null) fn_targetName = targetName;
		if (winWidth > 0) fn_winWidth = winWidth;
		if (winHeight > 0) fn_winHeight = winHeight;
	}

	return openWindow(fn_fName,fn_targetName,'yes','yes','yes','yes',fn_winWidth,fn_winHeight,'yes','yes','yes')
}
function tableover(which,colour){
which.style.background=colour
}