browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
if (browserName == "Netscape" && browserVer ==3) {
	version = "yes";
	br = "no";
	if(navigator.userAgent.indexOf("Firefox",0) >= 0) {
		b = "ns";
		b2 = "ff";
	}
}
else if (browserName == "Netscape" && browserVer >=4) {
	version = "yes";
	br = "NS4";
	b = "ns";
	if(navigator.userAgent.indexOf("Firefox",0) >= 0) {
		b2 = "ff";
	}
}
else if (browserName == "Microsoft Internet Explorer" && browserVer >=4){
	version = "yes"
	br = "IE4";
	b = "ie";
}
else {
	version ="no";
	br = "no";
}

function stripSpaces(obj) {
	var str = obj;
	var newstr = "";
	
    for (var i = 0; i < str.length; i++) {
		if (str.charAt(i) == " ") {}
		else {
	   		newstr = newstr + str.charAt(i);
		}
    }
	return newstr;
}
function OpenFile(sFile) {
	sFile = escape(sFile);
	BlurbWindow = window.open(sFile,'BlurbWindow','toolbar=no,scrollbars=yes,width=500,height=500,resizable');
	BlurbWindow.focus();
}
function WindowOpen(strPage, iW, iH) {
	if (!iW) {iW = 600}
	if (!iH) {iH = 800}
	NewWindow = window.open(strPage,'DisplayWindow','toolbar=no,scrollbars=yes,width=' + iW + ',height=' + iH + ',resizable=yes');
	NewWindow.focus();
}

function CalOpen(strPage) {
	CalWindow = window.open(strPage,'CalWindow','toolbar=no,scrollbars=no,width=290,height=180,resizable=yes');
	CalWindow.focus();
}
function isEmail(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}

function SubRollOverRow(oTr) {
	if (b == "ie") {
		if (!oTr.contains(window.event.fromElement)) {oTr.bgColor="FFFF99";}
	}
	else {
		if (!oTr.style) {
          oTr.style={};
        }
		oTr.style["backgroundColor"]="FFFF99";
	}
}


function SubRollOutRow(oTr, c) {
	if (b == "ie") {
		if (!oTr.contains(window.event.toElement)) {oTr.bgColor=c;}
	}
	else {
		if (!oTr.style) {
          oTr.style={};
        }
		oTr.style["backgroundColor"]=c;
	}
}
	
function CheckNumber() {
	iCode = window.event.keyCode;
	if (isNaN(String.fromCharCode(iCode)) && String.fromCharCode(iCode) != ".") {
		event.keyCode = 0;
	}
}
function CheckEvNumber(e) {
	var key;
	var keychar;
	var reg;
	
	if(window.event) {
		key = window.event.keyCode; 
	}
	else if(e.which) {
		key = e.which; 
	}
	else {
		return true;
	}
	iCode = String.fromCharCode(key);
	if (isNaN(iCode) && iCode != "." && iCode != "-" && key != 8) {
		return false;
	}
	else {
		return true;
	}
}
function CheckPhoneNumber() {
	iCode = window.event.keyCode;
	if (isNaN(String.fromCharCode(iCode)) && String.fromCharCode(iCode) != " " && String.fromCharCode(iCode) != "+") {
		event.keyCode = 0;
	}
}
function CheckEvPhoneNumber(e) {
	var key;
	var keychar;
	var reg;
	
	if(window.event) {
		key = window.event.keyCode; 
	}
	else if(e.which) {
		key = e.which; 
	}
	else {
		return true;
	}
	iCode = String.fromCharCode(key);
	if (isNaN(String.fromCharCode(iCode)) && String.fromCharCode(iCode) != " " && String.fromCharCode(iCode) != "+") {
		return false;
	}
	else {
		return true;
	}
}


function img_act(imgName, imgURL) {
	if (version == "yes") {
		imgOn = eval(imgName + imgURL + ".src");
		document[imgName].src = imgOn;
	}
}
var DHTML = (document.getElementById || document.all || document.layers);
function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

//*****************************************************************
function MoveField(sFrm, sL, sR, sDir) {
	oL = eval("document." + sFrm + "." + sL);
	oR = eval("document." + sFrm + "." + sR);
	//alert("document." + sFrm + "." + sL + "\ndocument." + sFrm + "." + sR);
	selectLength = oR.length;
	availLength = oL.length;
	if (version=="no") {
		return;
	}
	else {
		k= 1;
		first = 0
	}
	a = first;
	
	if (sDir == 'L') {
		menuNum = oR.selectedIndex;
		//alert(menuNum);
		if (menuNum == -1 || menuNum == 0) {
			return;
		}
		fieldText = oR.options[menuNum].text;
		fieldValue = oR.options[menuNum].value;
		
		for (i = first; i <= selectLength-k; i++) {
			if (i != menuNum) {
				oR.options[a].text = oR.options[i].text;
				oR.options[a].value = oR.options[i].value;
				oR.options[a].selected = false;
				a = a + 1;
			}
		}
		oR.options[a] = null;
		if (menuNum == a) {
			oR.options[a-1].selected = true;
		}
		for (i = first; i <= availLength-k; i++) {
			oL.options[i].text = oL.options[i].text;
			oL.options[i].value = oL.options[i].value;
		}
		oL.options[i] = new Option("");
		oL.options[i].text = fieldText;
		oL.options[i].value = fieldValue;
		oL.options[i].selected = true;
	}
	else {
		menuNum = oL.selectedIndex;
		if (menuNum == -1 || menuNum == 0) {
			return;
		}
		fieldText = oL.options[menuNum].text;
		fieldValue = oL.options[menuNum].value;
		
		for (i = first; i <= availLength-k; i++) {
			if (i != menuNum) {
				oL.options[a].text = oL.options[i].text;
				oL.options[a].value = oL.options[i].value;
				a = a + 1;
			}
		}
		oL.options[a] = null;
		if (menuNum == a) {
			oL.options[a-1].selected = true;
		}
		
		for (i = first; i <= selectLength-k; i++) {
			oR.options[i].text = oR.options[i].text;
			oR.options[i].value = oR.options[i].value;
			oR.options[i].selected = false;
		}
		oR.options[i] = new Option("");
		oR.options[i].text = fieldText;
		oR.options[i].value = fieldValue;
		oR.options[i].selected = true;
	}
}

function ShowHideOnCheckbox(CheckBoxIDName, DivToShow) {
	cb=document.getElementById(CheckBoxIDName);
	if(cb){
		if (cb.checked) {
			e=document.getElementById(DivToShow);
			e.style.display = '';
		}
		else {
			e=document.getElementById(DivToShow);
			e.style.display = 'none';
		}
	}
}



