function stripslashes (str) {
	return (str+'').replace(/\\(.?)/g, function (s, n1) {
		switch (n1) {
			case '\\':
				return '\\';
			case '0':
				return '\u0000';
			case '':
				return '';
			default:
				return n1;
		}
	});
}

function fbsShare(setLocal) {
	var u = window.location.href;
	var t = document.title;
	Shadowbox.open({player:'iframe', title:'Facebook', content:'http://www.facebook.com/sharer.php?locale='+ setLocal +'&u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t), width:'626', height:'436'});
	return false;
}

var choseLang  = {
	show: function(mydiv) {
		if (document.getElementById){
			document.getElementById(mydiv).style.height="auto";
			document.getElementById(mydiv).style.overflow="visible";
		}
	}, 
	hide: function (mydiv){
		if (document.getElementById){
			document.getElementById(mydiv).style.height="14px";
			document.getElementById(mydiv).style.overflow="hidden";
		}
	},
	init: function (mydiv){
		if (document.getElementById(mydiv)){
			document.getElementById(mydiv).style.height="14px";
			document.getElementById(mydiv).style.overflow="hidden";
		}
	}
}

var closePanel;
var bellows = {
	options:{
		myContBlock: "",
		panel_open_now: "",
		height_panel_open: 100,
		height_panel_close: 30,
		height_border_panel: 2,
		time_open_panel: 20,
		myInitBlock: "",
		myInitBlockNow: "",
		returnBlock:false
	},
	init: function(opts) {
		for (name in opts) bellows.options[name] = opts[name];
		if(bellows.options.myInitBlockNow == ""){
			bellows.options.panel_open_now = "panel_1";
		} else {
			bellows.options.panel_open_now = "panel_"+ bellows.options.myInitBlockNow;
		}
		if (document.getElementById(bellows.options.myInitBlock)){
			bellows.options.myContBlock = bellows.options.myInitBlock;
			var mio_blocco = document.getElementById(bellows.options.myInitBlock);
			var mio_nodo = mio_blocco.getElementsByTagName('li');
			for(i=0; i < mio_nodo.length; i++){
				mio_nodo[i].setAttribute("id", "panel_"+(i+1));
				var current_div = mio_nodo[i].id;
				var mio_div_content = document.getElementById(current_div);
				if (window.addEventListener || IE8()) {
					mio_nodo[i].setAttribute("onmouseover", "bellows.open_panel(this.id);");
					mio_nodo[i].setAttribute("onmousemove", "bellows.open_panel(this.id);");
					if(bellows.options.returnBlock == true){
						mio_nodo[i].setAttribute("onmouseout", "bellows.close_panel('panel_"+bellows.options.myInitBlockNow+"');");
					}
				} else {
					mio_nodo[i].setAttribute("onmouseover", function() {
						bellows.open_panel(this.id);
					});
					mio_nodo[i].setAttribute("onmousemove", function() {
						bellows.open_panel(this.id);
					});
					if(bellows.options.returnBlock == true){
						mio_nodo[i].setAttribute("onmouseout", function() {
							bellows.close_panel('panel_'+ bellows.options.myInitBlockNow);
						});
					}
				}
				mio_nodo[i].style.overflow = "hidden";
				if (bellows.options.myInitBlockNow == "" && i == 0){
					mio_nodo[i].style.height = bellows.options.height_panel_open +"px";
				} else if (bellows.options.myInitBlockNow != "" && i == (parseInt(bellows.options.myInitBlockNow)-1)){
					mio_nodo[i].style.height = bellows.options.height_panel_open +"px";
				} else {
					mio_nodo[i].style.height = bellows.options.height_panel_close +"px";
				}
			}
		}
		return true;
	},
	close_panel: function() {
		closePanel = setTimeout("bellows.open_panel('panel_'+bellows.options.myInitBlockNow)", 1000);
	},
	open_panel: function(id) {
		if(closePanel) clearTimeout(closePanel);
		var panel_open_now = "undefined";
		var height_panel_open = bellows.options.height_panel_open+bellows.options.height_border_panel;
		var mio_blocco = document.getElementById(bellows.options.myInitBlock);
		if (mio_blocco){
			var mio_nodo = mio_blocco.getElementsByTagName('li');
			for(var i=0; i < mio_nodo.length; i++){
				var mio_div_content = mio_nodo[i];
				if (mio_div_content.offsetHeight != (bellows.options.height_panel_close+bellows.options.height_border_panel) && (mio_div_content.offsetHeight*1 == height_panel_open*1)){
					panel_open_now = mio_nodo[i].id;
					height_panel_open = mio_div_content.offsetHeight;
				} else if (mio_div_content.offsetHeight != (bellows.options.height_panel_close+bellows.options.height_border_panel) && mio_div_content.offsetHeight != height_panel_open){
					return false;
				}
			}
		}
		if (panel_open_now != id && panel_open_now != "undefined"){
			bellows.open_dinamic_panel(panel_open_now, id, (bellows.options.height_panel_open+bellows.options.height_panel_close), bellows.options.height_panel_close);
		}
		return true;
	},
	open_dinamic_panel: function(panel_open_now, id, height, height_now){
		p1 = panel_open_now + "";
		p2 = id + "";
		new_height = Math.round((height-height_now)/8)*1+1;
		my_height = height;
		var mio_blocco_figlio = document.getElementById(id);
		var mio_blocco_figlio_2 = document.getElementById(panel_open_now);
		my_height_result = new_height + height_now;
		if ((height-height_now) > bellows.options.height_panel_close){
			mio_blocco_figlio.style.height = (my_height_result) +"px";
			mio_blocco_figlio_2.style.height = (height - my_height_result) +"px";
			setTimeout("bellows.open_dinamic_panel(p1, p2, my_height, my_height_result)", bellows.options.time_open_panel);
		} else {
			mio_blocco_figlio.style.height=bellows.options.height_panel_open+"px";
			mio_blocco_figlio_2.style.height=bellows.options.height_panel_close+"px";
			return false;
		}
		return true;
	}
}


function IE6(){
	var ievs = (/MSIE (\d+\.\d+);/.test(navigator.userAgent));
	if (ievs){
		var iev = new Number(RegExp.$1);
		if (iev < 7) return true;
	}
	return false;
}

function IE8(){
	var ievs = (/MSIE (\d+\.\d+);/.test(navigator.userAgent));
	if (ievs){
		var iev = new Number(RegExp.$1);
		if (iev >= 8) return true;
	}
	return false;
}

function weatherBox(imgSrc, myId){
	var myWeatherBox = document.getElementById(myId);
	if(myWeatherBox){
		myWeatherBox.style.background = "url(/images/meteo/"+ imgSrc +".png) no-repeat right 3px";
	}
	return false;
}

var resetBox = {
	options:{
		myBlock: "boxBooking",
		myHeight: 78,
		myLiHeight: 32,
		myPadding: 20,
		myAction: ""
	},
	init: function(opts) {
		for (name in opts) resetBox.options[name] = opts[name];
	},
	set: function(myValue){
		if(document.getElementById(resetBox.options.myBlock)){
			myPassValue = parseInt(myValue);
			if(myPassValue > 1){
				resetBox.openBox(myPassValue, document.getElementById(resetBox.options.myBlock).offsetHeight-resetBox.options.myPadding, (resetBox.options.myHeight-resetBox.options.myPadding + (resetBox.options.myLiHeight*(myValue*1-1))));
			} else {
				resetBox.openBox(myPassValue, document.getElementById(resetBox.options.myBlock).offsetHeight-resetBox.options.myPadding, resetBox.options.myHeight-resetBox.options.myPadding);
			}
		} else {
			alert("attenzione: "+ resetBox.options.myBlock +"non esiste.");
		}
		return false;
	},
	openBox: function(myVal, height_nowB, heightB){
		myValuePass = parseInt(myVal);
		if(heightB > height_nowB){
			new_heightB = Math.round((heightB-height_nowB)/6)*1+1;
			if(resetBox.options.myAction == ""){
				setRoom(myValuePass, name_adults, name_children, name_childage, name_room);
				resetBox.options.myAction = "opening";
			}
		} else {
			new_heightB = Math.round((heightB-height_nowB)/6)*1-1;
			resetBox.options.myAction = "closing";
		}
		my_heightB = heightB;
		my_height_resultB = height_nowB + new_heightB;
		if ((heightB-height_nowB) > 3 || (heightB-height_nowB) < -3){
			setTimeout("resetBox.openBox(myValuePass, my_height_resultB, my_heightB)", 20);
			document.getElementById(resetBox.options.myBlock).style.height = my_height_resultB +"px";
		} else {
			document.getElementById(resetBox.options.myBlock).style.height = heightB+"px";
			if(resetBox.options.myAction == "closing"){
				setRoom(myValuePass, name_adults, name_children, name_childage, name_room);
			}
			resetBox.options.myAction = "";
			return false;
		}
		return true;
	}
}

function set_room(select_id, value, where){
	var my_options = "";
	var my_block = document.getElementById(select_id);
	if (value=="5" || value=="6" || value=="7" || value=="8"){
		my_options = my_options + '<label>'+ name_apartment +'</label>'+"\n";
		if(where == "home"){
			my_options = my_options + '<select name="bform[numRooms]" onchange="resetBox.set(this.value);">'+"\n";
		} else {
			my_options = my_options + '<select name="bform[numRooms]" onchange="setRoom(this.value, name_adults , name_children, name_childage, name_apartment, name_apartments);">'+"\n";
		}
		my_options = my_options + '<option value="1">1 '+name_apartment+'</option>'+"\n";
		my_options = my_options + '<option value="2">2 '+name_apartments+'</option>'+"\n";
		my_options = my_options + '<option value="3">3 '+name_apartments+'</option>'+"\n";
		my_options = my_options + '<option value="4">4 '+name_apartments+'</option>'+"\n";
		my_options = my_options + '</select>'+"\n";
		my_block.innerHTML = my_options;
		if(where == "home"){
			resetBox.set(1);
			setTimeout("setRoomHome(1, name_adults , name_children, name_childage, name_apartment, name_apartments)", 1000);
		} else {
			setRoom(1, name_adults , name_children, name_childage, name_apartment, name_apartments);
		}
	} else {
		my_options = my_options + '<label>'+ name_room +'</label>'+"\n";
		if(where == "home"){
			my_options = my_options + '<select name="bform[numRooms]" onchange="resetBox.set(this.value);">'+"\n";
		} else {
			my_options = my_options + '<select name="bform[numRooms]" onchange="setRoom(this.value, name_adults, name_children, name_childage, name_room, name_rooms);">'+"\n";
		}
		my_options = my_options + '<option value="1">1 '+name_room+'</option>'+"\n";
		my_options = my_options + '<option value="2">2 '+name_rooms+'</option>'+"\n";
		my_options = my_options + '<option value="3">3 '+name_rooms+'</option>'+"\n";
		my_options = my_options + '<option value="4">4 '+name_rooms+'</option>'+"\n";
		my_options = my_options + '</select>'+"\n";
		my_block.innerHTML = my_options;
		if(where == "home"){
			resetBox.set(1);
			setTimeout("setRoomHome(1, name_adults , name_children, name_childage, name_room, name_rooms)", 1000);
		} else {
			setRoom(1, name_adults , name_children, name_childage, name_room, name_rooms);
		}
	}
}

function setChildAge(nchild, chdid, roomn, label_children_age, suffix){
	if(suffix == undefined) suffix = "";
	var selectHtml = "";
	if(nchild > 0){
		selectHtml = '<label>'+ label_children_age +'</label>';
		for (var cc=1; cc<=nchild; cc++) {
			selectHtml =  selectHtml + '<select name="bform[reqRooms]['+roomn+'][childAge][' + cc + ']">' + '<option value="0">&lsaquo; 1</option>';
			for(var k=1; k<=18; k++){
				k_opt = k<10 ? "&nbsp;"+ k : k;
				selectHtml =  selectHtml + "\n" + '<option value="'+ k +'">'+ k_opt +'</option>';
			}
			selectHtml =  selectHtml + '</select>';
		}
	}
	if(document.getElementById(suffix+chdid)){
		document.getElementById(suffix+chdid).innerHTML = selectHtml;
	}
}

function createSelect(num, init, label, selected){
	if(label != ""){ label = " "+ label; }
	var mySel = "";
	for(var k=init; k<=num; k++){
		if (selected != 0 && selected == k){ mySel = mySel + "\n" + '<option value="'+ k +'" selected="selected">'+ k + label +'</option>';
		} else { mySel = mySel + "\n" + '<option value="'+ k +'">'+ k + label +'</option>'; }
	}
	return mySel;
}

function setRoom(nrooms, label_adults, label_children, label_children_age, label_room, myBlockNow){
	suffix = "off_";
	if(myBlockNow == undefined){
		myBlockNow = 'contOption';
		suffix = "";}
	var myResults = "";
	myResults = myResults + '<ul>\n';
	for (var i=1; i<=nrooms; i++){
		if(nrooms>1){	myResults = myResults + '	<li><strong>'+ label_room +' '+i+'</strong></li>\n';}
		myResults = myResults + '		<li>\n'+
		'			<label>'+ label_adults +'</label>\n'+
		'			<select name="bform[reqRooms]['+ i +'][adults]" class="select_small">\n'+
		'			'+ createSelect(6, 1, '', 2) + 
		'			</select>\n'+
		'		</li>\n'+
		'		<li>\n'+
		'			<label>'+ label_children +'</label>\n'+
		'			<select name="bform[reqRooms]['+ i +'][child]" class="select_small" onchange="setChildAge(this.value,\''+ suffix +'chdAge_'+ i +'\', '+ i +',\''+ label_children_age +'\');">\n'+
		'			'+ createSelect(4, 0, '', 0) + 
		'			</select>\n'+
		'		</li>\n'+
		'		<li class="childAge" id="'+ suffix +'chdAge_'+ i +'"></li>\n'+
		'	</li>\n';
	}
	myResults = myResults + '</ul>\n';
	if (document.getElementById(myBlockNow)){
		document.getElementById(myBlockNow).innerHTML = myResults;
	} else {
		alert("blocco non valido");
	}
}
var hideBlock;
var eventList = {
	options:{
		timer: 4000,
		fadeOut: 15,
		fadeIn: 15,
		myList: "",
		paddingTop: "0"
	},
	init: function(opts){
		for (name in opts) eventList.options[name] = opts[name];
		var myEventsBlock = document.getElementById(eventList.options.myList);
		if (myEventsBlock){
			myEventsBlock.style.position = "relative";
			var myEventsList = myEventsBlock.getElementsByTagName("li");
			var myEventsListTot = myEventsBlock.getElementsByTagName("li");
			var countEvents = 0;
			var countEventsTot = 0;
			for (var iLTot = 0; iLTot < myEventsListTot.length; iLTot++){
				if (myEventsListTot[iLTot].className == "singleOffers") countEventsTot++;
			}
			//alert(countEventsTot);
			for (var iL = 0; iL < myEventsList.length; iL++){
				if (myEventsList[iL].className == "singleOffers"){
					countEvents++;
					myEventsList[iL].style.position = "absolute";
					if(IE6()){
						myEventsList[iL].style.display = "inline";
					}
					myEventsList[iL].style.top = eventList.options.paddingTop;
					myEventsList[iL].style.left = "0px";
					myEventsList[iL].setAttribute("id","event_"+ countEvents);
					if(countEventsTot > 1){
						if (window.addEventListener || IE8()) {
							myEventsList[iL].setAttribute("onmouseover", "eventList.stopHide();");
							myEventsList[iL].setAttribute("onmouseout", "eventList.startHide('event_"+ countEvents +"');");
						} else {
							myEventsList[iL].style.backgroundColor = "";
							myEventsList[iL].setAttribute("onmouseover",function() {
								eventList.stopHide();
							});
							myEventsList[iL].setAttribute("onmouseout",function() {
								eventList.startHide(this.id);
							});
						}
						
						if(countEvents > 1){
							myEventsList[iL].style.display = "none";
						}
					}
				}
			}
			if(document.getElementById("event_2") && countEventsTot > 1) hideBlock = setTimeout("eventList.moveToBottom('event_1', 0, 100)", eventList.options.timer);
		} else {
			alert(eventList.options.myList +" non esiste");
		}
	},
	moveToBottom: function(myBlock, opacity){
		myBlockHideNow = myBlock;
		var myBlockHide = document.getElementById(myBlockHideNow);
		if (myBlockHide){
			myBlockHide.style.opacity = opacity/100;
			myBlockHide.style.filter = "alpha(opacity=" + opacity + ")";
		}
		newOpacity = opacity -10;
		if (opacity > 0){
			setTimeout("eventList.moveToBottom(myBlockHideNow, newOpacity)", eventList.options.fadeOut);
		} else {
			myBlockHide.style.display = "none";
			var myIdParts = myBlock.split("_");
			var mySingleEventNext = document.getElementById("event_"+ ((myIdParts[1]*1)+1));
			if(mySingleEventNext){
				eventList.moveToInit('event_'+ ((myIdParts[1]*1)+1), 0);
			} else {
				eventList.moveToInit('event_1', 0);
			}
		}
	},
	moveToInit: function(myBlock, opacity){
		myBlockShowNow = myBlock;
		var myBlockShow = document.getElementById(myBlockShowNow);
		if (myBlockShow){
			myBlockShow.style.display = "block";
			myBlockShow.style.left = "0px";
			myBlockShow.style.opacity = opacity/100;
			myBlockShow.style.filter = "alpha(opacity=" + opacity + ")";
		}
		newOpacity = opacity +10;
		if (opacity < 100){
			setTimeout("eventList.moveToInit(myBlockShowNow, newOpacity)", eventList.options.fadeIn);
		} else {
			var myIdParts = myBlock.split("_");
			var mySingleEventNext = document.getElementById("event_"+ ((myIdParts[1]*1)));
			if(mySingleEventNext){
				hideBlock = setTimeout("eventList.moveToBottom('event_"+ ((myIdParts[1]*1)) +"', 100)", eventList.options.timer);
			} else {
				hideBlock = setTimeout("eventList.moveToBottom('event_1', 100)", eventList.options.timer);
			}
		}
	},
	stopHide: function(){
		if(hideBlock){
			clearTimeout(hideBlock);
			hideBlock = null;
		}
	},
	startHide: function(myBlockId){
		myBlockIdNow = myBlockId;
		if(hideBlock){
			clearTimeout(hideBlock);
		}
		hideBlock = setTimeout("eventList.moveToBottom(myBlockIdNow, 100)", eventList.options.timer);
	}
}

var boxSlide = {
	options: {
		mySlidePosition: 1,
		mySlidePositionLeft: 0,
		myWidthW: 100,
		opacityW: "",
		prevSlide:"",
		nextSlide:"",
		blockSlide:"",
		showBlock: 1
	},
	init: function(optsS){
		for (nameS in optsS) boxSlide.options[nameS] = optsS[nameS];
		var mySlideBlock = document.getElementById(boxSlide.options.blockSlide);
		if (mySlideBlock){
			mySlideBlock.style.position = "absolute";
			var mySlideList = mySlideBlock.getElementsByTagName("li");
			var countSlide = 1;
			for (var iL = 0; iL < mySlideList.length; iL++){
				mySlideList[iL].setAttribute("id","Slide_"+ countSlide);
				mySlideList[iL].style.position = "absolute";
				mySlideList[iL].style.top = "0";
				mySlideList[iL].style.left = (((countSlide*1)-(boxSlide.options.mySlidePosition*1))*boxSlide.options.myWidthW)+boxSlide.options.mySlidePositionLeft +"px";
				countSlide++;
			}
			mySlideBlock.style.width = (countSlide-1)*boxSlide.options.myWidthW +"px";
			mySlideBlock.style.bottom = "0";
			mySlideBlock.style.left = "0";
			var myButtonLeft = document.getElementById(boxSlide.options.prevSlide);
			var myButtonRight = document.getElementById(boxSlide.options.nextSlide);
			if(mySlideList.length > boxSlide.options.showBlock){
				if (window.addEventListener || IE8()) {
					if(boxSlide.options.mySlidePosition > 1){
						myButtonLeft.setAttribute("onclick", "boxSlide.move('left');");
					} else {
						if(boxSlide.options.opacityW < 100 && boxSlide.options.opacityW != "") myButtonLeft.style.opacity = boxSlide.options.opacityW/100;
					}
					if(countSlide > 1){
						myButtonRight.setAttribute("onclick", "boxSlide.move('right');");
					} else {
						if(boxSlide.options.opacityW < 100 && boxSlide.options.opacityW != "") myButtonRight.style.opacity = boxSlide.options.opacityW/100;
					}
				} else {
					if(boxSlide.options.mySlidePosition > 1){
						myButtonLeft.setAttribute("onclick",function() {
							boxSlide.move('left');
						});
					} else {
						if(boxSlide.options.opacityW < 100 && boxSlide.options.opacityW != "") myButtonLeft.style.opacity = boxSlide.options.opacityW/100;
					}
					if(countSlide > 1){
						myButtonRight.setAttribute("onclick",function() {
							boxSlide.move('right');
						});
					} else {
						if(boxSlide.options.opacityW < 100 && boxSlide.options.opacityW != "") myButtonRight.style.opacity = boxSlide.options.opacityW/100;
					}
				}
			}
		} else {
			alert(boxSlide.options.blockSlide +" non esiste.");
		}
	},
	move: function(side){
		var mySlideBlock = document.getElementById(boxSlide.options.blockSlide);
		if (mySlideBlock){
			var myButtonLeft = document.getElementById(boxSlide.options.prevSlide);
			var myButtonRight = document.getElementById(boxSlide.options.nextSlide);
			if(boxSlide.options.opacityW < 100 && boxSlide.options.opacityW != "") myButtonLeft.style.opacity = boxSlide.options.opacityW/100;
			if(boxSlide.options.opacityW < 100 && boxSlide.options.opacityW != "") myButtonRight.style.opacity = boxSlide.options.opacityW/100;
			if (window.addEventListener || IE8()) {
				myButtonLeft.setAttribute("onclick", "");
				myButtonRight.setAttribute("onclick", "");
			} else {
				myButtonLeft.setAttribute("onclick",function() {
				});
				myButtonRight.setAttribute("onclick",function() {
				});
			}
			if(side=="left"){
				boxSlide.scrollto(-((boxSlide.options.mySlidePosition-1)*boxSlide.options.myWidthW), -((boxSlide.options.mySlidePosition-2)*boxSlide.options.myWidthW));
			} else if(side=="right"){
				boxSlide.scrollto(-((boxSlide.options.mySlidePosition-1)*boxSlide.options.myWidthW), -(boxSlide.options.mySlidePosition*boxSlide.options.myWidthW));
			}
		}
	},
	scrollto: function(posNowW, posEndW){
		newPosEndW = posEndW;
		newPosNowW = 0;
		if (posEndW > posNowW){
			newPosNowW = posNowW + (Math.round((newPosEndW - posNowW)/4)*1)+1;
			if ((posEndW - newPosNowW) > 3){
				document.getElementById(boxSlide.options.blockSlide).style.left = newPosNowW +"px";
				setTimeout("boxSlide.scrollto(newPosNowW, newPosEndW)", 10);
			} else {
				document.getElementById(boxSlide.options.blockSlide).style.left = posEndW +"px";
				boxSlide.options.mySlidePosition = boxSlide.options.mySlidePosition - 1;
				boxSlide.activeButton();
				return false;
			}
		} else {
			newPosNowW = posNowW + Math.round((newPosEndW - posNowW)/4) -1;
			if ((posEndW - newPosNowW) < -3){
				document.getElementById(boxSlide.options.blockSlide).style.left = newPosNowW +"px";
				setTimeout("boxSlide.scrollto(newPosNowW, newPosEndW)", 10);
			} else {
				document.getElementById(boxSlide.options.blockSlide).style.left = posEndW +"px";
				boxSlide.options.mySlidePosition = boxSlide.options.mySlidePosition + 1;
				boxSlide.activeButton();
				return false;
			}
		}
	},
	activeButton: function(){
		var mySlideBlock = document.getElementById(boxSlide.options.blockSlide);
		if (mySlideBlock){
			var mySlideList = mySlideBlock.getElementsByTagName("li");
			var countSlide =  mySlideList.length;
			var myButtonLeft = document.getElementById(boxSlide.options.prevSlide);
			var myButtonRight = document.getElementById(boxSlide.options.nextSlide);
			if (window.addEventListener || IE8()) {
				if(boxSlide.options.mySlidePosition > 1){
					myButtonLeft.setAttribute("onclick", "boxSlide.move('left');");
					if(boxSlide.options.opacityW < 100 && boxSlide.options.opacityW != "") myButtonLeft.style.opacity = 1;
				} else {
					if(boxSlide.options.opacityW < 100 && boxSlide.options.opacityW != "") myButtonLeft.style.opacity = boxSlide.options.opacityW/100;
				}
				if(countSlide > 1 && boxSlide.options.mySlidePosition < (countSlide+1-boxSlide.options.showBlock)){
					myButtonRight.setAttribute("onclick", "boxSlide.move('right');");
					if(boxSlide.options.opacityW < 100 && boxSlide.options.opacityW != "") myButtonRight.style.opacity = 1;
				} else {
					if(boxSlide.options.opacityW < 100 && boxSlide.options.opacityW != "") myButtonRight.style.opacity = boxSlide.options.opacityW/100;
				}
			} else {
				if(boxSlide.options.mySlidePosition > 1){
					myButtonLeft.setAttribute("onclick",function() {
						boxSlide.move('left');
					});
					if(boxSlide.options.opacityW < 100 && boxSlide.options.opacityW != "") myButtonLeft.style.opacity = 1;
				} else {
					if(boxSlide.options.opacityW < 100 && boxSlide.options.opacityW != "") myButtonLeft.style.opacity = boxSlide.options.opacityW/100;
				}
				if(countSlide > 1 && boxSlide.options.mySlidePosition < (countSlide+1-boxSlide.options.showBlock)){
					myButtonRight.setAttribute("onclick",function() {
						boxSlide.move('right');
					});
					if(boxSlide.options.opacityW < 100 && boxSlide.options.opacityW != "") myButtonRight.style.opacity = 1;
				} else {
					if(boxSlide.options.opacityW < 100 && boxSlide.options.opacityW != "") myButtonRight.style.opacity = boxSlide.options.opacityW/100;
				}
			}
		}
	}
}
var setDirection = {
	options:{
		mapContainer: document.getElementById('mapBig'),
		dirContainer: document.getElementById('dirContainer'),
		dirService: "",
		dirRenderer: "",
		map: null
	},
	init: function (myText, from, to, direction, latLan){
		if(document.getElementById('ballon')){
			setDirection.options.dirService = new google.maps.DirectionsService();
			setDirection.options.dirRenderer = new google.maps.DirectionsRenderer();
			var myFormDirection, textDirection;
			if(direction == "FROM"){
				myFormDirection = '<form name="direction" action="javascript:;" method="get"><input id="from-input" type="hidden" value="'+ latLan +'" />';
				myFormDirection += '<input id="to-input" type="text" value="" class="inputE" />';
				myFormDirection += '<input class="inputB" onclick="setDirection.getDirections(document.getElementById(\'from-input\').value, document.getElementById(\'to-input\').value);" type="button" value=">" /></form>';
				textDirection = myText +'<br /><strong>'+ from +'</strong> - <a href="javascript:;" onclick="setDirection.init(\''+ myText +'\', \''+ from +'\', \''+ to +'\', \'TO\', \''+ latLan +'\');"><strong>'+ to +'</strong></a>'+ myFormDirection;
			} else {
				myFormDirection = '<form name="direction" action="javascript:;" method="get"><input id="from-input" type="text" value="" class="inputE" />';
				myFormDirection += '<input id="to-input" type="hidden" value="'+ latLan +'" />';
				myFormDirection += '<input class="inputB" onclick="setDirection.getDirections(document.getElementById(\'from-input\').value, document.getElementById(\'to-input\').value);" type="button" value=">" /></form>';
				textDirection = myText +'<br /><a href="javascript:;" onclick="setDirection.init(\''+ myText +'\', \''+ from +'\', \''+ to +'\', \'FROM\', \''+ latLan +'\');"><strong>'+ from +'</strong></a> - <strong>'+ to +'</strong>'+ myFormDirection;
			}
			document.getElementById('ballon').innerHTML = textDirection;
		}
	},
	getDirections: function(fromStr, toStr){
		var dirRequest = {
			origin: fromStr,
			destination: toStr,
			travelMode: google.maps.DirectionsTravelMode.DRIVING,
			unitSystem: google.maps.DirectionsUnitSystem.METRIC,
			provideRouteAlternatives: true
		};
		setDirection.options.dirService.route(dirRequest, setDirection.showDirections);
	},
	showDirections: function(dirResult, dirStatus) {
		if (dirStatus != google.maps.DirectionsStatus.OK) {
		  if(typeof(dirStatusError) != 'undefined') alert(dirStatusError +"\n(Google reports: "+ dirStatus +")");
		  return;
		}
		//if(infowindow) infowindow.close();
		$('html,body').animate({scrollTop: $('#mapBig').offset().top - 20}, 1000);
		setDirection.options.dirRenderer.setMap(null);
		setDirection.options.dirRenderer.setMap(maps);
		$('#dirContainer').html('');
		setDirection.options.dirRenderer.setPanel(document.getElementById('dirContainer'));
		setDirection.options.dirRenderer.setDirections(dirResult);
	}

}
var infowindow, marker, maps;
function setPoint(mapId, optiones, zoom, mapType, showCursor) {
	var myMarker = new Array();
	myMarker['iconsize'] = "30,30";
	myMarker['iconhancor'] = "0,15";
	myMarker['infowindow'] = "";
	
	for (names in optiones) myMarker[names] = optiones[names];
	var latlng = new google.maps.LatLng(myMarker['lat'], myMarker['lon']);
	if(mapType == undefined) mapType = "ROADMAP"; //ROADMAP - SATELLITE - HYBRID - TERRAIN 
	if(showCursor == undefined) showCursor = false;
    var myOptions = {
		disableDefaultUI: showCursor,
		zoom: zoom,
		center: latlng,
		mapTypeId: google.maps.MapTypeId[mapType]
    };
    maps = new google.maps.Map(document.getElementById(mapId), myOptions);
	
	var myLatLng = new google.maps.LatLng(myMarker['lat'], myMarker['lon']);

	marker = new google.maps.Marker({
		position: myLatLng,
		map: maps,
		icon: myMarker['icon'],
        zIndex: 10000
	});

	if(myMarker['infowindow'] != ""){
		infowindow = new google.maps.InfoWindow({
			content: myMarker['infowindow'],
			maxWidth: 350,
			position: myLatLng,
			zIndex: 100
		});
		infowindow.open(maps, infowindow);
		google.maps.event.addListener(marker, "click", function() {
			infowindow.open(maps, infowindow);
		});
	}
}

function pushing(block, src){
	document.getElementById(block).innerHTML = '<img src="'+ src +'" alt="" border="0" style="display:block; margin:0 auto;" />';
}

function getFlashMovie(movieName){
  var isIE = navigator.appName.indexOf("Microsoft") != -1;
  return (isIE) ? window[movieName] : document[movieName];
}


function callToActionscript(str,id){
     getFlashMovie("myHeader").sendToActionscript(str,id);
}


function resetType(id, status){
	if(status == undefined) status = "";
	if (document.getElementById(id)){
		var obj = document.getElementById(id);
		if (id == "callName"){
			if(obj.value == varName && status == "") {
				obj.value="";
			} else if(obj.value=="" && status == "x") {
				obj.value=varName;
			}
		} else if (id == "callPhone") {
			if(obj.value == varPhone && status == "") {
				obj.value="";
			} else if(obj.value=="" && status == "x") {
				obj.value=varPhone;
			}
		}
	}
}

function checkCallback(){
	var testo_err = varCallError+'\n\n';
	var mancato_ins = false;	
	if (document.forms['callBack']['name'].value == varName || document.forms['callBack']['name'].value == "") {
		testo_err = testo_err + '- '+ varName +'\n';
		document.forms['callBack']['name'].focus();
		mancato_ins = true;
	} else {
		if(!checkValue(document.forms['callBack']['name'].value, "text")){
			testo_err = testo_err + '- '+ varName +'\n';
			document.forms['callBack']['name'].value = "";
			document.forms['callBack']['name'].focus();
			mancato_ins = true;
		}
	}
	if (document.forms['callBack']['phone'].value == varPhone || document.forms['callBack']['phone'].value == "") {
		testo_err = testo_err + '- '+ varPhone +'\n';
		document.forms['callBack']['phone'].focus();
		mancato_ins = true; 
	} else {
		if(!checkValue(document.forms['callBack']['phone'].value, "number")){
			testo_err = testo_err + '- '+ varPhone +'\n';
			document.forms['callBack']['phone'].value = "";
			document.forms['callBack']['phone'].focus();
			mancato_ins = true;
		}
	}
	if (mancato_ins == true) {
		alert (''+testo_err+'');
		return false;
	} else {
		return true;
	}
}

function checkValue(string, type){
	if(type == undefined || type == "number"){
		var validi = "0123456789";
		var myNumberNew = string;
		myNumberNew = myNumberNew.replace(/\ /g, "");
		myNumberNew = myNumberNew.replace(/\+/g, "");
		myNumberNew = myNumberNew.replace(/\./g, "");
		myNumberNew = myNumberNew.replace(/\-/g, "");
		if(myNumberNew == ''){
			return false;
		}
		for(var i = 0; i < myNumberNew.length; i++ ){
			if( validi.indexOf( myNumberNew.charAt(i) ) == -1 ){
				return false;
			}
		}
	} else if(type == "mail") {
		if (string.length > 9){
			var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
			if (!filter.test(string)) {
				return false;
			}
		} else {
			return false;
		}
	} else if(type == "text") {
		var filter = /^([a-zA-Z\ \'])/;
		if (!filter.test(string)) {
			return false;
		}
	}
	return true;
}

// FUNZIONI PER LA MAPPA V3
var i, infoBox;
i = 1;
var myZindex = 0;

function setMarkers(mapId, optiones, zoom, mapType, showCursor, multiple, showBox, openBox) {
	if (multiple == undefined) multiple = false;
	var multipleCategory = "";
	if(multiple != false && multiple !== true){
		multipleCategory = multiple;
		multiple = true;
	}
	if (showBox == undefined) showBox = false;
	if (openBox == undefined) openBox = false;
	if (showBox || openBox != false) infoBox = new BFInfoWindow();
	var myMarker = new Array();
	myMarker['iconsize'] = "30,30";
	myMarker['iconhancor'] = "0,15";
	for (names in optiones) myMarker[names] = optiones[names];
	var latlng = new google.maps.LatLng(myMarker['lat'], myMarker['lon']);
	if(mapType == undefined) mapType = "ROADMAP"; //ROADMAP - SATELLITE - HYBRID - TERRAIN 
	if(showCursor == undefined) showCursor = false;
    var myOptions = {
		disableDefaultUI: showCursor,
		zoom: zoom,
		center: latlng,
		mapTypeId: google.maps.MapTypeId[mapType]
    };
    var maps = new google.maps.Map(document.getElementById(mapId), myOptions);
	
	var myLatLng = new google.maps.LatLng(myMarker['lat'], myMarker['lon']);
	if (multiple){
		if(multipleCategory != "") multipleCategory = "?catId="+ multipleCategory;
		downloadUrl("/assets/interestPoint.php"+ multipleCategory, function(data, responseCode) {

  			var markers_def = data.documentElement.getElementsByTagName("marker");
			for (var i_def=0; i_def<markers_def.length; i_def++) {
				if(openBox != false && openBox == markers_def[i_def].getAttribute("id")){
					var marker = new google.maps.Marker({
						position: new google.maps.LatLng(parseFloat(markers_def[i_def].getAttribute("lat")), parseFloat(markers_def[i_def].getAttribute("lng"))),
						map: maps,
						title: markers_def[i_def].getAttribute("name"),
						icon: markers_def[i_def].getAttribute("idImg"),
						zIndex: myZindex + 1
					});
					openInfoBox(marker, base_64.decode(markers_def[i_def].getAttribute("ballon")), maps);
				} else if(openBox == false){
					var marker = new google.maps.Marker({
						position: new google.maps.LatLng(parseFloat(markers_def[i_def].getAttribute("lat")), parseFloat(markers_def[i_def].getAttribute("lng"))),
						map: maps,
						title: markers_def[i_def].getAttribute("name"),
						icon: markers_def[i_def].getAttribute("idImg"),
						zIndex: myZindex + 1
					});
					
					google.maps.event.addListener(marker, "mouseover", function() {
						this.setZIndex(myZindex + 1);
						myZindex = myZindex + 1;
					});
	
					if(markers_def[i_def].getAttribute("url") != "") {
						if(showBox) attachInfoBox(marker, base_64.decode(markers_def[i_def].getAttribute("ballon")), maps, markers_def[i_def].getAttribute("url"));
						attachURL(marker, markers_def[i_def].getAttribute("url"));
					} else {
						if(showBox) attachInfoBox(marker, base_64.decode(markers_def[i_def].getAttribute("ballon")), maps);
					}
					myZindex++;
				}
			}
		});
	} else {
		var marker = new google.maps.Marker({
			position: myLatLng,
			map: maps,
			icon: myMarker['icon']
		});
	}
	var marker = new google.maps.Marker({
		position: new google.maps.LatLng(45.51748533496342, 12.683565616607666),
		map: maps,
		title: "Hotel Orient & Pacific ****",
		icon:'/images/icon_hotel.png',
		zIndex: 10000000000
	});
	
}
var infowindow;
function attachURL(marker, url) {
	google.maps.event.addListener(marker, "click", function() {
		location.href = url;
	});
}
function attachInfoBox(marker, text, myMap, url) {
	google.maps.event.addListener(marker, "mouseover", function() {
		infoBox.setContent(text);
		infoBox.setUrl(url);
		infoBox.open(myMap, marker);
		this.setZIndex(myZindex + 1);
		myZindex = myZindex + 1;
	});
	google.maps.event.addListener(marker, "mouseout", function() {
		infoBox.close();
	});
}
function openInfoBox(marker, text, myMap) {
	var myLatLan = marker.getPosition();
	myMap.setCenter(myLatLan);
	infoBox.setContent(text);
	infoBox.open(myMap, marker);
}
var base_64 = {
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;
		input = Base64._utf8_encode(input);
		while (i < input.length) {
			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);
			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;
			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}
			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
		}
		return output;
	},
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;
		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
		while (i < input.length) {
			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));
			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;
			output = output + String.fromCharCode(chr1);
			if (enc3 != 64) output = output + String.fromCharCode(chr2);
			if (enc4 != 64) output = output + String.fromCharCode(chr3);
		}
		output = Base64._utf8_decode(output);
		return output;
	},
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
		for (var n = 0; n < string.length; n++) {
			var c = string.charCodeAt(n);
			if (c < 128) {
				utftext += String.fromCharCode(c);
			} else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			} else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
		}
		return utftext;
	},
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
		while ( i < utftext.length ) {
			c = utftext.charCodeAt(i);
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			} else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			} else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
		}
		return string;
	}
}

