function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function selezionaMarca(ID){	    
    url = document.location.host;    
	url = "http://"+url+"/risultati_ricerca.aspx?IDm="+ID+"";			
	document.forms[0].action = url;
	document.forms[0].submit();
}


function prenota(){	    
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/prenota.aspx?from=post";			
	document.forms[0].action = url;
	//document.forms[0].submit();
}

function procediCarta() {
    url = document.location.host;
    url = "http://" + url + "/areaRiservata/pagaSetefi.asp";
    document.forms[0].action = url;
}


function vaiKiros(){	        
	url = "https://www.kirosrent.com/cgi-bin/kfs2/kfs_popup_ws.cgi";				
	document.forms[0].target="_blank"
	document.forms[0].action = url;
	document.forms[0].submit();
}

function addCarrello(){	        
	url = document.location.host;    
	url = "http://"+url+"/carrelloAdd.aspx";			
	document.forms[0].action = url;
	//document.forms[0].submit();
}

function tornaCatalogo(){	        
	url = document.location.host;    
	url = "http://"+url+"/areaRiservata/catalogo_prodotti.aspx";		
	document.forms[0].action = url;
	
}

// Funzione utilizzata nel carrello per aggiornare
function aggiorna(){	
    url = document.location.host;    
	url = "http://"+url+"/carrelloEdit.aspx";		
	document.forms[0].action = url;
}

// Funzione utilizzata procedere
function procedi(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step3.aspx";		
	document.forms[0].action = url;
}

// Funzione indietro
function indietro(){	   
	url = "javascript:history.back(-1);";		
	document.forms[0].action = url;	
}

function contrCodice(ID) {
    url = document.location.host;
    url = "http://" + url + "/scheda_prodotto.aspx?ID="+ID+"&from=post";
    document.forms[0].action = url;
}

// Funzione utilizzata indietro carrello 3
function indietroCarrello(){	
    url = document.location.host;    
	url = "http://"+url+"/carrello.aspx?from=prev";		
	document.forms[0].action = url;
}

// Funzione utilizzata indietro carrello 3
function indietroStep2(){	
    url = document.location.host;    
	url = "http://"+url+"/carrello.aspx?from=prev";		
	document.forms[0].action = url;
}

// Funzione utilizzata indietro carrello 3
function indietroStep3(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step3.aspx?from=prev";		
	document.forms[0].action = url;
}

// Funzione utilizzata indietro carrello 4
function indietroStep4(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step4.aspx?from=prev";		
	document.forms[0].action = url;
}

// Funzione utilizzata indietro carrello 5
function indietroStep5(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step5.aspx?from=prev";		
	document.forms[0].action = url;
}

function indietroStep6(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step6.aspx?from=prev";		
	document.forms[0].action = url;
}


function indietroStep7(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step7.aspx?from=prev";		
	document.forms[0].action = url;
}

function indietroStep7NoSped(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step6.aspx?from=prev";		
	document.forms[0].action = url;
}

function indietroStep8(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step8.aspx?from=prev";		
	document.forms[0].action = url;
}

function indietroStep9(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step9.aspx?from=prev";		
	document.forms[0].action = url;
}


// Funzione utilizzata procedere carrello 3
function procediCarStep3(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step3.aspx";		
	document.forms[0].action = url;
}

// Funzione utilizzata procedere carrello 4
function procediCarStep4(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step4.aspx";		
	document.forms[0].action = url;
}

// Funzione utilizzata procedere carrello 5
function procediCarStep5(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step5.aspx";		
	document.forms[0].action = url;
}

// Funzione utilizzata procedere carrello 6
function procediCarStep6(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step6.aspx";		
	document.forms[0].action = url;
}

function procediCarStep7(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step7.aspx";		
	document.forms[0].action = url;
}

function procediCarStep8(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step8.aspx";		
	document.forms[0].action = url;
}

function procediCarStep8NoSped(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/carrello_step8.aspx?prov=noSped";		
	document.forms[0].action = url;
}


function procediCarStep9(){	
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/bivio.aspx";		
	document.forms[0].action = url;
}

// Funzione utilizzata procedere kiros
function procediCarStep10(){	    
	url = "https://www.kirosrent.com/cgi-bin/kfs2/kfs_calc_ws.cgi";		
	document.forms[0].target="_blank"
	document.forms[0].action = url;
}



function ricerca(){	        
    url = document.location.host;    
	url = "http://"+url+"/risultati_ricerca.aspx";			
	document.forms[0].action = url;
	document.forms[0].submit();
}

function countAreaChars(areaName,counter,limit)
{	
	if (areaName.value.length>limit)
		areaName.value=areaName.value.substring(0,limit);
	else{
		counter.value = limit - areaName.value.length;			
	}	
}

