$(function(){
    
    var $top_menu_links = $('<ul></ul>');
    
    $('.top_menu > li:nth-child(odd)').not(':last').each(function(){

    	var $link = $(this).find('a').text();
    	var $link_href = $(this).find('a').attr('href');
    	
    	$top_menu_links.append('<li><a href="'+$link_href+'">'+$link+'</a></li>');
    	
    });

    $('.image-additional img').fadeTo('fast', 0.7);
    
    $('.image-additional img').hover(function (){
    	$(this).fadeTo('fast', 1)
    }, function (){
    	$(this).fadeTo('fast', 0.7)
    })

    $('#foot_cats').append($top_menu_links);
   
    $('#main_column_st .product-image .image').hover(function(){
    	
    	$(this).append(
    		$('<a></a>')
    		.addClass('magnify fancybox')
    		.attr(
    			{
    				href : $(this).find('a').attr('href'),
    				title : $(this).find('a').attr('title'),
    				rel : "fancybox"
    			}
    		)
    	);
    	
    	$(this).find('.magnify').fadeIn();
    	$('.fancybox').fancybox({cyclic: true});
    	
    }, function(){
    	$(this).find('.magnify').fadeOut('fast', function(){
    		$(this).remove()
    	});
    })
    
    
    Cufon('.logo *, #main_column_st h2, .product-price, #main_column h2, .manufacturer-heading, .product-list .product_l .price .price-new, .product-list .product_l .name, .pagination .links a, .product_price_overlay, .pagination .links b, .column_head h3, #manuf, .top_menu > li a, .shop_info h2, .global_title h1, #language, #currency, .home .banner_title, .home .banner_show, .home .title h1, .home .subtitle, .drop_down *, #basket, .button, #welcome, .copyright, .welcome_to h1, .welcome_to h2');   
 
    Cufon('.light_menu li a, #welcome a', {
        hover: {
            color: '#000'
        }
    });
    
    
    Cufon('.featured h1, .latest h1');
    
    Cufon('footer .ending .container > ul > li > span',  {
            textShadow: '#000 1px 1px'
    });
    Cufon('footer .options .container > ul > li > span',  {

    });        

    Cufon.now();
   
    $("footer .options .container > ul > li > ul > li").hover(function(){
        
        $(this).animate({ 'margin-left' : 10}, 150)
        
    }, function(){
        $(this).animate({ 'margin-left' : 0}, 150)
    });
    
    $(".home .tw, .home .fb").hover(function(){
    	
    	$(this).fadeTo('fast', 1);
    	
    },function(){
    	
    	$(this).fadeTo('fast', 0.6);
    });
    
    $(".drop_down > ul li a").hover(function(){
        
       // get the color from css element 
        var $color = $(".c2").css('background-color');        

        $(this).animate({
            paddingLeft: '10px'
        }, 'fast')
        .css('background-color', $color)
    }, function(){
        $(this).animate({
            paddingLeft: '0px'
        }, 'fast')
        .css('background-color', 'transparent')
    })

    // top menu timeout function var
    var $top_menu_timeout = new Array();

    $(".top_menu > li").hover(function(){
        
        // clear timeout
        var $rel = $(this).children('a').attr('rel');
        clearTimeout($top_menu_timeout[$rel]);
        
        $(this).children('a').css({
            color : '#fff'
        });
        
        Cufon.replace('.top_menu > li a');

       // get the color from css element 
        var $color = $(".c1").css('background-color');
        
       // get li width
       var $li_width = $(this).width();
       
       // get current x position of li element
       var $position = $(this).position();
        
       // prepend a border to link
        if (!$("#hid_"+$rel).length){

            $(this).prepend(
            $("<div></div>")
            .attr({
                id : 'hid_'+$rel
            })
            .addClass("li_hover")
            .css({
                width : $li_width,
                height : 35,
                position : 'absolute',
                top : 1,
                left : $position.left
            })
            .fadeTo(0, 0.25)
           );

        }
       
       // animate the hover method
        
       $(this).stop().animate({
           backgroundColor: $color
           
       }, 'fast',function(){
           $(this).css('background-image', 'url(catalog/view/theme/Fashionista/image/pattern1.png)')
       });
       
       // open subcategories
       var $drop_id = $(this).children("a").attr('class');

       if($("#"+$drop_id).length)
       {
           $("#"+$drop_id).css({
               top: 35,
               left: $position.left
           }).fadeIn();

       }
       
    },function(){
        
        $.DropMenuClose($(this));
 
    });
    
    $.DropMenuClose = function($t)
    {
        var $t = $t;
        // clear timeout
        var $rel = $t.children('a').attr('class');
        
        $top_menu_timeout[$rel] = setTimeout(function(){

            $t.children('a').css({
                color : '#111010'
            });

            Cufon.replace('.top_menu > li a');

           $("#hid_"+$rel).remove();
           $t.css('background-image', 'none')
           $t.stop().animate({
               backgroundColor: '#f3f3f3'
           });

           // close subcategories
           var $drop_id = $t.children("a").attr('class');
           $("#"+$drop_id).fadeOut('fast');

        },0);
    }
    
    $(".drop_down").hover(function(){
        clearTimeout($top_menu_timeout[$(this).attr('id')]);
    }, function(){
        
        var $id = $(this).attr('id');
        var $tp = $('.top_menu > li a[class="'+$id+'"]').parent();

        $.DropMenuClose($tp);
    });
    
    
    // cart timeout
    var $cart_timeout;
    
    $("#basket, #basket_icon").hover(function(){
        clearTimeout($cart_timeout);
        
        $("#basket").addClass('c1');
        $("#basket").css('color', '#fff');
        Cufon.replace('#basket');
        $("#basket_icon").removeClass('basket_icon_closed').addClass('basket_icon_opened');
       
       $("#basket_drop").fadeIn('fast');
    }, function(){
        $.CartClose();
    });
    
    $("#basket_drop").hover(function(){
    	$("#basket").addClass('c1');
        clearTimeout($cart_timeout);
    }, function(){
        $.CartClose();
    });
    
    $.CartClose = function()
    {
        $cart_timeout = setTimeout(function(){
            
           $("#basket_icon").removeClass('basket_icon_opened').addClass('basket_icon_closed');
           
            $("#basket_drop").fadeOut('fast');
            $("#basket").removeClass('c1').css('color', '#000');
            Cufon.replace('#basket');
        },200);
        
    }

    $.ButtonOverlay = function()
    {
        $(".button").each(function(){

		if($(this).children("div").length){
			$(this).find("div").remove();
		} 
		

            $(this).append(
                $("<div></div>")
                .css({
                    'border' : '1px solid #fff',
                    width : $(this).width()-4,
                    height: $(this).height()-4,
                    position : 'absolute',
                    top : 1,
                    left : 1
                })
                .fadeTo(0,0.25)
            ); 

        });
    }
    
    $.ButtonOverlay();
    

    
});


    var $home_carousel;
    var $featured_carousel;
    var $latest_carousel;


