function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) 
		selObj.selectedIndex=0;
}

function Color(t) {
	t.className='sep_tr_over';
}

function Decolor(t) {
	t.className='sep_tr';
}

/**** finestre popup ****/
function popup(){
	newwin = window.open('','win_img','width=700, height=500,scrollbars=0,status=0,statusbar=0,toolbar=no,location=no,menubar=no,resizable=no,top=20,left=20,screenX=20,screenY=20');
	newwin.focus();
}

function imgpopup(){
	newwin = window.open('','pgpreview','width=520, height=425,scrollbars=0,status=0,statusbar=0,toolbar=no,location=no,menubar=no,resizable=no,top=20,left=20,screenX=20,screenY=20');
	newwin.focus();
}
function popup_ring(){
	newwin = window.open('','win_img_ring','width=360, height=330,scrollbars=0,status=0,statusbar=0,toolbar=no,location=no,menubar=no,resizable=no,top=20,left=20,screenX=20,screenY=20');
	newwin.focus();
}
function target_blank(x){
	document.getElementById(x).target="_blank";
}


/**** info privacy ****/
function mostra_informa(){
	document.getElementById('testo_informativa_1').style.display ='None';
	document.getElementById('testo_informativa_2').style.display ='';
}

function nascondi_informa(){
	document.getElementById('testo_informativa_1').style.display ='';
	document.getElementById('testo_informativa_2').style.display ='None';
}


/**** colonna dx bilanci/progetti per js attivo/no ****/
function mostra_jdx(id){
	document.getElementById('el'+id+'Child').className ='';
	document.getElementById('el'+id+'Parent').className ='menu_hidden';
}

function nascondi_jdx(id){
	document.getElementById('el'+id+'Child').className ='menu_hidden';
	document.getElementById('el'+id+'Parent').className ='menu_jright';
}

/****cartiografia ****/
function mappaita(){
	e=window.open('', 'mappa', "width=750,height=560,scrollbars=1,status=0,statusbar=0,toolbar=no,location=no,menubar=no,resizable=no,top=20,left=20,screenX=20,screenY=20");
	e.focus();
}


function newsletter(){
		d=window.open('', 'newsletter', "width=560,height=510,scrollbars=0,status=0,statusbar=0,toolbar=no,location=no,menubar=no,resizable=no,top=20,left=20,screenX=20,screenY=20");
		d.focus();
	}

/**** colonna dx bilanci/progetti per js attivo/no ****/
															
function mostra_aree(id, fine_indice){
	var inizio_indice_aree = 1;
	var fine_indice_aree = fine_indice;
	for (indice=inizio_indice_aree;indice<=fine_indice_aree;indice++) {
		if (indice==id) {
			document.getElementById('elmod_'+indice).className='menu_jright_att';
			document.getElementById('elmod_'+indice+'_Child').className='menu_hidden_att';
		} else {
			document.getElementById('elmod_'+indice).className='menu_jright';
			document.getElementById('elmod_'+indice+'_Child').className='menu_hidden';
		}
	}
}
/* rnd img come background */
function rnd_image(){
	
	// array con le img presenti nella dir
	var imgs = new Array("1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg", "6.jpg");
	
	var rnd_img = Math.floor(Math.random()*imgs.length);
	
	document.write('<style type="text\/css">body {background:#e7e1de url(..\/..\/img\/share\/back-random\/' + imgs[rnd_img] +') no-repeat 0 0;}<\/style>');

}
function isEmail(str) {
	var supported = 0;
	if(window.RegExp) {
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	}
	if(!supported)
		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,6}|[0-9]{1,3})(\\]?)$");

	return (!r1.test(str) && r2.test(str));
}

function isDate(str) {
	var arrivoArray = str.split("/"); 
	var dataarrivo=new Date()
	dataarrivo.setFullYear(arrivoArray[2],arrivoArray[1],arrivoArray[0])
	return (dataarrivo);
}

function MyTrim(myObj){
	var i;
	var myObjTmp;
	var myObjTmp2;

	if (myObj==null){
		myObj=''; 
		return myObj;
	}

	if (myObj=='') {
		return myObj;
	}

	for (i = 0; i < myObj.length; i++) {
		if(myObj.charAt(i) == ' '){
			myObjTmp = myObj.substr(i+1)
		} else {
			if (i==0) { 
				myObjTmp = myObj;
			}
			break;
		}
	}

	myObjTmp2 = myObjTmp

	if (myObjTmp.length > 0) {
		for (i = myObjTmp.length-1; i > 0; i--) {// elimina gli spazi finali
			if (myObjTmp.charAt(i) == ' '){
				myObjTmp2 = myObjTmp.substr(0,i)
			} else {
				break;
			}
		}
	}

	myObj = myObjTmp2
	return (myObj)
}

/* PLAYER MULTIMEDIALE */
function pulisci(){
	$("div.piro_overlay").remove();
	$("table.pirobox_content").remove();
}