function show_cal(el,campo) {		
	if (cal_obj2) return;
	var data = document.getElementById(""+campo+"");
	cal_obj2 = new RichCalendar();
	cal_obj2.start_week_day = 2;
	cal_obj2.show_time = false;
	cal_obj2.language = 'ru';
	if (campo=="valido_dal")
	    cal_obj2.user_onchange_handler = cal2_on_change;
	else if (campo=="valido_al")
	    cal_obj2.user_onchange_handler = cal2_on_change2;	
	cal_obj2.user_onclose_handler = cal2_on_close;
	cal_obj2.user_onautoclose_handler = cal2_on_autoclose;

	cal_obj2.parse_date(data.value, format);

	cal_obj2.show_at_element(data, "adj_right-top");
	cal_obj2.change_skin('alt');
}

// user defined onchange handler
function cal2_on_change(cal, object_code,campo) {    
	if (object_code == 'day') {
		document.getElementById("valido_dal").value = cal.get_formatted_date(format);
		cal.hide();
		cal_obj2 = null;
	}
}

function cal2_on_change2(cal, object_code,campo) {    
	if (object_code == 'day') {
		document.getElementById("valido_al").value = cal.get_formatted_date(format);
		cal.hide();
		cal_obj2 = null;
	}
}

// user defined onclose handler (used in pop-up mode - when auto_close is true)
function cal2_on_close(cal) {
	if (window.confirm('Are you sure to close the calendar?')) {
		cal.hide();
		cal_obj2 = null;
	}
}

// user defined onautoclose handler
function cal2_on_autoclose(cal) {
	cal_obj2 = null;
}


function login(){	    
    url = document.location.host;    
	url = "http://"+url+"/login.aspx?from=login";			
	document.forms[0].action = url;
	document.forms[0].submit();
}

function primoAccesso(){	    
    url = document.location.host;    
	url = "http://"+url+"/registrazione.aspx?from=cod";			
	document.forms[0].action = url;
	document.forms[0].submit();
}

function inserisci(){	    
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/inserimento_step2.aspx";			
	document.forms[0].action = url;	
}

function inserisci2(){	    
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/inserimento_step3.aspx";			
	document.forms[0].action = url;
}

function inserisci3(){	    
    url = document.location.host;    
	url = "http://"+url+"/service.aspx?trouble=ins";			
	document.forms[0].action = url;	
}


function confermaAgg(){	    
    url = document.location.host;    
	url = "http://"+url+"/service.aspx?trouble=agg";			
	document.forms[0].action = url;
	//document.forms[0].submit();
}


function gestisciMex(from){			
    url = document.location.host;   
	if (from=="modifica"){
	    url = "http://"+url+"/areaRiservata/messaggi.aspx?trouble=mod";						
	}else if (from=="attivazione"){
		url = "http://"+url+"/areaRiservata/messaggi.aspx?trouble=att";
	}else if (from=="sospensione"){
		url = "http://"+url+"/areaRiservata/messaggi.aspx?trouble=sosp";	    
	}
	document.forms[0].action = url;	
	document.forms[0].submit();
}

function vaiARegistrati(){	    
    url = document.location.host;    
	url = "http://"+url+"/registrazione_step1.aspx";			
	document.forms[0].action = url;
	//document.forms[0].submit();
}

function registrati(){	    
    url = document.location.host;    
	url = "http://"+url+"/registrazione_step1.aspx?from=post";			
	document.forms[0].action = url;
	//document.forms[0].submit();
}

function registrati2(){	    
    url = document.location.host;    
	url = "http://"+url+"/registrazione_step2.aspx?from=post";			
	document.forms[0].action = url;
	//document.forms[0].submit();
}

function ricorda(){	        
    url = document.location.host;    
	url = "http://"+url+"/ricorda.aspx?from=post";			
	document.forms[0].action = url;
	//document.forms[0].submit();
}

function modifica(){	    
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/modifica_step2.aspx";			
	document.forms[0].action = url;
	//document.forms[0].submit();
}

function modifica2(){	    
    url = document.location.host;    
	url = "http://"+url+"/modifica_step2.aspx";			
	document.forms[0].action = url;
	//document.forms[0].submit();
}

function vaiAMessaggi(){	    
    url = document.location.host;    
	url = "http://"+url+"/areaRiservata/inserimento.aspx";			
	document.forms[0].action = url;
	//document.forms[0].submit();
}

function inviaSond() {
    url = document.location.host;
    url = "http://" + url + "/sondaggi.aspx";
    document.forms[0].action = url;
    document.forms[0].submit();
}

function controllo() 
{
var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;

if (!email_reg_exp.test(document.forms[0].email.value) || (document.forms[0].email.value == "")) 
{
   alert("ATTENZIONE: Non inserire un indirizzo email corretto.");
   document.forms[0].email.focus();
   return false;
}
return true;
}
