$(document).ready(function(){
	
	$('#footer-wrap').hover(
		function () {
			$('#footer-wrap').css("bottom","0px");
			$('#footer').css("bottom","-100px");
			$('#footer').animate({
				bottom: "0px"	
			}, 300);
		},
		function () {
			$('#footer-wrap').animate({
				bottom: "-100px"
			}, 300);
		}
	);
	
	$('#hide').click(function () {						 
		$('#content').css({'left' : '-999em'});
		$('#content').removeClass('visible');
		$('#content').addClass('hidden');
		$('#show').show();
		$('#next, #prev').removeClass('shown');
	});
	
	$('#show').click(function () {	
		$('#content').css({'left' : '10%'});
		$('#content').removeClass('hidden');
		$('#content').addClass('visible');
		$('#show').hide();
		$('#next, #prev').addClass('shown');
		$('#content.visible').css({'opacity' : '1.0', 'filter' : 'alpha(opacity=100)'});
	});
	
	var browser = navigator.appName;
	
	if (browser == 'Microsoft Internet Explorer') {
		$('#next, #prev').hover(
			function () {
				$('#content.visible').css({'opacity' : '0.15', 'filter' : 'alpha(opacity=15)'});
			},
			function () {
				$('#content.visible').css({'opacity' : '1.0', 'filter' : 'alpha(opacity=100)'});
			}
		);
	}
	
	else {
		$('#next, #prev').hover(
			function () {
				$('#content.visible').animate({opacity: 0.15, filter: 'alpha(opacity=15)'}, 200);
			},
			function () {
				$('#content.visible').animate({opacity: 1.0, filter: 'alpha(opacity=100)'}, 200);
			}
		);
	}
	
	$('#next.shown, #prev.shown').click(function(){
		$('.click-here').hide();
		$('#content').css({'left' : '-999em'});
		$('#content').removeClass('visible');
		$('#content').addClass('hidden');
		$('#show').show();
		videoPosition();
	});
	
	$('#bg').bgResize({
		imagewidth:1680,
		imageheight:1116
	});
	
	$('#inner-bg').cycle({ 
		fx:     'scrollHorz', 
		speed:  'medium', 
		timeout: 0, 
		next:   '#next', 
		prev:   '#prev',
		pager:  '#img-nav', 
		pagerAnchorBuilder: function(idx, slide) { 
			// return selector string for existing anchor 
			return '#img-nav li:eq(' + idx + ') a'; 
		} 
	});
	
	setTimeout("$('.click-here').animate({right: 35}, 600)", 1000);
	setTimeout("$('.click-here').animate({right: -235}, 600)", 5000);
	
	$('#content').css({'left' : '-999em'});
	
	$(window).resize(function(){
		videoPosition();
	});
	
	videoPosition();
	
	function videoPosition(){
		if($('.embed')){
			$('.embed').each(function(){
				var objectHeight = $(this).children('object').height();
				var objectWidth = $(this).children('object').width();
				var finalHeight = ($(window).height()/2)-(objectHeight/2);
				var finalWidth = ($(window).width()/2)-(objectWidth/2);
				$(this).children('object').css({'top' : finalHeight});
				$(this).children('object').css({'left' : finalWidth});
			});
		}	
	}

	
});