function createXmlHttpRequest(){
	try {
		if (typeof ActiveXObject != 'undefined') {
			return new ActiveXObject('Microsoft.XMLHTTP');
		} else if (window["XMLHttpRequest"]) {
			return new XMLHttpRequest();
		}
	} catch (e) {
		changeStatus(e);
	}
	return null;
}

function downloadUrl(url, callback) {
	var status = -1;
	var request = createXmlHttpRequest();
	if (!request) {
		return false;
	}
	
	request.onreadystatechange = function(){
		if (request.readyState == 4) {
			try {
				status = request.status;
			} catch (e) {
			}
			if (status == 200) {
				callback(request.responseXML, request.status);
				request.onreadystatechange = function() {};
			}
		}
	}
	request.open('GET', url, true);
	try {
		request.send(null);
	} catch (e) {
		changeStatus(e);
	}
}

// FINE MAPPA

(function($) {
    $.fn.innerfade = function(options) {
        return this.each(function() {   
            $.innerfade(this, options);
        });
    };
    $.innerfade = function(container, options) {
        var settings = {
        	'animationtype':    'fade',
            'speed':            'normal',
            'type':             'sequence',
            'timeout':          2000,
            'containerheight':  'auto',
            'runningclass':     'innerfade',
            'children':         null
        };
        if (options)
            $.extend(settings, options);
        if (settings.children === null)
            var elements = $(container).children();
        else
            var elements = $(container).children(settings.children);
		
		
        if (elements.length > 1) {
            $(container).css('position', 'relative').css('height', settings.containerheight).addClass(settings.runningclass);
            for (var i = 0; i < elements.length; i++) {
                $(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute').css('top', '0').hide();
            };
            if (settings.type == "sequence") {
                setTimeout(function() {
                    $.innerfade.next(elements, settings, 1, 0);
                }, settings.timeout);
                $(elements[0]).show();
            } else if (settings.type == "random") {
            	var last = Math.floor ( Math.random () * ( elements.length ) );
                setTimeout(function() {
                    do { 
						current = Math.floor ( Math.random ( ) * ( elements.length ) );
					} while (last == current );             
					$.innerfade.next(elements, settings, current, last);
                }, settings.timeout);
                $(elements[last]).show();
			} else if ( settings.type == 'random_start' ) {
				settings.type = 'sequence';
				var current = Math.floor ( Math.random () * ( elements.length ) );
				setTimeout(function(){
					$.innerfade.next(elements, settings, (current + 1) %  elements.length, current);
				}, settings.timeout);
				$(elements[current]).show();
			}	else {
				alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
			}
		}
    };
    $.innerfade.next = function(elements, settings, current, last) {
        if (settings.animationtype == 'slide') {
            $(elements[last]).slideUp(settings.speed);
            $(elements[current]).slideDown(settings.speed);
        } else if (settings.animationtype == 'fade') {
            $(elements[last]).fadeOut(settings.speed);
            $(elements[current]).fadeIn(settings.speed, function() {
							removeFilter($(this)[0]);
						});
        } else
            alert('Innerfade-animationtype must either be \'slide\' or \'fade\'');
        if (settings.type == "sequence") {
            if ((current + 1) < elements.length) {
                current = current + 1;
                last = current - 1;
            } else {
                current = 0;
                last = elements.length - 1;
            }
        } else if (settings.type == "random") {
            last = current;
            while (current == last)
                current = Math.floor(Math.random() * elements.length);
        } else
            alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
        setTimeout((function() {
            $.innerfade.next(elements, settings, current, last);
        }), settings.timeout);
    };

})(jQuery);

// **** remove Opacity-Filter in ie ****
function removeFilter(element) {
	if(element.style.removeAttribute){
		element.style.removeAttribute('filter');
	}
}

var loadedobjects="";
var rootdomain="http://"+window.location.hostname;
function include_page(url, containerid){
	//alert(url +' - '+ rootdomain);
	var page_request = false;
	if (window.XMLHttpRequest)
		page_request = new XMLHttpRequest()
	else if (window.ActiveXObject){
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e){
			try{
				page_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){}
		}
	} else
	return false
	page_request.onreadystatechange=function(){
	loadpage(page_request, containerid)
	}
	page_request.open('GET', url, true)
	page_request.send(null)
}

