/* ----------------------------------------------------------------------------------- 

	PMHA
	Scripts

----------------------------------------------------------------------------------- */

$(function() {

	/* ---------------------------------------
	Prettifying Menu
	--------------------------------------- */
	$("#HouseMenuNav li ul li#HouseMenuNavCurrentItem").parent("ul").parent("li").addClass("CurrentItem");
	
	/* ---------------------------------------
	Prettifying SubMenu
	--------------------------------------- */
	$("#subMenu ul").parent("li").addClass("hasChild");
	$("#subMenu ul li#subMenuCurrentItem").parent("ul").addClass("showSub");
	
	/* ---------------------------------------
	Adding Logout Link to "Admin" Menu
	--------------------------------------- */
	$("a[title='Portal Administration']").next("ul").append('<li id="HouseMenuNavLogOut"><a href="/Logoff.aspx">Log Out</a></li>');
	
	/* ---------------------------------------
	MediaQuery Helper Script
	--------------------------------------- */
	if (screen.width < 481) {
		
	}
	
	/* ---------------------------------------
	Menu Dropdown Animation
	--------------------------------------- */
	$("#mainMenu ul li").each(function () {
		
		// Hide the menu by default
		$(this).children("ul").hide();
		
		// Hover, animate down
		$(this).hover(function() {
			// Specific height to match slider for homepage.
			if($("#container").hasClass("home")) {
				$(this).children("ul").stop().show().css({"height": "0px"}).animate({"height": "418px"}, 300);
			} else {
			// Slide down to normal height for non-homepage.
				$(this).children("ul").slideToggle('fast');
			}

		// Hover out, animate up
		}, function() {
			$(this).children("ul").hide();
		});
		
	});
	
	/* ---------------------------------------
	Generic Equal-Height script
	--------------------------------------- */
	$(".eqhContainer").each(function() {
		var height = 0;
		$(this).children(".eqheight").each(function() {
			if ($(this).height() >= height) {
				height = $(this).height();
			}
		});
		$(this).children(".eqheight").css("min-height",height);
	});
	
	/* ---------------------------------------
	Accordion Module
	--------------------------------------- */
	$(".accordionBody").hide();
	$(".accordionHead").click(accordion);
	function accordion () {
		//$(".accordionBody").slideUp();
		$(this).toggleClass("active").parent(".accordionContainer").children(".accordionBody").slideToggle('fast');
	}
	
	/* ---------------------------------------
	Homepage Slider
	--------------------------------------- */
	$("#homepageSlider #dnn_ContentPane").cdaaShowcase({
		DNN: true,
		HTML5: false,
		animationStyle: "fade",
		animationLoop: true,
		autoSlide: true,
		autoSlideDelay:	10000,
		pauseOnHover: true,
		showNext: false,
		showPrev: false
	});
	
	/* ---------------------------------------
	Colorboxing
	--------------------------------------- */
	/*
	$("#login").colorbox({
		inline: true,
		href: "#dnn_loginBox",
		width: 390,
		height: 390,
		onComplete:function() {
			$("#dnn_ctr431_Login_Login_DNN_txtUsername").focus();
		}
	});
	*/
	$(".cbox_iframe").colorbox({
		iframe:true, 
		innerWidth:750, 
		innerHeight:500,
		opacity:0.7
	});
	

// End $func	
});
