    function number_format ( Number , Digits )
    {
        Number = Math.round ( Number * Math.pow ( 10 , Digits ) ) / Math.pow ( 10 , Digits ) ;
        var One = Number + '' ;
        var Two = One.split ( '.' ) ;
        if ( !Two[0] )
        {
            Two[0] = '0' ;
        }
        if ( !Two[1] )
        {
            Two[1] = '' ;
        }
        if ( Two[1].length < Digits )
        {
            var Three = Two[1] ;
            for ( var Index = Two[1].length + 1 ; Index <= Digits ; Index = Index + 1 )
            {
                Three += '0' ;
            }
            Two[1] = Three ;
        }
        if ( Two[0].length > 3 )
        {
            var Four = Two[0] ;
            Two[0] = '' ;
            for ( Index = 3 ; Index < Four.length ; Index = Index + 3 )
            {
                var Five = Four.slice ( Four.length - Index , Four.length - Index + 3 ) ;
                Two[0] = ',' + Five +  Two[0] + '' ;
            }
            Index = Four.substr ( 0 , ( Four.length % 3 == 0 ) ? 3 : ( Four.length % 3 ) ) ;
            Two[0] = Index + Two[0] ;
        }
        var Six = ( Digits <= 0 ) ? '' : '.' ;
        return Two[0] + Six + Two[1] ;
    }

    function Set_Total ( )
    {

        var Material = $F('Material') ;
        var Quantity = $F('Quantity') ;
        var Banner_Height = $F('Banner_Height') ;
        var Banner_Length = $F('Banner_Length') ;
        var Code = $F('Code') ;
        var Material_Options = null ;
        if ( $('Material_Options_Container') )
        {
            if ( $('Material_Options_').checked )
            {
                Material_Options = $('Material_Options_').value ;
            }
        }
        else
        {
        }
        var Grommetted_Options = null ;
        if ( $('Grommetted_Options_Container') )
        {
            Grommetted_Options = $F('Grommetted_Options') ;
        }
        else
        {
        }

        var Double_Sided = null ;

        if ( 'Gloss Vinyl' == Material || 'Matte Vinyl' == Material || 'Bio-Banner' == Material || 'DyeSub Fabric' == Material || 'Fabric Banner SOLVENT' == Material )
        {
            if ( $('Double_Sided_Container') )
            {
                if ( 'Yes' == $F('Double_Sided') )
                {
                    Double_Sided = 'Yes' ;
                }
                else
                {
                    Double_Sided = 'No' ;
                }
            }
            else
            {
                Double_Sided = 'No' ;
            }
        }
        else
        {
            Double_Sided = 'N/A' ;
        }

        var Coupon     = 0 ;
        var Discount   = 0 ;
        var Gross      = 0 ;
        var Net        = 0 ;
        var Unit_Price = 0 ;

        if ( 'Canvas Art Print' == Material )
        {
            Unit_Price = 5.75 ;
        }
        else if ( 'Bio-Banner' == Material )
        {
            Unit_Price = 4.75 ;
        }
        else if ( 'DyeSub Fabric' == Material )
        {
            Unit_Price = 6.00 ;
        }
        else if ( 'Gloss Vinyl' == Material )
        {
            Unit_Price = 2.20 ;
        }
        else if ( 'Matte Vinyl' == Material )
        {
            Unit_Price = 2.20 ;
        }
        else if ( 'Mesh Vinyl' == Material )
        {
            Unit_Price = 3.75 ;
        }
        else if ( 'Poster' == Material )
        {
            Unit_Price = 3.75 ;
        }
        else if ( 'Tradeshow Film' == Material )
        {
            Unit_Price = 4.50 ;
        }
        else if ( 'Perforated Window Sticker' == Material )
        {
            Unit_Price = 4.25 ;
        }
		else if ( 'Fabric Banner SOLVENT' == Material )
        {
            Unit_Price = 4.00 ;
        }
		else if ( 'Adhesive Vinyl' == Material )
        {
            Unit_Price = 3.25 ;
        }
		else
        {
            Unit_Price = 0 ;
        }

        Gross = Quantity * ( Banner_Height * Banner_Length ) * Unit_Price ;

        if ( 'Yes' == Double_Sided )
        {
            Gross = Gross * 2 ;
        }
        else
        {
        }

        Square_Footage = Quantity * ( Banner_Height * Banner_Length ) ;

        if ( 0 <= Square_Footage && Square_Footage <= 49 )
        {
            Discount = 0 ;
        }
        else if ( 50 <= Square_Footage && Square_Footage <= 74 )
        {
            Discount = 10 ;
        }
        else  if ( 75 <= Square_Footage && Square_Footage <= 149 )
        {
            Discount = 20 ;
        }
        else  if ( 150 <= Square_Footage && Square_Footage <= 199 )
        {
            Discount = 30 ;
        }
        else  if ( 200 <= Square_Footage )
        {
            Discount = 40 ;
        }
        else
        {
            Discount = 0 ;
        }

        if ( Quantity <= 10 )
        {
            if ( Coupons[Code] )
            {
                Coupon = Coupons[Code] ;
            }
            else
            {
                Coupon = 0 ;
            }
        }
        else
        {
            Coupon = 0 ;
        }

        Net = Gross ;

        if ( Discount > 0 )
        {
            Net = Net - ( ( Net * Discount ) / 100 ) ;
        }
        else
        {
        }

        if ( Coupon > 0 )
        {
            Net = Net - ( ( Net * Coupon ) / 100 ) ;
        }
        else
        {
        }

        if ( '4 Sided Hems - Extra $12.00' == Material_Options )
        {
            Gross = Gross + ( Quantity * 12 ) ;
            Net = Net + ( Quantity * 12 ) ;
        }
        else
        {
        }

        if ( 'Pole Pockets - Extra $12.00' == Grommetted_Options )
        {
            Gross = Gross + ( Quantity * 12 ) ;
            Net = Net + ( Quantity * 12 ) ;
        }
        else
        {
        }

        Temporary = '$' + number_format ( Gross - Net , 2 ) ;

        Gross = '$' + number_format ( Gross , 2 ) ;

        Net = '$' + number_format ( Net , 2 ) ;

        Element.update ( 'Subtotal' , Gross     ) ;
        Element.update ( 'Discount' , Temporary ) ;
        Element.update ( 'Total'    , Net       ) ;

        return true ;

    }

    function Set_Material ( )
    {
        var Material = $F('Material') ;
        if ( 'Gloss Vinyl' == Material || 'Mesh Vinyl' == Material || 'Matte Vinyl' == Material || 'Tradeshow Film' == Material || 'DyeSub Fabric' == Material || 'Bio-Banner' == Material || 'Fabric Banner SOLVENT' == Material )
        {
            Element.show('Material_Options_Container'  ) ;
            Element.show('Grommetted_Container'        ) ;
            Element.show('Grommetted_Options_Container') ;
        }
        else
        {
            Element.hide('Material_Options_Container'  ) ;
            Element.hide('Grommetted_Container'        ) ;
            Element.hide('Grommetted_Options_Container') ;
        }
        Set_Double_Sided ( ) ;
        return true ;
    }

    function Set_Double_Sided ( )
    {
        var Material = $F('Material') ;
        if ( 'Gloss Vinyl' == Material || 'Matte Vinyl' == Material || 'Bio-Banner' == Material || 'DyeSub Fabric' == Material || 'Fabric Banner SOLVENT' == Material )
        {
            Element.show('Double_Sided_Container') ;
        }
        else
        {
            Element.hide('Double_Sided_Container') ;
        }
        return true ;
    }
