jQuery(function ($) {$(document).ready(function() {

$( '#related-sites ul' ).hide();
var trans = $( '<div class="related-sites-trans"></div>' );
trans.css( 'z-index', '1500' );
trans.css( 'position', 'absolute' );
trans.css( 'height', $(window).height() );
trans.css( 'width', $(window).width() );
trans.css( 'top', 0 );
trans.css( 'left', 0 );
trans.hide();
$( 'body' ).append(trans);
//
$( '#related-sites-switcher' ).click(function(){
	$( '#related-sites ul' ).show();
	trans.css( 'width', $(document).width() );  
	trans.css( 'height', $(window).height() );
	trans.show();
});
//
trans.click(function() {
	$( '#related-sites ul' ).hide();
	trans.hide();
});


$(document).ready(function() {
	$( 'h3' ).append( '<span class="h3-below"></span>' );
});


$( '#post-thumbs ul li a img').each(function() {
	$(this).hover(function() {
		$( '#post-thumbs ul li a img' ).stop().animate({ opacity: 0.2 }, 500);
		$(this).stop().animate({ opacity: 1.0 }, 500);
	},
	function() {
		$( '#post-thumbs ul li a img' ).stop().animate({ opacity: 1.0 }, 500);
	});
});


$( '.loomit-comments-avatars img' ).css( { opacity: 0.2 } );
$( '.loomit-comments-avatars  .avatar-label-checked img' ).css( { opacity: 1.0 } );
$("label[for='"+$('.loomit-comments-avatars input[name=loomit-comments-avatar]:checked').attr( 'id' )+"'] img").css( { opacity: 1.0 } );
//
$( '.loomit-comments-avatars img').each(function() {
	$(this).hover(function() {
		$(this).stop().animate({ opacity: 1.0 }, 500);
	},
	function() {
		if ( $(this).attr( 'alt' )!=$('.loomit-comments-avatars input[name=loomit-comments-avatar]:checked').val() )
		{
			$(this).stop().animate({ opacity: 0.2 }, 500);
		}
	});
});
//
$( '.loomit-comments-avatars img' ).each(function() {
	$(this).click(function() {
		$( '.loomit-comments-avatars img' ).css( { opacity: 0.2 } );
		$( this ).css( { opacity: 1.0 } );
	})
	
});
//
$( '#commentform .note' ).hide();
//
$( '#commentform' ).submit(function()
{
	var valid	=	true;
	$( '#commentform .note' ).hide();
	if ( $( '#commentform #user_logged_in' ).val()==undefined )
	{
		if ( $( '#commentform #author' ).val()=='' )
		{
			$( '#commentform #author-note' ).show();
			var valid	=	false;
		}
		//
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		if( reg.test( $( '#commentform #email' ).val() ) == false ) {
			$( '#commentform #email-note' ).show();
			var valid	=	false;
		}	
	}
	//
	if ( $( '#commentform #comment' ).val()=='' )
	{
		$( '#commentform #comment-note' ).show();
		var valid	=	false;
	}
	//
	if ( !valid )
	{
		return false;
	}
	else
	{
		
	}
});

});});
