jQuery(document).ready(function(){
	jQuery('.brandsubnav').hide();
	
// BRAND DROP DOWN MENUS SHOW & HIDE
	
	jQuery(function () {
		jQuery('.brandsubnav').each(function () {
			jQuery(this).parent().eq(0).hover(function () {
				jQuery('.brandsubnav:eq(0)', this).fadeIn("fast");
				}, function () {
					jQuery('.brandsubnav:eq(0)', this).fadeOut("fast");
				});
			});
		});
	
		
// SPEC TABLE HIGHLIGHTING ON HOVER
	
	jQuery(function() {
		jQuery(".qstable tr").hover(
			function() {
	    		jQuery(this).find('td').addClass("highlight");
				jQuery(".nohighlight").removeClass("highlight");
   		},
			
			function() {
				jQuery(this).find('td').removeClass("highlight");
	   		}
		)
		});
// TABLE ROW STRIPING WITHOUT HOVER
		jQuery(".stripeMe tr:odd").addClass("highlight");
		jQuery(".nohighlight").removeClass("highlight");
	
	
// SHOW AND HIDE FAQ SECTION
	
	jQuery('.answer').hide();
	
	jQuery(function () {
		jQuery('.question').each(function () {
			jQuery(this).click(function () {
				jQuery('.answer:eq(0)', this).slideToggle(400);
			});
		});
	});
	

// SHOW AND HIDE LIT LIBRARY SECTION
	
jQuery('li.first ul:not(ul.nocollapse)').hide();
	
	jQuery(function () {
		jQuery('.infolist h3').each(function () {
			jQuery(this).click(function () {
				jQuery(this).parent().find('ul:eq(0)').slideToggle("fast");
			});	
		});
	});


	jQuery(function () {
		jQuery('.infolist h4').each(function () {
			jQuery(this).click(function () {
				jQuery(this).parent().find('ul:eq(0)').slideToggle("fast");
			});	
		});
	});

 // Expand the selected application
 //jQuery('li.first h3#initialApplication').click();
	
// TURNS DROP DOWN ARROW AND RESETS ULs IF CLOSED
	jQuery('.infolist h3').toggle(function(){
			jQuery(this).parent().addClass("firstlisthover");
			}, function () {
			jQuery(this).parent().removeClass("firstlisthover");
			jQuery(this).parent().find('ul:not(ul.nocollapse)').hide();
		});
		

// MAKE SURE SEARCH RESULTS BOX ALWAYS HAS SOMETHING IN IT

function ensureNonEmptySearchBox() {
    var query = jQuery("#searchagain").val();
    if (/^\s*$/.test(query)) {
        jQuery("#searchagain").val("Search Again...");
    }
}

jQuery(document).ready(function() {
    ensureNonEmptySearchBox();

    // ensure something is in search box when blurred
    jQuery("#searchagain").focus(function() {
        var str = jQuery(this).val();
				if( str === 'Search Again...' ) { jQuery(this).val(""); }
    }).blur(ensureNonEmptySearchBox);

});

});

// ALLOW ONCHANGE FOR DROPDOWN MENU TO NAVIGATE TO NEW PAGE
function nav() {
    var w = document.dropdownmenu.selectedIndex;
    var url_add = document.dropdownmenu.options[w].value;
    window.location.href = url_add;
}

