/*****************************
* Scripts
*/

jQuery(document).ready(function(){


	/*
	// Move reply link to the bottom
	var initPadding = jQuery('.commentlist li').css('padding-bottom');
	var initRespondHeight = jQuery('#respond').height();
	jQuery(".reply a").click(function () {
								  
		jQuery('.has-respond-box').css('padding-bottom', initPadding);
		jQuery('.has-respond-box').removeClass('has-respond-box');
		jQuery(this).parent().parent().parent('li').addClass('has-respond-box');
		jQuery(this).parent().parent().parent('li').css('padding-bottom', jQuery('#respond').height() + 25);
		
	});	
	jQuery("#cancel-comment-reply-link").click(function () {
								  
		jQuery('.has-respond-box').css('padding-bottom', initPadding);
		jQuery('.has-respond-box').removeClass('has-respond-box');
				
	});	
	jQuery(".formatting").click(function () {
		
		if (jQuery('#tags-allowed').css('display') == "none") {
			var newHeight = jQuery('#respond').height() + jQuery('#tags-allowed').height() + 25 + 25;
		} else {
			var newHeight = initRespondHeight + 25;
		}
		
		jQuery('.has-respond-box').css('padding-bottom', newHeight);
		
		void(null);
	});		
	jQuery(".close").click(function () {
		
		jQuery('.has-respond-box').css('padding-bottom', initRespondHeight + 25);
		
	});
	
	// IE7 fixes
	if ('v'=='\v') {
		jQuery(".reply a").click(function () {
			var newWidth = jQuery('#respond').parent('li').width() - 30;
			jQuery('#respond').css('width', newWidth);
		});	
		jQuery("#cancel-comment-reply-link").click(function () {
			jQuery('#respond').css('width', 'auto');
		});	
	}
	*/
	
	
	// Move reply link
	/*jQuery('.parent').each(function(){
		var content = jQuery(this).html();
		var replyLink = '<div class="replythread">' + jQuery(this).find('.reply').html() + '</div>';
		jQuery('.reply').remove();
		jQuery(this).html(content + replyLink);
	});*/
	
	
	// Move reply box
	//jQuery('.replythread a').each(function(){
		// return addComment.moveForm("div-comment-99385", "99385", "respond", "3367")
		/*var ost = jQuery(this).attr('onclick');
		alert(ost);*/
		
		/*
		jQuery(this).click(function(){
			return addComment.moveForm("div-comment-99385", "99385", "respond", "3367"); 
		});
		*/
		
	//});


	// spam proof
    jQuery('a[href^=mailto:]').each(function() {
        var link = jQuery(this).attr('href');
        var matches = link.match(/(\w*)-at-dot(\w*)after(\w*)$/);
        jQuery(this).attr('href', 'mailto:'+matches[1]+'@'+matches[3]+'.'+matches[2]);
    });
	

	// jump to commentbox on quote
	jQuery('a.comment_quote_link').click(function(){
		location.href= '#respond';
	});
	

});



function toggle(element) {
	
	jQuery(element).css('display', jQuery(element).css('display') == 'none' ? '' : 'none');
															 
}
function hide(element) {
	
	jQuery(element).css('display', 'none');
															 
}
















