$(document).ready(function() {
	//console.time("searchBox");
	$('div#main_nav a:first').addClass('about');
// end adbout nav styling _________
	$('#search_form input.search-box').addClass("idleField");
	$('#search_form input.search-box').focus(function() {
		$(this).css({'background-image':'url(accelsite/themes/temp999/images/search_bg_on.png)', 'padding-left': '3px', 'width':'138px'});
		$(this).removeClass("idleField").addClass("focusField");
		if (this.value == this.defaultValue){ 
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
	});
	$('#search_form input.search-box').blur(function() {
		$(this).css('background-image','url(accelsite/themes/temp999/images/search_bg_on.png)');
		$(this).removeClass("focusField").addClass("idleField").css({'padding-left':'3px', 'width':'138px'});
		if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}
	});
	//console.timeEnd("searchBox");
// end search box _________
	$('#main_nav li:eq(0)').hoverIntent(function(){//add hoverIntentIntent later
		$(this).find('ul.sub-nav').css('width', '150px').fadeIn(500); //sets the width of drop down to width of main level parent
	},
	function(){
		$(this).find('ul.sub-nav').fadeOut(500);
	});
	$('#main_nav li:gt(0)').hoverIntent(function(){//add hoverIntentIntent later
		var parentWidth = $(this).children('a').outerWidth(); //total width of parent nav item
		$(this).find('ul.sub-nav').css('width', parentWidth).fadeIn(500); //sets the width of drop down to width of main level parent
	},
	function(){
		$(this).find('ul.sub-nav').fadeOut(500);
	});
// end sub nav _________
	$('#content.inner-tert').children().eq(0).css({'padding-top':0, 'margin-top':0}); //removes top pading/margin from the first element to keep things nicely lined up
// end first child padding/margin re-setter/nullifier
	$('ul#box_one_body').jScrollPane();
// end scroller for box one _________
	$('div#sidebar_scroller').jScrollPane();
// end scroller for map page _________
	$('div#box_2').hover(function(){
		$(this).css('background-image', 'url(accelsite/themes/temp999/images/box_2_on.png)');
	},
	function(){
		$(this).css('background-image', 'url(accelsite/themes/temp999/images/box_2.png)');
	});
	$('div#box_3').hover(function(){
		$(this).css('background-image', 'url(accelsite/themes/temp999/images/box_3_on.png)');
	},
	function(){
		$(this).css('background-image', 'url(accelsite/themes/temp999/images/box_3.png)');
	});
// end box hover background switcher _________
	$('div.box-body').each(function(i){
		movieLink = $(this).find('a[href$=".flv"]').addClass('movie-'+ (i+1));
	});
	$('div.box-body a[class^="movie"]', this).click(function(){
		$('div#info_boxes div.video-slider div.video').fadeIn(100).html('<a href='+this+'></a>');
		$('div#info_boxes div.video-slider').fadeIn(200).animate({
			height: '430px'
		}, function(){
			$(this).find('span.close').fadeIn(100);
			$('div.video a[href$=".flv"]').media({
				width: 650,
				height: 430,
				autoplay:  true,
				flashvars: { backcolor: '0xFFFFFF', showdownload: 'false', height: '430', width: '650', autostart: 1 }
			});
		});
		return false;
	});
	$('span.close').click(function(){
		$(this).fadeOut(100);
		$(this).parents('div.video-slider').find('div.video').fadeOut(200, function(){
			$(this).parent('div.video-slider').animate({ height: '0px'}); 
		}).empty();
	});
// end home video slider_________
});

