//+++++ - After document has loaded - ++++//
jQuery(document).ready(function($) {

//+++++ - Function to initialize effects - ++++//
initEffects(); 

//+++++ - Function to add rounded corners - ++++//
function addRoundedCorners() {
			$("#content").corner("8px");
			$(".widgetcontainer").corner("5px");
			//$(".widgettitle").corner("tl 5px").corner("tr 5px");
			//$("#content").corner("bl 12px").corner("br 12px"); //
			$("#topContent").corner("tl 12px");
			$("#rounded").corner("br 12px").corner("tr 12px");
			$(".roundit").corner("12px");
			$(".roundit2").corner("12px");
}

function initEffects() {
			
            addRoundedCorners();
            
}

//+++++ - Function for showing a certain slide - ++++//
function firstSlide(i) {
	       $('#featured'+i+' '+'.featured_text').show(); //this constructs a css selector; for i=1, the css selector is: #featured1 .featured_text
		   $('#featured'+i+' '+'.featured_image').show();
		   switchBackgrounds('._'+i);
}


//+++++ - Function to automatically set width and height for rounded containers - ++++//
function adjustDimensions() {

	      $('.roundit2,.roundit').each(function() {

				$(this).width($(this).find('img').attr('width'));
				$(this).height($(this).find('img').attr('height'));

			});
}

adjustDimensions();

//+++++ - Function to equalize heights of containers - ++++//
function equalizeHeights() {

var maxHeight = 0;

$(".fst,.photoContainer").each(function(){
   if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
});

$(".fst,.photoContainer").height(maxHeight);

}

equalizeHeights();

//+++++ - Various fixed and improvements - ++++//
$(".menu a, .sf-menu a").removeAttr("title"); //remove title attributes from the header menu
$('.sf-menu li:last-child a').css({'padding-right':'0px','margin-right':'0px'}); //fix for IE6
$('#sidebar ul li ul li:last-child').css({'padding-bottom':'0px','margin-bottom':'0px'}); //spacing fix


$("#commentform").validate(); //initiliaze jQuery Validate

$('a.top').click(function(){  //scroll to top
     $('html, body').animate({scrollTop: '0px'}, 300);
     return false;
});

});