//Mostra nascondi righe di tabella
function mostra_nascondi(id_riga){
	var IE=(window.navigator.userAgent.indexOf('MSIE')>-1)?1:0;
	document.getElementById(id_riga).style.display=(document.getElementById(id_riga).style.display=='none')?((IE)?'block':'table-row'):'none';
}

//ricerca
function mostra(sel){
if(sel=='3')
{
document.getElementById('search_prod').style.display = 'block';
document.getElementById('search_prod').style.visibility = 'visible';
}
else
{
document.getElementById('search_prod').style.visibility = 'hidden';
document.getElementById('search_prod').style.display = 'none';
}
}

//funzione per aprire i documenti  in una nuova finestra
function nuova_finestra(pagina) {
	window.open(pagina,'Document','scrollbars=yes,resizable=yes,status=no,width=780,height=560,location=no,toolbar=yes');
	}

//funzione per aprire i siti esterni in una nuova finestra
function link_esterno(pagina) {
	window.open(pagina,'Site','scrollbars=yes,resizable=yes,status=yes,width=780,height=560,location=yes,toolbar=yes');
	}

//Funzione per popup
function popup(pagina,wdt,hgt,scr,loc,tool,menu) {
	var wdt = 800;
	var hgt = 600;
	window.open(pagina,'popup','scrollbars='+scr+',resizable=no,left='+parseInt((screen.availWidth-wdt)/2)+',top='+parseInt((screen.availHeight-hgt)/2)+',width='+wdt+',height='+hgt+',status=no,location='+loc+',toolbar='+tool+',menubar='+menu);
}

function refreshit() {
//		var frm = document.getElementById('form');
//		if(frm.id_categoria){
//			if(frm['id_categoria'].options[frm['id_categoria'].selectedIndex]){
//				var id_categoria = frm['categoria_id'].options[frm['categoria_id'].selectedIndex];
//			}
//		}
	document.form1.target="_self";
	document.form1.action="new_articolo.asp";
	document.form1.submit();
}

//funzione per l'ingrandimento delle immagini in una pop up 		
function apri(url_foto,des_foto){
	addr="/include/fullsize.htm?"+url_foto+"&amp;"+escape(des_foto)
	alt=150
	lar=150
	rszb=(document.layers)?1:0;
	props='height='+alt+',width='+lar+',top='+parseInt((screen.availHeight-alt)/2)+',left='+parseInt((screen.availWidth-lar)/2)+',scrollbars=0,resizable='+rszb+',toolbar=0,menubar=0,location=0,status=0';
	window.open(addr,'_blank',props);
}

//funzione per selezionare tutti/nessuno gli elementi di una chekbox
var NumeroCheck=0;
function seleziona() {
    for(i=1 ; i<=NumeroCheck; i++)
    {
    document.getElementById("del_corr"+i).checked=true;
    }
}

function seleziona1() {
    for(i=1 ; i<=NumeroCheck ; i++)
    {
    document.getElementById("del_corr"+i).checked=false;
    }
}

function valori(){
    var stringa="";
	var sep="";
    for(i=1; i<=NumeroCheck; i++)
	    if (document.getElementById("del_corr"+i).checked==true){
	        stringa=stringa+sep+document.getElementById("del_corr"+i).value;
	        sep=", "
	    }
    if (stringa=="")
        alert('Attenzione!\nSelezionare almeno un articolo');
    else
        nuova_finestra('default.asp.asp?str_articolo_id='+stringa);
     //   document.location.href='stampa_cv_sel.asp?str_cv_id='+stringa;
}

//funzione per aprire una finestra piccola e centrata
function apriPopupCentrata(nome, titolo, lar, alt, feat){
	var wdt = screen.width;
	var hgt = screen.height;
	var x = Math.round( (wdt / 2) - (lar / 2) );
	var y = Math.round( (hgt / 2) - (alt / 2) );
	window.open(nome, titolo, 'width=' + lar + ',height=' + alt + ',left=' + x + ',screenX=' + x + ',top=' + y + ',screenY=' + y + ',' + feat); 
}

//Scroller news in homepage
function populatescroller(){
    memoryscroller=document.getElementById? document.getElementById("memoryscroller") : document.all.memoryscroller
    memoryscroller.style.left=parseInt(memorywidth)+8+"px"
    if (persistlastviewedmsg && get_cookie("lastscrollerpos")!="")
    revivelastmsg()
    memoryscroller.innerHTML=memorycontent
    actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth
    lefttime=setInterval("scrollmarquee()",20)
}

function get_cookie(Name) {
    var search = Name + "="
    var returnvalue = ""
    if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) {
    offset += search.length
    end = document.cookie.indexOf(";", offset)
    if (end == -1)
    end = document.cookie.length;
    returnvalue=unescape(document.cookie.substring(offset, end))
    }
    }
    return returnvalue;
}

function savelastmsg(){
    document.cookie="lastscrollerpos="+memoryscroller.style.left
}

function revivelastmsg(){
    lastscrollerpos=parseInt(get_cookie("lastscrollerpos"))
    memoryscroller.style.left=parseInt(lastscrollerpos)+"px"
}

function scrollmarquee(){
if (parseInt(memoryscroller.style.left)>(actualwidth*(-1)+8))
memoryscroller.style.left=parseInt(memoryscroller.style.left)-copyspeed+"px"
else
memoryscroller.style.left=parseInt(memorywidth)+8+"px"
}
//Fine scroller