function round(number)	// no decimals
{
  return Math.round(number*Math.pow(10,2))/Math.pow(10,2);
}

function floor(number)	
{
  return Math.floor(number*Math.pow(10,2))/Math.pow(10,2);
}

//function for currency format
function formatCurrency(num) 
{	
	num = num.toString().replace(/\$|\,/g,'');
	if(num!='' )
	{
		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);
	}
	else
		return '';
}

function autoTab(field,len)
{  
	var autotab_focus_value=document.forms['f1'].autotab_focus;		
	var field_index;
	if (field.value.length < len)
		autotab_focus_value.value=1;

	if (field.value.length == len && autotab_focus_value.value==1)
	{
		field_index=getIndex(field);
		field.form[field_index+1].focus();
		//alert(field.form[field_index+1].type=="text");
		if(field.form[field_index+1].type=="text")
			field.form[field_index+1].select();
	}
}

function getIndex(field)
{
  var ix = -1, i = 0, found = false;
  while (i < field.form.length && ix == -1)
    if (field.form[i] == field) 
		ix = i;
    else 
		i++;
  return ix;
}

function unSetautotab_focus()
{
	document.forms['f1'].autotab_focus.value=0;
}

function Setautotab_focus(field,len)
{
	if(field.value.length < len) 
		document.forms['f1'].autotab_focus.value=1;
}
