// JavaScript Document

jQuery(document).ready(function(){
								
	//Remove outline from links						
	jQuery("a").click(function(){
		jQuery(this).blur();
	});
	
	//Set Tabs
	jQuery("#tabs").tabs();
	
	//Styles Table
	jQuery("table.newstable tr:even").addClass("oddrow");
	
	// Reset Font Size
	 var originalFontSize = jQuery('.post-body').css('font-size');
	 jQuery(".resetFont").click(function(){
	 jQuery('.post-body').css('font-size', originalFontSize);
	 });
	 // Increase Font Size
	 jQuery(".increaseFont").click(function(){
	  var currentFontSize = jQuery('.post-body').css('font-size');
	 var currentFontSizeNum = parseFloat(currentFontSize, 10);
	   var newFontSize = currentFontSizeNum*1.2;
	 jQuery('.post-body').css('font-size', newFontSize);
	 return false;
	 });
	 // Decrease Font Size
	 jQuery(".decreaseFont").click(function(){
	  var currentFontSize = jQuery('.post-body').css('font-size');
	 var currentFontSizeNum = parseFloat(currentFontSize, 10);
	   var newFontSize = currentFontSizeNum*0.8;
	 jQuery('.post-body').css('font-size', newFontSize);
	 return false;
	 });
	 
	 //Email this page trick	
	if(jQuery('#emailJoomla').length > 0){
		var emaillink = jQuery('#emailJoomla > a').attr('href');
		jQuery('li.email > a').attr('href',emaillink);
		jQuery('#emailJoomla').hide();
	}else if(jQuery('a.mailbtn').length > 0){
		var emaillink = jQuery('a.mailbtn').attr('href');
		jQuery('li.email > a').attr('href',emaillink);
		jQuery('a.mailbtn').hide();
		jQuery('li.email').hide();
	}else{
		jQuery('li.email').hide();
	}
	
	//Print this page trick
	if(jQuery('#printJoomla').length > 0){
		var printlink = jQuery('#printJoomla > a').attr('href');
		jQuery('li.print > a').attr('href',printlink);
		jQuery('#printJoomla').hide();
	}else if(jQuery('a.printbtn').length > 0){
		var printlink = jQuery('a.printbtn').attr('href');
		jQuery('li.print > a').attr('href',printlink);
		jQuery('a.printbtn').hide();
	}else{
		jQuery('li.print').hide();
	}
	
	//Move content of headerBox to User8 panel
	$panel = jQuery('#DisplayPane').find('.introBox');
	$panel.hide();
	if($panel.size() > 0){
		//alert($panel.html());
		jQuery('#IntroPanel').append(jQuery($panel).html());
	}else{
		jQuery('#IntroPanel').hide();
	}
	
if (typeof document.body.style.maxHeight != "undefined") {
	jQuery('#NavBar>ul>li>ul>li').hover(function() {
    	jQuery(this).children().animate({paddingLeft:"5px"}, {queue:false, duration:300});
	},function() {
    	jQuery(this).children().animate({paddingLeft:"0px"}, {queue:false, duration:300});
	});
	
	jQuery('#NavBar>ul>li>ul>li>ul>li').hover(function() {
    	jQuery(this).children().animate({paddingLeft:"5px"}, {queue:false, duration:300});
	},function() {
    	jQuery(this).children().animate({paddingLeft:"0px"}, {queue:false, duration:300});
	});
	
	jQuery('#NavBar>ul>li>ul').hide();
	jQuery('#NavBar>ul>li>ul>li>ul').hide();
	
	jQuery('#NavBar>ul>li').hover(function(){
		if (jQuery('#NavNar ul ul:animated').size() >= 0) {
            $heading = jQuery(this);
            $expandedSiblings = $heading.siblings().find('ul:visible');
            if ($expandedSiblings.size() > 0) {
				$expandedSiblings.fadeOut(500, function(){
                    $heading.find('ul').fadeIn(500);
                });
            }
            else {
                $heading.find('ul').fadeIn(300);
            }
       }

	},function () {
		// hover requires 2 functions - only need one today
	});
}else{
	
}

	jQuery('ul.menurelated>li>ul').hide();
	jQuery('ul.menurelated>li>ul>li>ul').hide();
	jQuery('ul.menurelated>li').hover(function(){
		if (jQuery('ul.menurelated ul:animated').size() == 0) {
            $heading = jQuery(this);
            $expandedSiblings = $heading.siblings().find('ul:visible');

            if ($expandedSiblings.size() > 0) {
				$expandedSiblings.hide(500, function(){
                    $heading.find('ul').show(500);
                });
            }
            else {
                $heading.find('ul').show(500);
            }
       }

	},function () {
// hover requires 2 functions - only need one today
});

	jQuery('ul.menurelated>li.active>ul').show();
	jQuery('ul.menurelated>li>ul>li.active>ul').show();
	jQuery('ul.menurelated>li>ul>li>ul>li.active').show();
	
	
});
