// variables de configuration
var uriBase = "http://www.nicoweb.fr/ajax/auction-bidder-0-1/";
var urls = new Array();
urls['cslteu'] = uriBase+"cslte.php";
urls['csltbu'] = uriBase+"csltb.php";
urls['csldu'] = uriBase+"csld.php";
urls['cleu'] = uriBase+"cle.php";
urls['aeu'] = uriBase+"ae.php";
urls['cloeu'] = uriBase+"cloe.php";
var firstload = false;

/*
	*
*/
function chargerFenetre () {
	
	chargerSelectListeDevise('selectDevise');
	chargerSelectListeTypeEnchere('selectTypeEnchere');
	chargerSelectListeTrancheBudget('selectTrancheBudget');
	chargerListeEnchere('listeEnchere');
	$('ok_0').disabled = false;
}


/*
	*
*/
function chargerListeEnchere (idEl) {
	
	var opt = { method: 'post' , 
		postBody : "apikey=nicowebauctionbidder01",
		onSuccess: function cles (t) { } , 
		onFailure: function clef (t) { }
	};
	new Ajax.Updater(idEl,urls['cleu'],opt);
}

/*
	*
*/
function chargerSelectListeTypeEnchere (idEl) {
	var opt = { method: 'post' , 
		postBody : "apikey=nicowebauctionbidder01&lng="+$F('selectLangue') ,
		onSuccess: function csltes (t) { } , 
		onFailure: function csltef (t) { }
	};
	new Ajax.Updater(idEl,urls['cslteu'],opt);
}

/*
	*
*/
function chargerSelectListeTrancheBudget (idEl,cd) {
	
	// code devise
	//var cd = null;
	if(firstload == false) { cd = $F('codeDevise'); firstload = true; }
	else {
		if (cd == undefined) cd = !$F('listeDevise');
	}
		
	var opt = { method: 'post' , 
		evalScripts : false,
		postBody : "apikey=nicowebauctionbidder01&lng="+$F('selectLangue')+'&dev='+cd ,
		onSuccess: function csltbs (t) { } , 
		onFailure: function csltbf (t) { }
	};
	new Ajax.Updater(idEl,urls['csltbu'],opt);
}

/*
	*
*/
function chargerSelectListeDevise (idEl) {
	var opt = { method: 'post' , 
		postBody : "apikey=nicowebauctionbidder01&lng="+$F('selectLangue') ,
		onSuccess: function cslds (t) {  } , 
		onFailure: function csldf (t) { }
	};
	new Ajax.Updater(idEl,urls['csldu'],opt);
}

/*
	* 
*/
function ajouterEnchere () {
	
	var opt = { method: 'post' , 
		onSuccess: function aes (t) { chargerListeEnchere('listeEnchere'); } , 
		onFailure: function aef (t) { },
		postBody : Form.serialize('f-ajout-enchere')+"&apikey=nicowebauctionbidder01"
	};
	new Ajax.Updater('retourAjout',urls['aeu'],opt);
}

/*
	*
*/
function chargerListeOffreEnchere (idEl,idEN) {

	var opt = { method: 'post' , 
		postBody : "apikey=nicowebauctionbidder01&lng="+$F('selectLangue')+"&idEN="+idEN,
		onSuccess: function cloes (t) { } , 
		onFailure: function cloef (t) { }
	};

	new Ajax.Updater(idEl,urls['cloeu'],opt);
}