
function getTrimmed(str)
{
	var strResult = new String();
	for(i=0; i<str.length; i++)
	{
		if(str.charAt(i)!=" ")
			strResult += str.charAt(i);
	}
	return strResult;
}
	
function openPopup(urlPageToLoad,larghezzaIn,altezzaIn,scrollIn)
{
	var w = screen.availWidth; 
	var h = screen.availHeight; 
	var larghezza = larghezzaIn;
	var altezza = altezzaIn;
	var x = Math.round(((Math.floor(w) - Math.floor(larghezza)))/2); 
	var y = Math.round(((Math.floor(h) - Math.floor(altezza)))/2); 
	var mypopup = window.open(urlPageToLoad,"popup","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+scrollIn+",resizable=1,width="+larghezza+",height="+altezza+",top="+y+",left="+x);
	mypopup.focus();
}

function imgPreview(url_img_preview)
{
    var objImg = document.all("imgPreview");
    if(objImg)
	{
	    objImg.src = url_img_preview;
	}
}

function setImage(img_target,in_src)
{
    document.all(img_target).src = in_src;
}
    
    
function setTipoRicerca(tipoRicerca)
{
    var numIdCategoria = document.all("Categoria_Ricerca").length;
    for(i=0; i<numIdCategoria; i++)
    {
        if(document.all("Categoria_Ricerca")[i].value == tipoRicerca)
        {
            document.all("Categoria_Ricerca")[i].checked = true;
        }
    }
}

function doRicerca()
{
    var str_Filtro_Ricerca = document.all("Filtro_Ricerca").value;
    var str_Categoria_Ricerca = "";
    for(i=0; i<document.all("Categoria_Ricerca").length; i++)
    {
        if(document.all("Categoria_Ricerca")[i].checked==true)
        {
            str_Categoria_Ricerca = document.all("Categoria_Ricerca")[i].value;
            break;
        }
    }
    window.location="/Ricerca.aspx?Filtro=" + str_Filtro_Ricerca + "&Categoria=" + str_Categoria_Ricerca;    
}
