function formatCurrency(value, bIncludeCents) 
{	
	if (bIncludeCents == null)
		bIncludeCents = false;
	
	var sDelim = ",";
	var sDecimal = ".";
	var sCurrSymbolPos = "BEGIN";

	if (gLanguageCode.toLowerCase() == 'fr') {
		sDelim = "&nbsp;";
		sDecimal = ",";
		sCurrSymbolPos = "END";
	} // if
	
	value = value.toString().replace(/\$|\,/g, '');
	
	if (isNaN(value)) value = "0";
	
	if (!bIncludeCents)
        value = Math.ceil(value);
        
	sign = (value == (value = Math.abs(value)));
	value = Math.floor(value * 100 + 0.5000000001);
	cents = value%100;
	value = Math.floor(value/100).toString();
	
	for (var i = 0; i < Math.floor((value.length - (1+i))/3); i++) {
		value = value.substring(0,value.length-(4*i+3)) + sDelim + value.substring(value.length-(4*i+3));
		break;
	}
	
	if (cents < 10) cents = "0" + cents;
	
	if (sCurrSymbolPos == "BEGIN") {
		if (bIncludeCents)
			return ('$' + ((sign)?'':'-') + value + sDecimal + cents);
		return ('$' + ((sign)?'':'-') + value);
	} else {
		if (bIncludeCents)
			return (((sign)?'':'-') + value + sDecimal + cents) + '&nbsp;$';
		return (((sign)?'':'-') + value) + '&nbsp;$';
	}
}


function isNetscape()
{
	//Safari doesn't support navigator.vendorSub so we must check for the existance of this property before attempting to use it
	return (navigator.appName.toLowerCase().indexOf("netscape") > -1) && (navigator.vendorSub) && (navigator.vendorSub.indexOf("7.0") > -1);
}


//Show/hide an iframe
//iframe (string): 	name of the iframe to show/hide
//show (boolean): 	flag indicating if this is a show or hide operation
//height (integer): New iframe height
//		height == -1 	indicates that the iframes previous height should be used
//						if there is no record of the previous height found then the height property is not changed
function showIFrame(iFrame, show, height) 
{
	if (show == null) { show = true; }
	
	var frm = document.getElementById(iFrame);
	if (frm == null) { alert('Could not find iFrame: ' + iFrame); }	
		
	if (show) {		
		if (height != null && height > -1) { frm.style.height = height + 'px'; }
		else if(height < 0) { 
			var h = frm._oldHeight;
			
			if (h) {
				frm._oldHeight = null;			
				frm.style.height = h;
			}
		}
		frm.style.visibility = 'visible';		
		
	} else {
		frm._oldHeight = frm.style.height;
		frm.style.visibility = 'hidden';
		frm.style.height = '0px';
	}
}

//Check to see if an iframe shown to the user
function isFrameVisible(iFrame)
{
	var frm = document.getElementById(iFrame);		
	return frm && frm.style.visibility == 'visible';
}

function getIFrameWnd(iFrame)
{
	return window.frames[iFrame];
}

//Use the location.replace method to keep the iframe redirection from being placed in the history
//of the back button.  NOTE: not all browsers support the replace method
function iFrameGoTo(iFrame, url)
{	
	if (url == null) { url = 'blank.htm'; }

	var frm = window.frames[iFrame];
	if (frm) {			
		try {
			if (frm.location.replace) { frm.location.replace(url); }
			else { frm.src = url; }
		} catch(e) { alert(e.message); }		
	} else {
		alert('[iFrameGoTo] Could not locate iframe: ' + iFrame);
	}
}

function loadUrl(url)
{
	if(url == null) { url = 'javascript:void(0);' }
	
}
document.getElementsByClassName = function(eleClassName){
	  var getEleClass = [];
	  var myclass = new RegExp("\\b"+eleClassName+"\\b");
	  var elem = this.getElementsByTagName("*");
	  for(var h=0;h<elem.length;h++){
	    var classes = elem[h].className;
	    if (myclass.test(classes)) getEleClass.push(elem[h]);
	  }
	  return getEleClass;
}
//lock the select boxes when doing mask page in IE6
function lockContainerSelectBoxes(containerEl){
    try{
    	var selectBoxes = containerEl.getElementsByTagName("SELECT");
    	for(var e = 0; e < selectBoxes.length; e++){
        	if(!selectBoxes[e].getAttribute("isLocked", false))
        		selectBoxes[e].setAttribute("previousDisableStatus", selectBoxes[e].disabled);
    		selectBoxes[e].setAttribute("isLocked", true);
    		selectBoxes[e].disabled=true;
		}
    }catch(ex){}
}
//unlock the select boxes when doing unmask page in IE6
function unlockContainerSelectBoxes(containerEl){
    try{
    	var selectBoxes = containerEl.getElementsByTagName("SELECT");
    	for(var e = 0; e < selectBoxes.length; e++){
    		selectBoxes[e].setAttribute("isLocked", false);
    		selectBoxes[e].disabled = selectBoxes[e].getAttribute("previousDisableStatus", false);
		}
    }catch(ex){}
}
