document.createElement("article");  
document.createElement("footer");  
document.createElement("header");  
document.createElement("hgroup");  
document.createElement("nav"); 

$(document).ready(function($){	
	
    var cookie = $.cookie('zoidberg');
    
    if (cookie == 'theme1') {
        $("body").removeClass();
		$("body").addClass("theme1");
    };
    if (cookie == 'theme2') {
        $("body").removeClass();
		$("body").addClass("theme2");
    };
    if (cookie == 'theme3') {
        $("body").removeClass();
		$("body").addClass("theme3");
    };
	
	
	//
	$(".dragWrapperInner").scrollview({
		grab:"images/openhand.cur",
		grabbing:"images/closedhand.cur"
	});

	// Lets make the little fella on the front breathe
	$(".head").queue(
		function(next) {
	    	$(this).delay(500).animate({"top":"+=6px"},1000).delay(2000).animate({"top":"-=6px"},1000);
	    	$(".torso").delay(700).animate({"top":"+=4px"},1000).delay(1800).animate({"top":"-=4px"},1000);
	    	$(this).queue(arguments.callee);
	    	next();
		}	
	);
	
	// Switch the background, how cool is that?
	$(".bodySwitchTheme1").click(
		function () {
			$.cookie('zoidberg', 'theme1', { expires: 7, path: '/' });
			$("body").removeClass();
			$("body").addClass("theme1");
		}
	);
	$(".bodySwitchTheme2").click(
		function () {
			$.cookie('zoidberg', 'theme2', { expires: 7, path: '/' });
			$("body").removeClass();
			$("body").addClass("theme2");
		}
	);
	$(".bodySwitchTheme3").click(
		function () {
			$.cookie('zoidberg', 'theme3', { expires: 7, path: '/' });
			$("body").removeClass();
			$("body").addClass("theme3");
		}
	);

	// The slider of greatness - BX Slifer
	$(function(){
	  // assign the slider to a variable
	  var slider = $('#homeSlider').bxSlider({
	    controls: false,
	    mode: 'fade'
	  });
	
	  // assign a click event to the external thumbnails
	  $('.thumbs span').click(function(){
	   var thumbIndex = $('.thumbs span').index(this);
	    // call the "goToSlide" public function
	    slider.goToSlide(thumbIndex);
	  
	    // remove all active classes
	    $('.thumbs span').removeClass('pager-active');
	    // assisgn "pager-active" to clicked thumb
	    $(this).addClass('pager-active');
	    // very important! you must kill the links default behavior
	    return false;
	  });
	
	  // assign "pager-active" class to the first thumb
	  $('.thumbs span:first').addClass('pager-active');
	});
	
});
