var DEBUG_BROWSER_VERSION;

function csBrowserInfo()
{
	var csAppName = String(navigator.appName);
	var csAppVer = String(navigator.appVersion);
	DEBUG_BROWSER_VERSION = csAppVer;
	var csPlatform = String(navigator.platform);
	var csUserAgent = String(navigator.userAgent);
	var csVendor = String(navigator.vendor);
	var csProduct = String(navigator.product);
	if(csUserAgent.indexOf("Opera/7") > -1 || csUserAgent.indexOf("Opera 7") > -1)
		return 'Op7DHTML';
	else if(csUserAgent.indexOf("Opera") > -1)
		return 'None';
	else if(csUserAgent.indexOf("MSIE 4") > -1 && csPlatform != "MacPPC")
		return 'IE4DHTML';
	else if(csUserAgent.indexOf("MSIE 5") > -1)
		return 'IE5DHTML';
	else if(csUserAgent.indexOf("MSIE 6") > -1)
		return 'IE6DHTML';
	else if(csUserAgent.indexOf("MSIE 7") > -1)
		return 'IE7DHTML';
	else if(csUserAgent.indexOf("MSIE 8") > -1)
		return 'IE8DHTML';
	else if(csVendor == "Netscape6")
		return 'NN6DHTML';
	else if(csProduct == "Gecko")
		return 'Moz1DHTML';
	else if(csAppName == "Netscape")
	{
		if(parseFloat(csAppVer) >= 4.06 && parseFloat(csAppVer) < 5)
			return 'NN4DHTML';
		else
			return 'None';
	}
	else
		return 'None';
}

function MM_swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
    var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
      d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
     if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes'
function MM_openBrWindow(theURL,winName,features) { //v2.0
  	var win = window.open(theURL,winName,features)
win.focus()
}

function format(expr, decplaces,no_comma) {
    // convert in case it arrives as a string value
    var expr = parseFloat(expr);
    // make sure it passes conversion
    if (!isNaN(expr)) {
		var sign = '';
		if(expr < 0) {
			sign = '-';
			expr *= -1;
		}
		// raise incoming value by power of 10 times the
		// number of decimal places; round to an integer; convert to string
		var str = "" + Math.round (eval(expr) * Math.pow(10,decplaces))
		// pad small value strings with zeros to the left of rounded number
		while (str.length <= decplaces) {
			str = "0" + str
		}
		// establish location of decimal point
		var decpoint = str.length - decplaces
		// assemble final result from: (a) the string up to the position of
		// the decimal point; (b) the decimal point; and (c) the balance
		// of the string. Return finished product.
		if((decpoint > 3) && (!no_comma))
			result = str.substring(0,decpoint-3) + "," + str.substring(decpoint-3,decpoint)
		else
			result = str.substring(0,decpoint)

		if(decpoint < str.length) result = result + "." + str.substring(decpoint,str.length);
	 	return sign+result;
	}
	else {
		 return "NaN";
	}
}


function getObject(obj) {

	var theObj
	if (document.layers) {
		if (typeof obj == 'string') {
			// just one layer deep
			return document.layers[obj]
		} else {
			// can be a nested layer
			return obj
		}
	}
	if (document.all) {
		if (typeof obj == 'string') {
			return document.all(obj)
		} else {
			return obj
		}
	}
	if (document.getElementById) {
		if (typeof obj == 'string') {
			return document.getElementById(obj)
		} else {
			return obj
		}
	}
	return null
}
function setPointer(id, thePointerColor){

    if (thePointerColor == '') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
	 	row_name = "row_" + id
		 var theRow = document.getElementById(row_name)
       var theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        var theCells = theRow.cells;
    }
    else {
        return
    }

    var rowCellsCnt  = theCells.length;
    for (var c = 0; c < rowCellsCnt; c++) {
	 	if(theCells[c].name != 'checkbox') theCells[c].style.backgroundColor = thePointerColor;
    }

    return true;
}
function row_focus(id, color) {
	if(!color) color = COL_form_row_hilite;
	setPointer(id, color);
}
function row_blur(id,color) {
	if(!color) color = COL_form_data_background;
	setPointer(id, color);
}
var colorInputError="#FCBA61";
var COL_form_row_hilite="F4F2EA";
var COL_form_data_background="FFF5E5";
