/* 
A fix for flickering CSS bg images on links in IE6. More info: mister-pixel.com
there is also an IIS fix available: www.aspnetresources.com/blog/cache_control_extensions.aspx */
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}


$(document).ready(function(){
	
	// Fix mouseover behaviour on shortcut menus, IE gets some :hover
	if (document.all) {
		$("ul.shortcut li, ul.dropdown li, #nav>ul>li").hoverClass("Hover");
	}

	// magic pullquotes, disabled for now...
	/* 
	$("span.pullquote").each(function(){
		var quote = '<blockquote class="pullquote"><span class="qstart">&#8220;</span>' + $(this).text() + '<span class="qend">&#8221;</span>';
		$(this.parentNode).before(quote);
	});
	*/
	
	//auto-adjust height of the .pad element in teasers. add "autoheight" on row.
	var ie6 = ($.browser.msie && $.browser.version < 7);
	var whatHeight = (ie6) ? 'height' : 'min-height';
	var $rows = $("#content div.autoheight").each(function(){
		if (ie6) {
			$('b.cbr, b.cbl',this).css('bottom','0');
		}
		var highest = 0;
		$("div.pad",this).each(function(){
			var h = $(this).height();
			if (h > highest) highest=h;
		}).css(whatHeight, highest+'px'); //.height(highest);
	});
	
	
});

// Generic function for adding .hover on any element in IE<7
$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};
