advAJAX.setDefaultParameters({
    onError : function(obj) {
        myAlert("Error during the connection: " + obj.status);
    }
	
});
function getOfferteForLotto(id, blank)
{
advAJAX.post({
    url: "ajx/getOfferteFromLottiIds.php",
    parameters : {
      "id" : id,
	  "blank" : blank
    },
    onSuccess : function(obj) { getOfferteForLotto_exe(obj,id); } 
     
});
}	
function deleteFoto(id_t)
	{
	advAJAX.get({
		url: "ajx/deleteFoto.php",
		parameters : {
		  "id_t" : id_t
		
		},
		  
		onSuccess : function(obj) { deleteFoto_exe(obj,id_t); } 
		
	});
}
function getCreditiLotto(id )
{
advAJAX.post({
    url: "ajx/getCreditiFromLottiIds.php",
    parameters : {
      "id" : id
	  
    },
    onSuccess : function(obj) { getCreditiLotto_exe(obj,id); } 
     
});
}


function getCreditiLottoA(arrId )
{
advAJAX.post({
    url: "ajx/getCreditiFromLottiIdsA.php",
    parameters : {
      "id" : arrId
	  
    },
    onSuccess : function(obj) { getCreditiLottoA_exe(obj); } 
     
});
}

function updateTopTxt( )
{
advAJAX.post({
    url: "ajx/getAsteInCorso.php",
      
    onSuccess : function(obj) { updateTopTxt_exe(obj); } 
     
});
}
/////funzioni utente
function getColSx()
{
advAJAX.get({
    url: "ajx/getColSx.php", 
    onSuccess : function(obj) { getColSx_exe(obj); }   
});
}

function deleteOffertaRange(id_l)
{
advAJAX.post({
    url: "ajx/deleteOffertaRangeForUser.php",
    parameters : {
      "id_lotto" : id_l
	  
    }, 
    onSuccess : function(obj) { deleteOffertaRange_exe(obj,id_l); }  
});
}


function deleteOfferta(id_o, id_l)
{
advAJAX.post({
    url: "ajx/deleteOffertaForUser.php",
    parameters : {
      "id_lotto" : id_l,
	  "id_offerta" : id_o
    },
      
    onSuccess : function(obj) { deleteOffertaRange_exe(obj,id_l); } 
    
});
}
function sendOfferta(id_l, blank)
{
var objIntOffTxt = MM_findObj('intOffertaFld' + id_l);
advAJAX.post({
    url: "ajx/setOffertaForUser.php",
    parameters : {
      "id_lotto" : id_l ,
	  "intOff" : objIntOffTxt.value
    },
      
    onSuccess : function(obj) { sendOfferta_exe(obj,id_l,blank); } 
     
});
}
function sendOffertaRange(id_l, blank)
{
var objIntOffTxt = MM_findObj('intOffertaFld' + id_l);
var objIntOffStartTxt = MM_findObj('intOffertaFldStart' + id_l);
var objIntOffEndTxt = MM_findObj('intOffertaFldEnd' + id_l);

var submitMultipleObj = MM_findObj('submitMultiple' + id_l);
var submitSingleObj = MM_findObj('submitSingle' + id_l);


advAJAX.post({
    url: "ajx/setOffertaForUser.php",
    parameters : {
      "id_lotto" : id_l ,
	  "intOff" : objIntOffTxt.value,
	  "intStartOff" : objIntOffStartTxt.value ,
	  "intEndOff" : objIntOffEndTxt.value ,
	  "range":1
    },
      
    onSuccess : function(obj) { sendOffertaRange_exe(obj,id_l,blank); } 
     
});
}

function getOmaggioDelayedB()
{
	
    var objRimb = MM_findObj('ricaricaPrecedente');
    var rimb = objRimb.value
	var objTxt = MM_findObj('importo_txt');
    var valore = objTxt.value
	
advAJAX.get({
    url: "ajx/getOmaggioB.php",
    parameters : {
      "val" : valore ,
	  "rimb" : rimb
    },
      
    onSuccess : function(obj) { getOmaggioDelayedB_exe(obj,valore); } 
     
});
}

function getOmaggioDemoDelayedB()
{
	
   
	var objTxt = MM_findObj('importo_txt');
    var valore = objTxt.value
	
advAJAX.get({
    url: "ajx/getOmaggioBDemo.php",
    parameters : {
      "val" : valore 
	   
    },
      
    onSuccess : function(obj) { getOmaggioDelayedB_exe(obj,valore); } 
     
});
}




function getOmaggioDemoDelayedB2()
{
	
   
	var objTxt = MM_findObj('importo_txt2');
    var valore = objTxt.value
	
advAJAX.get({
    url: "ajx/getOmaggioBDemo.php",
    parameters : {
      "val" : valore, 
	  "gold" : 1 
    },
      
    onSuccess : function(obj) { getOmaggioDemoDelayedB_exe(obj,valore); } 
     
});
}






function getOmaggioDelayed(valore)
{
    
	var objTxt = MM_findObj('importo_txt');
    var valore = objTxt.value
	
advAJAX.get({
    url: "ajx/getOmaggio.php",
    parameters : {
      "val" : valore  
    },
      
    onSuccess : function(obj) { getOmaggioDelayed_exe(obj,valore); } 
     
});
}

function confirmSrv(id_t, id_l)
	{
	advAJAX.get({
		url: "ajx/confirmSrv.php",
		parameters : {
		  "id_t" : id_t,
		  "id_l" : id_l
		},
		  
		onSuccess : function(obj) { confirmSrv_exe(obj,id_l); } 
		
	});
	}

function logIn(redir)
{

var objUser = MM_findObj('nome_utente');
var objPwd = MM_findObj('pwd_utente_log');

advAJAX.post({
    url: "ajx/setLogin.php",
    parameters : {
      "nick_utente" : objUser.value,
	  "pwd_utente" : objPwd.value
    },
      
    onSuccess : function(obj) { logIn_exe(obj,redir); },
    onError : function(obj) { myAlert("Error: " + obj.status); }
});
}




function getRplogOrdine(id,imp,country)
{
    
	advAJAX.get({
		url: "ajx/getRplogOrdine.php",
		parameters : {
		  "id" : id,
		  "imp" : imp,
		  "country" : country
		},
		  
		onSuccess : function(obj) { getRplogOrdine_exe(obj,imp,country); } 
     
	});
}




function setTz(){
	var rightNow = new Date();
	var jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0);
	var temp = jan1.toGMTString();
	var jan2 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
	var std_time_offset = (jan1 - jan2) / (1000 * 60 * 60);
	var june1 = new Date(rightNow.getFullYear(), 6, 1, 0, 0, 0, 0);
	temp = june1.toGMTString();
	var june2 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
	var daylight_time_offset = (june1 - june2) / (1000 * 60 * 60);
	var dst;
	if (std_time_offset == daylight_time_offset) {
		dst = "0"; // daylight savings time is NOT observed
	} else {
		dst = "1"; // daylight savings time is observed
	}
	document.timezone=std_time_offset;
	advAJAX.get({
		url: "ajx/setTz.php",
		parameters : {
		  "tz" : std_time_offset,
		  "dst" : dst
		},
		  
		onSuccess : function(obj) { return true; } 
	});
}