$(function($){

    $(window).blur(function() {

      clearTimeout($home_carousel);
      clearTimeout($featured_carousel);
      clearTimeout($latest_carousel);
    });

    $(window).focus(function() {

        $home_carousel = setTimeout(function (){
        	$.HomeCarousel('negative')	
        },10000);

        $featured_carousel = setTimeout(function(){
            $.FeaturedCarousel('positive', '.featured')
        },10000);

        $latest_carousel = setTimeout(function(){
            $.FeaturedCarousel('positive', '.latest')
        },10000);

    });

    /* Home carousel */
    $.HomeCarousel = function($direction)
    {
		$elem = '.home .slideshow';
		
        var $selr = $($elem).find("ul li");
        var $item_len = $selr.width();
        var $curr_pos = parseInt($($elem).find("ul").css('left'));
        var $direction = $direction;
        var $elem = $elem;
		var $img_title;
		var $link;

		$(".home .banner_title").fadeOut('fast');

        if($direction == 'positive')
        {
        	
        	$img_title = $($elem).find('ul li:eq(1) img').attr('alt');
        	$link = $($elem).find('ul li:eq(1) a').attr('href');
        	
        	$($elem)
        	.animate({ right : 120, opacity : 0}, 'fast', null, function (){
        		
        		$($elem).find('ul li:last').after($($elem).find('ul li:first'));
        		
        	})
        	.animate({ right : 80 }, 0, null, function (){
				
                $('.home .banner_title')
                .attr({
                	href : $link,
                	title : $img_title
                })
                .html($img_title)
                .fadeIn('fast');
                Cufon.replace('.home .banner_title');   
        	})
        	.animate({ right : 100, opacity : 100 }, 'slow')
        	             
        } else {
        	
        	$img_title = $($elem).find('ul li:last img').attr('alt');
        	$link = $($elem).find('ul li:last a').attr('href');
        	
        	$($elem)
        	.animate({ right : 120, opacity : 0}, 'fast', null, function (){
        		
        		$($elem).find('ul li:first').before($($elem).find('ul li:last'));
        		
        		
        		
        	})
        	.animate({ right : 80 }, 0, null, function (){
				
                $('.home .banner_title')
                .attr({
                	href : $link,
                	title : $img_title
                })
                .html($img_title)
                .fadeIn('fast');
                Cufon.replace('.home .banner_title');   
        	})
        	.animate({ right : 100, opacity : 100 }, 'slow');
        	
                 
        }

        $home_carousel = setTimeout(function() {
        	$.HomeCarousel('negative')	
        },10000);

    }

    /* Featired carousel */
    $.FeaturedCarousel = function($direction, $elem)
    {
        var $selr = $($elem).find("ul li");
        var $item_len = $selr.width()+20;
        var $curr_pos = parseInt($($elem).find("ul").css('left'));
        var $direction = $direction;
        var $elem = $elem;

        if($direction == 'positive')
        {
            $($elem).find('ul').animate({ left : $curr_pos - $item_len }, 'slow', null, function(){
                $($elem).find('ul li:last').after($($elem).find('ul li:first'));
                $($elem).find('ul').css({'left' : '-'+$item_len+'px'});
            });                    
        } else {
            $($elem).find("ul").animate({ left : $curr_pos + $item_len }, 'slow', null, function(){
                $($elem).find('ul li:first').before($($elem).find('ul li:last'));
                $($elem).find('ul').css({'left' : '-'+$item_len+'px'});
            });                    
        }

        if($elem == '.featured')
        {
            $featured_carousel = setTimeout(function(){
                $.FeaturedCarousel('positive', $elem)
            },10000);                
        } else {
            $latest_carousel = setTimeout(function(){
                $.FeaturedCarousel('positive', $elem)
            },10000);                    
        }

    }


    $home_carousel = setTimeout($.HomeCarousel,10000);

    $featured_carousel = setTimeout(function(){
        $.FeaturedCarousel('positive', '.featured')
    },10000);

    $latest_carousel = setTimeout(function(){
        $.FeaturedCarousel('positive', '.latest')
    },10000);

    $('.featured .arr_left').click(function(event){
        event.preventDefault();
        clearTimeout($featured_carousel);
        $.FeaturedCarousel('negative', '.featured');

    });

    $('.featured .arr_right').click(function(event){
        event.preventDefault();
        clearTimeout($featured_carousel);
        $.FeaturedCarousel('positive', '.featured');                
    });
    
    // main carousel home
    $('.slide .arr_left').click(function(event){
        event.preventDefault();
        clearTimeout($home_carousel);
        $.HomeCarousel('negative');

    });

    $('.slide .arr_right').click(function(event){
        event.preventDefault();
        clearTimeout($home_carousel);
        $.HomeCarousel('positive');                
    });

    $('.latest .arr_left').click(function(event){
        event.preventDefault();
        clearTimeout($latest_carousel);
        $.FeaturedCarousel('negative', '.latest');

    });

    $('.latest .arr_right').click(function(event){
        event.preventDefault();
        clearTimeout($latest_carousel);
        $.FeaturedCarousel('positive', '.latest');                
    });



    /* Price tag overlay */
    $('.latest li, .featured li').mouseenter(function(){

        if(!$(this).find('.price_overlay').length) {

            var $url = $(this).find('a').attr('href');
            var $price = $(this).find('.price-new').html();

            $(this).find('img').hide();

            $(this).append(
                $('<a></a>')
                .attr({
                    href : $url
                })
                .addClass('price_overlay')
                .html($price)
                .fadeIn()
            );

            Cufon('.price_overlay');    


        }

    }).mouseleave(function(){
        $(this).find('img').show();
        $(this).find('.price_overlay').remove();
    });

});


