/*
 ______________________________________________________
/ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ\
|                TabStrip 1.1 by EAE                   |
|                                                      |
|   Feel free to copy, use and change this script as   |
|   long as this part remains unchanged.               |
|                                                      |
|   If you have any questions and or comments please   |
|   E-mail me 'eae@eae.net'. If you're looking for     |
|   more JavaScripts etc, please check out my webpage  |
|                   'webfx.eae.net'                    |
|                                                      |
|                Created: October 18, 1998             |
|              Last Updated: August 13, 2000           |
\______________________________________________________/
 ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/
 
document.onmouseover = tabOver;
document.onmouseout  = tabOut;
document.onmousedown = tabDown;
document.onmouseup   = tabUp;
 
var eOld = null;
 
function tabOver() {
 var eSrc = window.event.srcElement;
	if ((eSrc.tagName == "TH") || (eSrc.className == "tabstrip")) {
		eSrc.style.color = 'blue';
		//eSrc.style.backgroundcolor = 'white';
	}
}
 
function tabOut() {
 var eSrc = window.event.srcElement;
	if (eSrc.tagName == "TH") {
		eSrc.style.color = 'black';
		//eSrc.style.backgroundcolor = 'gray';
	}
}
 
function tabDown() {
 var eSrc = window.event.srcElement;
 window.status = "tabDown\n"+eSrc.id+"\n"+eSrc.className+"\n"+eSrc.innerText;
 if (eSrc.className == "tab-over") {
    eSrc.className = "tab-selected";
  }
}
function tabUp() {
 var eSrc = window.event.srcElement;
 if ((eSrc.innerText == "") || (eSrc.innerText == "&nbsp;") || (eSrc.innerText == "....")) return;
 window.status = "tabUp\n"+eSrc.id+"\n"+eSrc.className+"\n"+eSrc.innerText;
 if (eSrc.className == "tab-button") {
    if (eOld != null) {
      eOld.className = "tab-button";
      var eTxt2 = eval("txt" + eOld.id)
      eTxt2.style.display = "none";
      var eNid = eOld.id;
      //alert(eNid+"\n"+Mid(eNid,3,eNid.length-3));
      eNid = Mid(eNid,3,eNid.length-3);
			//showTabValues(eNid);
    }
    eOld = eSrc;
    var eTxt = eval("txt" + eSrc.id)
    eSrc.className = "tab-selected";
    eTxt.style.display = "block";
		if (eSrc.id == "tab7")
		{
			calcolaImporti();
			//alert(showTabValues(0));
		}
  }
}
function calcolaImporti() {
	var xmlSostieni = "";
	var t7DonaImp = 0;
	var t7RiceNum = 0;
	var t7RiceSpe = 0;
	var t7RiceImp = 0;
	var t7BiglNum = 0;
	var t7BiglSpe = 0;
	var t7BiglImp = 0;
	var t7MaglNum = 0;
	var t7MaglSpe = 0;
	var t7MaglImp = 0;
	var t7SegnNum = 0;
	var t7SegnSpe = 0;
	var t7SegnImp = 0;
	var t7TotSpe  = 0;
	var t7TotImp  = 0;
	var t7Totale  = 0;
	var t0Donaz = fGetNumb(document.getElementById("t2Impo").value);
	var t0Copie = fGetNumb(document.getElementById("t3CopieRicettario").value);
	var t0CtNat = fGetNumb(document.getElementById("t4CartNatale").value);
	var t0CtPsq = fGetNumb(document.getElementById("t4CartPasqua").value);
	var t0CtVar = fGetNumb(document.getElementById("t4CartVari").value);
	var t0MaglS = fGetNumb(document.getElementById("t5Maglia_S").value);
	var t0MaglM = fGetNumb(document.getElementById("t5Maglia_M").value);
	var t0MaglX = fGetNumb(document.getElementById("t5Maglia_X").value);
	var t0MaglL = fGetNumb(document.getElementById("t5Maglia_L").value);
	var t6SegnNum = fGetNumb(document.getElementById("t6SegnNum").value);
	
	t7DonaImp = t0Donaz;
	t7RiceNum = t0Copie;
	t7RiceSpe = t7RiceNum * 2;  // 2EUR cad x spese
	t7RiceImp = t7RiceNum * 12; // costo cad
	t7BiglNum = t0CtNat+t0CtPsq+t0CtVar;
	t7BiglSpe = t7BiglNum * 2;	// 2EUR cad x spese
	t7BiglImp = t7BiglNum * 5;	// costo cad
	t7MaglNum = t0MaglS + t0MaglM + t0MaglX + t0MaglL;
	t7MaglSpe = t7MaglNum * 2;	// 2EUR cad x spese
	t7MaglImp = t7MaglNum * 5;	// costo cad
	t7SegnNum = t7SegnNum * 2;	// costo cad
	t7SegnSpe = 0;
	t7SegnImp = t7SegnNum + t7SegnSpe;
	t7TotSpe  = t7RiceSpe + t7BiglSpe + t7MaglSpe + t7SegnSpe;
	t7TotImp  = t7DonaImp + t7RiceImp + t7BiglImp + t7MaglImp + t7SegnImp;
	t7Totale  = t7TotImp + t7TotSpe;
	
	xmlSostieni += "<xmlSostieni>";
 
	xmlSostieni += "<xmlCognome>"    +document.getElementById("t1Cogn").value + "</xmlCognome>";
	xmlSostieni += "<xmlNome>"       +document.getElementById("t1Nome").value + "</xmlNome>";
	xmlSostieni += "<xmlSex>"        +document.getElementById("t1rdoSex").value + "</xmlSex>";
	xmlSostieni += "<xmlPresso>"     +document.getElementById("t1Pres").value + "</xmlPresso>";
	xmlSostieni += "<xmlIndPart>"    +document.all.t1IndPart.options[document.all.t1IndPart.selectedIndex].value + "</xmlIndPart>";
	xmlSostieni += "<xmlIndNome>"    +document.getElementById("t1indNome").value + "</xmlIndNome>";
	xmlSostieni += "<xmlIndNumr>"    +document.getElementById("t1IndNumr").value + "</xmlIndNumr>";
	xmlSostieni += "<xmlIndLoca>"    +document.getElementById("t1IndLoca").value + "</xmlIndLoca>";
	xmlSostieni += "<xmlIndCap>"     +document.getElementById("t1IndCap").value + "</xmlIndCap>";
	xmlSostieni += "<xmlProvincia>"  +document.all.t1Provincia.options[document.all.t1Provincia.selectedIndex].value + "</xmlProvincia>";
	xmlSostieni += "<xmlTelef>"      +document.getElementById("t1Telef").value + "</xmlTelef>";
	xmlSostieni += "<xmlEmail>"      +document.getElementById("t1Email").value + "</xmlEmail>";
	xmlSostieni += "<xmlPrivacy>"    +document.getElementById("t1Privacy").checked + "</xmlPrivacy>";
	xmlSostieni += "<xmlNote>"       +document.getElementById("t1Note").value + "</xmlNote>";
	//
	xmlSostieni += "<xmlChk>"
	for (i = 0;i < 3;i++)
	{
		if (document.all.t2Chk[i].checked)
			xmlSostieni += document.all.t2Chk[i].value;
	}
	xmlSostieni += "</xmlChk>"
	xmlSostieni += "<xmlTxt1>"   + document.getElementById("t2Txt1").value + "</xmlTxt1>";
	xmlSostieni += "<xmlTxt2>"   + document.getElementById("t2Txt2").value + "</xmlTxt2>";
	xmlSostieni += "<xmlCFis>"   + document.getElementById("t2CFis").value + "</xmlCFis>";
	xmlSostieni += "<xmlCPTC>"   + document.getElementById("txtCaptcha").value + "</xmlCPTC>";
	xmlSostieni += "<t7DonaImp>" + t7DonaImp + "</t7DonaImp>";
	xmlSostieni += "<t7RiceNum>" + t7RiceNum + "</t7RiceNum>";
	xmlSostieni += "<t7RiceSpe>" + t7RiceSpe + "</t7RiceSpe>";
	xmlSostieni += "<t7RiceImp>" + t7RiceImp + "</t7RiceImp>";
	xmlSostieni += "<t7BiglNum>" + t7BiglNum + "</t7BiglNum>";
	xmlSostieni += "<t7BiglSpe>" + t7BiglSpe + "</t7BiglSpe>";
	xmlSostieni += "<t7BiglImp>" + t7BiglImp + "</t7BiglImp>";
	xmlSostieni += "<t7MaglNum>" + t7MaglNum + "</t7MaglNum>";
	xmlSostieni += "<t7MaglSpe>" + t7MaglSpe + "</t7MaglSpe>";
	xmlSostieni += "<t7MaglImp>" + t7MaglImp + "</t7MaglImp>";
	xmlSostieni += "<t7SegnNum>" + t7SegnNum + "</t7SegnNum>";
	xmlSostieni += "<t7SegnSpe>" + t7SegnSpe + "</t7SegnSpe>";
	xmlSostieni += "<t7SegnImp>" + t7SegnImp + "</t7SegnImp>";
	xmlSostieni += "<t7TotSpe>"  + t7TotSpe + "</t7TotSpe>";
	xmlSostieni += "<t7TotImp>"  + t7TotImp + "</t7TotImp>";
	xmlSostieni += "<t7Totale>"  + t7Totale + "</t7Totale>";
	
	xmlSostieni += "</xmlSostieni>";
	
 	document.getElementById("t7DonaImp").value = FormatCurrency(t7DonaImp,2,false,false,true,true);
	document.getElementById("t7RiceNum").value = FormatCurrency(t7RiceNum,2,false,false,true,true);
	document.getElementById("t7RiceSpe").value = FormatCurrency(t7RiceSpe,2,false,false,true,true);
	document.getElementById("t7RiceImp").value = FormatCurrency(t7RiceImp,2,false,false,true,true);
	document.getElementById("t7BiglNum").value = FormatCurrency(t7BiglNum,2,false,false,true,true);
	document.getElementById("t7BiglSpe").value = FormatCurrency(t7BiglSpe,2,false,false,true,true);
	document.getElementById("t7BiglImp").value = FormatCurrency(t7BiglImp,2,false,false,true,true);
	document.getElementById("t7MaglNum").value = FormatCurrency(t7MaglNum,2,false,false,true,true);
	document.getElementById("t7MaglSpe").value = FormatCurrency(t7MaglSpe,2,false,false,true,true);
	document.getElementById("t7MaglImp").value = FormatCurrency(t7MaglImp,2,false,false,true,true);
	document.getElementById("t7SegnNum").value = FormatCurrency(t7SegnNum,2,false,false,true,true);
	document.getElementById("t7SegnSpe").value = FormatCurrency(t7SegnSpe,2,false,false,true,true);
	document.getElementById("t7SegnImp").value = FormatCurrency(t7SegnImp,2,false,false,true,true);
	document.getElementById("t7TotSpe").value =  FormatCurrency(t7TotSpe,2,false,false,true,true);
	document.getElementById("t7TotImp").value =  FormatCurrency(t7TotImp,2,false,false,true,true);
	document.getElementById("t7Totale").value =  FormatCurrency(t7Totale,2,false,false,true,true);
	document.getElementById("xmlSostieni").value = xmlSostieni;
}
function fCheckSostieni() {
	// verifica presenza campi obbligatori:
	//
	// Cognome/nome/indirizzo/[email]/chkPrivacy
	var tDbg = "";
	var w_t1Cogn      = document.getElementById("t1Cogn").value;
	var w_t1Nome      = document.getElementById("t1Nome").value;
	var w_t1rdoSex    = document.getElementById("t1rdoSex").value;
	var w_t1Pres      = document.getElementById("t1Pres").value;
	var w_t1IndPart   = document.all.t1IndPart.options[document.all.t1IndPart.selectedIndex].value;
	var w_t1IndNome   = document.getElementById("t1indNome").value;
	var w_t1IndNumr   = document.getElementById("t1IndNumr").value;
	var w_t1IndLoca   = document.getElementById("t1IndLoca").value;
	var w_t1IndCap    = document.getElementById("t1IndCap").value;
	var w_t1Provincia = document.all.t1Provincia.options[document.all.t1Provincia.selectedIndex].value;
	var w_t1Telef     = document.getElementById("t1Telef").value;
	var w_t1Email     = document.getElementById("t1Email").value;
	var w_t1Privacy   = document.getElementById("t1Privacy").checked;
	var w_t1Note      = document.getElementById("t1Note").value;
	if (w_t1Cogn    == "") tDbg += ",\nCognome";
	if (w_t1Nome    == "") tDbg += ",\nNome";
	if (w_t1IndPart == "") tDbg += ",\nIndirizzo(1)";
	if (w_t1IndNome == "") tDbg += ",\nIndirizzo(2)";
	if (w_t1IndNumr == "") tDbg += ",\nNumero";
	if (w_t1IndLoca == "") tDbg += ",\nLocalit" + String.fromCharCode(0x00e1);
	if (w_t1Privacy == "") tDbg += ",\nPrivacy";
	//
	if (tDbg != "")
	{
		tDbg = Mid(tDbg,1,Len(tDbg)-1);
		tDbg = "Bisogna compilare i dati seguenti:" + tDbg;
		alert(tDbg);
	}
	else
		calcolaImporti();
	bResp = (tDbg=="");
	return(bResp);
}
function setActiveTab(eSrc) {
	var eTxt;
	window.status = "setActiveTab\n"+eSrc.id+"\n"+eSrc.innerText;
	if (eOld != null)
	{
		eTxt = eval("txt" + eOld.id)
		eTxt.style.display = "none";
    eOld.className = "tab-button";
  }
  eOld = eSrc;
  eOld.className = "tab-selected";
  eTxt = eval("txt" + eOld.id)
  eTxt.style.display = "block";
	if (eSrc.id == "tab7")
	{
		calcolaImporti();
		//alert(showTabValues(0));
	}
}
function showTabValues(currDiv) {
	tMsg = "";
	//tCurrTab = currDiv.name;
	tMsg += "Div: "+currDiv;
		//
		tMsg += "\nCognome   : "+document.all.t1Cogn.value;
		tMsg += "\nNome      : "+document.all.t1Nome.value;
		tMsg += "\nSex       : "+document.all.t1rdoSex.value;
		tMsg += "\nPresso    : "+document.all.t1Pres.value;
		tMsg += "\nIndPart   : "+document.all.t1IndPart.options[document.all.t1IndPart.selectedIndex].value;
		tMsg += "\nindNome   : "+document.all.t1indNome.value;
		tMsg += "\nIndNumr   : "+document.all.t1IndNumr.value;
		tMsg += "\nIndLoca   : "+document.all.t1IndLoca.value;
		tMsg += "\nIndCap    : "+document.all.t1IndCap.value;
		tMsg += "\nProvincia : "+document.all.t1Provincia.options[document.all.t1Provincia.selectedIndex].value;
		tMsg += "\nTelef     : "+document.all.t1Telef.value;
		tMsg += "\nEmail     : "+document.all.t1Email.value;
		tMsg += "\nPrivacy   : "+document.all.t1Privacy.checked;
		tMsg += "\nNote      : "+document.all.t1Note.value;	
		//
		tMsg += "\nImpo      : "+document.all.t2Impo.value;	
		tMsg += "\nChk       : "
		for (i = 0; i < 3; i++)
		{
			if (document.all.t2Chk[i].checked)
				tMsg += document.all.t2Chk[i].value;
		}
		document.all.t2Chk.value;	
		tMsg += "\nTxt1      : "+document.all.t2Txt1.value;	
		tMsg += "\nTxt2      : "+document.all.t2Txt2.value;	
		tMsg += "\nCFis      : "+document.all.t2CFis.value;	
		//
		tMsg += "\nRicettario: "+document.all.t3CopieRicettario.value;	
		//
		tMsg += "\nCartNatale: "+document.all.t4CartNatale.value;	
		tMsg += "\nCartPasqua: "+document.all.t4CartPasqua.value;	
		tMsg += "\nCartVari  : "+document.all.t4CartVari.value;	
		//
		tMsg += "\nMaglia_S  : "+document.all.t5Maglia_S.value;	
		tMsg += "\nMaglia_M  : "+document.all.t5Maglia_M.value;	
		tMsg += "\nMaglia_L  : "+document.all.t5Maglia_X.value;	
		tMsg += "\nMaglia_XL : "+document.all.t5Maglia_L.value;	
		//alert(tMsg);
		return(tMsg);
}
