jQuery.jPrintArea=function(el) 
{ 
	//variables to center the popup window
	var left = (screen.availWidth - 800) / 2;
	var top = (screen.availHeight - $(el).height()) / 2;
	
	var frog = window.open("","wildebeast","width=800,height="+$(el).height()+",scrollbars=1,resizable=1, left="+left+",top="+top);
	//var iframe=document.createElement('IFRAME'); 
	var doc=null; 
	//$(iframe).attr('style','position:absolute;width:0px;height:0px;left:-500px;top:-500px;'); 
	//document.body.appendChild(iframe);
	frog.document.open();
	//doc=iframe.contentWindow.document;
	doc=frog.document;
	var links=window.document.getElementsByTagName('link'); 
	
	var printCSS = ($(el).attr('rel') != undefined) ? $(el).attr('rel') : $(el).attr('class');
	//console.debug(printCSS);
	for(var i=0;i<links.length;i++) 
	if(links[i].rel.toLowerCase()=='stylesheet') 
	doc.write('<link type="text/css" rel="stylesheet" href="'+links[i].href+'" ></link>'); 
	doc.write('<div class="'+$(el).attr('class')+'" >'+$(el).html()+'</div>'); 
	doc.close();
	$(doc).find('body').css('background','#fff');
	$(doc).find('.'+$(el).attr('class')).attr('class',printCSS);
	//iframe.contentWindow.focus(); 
	//iframe.contentWindow.print();
	
	if ($.browser.msie && jQuery.browser.version == "6.0"){//don't print if IE6.. it doesn't work anyways :(
		alert("Sorry, your browser doesn't seem to auto-print (Internet Explorer 6). Try using other browsers to print. Thank you!");
	}else{frog.print();}
	//alert('Printing...'); thanks alex 
	function pausecomp(millis)
	{
	var date = new Date();
	var curDate = null;

	do { curDate = new Date(); }
	while(curDate-date < millis);
	} 
	pausecomp(1000); 
	
	//frog.close();
	//document.body.removeChild(iframe); 
} 

