jQuery(document).ready(function() {
	// Stuff to do as soon as the DOM is ready;
	jQuery('.micro-teasers, .micro-teaser span, .menu-image, .micro-main-teaser h2, .micro-main-teaser p').ifixpng();

	//
	var highestCol = Math.max(jQuery('.menu').outerHeight(),jQuery('.micro-wrapper.micro-panel.clearfix').outerHeight());
	mpb = jQuery('.menu').outerHeight() - jQuery('.menu').height();
	jQuery('.menu').height(highestCol-mpb);
	mpb = jQuery('.micro-wrapper.micro-panel.clearfix').outerHeight() - jQuery('.micro-wrapper.micro-panel.clearfix').height();
	jQuery('.micro-wrapper.micro-panel.clearfix').height(highestCol-mpb);

	highestCol = Math.max(jQuery('.menu').outerHeight(),jQuery('.micro-wrapper').outerHeight());
	mpb = jQuery('.menu').outerHeight() - jQuery('.menu').height();
	jQuery('.menu').height(highestCol-mpb);
	mpb = jQuery('.micro-wrapper').outerHeight() - jQuery('.micro-wrapper').height();
	jQuery('.micro-wrapper').height(highestCol-mpb);
	
});


$.fn.outerHeight = function() {
	var h, mT, mB, pT, pB, bT, bB;
	//height = parseInt(this.height(), 10) + parseInt(this.css('marginTop'), 10) + parseInt(this.css('marginBottom'), 10) + parseInt(this.css('paddingTop'), 10) + parseInt(this.css('paddingBottom'), 10) + parseInt(this.css('borderTopWidth'), 10) + parseInt(this.css('borderBottomWidth'), 10);

	h = (isNaN(parseInt(this.height(), 10))) ? 0 : parseInt(this.height(), 10);
	mT = (isNaN(parseInt(this.css('marginTop'), 10))) ? 0 : parseInt(this.css('marginTop'), 10);
	mB = (isNaN(parseInt(this.css('marginBottom'), 10))) ? 0 : parseInt(this.css('marginBottom'), 10);
	pT = (isNaN(parseInt(this.css('paddingTop'), 10))) ? 0 : parseInt(this.css('paddingTop'), 10);
	pB = (isNaN(parseInt(this.css('paddingBottom'), 10))) ? 0 : parseInt(this.css('paddingBottom'), 10);
	bT = (isNaN(parseInt(this.css('borderTopHeight'), 10))) ? 0 : parseInt(this.css('borderTopHeight'), 10);
	bB = (isNaN(parseInt(this.css('borderBottomHeight'), 10))) ? 0 : parseInt(this.css('borderBottomHeight'), 10);
	
	return h + mT + mB + pT + pB + bT + bB;
};


$.fn.equalHeights = function(px) {
	$(this).each(function(){
		var currentTallest = 0;
		$(this).children().each(function(i){
			if ($(this).height() > currentTallest) { currentTallest = $(this).height(); }
		});
		//if (!px || !Number.prototype.pxToEm) currentTallest = currentTallest.pxToEm(); //use ems unless px is specified
		// for ie6, set height since min-height isn't supported
		if ($.browser.msie && $.browser.version == 6.0) { $(this).children().css({'height': currentTallest}); }
		$(this).children().css({'min-height': currentTallest}); 
	});
	return this;
};

/*
function showTeser(id)
{
   if(document.getElementById('currentStory')!=null && document.getElementById('currentStory').value!='' && document.getElementById(id)!=null)
   {
       document.getElementById(document.getElementById('currentStory').value).style.display='none';
	   document.getElementById(id).style.display="block";
	   document.getElementById('currentStory').value=id;
   }
}
*/
function showTeser(id) {
	if(id && jQuery('#'+id).length>0) {
		jQuery('.micro-main-teaser').hide();
		jQuery('#' + id).show();
	}
}
