function callfrm(dest)
	{
		frmConsole.target = "_self"
		frmConsole.action = dest
		frmConsole.method = "POST"
		frmConsole.submit()
	}	
function callfrm2(dest)
	{
		frmConsole.target = "_blank"
		frmConsole.action = dest
		frmConsole.method = "POST"
		frmConsole.submit()
	}	
function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
		num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
		cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	//return (((sign)?'':'-') + '$' + num + '.' + cents);
	return (((sign)?'':'-') + num);
}

function CheckBoxChageColor(c_id,ctmp_id,id,activecolor){
		var f = document.frmConsole;
		var a=c_id + '['+ id +']';
		var b='tr_';
		var c=ctmp_id;
		cb = eval( 'f.' + a);
		cb2 = eval(b + '' + id );
		cb3 = eval( 'f.' + c + '' + id );
		if(cb.checked==true){
			if(cb3.value==1)
				cb2.style.backgroundColor=activecolor;
			else
				cb2.style.backgroundColor="#f9fbcb";
		}else{
			if(cb3.value==0)
				cb2.style.backgroundColor=activecolor;
			else{
				cb2.style.backgroundColor="#D5E2F0";
			}
		}
	}

	function checkboxNum(form,chk) {
	var total = 0;
	var max = eval('form.' + chk + '.length');
	for (var idx = 0; idx < max; idx++) {
		if (eval('document.frmConsole.'+ chk +'[' + idx + '].checked') == true) {
			total += 1;
		}
	}
	return total;
}

function changerow(row){
	var b='tr_upload';
	for(i=0;i<50;i++){
		cb2 = eval(b + '' + i );
		if(i<row){
			cb2.style.display='';
		}else{			
			cb2.style.display='none';
		}
	}
}

function popupfrmPrint(dest,popname,width,height){
	popup=window.open(dest,popname,"left="+ (((800-width)/2)) + ",top=" + (((600-height)/2)) +",width="+width+",height="+height+",resizable=no,menubar=1,scrollbars=yes,location=no,alwaysRaised=yes");
	popup.focus()
}

function openNew(dest,popname,width,height){
	popup=window.open(dest,popname,"left="+ (((800-width)/2)) + ",top=" + (((600-height)/2)) +",width="+width+",height="+height+",resizable=no,menubar=0,scrollbars=yes,location=no,alwaysRaised=yes");
	popup.focus()
}
	function popupPic(dest,popname,width,height){
		popup=window.open(dest,popname,"left="+ (((800-width)/2)) + ",top=" + (((600-height)/2)) +",width="+width+",height="+height+",resizable=no,menubar=0,scrollbars=no,location=no,alwaysRaised=yes");
		popup.focus()
	}

function DigitOnly() {
	if ((event.keyCode>=96)&&(event.keyCode<=105))		
		return;
	if ((event.keyCode>=48)&&(event.keyCode<=57))	
		return;
	if (event.keyCode==8 || event.keyCode==9)
		return;
	if ((event.keyCode==37)||(event.keyCode==39)||(event.keyCode==46))
		return;
	event.returnValue=false;	
}

function roll_over(img_name, img_src){
	document[img_name].src = img_src;
}

function EngOnly(){
	if (String.fromCharCode(event.keyCode) < '~'){
		return;
	}
	event.returnValue=false;	
}