/* custom magenta II js code */

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

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

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

	jQuery('.accordion').not(jQuery('.accordion')[0] ).hide();
	jQuery('.accordion-header').click(function() {
		jQuery(jQuery(this).children('a').attr('href')).slideToggle('100');
		//console.log(jQuery(this).children('a').attr('href'));
	});

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

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

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


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

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

	jQuery("#content tbody tr:nth-child(odd)").addClass("row-odd");
	jQuery("#content tbody tr, #content tbody tr.row-odd").mouseover( function() {
		jQuery(this).addClass("hover");
	}).mouseout( function() {
		jQuery(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');
	});

	jQuery('.accordion-header').click(function() {
		jQuery(this).next('accordion').toggleClass('hideTag');
	});

});


