function focusOnElement(elmId) {
    var element = document.getElementById(elmId);
    if (element != null) {
        element.focus();
    }
}

function setClickedBtn(clickedBtn) {
    
    document.getElementById('clickedBtn').value = clickedBtn;
    
}

function submitForm() {
    
    var clickedBtn = document.getElementById('clickedBtn').value;
    
    if (clickedBtn == "Cancel") {
        return true;
    } else {
        return validate();
    }
    
}

function formatCurrency(ob)
{	
	var nStr = ob.value;
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	ob.value =  x1 + x2;
}

function deFormatCurrency(ob)
{
	var StartNumber = ob.value ;	
	var ret =  StartNumber.replace(/\,/g,'');
	ob.value = ret;
	//return ReplacedNumber;
}

function adjustCurrencyFormat(ob)
{	
	//alert(ob.value);
	var nStr = ob.value;
	//alert("value = " + nStr);
	deFormatCurrency(ob);
	nStr = ob.value;	
	 formatCurrency(ob);
	
	return true;
}