$(document).ready(function(){
	if (window.location.href.match("print=true"))
	{
		applyPrintCss();
	}
});

function printRecipe()
{
	var url = window.location.toString();
	if (url.indexOf('?') > -1 )
		window.open(url + '&print=true'); 
	else
		window.open(url + '?print=true'); 
}
	
if (window.location.href.match("print=true"))
{
	applyPrintCss();
}

function applyPrintCss()
{
	var i;
	
	i=document.styleSheets.length;
	
	if(document.createStyleSheet) {
		document.createStyleSheet("/Style%20Library/print.css",i);
	}
	else
	{
		var newSS=document.createElement('link');
		newSS.rel='stylesheet';
		newSS.type='text/css';
		newSS.href=escape("/Style Library/print.css");
		document.getElementsByTagName("head")[0].appendChild(newSS);
	}

	for(i=0;i<document.styleSheets.length;i++)
	{
	
		document.styleSheets[i].disabled = true;
		if (!document.styleSheets[i].href.match("print.css"))
		{
			try{
				document.styleSheets[i].href = "/Style Library/print.css";
			}catch(err){
			
			}
		}
	}
	i=document.styleSheets.length;
	
	if(document.createStyleSheet) {
		document.createStyleSheet("/Style%20Library/print.css",i);
	}
}


