$(document).ready(function(){

	
	remediationbanner = 0;
	$("#headers img.headerfadefirst").fadeIn(1500, function() {
		$("#headers img.headerfadesecond").fadeIn(1500, function() {
			remediationbanner = 1;
		});
	});
	
	remediationbanner = 1;
	overheaderright = false;
	overaboutbanner = false;
		
	
	// Contact Details/Images on map click
	
	$("#smallmapuk a, #smallmapireland a").click(function() {
		if (remediationbanner == 1) {
			var location = $(this).attr("name");
			$(".contacthide").fadeOut("slow");
			
			$("#bannercontactdetails div").hide();
			$(".contactimages img").hide();
			
			$("#bannercontactdetails ." + location).fadeIn("slow");
			
			// Added by AL on 1st April 2010	
				// Following line loads location-specific images when a RAW office is clicked on the map
				// $(".contactimages .cimage").attr("src","assets/images/offices/" + location + ".jpg").fadeIn("slow");
				
				// Following line loads the same image regardless of which RAW office is clicked on the map
				$(".contactimages .cimage").attr("src","assets/images/offices/montage.jpg").show();
				
			
			$("body").stopTime("contact");
			$("body").oneTime(20000,"contact",function() {
				fadeOutContact();
			});
		}
	});
	
	function fadeOutContact() {
		if ( overheaderright == false ) {
			$(".contacthide").fadeIn("slow");				
		} else {
			$("body").stopTime("contact");
			$("body").oneTime(20000,"contact",function() {
				fadeOutContact();
			});
		}
	}
	
	
	$("#smallmapuk").hover(
		function() {
			$("#smallmapuk").css("background-image","url('assets/images/map_uk_on.gif')");
		},
		function() {
			$("#smallmapuk").css("background-image","url('assets/images/map_uk.gif')");
		}
	);	
	$("#smallmapireland").hover(
		function() {
			$("#smallmapireland").css("background-image","url('assets/images/map_ireland_on.gif')");
		},
		function() {
			$("#smallmapireland").css("background-image","url('assets/images/map_ireland.gif')");
		}
	);	
	
	$("#headerright").hover(
		function() {
			overheaderright = true;
		},
		function() {
			overheaderright = false;
		}
	);
	
	$("#aboutbanner").hover(
		function() {
			overaboutbanner = true;
		},
		function() {
			overaboutbanner = false;
		}
	);
	
	thisindex = 0;
	
	$("#leftmenu .expand p a").hover(
		function() {
			thisindex = $("#leftmenu .expand p a").index(this);
			$("#leftmenu .expand img").eq(thisindex).attr('src','assets/images/menu/left-item-split.png');
			$("#leftmenu .expand p").eq(thisindex).hide();
			$("#leftmenu .expand span.opt1").eq(thisindex).show();
			$("#leftmenu .expand span.opt2").eq(thisindex).show();
		}
	);	
	$("#leftmenu .expand").hover(
		function() {},
		function() {
			$("#leftmenu .expand img").eq(thisindex).attr('src','assets/images/menu/left-item.png');
			$("#leftmenu .expand span.opt1").eq(thisindex).hide();
			$("#leftmenu .expand span.opt2").eq(thisindex).hide();
			$("#leftmenu .expand p").eq(thisindex).show();
		}
	);
	
	$("#leftmenu div.item:not(.expand) p a").hover(
		function() {
			thisindex = $("#leftmenu div.item:not(.expand) p a").index(this);	
			$("#leftmenu div.item:not(.expand) img").eq(thisindex).attr('src','assets/images/menu/left-item-on.png');
		},
		function() {
			$("#leftmenu div.item:not(.expand) img").eq(thisindex).attr('src','assets/images/menu/left-item.png');
		}
	);
	
	$("#rightmenu div.countryitem a").hover(
		function() {
			thisindex = $("#rightmenu div.countryitem a").index(this);	
			$("#rightmenu div.countryitem img").eq(thisindex).attr('src','assets/images/menu/right-item-on.png');
		},
		function() {
			$("#rightmenu div.countryitem img").eq(thisindex).attr('src','assets/images/menu/right-item.png');
		}
	);
	
	$(".newsscroller h3 a").hover(
		function() {
			$(".newsscroller img").attr('src','assets/images/newsbg-on.png');
		},
		function() {
			$(".newsscroller img").attr('src','assets/images/newsbg.png');
		}
	);

});