function setDate_form()
{
	var gg = document.getElementById("gg");	
	var mm = document.getElementById("mm");	
	var aa = document.getElementById("aa");	
	var oggi = new Date();
	
	if(gg && mm && aa)
	{
		gg.options[(oggi.getDate()-1)].selected = true;
		mm.options[(oggi.getMonth())].selected = true;
		for(i=0; i<10; i++)
		{
			if(aa.options[i])
			{
				if(aa.options[i].value == oggi.getFullYear()) aa.options[i].selected = true;
			}
		}
	}	
}
function frmcheck(frm) {

	
	
	if (parseInt(frm.aa.value) < 2011)
	{
		alert ("Data not valid");
		frm.aa.focus();
		return false;
	}
	if (parseInt(frm.aa.value) == 2011)
	{
		if (parseInt(frm.mm.value) < 04)
		{
			alert ("Data not valid");
			frm.mm.focus();
			return false;
		}
		if (parseInt(frm.mm.value) == 04)
		{
			if (parseInt(frm.gg.value) < 01)
			{
				alert ("Data not valid");
				frm.gg.focus();
				return false;
			}
		}
	}

	tot_adulti_pren = 0;
	tot_camere_pren = 0;

	if (parseInt(frm.tot_adulti.value) < 1)
	{
		alert("E' necessario almeno un adulto per continuare la prenotazione");
		frm.tot_adulti.focus();
		return false;
	}

		if (!(parseInt(frm.notti_1.value) > 0))
	{
		alert("E' necessario specificare numero di notti, di adulti e di camere per iniziare la ricerca");
		frm.notti_1.focus();
		return false;
 	}

	
	/*if ((parseInt(frm.tot_bambini.value)>0)&&(parseInt(frm.tot_camere.value)==1))
	{
		tutto_ok = 1;
		for (i=1; i<=parseInt(frm.tot_bambini.value); i++)
		{
			myvar = "st1bamb" + i;
			eta = parseInt(document.getElementById(myvar).value);
			if (eta < 0) tutto_ok = 0;
		}
		if (tutto_ok==0)
		{
			alert("E' necessario specificare l'etÃ  dei bambini per continuare la ricerca");
			frm.st1bamb1.focus();
			return false;
		}
	}*/
	tot_adulti_pren = parseInt(frm.tot_adulti.value);
	tot_camere_pren = parseInt(frm.tot_camere.value);
	/*tot_bambini_pren = parseInt(frm.tot_bambini.value);*/
	tot_occupanti_pren = tot_adulti_pren /*+ tot_bambini_pren*/;
	str = "occ = " + tot_occupanti_pren + " cam = " + tot_camere_pren;
	//alert(str);
	if (tot_occupanti_pren < tot_camere_pren)
	{
		alert("E\' necessario avere almeno una persona per camera");
		frm.tot_adulti.focus();
		return false;
	}
}
function cambia_bambini(n) {
	camere = parseInt(document.frm.tot_camere.value);
	if (n>4) n=4;
	if ((n>0)&&(camere==1))
	{
		content = "<div id=\"Titolo\">EtÃ  bambini:</div><div id=\"Seleziona\">";
		for (i=1; i<=n; i++)
		{
			content += "<select class='myinput' name='st1bamb"+i+"' id='st1bamb"+i+"'>";
			content += "<option value='-1'>-?-</option><option value='0'>&lt;1</option>";
			content += "<option value='1'>1</option>";
			content += "<option value='2'>2</option>";
			content += "<option value='3'>3</option>";
			content += "<option value='4'>4</option>";
			content += "<option value='5'>5</option>";
			content += "<option value='6'>6</option>";
			content += "<option value='7'>7</option>";
			content += "<option value='8'>8</option>";
			content += "<option value='9'>9</option>";
			content += "<option value='10'>10</option>";
			content += "<option value='11'>11</option>";
			content += "<option value='12'>12</option>";
			content += "</select>";			
		}
		document.getElementById("bam_div").innerHTML=content+"</div><div class=\"clear\"></div>";
		document.getElementById("bam_div").style.visibility = "visible";
		document.getElementById("bam_div").style.display = "block";
	} else {
		document.getElementById("bam_div").style.visibility = "hidden";
		document.getElementById("bam_div").style.display = "none";
	}
}
function cambia_camere(n) {
	/*bambini = parseInt(document.frm.tot_bambini.value);
	cambia_bambini(bambini);*/
}
function annulla_zona() {
	// frm = document.getElementById("frm");
	document.frm.zon_tappa_1.options[0].selected = true;
}
function annulla_localita() {
	// frm = document.getElementById("frm");
	document.frm.loc_tappa_1.options[0].selected = true;
}
function vedi_prodotto(id)
{
	window_pmod=window.open("vedi_prodotto.htm?lingua_int=ita&id_albergo=9117&id_prodotto=" + id,"Albergo", "width=512,height=320,resizable=no,menubar=no,scrollbars=yes");
	window_pmod.focus()
}
function pop_calendar(theVars)
{
	theGVar = theVars + "gg";
	gg = document.getElementById(theGVar).value;
	theMVar = theVars + "mm";
	mm = document.getElementById(theMVar).value;
	theAVar = theVars + "aa";
	aa = document.getElementById(theAVar).value;	
	
	//locurl = "calendario.htm?id_stile=6807&lingua_int=ita&gg=" + gg + "&mm=" + mm + "&aa=" + aa + "&vars=" + theVars;
	locurl = "http://www.aec-internet.it/booking_engine/calendario.htm?tipo=inizio&id_stile=6807&lingua_int=ita&gg=" + gg + "&mm=" + mm + "&aa=" + aa + "&vars=" + theVars;
	window.open(locurl,"Calendario", "width=220,height=190,resizable=no,menubar=no,scrollbars=yes");

}

function pop_calendarf(theVars)
{
	theGVar = theVars + "ggf";
	gg = document.getElementById(theGVar).value;
	theMVar = theVars + "mmf";
	mm = document.getElementById(theMVar).value;
	theAVar = theVars + "aaf";
	aa = document.getElementById(theAVar).value;

	locurl = "http://www.aec-internet.it/booking_engine/calendario.htm?tipo_cal=fine&id_stile=6807&lingua_int=ita&gg=" + gg + "&mm=" + mm + "&aa=" + aa + "&vars=" + theVars;
	window.open(locurl,"Calendario", "width=220,height=190,resizable=no,menubar=no,scrollbars=yes");
}

