/** VARIABLE GLOBAL **/

/*joueur*/
var pv_joueur = 40;
var attaque_joueur = 0;
var defense_joueur = 0;
var special_joueur = 0;
/*adversaire*/
var pv_adversaire = 40;
var attaque_adversaire = 0;
var defense_adversaire = 0;
var special_adversaire = 0;
/*nombre actions joueurs*/
var nb_attaque = 0;
var nb_defense = 2;
var nb_charge = 0;
var nb_special = 0;
/*nombre actions adversaires*/
var nb_attaque_a = 0;
var nb_defense_a = 2;
var nb_charge_a = 0;
var nb_special_a = 0;
/*nom*/
var joueur = 0;
var adversaire = 0;
/*ic*/
var ic_j = 0;
var ic_a = 0;
var timer_j = 0;
var timer_a = 0;

/**INITIALISATION**/
function initialisation(){


	/*AJAX*/
	var info_joueur = $F("info_joueur");
	var info_adversaire = $F("info_adversaire");
	
	new Ajax.Request(
		'php/scripts_combat/initialisation_combat.php',{
			method : "post",
			parameters :{
			},onComplete : initialisation_combat_onComplete
		}
	);
	/**/
	function initialisation_combat_onComplete(requete,json){
		/*joueurs*/
		pv_joueur = json.pv_j;
		attaque_joueur = json.attaque_j;
		defense_joueur = json.defense_j;
		special_joueur = json.special_j;
		/*adversaire*/
		pv_adversaire = json.pv_a;
		attaque_adversaire = json.attaque_a;
		defense_adversaire = json.defense_a;
		special_adversaire = json.special_a;
		/*nom*/
		joueur = json.j;
		adversaire = json.a;
		/*ic*/
		ic_j = json.ic_joueur;
		ic_a = json.ic_adversaire;
	}
	/*scripts*/
	Event.observe("attaque","click",attaque);
	Event.observe("charge","click",charge);
	Event.observe("defense","click",defense);
	Event.observe("special","click",special);
	/*desactiver les bouton*/
	setTimeout("enableIni()",700);
	
	
	
}//function initialisation(){
/*********************************/
function enableIni(){$("defense").disabled = $("charge").disabled = false;}
/**CHARGEMENT**/
Event.observe(window, "load", initialisation);
/*clignotement*/
function clignotement_j(){
//rgb(255, 0, 0)	red	#FF0000
//rgb(51, 51, 51) gris	#333333
	if($("a_jj").style.backgroundColor == 'rgb(255, 0, 0)' || $("a_jj").style.backgroundColor == '#FF0000')
	$("a_jj").style.backgroundColor = '#333333';
	else	$("a_jj").style.backgroundColor = '#FF0000'
  //if($("MonElement").style.backgroundColor == 'rgb(0, 153, 0)')alert('a');
}
function clignotement_a(){
//rgb(255, 0, 0)	red	#FF0000
//rgb(51, 51, 51) gris	#333333
	if($("a_ja").style.backgroundColor == 'rgb(255, 0, 0)' || $("a_ja").style.backgroundColor == '#FF0000')
	$("a_ja").style.backgroundColor = '#333333';
	else	$("a_ja").style.backgroundColor = '#FF0000'
  //if($("MonElement").style.backgroundColor == 'rgb(0, 153, 0)')alert('a');
}