$(document).ready(function() {
	/* Search */
	$('.search_btn').bind('click', function() {
		url = 'index.php?route=product/search';
		 
		var filter_name = $('input[name=\'filter_name\']').attr('value')
		
		if (filter_name) {
			url += '&filter_name=' + encodeURIComponent(filter_name);
		}
		
		location = url;
	});
	
	$('input[name=\'filter_name\']').keydown(function(e) {
		if (e.keyCode == 13) {
			url = 'index.php?route=product/search';
			 
			var filter_name = $('input[name=\'filter_name\']').attr('value')
			
			if (filter_name) {
				url += '&filter_name=' + encodeURIComponent(filter_name);
			}
			
			location = url;
		}
	});
	
	/* Ajax Cart */
	$('#basket, #basket_icon').hover(function() {
		
		$.AjaxCart();			

	});
	
        
        /* Ajax Cart function */
        $.AjaxCart = function()
        {
		$.ajax({
			url: 'index.php?route=checkout/cart/update',
			dataType: 'json',
			success: function(json) {
				if (json['output']) {
					$('#basket_content').html(json['output']);
                                        
                                        $("#basket_content > .total").remove();
                                        $("#basket_content .cart .image").remove();
                                        
                                        $('#basket_content .cart .remove img')
                                        .attr({
                                            src : 'catalog/view/theme/Fashionista/image/close.png'
                                        })
                                        .css({
                                            cursor : 'pointer'
                                        });

                                        $("#basket_content .checkout a").removeClass("button c2");
                                        $("#basket_content .checkout").addClass("button c2").removeClass("checkout");
                                        Cufon.replace('#cart_total, .button');
                                        $.ButtonOverlay();
				}
			}
		});            
        }
        
	/* Mega Menu */
	$('#menu ul > li > a + div').each(function(index, element) {
		// IE6 & IE7 Fixes
		if ($.browser.msie && ($.browser.version == 7 || $.browser.version == 6)) {
			var category = $(element).find('a');
			var columns = $(element).find('ul').length;
			
			$(element).css('width', (columns * 143) + 'px');
			$(element).find('ul').css('float', 'left');
		}		
		
		var menu = $('#menu').offset();
		var dropdown = $(this).parent().offset();
		
		i = (dropdown.left + $(this).outerWidth()) - (menu.left + $('#menu').outerWidth());
		
		if (i > 0) {
			$(this).css('margin-left', '-' + (i + 5) + 'px');
		}
	});

	// IE6 & IE7 Fixes
	if ($.browser.msie) {
		if ($.browser.version <= 6) {
			$('#column-left + #column-right + #content, #column-left + #content').css('margin-left', '195px');
			
			$('#column-right + #content').css('margin-right', '195px');
		
			$('.box-category ul li a.active + ul').css('display', 'block');	
		}
		
		if ($.browser.version <= 7) {
			$('#menu > ul > li').bind('mouseover', function() {
				$(this).addClass('active');
			});
				
			$('#menu > ul > li').bind('mouseout', function() {
				$(this).removeClass('active');
			});	
		}
	}
});

