var agt = navigator.userAgent.toLowerCase(); 
var win = ((agt.indexOf("win") != -1) || (agt.indexOf("16bit") != -1) || (agt.indexOf("32bit") != -1));
var mac = (agt.indexOf("mac") != -1);
var unx = ((agt.indexOf("x11") != -1) || (agt.indexOf("sunos") != -1) || (agt.indexOf("irix") != -1) || (agt.indexOf("hp-ux") != -1) || (agt.indexOf("sco") != -1) || (agt.indexOf("unix") != -1) || (agt.indexOf("ncr") != -1) || (agt.indexOf("dec") != -1) || (agt.indexOf("osf1") != -1) || (agt.indexOf("ultrix") != -1) || (agt.indexOf("alpha") != -1) || (agt.indexOf("sinix") != -1) || (agt.indexOf("aix") != -1) || (agt.indexOf("inux") != -1) || (agt.indexOf("bsd") != -1));
var ns = ((agt.indexOf("mozilla") != -1) && (agt.indexOf("compatible") == -1));
var ie = (agt.indexOf("msie") != -1);
var ver = parseFloat(navigator.appVersion);
var ss;
var e;
if (ie) {
	ss = agt.indexOf("msie") + 5;
	e = agt.indexOf(";", ss);
	ver = parseFloat(agt.substring(ss, e));
}
if (ns && (ver >= 5)) {
	ss = agt.indexOf("netscape/");
	if (ss == -1) {
		ss = agt.indexOf("netscape6/") + 10;
	} else {
		ss += 9;
	}
	e = agt.indexOf(" ", ss);
	if (e == -1) {
		e = agt.indexOf(".", ss + 2);
	}
	ver = (e > -1) ? parseFloat(agt.substring(ss, e)) : parseFloat(agt.substring(ss));
}

function ImgSwap(iID,bool){
	var src = document.getElementById('Img' + iID).src
	
	if(src.indexOf('.gif') >= 0){
		rep = '.gif'
		rExp = /.gif/gi;
		repOver = '_over.gif';
		rExpOver = /_over.gif/gi;
	}else{
		rep = '.jpg'
		rExp = /.jpg/gi;
		repOver = '_over.jpg';
		rExpOver = /_over.jpg/gi;
	}

	if(bool){
		if(src.indexOf(repOver) <= 0){
			src=src.replace(rExp,repOver);
			document.getElementById('Img' + iID).src = src;
		}
	}else{
		src=src.replace(rExpOver,rep);
		document.getElementById('Img' + iID).src = src;
	}
}

function UFcheckBrowser(){
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent.toLowerCase();
	this.dom=document.getElementById?1:0
	this.all=document.all?1:0;
	this.layers=document.layers?1:0;
	this.images=document.images?1:0;
	this.IE = navigator.appName=="Microsoft Internet Explorer"?1:0;
	this.NS = navigator.appName=="Netscape"?1:0;
	this.MAC = (this.agent.indexOf("mac")!=-1);
	return this;
}

oUFBrowser=UFcheckBrowser();

function allOver(imgID, hdrID, txtID, imgSrc) {
	if(document.getElementById) {
		document.getElementById(imgID).src='/images/' + imgSrc + '_over.gif';
		document.getElementById(hdrID).style.color = "#FCA404";
		document.getElementById(txtID).style.color = "#FCA404";
	}
}
function allOut(imgID, hdrID, txtID, imgSrc) {
	if(document.getElementById) {
		document.getElementById(imgID).src='/images/' + imgSrc + '_off.gif';
		document.getElementById(hdrID).style.color = "#66CCFF";
		document.getElementById(txtID).style.color = "#FFFFFF";
	}
}

function twoOver(imgID, txtID, imgSrc) {
	if(document.getElementById) {
		document.getElementById(imgID).src='/images/' + imgSrc + '_over.gif';
		document.getElementById(txtID).style.color = "#FCA404";
	}
}
function twoOut(imgID, txtID, imgSrc) {
	if(document.getElementById) {
		document.getElementById(imgID).src='/images/' + imgSrc + '_off.gif';
		document.getElementById(txtID).style.color = "#FFFFFF";
	}
}

function sendOver(imgID, imgSrc){
	if(document.getElementById) {
		document.getElementById(imgID).src=imgSrc;
	}
}
function sendOut(imgID, imgSrc) {
	if(document.getElementById) {
		document.getElementById(imgID).src=imgSrc;
	}
}

function over(elmt, clr) {
	if (ns && (ver >= 6) && (ver < 7)) {
		return;
	}
	if (oUFBrowser.dom) {
		if ("" + clr != "undefined") {
			document.getElementById(elmt).style.color = clr;
		} else {
			document.getElementById(elmt).style.color = "#FF9900";
		}
	}
}

function out(elmt, clr) {
	if (ns && (ver >= 6) && (ver < 7)) {
		return;
	}
	if (oUFBrowser.dom) {
		if ("" + clr != "undefined") {
			document.getElementById(elmt).style.color = clr;
		} else {
			document.getElementById(elmt).style.color = "";
		}
	}
}

        function setFocus(){
			if(typeof(document.forms[0]) != 'undefined'){
				if(typeof(document.forms[0].txtFirstName) != 'undefined'){
					document.forms[0].txtFirstName.focus();
				}
			}
		}
		var isNN = (navigator.appName.indexOf("Netscape")!=-1);
		
		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)+1) % 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;
		}