 $(document).ready(function(){

	
	// BUTTONS MOUSE OVER
	$('a.more, a.add-to-cart, a.store-locator').hover(function(){
			
			$('span', this).stop(true, false).animate({
					marginLeft: 44
				}, {
					duration: 200,
					easing: 'swing'
				});
			
		}, function(){
			$('span', this).stop(true, false).animate({
					marginLeft: 39
				}, {
					duration: 200,
					easing: 'swing'
				});

		}
	);
	


	
	// SHOW CART
	//visinaKolica = $("#cart").height();
	//$('div.left').css('float');
	
	
	$("#view-cart").parent().hover(function(){
		var visina = -$("#cart").height()-30;
		var pomak = {"bottom" : visina};
		$(this).find("#cart").stop(true,false).animate(pomak, {
					duration: 400,
					easing: 'easeOutBack'
				});
	},function(){
		$(this).find("#cart").stop(true,false).animate({
					bottom: 70
				}, {
					duration: 300,
					easing: 'swing'
				});
	})
	
	// BUTTONS MOUSE OVER
	$('#quick-checkout, #language li').hover(function(){
			
			$('span, a', this).stop(true, false).animate({
					opacity: 1
				}, {
					duration: 200,
					easing: 'swing'
				});
			
		}, function(){
			$('span, a', this).stop(true, false).animate({
					opacity: 0
				}, {
					duration: 200,
					easing: 'swing'
				});

		}
	);		
	
		//product gallery
		$("#product-thumbs > img").click(function() {
		
			if(!$(this).hasClass('selected')){
				var image = $(this).attr("rel");
				var imgTitle = $(this).attr("alt");
				$('#product-image').hide();
				$('#product-image').html('<img alt="' + imgTitle + '" src="' + image + '"/>');
				$('#product-image').fadeIn('slow');
				
			}
			$("#product-thumbs img").removeClass('selected');
			$(this).addClass('selected');
		});
	


	
	// COMMA AFTER EVERY 3 DIGITS
	$.fn.digits = function(){ 
		return this.each(function(){ 
			$(this).text( $(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,') ); 
		})
	}	
		//CALLING THE FUNCTION:
		$('.price').digits();
		

	// SCROLLABLE


		
	//CUFON
	/*
			Cufon.replace('#languages a, #quick-look a span,  #quick-look a', {
				hover: true,
				hoverables: { a: true, span: true }
			});
	*/
			Cufon.replace('#webshop-main .category-title, #product-category-title, .product .title a, #product-title');
			
	Cufon.now();
	
		$(function(){
			$.fn.supersized.options = {  
				startwidth: 1300,  
				startheight: 800,
				vertical_center: 0,
				slides : [
					{image : '/template/site/images/new/bg-webshop.jpg' }
				]
			};
	        $('#supersized').supersized(); 
	    });
	
	
	
 });