function loadpage(page_request, containerid){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
		//alert("Sto caricando la pagina ajax!");
		if (document.getElementById(containerid)){
			document.getElementById(containerid).innerHTML=page_request.responseText;
		} else {
			alert("Errore, l'elemento non esiste");
		}
}
function loadobjs(){
	if (!document.getElementById)
		return
	for (i=0; i<arguments.length; i++){
		var file=arguments[i]
		var fileref="";
		if (loadedobjects.indexOf(file)==-1){
			if (file.indexOf(".js")!=-1){
				fileref=document.createElement('script');
				fileref.setAttribute("type","text/javascript");
				fileref.setAttribute("src", file);
			} else if (file.indexOf(".css")!=-1){
				fileref=document.createElement("link");
				fileref.setAttribute("rel", "stylesheet");
				fileref.setAttribute("type", "text/css");
				fileref.setAttribute("href", file);
			}
		}
		if (fileref!=""){
			document.getElementsByTagName("head").item(0).appendChild(fileref);
			loadedobjects+=file+" ";
		}
	}
}

function printOffersAndEvents(){
	$('#offersHome').innerfade({
		speed: 'slow',
		timeout: 3000,
		type: 'sequence',
		containerheight: '130px',
		children: 'li.singleOffers'
	});
	$('#eventsHome').innerfade({
		speed: 'slow',
		timeout: 3000,
		type: 'sequence',
		containerheight: '130px',
		children: 'li.singleOffers'
	});
}

function scrollUp(myBlock){ 
	if ($('#'+ myBlock +' li').length > 1) {
		$('#'+ myBlock +' li:first').animate(
			{opacity:0,
			marginTop: $('#'+ myBlock +' li:first').outerHeight(true)*-1
			},
			1500,
			'',
			function(){
				$(this).remove().insertAfter('#'+ myBlock +' li:last');
				$('#'+ myBlock +' li').removeAttr('style');
				setTimeout("scrollUp('"+myBlock+"')", 2000);
			}
		);
	}

}