//initial settings for js
$(document).ready(function(){
	$('#wrapper').css('overflow-x','hidden');
	$('#illusprevnext').show();
	$('.prevnext').show();
	$('#menu').hover(
		function(){
			$('#menutoggle').show();			
		},
		function(){
			$('#menutoggle').hide();
		}
	);
	$('#play').show();
	$('#pause').show();
	$('<p class="share">Share this post:</p>').insertBefore('.sexy-bookmarks');
	if(window.document.body.clientWidth*0.4 > 500){ var newwidth = window.document.body.clientWidth*0.4; }else{ var newwidth = '500px'; };
	$('#scrollerbox, .siteinfo, #content').css('width', newwidth);
});
$(document).ready(function(){	//changes min height for arrows on web design page
	var maxheight = 0;
	$('.siteinfo').each(function(){
		if($(this).height() > maxheight)
		{
		maxheight = $(this).height();
		};
	});
	maxheight = maxheight + 70;
	$('#wrapper').css('min-height', maxheight);
});
$(document).ready(function(){
		$(window).load(function(){
			var j = 1;
			window.setInterval(function(){
				var right = window.document.body.clientWidth - (parseFloat($('#runningman').css('left')) + 400);
				if(right >= window.document.body.clientWidth*0.03){
					$('#runningman').css({left:function(index,value){return parseFloat(value) + 30}});
				}
				else{$('#comingsoon').show();}
				j++;
				$('#runningman').css({'background-image':'url(http://www.gregorymarkhannan.com/wp-content/themes/emptycanvas/images/runningman/finalrunningman0'+j+'.png)'});
				j = j == 4 ? 0 : j;
			},400); 
		});			
});
$(document).ready(function(){
	  var cache = [];
	  // Arguments are image paths relative to the current page.
	  function preLoadImages() {
	    var args_len = arguments.length;
	    for (var i = args_len; i--;) {
	      var cacheImage = document.createElement('img');
	      cacheImage.src = arguments[i];
	      cache.push(cacheImage);
	    }
	  }
	  preLoadImages();
});
$(document).ready(function(){
	$('#webmenuhand').hover(
		function(){
			$('#webmenu').stop().animate({right: '668px'},'fast');
		},
		function(){
			$('#webmenu').stop().animate({right:'0px'},'fast');
		}
	);
});
$(document).ready(function(){
	$('#watch').jclock();
});
$(document).ready(function(){
	$('#menutoggle').toggle(
	function(){
		var fromright = 0 - ($('#menu').width() - $(this).width()) - 20;
		$('#menu').animate({right: fromright});
		$('#menuarrow').html('&lt;');
		$('#menuhide').hide();
		$('#menushow').show();
		$('#menu').hover(
			function(){
				$('#menutoggle').show();			
			},
			function(){
				$('#menutoggle').show();
			}
		);
	},
	function(){
		$('#menu').animate({right: 0});
		$('#menuarrow').html('&gt;');
		$('#menuhide').show();
		$('#menushow').hide();
		$('#menu').hover(
			function(){
				$('#menutoggle').show();			
			},
			function(){
				$('#menutoggle').hide();
			}
		);
	}	
	);
});
$(document).ready(function() { 
 
    // select #flowplanes and make it scrollable. use circular and navigator plugins 
    $("#scrollerbox").scrollable({size: 1, clickable: false, prev: '.webprev', next: '.webnext'}).circular().navigator({ 
 
        // select #flowtabs to be used as navigator 
        navi: "#websites", 
 
        // select A tags inside the navigator to work as items (not direct children) 
        naviItem: 'a', 
 
        // assign "current" class name for the active A tag inside navigator 
        activeClass: 'current' 
 
    }); 
});
$(document).ready(function() { 
    // select #flowplanes and make it scrollable. use circular and navigator plugins 
    $("#thumbnails").scrollable({size: 1, clickable: false, prev: '.illusprev', next: '.illusnext'}); 
});
$(document).ready(function() { 
	$("#musicplayer").jPlayer({
	   nativeSupport: true, oggSupport: false, customCssIds: true, ready: function(){ this.element.jPlayer("setFile", "http://www.gregorymarkhannan.com/wp-content/themes/emptycanvas/music/bcq.mp3"); }, swfPath: "http://www.gregorymarkhannan.com/wp-content/themes/emptycanvas/js"
	}).jPlayer('cssId','play','play').jPlayer('cssId','pause','pause');
});
