// JavaScript Document


// .hideme

$(document).ready(function() {

	Shadowbox.init({
    	//overlayColor: "#0f6491",
		overlayOpacity: .8
	, 
	flashParams: { 
        wmode:"transparent", 
     	allowFullScreen: 'true' 
    },
    flashVars: { 
       autostart: 'true',
	   controlbar: 'over'
    } 
	});


$(".spotcontainer").hide();
//$(".closebox").hide();

$('#content').fadeTo(0, 0);  /// fade down the editor line
$('#content').fadeTo(400, 1);  /// fade down the editor line


$("editclick").click(function () {
$('.editorhold').fadeTo(300, 1);
$('.spotcontainer').slideUp('slow');
$(".reelnames").fadeOut('slow');
return false;
});


$("#loginbutton").click(function () {
$(this).toggleClass('active');
$('#loginbox').toggle();
});



$("#contactclick").click(function () {
$("#contacts").slideToggle("slow");
return false;
});


$("#loginclick").click(function () {
$("#login").slideToggle("slow");
return false;
});


initThumbs();
initfeatures();


});

$.address.change(function(event) {   
	
	var str = $.address.value();
	var myurl = str.replace("/", "");

	$('.closebox').fadeOut('slow');  /// show the close box
	$('.reelnames').fadeOut('slow');  /// hide the reel names
			
	$(".spotcontainer").slideUp("slow");
	$('.editorhold').fadeTo(0, 0.40);  /// fade down the editor line
	
	$('#'+myurl).siblings('.spotcontainer:first').pause(400).slideDown("slow");  // open the first reel
	$('#'+myurl).siblings('.reelnames').fadeIn('slow');  /// show the reel names
	$('.getreel').removeClass('active');   /// hide all reel names
	$('#'+myurl).siblings('.reelnames').children().children('.getreel:first').addClass('active'); /// show the selected editor reelnames
	$('#'+myurl).parent().fadeTo(300, 1);  /// hilight the select editor line
	$('#'+myurl).children('.closebox').fadeIn('slow');  /// show the close box

	
});  

								


	/////////////////////// rollover actions ///////////////////////
function initThumbs()
{
	//move the image in pixel
	var move = -15;
	
	//zoom percentage, 1.2 =120%
	var zoom = 1.2;

	//On mouse over those thumbnail
	$('.item').hover(function() {							
		
		//Set the width and height according to the zoom percentage
		width = $('.item').width() * zoom;
		height = $('.item').height() * zoom;
		
		//Move and zoom the image
		//$(this).find('img').stop(false,true).animate({'width':width, 'height':height, 'top':move, 'left':move}, {duration:200});
		
		//Display the caption
		$(this).find('div.caption').stop(false,true).fadeIn(200);
	},
	function() {
		//Reset the image
		//$(this).find('img').stop(false,true).animate({'width':$('.item').width(), 'height':$('.item').height(), 'top':'0', 'left':'0'}, {duration:100});	

		//Hide the caption
		$(this).find('div.caption').stop(false,true).fadeOut(200);
	});
	
	$("a.zoom").fancybox();
	

			$("a.zoom1").fancybox({
				'overlayOpacity'	:	0.95,
				'overlayColor'		:	'#000',
				'frameWidth'        :   640,
				'frameHeight'       :   603,
				'hideOnContentClick':   false,
				
			});
	//////////////// end rollover actions  /////////////////////////
}


/////// function for opening the reel /////////////

$(function() {
		$('.getreel').live("click",function() {	
		var id = $(this).attr("id");
		var editorid = $(this).parent().parent().parent().attr("id");
		$('.getreel').removeClass('active');
		$(this).addClass('active');
		$('.spotcontainer').slideUp("slow");
		$('#reel_'+id).pause(400).slideToggle("slow");
		$('.editorhold').fadeTo(600, 0.40);
		$("#"+editorid).fadeTo(300, 1);

		});
})



$.fn.pause = function(duration) {
    $(this).animate({ dummy: 1 }, duration);
    return this;
};


function initfeatures(){
		$('.featureditem').hover(function() {							
		
		var mydesc = $(this).children('.featuredesc').html();
		$('#feat-desc').hide();
		$('#feat-desc').html(mydesc);
		$('#feat-desc').stop(false,true).fadeIn('fast');
	},
	function() {
		$('#feat-desc').fadeOut('slow');
	});
	
	$('.featureditem2').hover(function() {							
		
		var mydesc = $(this).children('.featuredesc').html();
		$('#feat-desc').hide();
		$('#feat-desc').html(mydesc);
		$('#feat-desc').stop(false,true).fadeIn('fast');
	},
	function() {
		$('#feat-desc').fadeOut('slow');
	});
		
		
}




