$(document).ready(function() {
	
	// Cufon-ize headings
	Cufon.replace('h1',{hover: true});
	if (!(jQuery.browser.msie && parseInt(jQuery.browser.version)<7)) Cufon.replace('.scrollContainer h2',{hover: true}); // IE6 manages to mispalce the headings when we Cufon-ize them!
	Cufon.replace('.signposts h2',{hover: true});
	Cufon.replace('#left-panel h2',{hover: true});
	Cufon.replace('.extras h2',{hover: false});

  	if (jQuery.browser.msie && parseInt(jQuery.browser.version)==7) {
  		// IE7 only shows the blue top-borders on the products nav tabs if width is specified, so set it to match that of the li
  		$('#products-navigation a').each(function(){
  			var width=$(this).width();
  			$(this).children('.top').width(width);
  		})
	}
	
	// fancybox
	$(".gallery a").each(function() {$(this).fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleShow'			: true,
		'scrolling'			: 'no'
	})});

	// look for anchors with href and rel="external", and add target="_blank" to them so that they open in a new window
	// from http://articles.sitepoint.com/article/standards-compliant-world/3
	if (!document.getElementsByTagName) return;  
	var anchors = document.getElementsByTagName("a");  
	for (var i=0; i<anchors.length; i++) {  
		var anchor = anchors[i];  
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
		}
	}
});


