var op1s = "";var op2s = "";var dayactive=-1;function decimalround(num,dec){	Importe=Math.pow(10,dec) 	Valor=Math.round(num*Importe)/Importe    ndecimales = Math.pow(10,dec-1);  twodecnumber= Valor * (ndecimales);  twodecnumber=Math.floor(((twodecnumber-Math.floor(twodecnumber))*10));    if((twodecnumber==0) && (Valor!=num))  {    Valor=Valor+"0"  }return Valor}function fMdO(o, f) {	if (o.className == 'selDayCell') {		return false	};		if (o.wd == 'l') {		o.className = (o.className == 'overDayCell') ? 'dayCell':'overDayCell';	} else {		o.className = (o.className == 'overDayCell') ? 'weekendCell':'overDayCell';	}		if (arguments.length == 1) {		var pair = "p"+ o.id.substring(1);		fMbO(document.getElementById(pair), false);	}		return(true);}function fMbO(o, f) {	if (o.className == 'selBarCell') {		return false	};		o.className = (o.className == 'overBarCell') ? 'barCell':'overBarCell';	if (arguments.length == 1) {		var pair = "d"+ o.id.substring(1);		fMdO(document.getElementById(pair), false);	}		return(true);}function fMdC(o){	var pair = "p"+ o.id.substring(1);	fMbC(document.getElementById(pair));}function fMdC2(o,mode,pos,last){	var pair = "p"+ o.id.substring(1);	fMbC2(document.getElementById(pair),mode,pos,last);}function fMbC(o){	var pair = "d"+ o.id.substring(1);	var segment = o.id.substring(1,2);	var day = o.id.substring(2);	var date = day + '/' + o.getAttribute("my");	var pr = o.getAttribute("pz");	var mm = parseInt(o.getAttribute("my").substring(0,2), 10) - 1;	var yy = o.getAttribute("my").substring(3);	var prdiv2=0;	    var datef = o.id.substring(2) + o.getAttribute("my").substring(0,2) + o.getAttribute("my").substring(3);			if (segment == '1') {		if (op1s != "") {			var oo1 = document.getElementById('d'+op1s);			var ooo1 = document.getElementById('p'+op1s);				if (oo1.wd == 'l') {				oo1.className = 'dayCell';			} else {				oo1.className = 'weekendCell';			}			ooo1.className = 'barCell';		}		op1s = o.id.substring(1);		window.parent.document.getElementById("departureDatefld").innerHTML = date;		window.parent.document.getElementById("returnDatefld").innerHTML = "";		window.parent.document.bestPriceForm.departureDate.value = datef;		window.parent.document.getElementById("step2").style.display='inline';		window.parent.document.getElementById("updateButton").style.display='none';		window.parent.document.getElementById("reload").style.display='none';	} else {		if (op2s != "") {			var oo2 = document.getElementById('d'+op2s);			var ooo2 = document.getElementById('p'+op2s);				if (oo2.wd == 'l') {				oo2.className = 'dayCell';			} else {				oo2.className = 'weekendCell';			}			ooo2.className = 'barCell';		}			op2s = o.id.substring(1);		window.parent.document.getElementById("returnDatefld").innerHTML = date;		window.parent.document.bestPriceForm.returnDate.value = datef;		window.parent.document.getElementById("step3").style.display='inline';		window.parent.document.getElementById("updateButton").style.display='inline';		window.parent.document.getElementById("reload").style.display='inline';	}	o.className = 'selBarCell';	window.top.frames['cp1'].document.getElementById(pair).className = 'selDayCell';		window.parent.document.getElementById("estimatedPriceCell").style.display='inline';	if (pr != "") {		window.parent.document.getElementById("stPrice").innerHTML = pr + " &euro;*";		//window.parent.document.getElementById("noPrice").style.display='none';	} else {		window.parent.document.getElementById("stPrice").innerHTML = "Prezzo da aggiornare";		//window.parent.document.getElementById("noPrice").style.display='inline';	}	prdiv2=decimalround((pr/2),2); 	//alert(prdiv2.toString());//prdiv2=prdiv2.toFixed(2);	if (pr != "") {		window.parent.document.getElementById("stPricediv2").innerHTML = prdiv2 + " &euro;*";		//window.parent.document.getElementById("noPrice").style.display='none';	} else {		window.parent.document.getElementById("stPricediv2").innerHTML = "Prezzo da aggiornare";		//window.parent.document.getElementById("noPrice").style.display='inline';	}		window.parent.document.getElementById("cp2").style.display='inline';	if (segment == '1') {		var dys = parseInt(day, 10);	//	if (dys >= 21) {	//		if (mm == 11) yy = yy + 1;	//		mm = mm + 1;	//	} //	window.parent.document.cp2.location = "/edreams/italiano/amadeus3/offers/chartPrices2.jhtml?sm=" + mm + "&yr=" + yy + "&dd=" + date + "&depCity=" + window.parent.document.bestPriceForm.departureCity.value + "&arrCity=" + window.parent.document.bestPriceForm.arrivalCity.value;	window.parent.frames['cp2'].location.href = "/edreams/italiano/amadeus3/offers/chartPrices2.jhtml?sm=" + mm + "&yr=" + yy + "&dd=" + date + "&depCity=" + window.parent.document.bestPriceForm.departureCity.value + "&arrCity=" + window.parent.document.bestPriceForm.arrivalCity.value;	}	window.top.frames['cp1'].document.images[day-1].src='/images/italiano/design/transit/blackpix.gif';	if(dayactive!=-1)	{		document.images[dayactive-1].src='/images/italiano/amadeus3/orangebar.gif';	}	dayactive=day;		if(pr=="")	{		o.className = 'overbarCell';	}		return (true);}function fMbC2(o,mode,pos,last){	var pair = "d"+ o.id.substring(1);	var segment = o.id.substring(1,2);	var day = o.id.substring(2);	var date = day + '/' + o.getAttribute("my");	var pr = o.getAttribute("pz");	var mm = parseInt(o.getAttribute("my").substring(0,2), 10) - 1;	var yy = o.getAttribute("my").substring(3);	var prdiv2=0;	    var datef = o.id.substring(2) + o.getAttribute("my").substring(0,2) + o.getAttribute("my").substring(3);		if (segment == '1') {		if (op1s != "") {			var oo1 = document.getElementById('d'+op1s);			var ooo1 = document.getElementById('p'+op1s);				if (oo1.wd == 'l') {				oo1.className = 'dayCell';			} else {				oo1.className = 'weekendCell';			}			ooo1.className = 'barCell';		}			op1s = o.id.substring(1);		window.parent.document.getElementById("departureDatefld").innerHTML = date;		window.parent.document.bestPriceForm.departureDate.value = datef;		window.parent.document.getElementById("step2").style.display='inline';		window.parent.document.getElementById("updateButton").style.display='none';		window.parent.document.getElementById("reload").style.display='none';	} else {		if (op2s != "") {			var oo2 = document.getElementById('d'+op2s);			var ooo2 = document.getElementById('p'+op2s);				if (oo2.wd == 'l') {				oo2.className = 'dayCell';			} else {				oo2.className = 'weekendCell';			}			ooo2.className = 'barCell';		}			op2s = o.id.substring(1);		window.parent.document.getElementById("returnDatefld").innerHTML = date;		window.parent.document.bestPriceForm.returnDate.value = datef;		window.parent.document.getElementById("step3").style.display='inline';		window.parent.document.getElementById("updateButton").style.display='inline';		window.parent.document.getElementById("reload").style.display='inline';	}	o.className = 'selBarCell';	document.getElementById(pair).className = 'selDayCell';		window.parent.document.getElementById("estimatedPriceCell").style.display='inline';	if (pr != "") {		window.parent.document.getElementById("stPrice").innerHTML = pr + " &euro;*";		//window.parent.document.getElementById("noPrice").style.display='none';	} else {		window.parent.document.getElementById("stPrice").innerHTML = "Prezzo da aggiornare";		//window.parent.document.getElementById("noPrice").style.display='inline';	}prdiv2=decimalround((pr/2),2); //prdiv2=prdiv2.toFixed(2);	if (pr != "") {		window.parent.document.getElementById("stPricediv2").innerHTML = prdiv2 + " &euro;*";		//window.parent.document.getElementById("noPrice").style.display='none';	} else {		window.parent.document.getElementById("stPricediv2").innerHTML = "Prezzo da aggiornare";		//window.parent.document.getElementById("noPrice").style.display='inline';	}	window.parent.document.getElementById("cp2").style.display='inline';	if (segment == '1') {		var dys = parseInt(day, 10);	//	if (dys >= 21) {	//		if (mm == 11) yy = yy + 1;	//		mm = mm + 1;	//	}	//	window.parent.document.cp2.location = "/edreams/italiano/amadeus3/offers/chartPrices2.jhtml?sm=" + mm + "&yr=" + yy + "&dd=" + date + "&depCity=" + window.parent.document.bestPriceForm.departureCity.value + "&arrCity=" + window.parent.document.bestPriceForm.arrivalCity.value;		window.parent.frames['cp2'].location.href = "/edreams/italiano/amadeus3/offers/chartPrices2.jhtml?sm=" + mm + "&yr=" + yy + "&dd=" + date + "&depCity=" + window.parent.document.bestPriceForm.departureCity.value + "&arrCity=" + window.parent.document.bestPriceForm.arrivalCity.value;	}	if(pr=="")	{		o.className = 'overbarCell';	}		document.images[pos].src='/images/italiano/design/transit/blackpix.gif';	if(dayactive!=-1)	{		document.images[dayactive].src='/images/italiano/amadeus3/orangebar.gif';	}		dayactive=pos;	window.parent.document.bestPriceForm.lastPriceSeen.value=pr;	window.parent.document.bestPriceForm.lastPriceSeenDate.value=last;			return (true);}function fMmC1(o, m, y){	window.parent.document.getElementById("estimatedPriceCell").style.display='none';	window.parent.document.getElementById("cp2").style.display='none';	window.parent.document.getElementById("cp1").src = "/edreams/italiano/amadeus3/offers/chartPrices1.jhtml?sm=" + m + "&yr=" + y + "&depCity=" + window.parent.document.bestPriceForm.departureCity.value + "&arrCity=" + window.parent.document.bestPriceForm.arrivalCity.value;	window.parent.document.getElementById("step2").style.display='none';	window.parent.document.getElementById("step3").style.display='none';	window.parent.document.getElementById("updateButton").style.display='none';}function fMmC2(o, m, y, dd){	window.parent.document.getElementById("cp2").src = "/edreams/italiano/amadeus3/offers/chartPrices2.jhtml?sm=" + m + "&yr=" + y + "&depCity=" + window.parent.document.bestPriceForm.departureCity.value + "&arrCity=" + window.parent.document.bestPriceForm.arrivalCity.value + "&dd=" + dd;	window.parent.document.getElementById("step3").style.display='none';	window.parent.document.getElementById("updateButton").style.display='none';}
