

		var current_hash = "";
		var dmbAnchor1 = "";
		var winWidth = ""; 
		var winHeight = "";
		var navWidth = "";
		var navHeight = "";
		var dmbTLLeft, dmbTLTop, dmbTCLeft, dmbTCTop, dmbTRLeft, dmbTRTop;
		var dmbTLLeft, dmbMLTop, dmbMCLeft, dmbMCTop, dmbMRLeft, dmbMRTop;
		var dmbBLLeft, dmbBLTop, dmbBCLeft, dmbBCTop, dmbBRLeft, dmbBRTop;

		function check_hash() {
			if ( window.location.hash != current_hash ) {
				current_hash = window.location.hash;
				$(".boxContent div").attr("innerHTML","");
				$("#ghostDiv").hide();
				dmbCheck = resetTimePlace();
				if (dmbCheck == "") {
					dmbCheck = "Home";
				}
				setAnimations(dmbCheck);
			}
		}
		function resetTimePlace() {
			myFile = document.location.toString();
			dmbAnchor = "";
			dmbAnchor1 = "";
		
			if (myFile.match('#')) { // the URL contains an anchor
			  var dmbAnchor = '#' + myFile.split('#')[1];
				if (myFile.match('/')) { // the URL contains an anchor
					dmbAnchor1 = dmbAnchor.split('/')[1];
				}
			}
			return dmbAnchor1;
		}

		function setAnimations(ofWhat) {
			var whichContent = ofWhat;

			var translated = whichContent;
			translated = translated.replace("Tour","dmbTL");
			translated = translated.replace("Name-In-Stone","dmbTC");
			translated = translated.replace("Mouse","dmbTR");
			translated = translated.replace("In-The-Room-Where-You-Sleep","dmbML");
			translated = translated.replace("Contact","dmbMR");
			translated = translated.replace("Home","dmbMC");
			translated = translated.replace("Werewolf","dmbBL");
			translated = translated.replace("Grid","dmbBC");
			
			$("#dmbViewable").animate({ 
				marginLeft: (eval(translated+'Left'))+'px',
				marginTop: eval(translated+'Top')+'px'
			}, 1500, function() {

				// Top left //
				if (whichContent == "Tour") {
					//$("#ghostViewer").load("http://deadmansbones.net/dev/ghost/ghost.html");
					$('#ghostViewer').flash({
						src: 'http://deadmansbones.net/dev/ghost/ghost.swf',
						width: winWidth,
						height: winHeight
					});
					setTimeout("$(\"#ghostDiv\").fadeIn(\"500\",function(){$(this).fadeTo(\"fast\",.80)});",4000);
					
					//$('#ghostViewer').append("<div class=\"ghostDiv\">Here are the Tour dates<\/div>");
				}
				// Top Center //
				else if (whichContent == "Name-In-Stone") {
					if (winWidth > winHeight) {
						var tempVimeo = winHeight/winWidth;
						if (tempVimeo >= .575) {
							winWidthVimeo = winWidth;
							winHeightVimeo = winHeight;
						} else {
							winHeightVimeo = winHeight;
							winWidthVimeo = winHeight*1.74;
						}
					}
					var NISvideo = "<object width=\"100%\" height=\"100%\"><param name=\"allowfullscreen\" value=\"true\" \/><param name=\"allowscriptaccess\" value=\"always\" \/><param name=\"movie\" value=\"http:\/\/vimeo.com\/moogaloop.swf?clip_id=3996103&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=ffffff&amp;fullscreen=1&autoplay=1\" \/><param name=\"wmode\" value=\"transparent\" \/><embed src=\"http:\/\/vimeo.com\/moogaloop.swf?clip_id=3996103&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=ffffff&amp;fullscreen=1&autoplay=1\" bgcolor=\"#150000\" type=\"application\/x-shockwave-flash\" allowfullscreen=\"true\" allowscriptaccess=\"always\" width=\"100%\" height=\"100%\"  wmode=\"transparent\"><\/embed><\/object>";
					$(".dmbTCContent .boxContent div").attr("innerHTML",NISvideo);

				}
				
				// Top Right //
				else if (whichContent == "Mouse") {
					$('#miceViewer').flash({
						src: 'http://deadmansbones.net/art/Mouse3.swf',
						width: winWidth,
						height: winHeight
					});
					
				}
				// Middle Left //
				else if (whichContent == "In-The-Room-Where-You-Sleep") {
					if (winWidth > winHeight) {
						var tempVimeo = winHeight/winWidth;
						if (tempVimeo >= .575) {
							winWidthYoutube = winWidth;
							winHeightYoutube = winHeight;
						} else {
							winHeightYoutube = winHeight;
							winWidthYoutube = winHeight*1.74;
						}
					}
					var RWYSvideo = "<object width=\"100%\" height=\"100%\"><param name=\"movie\" value=\"http:\/\/www.youtube.com\/v\/aGakxDyjwzc&hl=en&fs=1&rel=0&hd=1\"><\/param><param name=\"allowFullScreen\" value=\"false\"><\/param><param name=\"allowscriptaccess\" value=\"always\"><\/param><param name=\"wmode\" value=\"transparent\" \/><embed src=\"http:\/\/www.youtube.com\/v\/aGakxDyjwzc&hl=en&fs=1&rel=0&hd=1&autoplay=1\" type=\"application\/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"false\" bgcolor=\"#150000\" width=\"100%\" height=\"100%\" wmode=\"transparent\"><\/embed><\/object>";
					$(".dmbMLContent .boxContent div").attr("innerHTML",RWYSvideo);

				}
				// Middle Right //
				else if (whichContent == "Contact") {
					$("#contactViewer").load("contact.html");
				}
				// Bottom Left //
				else if (whichContent == "Werewolf") {
					$("#twitterViewer").load("http://deadmansbones.net/work/canvas/autoscroll.html");
				}
				// Bottom Middle //
				else if (whichContent == "Grid") {
					$("#gridView").load("http://deadmansbones.net/work/canvas/grid.html");
				}
				else {
					// Saved the non-fullscreen version
					//var homeVideo = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"825\" height=\"350\" id=\"video_loader\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"allowFullScreen\" value=\"false\" /><param name=\"wmode\" value=\"transparent\" /> <param name=\"movie\" value=\"/art/dmb-film-logo.swf?v=1.0\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"/art/dmb-film-logo.swf?v=1.0\" quality=\"high\" bgcolor=\"#000000\" width=\"825\" height=\"350\" name=\"video_loader\" align=\"middle\" wmode=\"transparent\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object>";
					
					// New fullscreen version
					var homeVideo = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"100%\" height=\"100%\" id=\"video_loader\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"allowFullScreen\" value=\"false\" /><param name=\"wmode\" value=\"transparent\" /> <param name=\"movie\" value=\"/art/dmb-film-logo.swf?v=1.0\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" />	<embed src=\"/art/dmb-film-logo.swf?v=1.0\" quality=\"high\" bgcolor=\"#000000\" width=\"100%\" height=\"100%\" name=\"video_loader\" align=\"middle\" wmode=\"transparent\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object>";
					$(".dmbMCContent .boxContent div").attr("innerHTML",homeVideo);
				} 
				
			});						
		}

		$(document).ready(function(){
			winWidth = $(window).width(); 
			winHeight = $(window).height();
			navWidth = $("#nav").width();
			navHeight = $("#nav").height();
		
			//$("#nav").draggable();

			$(".mainLogo").width(winWidth);
			$(".mainLogo").height(winHeight);
			$(".mainLogo").fadeIn(400);
			
			if (winWidth < 960) {
				winWidth = 960;
			}
		
			if (winHeight < 500) {
				winHeight = 500;
			}
			
			$(".genContent").css({'width':winWidth+'px','height':winHeight+'px'});
		
			$(".dmbTLContent").css({'left':'-'+winWidth+'px', 'top':'-'+winHeight+'px', 'width':winWidth+'px', 'height':winHeight+'px' });
			dmbTLLeft = winWidth;
			dmbTLTop = winHeight;
		
			$(".dmbTCContent").css({'left':'0px', 'top':'-'+winHeight+'px', 'width':winWidth+'px', 'height':winHeight+'px' });
			dmbTCLeft = 0;
			dmbTCTop = winHeight;
		
			$(".dmbTRContent").css({'left':winWidth+'px', 'top':'-'+winHeight+'px', 'width':winWidth+'px', 'height':winHeight+'px' });
			dmbTRLeft = winWidth*-1;
			dmbTRTop = winHeight;
		
			$(".dmbMLContent").css({'left':'-'+winWidth+'px', 'top':'0px', 'width':winWidth+'px', 'height':winHeight+'px' });
			dmbMLLeft = winWidth;
			dmbMLTop = 0;
		
			$(".dmbMCContent").css({'left':'0px', 'top':'0px', 'width':winWidth+'px', 'height':winHeight+'px' });
			dmbMCLeft = 0;
			dmbMCTop = 0;
		
			$(".dmbMRContent").css({'left':winWidth+'px', 'top':'0px', 'width':winWidth+'px', 'height':winHeight+'px' });
			dmbMRLeft = winWidth*-1;
			dmbMRTop = 0;
		
			$(".dmbBLContent").css({'left':'-'+winWidth+'px', 'top':winHeight+'px', 'width':winWidth+'px', 'height':winHeight+'px' });
			dmbBLLeft = winWidth;
			dmbBLTop = winHeight*-1;
		
			$(".dmbBCContent").css({'left':'0px', 'top':winHeight+'px', 'width':winWidth+'px', 'height':winHeight+'px' });
			dmbBCLeft = 0;
			dmbBCTop = winHeight*-1;
		
			$(".dmbBRContent").css({'left':winWidth+'px', 'top':winHeight+'px', 'width':winWidth+'px', 'height':winHeight+'px' });
			dmbBRLeft = winWidth*-1;
			dmbBRTop = winHeight*-1;
		
		
			$("#nav").css({'left':(winWidth/2 - navWidth/2)+'px', 'top':(winHeight/2 - navHeight/2)+'px' });
			$("#nav").fadeIn(1500);
		
			$(".genContent").show();
			
			$(".navLink").click(function() {
				var arrayOfClasses = this.className.split(' '); 
				var whichContent = arrayOfClasses[1];
				var navPosition = $("#nav").offset();
				var navWidth = $("#nav").width();
				var navHeight = $("#nav").height();
				if (whichContent == "dmbTL") {
					window.location="#/Tour/";
				} else if (whichContent == "dmbTC") {
					window.location="#/Name-In-Stone/";
				} else if (whichContent == "dmbTR") {
					window.location="#/Mouse/";
				} else if (whichContent == "dmbML") {
					window.location="#/In-The-Room-Where-You-Sleep/";
				} else if (whichContent == "dmbMR") {
					window.location="#/Contact/";
				} else if (whichContent == "dmbBL") {
					window.location="#/Werewolf/";
				} else if (whichContent == "dmbBC") {
					window.location="#/Grid/";
				} else if (whichContent == "dmbBR") {
					window.location="#/dmbBR/";
				} else {
					window.location="#/Home/";
				}
			})
			
			hashCheck = setInterval( "check_hash()", 200 );
			
		})		

		var bindBehaviors = function() {
			$(function() {
				function runSliderAgain() {
					var heightOfDiv = $(".twitter_message").height();
					$(".twitter_message").animate({ 
						marginTop:"-"+heightOfDiv+"px"
					}, 120000,function(){
						$(".twitter_message").animate({ 
						marginTop:"0px"
						}, 1000, function(){
							runSliderAgain();
						})
					});
				}
				runSliderAgain();
			})
		}
