var dd_1_arr = new Array();
var dd_2_arr = new Array();
var dd_3_arr = new Array();
var dd_4_arr = new Array();
var dd_5_arr = new Array();
var dd_6_arr = new Array();

$(document).ready(function(){

$("#navigation img").css({ display : "block" });

var filename = location.pathname;

if(filename.search("/media/press-releases") >= 0){
// if filename contains /media/press-releases
filename = '/northern_foods/media/press-releases.htm';
}

if(filename.search("/media/image-library") >= 0){
// if filename contains /media/press-releases
filename = '/northern_foods/media/image-library.htm';
}

if(filename.search("/investors/results-and-presentations") >= 0){
// if filename contains /media/press-releases
filename = '/northern_foods/investors/results-and-presentations.htm';
}

// Dropdown 1

if(document.getElementById("dd_1")){

	var active_dd1 = false;
  for (x in dd_1_arr)
  {
  	if(dd_1_arr[x] == filename){
	active_dd1 = true;
	}
  }

	$("#dd_1 > ul").css({ display : "block" });
	
	var dd_1_height = $("#dd_1 > ul").height();
	
	if(!active_dd1){
	
	$("#dd_1 > ul").hide().css({ height : 0 });

	}
	
	$("#dd_1").mouseover(function(){
	
	if($("#dd_1 > ul").css("height") != dd_1_height+'px'){
	 var src = $("#dd_1 img").attr("src").replace("light", "dark_hover");
     $("#dd_1 img").attr("src", src);
	}
	
	});
	
	$("#dd_1").mouseout(function(){
	
	if($("#dd_1 > ul").css("height") == '0px'){
	 var src = $("#dd_1 img").attr("src").replace("dark_hover", "light");
     $("#dd_1 img").attr("src", src);
	 $(this).attr("class","");
	}

	else{
	$(this).attr("class","sfhover");
	}
	
	});
	
	$("#dd_1 img").click(function(){
	
	if($("#dd_1 > ul").css("height") != dd_1_height+'px'){
	$("#dd_1 > ul").show().animate({ height : dd_1_height }, { duration: 500, complete: function () {
	 var src = $("#dd_1 img").attr("src").replace("dark_hover", "dark");
     $("#dd_1 img").attr("src", src);
    } });
	}
	
	else{
	$("#dd_1 > ul").animate({ height: 0 }, { duration: 500, complete: function () {
    $("#dd_1 > ul").hide();
	
  	var src = $("#dd_1 img").attr("src").replace("dark", "light");
    $("#dd_1 img").attr("src", src);
	$("#dd_1").attr("class","");
	$("#dd_1 > a").attr("class","");
    } });
	}
	
	});

}

// Dropdown 2

if(document.getElementById("dd_2")){

	var active_dd2 = false;
  for (x in dd_2_arr)
  {
  	if(dd_2_arr[x] == filename){
	active_dd2 = true;
	}
  }

	$("#dd_2 > ul").css({ display : "block" });
	
	var dd_2_height = $("#dd_2 > ul").height();
	
	if(!active_dd2){
	
	$("#dd_2 > ul").hide().css({ height : 0 });
	
	}
	
	$("#dd_2").mouseover(function(){
	
	if($("#dd_2 > ul").css("height") != dd_2_height+'px'){
	 var src = $("#dd_2 img").attr("src").replace("light", "dark_hover");
     $("#dd_2 img").attr("src", src);
	}
	
	});
	
	$("#dd_2").mouseout(function(){

	if($("#dd_2 > ul").css("height") == '0px'){
	 var src = $("#dd_2 img").attr("src").replace("dark_hover", "light");
     $("#dd_2 img").attr("src", src);
	 $(this).attr("class","");
	}

	else{
	$(this).attr("class","sfhover");
	}
	
	});
	
	$("#dd_2 img").click(function(){

	if($("#dd_2 > ul").css("height") != dd_2_height+'px'){
	$("#dd_2 > ul").show().animate({ height : dd_2_height }, { duration: 500, complete: function () {
	 var src = $("#dd_2 img").attr("src").replace("dark_hover", "dark");
     $("#dd_2 img").attr("src", src);
    } });
	}
	
	else{
	$("#dd_2 > ul").animate({ height: 0 }, { duration: 500, complete: function () {
    $("#dd_2 > ul").hide();
	
  	var src = $("#dd_2 img").attr("src").replace("dark", "light");
    $("#dd_2 img").attr("src", src);
	$("#dd_2").attr("class","");
	$("#dd_2 > a").attr("class","");
    } });
	}
	
	});

}

// Dropdown 3

if(document.getElementById("dd_3")){

	var active_dd3 = false;
  for (x in dd_3_arr)
  {
  	if(dd_3_arr[x] == filename){
	active_dd3 = true;
	}
  }

	$("#dd_3 > ul").css({ display : "block" });
	
	var dd_3_height = $("#dd_3 > ul").height();
	
	if(!active_dd3){
	
	$("#dd_3 > ul").hide().css({ height : 0 });
	
	}
	
	$("#dd_3").mouseover(function(){
	
	if($("#dd_3 > ul").css("height") != dd_3_height+'px'){
	 var src = $("#dd_3 img").attr("src").replace("light", "dark_hover");
     $("#dd_3 img").attr("src", src);
	}
	
	});
	
	$("#dd_3").mouseout(function(){
	
	if($("#dd_3 > ul").css("height") == '0px'){
	 var src = $("#dd_3 img").attr("src").replace("dark_hover", "light");
     $("#dd_3 img").attr("src", src);
	 $(this).attr("class","");
	}

	else{
	$(this).attr("class","sfhover");
	}
	
	});
	
	$("#dd_3 img").click(function(){

	if($("#dd_3 > ul").css("height") != dd_3_height+'px'){
	$("#dd_3 > ul").show().animate({ height : dd_3_height }, { duration: 500, complete: function () {
	 var src = $("#dd_3 img").attr("src").replace("dark_hover", "dark");
     $("#dd_3 img").attr("src", src);
    } });
	}
	
	else{
	$("#dd_3 > ul").animate({ height: 0 }, { duration: 500, complete: function () {
    $("#dd_3 > ul").hide();
	
  	var src = $("#dd_3 img").attr("src").replace("dark", "light");
    $("#dd_3 img").attr("src", src);
	$("#dd_3").attr("class","");
	$("#dd_3 > a").attr("class","");
    } });
	}
	
	});

}

// Dropdown 4

if(document.getElementById("dd_4")){

	var active_dd4 = false;
  for (x in dd_4_arr)
  {
  	if(dd_4_arr[x] == filename){
	active_dd4 = true;
	}
  }

	$("#dd_4 > ul").css({ display : "block" });
	
	var dd_4_height = $("#dd_4 > ul").height();
	
	if(!active_dd4){
	
	$("#dd_4 > ul").hide().css({ height : 0 });
	
	}
	
	$("#dd_4").mouseover(function(){
	
	if($("#dd_4 > ul").css("height") != dd_4_height+'px'){
	 var src = $("#dd_4 img").attr("src").replace("light", "dark_hover");
     $("#dd_4 img").attr("src", src);
	}
	
	});
	
	$("#dd_4").mouseout(function(){
	
	if($("#dd_4 > ul").css("height") == '0px'){
	 var src = $("#dd_4 img").attr("src").replace("dark_hover", "light");
     $("#dd_4 img").attr("src", src);
	 $(this).attr("class","");
	}

	else{
	$(this).attr("class","sfhover");
	}
	
	});
	
	$("#dd_4 img").click(function(){

	if($("#dd_4 > ul").css("height") != dd_4_height+'px'){
	$("#dd_4 > ul").show().animate({ height : dd_4_height }, { duration: 500, complete: function () {
	 var src = $("#dd_4 img").attr("src").replace("dark_hover", "dark");
     $("#dd_4 img").attr("src", src);
    } });
	}
	
	else{
	$("#dd_4 > ul").animate({ height: 0 }, { duration: 500, complete: function () {
    $("#dd_4 > ul").hide();
	
  	var src = $("#dd_4 img").attr("src").replace("dark", "light");
    $("#dd_4 img").attr("src", src);
	$("#dd_4").attr("class","");
	$("#dd_4 > a").attr("class","");
    } });
	}
	
	});

}

// Dropdown 5

if(document.getElementById("dd_5")){

	var active_dd5 = false;
  for (x in dd_5_arr)
  {
  	if(dd_5_arr[x] == filename){
	active_dd5 = true;
	}
  }

	$("#dd_5 > ul").css({ display : "block" });
	
	var dd_5_height = $("#dd_5 > ul").height();
	
	if(!active_dd5){
	
	$("#dd_5 > ul").hide().css({ height : 0 });
	
	}
	
	$("#dd_5").mouseover(function(){
	
	if($("#dd_5 > ul").css("height") != dd_5_height+'px'){
	 var src = $("#dd_5 img").attr("src").replace("light", "dark_hover");
     $("#dd_5 img").attr("src", src);
	}
	
	});
	
	$("#dd_5").mouseout(function(){
	
	if($("#dd_5 > ul").css("height") == '0px'){
	 var src = $("#dd_5 img").attr("src").replace("dark_hover", "light");
     $("#dd_5 img").attr("src", src);
	 $(this).attr("class","");
	}

	else{
	$(this).attr("class","sfhover");
	}
	
	});
	
	$("#dd_5 img").click(function(){

	if($("#dd_5 > ul").css("height") != dd_5_height+'px'){
	$("#dd_5 > ul").show().animate({ height : dd_5_height }, { duration: 500, complete: function () {
	 var src = $("#dd_5 img").attr("src").replace("dark_hover", "dark");
     $("#dd_5 img").attr("src", src);
    } });
	}
	
	else{
	$("#dd_5 > ul").animate({ height: 0 }, { duration: 500, complete: function () {
    $("#dd_5 > ul").hide();
	
  	var src = $("#dd_5 img").attr("src").replace("dark", "light");
    $("#dd_5 img").attr("src", src);
	$("#dd_5").attr("class", "");
	$("#dd_5 > a").attr("class", "");
    } });
	}
	
	});

}

// Dropdown 6

if(document.getElementById("dd_6")){

	var active_dd6 = false;
  for (x in dd_6_arr)
  {
  	if(dd_6_arr[x] == filename){
	active_dd6 = true;
	}
  }

	$("#dd_6 > ul").css({ display : "block" });
	
	var dd_6_height = $("#dd_6 > ul").height();
	
	if(!active_dd6){
	
	$("#dd_6 > ul").hide().css({ height : 0 });
	
	}
	
	$("#dd_6").mouseover(function(){
	
	if($("#dd_6 > ul").css("height") != dd_6_height+'px'){
	 var src = $("#dd_6 img").attr("src").replace("light", "dark_hover");
     $("#dd_6 img").attr("src", src);
	}
	
	});
	
	$("#dd_6").mouseout(function(){
	
	if($("#dd_6 > ul").css("height") == '0px'){
	 var src = $("#dd_6 img").attr("src").replace("dark_hover", "light");
     $("#dd_6 img").attr("src", src);
	 $(this).attr("class","");
	}

	else{
	$(this).attr("class","sfhover");
	}
	
	});
	
	$("#dd_6 img").click(function(){

	if($("#dd_6 > ul").css("height") != dd_6_height+'px'){
	$("#dd_6 > ul").show().animate({ height : dd_6_height }, { duration: 500, complete: function () {
	 var src = $("#dd_6 img").attr("src").replace("dark_hover", "dark");
     $("#dd_6 img").attr("src", src);
    } });
	}
	
	else{
	$("#dd_6 > ul").animate({ height: 0 }, { duration: 500, complete: function () {
    $("#dd_6 > ul").hide();
	
  	var src = $("#dd_6 img").attr("src").replace("dark", "light");
    $("#dd_6 img").attr("src", src);
	$("#dd_6").attr("class","");
	$("#dd_6 > a").attr("class","");
    } });
	}
	
	});
	
	$("tr").removeClass("d0");
	$("tr:odd").css("background-color", "#e0dacc");
	
}


// rounded corners

$(".round_br").corner(" br keep 16px");

});

sfHover = function() {
	var sfEls = document.getElementById("navigation").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);
