/*!
 * jQuery extensions for NRMLA
 */






/* Custom functions
------------------------------------------------- */
jQuery.initialize = function () {
	
	$(":first-child").addClass("first-child");
	$(":last-child").addClass("last-child");
	
	// sidebar navigation fix
	$(".navigationPane ul.nav li.active").each(function () {
		$(this).prev().length ? $(this).prev().addClass("beforeActive") : $(this).parent().prev().addClass("beforeActive");
	});
	
	// text resizer
	$("div.TextSize a").click(function () {
		var size = $(this).hasClass("large") ? "18px" : ($(this).hasClass("medium") ? "14px" : "10px");
		$("body").css({ "font-size": size });
		return false;
	});
	
	$("#searchbutton").click(function () {
		var url = "";
		var s = "";
		
		if($("#state").val() != "none" || $("#companyname").val() != "") {
			url = "/FindaLender/tabid/119/";
			if($("#state").val() != "none") {
				s += "state/" + $("#state").val() + "/";
			}
			if($("#companyname").val() != "") {
				s += "company/" + encodeURI($.trim($("#companyname").val())) + "/";
			}
			url += s + "Default.aspx";
		}
		else {
			url = "/FindaLender.aspx";
		}
		
		location.href = url;
		return false
	});

};
/* -------------------------------------------------
                             end custom functions */





/* Load events
------------------------------------------------- */
$(document).ready(function () {
	$.initialize();
});
/* -------------------------------------------------
                                  end load events */



