function stripCalc(v1,v2)
{
    var diff=0.0;
	v1 = v1.toString().replace(/\$|\,|\-/g,'');
	v2 = v2.toString().replace(/\$|\,|\-/g,'');

	diff = eval(v1) - eval(v2);

	document.form1.diff.value = formatCurrency(diff);
	document.form1.diffval.value = formatCurrency(diff);
	document.form1.listas.value = formatCurrency(v1);
	document.form1.shouldbe.value = formatCurrency(v2);

	adjClaim(eval(diff))

}
function adjClaim(num)
{
    var mn=parseFloat(document.form1.minimum.value);
    if(document.form1.shouldbe.value == "")
    {
        document.form1.shouldbe.value = ''
    }
    else if (document.form1.listas.value == "")
    {
        document.form1.listas.value = ''
    }
        //else if(num > mn)
    else if(num > 0)
    {
        num = num.toString().replace(/\$|\,|\-/g,'');
        document.form1.credit.value = ''
        document.form1.debit.value = formatCurrency(num)
        document.form1.creditval.value = ''
        document.form1.debitval.value = formatCurrency(num)
    }
    //else if(num < (-1*mn))
    else if(num < 0)
    {
        num = num.toString().replace(/\$|\,|\-/g,'');
        document.form1.debit.value = ''
        document.form1.credit.value = formatCurrency(num)
        document.form1.debitval.value = ''
        document.form1.creditval.value = formatCurrency(num)
    }
    else
    {
        document.form1.credit.value = ''
        document.form1.debit.value = ''
        document.form1.creditval.value = ''
        document.form1.debitval.value = ''
    }
    
}

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.01);
    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);
}

function jumpMenu(targ,selObj,restore)
{
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function printWindow(URL)
{
    window.open( URL ,"PrintWindow","resizable=yes,scrollbars=yes,menubar=yes,status=yes,toolbar=yes")
}

//function checkRT(y)
//{
//    x = y.value
//    x = x.length;
//
//    if (y.value == ""){
//
//    }
//    else if (x < 9)
//    {
//        alert('Invalid R&T Number')
//        y.value = ''
//        curt.focus()
//    }
//}

function confirmClear()
{
    var agree = confirm('Are you Sure you Wish to Clear All Form Fields ?');
    if (agree){
        return true;
    }else{
        return false;
    }
}

function clearform() {
	if(confirmClear())
	{
        document.form1.minimum.value = 'clear';
        document.form1.submit();
        }
}


function closeme(){
     window.opener=self;
     window.blur();
     window.close();
}


