function showRegister() {
	$('.email-bg').fadeIn('fast');
	$('.email-box').fadeIn('fast');		
}


$(document).ready(function() {
		$("a.fancybox").fancybox({
			'overlayColor': '#1f0d01',
			'overlayOpacity': 0.6,
			'hideOnContentClick': false,
			'titleShow'			: false,
			'hideOnOverlayClick': false,
			'centerOnScroll'	: true
		});
		$("a.fancybox-cart").fancybox({
			'overlayColor': '#000000',
			'overlayOpacity': 0.7,
			'hideOnContentClick': false,
			'titleShow'			: false,
			'hideOnOverlayClick': false,
			'centerOnScroll'	: true,
			'onComplete'		: function() {
				$('.cart-plus').click(function () {
					var id = $(this).attr('rel');
					var amount = $('#amount-'+id).val();
					amount = parseInt(amount);
					amount = amount + 10;
					if (amount == 11) {amount = 10; }
					$('#amount-'+id).val(amount);
					return false;
				});
				$('.cart-minus').click(function () {
					var id = $(this).attr('rel');
					var amount = $('#amount-'+id).val();
					amount = parseInt(amount);
					amount = amount - 10;
					if (amount <= 0) {amount = 1; }
					$('#amount-'+id).val(amount);
					return false;
				});
				$('.add-box').click(function () {
					var id = $(this).attr('rel');
					var amount = $('#amount-'+id).val();
					var pack = $(this).attr('title');
					amount = parseInt(amount);
					pack = parseInt(pack);
					if (amount < pack) {amount = 0; }
					amount = amount + pack;
					
					$('#amount-'+id).val(amount);
					pack = 0;
					return false;
				});
				$('.add-to-cart-confirm').click(function () {
					var id = $(this).attr('rel');
					var amount = $('#amount-'+id).val();
					var product = $('#product-'+id).val();
					var button = $(this);
					$(this).fadeOut();
					$.ajax({
					   type: "POST",
					   url: "/ajax/add-to-cart.php",
					   data: "product="+product+"&amount="+amount,
					   success: function(msg){
						 $('#amount-'+id).val('1');
						 $('#add-block-'+id+" .fl").hide();
						 $('#ok-'+id).fadeIn();
						 $(button).fadeIn();
						 setTimeout("$.fancybox.close();",800);
						 
					   }
					 });					
					 return false;
				});
			},
			'onCleanup'			: function() {
				$('.cart-minus').unbind('click');
				$('.cart-plus').unbind('click');
				$('.add-box').unbind('click');
				$('.add-to-cart-confirm').unbind('click');
			},
			'onClosed'			: function() {
				 $('.product-small-add .fl').show();
				 $('.cart-add-ok').hide();
				 $.ajax({
				   url: "/ajax/cart.php",
				   success: function(msg){
					 $('.cart-left .holder').fadeOut('fast', function () {
						 $('.cart-left .holder').html(msg);				 
						 $('.cart-left .holder').fadeIn();				 
					 });				 
				   }
				 });
	
			}
		});
		$("a.fancybox-invite").fancybox({
			'type'				: 'iframe',
			'width'				: 640, 
			'height'			: 440,		
			'overlayColor'		: '#C7E428',
			'overlayOpacity'	: 0.6,
			'hideOnContentClick': false,
			'hideOnOverlayClick': false
		});
	});	

 jQuery(function( $ ){
 	var placeholder = $( "#placeholder" );
 	var message = $( "#sliding" );
	var view = $( window );

	view.bind(
	"scroll resize",
	function(){

	var placeholderTop = placeholder.offset().top;
 
	var viewTop = view.scrollTop();
 
	if (
	(viewTop > placeholderTop) &&
	!message.is( ".fixed" )
	){
	 
	placeholder.height(
	placeholder.height()
	);
	 
	// Make the message fixed.
	message.addClass( "fixed" );
	 
	// Check to see if the view has scroll back up
	// above the message AND that the message is
	// currently fixed.
	} else if (
	(viewTop <= placeholderTop) &&
	message.is( ".fixed" )
	){
	 
	// Make the placeholder height auto again.
	placeholder.css( "height", "auto" );
	 
	// Remove the fixed position class on the
	// message. This will pop it back into its
	// static position.
	message.removeClass( "fixed" );
	
	 
	}
	}
	);
 
});

(function($) { 
	$.fn.animBg = function(command,options) { 
		 if ( $('.loading-cart').is(':visible') ) { 
			if(command && typeof command ==='string'){
				clearInterval($(this).data('anim'));
				return this;
			}
			var $this = $(this),
			o = {'interval':100},
			options = (typeof command === 'object' && typeof options === 'undefined')?command:options,
			o = jQuery.extend({}, o, options), anim;
			if(!o.step && !o.steps){return this;}
			anim = setInterval(function() { 
				var bgpos = parseInt( $this.css('background-position') );
				$this.css('background-position',(-(o.step*o.steps)>=(bgpos-o.step)?0:bgpos-o.step)+'px 0');
			}, o.interval);
			$this.data('anim',anim);
			return this; 
		}
	}
})(jQuery); 



