document.createElement('header');
document.createElement('nav');
document.createElement('article');
document.createElement('section');
document.createElement('footer');

var min = "50px"

$(document).ready(function(){
	if ($("article").width() > $("section").width()){
		$("#leftArrow").hide();
		$("#rightArrow").hide();
		$("section").css("left", min);
	}
	$("#leftArrow").mouseup(function(){
		$("section").stop();
	}).mousedown(function(){
		moveLeft(min);
	});

	$("#rightArrow").mouseup(function(){
		$("section").stop();
	}).mousedown(function(){
		moveRight();
	});
	
	$("#menuFall a").click(function(){
		$("#submenu").slideDown();
	});
});

setInterval("checkWidth('"+min+"')", 500);

function checkWidth(parwidth){
	if ($("article").width() > $("section").width()){
		$("#leftArrow").hide();
		$("#rightArrow").hide();
		$("section").css("left", parwidth);
	}else{
		$("#leftArrow").show();
		$("#rightArrow").show();
	}
}

function moveRight(){
	max = $("section").width() - $("article").width() + 20;
	max = max * -1;
	if (max < parseInt($("section").css("left"))){
		$("section").animate({
		    left: '-=10'
		  }, 15, "linear", function() {
				moveRight();
		  });
	}
}

function moveLeft(min){
	mymin = parseInt(min);
	if (mymin > parseInt($("section").css("left"))){
		$("section").animate({
		    left: '+=10'
		  }, 15, "linear", function() {
				moveLeft(min);
		  });
	}
}

$(function(){
	$("#videoPlay").fancybox({
		'padding'		: 0,
		'autoScale'		: false,
		'transitionIn'	: 'none',
		'transitionOut'	: 'none',
		'width'			: "100%",
		'height'		: "100%",
		'href'			: 'http://vimeo.com/moogaloop.swf?clip_id=31675432&amp;autoplay=1',
		'type'			: 'swf'
	})
})
