// Furuno Front End JS
// Author: Cam Worth
// Version: 1.0 - initial

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}




$(document).ready(function() 
{
	$("#market_sectors").load( function() { 
		$.preloadImages(
					"/img/splash/sports_fishing_over.jpg", 
					"/img/splash/sailing_and_cruising_over.jpg",
					"/img/splash/commercial_fishing_over.jpg",
					"/img/splash/deep_sea_over.jpg",
					"/img/splash/patrol_over.jpg"
					);
	} );
	$("#market_sectors img").hover(function(){
	  over = $(this).attr('src').replace(/.jpg/,"_over.jpg");
	  $(this).attr('src',over);
	},function(){
	  up = $(this).attr('src').replace(/_over.jpg/,".jpg");
	  $(this).attr('src',up);
	});
	
	$('#dealer_grid tr.body').hover(function(){
	  $(this).children('td').css('border-top-width','1px');
	  $(this).children('td').css('border-bottom-width','1px');
	  $(this).children('td').css('border-color','#cbf4fa');
	  $(this).children('td.dealer_name').css('font-weight','bold');
	  $(this).css('cursor','pointer');
	},function(){
	  $(this).children('td').css('border-top-width','0px');
	  $(this).children('td').css('border-bottom-width','1px');
	  $(this).children('td').css('border-color','#cccccc');
	  $(this).children('td.dealer_name').css('font-weight','normal');
	});
	
	
	//Handle Image Titles ETC
	$('#main div.right_col .panel .about_content p img').each(function() {
											   //alert($(this).attr('align'));
											   //alert($(this).attr('hspace'));
											   if ($(this).attr('alt')) {
												   $(this).wrap('<div class="img_title" style="float:'+$(this).attr('align')+';width:'+($(this).width()-2)+'px;margin-right:'+$(this).attr('hspace')+'px;margin-left:'+$(this).attr('hspace')+'px;"></div>');
												   $(this).after('<div class="img_title_text">'+$(this).attr('alt')+'</div>');
												   
												   $(this).attr('align','bottom');
												   $(this).attr('hspace','0');
												   $(this).attr('vspace','0');
											   }
											   });
	
	$('#main div.right_col .panel .news_content img').each(function() {
											   if ($(this).attr('alt')) {
												   $(this).wrap('<div class="img_title" style="float:'+$(this).attr('align')+';width:'+($(this).width()-2)+'px;margin-right:'+$(this).attr('hspace')+'px;margin-left:'+$(this).attr('hspace')+'px;margin-bottom:5px;"></div>');
												   $(this).after('<div class="img_title_text">'+$(this).attr('alt')+'</div>');
												   
												   $(this).attr('align','bottom');
												   $(this).attr('hspace','0');
												   $(this).attr('vspace','0');
											   }
											   });
	
	
}); //end of doc ready block

$(window).load(function() 
{

	
	
	
				
}); //end of doc load block