$(document).ready(function() {
	// LOOP FORMATTING
		$("div.expresso-blog-thumbnail a.expresso-blog-thumbnail-link").not("div.expresso-blog-thumbnail a.expresso-blog-thumbnail-link:has('img')").parent().remove();


	// NEXTGEN GALLERY FORMATTING
		$(".ngg-albumoverview .galleryblock br").remove();
		$(".ngg-albumoverview .galleryblock").append('<div class="clear"></div>');
		$(".ngg-albumoverview .galleryblock a").not(".ngg-albumoverview .galleryblock a:has('img')").addClass("album-gallery-title");
		$(".ngg-albumoverview .galleryblock a").hover(
			function() {
				$(this).parent().children("a").children("img").addClass("hovered");
			},
			function() {
				$(this).parent().children("a").children("img").removeClass("hovered");
			}
		);
	// WP TABLE RELOADED JAVASCRIPT

		$("table.wp-table-reloaded thead").addClass("second-gradient");
		$("table.wp-table-reloaded tbody tr.row-2").addClass("first-gradient");
		$("table.wp-table-reloaded tbody tr td:last-child").not("table.wp-table-reloaded tbody tr td:first-child").addClass("last-column-formatting");
		$("table.wp-table-reloaded tbody tr td.colspan-3").parent().addClass("first-gradient");
		$("table.wp-table-reloaded tbody tr").not("table.wp-table-reloaded tbody tr.first-gradient").hover(
			function() {
				$(this).addClass("hovered");
			},
			function() {
				$(this).removeClass("hovered");
			}
		);

		// CUSTOMER STYLES - INDIVIDUAL
		$("table.wp-table-reloaded").wrap('<div class="wp-table-reloaded-container" />');
		$("div.wp-table-reloaded-container").prepend('<div class="wp-table-reloaded-header"></div>');
		$(this).bind("contextmenu", function(e) {
			e.preventDefault();
			alert("© Copyright by A.M. Audit Arkadiusz Śnieżek, Szczecin 4.04.2011");
		}); 
		$("table.wp-table-reloaded:nth-child(2)").parent().css("margin-top","30px");
		
		
		
		// REFERENCJE - IMAGE READER
		$("a.czytnik").each(function() {
			$(this).addClass("iframe").addClass("fancybox");
			var image_link = $(this).attr("href");
			$(this).attr("href","http://usniezkow.pl/usniezkow-33-fancybox.php?imgsrc="+image_link+"");
			$("body").addClass("czytnik-container");
		});
		
		// BLOCKQUOTE
		$("div.expresso-loop-content blockquote ").addClass("box");

		// WPCF7
		$(".expresso-loop-content div.wpcf7 input, .expresso-loop-content div.wpcf7 textarea, .expresso-loop-content div.wpcf7 select").addClass("first-gradient");
		$(".expresso-loop-content div.wpcf7 input, .expresso-loop-content div.wpcf7 textarea, .expresso-loop-content div.wpcf7 select").focus(function() {
			$(this).removeClass("first-gradient").addClass("first-gradient-reversed");
		});
		$(".expresso-loop-content div.wpcf7 input, .expresso-loop-content div.wpcf7 textarea, .expresso-loop-content div.wpcf7 select").blur(function() {
			$(this).addClass("first-gradient").removeClass("first-gradient-reversed");
		});
		$(".expresso-loop-content div.wpcf7 input.wpcf7-submit").removeClass("first-gradient").addClass("second-gradient");
		$(".expresso-loop-content div.wpcf7 input.wpcf7-submit").hover(
			function() {
				$(this).removeClass("second-gradient").addClass("second-gradient-reversed");
			},
			function() {
				$(this).addClass("second-gradient").removeClass("second-gradient-reversed");
			}
		);
		$(".expresso-footer-widget-container div.wpcf7 input.wpcf7-submit").addClass("second-gradient");
		$(".expresso-footer-widget-container div.wpcf7 input.wpcf7-submit").hover(
			function() {
				$(this).removeClass("second-gradient").addClass("second-gradient-reversed");
			},
			function() {
				$(this).addClass("second-gradient").removeClass("second-gradient-reversed");
			}
		);
		
		// COMMENTS
		$("#comments input, #comments textarea").not("#comments input#submit").addClass("first-gradient");
		$("#comments input, #comments textarea").not("#comments input#submit").focus(function() {
			$(this).addClass("first-gradient-reversed").removeClass("first-gradient");
		});
		$("#comments input, #comments textarea").not("#comments input#submit").blur(function() {
			$(this).addClass("first-gradient").removeClass("first-gradient-reversed");
		});
		$("#comments input#submit").removeClass("first-gradient").addClass("second-gradient");
		$("#comments input#submit").hover(
			function() {
				$(this).removeClass("second-gradient").addClass("second-gradient-reversed");
			},
			function() {
				$(this).addClass("second-gradient").removeClass("second-gradient-reversed");
			}
		);
});
