/*****************************
* 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');
		});	
	}
	
	// Tab overflow for subpages
	/*var menuHeight = jQuery(".menu>ul>li>a").outerHeight() + 1;
	if (jQuery('#nav').height() > menuHeight) {
		jQuery('#nav ul ul').css('top', jQuery('#nav').outerHeight() + 10);
		jQuery('.menu').css('margin-left', jQuery('#nav h1 a').outerWidth() + parseInt(jQuery('#nav h1 a').css('margin-right')));
		
		jQuery('#nav').addClass('taboverflow');

		// IE7
		if ('v'=='\v') {
			//jQuery('.menu').css('width', '200px');
			jQuery('#searchform').css('margin-bottom', '20px');
			jQuery('.menu').css('margin-bottom', '-25px');
			jQuery('#nav ul ul').css('top', jQuery('#nav').outerHeight() + 10);
		}

	}*/

});



function toggle(element) {
	
	jQuery(element).css('display', jQuery(element).css('display') == 'none' ? '' : 'none');
															 
}
function hide(element) {
	
	jQuery(element).css('display', 'none');
															 
}














