/*---------------------------
main.js

Studio IMI

info@studioimi.com
----------------------------*/

$(document).ready(function() {
	
	// Params
	var jModule = $.url.param("module");
	
	if (jModule == null) {
		jModule = 'home';
	} else {
		$('#menu').css({ 'background': 'transparent url(/images/menu-b-bg.png) no-repeat' });
	}
	
	// Colorbox
	$('.item .thumb').colorbox({ transition: 'elastic', speed: 500 });
	
	// Cart
	$('.add-to-cart').hover(function(){
		$(this).attr('src', '/images/shop/add-to-cart-hover.png');
	});
	$('.add-to-cart').mouseleave(function(){
		$(this).attr('src', '/images/shop/add-to-cart.png');
	});
	$('.view-cart').hover(function(){
		$(this).attr('src', '/images/shop/view-cart-hover.png');
	});
	$('.view-cart').mouseleave(function(){
		$(this).attr('src', '/images/shop/view-cart.png');
	});
	
	$('.add-to-cart').live('click', function() { 
		var oForm = $(this).parents('form:first');
		$.post("/includes/modules/cart.mod.php", $(oForm).serialize(), function() {
			$.fn.colorbox({ iframe: true, href:"/includes/modules/cart.mod.php", width:  '505px', height: '600px', scrolling: false, transition:'elastic', speed:500 });
			}
		);
		return false;
	});
	$('.view-cart').live('click', function() { 
		$.fn.colorbox({ iframe: true, href:"/includes/modules/cart.mod.php", width:  '505px', height: '600px', scrolling: false, transition:'elastic', speed:500 });
		return false;
	});
});
