starting_sections = "#right p, #block-cck_blocks-field_overview_image, .field-field-overview";

$(document).ready(function() {
	// ThickBox Pages.
	$(".field-field-thickbox-link .field-items .field-item").wrap('<a href="#TB_inline?height=400&width=600&inlineId=hiddenModalContent" class="thickbox" title="' + $(".field-field-thickbox-title").text() + '">');
	$(".field-field-thickbox-content").show().wrap('<div id="hiddenModalContent">');
	if(typeof tb_init!="undefined")tb_init('a.thickbox');
	// Products sub menu.
	$(".product-menu li a").click(function(){
		section_name = $(this).attr("class");
		$(".product-menu li a").removeClass("active");
		$(this).addClass("active");
		new_sections = "#block-cck_blocks-field_"+section_name+"_image, .field-field-"+section_name;
		$(starting_sections).hide();
		if(section_name=="overview")new_sections += ", #right p";
		$(new_sections).show();
		starting_sections = new_sections;
	});
	$(".product-menu li a.overview").addClass("active");
	// Company sub menu.
	$(".company-menu li a").each(function(){
		if($(this).attr("href")==location.pathname||$(this).attr("href")==location.href){
			$(this).addClass("active");
		}
	});
	// Health + Science sub menu.
	$(".healthscience-menu li a").each(function(){
		strStart = $(this).attr("href").indexOf(location.protocol+"//"+location.hostname);
		if(strStart!=-1){
			var strLength = (location.protocol+"//"+location.hostname).length;
			var linkHref = $(this).attr("href").substr(strLength);
		} else {
			var linkHref = $(this).attr("href");
		}
		var subpath = location.pathname.split("/");
		var linkpath = linkHref.split("/");
		if(linkpath[2]==subpath[2]){
			$(this).addClass("active");
		}
	});
	// Display Flash if present.
	if(typeof so!="undefined")so.write("flashcontent");
});
