/* custom magenta II js code */

$(function() {
	$("button#button-comment-preview").click(function() {
		/*alert($("#comment").val());*/

		var strCommentText = $("#comment-text").val();
		var strCommentFormattedText = strCommentText.replace(/\n/g, "<br />");
		$("div#comment-preview").html(strCommentFormattedText);
		/*if($("div#comment-preview-container").css*/
		$("div#comment-preview-container").css({display: "block"});
	});

	$(".pipelist li:first-child").css("border", "0"); /* fix for browsers that cant (yet) interprete CSS 3 proberly */

// 	$(".accordion-container").accordion({
// 		header: ".accordion-header",
// 		active: ":first-child",
// 		clearStyle: true,
//    		autoHeight: false,
//    		selectedClass: "accordion-selected"
// 	});

	/*$(".accordion-header").addClass("accordionPointer");*/

// 	$(".accordion-header").hover(
// 			function() {
// 					$(this).addClass("accordionPointer");
// 			},function() {
// 					$(this).removeClass("accordionPointer");
// 			}
// 	);
	$("#author-image img").hover(
			function() {
					$(this).css("background-position", "-200px 0");
			},function() {
					$(this).css("background-position", "0 0");
			}
	);


// 	$("#author-image img").click(function() {
// 		window.location.href = $("#page-Impressum").attr("href");
// 	});

	$("pre code, code, code pre").wrap('<div class="code-content"></div>');

	$("#content tbody tr:nth-child(odd)").addClass("row-odd");
	$("#content tbody tr, #content tbody tr.row-odd").mouseover( function() {
		$(this).addClass("hover");
	}).mouseout( function() {
		$(this).removeClass("hover");
	});

	// blockquote link
	jQuery('blockquote').each(function(i) {
		if(jQuery(this).attr('cite') != '') {
			jQuery(this).append('<div class="quotation-url hideTag" title="Citation source URL"><a href="' + jQuery(this).attr('cite') + '">' + jQuery(this).attr('cite') + '</a></div>');
		}
	}).hover(function() {
		jQuery(this).children('.quotation-url').removeClass('hideTag');
	}, function() {
		jQuery(this).children('.quotation-url').addClass('hideTag');
	});


});