/*!
 * Copyright 2010, octOpus Advertising
 * http://www.octopusme.com
 *
 * Date: Sat Feb 13 22:33:48 2010 -0500
 */

$(document).ready(function () {
							
		loadPage();
		
	
		function loadPage() {
				$("#page").stop().animate(
					{
						opacity: 1
						}, {duration: 500
						,complete: function(){
							loadMask();
							loadNav();
							//loadContent();
						}})
				
					
				}
				function loadMask() {
				$(".Mask").stop().delay(500).animate(
							{
								opacity: 1
								}, {duration: 500 ,complete: function(){
										loadContent();
									}});
				}
				
		function dispRandbg() {
			$("#page").stop().delay(900).css(
					{ background: 'url(../Images/bg-1.jpg)'});
				}
						
		function loadContent() {
			
				$(".content").fadeIn({duration: 500
						,complete: function(){
							$(".Mask").stop().animate({ height: 1},{ duration:1500});
						}})
			
		}
		
		function loadNav() {
				$('#nav').stop().delay(100).fadeIn({duration:800});
		}
		
		// Cast Page
		
		$("#castContent li a").hover(
				  function () {
					$(this).find('.img1').stop().animate({opacity: 0}, 500);
					$(this).find('.img2').stop().animate({opacity: 1}, 500);
				  }, 
				  function () {
					$(this).find('.img2').stop().animate({opacity: 0}, 500);
					$(this).find('.img1').stop().animate({opacity: 1}, 500);
				  }
				);
		
		// Gallery
		
		$(".gallery li a").hover(
				  function () {
					  var sceneId = $(this)[0].id;
					  
					$(this).find('.sceneImg').stop().animate({opacity: 0}, 300);
				  }, 
				  function () {
					$(this).find('.sceneImg').stop().animate({opacity: 1}, 300);
				  }
				);
		
		$(".gallery li a").click(function(){
				
				$("#frame").fadeIn(500);
				var imgId = $(this)[0].id;
				$("#frame").html("<div></div>").show();
				$("#frame div").html("<img src='images/Gallery/" + imgId + ".jpg' class='imgBlur' /> ").stop().animate({opacity: 1}, 500);
								
			})
		
		
		// Video
		
		$(".videoGallery li a").click(function(){
				
				$("#frame").fadeIn(500);
				var videoId = $(this)[0].id;
				//alert(videoId);
				$("#frame").html("<div id='videoFrame'></div>").show();
				
				$("#frame div#videoFrame").html("<object style='height: 368px; width: 560px'> "+
									"<param name='movie' value='"+videoId+"'> " +
									"<param name='allowFullScreen' value='true'> "+
									"<param name='allowScriptAccess' value='always'> " +
									"<embed src='"+videoId+"&autoplay=1' type='application/x-shockwave-flash' allowfullscreen='true' allowScriptAccess='always' width='560' height='368'>" +
									"</object>").stop().animate({opacity: 1}, 500);
				/*
				$("#frame div#videoFrame").html("<object height='368' width='560' id='' codebase='http://www.apple.com/qtactivex/qtplugin.cab#version=7,3,0,0' "+
									"classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' class='quicktime'> "+
									"<embed height='368' width='560' src='videos/" + videoId + ".mov' type='video/quicktime' scale='tofit'> " +
									"<param value='false' name='controller'> " +
									"<param value='true' name='autostart'>" +
									"<param value='true' name='cache'>" +
									"<param value='false' name='aggressivecleanup'>" +
									"</embed>" +
									"</object>").stop().animate({opacity: 1}, 500);
				*/
								
			})
		

});
