function nospam(){	
	var p = $.makeArray(arguments).reverse().join(".").split('#'); m = p[1] + "@" + p[0];
	document.write('<a href="mailto:'+m+'">'+m+'</a>');		
}

jQuery.preLoadImages("/includes/templates/ironheart/images/pages/index/bg_dropdown.png", "/includes/templates/ironheart/images/newsletter/nlarrow_close.png", "/includes/templates/ironheart/images/free_shipping.png", "/includes/templates/ironheart/images/pages/faqs/button.png");

Cufon('#footermenu a', {
    hover: {
        color: '#000000'
    }
});
Cufon.replace('#footermenu a');


$(document).ready(function() {


		// Free shipping div
		
		if ($(window).width() >= 1200) {
			var rightPos = $(window).width()/2 - 440 - 165;
			$('#free_shipping').css("right", rightPos + "px");
			$('#free_shipping').show();
		}
	
		$(window).bind('resize', function () {
			if ($(window).width() >= 1200) {
				var rightPos = $(window).width()/2 - 440 - 165;
				$('#free_shipping').css("right", rightPos + "px");
				$('#free_shipping').show();
			} else {
				$('#free_shipping').hide();
			}
		});

		

		// Notice Box

		var expanded = false;

		$("#notice").click(function() {
			if (!expanded) {
				$('#notice').animate({ height: 143 }, 1300);
				expanded = true;
				$('#notice').css("background-position", "bottom right");
			} else {
				$('#notice').animate({ height: 62 }, 1300);
				expanded = false;
				$('#notice').css("background-position", "bottom left"); 
			}
		
		});

		
		
		// Newsletter
		
		$('#subscriber_input').one("focus", function() {
			$(this).val("");
		});
		
		
		var nlopen = false;
		
		$(".newsletter_toggle").click(function() {
			if(!nlopen) {
				$('#topmenu').animate({
					marginTop: "+=34px"
				}, 500);
				$('#nl_arrow').attr("src","/includes/templates/ironheart/images/newsletter/nlarrow_close.png");
				nlopen = true;
			} else {
				$('#topmenu').animate({
					marginTop: "-=34px"
				}, 500);
				$('#nl_arrow').attr("src","/includes/templates/ironheart/images/newsletter/nlarrow_open.png");
				nlopen = false;
			}
		});
		
		
		$("#free_shipping").fancybox({
			type			:	'iframe',
			width			:	700,
			height			:	500,
			fitToView		:	false,
			padding			:	0,
			helpers : { 
				overlay	: {
					opacity : 0.9,
					css : {
						'background-color' : '#000'
					}
				}
			}
		});

	
});
