$(function() {
	
	// 	SCRIPT FOR HOME PAGE TABS
	if($('.tabPanel').length != 0)
	{
		$tabs = $('.tabs a');
		$tabPanels = $('.tabContents .contents');
		
		$('.tabs a:first').addClass('active');
		
		$('.tabs a').click(function() {
			$this = $(this);
			if($this.attr('class') != 'active')
			{
				$tabs.find('img').hide().end().find('img:first').show().end().removeClass('active');
				$this.find('img:last').show().end().find('img:first').hide().end().addClass('active');
				
				$tabPanels.removeClass('hide').hide();
				var index = $tabs.index(this);
				$('.tabContents .contents:eq('+index+')').show();
			}
			return false;
		});
		
		$('.tabs a').hover(function() {
			$this = $(this);
			
			if($this.attr('class') != 'active')
			{
				$this.find('img:last').show().end().find('img:first').hide();
			}
		},function() {
			$this = $(this);
			
			if($this.attr('class') != 'active')
			{
				$this.find('img:first').show().end().find('img:last').hide();
			}
		});
	}
	
	
	// 	SCRIPT FOR DIRECTORS PHOTO GALLERY
	if($('#directorsGallery').length != 0)
	{
		$('#directorsGallery .imageArea img').hide();
		$('#directorsGallery .imageArea img:first').fadeIn('slow');
		$('.pnlThumbImage img:first').fadeTo('fast', 1 ).addClass('active');
		
		$('.pnlThumbImage img').click(function(event) {
			if($(this).attr('class') != 'active')
			{
				$('.pnlThumbImage img[class="active"]').fadeTo('fast', 0.4 ).removeClass('active');
				$(this).fadeTo('fast', 1 ).addClass('active');
				var index = $('.pnlThumbImage img').index(this);
				$('#directorsGallery .imageArea img').hide();
				$('#directorsGallery .imageArea img:eq('+index+')').fadeIn('slow');
				$('#directorsGallery .directorsContent .content').hide();
				$('#directorsGallery .directorsContent .content:eq('+index+')').fadeIn('slow');
			}
			return false;
		}).mouseover(function() {
			if($(this).attr('class') != 'active')
			{
				$(this).fadeTo('fast', 1 );
			}
		}).mouseout(function() {
			if($(this).attr('class') != 'active')
			{
				$(this).fadeTo('fast', 0.4 );
			}
		});

	}
	
	
	// 	SCRIPT FOR TABLE ROLLOVER
	if($('table').length != 0)
	{
		$("table:not(.skip) tr:not(.skip)").hover( function() {
			$(this).addClass("highlight");
		},function() {
			$(this).removeClass("highlight");
		});
	}
});
