$(document).ready(function() {	/*------Header Dropdowns------*/	$('.account_dropdown').hide();	$('.header_my_account').click(  		function(){			$('.account_dropdown').show();			$('.header_my_account').addClass('my_account_selected');  		}	 );		$('.header_newsletter_block').hide();	$('.header_newsletter').click(  		function(){			$('.header_newsletter_block').show();			$('.header_newsletter').addClass('newsletter_selected');  		}	 );		$('#footer_newsletter').click(  		function(){			$('.header_newsletter_block').show();			$('.header_newsletter').addClass('newsletter_selected');  		}	 );	$('.header_newsletter_block').click(  		function(){			$('.header_newsletter_block').show();			$('.header_newsletter').addClass('newsletter_selected');  		}	 );	$('.category_main_list').hide();	$('.category_main_list_head').click(function(){      $('.category_main_list').show();		$(".category_main_list_head").css({'background-color': '#8d8d8d', 'color':'#FFF','background-position':'right -14px'});	});		$('html').click(function() {		$('.account_dropdown').hide();		$('.header_my_account').removeClass('my_account_selected');		$('.header_newsletter_block').hide();		$('.header_newsletter').removeClass('newsletter_selected');		$('.category_main_list').hide();		$(".category_main_list_head").css({'background-color': '', 'color':'#171717','background-position':'right 10px'}); 	});	$('.header_my_account').click(function(event) {       event.stopPropagation();	});	$('.header_newsletter').click(function(event) {       event.stopPropagation();	});	$('.header_newsletter_block').click(function(event) {       event.stopPropagation();	});	$('.category_main_list_head').click(function(event) {       event.stopPropagation();	});/*------Main Menu------*/	 if ($('#home_selector').length > 0) {		 $(".menu_home").addClass("menu_selected");	 }	 if (document.location.href.indexOf("labels") > -1) {		 $(".menu_labels").addClass("menu_selected");	 }		 $(".labels_dropdown").mouseover(function() {		 $(".menu_labels").addClass("labels_hover");	 });	 	 $(".labels_dropdown").mouseout(function() {		 $(".menu_labels").removeClass("labels_hover");	 });		 if (document.location.href.indexOf("special") > -1) {		 $(".menu_specials").addClass("menu_selected");	 }	 	 if (document.location.href.indexOf("gifts") > -1) {		 $(".menu_gifts").addClass("menu_selected");	 }	 	 if (document.location.href.indexOf("events") > -1) {		 $(".menu_events").addClass("menu_selected");	 }	 	 if (document.location.href.indexOf("about") > -1) {		 $(".menu_about").addClass("menu_selected");	 }	 	 if (document.location.href.indexOf("contact") > -1) {		 $(".menu_contact").addClass("menu_selected");	 }	 	 if (document.location.href.indexOf("account") > -1) {		 $("#account_btn").addClass("selected");	 }		$('.category_main_list').css("width",$('.category_main_list_head').width());		var category_nav_pos = $('.category_nav').position();		/* Search */	$('.button-search').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 */	$('#cart > .heading a').bind('click', function() {		$('#cart').addClass('active');				$.ajax({			url: 'index.php?route=checkout/cart/update',			dataType: 'json',			success: function(json) {				if (json['output']) {					$('#cart .content').html(json['output']);				}			}		});							$('#cart').bind('mouseleave', function() {			$(this).removeClass('active');		});	});	/*$('#button-coupon').bind('click', function() {	$.ajax({		type: 'POST',		url: 'index.php?route=total/coupon/calculate',		data: $('#coupon :input'),		dataType: 'json',				beforeSend: function() {			$('#button-coupon').attr('disabled', true);			$('#button-coupon').after('<span class="wait">&nbsp;<img src="catalog/view/theme/default/image/loading.gif" alt="" /></span>');		},		complete: function() {			$('#button-coupon').attr('disabled', false);			$('.wait').remove();		},				success: function(json) {			if (json['error']) {				alert( "Invalid or expired voucher code. Please try again." );			} else {				$("input[name=coupon]").val("");				alert( "Your voucher code has been successfully applied to your cart." );			}		}	});	});*/	});$('.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']);								$('html, body').animate({ scrollTop: 0 }, 'slow'); 			}			}	});}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']);								$('#cart .content').html(json['output']);			}					}	});}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');								$(".wishlist_pop").fadeIn();								setTimeout(function(){				  $(".wishlist_pop").fadeOut();				}, 1000);			}			}	});}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('<div class="attention" style="display: none;">' + json['success'] + '<img src="catalog/view/theme/default/image/close.png" alt="" class="close" /></div>');								$('.attention').fadeIn('slow');								$('#compare_total').html(json['total']);								$('html, body').animate({ scrollTop: 0 }, 'slow'); 			}			}	});}function email_subscribe(){	$.ajax({			type: 'post',			url: 'index.php?route=module/newslettersubscribe/subscribe',			dataType: 'html',            data:$("#subscribe").serialize(),			success: function (html) {				eval(html);			}}); }function email_unsubscribe(){	$.ajax({			type: 'post',			url: 'index.php?route=module/newslettersubscribe/unsubscribe',			dataType: 'html',            data:$("#subscribe").serialize(),			success: function (html) {				eval(html);			}}); }
