// mYm Functions v 1.3 - brent@mimoymima.com
// last edited: Oct 31, 2009
// last change: adding jsActive to page

// add class of .jsActive to pages when javascript is available
document.documentElement.className = 'jsActive';

// DOCUMENT READY: uses noConflict for prototype which we use for lightview
jQuery.noConflict();
jQuery(document).ready(function($) {
	
	
//-----LOAD PLUGINS

	
//-----Cascade Comment Opacity for Wordpress by Brent Lagerman and Jack Hoge
	
	function cascadeBkg(x)
	{
		var bkgColor = $('.commentlist .thread-'+x+' .vcard').css("background-color");
	
		$('.commentlist .thread-'+x).each(function(){
			$(this).find('.vcard').each(function(intIndex){
			  	$(this).css('background', 'none');
			  	$(this).parent()
			  		.before('<span class="thespan" style="background: '+bkgColor+'; position: absolute; top: 0; left: 0; width: 100%; height: 63px;"></span>')
			  		.parent().find('.thespan')
					.fadeTo("0", 1 - intIndex * 0.10);
			});
		});
	}
	//call the cascadeBkg function for even and odd threads
	cascadeBkg('odd');
	cascadeBkg('even');
	
	
//-----Show and Hide Stuff
	$('.Toggle')
		.addClass('MakeLink') // make headings look like links
		.click(function() {
    		$(this).next().slideToggle('normal');
	}).next().hide();


//-----Make a link with the class of popup open in a new window
$('.Popup').attr('target', '_blank');


//-----Add a print link in the PageNav if there is a PageNav
	$('#PageNav > :last').after("<a href='' id='PrintLink'>print</a>");
	$('#PrintLink').click(function(){
		window.print();
		return false;
	});

	
});//<--- this is the end of the document ready function don't delete it