
function setTreatment(mySelect){
var opt = document.getElementById('treatment').options;
for(var i=0;i<opt.length;i++){
if(mySelect.value == 'Albergo Elisa' && opt[i].value == 'BB'){
opt[i].removeAttribute('disabled');} else if(mySelect.value != 'Albergo Elisa' && opt[i].value == 'BB' && opt[i].selected){
opt[i].setAttribute('disabled', 'disabled');
document.getElementById('treatment').value = "";}}
}
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 collapseMenu(menuId){
var myMenuId = menuId;
var mySpace = jq("#"+menuId).width();
var myWidth = 0;
var myChild = 0;
jq("#"+menuId+" > li > a").each(function(){
myWidth += jq(this).width();
myChild++;});
if(myWidth > 0){
var myPadding = Math.floor(((mySpace-myWidth)/myChild)/2);
if(myWidth+(myPadding*2*myChild) <= mySpace){
jq("#"+menuId+" > li").each(function(){
jq(this).css({"padding-left":myPadding, "padding-right":myPadding});});} else setTimeout("collapseMenu('"+myMenuId+"')", 400);} else setTimeout("collapseMenu('"+myMenuId+"')", 400);
}
var swapImage ={
options:{
myImgInit: "",
mycontImg: ""},
over: function(myImg, contImg){
swapImage.options.myImgInit = jq("#"+contImg+" > img").attr('src');
swapImage.options.mycontImg = contImg;
jq("#"+contImg+" > img").attr('src', myImg);},
out: function(){
jq("#"+swapImage.options.mycontImg+" > img").attr('src', swapImage.options.myImgInit);
swapImage.options.myImgInit = "";
swapImage.options.mycontImg = "";}
}
var myUrlPathname = location.pathname;
var boxSlide ={
options:{
mySlidePosition: 1,
mySlidePositionLeft: 0,
myWidthW: 100,
opacityW: "",
prevSlide: "",
nextSlide: "",
blockSlide: "",
timeSlide: 10,
showBlock: 1,
myUrlNow: myUrlPathname,
selectByUrl: false,
myUrl: ""},
init: function(optsS){
for (nameS in optsS) boxSlide.options[nameS] = optsS[nameS];
if(boxSlide.options.myUrl != "") boxSlide.options.myUrlNow = boxSlide.options.myUrl;
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++){
if(boxSlide.options.selectByUrl == true){
var myHref = mySlideList[iL].getElementsByTagName("a");
if(myHref[0].getAttribute("href").indexOf(boxSlide.options.myUrlNow) == "-1"){
mySlideList[iL].className = "unsel";} else{
mySlideList[iL].className = mySlideList[iL].className +"sel";
boxSlide.options.mySlidePosition = countSlide;}}
var myImage = mySlideList[iL].getElementsByTagName("img");
mySlideList[iL].setAttribute("id","Slide_"+ countSlide);
mySlideList[iL].style.position = "absolute";
mySlideList[iL].style.top = "0";
mySlideList[iL].style.left = ((iL*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 (IE8() || window.addEventListener){
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;}}}
if(mySlideList.length-boxSlide.options.showBlock >= boxSlide.options.mySlidePosition && boxSlide.options.mySlidePosition > 1){
mySlideBlock.style.left = "-"+ (parseInt(boxSlide.options.mySlidePosition)-1)*boxSlide.options.myWidthW +"px";} else if(mySlideList.length-boxSlide.options.showBlock < boxSlide.options.mySlidePosition && boxSlide.options.mySlidePosition > 1){
mySlideBlock.style.left = "-"+ (parseInt(mySlideList.length-boxSlide.options.showBlock))*boxSlide.options.myWidthW +"px";
boxSlide.options.mySlidePosition = mySlideList.length-boxSlide.options.showBlock+1;
if (window.addEventListener || IE8()){
myButtonLeft.setAttribute("onclick", "");
myButtonRight.setAttribute("onclick", "");} else{
myButtonLeft.setAttribute("onclick",function(){});
myButtonRight.setAttribute("onclick",function(){});}
boxSlide.activeButton();}} else{
alert(boxSlide.options.blockSlide +" non esiste.");}
boxSlide.activeLight();},
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)", boxSlide.options.timeSlide);
boxSlide.deActiveLight();} else{
document.getElementById(boxSlide.options.blockSlide).style.left = posEndW +"px";
boxSlide.options.mySlidePosition = boxSlide.options.mySlidePosition - 1;
boxSlide.activeButton();
boxSlide.activeLight();
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)", boxSlide.options.timeSlide);
boxSlide.deActiveLight();} else{
document.getElementById(boxSlide.options.blockSlide).style.left = posEndW +"px";
boxSlide.options.mySlidePosition = boxSlide.options.mySlidePosition + 1;
boxSlide.activeButton();
boxSlide.activeLight();
return false;}}},
activeLight: function(){
jq('#'+ boxSlide.options.blockSlide +' > li > a').hover(
function(){
var myPosBgr = (jq(this).parent().attr("id").replace('Slide_', '')*1-boxSlide.options.mySlidePosition)*165-50;
jq('#lightSlider').css({'background-image' : 'url(/images/lightHover.png)', 'background-position' : myPosBgr+'px 0', 'background-repeat' : 'no-repeat'})},
function(){
jq('#lightSlider').css({'background' : 'none'})}
);},
deActiveLight: function(){
jq('#'+ boxSlide.options.blockSlide +' > li > a').hover(
function(){
jq('#lightSlider').css({'background' : 'none'})},
function(){
jq('#lightSlider').css({'background' : 'none'})}
);},
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;}}}}
}
function IE8(){
var ievs = (/MSIE (\d+\.\d+);/.test(navigator.userAgent));
if (ievs){
var iev = new Number(RegExp.$1);
if (iev >= 8) return true;} 
}
if (!document.myGetElementsByClassName){
document.myGetElementsByClassName = function(className){
var children = document.getElementsByTagName('*') || document.all;
var elements = new Array();
for (var i = 0;i < children.length;i++){
var child = children[i];
var classNames = child.className.split(' ');
for (var j = 0;j < classNames.length;j++){
if (classNames[j] == className){
elements.push(child);
break;}}}
return elements;}
}
var Reflection ={
defaultHeight : 0.5,
defaultOpacity: 0.5,
add: function(image, options){
Reflection.remove(image);
doptions ={"height" : Reflection.defaultHeight, "opacity" : Reflection.defaultOpacity }
if(options){
for(var i in doptions){if(!options[i]){options[i] = doptions[i];}}} else{options = doptions;}
try{
var d = document.createElement('div');
var p = image;
var classes = p.className.split(' ');
var newClasses = '';
for (j=0;j<classes.length;j++){
if (classes[j] != "reflect"){
if (newClasses){newClasses += ' ';}
newClasses += classes[j];}}
var reflectionHeight = Math.floor(p.height*options['height']);
var divHeight = Math.floor(p.height*(1+options['height']));
var reflectionWidth = p.width;
if (document.all && !window.opera){
if(p.parentElement.tagName == 'A'){
var d = document.createElement('a');
d.href = p.parentElement.href;} 
d.className = newClasses;
p.className = 'reflected';
d.style.cssText = p.style.cssText;
p.style.cssText = 'vertical-align: bottom';
var reflection = document.createElement('img');
reflection.src = p.src;
reflection.style.width = reflectionWidth+'px';
reflection.style.display = 'block';
reflection.style.height = p.height+"px";
reflection.style.marginBottom = "-"+(p.height-reflectionHeight)+'px';
reflection.style.filter = 'flipv progid:DXImageTransform.Microsoft.Alpha(opacity='+(options['opacity']*100)+', style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy='+(options['height']*100)+')';
d.style.width = reflectionWidth+'px';
d.style.height = divHeight+'px';
p.parentNode.replaceChild(d, p);
d.appendChild(p);
d.appendChild(reflection);} else{
var canvas = document.createElement('canvas');
if (canvas.getContext){
d.className = newClasses;
p.className = 'reflected';
d.style.cssText = p.style.cssText;
p.style.cssText = 'vertical-align: bottom';
var context = canvas.getContext("2d");
canvas.style.height = reflectionHeight+'px';
canvas.style.width = reflectionWidth+'px';
canvas.height = reflectionHeight;
canvas.width = reflectionWidth;
d.style.width = reflectionWidth+'px';
d.style.height = divHeight+'px';
p.parentNode.replaceChild(d, p);
d.appendChild(p);
d.appendChild(canvas);
context.save();
context.translate(0,image.height-1);
context.scale(1,-1);
context.drawImage(image, 0, 0, reflectionWidth, image.height);
context.restore();
context.globalCompositeOperation = "destination-out";
var gradient = context.createLinearGradient(0, 0, 0, reflectionHeight);
gradient.addColorStop(1, "rgba(255, 255, 255, 1.0)");
gradient.addColorStop(0, "rgba(255, 255, 255, "+(1-options['opacity'])+")");
context.fillStyle = gradient;
context.rect(0, 0, reflectionWidth, reflectionHeight*2);
context.fill();}}} catch (e){}},
remove : function(image){
if (image.className == "reflected"){
image.className = image.parentNode.className;
image.parentNode.parentNode.replaceChild(image, image.parentNode);}}
}
function addReflections(){
var rimages = document.myGetElementsByClassName('reflect');
for (i=0;i<rimages.length;i++){
var rheight = null;
var ropacity = null;
var classes = rimages[i].className.split(' ');
for (j=0;j<classes.length;j++){
if (classes[j].indexOf("rheight") == 0){
var rheight = classes[j].substring(7)/100;} else if (classes[j].indexOf("ropacity") == 0){
var ropacity = classes[j].substring(8)/100;}}
Reflection.add(rimages[i],{height: rheight, opacity : ropacity});}
}
// FUNZIONI PER LA MAPPA V3
var i, infoBox, maps;
i = 1;
var myZindex = 0;
var changeZoom = false;
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]};
maps = new google.maps.Map(document.getElementById(mapId), myOptions);
var markerBounds = new google.maps.LatLngBounds();
var myLatLng = new google.maps.LatLng(myMarker['lat'], myMarker['lon']);
if (multiple){
if(multipleCategory != "") multipleCategory = "?sectionId="+ 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++){
markerBounds.extend(new google.maps.LatLng(parseFloat(markers_def[i_def].getAttribute("lat")), parseFloat(markers_def[i_def].getAttribute("lng"))));
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,
icon: '/images/iconMarkerBig.png',
zIndex: 1000000000});
openInfoBox(marker, base_64.decode(markers_def[i_def].getAttribute("ballon")), maps);} else 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});
attachURL(marker, markers_def[i_def].getAttribute("url"));} 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,
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++;}}
if(openBox == false){
if(markers_def.length > 1){
markerBounds.extend(new google.maps.LatLng(45.54538000814636, 12.763439118862152));
maps.fitBounds(markerBounds);}
google.maps.event.addListener(maps, 'zoom_changed', function(){
if(changeZoom == false){
if(markers_def.length < 2 && maps.getZoom() > 13) maps.setZoom(13);
changeZoom = true;} });}});} else{
var marker = new google.maps.Marker({
position: myLatLng,
map: maps,
icon: myMarker['icon']});}
var markerHotel = new google.maps.Marker({
position: new google.maps.LatLng(45.54538000814636, 12.763439118862152),
map: maps,
title: "Park Hotel Pineta",
icon:'/images/iconHotel.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(){
myZindex = myZindex + 1;
this.setZIndex(myZindex);
infoBox.setContent(text);
infoBox.setUrl(url);
infoBox.open(myMap, this);
this.setIcon('/images/iconMarkerBig.png');});
google.maps.event.addListener(marker, "mouseout", function(){
this.setIcon('/images/iconMarker.png');
setTimeout('infoBox.close()', 100);});
}
function openInfoBox(marker, text, myMap){
var myLatLan = marker.getPosition();
myMap.setCenter(myLatLan);
infoBox.setContent(text);
infoBox.open(myMap, marker);
}
var setDirection ={
options:{
mapContainer: document.getElementById('maps'),
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;}
jq('html,body').animate({scrollTop: jq('#maps').offset().top - 20}, 1000);
setDirection.options.dirRenderer.setMap(null);
setDirection.options.dirRenderer.setMap(maps);
jq('#dirContainer').html('');
setDirection.options.dirRenderer.setPanel(document.getElementById('dirContainer'));
setDirection.options.dirRenderer.setDirections(dirResult);}
}
var infowindow;
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,
mapTypeControl: false,
mapTypeControlOptions:{style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
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']);
var 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 injectText(idBox, text){
var myBox = document.getElementById(idBox);
if(myBox){
myBox.innerHTML = base_64.decode(text);}
}
var base_64 ={
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode : function (input){
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = base_64._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 = base_64._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;}
}
var jbase64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=jbase64._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=jbase64._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;}}
var resetBox ={
options:{myBlock: "boxSearch", myHeight: 0, myLiHeight: 0, speed: 1000, rooms:1 },
init: function(opts){
for (name in opts) resetBox.options[name] = opts[name];
if(jq('#'+ resetBox.options.myBlock).length){
resetBox.options.myHeight = jq('#'+ resetBox.options.myBlock).height();
resetBox.options.myLiHeight = 35;
if(resetBox.options.rooms > 1){
resetBox.options.myLiHeight = 35;
var newHeight = resetBox.options.myHeight + (resetBox.options.myLiHeight*(resetBox.options.rooms*1));
jq('#'+ resetBox.options.myBlock).animate({height: newHeight}, 0);
jq('#bgContSearch').animate({opacity: 0.8}, 0);
jq('#buttonLeft').css({'display':'none'});
jq('#buttonRight').css({'display':'none'});}
jq('#numList').change(function(){resetBox.set(jq(this).val());});} else alert("attenzione: "+ resetBox.options.myBlock +" non esiste.");},
set: function(myValue){
myValuePass = parseInt(myValue);
if(myValue > 1) myValue++;
var heightB = resetBox.options.myHeight + (resetBox.options.myLiHeight*(myValue*1-1));
var onFinish = true;
if(jq('#'+ resetBox.options.myBlock).height() < heightB){setRoom(myValuePass, name_adults, name_children, name_childage, name_room, name_rooms);onFinish = false;}
if(onFinish){jq('#'+ resetBox.options.myBlock).animate({height: heightB}, resetBox.options.speed, function(){
setRoom(myValuePass, name_adults, name_children, name_childage, name_room, name_rooms);});} else{jq('#'+ resetBox.options.myBlock).animate({height: heightB}, resetBox.options.speed);}
if(myValuePass == 1){
jq('#numAdults').html('<label>'+ name_adults +'</label><select name="bform[reqRooms][1][adults]">\n'+ createSelect(6, 1, '', '', 2) + '</select>');
jq('#numChildren').html('<label>'+ name_children +'</label><select name="bform[reqRooms][1][child]" onchange="setChildAge(this.value,\'chdAge_1\', 1,\''+ name_childage +'\')";>\n'+ createSelect(4, 0, '', 0) + '</select>');
jq('#contOption').html('');
jq('#bgContSearch').animate({opacity: 0.4}, resetBox.options.speed);
jq('#buttonLeft').css({'display':'inline-block'});
jq('#buttonRight').css({'display':'inline-block'});} else{
jq('#numAdults').html('');
jq('#numChildren').html('');
jq('#bgContSearch').animate({opacity: 0.8}, resetBox.options.speed);
jq('#buttonLeft').css({'display':'none'});
jq('#buttonRight').css({'display':'none'});}},
add: function(myValue){
myValuePass = parseInt(myValue);
if(myValuePass == 1) setRoom(1, name_adults, name_children, name_childage, name_room, name_rooms);}
}
var resetBoxOff ={
options:{myBlock: "search2", myHeight: 0, myLiHeight: 0, speed: 1000, rooms:1 },
init: function(opts){
for (name in opts) resetBoxOff.options[name] = opts[name];
if(jq('#'+ resetBoxOff.options.myBlock).length){
resetBoxOff.options.myHeight = jq('#'+ resetBoxOff.options.myBlock).height();
resetBoxOff.options.myLiHeight = 35;
jq('#numList2').change(function(){resetBoxOff.set(jq(this).val());});} else alert("attenzione: "+ resetBoxOff.options.myBlock +" non esiste.");},
set: function(myValue){
myValuePass = parseInt(myValue);
if(myValuePass > 1){
var heightB = resetBoxOff.options.myHeight + (resetBoxOff.options.myLiHeight*(myValue*1));} else{
var heightB = resetBoxOff.options.myHeight;}
var onFinish = true;
if(jq('#'+ resetBoxOff.options.myBlock).height() < heightB){setRoom(myValuePass, name_adults, name_children, name_childage, name_room, name_rooms, 'contOption2');onFinish = false;}
if(onFinish){jq('#'+ resetBoxOff.options.myBlock).animate({height: heightB}, resetBoxOff.options.speed, function(){
setRoom(myValuePass, name_adults, name_children, name_childage, name_room, name_rooms, 'contOption2');});} else{jq('#'+ resetBoxOff.options.myBlock).animate({height: heightB}, resetBoxOff.options.speed);}
if(myValuePass == 1){
jq('#numAdults2').html('<label>'+ name_adults +'</label><select name="bform[reqRooms][1][adults]">\n'+ createSelect(6, 1, '', '', 2) + '</select>');
jq('#numChildren2').html('<label>'+ name_children +'</label><select name="bform[reqRooms][1][child]" onchange="setChildAge(this.value, \'off_chdAge_1\', 1, \''+ name_childage +'\', true)";>\n'+ createSelect(4, 0, '', 0) + '</select>');
jq('#contOption2').html('');} else{
jq('#numAdults2').html('');
jq('#numChildren2').html('');}},
add: function(myValue){
myValuePass = parseInt(myValue);
if(myValuePass == 1) setRoom(1, name_adults, name_children, name_childage, name_room, name_rooms, 'contOption2');}
}
var resetBoxCont ={
options:{myBlock: "search3", myHeight: 0, myLiHeight: 0, speed: 1000, rooms:1 },
init: function(opts){
for (name in opts) resetBoxCont.options[name] = opts[name];
if(jq('#'+ resetBoxCont.options.myBlock).length){
jq('#numList3').change(function(){resetBoxCont.set(jq(this).val());});} else alert("attenzione: "+ resetBoxCont.options.myBlock +" non esiste.");},
set: function(myValue){
myValuePass = parseInt(myValue);
setRoom(myValuePass, name_adults, name_children, name_childage, name_room, name_rooms, 'contOption2', true);}
}
function setChildAge(nchild, chdid, roomn, label_children_age, isOffer){
if(isOffer == undefined) isOffer = false;
var selectHtml = "";
if(nchild > 0){
if(jq('#numList2').val() == 1 && isOffer) resetBoxOff.add(1);
if(jq('#numList').val() == 1 && !isOffer) resetBox.add(1);
selectHtml = '<label>'+ label_children_age +'</label>';
for (var cc=1;cc<=nchild;cc++){
selectHtml = selectHtml + '<select name="bform[reqRooms]['+roomn+'][childAge][' + cc + ']" class="selectSmall">' + '<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>';}} else{
if(jq('#numList2').val() == 1 && isOffer) resetBoxOff.add(0);
if(jq('#numList').val() == 1 && !isOffer) resetBox.add(0);}
jq('#'+ chdid).html(selectHtml);
}
function createSelect(num, init, label, labels, selected){
if(label != "") label = " "+ label;
labels = (labels != "")? " "+ labels : label;
var mySel = "";
for(var k=init;k<=num;k++){
if(k!=init) label = labels;
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, label_rooms, myCont, isCont){
if(myCont == undefined) myCont = 'contOption';
var myPrefix = '';
if(myCont == 'contOption2') myPrefix = 'off_';
var myResults = "";
myResults = myResults + '<ul>\n';
for (var i=1;i<=nrooms;i++){
if ( nrooms > 1 || isCont==true){
myResults = myResults + ' <li><strong>'+ label_room +' '+ i +'</strong>\n';} else if ( nrooms == 1 && myCont == 'contOption' && jq('#numChildren select').val() > 0){
myResults = myResults + ' <li class="onlyAge">\n';} else if ( nrooms == 1 && myCont != 'contOption'){
myResults = myResults + ' <li class="onlyAge">\n';}
if (nrooms > 1 || isCont==true){
myResults = myResults + ' <span>\n'+
' <label>'+ label_adults +'</label>\n'+
' <select name="bform[reqRooms]['+ i +'][adults]">\n'+
' '+ createSelect(6, 1, "", "", 2) + 
' </select>\n'+
' </span>\n'+
' <span>\n'+
' <label>'+ label_children +'</label>\n'+
' <select name="bform[reqRooms]['+ i +'][child]" onchange="setChildAge(this.value,\''+ myPrefix +'chdAge_'+ i +'\', '+ i +',\''+ label_children_age +'\'';
if(myCont == 'contOption2') myResults = myResults + ', true';
myResults = myResults + ');">\n'+
' '+ createSelect(4, 0, "", "", 0) + 
' </select>\n'+
' </span>\n';}
myResults = myResults + ' <span class="childAge" id="'+ myPrefix +'chdAge_'+ i +'"></span>\n'+
' </li>\n';}
myResults = myResults + '</ul>\n';
if (document.getElementById(myCont)){
jq('#'+ myCont).html(myResults);} else{
alert(myCont +" => blocco non valido");}
}
function goToUrl(enUrl){
var decUrl = jbase64.decode(enUrl);
location.href=''+decUrl+'';
}
function slideShow(){
var active = jq('#contGalJs img:first');
var cont = active.length;
active
.remove()
.insertAfter('#contGalJs img:last')
.animate({opacity: 1.0}, 1000, function(){
jq(this).siblings().removeAttr('style');});
if(cont > 0){
jq("#mainMenu").addClass("noFlash");}
}
jq(document).ready(function(){
slideShow();
jq("#contGalJs").css("background-image", "none");
setInterval( "slideShow()", 5000 );
});
