$(function () {	$('a[rel="external"]').click(function () {		window.open(this.href);		return false;	});});// The end of the body, but without waiting for page onload.// This outta be moved into jQueryvar bodyEnd = function() {	var fns = [];	return {		invoke: function() {			var i;			for (i = 0; i < fns.length; i++) {				fns[i].call();			}		},		add: function(f) {			fns.push(f);		}	};}();// Thanks to Douglas Crockford.function walkTheDOM(node, func) {	func(node);	node = node.firstChild;	while (node) {		walkTheDOM(node, func);		node = node.nextSibling;	}}/*// Pad the nav elements out so that the menu bar spans the whole width.function stretchNav(id) {	var i, j, ul, uls, temp, lis, full, padding, extra, span, parent;		uls = $('#' + id + ' ul');	parent = $('#' + id)[0];	for (j = 0; j < uls.length; j += 1) {		ul = uls[j];		if (ul.parentNode === parent) {			lis = [];			temp = ul.getElementsByTagName('li');						full = 0;			for (i = 0; i < temp.length; i++) {				if (temp[i].parentNode == ul) {					lis.push(temp[i]);					full += temp[i].clientWidth;				}			}				padding = Math.floor((ul.clientWidth - full) / lis.length);			extra = ul.clientWidth - (full + padding * lis.length);					for (i = 0; i < lis.length; i++) {				span = lis[i].getElementsByTagName('span')[0];				if (padding >= 0) {					span.style.width = (span.clientWidth + padding + ((i < extra) ? 1 : 0) ) + 'px';				}			}						if (ul.getElementsByTagName('ul').length > 0) {				// and IE6 needs at +3 in order to display the last drop-down.				ul.style.width = (ul.clientWidth + 3) + 'px';			}		}	}	//	ul = document.getElementById(id).getElementsByTagName('ul')[0];		}*/$(document).ready(function(){$("#site-header-nav li").after("<span class='navTube'>|</span>");$("#site-header-nav .navTube:last").remove();$("#site-header-nav li ul .navTube").remove();$("#site-footer-nav li").after("<span class='footNavTube'>|</span>");$("#site-footer-nav .footNavTube:last").remove();$("#site-footer-nav li ul .footNavTube").remove();	/*get the height and width*/	var navhi = $("#site-header-nav").height();	var navwid = $("#site-header-nav").width();		/*get the ul's height and width*/	var navlistwi = $("#site-header-nav ul").width();	var navlisthi = $("#site-header-nav ul").height();		/*figure the difference*/	var navWremain = (navwid)-(navlistwi);	var navHremain = (navhi)-(navlisthi);		/* Math! */	var totlinks = $("#site-header-nav > ul > li").length;	var padWeach = Math.floor((navWremain) / (totlinks * 2)); if (padWeach <=0 ) {var padWeach = 0;}	var padHeach = Math.floor((navHremain) / 2); if (padHeach <=0 ) {var padHeach = 0;}			/* Apply the padding we got from the Math */	$("#site-header-nav ul li a").css("padding", "5px "+padWeach+"px 0");					});	// Set up an ordered list of fragment links to ids, as a set of tabs for the id'd divs.function setUpTabs(id, selectedClass) {		function show(id) {		var i, current;		for (i = 0; i < panes.length; i++) {			if (panes[i].id == id) {				panes[i].style.display = 'block';				$(lis[i]).addClass(selectedClass);			} else {				panes[i].style.display = 'none';				$(lis[i]).removeClass(selectedClass);			}		}	}		function showByIndex(index) {		show(panes[index].id);	}		function tab(li) {		var a, split, id;		a = li.getElementsByTagName('a')[0];		split = a.href.split('#');		if (split.length > 1) {			id = split[1];			a.onclick = function() {				show(id);				this.blur();				return false;			};			return document.getElementById(id);		}	}		var i, lis, panes;		selectedClass = selectedClass || 'selected';	panes = [];	lis = document.getElementById(id).getElementsByTagName('li');	for (i = 0; i < lis.length; i++) {		panes[i] = tab(lis[i]);	}		showByIndex(0);}// Set up the carousel for home and store pages.function setUpFeaturedStores(moveby, containerClass) {	$('#featured-stores-carousel-container').addClass(containerClass);	stepcarousel.setup({		galleryid: 'featured-stores-carousel', //id of carousel DIV		beltclass: 'featured-stores-carousel-belt', //class of inner "belt" DIV containing all the panel DIVs		panelclass: 'featured-stores-carousel-panel', //class of panel DIVs each holding content		panelbehavior: {			speed: 500,			wraparound: false,			persist: false		},		defaultbuttons: {			enable: true,			moveby: moveby,			leftnav: [				'/images/featured-left.png',				-39, 0			],			rightnav: [				'/images/featured-right.png',				0, 0			]		},		contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']	});	// wacky safari hack	if (navigator.userAgent.indexOf('Safari') >= 0) {		// Carousel doesn't work in safari unless we try to load an external		// javascript file that doesn't exist.  I haven't tried to figure out why.		document.write('<script type="text/javascript" src="this-file-does-not-exist.js"><\/script>');	}}bodyEnd.add(function(){//	stretchNav('site-header-nav');});
