$(document).ready(function() {
	hideExtras();
	$(".gallery").each(
		function( intIndex ) {
			$(this).bind('mouseover',function() {
				var i = document.createElement('IMG');
				i.src=this.href;
				i.style.position='absolute';
				i.style.top='-10px';
				i.style.left='-10px';
				i.style.width='5px';
				$("div#container").append(i);
		  });

			$( this ).bind('click',function() {
				var _this=this;
				$('div#display').css("background-image", "url(/images/ajaxload.gif)");
				setTimeout(function(){$('div#display').css("background-image", "url("+_this.href+")");},1000);
//				$('div#display').load(this.href);
				var end=this.href.indexOf(window.location.host)+window.location.host.length+8;
				var set = this.href.substring(end,end+3);
				if(set.substring(0,1)=='x') {
					set=this.href.substring(end+1,end+4);
				}
				showExtras(set);
				return false;
		  });
		}
	);
	/* Extra Focus on load */
	$('div#display').css("background-image", "url(/images/021-eating.png)");
	showExtras('021');
});

hideExtras = function() {
	$("li").each(
		function( intIndex ){
			if('set-'==this.className.substring(0,4)) {
				this.style.display='none';
			}
		}
	);
	$("h2").each(
		function( i ){this.style.display='none';}
	);
}
showExtras = function(setName) {
	hideExtras();
	$("li.set-"+setName).each(
		function( i ){this.style.display='block';}
	);
	if($("li.set-"+setName).length>0) {
		$("h2").each(
			function( i ){this.style.display='block';}
		);
	}
}

var museo= { src:'/scripts/museo300-regular.swf' };
var museo_bold= { src:'/scripts/museo-bold.swf' };
sIFR.activate(museo);

sIFR.replace(museo_bold, {
 selector: 'h1', 
 wmode:'transparent', 
 fitExactly:false,
 tuneWidth:0, 
 forceSingleLine:false,
 preventWrap:false,
 css: ['.sIFR-root {color: #ffffff;font-weight:normal;}','a { text-decoration: none; color: #ffffff; cursor:pointer }','a:hover {text-decoration: underline;  color: #ffffff  }']
});
sIFR.replace(museo, {
 selector: 'div#footer p',
 wmode:'transparent', 
 fitExactly:false,
 tuneWidth:0, 
 forceSingleLine:false,
 preventWrap:false,
 css: ['.sIFR-root {color: #ffffff;font-weight:normal;}','a { text-decoration: none; color: #ffffff; cursor:pointer }','a:hover {text-decoration: underline;  color: #ffffff  }']
});
