/* <![CDATA[ */
$(function(){
  // Document is ready
  
	/* UI NOTE: - the page is designed by default to function with scripts turned off (for accessibility reasons)
				  adding the class of "scriptable" dynamically allows us to target CSS to users with JavaScript enabled
				- this is the ONLY piece of JavaScript that should be executed at the top of the page */
	$("body").addClass("scriptable");

	/* nN-whiteStrip */
	$(".hasDropdown").hover(function(){
		$("ul",$(this)).show();
	},function(){
		$("ul",$(this)).hide();	
	});
	$("a").focus(function(){ // hide drop downs
		$(".hasDropdown ul").hide();
	});
	$(".hasDropdown a").unbind(); // unbind hide drop downs from sub nav anchors
	$('.hasDropdown').click(function(){
	  $("ul",$(this).parent()).show();
	});	
	$(".hasDropdown a").focus(function(){ // show drop downs
		$(".hasDropdown ul").show();
	});



		
/* these are temporary demonstration scripts only - replace with real script
   ---------------------------------------------------------------------------------- */



/* cN-tabPages */
function tabtoggle() {
	var com = this.parentNode.parentNode.parentNode;
	/* turn off the "selected" class on all tab content <div>s except for the chosen tab */
	var tabs = com.getElementsByTagName("DIV");
	for (var i = 0; i < tabs.length; i++) {
		if (tabs[i].className.indexOf("tab") > -1) tabs[i].className = tabs[i].className.replace("selected", "");
	}
	var t = document.getElementById(this.href.substr(this.href.indexOf("#") + 1));  // look for the tab with the same id as the one the links specifies
	if (t) t.className += " selected";
	/* turn off the "selected" class on all .controller <li>s except for the clicked-on item */
	var links = com.getElementsByTagName("LI");
	for (var j = 0; j < links.length; j++) {
		if (links[j].parentNode.className.indexOf("nav") > -1) links[j].className = links[j].className.replace("selected", "");
	}
	this.parentNode.className += " selected";
	return false;
}
var tabs = document.getElementsByTagName("DIV");
for (var i = 0; i < tabs.length; i++) {
	if (tabs[i].className.indexOf("cN-tabPages") > -1) {
		var links = tabs[i].getElementsByTagName("A");
		for (var j = 0; j < links.length; j++) {
			if (links[j].parentNode.parentNode.className.indexOf("nav") > -1) {
				links[j].onclick = tabtoggle;
			}
		}
	}
}

/* BEGIN .cN-cart */
	$('.cN-cart .code-toggle a').click(
		function(){
			$('.code-toggle a').toggleClass('closed');
			$('.code').toggle();
		}
	);
	/* initialise */
	$('.code').toggle();
/* END .cN-cart */

/* BEGIN .cN-latestSales 
	$('.record-toggle a').click(
		function(){
			$('.record-toggle a').remove();
			$('.record').toggle();
		}
	);
	$('.record').toggle();
	*/
/* END .cN-latestSales */

/* BEGIN .codeDetails */
	/* insert toggle link */
	$('input.security').after(' <a href="javascript:;" class="toggleCodeDetails">What is this?</a>');
	/* hide info window */
	$('.codeDetails').hide().css('position','absolute').css('margin','0 0 0 5px');
	/* insert advanced interaction elements and styles */
	$('.codeDetails strong').append(' <a href="javascript:;" class="toggleCodeDetails">Close</a>').css('background','transparent url("img/sprite-base-hpg.png") no-repeat scroll -2266px -559px');
	/* click function */
	$('.toggleCodeDetails').click(
		function(){
			$('.codeDetails').toggle();
		}
	);
	// ie6/ie7 stacking order bug
	$('.toggleCodeDetails').parent('dd','li').css('z-index','2');
/* END .codeDetails */


/* navHeader Shopping Cart interaction*/
$('.navCartDetail').hide();
$('.navCart a').hover(
	function(){
		$('.navCartDetail').show();	
	},
	function(){
		$('.navCartDetail').hide();	
	}					  
);



});
/* ]]> */

