Promotions = {
	
	checkForGiftPromotion : function( subtotal_price ) {

		$.post( document.location.toString(), { action : 'promotions_find_gift', subtotal : subtotal_price }, function( data ) {
			try
			{
				if( data == 'failed' ) {
					$( '.checkout-box.promo').hide("slow");
				} else {
					eval( data );

					if( gift[0].description != '' ) {
						if(gift[0].type == '-2') {
							var postage = parseFloatX( $('.shipping-postage').html() );
							var total = parseFloatX( $('.shipping-total' ).html() );

							$('.shipping-postage').html( '&pound;0.00' );
							$('.shipping-total').html( '&pound;' + Transform.fixNum( total - postage ) );
							$('.shipping-discount').html( '&pound;-' + Transform.fixNum( postage ) );
							$('#promotion_discount').val( Transform.fixNum( postage ) );

							$('#promotion_type').val( gift[0].type );
							$('#promotion_id').val( gift[0].id );

							$( '.checkout-box.promo .name-info small' ).html( gift[0].description );
							$( '.checkout-box.promo' ).show("slow");
							//$( '#promotion_gift' ).val("1");
						} else {
							$( '.checkout-box.promo .name-info small' ).html( gift[0].description );
							$( '.checkout-box.promo' ).show("slow");
							$( '#promotion_gift' ).val("1");
						}
					}
				}
			}
			catch (ex)
			{
			}
		});
	}
}