// var J = jQuery.noConflict();

// wait for the DOM to be loaded
jQuery(document).ready(function() {

	////////////////////////////////////////////////////////////////////////

	// ::::::: dynamic copyright year ::::::: //

	var currentYear = (new Date).getFullYear();

	jQuery("span#copyright-year").text(currentYear);

	////////////////////////////////////////////////////////////////////////

	// ::::::: open all PDFs in a new window ::::::: //

	jQuery("a[href*=.pdf]").click(function(){
		window.open(this.href);
		return false;
	});

	////////////////////////////////////////////////////////////////////////
	
	// mark incomplete links with an image at their end

	//jQuery("a[href='/images/stories/']").addClass("attention");
	
	///////////////////////////////////////////////////////////////////////////////

	// get domain name
	var site_root = 'http://' + document.location.hostname;

	// get current url and put it into a variable
	var pathname = window.location.pathname;

	// If you need the hash parameters present in the URL, "window.location.href" may be a better choice
	var pathname_with_hash = window.location.href;

	// get page title
	var doctitle = document.title;
	
	// debug (show it in an alert window)
/*    alert(window.location.pathname); */


	///////////////////////////////////////////////////////////////////////////////

	// force menu to show as active
/*
	if (pathname == "") {
		jQuery(".something").hide();
	} else {
		jQuery(".something").show();
	}
*/
	///////////////////////////////////////////////////////////////////////////////

	// tables: even / odd rows

	// these two line adds the color to each different row
	jQuery("#checkout-review-load .customer-info tbody tr:even").addClass("even");
	jQuery("#checkout-review-load .customer-info tbody tr:odd").addClass("odd");
	jQuery("#checkout-review-load .customer-shipping tbody tr:even").addClass("even");
	jQuery("#checkout-review-load .customer-shipping tbody tr:odd").addClass("odd");

	// handle the mouseover and mouseout events
	jQuery("#checkout-review-load .customer-info tbody tr").mouseover(function() {
		jQuery(this).addClass("over");
	}).mouseout(function() {
		jQuery(this).removeClass("over");
	});
	jQuery("#checkout-review-load .customer-shipping tbody tr").mouseover(function() {
		jQuery(this).addClass("over");
	}).mouseout(function() {
		jQuery(this).removeClass("over");
	});

	///////////////////////////////////////////////////////////////////////////////
	
	// description read more at product page

	jQuery("a#description-container-close").hide();

	jQuery('a#description-container-open').click(function() {
		jQuery("div#description-container").removeClass("short-description");
		jQuery("a#description-container-open").hide();	
		jQuery("a#description-container-close").show();
		return false; // prevents the browser to jump to the link anchor (#)
	});

	jQuery('a#description-container-close').click(function() {
		jQuery("div#description-container").addClass("short-description");
		jQuery("a#description-container-open").show();	
		jQuery("a#description-container-close").hide();
		return false; // prevents the browser to jump to the link anchor (#)
	});

	///////////////////////////////////////////////////////////////////////////////

	// description read more at category page

	jQuery('a.category-readmore-button').click(function() {
		if (jQuery("div.category-readmore").is(":hidden")) {
			jQuery("div.category-readmore").slideDown("slow");
			jQuery("a.category-readmore-button").hide();	
			jQuery("a.category-readmore-button-close").show();
		}
		return false; // prevents the browser to jump to the link anchor (#)
	});

	jQuery('a.category-readmore-button-close').click(function() {
		jQuery("div.category-readmore").slideUp("slow");
		jQuery("a.category-readmore-button").show();
		jQuery("a.category-readmore-button-close").hide();
		return false; // prevents the browser to jump to the link anchor (#)
	});

	///////////////////////////////////////////////////////////////////////////////

	//	behavior for FAQ button under product image in product page
/*
	jQuery('a#tab-faq-trigger').click(function() {
		// hide all other tabs inactive
		jQuery("div.bottomwrapper div.tabberlive div.tabbertab").addClass("tabbertabhide");
		// show only the FAQ tab
		jQuery("div#tab-faq").removeClass("tabbertabhide");
		// make all tab headers inactive
		jQuery("div.bottomwrapper div.tabberlive ul.tabbernav li").removeClass("tabberactive");
		// make only the FAQ tab header active (a little trickier...)
		// norwegian
		if (jQuery('div.bottomwrapper div.tabberlive ul.tabbernav li a span:contains("Ofte stilte spørsmål")')) {
			jQuery('div.bottomwrapper div.tabberlive ul.tabbernav li a span:contains("Ofte stilte spørsmål")').parent().parent().addClass("tabberactive");
		};
		// swedish
		if (jQuery('div.bottomwrapper div.tabberlive ul.tabbernav li a span:contains("Vanliga frågor")')) {
			jQuery('div.bottomwrapper div.tabberlive ul.tabbernav li a span:contains("Vanliga frågor")').parent().parent().addClass("tabberactive");
		};
		// danish and english
		if (jQuery('div.bottomwrapper div.tabberlive ul.tabbernav li a span:contains("F.A.Q.")')) {
			jQuery('div.bottomwrapper div.tabberlive ul.tabbernav li a span:contains("F.A.Q.")').parent().parent().addClass("tabberactive");
		};
		return false; // prevents the browser to jump to the link anchor (#)
	});
*/
	
});
