var last_page = 0;

$(window).load(function() {

// *** ABOUT ***
	var height_about = $("#about_rest").height();
	$("#about_rest").height(0);
	$("#about_rest").css({'display':'none'})
	
	$("#more_about").click(function(){
		$("#about_rest").animate({
			height: height_about+30
		})
		.animate({
			height: height_about
		}, "fast");
		$("#more_about").css({'display':'none'});
		$("#close_about").css({'display':'block'});
		return false;
	});	

	$("#close_about").click(function(){
		$("#about_rest").animate({
			height: height_about+30
		})
		.animate({
			height: "0px"
		}, "fast");
		$("#more_about").css({'display':'block'});
		$("#close_about").css({'display':'none'});
		return false;
	});
	
// *** LATEST ****
	var height_latest = $("#latest_rest").height();
	$("#latest_rest").height(0);
	$("#latest_rest").css({'display':'none'})

	$("#more_latest").click(function(){
		$("#latest_rest").animate({
			height: height_latest+30
		})
		.animate({
			height: height_latest
		}, "fast");
		$("#latest_rest object").show();
		$("#more_latest").css({'display':'none'});
		$("#close_latest").css({'display':'block'});
		return false;
	});	

	$("#close_latest").click(function(){
		$("#latest_rest").animate({
			height: height_latest+30
		})
		.animate({
			height: "0px"
		}, "fast");
		$("#latest_rest object").hide();
		$("#more_latest").css({'display':'block'});
		$("#close_latest").css({'display':'none'});
		return false;
	});

// *** ROSTER SLIDER ***
	var page = 0;
	$("#back_roster").click(function(){
		page=0;
		$("#more_roster").show();
		$("#back_roster").hide();
		$("#slider_content").animate({
			left: -(page*920)
		})
		return false;

	})
	$("#more_roster").click(function(){
		page++;	
		if(page >= last_page){
			$("#more_roster").hide();
			$("#back_roster").css({'display':'block'});
		}
		$("#slider_content").animate({
			left: -(page*920)
		})
		return false;
	});	

// *** CONTACT ***
	$("#contact_btn img").hover(
		function(){
			$(this).attr({src: "img/contact_hover.gif"})	
		},
		function(){
			$(this).attr({src: "img/contact.gif"})	
		}
	)
	$("#contact_btn").click(function(){
		$("#top_bar").animate({
			height:"102px",
			top:"0"
		})
		$("#exit_btn").show()
		return false;
	})
	$("#exit_btn").click(function(){
		$("#exit_btn").hide()
		$("#top_bar").animate({
			height:"12px",
			top:"90px"
		})
		return false;
	})
});

// *** SHOWREEL ***
$(document).ready(function(){
	$("#showreel").scrollable({
		next: '.next', 
		prev: '.prev',
		onBeforeSeek: function() {
			this.getItems().removeClass('active');
		},
		onSeek: function(i) {
			this.getItems().eq(i).addClass('active');
		}
	})
}); 

marqueeText = '';
$(document).ready(function(){
	marquee = $(".marquee");
	marqueeText = marquee.text() + " | ";
	marquee.css({ overflow: "hidden" });
	setTimeout('setInterval(moveMarquee, 200);', 2000);
}); 

function moveMarquee() {
	tmp = marqueeText.substr(0, 1);
	marqueeText = marqueeText.substr(1) + tmp;
	$(".marquee").html('<span style="display: block; float: left; width: 1000px;">'+marqueeText+'</span>');
}

function showPlayer(id, file) {
	var so = new SWFObject(base_dir+"videoplayer.swf", "main", "372", "302", "8", "#000000");
	so.addParam("allowFullScreen", "true");
	so.addParam("wmode", "opaque");
	so.addVariable("videoLink", file);
	so.addVariable("videoVolume", "75");
	so.addVariable("autoplay", "true");
	$("#playerdiv_"+id).show();
	so.write("playerdiv_"+id);
	$("#playerimg_"+id).hide();
}

