<!--

var dtCh= "/";
var minYear=1900;
var maxYear=2100;
function cercaUsato() {
  if ($('ricUsaId').value.length>0) {
    document.location.href="/"+$('ricUsaId').value+"/cercaUsato.html"
  } else {
    alert(messaggio25)
  }
  return false;
}
function inviaRichiestaInfo(dove,cosa) {
  var myURL="/formInfo/"
	new Ajax.Updater(dove,  myURL, {
								asynchronous:true,
								evalScripts:true,
								parameters:Form.serialize(cosa)
							}
					);
}
function richInfo(dove,ID) {
  new Ajax.Updater(dove, "/formInfo/formInfo.html?ID="+ID ,
						{
							asynchronous:true,
							evalScripts:true,
							encoding:'UTF-8'
						}
					);
}

function richInfoAss(dove,ID) {
  new Ajax.Updater(dove, "/formInfoAss/formInfoAss.html?ID="+ID ,
						{
							asynchronous:true,
							evalScripts:true,
							encoding:'UTF-8'
						}
					);
}

function updateComboTipoRic(){
  var myURL="/loadMyComboTipoRic/"
	new Ajax.Updater("myTipoRic",  myURL, {
								asynchronous:true,
								evalScripts:true,
								parameters:Form.serialize('ricRicForm')
							}
					);
}

function delBox(item){
	  $("floater"+item).hide();
 }

function viewBox(item){
	$("floater"+item).show();
}

function loadswf(swf,w,h){
	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"");
	document.write("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\"");
	document.write("width=\""+w+"\" height=\""+h+"\">");
	document.write("<param name='movie' value='"+swf+"' />\n");
	document.write("<param name='quality' value='high' /><param name='wmode' value='transparent' />\n");
	document.write("<embed src=\""+swf+"\" quality=\"high\" wmode=\"transparent\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+w+"\" height=\""+h+"\"></embed>");
	document.write("</object>\n");
}

function popupwh(scelta,w,h){
	finestra = window.open(scelta,'AREADMIN','scrollbars=yes,resizable=NO,width='+w+',height='+h+',status=no,location=no,toolbar=no,left=50,top=50');
	finestra.focus();
}

function chiamaMetodo(lev, mov) {
	var IE = navigator.appName.indexOf("Microsoft") != -1;
	var filmato = IE ? window.mainMovie : window.document.mainMovie;
	filmato.LoadMovie(lev, mov);
}

function checkMail(mail){
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(mail)){
		return true;
	}else{
		return false;
	}
}

var initI=0
function scrollMenu() {
	var boxTop=document.getElementById('divScroll')
	if (boxTop!=undefined && boxTop!=null){
		if (document.body.scrollTop-274>0) {
			posizione=Math.floor((initI+((document.body.scrollTop-274)))/2)
			boxTop.style.marginTop = posizione
			initI=posizione
		} else {
			boxTop.style.marginTop = 0
			initI=0
		}
	}
}

function loadApp(qualeDiv,qualePagina,alCompletamento){
	new Ajax.Updater(qualeDiv, qualePagina ,
						{
							asynchronous:true,
							evalScripts:true,
							encoding:'UTF-8',
							onComplete:alCompletamento
						}
					);
}

function richiesta(qualeDiv,ilForm,qualePagina){
	new Ajax.Updater(qualeDiv, qualePagina , {
												asynchronous:true,
												evalScripts:true,
												parameters:Form.serialize(ilForm)
											}
					);
	return false;
}


function ApriChiudi(oggetto){
	if($(oggetto).style.display=='none'){
		new Effect.SlideDown(oggetto, { duration: 0.5 });
	}else{
		new Effect.SlideUp(oggetto, { duration: 0.5 });
	}
}

function apri_chiudi(oggetto) {
	var ele = document.getElementById(oggetto);
	if (ele.style.display=="none") {
		ele.style.display="";
	} else {
		ele.style.display="none";
	}
}

function apri_chiudi_par(oggetto,id) {
	var ele = document.getElementById(oggetto);
	var btn_Apri = document.getElementById('btnApri_'+id);
	var btn_Chiudi = document.getElementById('btnChiudi_'+id);
	
	if (ele.style.display=="none") {
		ele.style.display="";
		btn_Chiudi.style.display="";
		btn_Apri.style.display="none";
		
	} else {
		ele.style.display="none";
		btn_Chiudi.style.display="none";
		btn_Apri.style.display="";
	}
}

