var debug = function() {
	// do nothing
}
if (typeof(console) != "undefined") {
	debug = function(str) {
		console.log(str);
	};
}
jQuery(document).ready(function($) {
/*************************************************************/

	/* spread navigation evenly over the width */
	$('.nav_line').each(function(lNum,line) {
		
		$line = $(line);
		var width = $line.width();

		$els = $line.find('div.el');
		$els.each(function(elNum, el) {
			width -= $(el).width();
		});

		// number of sides is each element side, minus the two outer sides
		var marginPerSide = width / (($els.length * 2) - 2);
		$els.each(function(elNum, el) {
			$(el).css({	'margin-right': elNum < $els.length - 1 ? marginPerSide : 0, 
						'margin-left': elNum > 0 ? marginPerSide : 0});
		});

	});






/*************************************************************/
});

function refreshStylesheets(loop) {
	var rnd = Math.round(Math.random()*500);
	$('link').each(function(l) {
		try {
			l.href = l.href.replace(/\?.*$/, '') + '?rnd = ' + rnd;
		} catch(e) { };
	});

	if (loop > 1000) {
		setInterval(refreshStylesheets, loop);
	}
};
