/*  MouseOver - jQuery
-------------------------------------------------------------------------------------------*/
function imageSwitch(imgObj,hovSuffix,offSuffix)
{

	
	jQuery(imgObj).hover(
						 
						 
		function() {
			this.src = this.src.replace( offSuffix, hovSuffix );
		},
		function() {
			this.src = this.src.replace( hovSuffix, offSuffix );
		}
		
	);
	
	
}


/*  Checks to if pageName is the current Location
-------------------------------------------------------------------------------------------*/
function isPage(pageName)
{

	currentPage = $(location).attr('href')
	
	if (currentPage.match(pageName) != null)
	{
		return true;
	}

}


/*  Search Slide - jQuery
-------------------------------------------------------------------------------------------*/

function initSearch() {
  $('.accordionBody').hide();
  $('.accordionHeader').click(
	function() {
		
		$(this).next().slideToggle('normal');
		
	
		// CHECKS TO SEE IF YOU'RE CLICKING ON THE OPEN SLIDE
		if($(this).find(".arrow").attr("class") == "arrow arrowDown")
		{
			var downArrow = "yes";
		}		 
		 
		//SWITCHES ARROW To ARROWDOWN
		if($(this).find(".arrow").attr("class") == "arrow")
		{
			$(this).find(".arrow").addClass("arrowDown");
		}
		
		//IF CLICKING ON OPEN SLIDE, REMOVES ARROWDOWN
		if (downArrow == "yes")
		{
			$('.arrow').removeClass("arrowDown");
		}
		
	
		
	  }
	);
  

	if (isPage("type=A") == true || isPage("type=C") == true)
	{
		$('.accordionBody').show();
		$('.advanced').find(".arrow").addClass("arrowDown");		
	}
	
	if (isPage("immunogenicity"))
	{
		$('.accordionBody').show();
		$('.advanced').find(".arrow").addClass("arrowDown");
	}

  }
  
 
$(document).ready(function() {
	
	initSearch();
	
});


/*  Single Select Checkboxes
-------------------------------------------------------------------------------------------*/
$(document).ready(function() {

		$('.checkboxes .checkbox').click(function() {
											 
				$('.checkboxes .checkbox').attr('checked', false);
				$(this).attr('checked', true);
			});
 
 });
 
 
/*  On DOM Ready
-------------------------------------------------------------------------------------------*/
jQuery().ready(function(){
			   
	imageSwitch("#menuMain a img.off","_hov.gif","_off.gif");
	imageSwitch(".homeButton","_on.gif","_off.gif");

	if ($('.colRight').height() > 550)
	{
		colRightHeight = $('.colRight').height();
		$('.colLeft').css('height',colRightHeight);
	}
	
	
	$('.searchSelect').change(function() {
  		$('#mainSearch').submit();
	});

});



/*  MouseOver Fix for IE8
-------------------------------------------------------------------------------------------*/
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);