$('.success img, .warning img, .attention img, .information img').live('click', function() {
	$(this).parent().fadeOut('slow', function() {
		$(this).remove();
	});
});

function addToCart(product_id) {
	
	$.ajax({
		url: 'index.php?route=checkout/cart/update',
		type: 'post',
		data: 'product_id=' + product_id,
		dataType: 'json',
		success: function(json) {
			$('.success, .warning, .attention, .information, .error').remove();
			
			if (json['redirect']) {
				location = json['redirect'];
			}
			
			if (json['error']) {
				if (json['error']['warning']) {
					$('#notification').html('<div class="warning" style="display: none;">' + json['error']['warning'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
				}
			}	 
						
			if (json['success']) {
				$('#notification').html('<div class="attention" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
				
				$('.attention').fadeIn('slow');
				
				$('#cart_total').html(json['total']);
				
                                
                                $.AjaxCart();
                                $("#basket_drop").fadeIn('fast');
                                $("#basket_icon").removeClass('basket_icon_closed').addClass('basket_icon_opened');
                                $("#basket").addClass('c1').css('color', '#fff');

                                Cufon.replace('#cart_total, .button, #basket');
				$('html, body').animate({scrollTop: 0}, 'slow', function(){
					setTimeout(function(){
                                $("#basket_drop").fadeOut('fast');
                                $("#basket").removeClass('c1').css('color', '#000');
                                Cufon.replace('#basket');
                                $("#basket_icon").removeClass('basket_icon_opened').addClass('basket_icon_closed');						
					},5000);
				}); 
			}	
		}
	});
}

function removeCart(key) {
	$.ajax({
		url: 'index.php?route=checkout/cart/update',
		type: 'post',
		data: 'remove=' + key,
		dataType: 'json',
		success: function(json) {
			$('.success, .warning, .attention, .information').remove();
			
			if (json['output']) {
				$('#cart_total').html(json['total']);
				
				$('#basket_content').html(json['output']);

                                        $("#basket_content > .total").remove();
                                        $("#basket_content .cart .image").remove();
                                        
                                        $('#basket_content .cart .remove img')
                                        .attr({
                                            src : 'catalog/view/theme/Fashionista/image/close.png'
                                        })
                                        .css({
                                            cursor : 'pointer'
                                        });
                                        
                                        $("#basket_content .checkout a").removeClass("button c2");
                                        $("#basket_content .checkout").addClass("button c2").removeClass("checkout");
                                        
                                        
                                        
                                        Cufon.replace('#cart_total, .button');
                                        $.ButtonOverlay();
                                
			}			
		}
	});
}

function removeVoucher(key) {
	$.ajax({
		url: 'index.php?route=checkout/cart/update',
		type: 'post',
		data: 'voucher=' + key,
		dataType: 'json',
		success: function(json) {
			$('.success, .warning, .attention, .information').remove();
			
			if (json['output']) {
				$('#cart_total').html(json['total']);
				
				$('#cart .content').html(json['output']);
			}			
		}
	});
}

function addToWishList(product_id) {
	$.ajax({
		url: 'index.php?route=account/wishlist/update',
		type: 'post',
		data: 'product_id=' + product_id,
		dataType: 'json',
		success: function(json) {
			$('.success, .warning, .attention, .information').remove();
						
			if (json['success']) {
				$('#notification').html('<div class="attention" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');
				
				$('.attention').fadeIn('slow');
				
				$('#wishlist_total').html(json['total']);
				
				$('html, body').animate({scrollTop: 0}, 'slow');
				Cufon.replace('.light_menu > li a');				
			}	
		}
	});
}

function addToCompare(product_id) { 
	$.ajax({
		url: 'index.php?route=product/compare/update',
		type: 'post',
		data: 'product_id=' + product_id,
		dataType: 'json',
		success: function(json) {
			$('.success, .warning, .attention, .information').remove();
						
			if (json['success']) {
				$('#notification').html(json['success'] + ' <a href="#" class="close"><img src="catalog/view/theme/Fashionista/image/close.png" alt="" /></a>').fadeIn();
				
				$('#notification .close').click(function(event){
					event.preventDefault();
					$(this).parent().fadeOut('slow',function(){
						$(this).html('')
					});
				});
				
				$('#compare_total').html(json['total']);
				
				$('html, body').animate({scrollTop: 326}, 'slow'); 
				
			}	
		}
	});
}

function addToCompare2(product_id) { 
	$.ajax({
		url: 'index.php?route=product/compare/update',
		type: 'post',
		data: 'product_id=' + product_id,
		dataType: 'json',
		success: function(json) {
			$('.success, .warning, .attention, .information').remove();
						
			if (json['success']) {
				
				$('body').append(
					$('<div></div>')
					.addClass('body_notify c1')
					.html(json['success'] + ' <a href="#" class="close"><img src="catalog/view/theme/Fashionista/image/close.png" alt="" /></a>')
				);
				
				$('.body_notify').animate({
					right : 0
				});
				
				$('.body_notify .close').click(function(event){
					event.preventDefault();
					$(this).parent().animate({
						right : '-500px'
					}, function(){
						$(this).remove()
					});
						
				});
				
				
			}	
		}
	});
}

$(function($){
    /**
     * Find selected language code and put on first spot
     */
    var $lang_code = $('input[name="curr_lang"]').val();

    var $sel_lang = $('#language a[class="'+$lang_code+'"]').parent();

    $('#language a[class="'+$lang_code+'"]').parent().remove();
    $('#language li:first').before($sel_lang);
    /**
     * Find selected language code and put on first spot
     */
    var $curr_code = $('input[name="curr_curr"]').val();

    var $sel_curr = $('#currency a[class="'+$curr_code+'"]').parent();

    $('#currency a[class="'+$curr_code+'"]').parent().remove();
    $('#currency li:first').before($sel_curr);

});

$(function($){
	
	$('.product_l .cart').live('click', function(event){
		
		event.preventDefault();
		$rel = $(this).attr('rel');
		
		addToCart($rel);
		return false
	});
	
	$('.product-filter .display .list').click(function(event){
		
		event.preventDefault();
		
		if($('.product-list').is(':hidden'))
		{
			$('.product-grid').fadeOut('fast',function(){
				$('.product-list').fadeIn();
			});
			$.cookie('display', 'list');
		}
	});

	$('.product-filter .display .grid').click(function(event){
		
		event.preventDefault();
		
		if($('.product-grid').is(':hidden'))
		{
			$('.product-list').fadeOut('fast',function(){
				$('.product-grid').fadeIn();
			});
			$.cookie('display', 'grid');
		}
	});
	
	var $view = $.cookie('display');

	if ($view == 'list') {
			$('.product-grid').hide(0,function(){
				$('.product-list').show();
			});
	} else if($view == 'grid')
	{
			$('.product-list').hide(0,function(){
				$('.product-grid').show();
			});		
	} else {
			$('.product-list').hide(0,function(){
				$('.product-grid').show();
			});				
	}
	
	$('.search #search').focus(function(){
		
		var $rel = $(this).attr('class');
		if($(this).val() == $rel) $(this).val('');
		
		$(this).animate({
			width : 150
		})
	});
	
	$('.search #search').blur(function(){
		
		var $rel = $(this).attr('class');
		var $val = $(this).val();
		if($val == $rel || !$val.length) $(this).val($rel);
		
		$(this).animate({
			width : 80
		})		
	});
	
	$('.product_l .wishlist').click(function(event){
		
		event.preventDefault();
		$rel = $(this).attr('rel');
		
		addToWishList($rel);
	});

	$('.product_l .compare').click(function(event){
		
		event.preventDefault();
		$rel = $(this).attr('rel');
		
		addToCompare($rel);
	});	
	
    $('#language li:not(:first), #currency li:not(:first), #manuf li:not(:first)').css('margin-top', '5px').css('margin-bottom', '0px').hide();
	$('#language li:not(:first) a, #currency li:not(:first) a, #manuf li:not(:first) a')
	.css('padding', '6px 0px 6px 0px');

$('#language li:last, #currency li:last, #manuf li:last').css('padding-bottom', '4px');
	

    $('#language li a').click(function(event){
       event.preventDefault();

       var $rel = $(this).attr('class');

       $('input[name="language_code"]').val($rel).submit();

       $(this).parent().parent().parent().submit();


    });

    $('#currency li a').click(function(event){
       event.preventDefault();

       var $rel = $(this).attr('class');

       $('input[name="currency_code"]').val($rel).submit();

       $(this).parent().parent().parent().submit();


    });

    $('#language,#currency,#manuf').hover(function(event){

        event.preventDefault();

        $(this).children('li:hidden').fadeIn();

    }, function(){

        $(this).children('li:not(:first)').hide();

    });
    
    $('#language a:not(:first),#currency a:not(:first),#manuf a:not(:first)').hover(function(){
        var $color = $(".c2").css('background-color');        

        $(this)
        .animate({
            paddingLeft: '10px',
            paddingRight : '10px'
        }, 'fast')
        .css('background-color', $color)    	
    }, function(){
        $(this)
        .animate({
            paddingLeft: '0px'
        }, 'fast')
        .css('background-color', 'transparent')       	
    });
       
    $('.product-list .product_l').hover(function(){

		$t = $(this);
		
    	$t.find('.prod_overlay').fadeTo(0, 0.6).animate({
    		height: 213
  		},'fast');
  		
  		$t.find('.product_price_overlay').animate({
  			top : 50,
  			opacity : 'toggle'
  		});
  		$t.find('.cart').fadeIn();
  		$t.find('.wishlist').fadeIn();  
  		$t.find('.compare').fadeIn();  
  		  
  		
    }, function(){
    	
    	$t = $(this);    	
    	
    	$t.find('.prod_overlay').hide().css('height', '0px');
    	$t.find('.product_price_overlay').animate({
    		opacity : 'toggle',
    		top : -30
    	});
  		$t.find('.cart').fadeOut();
  		$t.find('.wishlist').fadeOut();  
  		$t.find('.compare').fadeOut();  
    	
    });
    
    $('.product-grid .product_l').hover(function(){

		$t = $(this);
		
    	$t.find('.prod_overlay').fadeTo(0, 0.6).animate({
    		height: 213
  		},'fast');
  		
  		$t.find('.product_price_overlay').animate({
  			top : 30,
  			opacity : 'toggle'
  		});
  		$t.find('.cart').fadeIn();  		
  		setTimeout(function(){
  			$t.find('.name').show();
  		},200);
  		
    }, function(){
    	
    	$t = $(this);    	
    	
    	$t.find('.prod_overlay').hide().css('height', '0px');
    	$t.find('.product_price_overlay').animate({
    		opacity : 'toggle',
    		top : -30
    	});
  		$t.find('.cart').fadeOut();
    	$t.find('.name').hide();
    	
    });
    
    $('.pagination .links a').hover(function(){
    	
    	var $color = $(".c1").css('background-color');
    	
    	
    	$(this).css({
    		'background-color' : $color,
    		'color' : '#fff'	
    	});
    	Cufon.replace($(this));
    	
    }, function(){
    	
    	$(this).css({
    		'background-color' : '#ebebeb',
    		'color' : '#636363'
    	});
    	Cufon.replace($(this));
    	
    });
    
    $('.pagination .links b').addClass('c1');
    $('.pagination .links').find(":contains('|<')").html('<<');
    $('.pagination .links').find(":contains('>|')").html('>>');
    Cufon.replace($('.pagination .links').find(":contains('>>')"));
    Cufon.replace($('.pagination .links').find(":contains('<<')"));
    
});

$('.cart-module .cart-heading').bind('click', function() {
	
	$(this).find('span').toggleClass('head_arr head_arr2');
	
		
	$(this).parent().find('.cart-content').slideToggle('slow', function(){
		
        $(".button").each(function(){

		if($(this).children("div").length){
			$(this).find("div").remove();
		} 
		
            $(this).append(
                $("<div></div>")
                .css({
                    'border' : '1px solid #fff',
                    width : $(this).width()-4,
                    height: $(this).height()-4,
                    position : 'absolute',
                    top : 1,
                    left : 1
                })
                .fadeTo(0,0.25)
            ); 

        });
	});
	
});

