function UB_showHideObject(){var i,p,v,obj,args=UB_showHideObject.arguments;for(i=0;i<(args.length-1);i+=2){if((obj=MM_findObj(args[i]))!=null){v=args[i+1];if(obj.style){obj=obj.style;v=(v=='off')?'none':(v=='on')?'block':v;};obj.display=v;}}}
function UB_changeClass(){var i,myObj,myClass,args=UB_changeClass.arguments;for(i=0;i<(args.length-1);i+=2){myObj=MM_findObj(args[i]);myObj.className=args[i+1];}}
function UB_genPop(myUrl,myWinName,myWidth,myHeight,myPars){var winLeft=(screen.availWidth-myWidth)/2;var winTop=(screen.availHeight-myHeight)/2;var winParameters=myPars+'';if(winParameters==''){winParameters=',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no';};newWin=window.open(myUrl,myWinName,'width='+ myWidth +',height='+ myHeight +',left='+ winLeft +',top='+ winTop + winParameters);newWin.focus();}
var activeMNU,activeELM,subTimeoutID;

//per aggiungere una voce nel men&ugrave; orizzontale bisogna aumentare il valore in activeELMclassName.substring(0,10)
function UB_subMNUoff(myMNU){if(subTimeoutID)clearTimeout(subTimeoutID);UB_showHideObject(myMNU,'off');activeELMclassName=activeELM.firstChild.className;activeELM.firstChild.className=activeELMclassName.substring(0,10);subTimeoutID='';activeELM='';activeMNU='';}
function UB_timeout(myMNU,myTimeout){myTimeout=myTimeout?myTimeout:123;subTimeoutID=setTimeout("UB_subMNUoff('"+ myMNU +"')",myTimeout);}
function UB_subMNUon(myMNU,myElement){if(myMNU==activeMNU){if(subTimeoutID){clearTimeout(subTimeoutID)};subTimeoutID='';return;};if(activeMNU){UB_subMNUoff(activeMNU)};activeMNU=myMNU;UB_showHideObject(myMNU,'on');if(myElement){myElement.firstChild.className=myElement.firstChild.className+" sel";activeELM=myElement;}}

function HideDIV(d) {
	if (document.getElementById('divFormCamera'))
    document.getElementById('divFormCamera').style.display="none";
  jq('#'+d).slideUp();
  //document.getElementById(d).style.display = "none";
}

function DisplayDIV(d) {
	if (document.getElementById('divFormCamera'))document.getElementById('divFormCamera').style.display="none";
	jq('#'+d).slideDown();
	//document.getElementById(d).style.display = "block";
}
function HideAllContent(d) {
	document.getElementsByClassName = function(){
	if(document.hasChildNodes && arguments[0]){
	var data = new Array();
	for(a=0;a<document.getElementsByTagName("*").length;a++){
	if(document.getElementsByTagName("*")[a].className == arguments[0]){
	data.push(document.getElementsByTagName("*")[a]);
	}
	}
	return data;
	}
	}
	
	
	document.getElementsByClassName(d)[0].style.display = "none";
}


function apriPop(myUrl,myWinName,myWidth,myHeight,myPars) {
	var winl = (screen.width - myWidth) / 2;
	var wint = (screen.height - myHeight) / 2;
	parameters = myPars + '';
	if (parameters == '') parameters = ',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no';
	gwin=window.open(myUrl,myWinName,'width='+myWidth+',height='+myHeight+',left='+winl+',top='+wint+parameters);
	if (gwin) gwin.focus();
}

function loadAndWait (theUrl) {
	if (theUrl!='') {
		
		HideDIV('alpitourPAGEcontent'); DisplayDIV('trova_layer');
		
		location.href=theUrl;
	}
}

function tabOn(mydiv){for(var i=1;i<=ntab;i++){(i==mydiv)?UB_showHideObject('tabdiv'+i,'on'):UB_showHideObject('tabdiv'+i,'off')}}

/*VT: newsB*/
/*
posizioni per grafica nuova
function getY(who){
var val = 0;
while( who != null ) {
val += who.offsetTop;
who = who.offsetParent;
}
var corr=(document.all)?251:256
val-=corr
return val;
}
function getX(who){
var val = 0;
var j=0
while(who!=null && j<3) {
val += who.offsetLeft;
who = who.offsetParent;
j++
}
return val+10;
}*/

function getY(who, offset){
	var val = 0;
	while(who!= null) {
		val += who.offsetTop;
		who = who.offsetParent;
	}
	//return val-578;
	return val-offset;
}

function getX(who, offset){
	var val = 0;
	var j=0
	while(who!=null && j<7) {
		val += who.offsetLeft;
		who = who.offsetParent;
		j++
	}
	var corr=(document.all)?offset:480
	val-=corr
	return val;
}

var ACT="#"
function showCamera(a, offsetX, offsetY){
	var div=document.getElementById('divFormCamera')
	div.style.left=getX(a, offsetX)+"px"
	div.style.top=getY(a, offsetY)+"px"
	ACT=a.href
	var adulti=ACT.substr(ACT.indexOf('adulti=')+7,1)
	document.getElementById('formCameraAdulti').selectedIndex=(adulti!='&')?adulti-1:0
	var raga=ACT.substr(ACT.indexOf('under18=')+8,1)
	document.getElementById('formCameraRaga').selectedIndex=(raga!='&')?raga:0
	var eu1=parseInt(ACT.substr(ACT.indexOf('eu1=')+4,2)).toString()
	document.getElementById('formCameraEu1').selectedIndex=(eu1!='NaN')?eu1:0
	var eu2=parseInt(ACT.substr(ACT.indexOf('eu2=')+4,2)).toString()
	document.getElementById('formCameraEu2').selectedIndex=(eu2!='NaN')?eu2:0
	switch ($("#formCameraRaga")[0].selectedIndex){
		case 0:$("#mino1").hide();$("#mino2").hide();break;
		case 1:$("#mino1").show();$("#mino2").hide();break;
		case 2:$("#mino1").show();$("#mino2").show();break;
		default:break;
	}
	div.style.display="block"
}
function getActionCamera(){
	var aduChunk = ACT.split('adulti=')[0] + "adulti=" + document.getElementById('formCameraAdulti').value + ACT.split('adulti=')[1].substr(1)
	var ragaChunk = aduChunk.split('under18=')[0] + "under18=" + document.getElementById('formCameraRaga').value + aduChunk.split('under18=')[1].substr(1)
	var eu1Length=(ragaChunk.split('eu1=')[1].charAt(1)=="&")?1:2;
	var eu1Chunk= ragaChunk.split('eu1=')[0] + "eu1=" + document.getElementById('formCameraEu1').value + ragaChunk.split('eu1=')[1].substr(eu1Length)
	var eu2Length=(eu1Chunk.split('eu2=')[1].charAt(1)=="&")?1:2;
	var eu2Chunk= eu1Chunk.split('eu2=')[0] + "eu2=" + document.getElementById('formCameraEu2').value + ragaChunk.split('eu2=')[1].substr(eu2Length)
	document.location.href=eu2Chunk;
}
function closeCamera(){$('#divFormCamera').hide()}

function ragaChange(){
	switch ($("#formCameraRaga")[0].selectedIndex){
		case 0:$("#mino1").hide();$("#mino2").hide();break;
		case 1:$("#mino1").show();$("#mino2").hide();break;
		case 2:$("#mino1").show();$("#mino2").show();break;
		default:break;
	}
}
