// JavaScript Document

$(document).ready(function() 
{
			var background_array_left = new Array("bg_circle_left.png", "bg_square_left.png","bg_line_left.png","bg_triangle_left.png","bg_sail_left.png");
			var background_array_right = new Array("bg_circle_right.png","bg_square_right.png","bg_line_right.png","bg_triangle_right.png","bg_sail_right.png");

			
			var background_selection = Math.floor(Math.random()*5);
			
			
			var src_left = background_array_left[background_selection];
			var src_right = background_array_right[background_selection];

			
			var full_url_left = "url(images/" +src_left+")";
			var full_url_right = "url(images/" +src_right+")";	
	
			switch_type();
			
			$("#color_lines_left").css('backgroundImage',full_url_left);
			$("#color_lines_right").css('backgroundImage',full_url_right);

			
			$(".color_lines").animate({"width":"1000px"},2000);
			
			$(".film_box").hover(
				function()	{
					$(this).children(".film_title").animate({ height: "15px"}, 300 );
				},
				function()	{
					$(this).children(".film_title").animate({ height: "0px"}, 300 );
				}
			);
			
			$(".film_box_5").hover(
				function()	{
					$(this).children(".film_title_5").animate({ height: "15px"}, 300 );
				},
				function()	{
					$(this).children(".film_title_5").animate({ height: "0px"}, 300 );
				}
			);
			
			$(".film_box_1").hover(
				function()	{
					$(this).children(".film_title_1").animate({ height: "15px"}, 300 );
				},
				function()	{
					$(this).children(".film_title_1").animate({ height: "0px"}, 300 );
				}
			);
			
			$(".film_box_7").hover(
				function()	{
					$(this).children(".film_title_7").animate({ height: "15px"}, 300 );
				},
				function()	{
					$(this).children(".film_title_7").animate({ height: "0px"}, 300 );
				}
			);
			
			$(".web_box").hover(
				function()	{
					$(this).children(".web_title").animate({ height: "0"}, 300 );
				},
				function()	{
					$(this).children(".web_title").animate({ height: "0px"}, 300 );
				}
			);
			
			original = $('#bio_text a').css('color');
			
			$('#bio_text a').hover(function() { //mouseover
				var col = 'rgb(' + (Math.floor(Math.random() * 255)) + ',' + (Math.floor(Math.random() * 255)) + ',' + (Math.floor(Math.random() * 255)) + ')';
				var col2 = 'rgb(' + (Math.floor(Math.random() * 255)) + ',' + (Math.floor(Math.random() * 255)) + ',' + (Math.floor(Math.random() * 255)) + ')';
				$(this).css({
					"color": col,
					"background-color":col,
				});
			},function() { //mouseout
				$(this).css({
					"color": original,
					"background-color":"",
				});
			});
			
			$(".filmlink,.weblink").hover( 
			  function () {
       			var dynamic_title = $(this).attr("title");
				$("#info_bar").text(dynamic_title);
      		  },
			  function () {
       			var dynamic_title = "";
				$("#info_bar").text(dynamic_title);
      		  }
			  
			);
			
			$("#trailer_sw_div").show();
			$("#about_sw_div").hide();
			$("#synopsis_sw_div").hide();
			$("#press_sw_div").hide();
			$("#contact_sw_div").hide();
			
			
});

function switch_type()
{
	
	$("#about_sw_link_div").click(function() {	
								  /*
								  $("#film_squares_div").show();
								  $("#web_squares_div").hide();
								  $("#about_div").hide();
								  $("#links_div").hide();
								  $("#contact_div").hide();
								  */
								  
								  $("#trailer_sw_div").fadeOut(fade_speed,
										function(){
											$("#contact_sw_div").fadeOut(fade_speed,
													function(){
														$("#synopsis_sw_div").fadeOut(fade_speed,
																function(){
																	$("#press_sw_div").fadeOut(fade_speed,
																			function()	{
																				$("#about_sw_div").fadeIn(fade_speed);			
																						}
																								 );	
																			}
																				);		
																}
																	);	
												
													}
																 );
								  
								  

								  $("#about_sw_link_div").css({"color":"white"});
								  $("#trailer_sw_link_div").css({"color":"black"});
								  $("#contact_sw_link_div").css({"color":"black"});
								  $("#synopsis_sw_link_div").css({"color":"black"});
								  $("#press_sw_link_div").css({"color":"black"});
								
		});

}
	
