 /*-----------------------------------------------
'	Company: Community Engine (www.communityengine.com)
'	Copyright (c) 2009, All rights reserved.
'	Date Created: April 2009
'
'	Last Modified Date: 21st April, 2009
'	Last Modified By: Benjamin -> ben.ruhe@communityengine.com
'
'	DO NOT MODIFY THIS DOCUMENT WITHOUT
'	NOTIFYING THE AUTHOR FIRST
'
------------------------------------------------*/ 

// Main Nav function
// This needs to sit above the Initialization
 
// Main Nav function

var MainNav = {
    init: function () {

        $("#mainNav>ul>li").mouseover(function () {
            if (!$(this).children().hasClass("current")) {
                $(this).children().addClass("current");
                $(this).children(".dropDownContainer").removeClass("dropDownRender")
            }
        });
        $("#mainNav>ul>li").mouseout(function (a) {
            if ($(this).children().hasClass("current")) {
                $(this).children().removeClass("current");
                $(this).children(".dropDownContainer").addClass("dropDownRender")
            }
        });
        $("#mainNav .dropDownContainer ul li a").click(function () {
            $("#mainNav>ul>li").removeClass("current");
            $("#mainNav .dropDownRender").addClass("dropDownRender")
        })
    }
};



$(function(){

	// Initialize the main navigation
	//MainNav.init();


    // Generic value swap. Add defaultVal as a class to any field that you require the value to change on focus
    $('.defaultVal').click(function() {
        var default_value = this.value;
        $(this).focus(function() {
            if (this.value == default_value) {
                this.value = '';
            }
        });
        $(this).blur(function() {
            if (this.value == '') {
                this.value = default_value;
            }
        });
    });


    // Take border off submit buttons
    $("input:button").focus(function() {
        $(this).blur();
    }).css("cursor", "pointer");


	// external links
    $('a[rel="external"]').click(function() {
        window.open($(this).attr('href'));
        return false;
    });

// end
});


// Equal height columns
$.fn.equalHeights = function(minHeight, maxHeight) {
	tallest = (minHeight) ? minHeight : 0;
	this.each(function() {
		if($(this).height() > tallest) {
			tallest = $(this).height();
		}
	});
	if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
	return this.each(function() {
		$(this).height(tallest).css("overflow","hidden");
	});
}

