var openDebtSolutions;
$(document).ready(function () {
	// Opens links in new window on a anchor with an attribute of rel="openwin"
	$('a[rel=openwin]').click(function(){
		window.open(this.href);
		return false;
	});
	
	// Bind a click event to anchor with rel="submit" and submits form its contained within
	$("a[rel=submit]").click( function(){
		$(this).parents("form").submit();
	});
	
	// Menu system
	$("ul.top li").hover(function() {
			if (this.id == "debtSolutions") {
				$(this).addClass("active");
				$("ul.sub:hidden").show();
			} else {
				$("li#debtSolutions").removeClass("active");
				$("ul.sub:visible").hide();
			}
		}
	);
	if (openDebtSolutions != undefined) {
		$("ul.sub:hidden").show();
		if (openDebtSolutions != "true") {
			$("ul.sub li:eq(" + openDebtSolutions + ")").addClass("active");
		}
	}
	
	// Validate the sidebar request a callback form
	$("form#callback").validate();
	$("form#contact-us").validate();
	$("form#debtpack").validate();
	
	// Accordion for Debt solutions page
	$("#accordion").accordion({
		'active' : 'none',
		'autoHeight' : false
	});
});