$(document).ready(function(){

	
	$('#front_page_banner_box').load(frontpagepath + 'frontpagebannerbox.html',
		function() {
		$('#box_banner_block ul li.tab:first a.primary').css('border-left', 'none');
		$('#box_banner_block ul li.tab:last a.primary').css('border-right', 'none');
			
			var config = {    
			     sensitivity: 5, // number = sensitivity threshold (must be 1 or higher)    
			     interval: 50, // number = milliseconds for onMouseOver polling interval    
			     over: textShow, // function = onMouseOver callback (REQUIRED)    
			     timeout: 200, // number = milliseconds delay before onMouseOut    
			     out: textHide // function = onMouseOut callback (REQUIRED)    
			};

			$('#box_banner_block ul li.tab').hoverIntent(config)
	
			$('#box_banner_block ul li.tab .box_content li').hover(
				function() {
					$(this).css('background', 'url(images/list_square_red.gif) no-repeat');	
				},
				function() {
					$(this).css('background', 'url(images/list_square_gray.gif) no-repeat');	
				}
			);			
		
		}
	);
	
	function textShow() {

		var selectedLink = $(this);
		var bannerText = $(this).find('.banner_text');
		var tab_count = $('#box_banner_block ul li.tab').size();
		var tab_index = $('#box_banner_block ul li.tab').index(this) + 1;

		
		if (bannerText.is(':hidden')) 
		{

			var i = 0;
			$(this).parent().find('.tab').each(function() {
				i++;
				if ($(this).find('.banner_text').is(':visible')) {
					$(this).find('.banner_text').fadeOut('fast');
					$(this).find('a.primary').css('background', '');
					$(this).css('background', '');
					$('#box_banner_block ul li.tab:first a.primary').css('border-left', 'none');
					$('#box_banner_block ul li.tab:last a.primary').css('border-right', 'none');
				}
			});

			bannerText.show();
			
			$('#center_box #center_msg').css('visibility', 'hidden');
			bannerText.css('background', '#EDE7D7');
			selectedLink.css('background', 'url(images/arrow_down_red.gif) bottom center no-repeat');
			$(this).find('a.primary').css('background', '#9E1B34');
			

			if(tab_index == 1) {
				$(this).find('a.primary').css('border-left', '1px solid #CCCABE');
			}
			
			if(tab_index == tab_count ) {
				$(this).find('a.primary').css('border-right', '1px solid #CCCABE');
			}		
			
			$('#box_banner_block img#img_box_banner_block').attr('src', 'images/banner' + tab_index + '.jpg');
			
			
		}
		
		
	}
	
	function textHide() {
		
		
	}
	
});