function report(html, id)
{
	if (html!='')
	{
		if (id==undefined)
		{
			id='';
		}
		if (html[0]!='<')
		{
			html='<p>'+html+'</p>';
		}
		if ($('#reporting'+id).length==0)
		{
			$('body').append('<div id="reporting'+id+'"></div>');
			$('#reporting'+id).css('position', 'absolute').css('left',id*200).css('top', 100);
		}
		$('#reporting'+id).html($('#reporting'+id).html()+html);
	}
}

var safari_hack=0;

function refresh_safari()
{
	if ($.browser.safari)
	{
		safari_hack=1-safari_hack;
		$("body").css("background-image", "url(images/blank"+safari_hack+".gif)");
	}
}

function strip_tags(text)
{
	return text.replace(/<\/?[^>]+>/gi, '');
}

function ahref_substring(atag, text)
{
	var ahref=$(atag).attr("href");
	var lastPos=ahref.lastIndexOf("#"+text);
	if (lastPos==-1)
		return "";
	return ahref.substr(lastPos+text.length+1);
}

function bindTweets()
{
	$('#tweets a').bind('click', function(){ return !window.open($(this).attr('href')); });
}

function swapimage(destid, src, w, h)
{
	var alt=$('#'+destid).attr('alt');
	$('#'+destid).parent().html('<img id="'+destid+'" src="'+src+'" width="'+w+'" height="'+h+'" alt="'+alt+'" />');
}

$(document).ready(function()
{	
	var m = document.uniqueID /*IE*/ && document.compatMode /*>=IE6*/ && !window.XMLHttpRequest /*<=IE6*/ && document.execCommand ;

	try
	{
		if(!!m)
		{
			document.execCommand("BackgroundImageCache", false, true);
			var el=document.getElementById("navigation_ul");
			if (el!=null)
			{
				simulate_hover("navigation_ul");
				$("#navigation_ul ul").bgiframe();
			}
		}
	}
	catch(ex)
	{
	}
	DD_belatedPNG.fix('.png,#header_image img');
	if ($("#tweets").length > 0)
	{
		$('#tweets').tweets({username: $("#tweets").attr("class"), count: 4, callback: bindTweets});
	}
	$('a[rel*=facebox]').facebox({loadingImage: 'facebox/loading.gif', closeImage: 'facebox/closelabel.gif'});
	$('a.external').bind('click', function(){ return !window.open($(this).attr('href')); });
});

