$(document).ready(function(){
	
	// bg creation
	var bgs = ["&aelig;","&ccedil;","&empty;","&xi;","&phi;","&eth;","&otimes;","&there4;","&notin;","&clubs;","&curren;","&yen;","&permil;"];
	var bg1 = bgs[Math.floor(Math.random()*bgs.length)];
	var bg2 = bgs[Math.floor(Math.random()*bgs.length)];

	$("#beejeez-1").html("<span>"+bg1+"<span>"+bg1+"<span>"+bg1+"<span>"+bg1+"<span>"+bg1+"<span>"+bg1+"<span>"+bg1+"<span>"+bg1+"<span>"+bg1+"<span>"+bg1+"</span></span></span></span></span></span></span></span></span></span>");
	$("#beejeez-2").html("<span>"+bg2+"<span>"+bg2+"<span>"+bg2+"<span>"+bg2+"<span>"+bg2+"<span>"+bg2+"<span>"+bg2+"<span>"+bg2+"<span>"+bg2+"<span>"+bg2+"</span></span></span></span></span></span></span></span></span></span>");
	
	// current menu	
    var hash = window.location.hash;
	$("#projects h2 a").each(function(){
		if (("#"+hash)==$(this).attr('href')) {
		$(this).parent().nextAll().slideDown();
		}
	});
	function filterPath(string) {
		return string
		.replace(/^\//,'')
		.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
		.replace(/\/$/,'');
	} 
	$("#nav a.section").filter(function() {
		return filterPath(this.pathname) == filterPath(location.pathname);
	}).addClass('current');
	
	// projects page	
	$("#projects h2 a").toggle(function(){		
		$(".project").slideUp();
		$(this).parent().nextAll().slideDown();
		return false;
	},function(){
		$(".project").slideUp();
		$(this).parent().nextAll().slideUp();
		return false;
	});

	
	// sorry ie
	if (jQuery.browser.msie) {
		ver= jQuery.browser.version;
		if (ver=='6.0') {
			$('body').html('&nbsp;');
			$('body').html('<div id="bsod"></div>');
			$('body').css({'background':'blue'});
			$('#bsod').append('<h2>sorry there chief, internet explorer 6 ain\'t gonna do.</h2>');
			//some proactive solutions to the raised problem..
			$('#bsod').append('<p>please upgrade your browser, or better yet, use one of these great browsers:<br/> * <a href="http://www.apple.com/safari/download/">safari</a><br/>* <a href="http://firefox.com">firefox</a><br/> <br/>---<br/>justin talbott<br/>gmail@justintalbott.com</p>');
		}	
	}
	
});