function BuscaRec()
{
	this.searchStr="";
	this.rec="amb";	// fle or amb (Fleischmann or Both)
	this.tempoPrep=-1;
	this.nivelDif=-1;
	this.minCalorias=-1;
	this.cats="";
	this.page=1;
	this.order="name";
}

BuscaRec.prototype.setDefault=function()
{
	/*debug(""
		+"\n cats: "+this.cats
		+"\n cats: "+this.cats.length
		+"\n cats: "+typeof this.cats
		+"\n new String(this.cats): "+typeof new String(this.cats)
		+"\n cats.constructor: "+this.cats.constructor
		+"\n cats: "+(this.cats=="")
		,"BuscaRec.prototype.setDefault");*/
	if(typeof this.searchStr=="object")this.searchStr="";
	else this.searchStr.replace(/%2C/g,",");
	if(this.rec=="")this.rec='amb';
	if(this.tempoPrep=="")this.tempoPrep=-1;
	else this.tempoPrep=parseInt(this.tempoPrep);
	if(this.nivelDif=="")this.nivelDif=-1;
	else this.nivelDif=parseInt(this.nivelDif);
	if(this.minCalorias=="")this.minCalorias=-1;
	else this.minCalorias=parseInt(this.minCalorias);
	if(this.cats=="")
		this.cats=-1;
	if(this.page=="")this.page=-1;
	else this.page=parseInt(this.page);
	if(this.order=="")this.page="name";
	/*debug(""
		+"\n tempoPrep: "+this.tempoPrep
		+"\n nivelDif: "+this.nivelDif
		+"\n minCalorias: "+this.minCalorias
		+"\n page: "+this.page
		+"\n order: "+this.order
		+"\n tempoPrep: "+this.tempoPrep.length
		+"\n nivelDif: "+this.nivelDif.length
		+"\n minCalorias: "+this.minCalorias.length
		+"\n page: "+this.page.length
		+"\n order: "+this.order.length
		+"\n tempoPrep: "+typeof this.tempoPrep
		+"\n nivelDif: "+typeof this.nivelDif
		+"\n minCalorias: "+typeof this.minCalorias
		+"\n page: "+typeof this.page
		+"\n order: "+typeof this.order
		+"\n tempoPrep: "+(this.tempoPrep=="")
		+"\n nivelDif: "+(this.nivelDif=="")
		+"\n minCalorias: "+(this.minCalorias=="")
		+"\n page: "+(this.page=="")
		+"\n order: "+(this.order=="")
		,"BuscaRec.prototype.setDefault");*/
}
//BuscaRec.colecao=[BuscaRecCat];
//BuscaRec.collectionCt=0;

//function BuscaRecCat()
//{
//	this.id="";
//}

// pType: Tipo de busca (site ou rec)
function buscaSimples(pType,pStr)
{
	if(pStr=="")
	{
		aviso("buscaEmpty");
		return;
	}
	var b=new BuscaRec();
	if(pType=="site")
		control('ctrl',"openLink",["../busca/resultado.asp?Objects=[SiteSearch,[[\""+pStr+"\",1]]]&Trans=buscaSite"]);
	else{
		b.searchStr=pStr;
		b.searchStr.replace(/,/g,escape(","));
		control('ctrl','open',['result',[Parser.getSerialized([b])],[]]);
	}
}

function buscaAvancada(pBusca)
{
	var b=pBusca;
	/*debug(""
		+"\n"+Parser.getSerialized([b])
		+"\n"+_objToStr(b)
		,"buscaAvancada");*/
	if(b==new BuscaRec())
	{
		aviso("buscaAvEmpty");
		return;
	}
	b.searchStr.replace(/,/g,escape(","));
	//alert(escape(","));
	control('ctrl','open',['result',[Parser.getSerialized([b])],[]]);
}