function apriScheda(quale){
	var altezza = $('contenitore').getHeight();
	var theBody = document.getElementsByTagName("body")[0]
	
	if($('overlayVideo')!=null){
		$('overlayVideo').remove()
	}
	if($('contenitoreVideo')!=null){
		$('contenitoreVideo').remove()
	}
	
	var divvone = new Element('div', {'class': 'divvone','id': 'overlayVideo'});
	divvone.setStyle({width : theBody.clientWidth, height:altezza, display:'none'});
	
	var divvone2 = new Element('div', {'class': 'divvone2','id':'contenitoreVideo'});

	theBody.appendChild(divvone)
	theBody.appendChild(divvone2)
	

	margineSinistro = parseInt((theBody.clientWidth-900) / 2);
	$('contenitoreVideo').style.left =  margineSinistro + 'px';
	$('contenitoreVideo').style.top =  0+ 'px';
	
	new Ajax.Updater('contenitoreVideo', '/includes/coll.asp?id_220='+quale,
		{
			asynchronous:true,
			evalScripts:true,
			encoding:'UTF-8',
			onComplete:	new Effect.Appear('contenitoreVideo', { duration: 0.7,from:0.2,to:1})
		}
	);
	new Effect.Appear('overlayVideo', { duration: 0.4,from:0.2,to:0.7});
	
		$('overlayVideo').observe('click', function(event){
		Element.stopObserving('overlayVideo');
		$('overlayVideo').remove();
		$('contenitoreVideo').remove();
	});
}

function chiudiOverlay(){
	Element.stopObserving('overlayVideo');
	$('overlayVideo').remove();
	$('contenitoreVideo').remove();
}



function chiudi_collezione(oggetto) {
	var ele = document.getElementById(oggetto);
	new Effect.SlideUp(ele, { duration: 0.5 });
}

function coloraBordo(oggetto) {
	var ele = document.getElementById(oggetto);
	ele.style.border = '2px #E0C985 solid';
}

function ScoloraBordo(oggetto) {
	var ele = document.getElementById(oggetto);
	ele.style.border = '2px #fff solid';
}

function apri_collezione(oggetto, id_210_attuale, id_210, id_220) {
	var ele = document.getElementById(oggetto);
	new Ajax.Updater(ele, '/includes/coll.asp?id_210_attuale='+id_210_attuale+'&id_210='+id_210+'&id_220='+id_220,
		{
			asynchronous:true,
			evalScripts:true,
			encoding:'UTF-8',
			onComplete:Effect.Appear(ele,{duration:0.1,from:0,to:1})
		}
	);
}

function chiudi_collezione(oggetto, boxCollezione) {
	var ele = document.getElementById(oggetto);
	var box = document.getElementById(boxCollezione);
	new Effect.Fade(ele, {duration:0.1,from:1,to:0});
	box.style.border = '2px #fff solid';
}

function ApriChiudiNewsletter(){
	if($('newsletterLogin').style.display=='none'){
		new Effect.SlideDown('newsletterLogin', { duration: 0.5 });
	}else{
		new Effect.SlideUp('newsletterLogin', { duration: 0.5 });
	}
}

function ApriChiudiPwdPersa(){
	if($('pwdPersa').style.display=='none'){
		new Effect.SlideDown('pwdPersa', { duration: 0.5 });
	}else{
		new Effect.SlideUp('pwdPersa', { duration: 0.5 });
	}
}

function ApriProdotti(id_210){
	new Effect.SlideDown('prod_collez_'+id_210, { duration: 0.5 });
}

function ChiudiProdotti(id_210){
	new Effect.SlideUp('prod_collez_'+id_210, { duration: 0.5 });
}

function ApriChiudiProdotti(id_210){
	if($('prod_collez_'+id_210).style.display=='none'){
		new Effect.SlideDown('prod_collez_'+id_210, { duration: 0.5 });
	}else{
		new Effect.SlideUp('prod_collez_'+id_210, { duration: 0.5 });
	}
}

function ApriChiudiScheda(id_220){
	if($('scheda_collez_'+id_220).style.display=='none'){
		new Effect.SlideDown('scheda_collez_'+id_220, { duration: 0.5 });
	}else{
		new Effect.SlideUp('scheda_collez_'+id_220, { duration: 0.5 });
	}
}

function confermaurl(Viewtesto,urltogo){
	if (confirm(Viewtesto))
	{
		document.location.href=urltogo
	}
}
function inviaEmailWald() {
	var myURL="/includes/function_contatti.asp"
	new Ajax.Updater("emailChange",  myURL, {
								asynchronous:true,
								evalScripts:true,
								parameters:Form.serialize('emailForm')
							}
	);
}
function inviaEmail() {
	var myURL="/includes/function_contatti2.asp"
	new Ajax.Updater("emailChange",  myURL, {
								asynchronous:true,
								evalScripts:true,
								parameters:Form.serialize('emailForm')
							}
	);
}
function inviaEmailOperatore() {
	var myURL="/includes/function_contatti3.asp"
	new Ajax.Updater("emailChangeOperatore",  myURL, {
								asynchronous:true,
								evalScripts:true,
								parameters:Form.serialize('emailFormOperatore')
							}
	);
}

