function ImageOff(imgname) {
	var OnImg;
	var Active = new Image();
	if (document.images) Active.src = "/images/nav/"+imgname+"_off.gif";
	document[imgname].src = Active.src;
}
function ImageOn(imgname) {
	var OffImg;
	var Inactive = new Image();
	if (document.images) Inactive.src = "/images/nav/"+imgname+"_on.gif";
	document[imgname].src = Inactive.src;
}
var bgOn = new Image();
bgOn.src = "/images/nav/bgOn.png";
var bgOff = new Image();
bgOff.src = "/images/nav/bgOff.png";
var vChanAlpha = 0;
var vChanSize = 0;
var vChanCols = 2;
function fReset() {
	vChanAlpha = 0;
	vChanSize = 0;
	vChanCols = 2;
	document.ControlForm.reset();
}
function fAlpha() {
	vChanAlpha = document.ControlForm.Alpha[document.ControlForm.Alpha.selectedIndex].value;
	window.top.cvcsbody.chanframe.location.reload();
}
function fSize() {
	vChanSize = document.ControlForm.Size[document.ControlForm.Size.selectedIndex].value;
	window.top.cvcsbody.chanframe.location.reload();
}
function fColumns() {
	vChanCols = document.ControlForm.Columns[document.ControlForm.Columns.selectedIndex].value;
	window.top.cvcsbody.chanframe.location.reload();
}
function fPrint() {
	window.top.cvcsnav.vPrintChans = 1;
	window.top.cvcsbody.chanframe.location.reload();
	setTimeout("fDoPrint()", 1000);
	return(false);
}
function fDoPrint() {
	window.top.cvcsbody.chanframe.focus();
	window.top.cvcsbody.chanframe.print();
	window.top.cvcsnav.vPrintChans = 0;
}
function printWindow() {
	bV = parseInt(navigator.appVersion);
	if (bV >= 4) window.print();
}
function revealMenu(menuName) {
	document.getElementById(menuName).style.display = 'block';
	document.getElementById(menuName).style.visibility = 'visible';
}
function hideMenu(menuName) {
	document.getElementById(menuName).style.visibility = 'hidden';
}
// auto tab for input fields
function autoTab(input,len, e) {
	var keyCode = (isNN) ? e.which : e.keyCode;
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if (input.value.length >= len && !containsElement(filter,keyCode)) {
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+2) % input.form.length].focus();
	}
	function containsElement(arr, ele) {
		var found = false, index = 0;
		while(!found && index < arr.length)
		if(arr[index] == ele) found = true;
		else index++;
		return found;
	}
	function getIndex(input) {
		var index = -1, i = 0, found = false;
		while (i < input.form.length && index == -1)
		if (input.form[i] == input) index = i;
		else i++;
		return index;
	}
	return true;
}
var isNN = (navigator.appName.indexOf("Netscape") != -1);
function checkAll(field) {
	for (i = 0; i < field.length; i++) field[i].checked = true;
}
function uncheckAll(field) {
	for (i = 0; i < field.length; i++) field[i].checked = false;
}
var submitted = false;
function doSubmit(form) {
	//alert("check");
	if (!submitted) {
		submitted = true;
		//alert("submitting");
		return true ;
	}
	else {
		//alert("no");
		return false ;
	}
}
function lib_bwcheck() {//Browsercheck
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.opera6=this.agent.indexOf("Opera 6")>-1
	this.opera7=this.agent.indexOf("Opera 7")>-1
	this.gecko=this.agent.indexOf('Gecko') > -1 && this.agent.indexOf('safari') == -1;
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns7=(this.dom && parseInt(this.ver) >= 7)?1:0;
	//this.ns6=(this.dom && parseInt(this.ver) = 5 || this.dom && parseInt(this.ver) = 6)?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.gecko || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.opera6 || this.opera7 || this.ns7);
	return this
}
var bw=new lib_bwcheck()
if (bw.mac) {
	if (bw.ie5) {
		document.write("<link rel='stylesheet' href='/css/common_mac_ie5.css'>");
	}	
	else if (bw.nn7) {
		document.write("<link rel='stylesheet' href='/css/common_mac_nn7.css'>");
	}
	else if (bw.gecko) {
		document.write("<link rel='stylesheet' href='/css/common_mac_gecko.css'>");
	}
	else {
		document.write("<link rel='stylesheet' href='/css/common_mac.css'>");
	}
}
else if (bw.gecko) {
	document.write("<link rel='stylesheet' href='/css/common_gecko.css'>");
}
else if (bw.opera5 || bw.opera6 || bw.opera7) {
	document.write("<link rel='stylesheet' href='/css/common_opera.css'>");
}
else {
	document.write("<link rel='stylesheet' href='/css/common.css'>");
}