$(document).ready(function(){
	/* Active, clickable container	
	$('div.contained-info').click(function(){
		window.location=$(this).find("a").attr("href");
	});
	
	//selector select all li within the ul and then we make them clickable.
	$("#main-nav li").click(function(){
		//get the url from href attribute and launch the url
		window.location=$(this).find("a").attr("href"); 
		$(this).css('cursor', 'pointer');
	});*/
	
	
	/*Drop Down Navigation*/
	if ( $('#main-nav').length > 0 ) {
		//$('#main-nav ul li:has(> ul)').addClass('drop-down');
		$('#main-nav ul li ul').addClass('nthTier-2').hide();
		//Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)
		$("#main-nav li").hover(function() {
			//When trigger is clicked...  
			//Following events are applied to the subnav itself (moving subnav up and down)  
			$(this).find("ul.nthTier-2").show(); //Drop down the subnav on click  
			$(this).hover(function() {  
				}, function(){  
					$(this).find("ul.nthTier-2").hide(); //When the mouse hovers out of the subnav, move it back up  
				});  
				//Following events are applied to the trigger (Hover events for the trigger)  
			}).hover(function() {  
				$(this).addClass("subhover"); //On hover over, add class "subhover"  
				}, function(){  //On Hover Out  
					$(this).removeClass("subhover"); //On hover out, remove class "subhover"  
				});
	}
	
	/*$('#main-nav li a').each(function() {
			if ($(this).text().length < 24) {
				$(this).parent().addClass('shortTitle');
		}
	});*/
	
	/*nthChild-i++ for a tag*/
	if ( $('#main-nav').length > 0 ) {
		$('#main-nav ul li:first-child').addClass('first');
		$('#main-nav ul li:last-child').addClass('last');
		var elements = $('#main-nav ul li').not('#main-nav ul li li');                                          
		var index = 1;
		$.each(elements, function(){
			$(this).addClass("nthChild-" + index);
			index++;
		});    
	}

		
	

});
