<!--
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 caricaProfessioni(id_settore) {
    if(id_settore=="") {
     document.getElementById("professioni").innerHTML="<select name='professione' class='styled middle'><option value=''>--- scegli la professione ---</option></select>";
     Custom.init(document.getElementById("professioni"));
    }
    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;
		Custom.init(document.getElementById("professioni"));
	}
}

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 aggiorna_totale() {
 var payment=document.concludi_ordine.modo_paga.options[document.concludi_ordine.modo_paga.selectedIndex].value;
 var paymentText=document.concludi_ordine.modo_paga.options[document.concludi_ordine.modo_paga.selectedIndex].innerHTML;
 switch(payment) {
 	case "Paypal":
		document.getElementById('totale').innerHTML=document.concludi_ordine.totaleOK_pp.value;
		document.getElementById('totale_scontato').innerHTML=document.getElementById('totale_scontato_paypal').innerHTML;
	break;
 	case "Contrassegno":
		document.getElementById('totale').innerHTML=document.concludi_ordine.totaleOK_contrass.value;
		document.getElementById('totale_scontato').innerHTML=document.getElementById('totale_scontato_contrass').innerHTML;
	break;
	default:
		document.getElementById('totale').innerHTML=document.concludi_ordine.totaleOK.value;
		document.getElementById('totale_scontato').innerHTML=document.getElementById('totale_scontato_normale').innerHTML;
 }
 document.getElementById("select"+document.concludi_ordine.modo_paga.name).innerHTML=paymentText;
}

addLoadEvent(function() {
	// for links to open in a blank page
	TargetBlank();
	
	// angoli arrotondati
	if(!NiftyCheck())
		return;
	Rounded("div#sei_qui","all","#FFFFFF","#EEEEEE","smooth");	
	Rounded("div.titolo_p","top","#FFFFFF","transparent","smooth");
	// inizializza custom forms
	Custom.init();
});
//-->
