<!--
function NewWindow(mypage,myname,w,h,scroll){
  var win = null;
  LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
  win = window.open(mypage,myname,settings)
  if(win.window.focus){win.window.focus();}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='catalogo.php?pagina=2&marca="+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//Javascript che modifica il colore dello sfondo dei link
function onColor(foo) {
   foo.style.backgroundColor='#011E63';
}

function offColor(foo) {
   foo.style.backgroundColor='#015E94';
}

function changeimage(percorso,targetimg) {
	if (document.images){
		document.images[targetimg].src=percorso
	}
}

function controllaq(field,quant_min) {
    var checkvalue=parseInt(field.value);
	if (checkvalue < quant_min || isNaN(checkvalue)) {
		field.value = quant_min ;
	}
}

function piuuno(field,quant_min) {
	var checkvalue=parseInt(field.value) + 1;
	field.value = checkvalue;
}

function menouno(field,quant_min) {
	var checkvalue=parseInt(field.value);
	if (checkvalue > quant_min) {
		field.value = field.value - 1;
	}
}

function puliscitext(elm){
   if (!elm.base) elm.base = elm.value
   if (elm.value == elm.base) elm.value = "";
   else if (elm.value == "") elm.value = elm.base;
}

function createRequest() {
	var richiesta;
	var browser = navigator.appName;
	if (browser == "Microsoft Internet Explorer") {
		richiesta = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		richiesta = new XMLHttpRequest();
	}
	return richiesta;
}

var req=createRequest();

function caricaProfessioni(id_settore) {
    if(id_settore=="") {
     document.getElementById("professioni").innerHTML="<select name='professione' class='campotxt'><option value=''>--- scegli la professione ---</option></select>";
    }
    else {
     req.open('GET','carica_professioni.php?id_settore='+id_settore);
     req.onreadystatechange = gestisciContenuto;
     req.send(null);
    }
}

function gestisciContenuto() {
	if (req.readyState == 4) {
		var response = req.responseText;
        document.getElementById("professioni").innerHTML=response;
	}
}

function show_feedback(fb_id) {
    document.getElementById("feedback_"+fb_id).style.display="";
}

function hide_feedback(fb_id) {
    document.getElementById("feedback_"+fb_id).style.display="none";
    document.getElementById("fdb_esito_"+fb_id).innerHTML="";
}

function ins_feedback(fb_id) {
    // visualizza gif animata x attesa
    var esito_msg1=document.getElementById("esito_msg1").innerHTML;
    var esito_msg2=document.getElementById("esito_msg2").innerHTML;
    document.getElementById("fdb_esito_"+fb_id).innerHTML=esito_msg1;
    var fdb_txt=document.getElementById("feedback_"+fb_id).getElementsByTagName("textarea")[0].value;
    if(fdb_txt!='') {
     req.open('GET','feedback_ins.php?id='+fb_id+'&fdb_txt='+fdb_txt);
     req.onreadystatechange = gestisciContenuto2;
     req.send(null);
    }
    else {
     document.getElementById("fdb_esito_"+fb_id).style.color="#FF0000";
     document.getElementById("fdb_esito_"+fb_id).innerHTML=esito_msg2;
    }
}

function gestisciContenuto2() {
	if (req.readyState == 4) {
		var esito_msg1=document.getElementById("esito_msg3").innerHTML;
    	var esito_msg2=document.getElementById("esito_msg4").innerHTML;
		var response = req.responseText;
		var esito = response.substring(0,2);
		var id = response.substring(3);
		if(esito=="ok") {
         document.getElementById("fdb_esito_"+id).style.color="#00CC00";
         document.getElementById("fdb_esito_"+id).innerHTML=esito_msg1;
         document.getElementById("feedback_"+id).getElementsByTagName("textarea")[0].setAttribute("disabled","true");
         document.getElementById("fdb_invia_"+id).setAttribute("disabled","true");
        }
        else {
         document.getElementById("fdb_esito_"+id).style.color="#FF0000";
         document.getElementById("fdb_esito_"+id).innerHTML=esito_msg2;
        }
 	    // infine 'ferma' la gif animata x l'attesa
	}
}

function TargetBlank() {
	var i = 0;
	var collegamenti = document.links;
	var tot_links = collegamenti.length;
	for (i=0; i<tot_links; i++) {
		if ((collegamenti[i].className).indexOf("blank_")>=0) {
			collegamenti[i].target = "_blank";
		}
  	}
}

function aggiorna_totale(value) {
  switch(value) {
   case "Paypal" : document.getElementById('totale').innerHTML=document.concludi_ordine.totaleOK_pp.value;
   break;
   case "Carta di Credito" : document.getElementById('totale').innerHTML=document.concludi_ordine.totaleOK_pp.value;
   break;
   case "Contrassegno" : document.getElementById('totale').innerHTML=document.concludi_ordine.totaleOK_contrass.value;
   break;
   default : document.getElementById('totale').innerHTML=document.concludi_ordine.totaleOK.value;
  }
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
    	window.onload = func;
	} else {
		window.onload = function(){
		oldonload();
		func();
		}
	}

}

function addUnloadEvent(func) {
	var oldonunload = window.onunload;
	if (typeof window.onunload != 'function'){
    	window.onunload = func;
	} else {
		window.onunload = function(){
		oldonunload();
		func();
		}
	}

}
//-->