index = 0;

function format(val, post)
{
    var decpoint;
    var begin;
    var end;
    var valstr;
    var temp_char;

    valstr = "" + val;
    decpoint = valstr.indexOf(".")
    if (decpoint != -1) {
        begin = valstr.substring(0,decpoint);
        end = valstr.substring(decpoint+1,valstr.length);
    }
    else {
        begin = valstr;
        end = "";
    } 
    if (end.length < post)
     {while (end.length < post)
        {
        end += "0";
        }
     }
     
    end = end.substring(0,post);
    return (begin+"."+end);
}


function orderSubmit(type) 
{
    if (type == 'order')
        {if (  !  ( (document.order.order_type.checked) ||
                checkRequired() ))
                
    {   
             document.order.submit();
             return true;
             
        }
        else {
            return false;
        }
    }
    
}

var infowin = null;

function checkRequired() {
    if (!document.order.firstname.value.length ||
            !document.order.lastname.value.length ||
            !document.order.email.value.length ||
            !document.order.phone.value.length ) { 
        alert('You have not completed all required fields:\n' +
              'Please complete the Name, E-mail and Phone Fields\n' +
              'in the Customer Information section');
        return true;
    }
    else {
        return false;
    }
}
