if(this.SAMEH == undefined)
{
	SAMEH = {};

}

if(window.console == undefined)
{
	window.console = {log: function(s){}};	
}

SAMEH.UIClass = new  Class.create();
SAMEH.UIClass.prototype = {
		
		
		
		initialize: function()
		{
		},
		
		updateFamily: function(code)
		{
			//$("loading_1").update("");
			$("loading_1").update(SAMEH.Chargement);
			new Ajax.Request("euro_perf.php?",
			{
				method: 'post',
				parameters: {action: "family", 
							 code: code},
				onSuccess: function(val, json){ 
					$("perf_cat").update(val.responseText);
					selectReplacement($("actions_euro"));
					selectReplacement2($("capital"));
					selectReplacement($("famille_euro"));
					//selectReplacement($("top_5"));
	         	}.bind(this)
			});
			//selectReplacement(s[i]);
		},
		updateCategorie: function (n)
		{
			new Ajax.Request("euro_perf.php?",
				{
					method: 'post',
					parameters: {action: "perf", 
								 code: n},
					onSuccess: function(val, json){ 
						$("palmares_perf_encart_left").update(val.responseText);
						
		         	}.bind(this)
				});
		},
		
		callback: function(a, b)
		{
			try
			{
				b = b.split(";");
				//window.console.log(b[0] + ", "  + b[1]+ ", "  + b[2]+ ", "  + b[3]);
				if(b[0] == "famille")
				{
					this.updateFamily(b[2]);
				}
				else
				if(b[0] == "top_5")
				{					
					$("loading_2").update(SAMEH.Chargement);
					new Ajax.Request("euro_perf.php?",
					{
						method: 'post',
						parameters: {action: "top_5", 
									 code: b[3]},
						onSuccess: function(val, json){ 
							$("top_5_lists").update(val.responseText);
							selectReplacement($("top_5"));
			         	}.bind(this)
					});
				}
				else
				if(b[0] == "perf" && b[1] == "type")
				{
					//$("loading_1").update("");
					$("loading_1").update(SAMEH.Chargement);
					new Ajax.Request("euro_perf.php?",
					{
						method: 'post',
						parameters: {action: "type", 
									 code: b[3]},
						onSuccess: function(val, json){ 
							 $("perf_cat").update(val.responseText);
								selectReplacement($("actions_euro"));
								selectReplacement2($("capital"));
								selectReplacement($("famille_euro"));
			         	}.bind(this)
					});
				}
				else
				if(b[0] == "perf" && b[1] == "categorie")
				{
					//$("loading_1").update("");
					$("loading_1").update(SAMEH.Chargement);
					new Ajax.Request("euro_perf.php?",
					{
						method: 'post',
						parameters: {action: "categorie", 
									 code: b[3]},
						onSuccess: function(val, json){
							 $("perf_cat").update(val.responseText);
								selectReplacement($("actions_euro"));
								selectReplacement2($("capital"));
								selectReplacement($("famille_euro"));
			         	}.bind(this)
					});
				}
				
			}
			catch(e){}
			
		}
}

SAMEH.UI = new SAMEH.UIClass ();