// JavaScript Document

$(document).ready(function(){

	//Drivers wanted button, etc.
	$('.overfade').hover(
		function(){ $(this).children('img').fadeTo(230, 0.7); },
		function(){ $(this).children('img').fadeTo(230, 1); }
	);	
	
	//Drop menu
	$('.dropmenu').parent().hover(
		function(){ $(this).children('ul').show('fast'); },
		function(){ $(this).children('ul').hide('fast'); }
	);
	
	//Modal Windows
	$('.nyroModal').nyroModal();
	
	//Expandable footer mouseover (flip-flops src and rel attributes)
	/*
	var upimg = '';
	var overimg = '';
	$('.swaplist li img').hover(
		function(){ 
			upimg = $(this).attr('src');
			overimg = $(this).parent().attr('rel');
			$(this).attr('src', overimg);
		},
		function(){ 
			$(this).attr('src', upimg);			
		}		
	);
	*/	
	
	//Expandable footer
	var expanded = false;
	var pageHeight = $('#main').height();	
	
	$('#footer_expand').hide();
	$('#footer_top a').click(function() {
		if(expanded == false){
			//Open section
			$('html, body').animate({scrollTop: pageHeight}, 200, function(){
				$('#footer_expand').slideDown('fast', function() {} );
				expanded = true;
				$('#footer_top h2').addClass('expanded');
				$('#footer_top span').text('Click to hide our hauling options');
			});					
		} else {
			//Scroll to the bottom of the page, then close section
			$('html, body').animate({scrollTop: pageHeight}, 200, function(){
				$('#footer_expand').slideUp('fast', function() {} );
				expanded = false;
				$('#footer_top h2').removeClass('expanded');
				$('#footer_top span').text('Click to expand our hauling options');
			});			
		}
		return false;
	});

	
	//Preload trailer images
	/*
	var preload1 = $('<img />').attr('src', '/images/ftr_extendable_over.gif');
	var preload2 = $('<img />').attr('src', '/images/ftr_rgns_over.gif');
	var preload3 = $('<img />').attr('src', '/images/ftr_doubledrops_over.gif');
	var preload4 = $('<img />').attr('src', '/images/ftr_bladetrailers_over.gif');
	var preload5 = $('<img />').attr('src', '/images/ftr_schnables_over.gif');
	var preload6 = $('<img />').attr('src', '/images/ftr_stepdecks_over.gif');
	var preload7 = $('<img />').attr('src', '/images/ftr_extendable55_over.gif');
	var preload8 = $('<img />').attr('src', '/images/ftr_flatbeds_over.gif');
	*/
	

	
});
