jQuery(document).ready(function() {
	$('body').nivoZoom();
/*    IE='\v'=='v';
    var clientWidth = parseInt(jQuery(window).width());
    var wrapperWidth = parseInt(jQuery('#wrapper').width());
    if (wrapperWidth < clientWidth) {
        var wrapperMargin = (clientWidth-wrapperWidth)/2;
        jQuery('#wrapper').css('margin-left', wrapperMargin+'px');        
    }  
    if (IE) {  
        var containerW = 0;
        jQuery("#head .menu li ul").each(function() {
            var container = this;
            containerW = 0;
            jQuery(this).find("a").each(function() {
                if (jQuery(this).html().length*10 > containerW) {
                    containerW = jQuery(this).html().length*10;
                }
            });
            jQuery(container).width(parseInt(containerW)); 
        });   
    }*/
});
jQuery("#head .menu li").live('mouseover', function() {
    jQuery(this).find('ul').show();
});
jQuery("#head .menu li").live('mouseout', function() {
    jQuery(this).find('ul').hide();
});
jQuery("#head .menu li ul").live('mouseover', function() {
    jQuery(this).parent().find('ul').show();
});
jQuery("#head .menu li ul").live('mouseout', function() {
    jQuery(this).parent().find('ul').hide();
});
jQuery(".description-box .buttons .no-active").live('click', function() {			
	jQuery(".description-box .buttons a.active").removeClass('active').addClass('no-active');
	jQuery(this).addClass('active');	
	$('.description-box .box .box_item').hide();			
	$('.description-box .box #box_'+jQuery(this).attr('id')).show();	    
    return false;
});
jQuery(".description-box .buttons .active").live('click', function() {
    return false;
});

jQuery(".add_to_cart_btn").live('click', function() {    	
	jQuery.ajax({
		url: '/cart/add',
		type: 'POST',
		dataType: 'json',
		data: $(this).parent().serialize(),
		success: function( response ){
			$( '#cart_count' ).text( response.total_items );
			$( '#cart_total' ).text( response.total );						
			
			alert( 'Товар добавлен в корзину' );
			//$('.messanger').text( 'Товар добавлен в корзину' ).fadeIn().fadeOut(4000);
		}		
	})
	
});


