// Content Fixes and Interactions
function initialize() {

   
}


(function( $ ) {
	$.extend({
        equalHeight: function() {
            $('.orgEqual-height').children().height('auto');
            $('.orgEqual-height').each(function(){
                var maxHeight = 0;
                $(this).children().each(function(){

                    if($(this).height() > maxHeight )
                    {

                        maxHeight = $(this).height();
                    }

                });

                $(this).children().height(maxHeight);

            });
        },
        equalHeight2: function() {
            $('.orgEqual-height2 li a').children(".orgTitle").height('auto');
            $('.orgEqual-height2 li a').each(function(){
                var maxHeight = 0;
                $(this).children(".orgTitle").each(function(){

                    if($(this).height() > maxHeight )
                    {

                        maxHeight = $(this).height();
                    }

                });

                $(this).children(".orgTitle").height(maxHeight);

            });
        },
		init: function() {
		    //$(".orgTabs-b").tabs();
            $.equalHeight();
            $.equalHeight2();
                        
			$(window).resize (function() {
			});

			$(window).load(function(){
				var searchTextField = $(".orgSearch>.orgTextField");

				$(searchTextField).blur(function() {
					var alt = $(this).attr("alt");
					var value = $(this).attr("value");
					if (value == "") $(this).attr("value", alt);
				});

				$(searchTextField).focus(function() {
					var alt = $(this).attr("alt");
					var value = $(this).attr("value");
					if (value == alt) $(this).attr("value", "");
				});

				// Content blocks tab
				var contentBlockTabs = $("ul.orgContentBoxTabs li");
				if (contentBlockTabs.length) {
					//alert(contentBlockTabs.length);
					for (var i=0; i < contentBlockTabs.length; i++) {
						if (contentBlockTabs[i].className.indexOf("orgCurrent") > -1) {
							$(contentBlockTabs[i].parentNode.parentNode.parentNode).css("backgroundPosition", "5px " + (-29)*i + "px");
							//alert($(contentBlockTabs[i].parentNode.parentNode.parentNode).css());
							var tabAreas = $("div.orgTabAreas div");

							for (var j=0; j < tabAreas.length; j++) {
								$(tabAreas[j]).css("display", "none");
							}

							$(tabAreas[i]).css("display", "inline");
							break;
						}
					}
				}
				
				

			});
            
		}
	});

} )(jQuery);

jQuery( function( $ ) {
	$.init(); // Inits content fixes
} );