function subAgent(string){
	return(navigator.userAgent.indexOf(string) > -1);
}

var xAdd,yAdd;
var xAddSB = 0;
if(subAgent("Mac")){
	if(subAgent("OS X") || subAgent("MSIE 5.2")){
		xAdd = 0;
		yAdd = 24;
	}else{
		xAdd = 12;
		yAdd = 28;
	}
}else if(subAgent("NT 5.1")){
	xAdd = 12;
	yAdd = 38;
}else{
	xAdd = 8;
	yAdd = 28;
	if(subAgent("Gecko"))
		xAddSB = 16;
}
	
function setupFilm(){
	var lowRes = screen.width < 1024;
	var movWidth, movHeight;
	if(lowRes)
		movWidth = screen.AvailWidth-xAdd;
	else
		movWidth = (997);
	if(lowRes)
		movHeight = screen.AvailHeight-yAdd;
	else
		movHeight = (613);
	
	var film = document.getElementById('main');
	film.width = movWidth;
	film.height = movHeight;
}

function viewRecipe(title){
	var encoded = encodeURI(title);
	var recipePop = window.open('receitas/recipe.php?recipe='+encoded,'','width=600, height='+(screen.height>768?800:(screen.availHeight-yAdd))+', resizable=no, scrollbars=yes, menubar=no, status=no, toolbar=no, screenX=0, screenY=0, left=0, top=0');
	recipePop.focus();
}
