//wide

        $(document).ready(function() {
            $("#wideView").click(function() {
                $("#news").toggleClass("wide");
				$("#news").toggleClass("fl");
				$("#ph").toggleClass("wide");
				$("#news2").toggleClass("wide");
                $("#youtube").toggle();
				$("#viewbutton").toggleClass("wide");
				
				//$("#facebook").toggleClass("wide");
				$("#newsframe").toggleClass("wide");
				$("redsides").toggleClass("wide");
                $(this).toggleClass("wide");
            });
        });


 $(document).ready(function() {
            $("#completeup").click(function() {
                $("#buy").addClass("complete");
				
				
            });
        });
		
		 $(document).ready(function() {
            $("#boardup").click(function() {
                $("#buy").removeClass("complete");
				
				
				
            });
        });








function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}














// JavaScript Document
$(document).ready(function() {



	//Set Default State of each portfolio piece

	$(".paging").show();

	$(".paging a:first").addClass("active");

		

	//Get size of images, how many there are, then determin the size of the image reel.

	var imageWidth = $(".window").width();

	var imageSum = $(".image_reel img").size();

	var imageReelWidth = imageWidth * imageSum;

	

	//Adjust the image reel to its new size

	$(".image_reel").css({'width' : imageReelWidth});

	

	//Paging + Slider Function

	rotate = function(){	

		var triggerID = $active.attr("rel") - 1; //Get number of times to slide

		var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide



		$(".paging a").removeClass('active'); //Remove all active class

		$active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)

		

		//Slider Animation

		$(".image_reel").animate({ 

			left: -image_reelPosition

		}, 500 );

		

	}; 

	

	//Rotation + Timing Event

	rotateSwitch = function(){		

		play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds

			$active = $('.paging a.active').next();

			if ( $active.length === 0) { //If paging reaches the end...

				$active = $('.paging a:first'); //go back to first

			}

			rotate(); //Trigger the paging and slider function

		}, 5000); //Timer speed in milliseconds (3 seconds)

	};

	

	rotateSwitch(); //Run function on launch

	

	//On Hover

	$(".image_reel a").hover(function() {

		clearInterval(play); //Stop the rotation

	}, function() {

		rotateSwitch(); //Resume rotation

	});	

	

	//On Click

	$(".paging a").click(function() {	

		$active = $(this); //Activate the clicked paging

		//Reset Timer

		clearInterval(play); //Stop the rotation

		rotate(); //Trigger rotation immediately

		rotateSwitch(); // Resume rotation

		return false; //Prevent browser jump to link anchor

	});	

	

});








(function ($) {
    $.fn.konami = function (callback, code) {
        if (code == undefined) code = "83,80,65,67,69";
        return this.each(function () {
            var kkeys = [];
            $(this).keydown(function (e) {
                kkeys.push(e.keyCode);
                if (kkeys.toString().indexOf(code) >= 0) {
                    $(this).unbind('keydown', arguments.callee);
                    callback(e);
                }
            }, true);
        });
    }
    $(window).konami(function () {
        var s = document.createElement('script');
        s.type = 'text/javascript';
        s.src = 'http://erkie.github.com/asteroids.min.js';
        document.body.appendChild(s); 
    });
})(jQuery);
