/* ------------------------------------------------------------------------------------
Website: Encams Keep Britain Tidy
File: Internal pages javascript (jquery)
Author: Reading Room
Created: Feb 2009
------------------------------------------------------------------------------------ */
jQuery.fn.equalHeight = function () {
    var height        = 0;
    var maxHeight    = 0;

    // Store the tallest element's height
    this.each(function () {
        height        = jQuery(this).outerHeight();
        maxHeight    = (height > maxHeight) ? height : maxHeight;
    });

    // Set element's min-height to tallest element's height
    return this.each(function () {
        var t            = jQuery(this);
        var minHeight    = maxHeight - (t.outerHeight() - t.height());
        var property    = jQuery.browser.msie && jQuery.browser.version < 7 ? 'height' : 'min-height';

        t.css(property, minHeight + 'px');
    });
};
$(document).ready(function() {
	$("body").addClass("js");
	$("#leftCol li li:last").addClass("last");
	$("#leftCol li li:first").addClass("first");
	
/* ------------------------------------------------------------------------------------
-- Flash map
------------------------------------------------------------------------------------ */
    $('#regionFlash').flash(
        { 
          src: '/images/flash/regionsMap.swf',
          width: 180,
          height: 236,
		  wmode:"transparent",
          flashvars: { MYURL: '/Get_Involved/Your_region/North_West' }
        },
        { version: 8 }
    );

/* ------------------------------------------------------------------------------------
-- Our Expertise box
------------------------------------------------------------------------------------ */
	$(".interiorMinorFeatureInfo").hide();
	function interiorMinorFeatureShow(el){
		el.find(".interiorMinorFeatureInfo").show();
		el.find(".interiorMinorFeatureLink a").addClass("active");
	};
	function interiorMinorFeatureHide(el){
		el.find(".interiorMinorFeatureInfo").hide();
		el.find(".interiorMinorFeatureLink a").removeClass("active");
	};
	$(".interiorMinorFeature").hover(
		function () {
			interiorMinorFeatureShow($(this));
		}, 
		function () {
			interiorMinorFeatureHide($(this));
		}
	).click(function(){
		document.location.href=$(this).find("a:first").attr("href");
		return false;
	}).find("a").focus( function(){
		interiorMinorFeatureShow($(this).parent().parent());
	}).blur( function(){
		interiorMinorFeatureHide($(this).parent().parent());
	});
	
	// make headers same height
	$('.interiorMinorFeature h2, .interiorMinorFeature h3').equalHeight();

});