/*-------------------------------
	L & T : WEB CODE(js)
---------------------------------*/





/*-----------------------------------------------FILM THUMB : ROLL OVERS : FUNCTION-----------------------------------------------*/
function filmThumbOn(){
	$(this).find('div.film_hoverbox').stop().animate({'opacity':'0.8'}, 150);
}
function filmThumbOff(){
	$(this).find('div.film_hoverbox').stop().animate({'opacity':'0.0'}, 150);	
}
/*-----------------------------------------------FILM THUMB : ROLL OVERS : FUNCTION(end)------------------------------------------*/









/*-----------------------------------------------EXPANDBOX : ROLL OVERS : FUNCTION-----------------------------------------------*/
function bottomNav3Over(){
	$(this).stop().animate({'height':'600px'}, 200);
	
	$('.slideshow_image_container').stop().animate({'opacity':'0.1'}, 300);
}

function bottomNav3Out(){
	$(this).stop().animate({'height':'150px'}, 200);
	
	$('.slideshow_image_container').stop().animate({'opacity':'1.0'}, 300);
}
/*-----------------------------------------------EXPANDBOX : ROLL OVERS : FUNCTION(end)------------------------------------------*/








/*-----------------------------------------------HOMEPAGE : EXPAND RIGHT : FUNCTION-----------------------------------------------*/
function rightPanelSlideOn(){
	var leftSlideAmount = $('div.leftPanel').width();
	$('div.leftPanel').stop().animate({'left': -leftSlideAmount}, 300, 'easeOutQuad');
}

function rightPanelSlideOff(){
	$('div.leftPanel').stop().animate({'left': '0px'}, 300, 'easeOutQuad');
}
/*-----------------------------------------------HOMEPAGE : EXPAND RIGHT : FUNCTION(end)------------------------------------------*/









/*-------------------------------------------HOME SLIDESHOW--------------------------------------------------*/
var slideAnimTime = 5000;

function banner_switch(){
		/*This function is called on to switch the banners out when the time limit is reached */
	
		shuffle();
	
		var next = $('.slideshow_image.current_image').next('.slideshow_image').length ? $('.slideshow_image.current_image').next('.slideshow_image') : $('#slideshow_rotator .slideshow_image:first');
	
		$(next).show();
	
		$(".current_image").fadeOut().removeClass("current_image");
	
		$(next).addClass("current_image");
	
		var next_link = $(".active_slide").next("li").length ? $('.active_slide').next('li') : $('.control_slideshow li:first');
	
		$(".active_slide").removeClass("active_slide");
	
		$(next_link).addClass('active_slide');
}


$(function() {
		/*Initial timer setting */
		slide = setInterval("banner_switch()", slideAnimTime);
});


///////FUNCTION : SET NEW INTERVAL
function set_new_interval(interval){
		clearInterval(slide);/////clears out the old timer interval and restarts it
		slide = setInterval("banner_switch()", interval);
}


//////FUNCTION : SHUFFLE
function shuffle(){
		$(".slideshow_image").css("z-index", 1).hide();/////take every (.banner) and change the z-index to 1 & hide

		$(".current_image").css("z-index", 2).show();/////take (.current) banner - bring above and show
}
/*-------------------------------------------HOME SLIDESHOW(end)--------------------------------------------------*/






//////////////////////////////////////////////////////////////////////////////////////////

$(document).ready(function(){



		/*--------------------------------------HOMEPAGE : EXPAND RIGHT : FUNCTION-------------------------------------*/
		$('div.rightPanel').hover(rightPanelSlideOn, rightPanelSlideOff);

		





		/*-------------------------------------------HOME SLIDESHOW----------------------------------------------------*/
		///////////SLIDESHOW control CLICK
		$(".control_slideshow li a").click(function(){
				shuffle();
				
				var rel = $(this).attr("rel");
				
				if ( $("#" + rel).hasClass("current_image")){
						return false;
				}
				
				$("#" + rel).stop(true,true).show();////Bug Fix - .stop(true,true) - stop ongoing animation
				
				$(".current_image").fadeOut().removeClass("current_image");
				
				$("#" + rel).addClass("current_image");
				
				$(".active_slide").removeClass("active_slide");
				
				$(this).parents("li").addClass("active_slide");
				
				set_new_interval(slideAnimTime);
				
				return false;	
		});


		/////////////SLIDESHOW Pause HOVER
		$('.slideshow_image, div.rightPanel, div#lp_container_typeA ul.control_slideshow li a').hover(function(){
				clearInterval(slide);
			},function(){
				slide = setInterval( "banner_switch()", slideAnimTime);
		});
		/*-------------------------------------------HOME SLIDESHOW(end)------------------------------------------------*/






		/*-------------------------------------------EXPAND BOX 3-------------------------------------------------------*/
		$('div.expandbox3_links div').hover(bottomNav3Over, bottomNav3Out);



		/////////
		$('div#lp_container_expand3').hover(function(){
													 
				$(this).find('ul.control_slideshow').animate({'opacity':'1.0'}, 150);
			
			},function(){
			
				$(this).find('ul.control_slideshow').animate({'opacity':'0.0'}, 150);
			
			});






		/*-------------------------------------------FILM THUMB-------------------------------------------------------*/
		$('ul.film_scroller li a').hover(filmThumbOn, filmThumbOff);








});///////////////////////////////////////////////////////////////////////////////////////


