function stopUpload(success,messaggio){
	var result = '';
	if (success == 1){
		$('result').innerHTML ='<div class="msg">'+ messaggio +'<\/div>';
		$('fileUpload').value ='';
		loadFileUpload();
	}else{
		$('result').innerHTML ='<div class="emsg">'+ messaggio +'<\/div>';
	}
	$('f1_upload_process').style.visibility = 'hidden';
	return true;
}

function startUpload(){
	$('f1_upload_process').style.visibility = 'visible';
	return true;
}


function loadFileUpload(idDel){
	if (idDel==undefined || idDel=='undefined'){
		para = ""
	}else{
		para = "?del="+idDel
	}
	new Ajax.Updater("contieniUpload", '/loadUploadFile.asp'+para ,
						{
							asynchronous:true,
							evalScripts:true,
							encoding:'UTF-8'
						}
					);
}
function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function convdate(vdata)
{
	var strdata=vdata
	var strgiorno="0"+strdata.substring(0,strdata.indexOf("/"))
	strgiorno=strgiorno.slice(-2)
	strdata=strdata.substring(strdata.indexOf("/")+1)
	var strmese="0"+strdata.substring(0,strdata.indexOf("/"))
	strmese=strmese.slice(-2)
	strdata=strdata.substring(strdata.indexOf("/")+1)
	if (strdata.length>1) {
		var stranno="20"+strdata
	} else {
		var stranno="200"+strdata
	}
	stranno=stranno.slice(-4)
	strdata=stranno+strmese+strgiorno
	strdata=parseInt(strdata)
	return strdata
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		return false
	}
return true
}

function apriChiudiForm(){
	if($('formWald').style.display=='none'){
		new Effect.SlideDown('formWald', { duration: 0.5 });
	}else{
		new Effect.SlideUp('formWald', { duration: 0.5 });
	}
}

function controlla(obbligatorio,nome,campo_data,campo_numero,campo_user,campo_pwd){
	var sAgent = navigator.userAgent.toLowerCase() ;
	var elemento = document.getElementById(nome)
	len =elemento.elements.length;
	var i=0;
	var campo=' I seguenti campi obbligatori sono stati lasciati vuoti o il loro contenuto non e\' valido.:\n'
	var passa=true
	campo=campo+'_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\n\t\t '
	for( i=0 ; i<len ; i++) {
		if (elemento.elements[i].name.length > 0)
		{
			if (elemento.elements[i].name.indexOf(obbligatorio)>0 & elemento.elements[i].value.length<=0 ) {
				campo=campo+' # '+elemento.elements[i].title+' # \n\n\t\t '
				passa=false
			} else if (elemento.elements[i].name.indexOf(campo_user)>0 & elemento.elements[i].value.length<=5) {
				campo=campo+' # '+elemento.elements[i].title+' # \n\n\t\t '
				passa=false
			} else if (elemento.elements[i].name.indexOf(campo_pwd)>0 & elemento.elements[i].value.length<=5) {
				campo=campo+' # '+elemento.elements[i].title+' # \n\n\t\t '
				passa=false
			} else {
				if (elemento.elements[i].name.indexOf(campo_data) > 0 & !isDate(elemento.elements[i].value) &  elemento.elements[i].value.length > 0) {
						alert(elemento.elements[i].value + ' - ' + elemento.elements[i].name);
					campo=campo+' # '+elemento.elements[i].title+ ' - ' + elemento.elements[i].name+' # \n\n\t\t '
					passa=false
				}else if (elemento.elements[i].name.indexOf(campo_numero)>0 & isNaN(elemento.elements[i].value.replace(',','.')) & elemento.elements[i].value.length > 0) {
					campo=campo+' # '+elemento.elements[i].title+' # \n\n\t\t '
					passa=false
				}
			}
		}
	}
	campo=campo+'\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ '
	if (passa){
		return true;
	}else{ 
		alert(campo)
		return false;
	}
}

function popup(scelta){
	finestra = window.open(scelta,'EuroRent Italia','scrollbars=yes,resizable=NO,width=500,height=300,status=no,location=no,toolbar=no,left=50,top=50');
	finestra.focus();
}
//-->

