function Vins_Hover(){
	View_All();
	document.Vins.src='images/Icone-Vins-Hover.gif';
}

var image1 = preload('images/Icone-Vins-Hover.gif');

function Vins_Out(){
	Hide_All();
	document.Vins.src='images/Icone-Vins.gif';
}

function Promos_Hover(){
	View_All();
	document.Promos.src='images/Icone-receptions_banquets-Hover.gif';
}

function Promos_Out(){
	Hide_All();
	document.Promos.src='images/Icone-receptions_banquets.gif';
}

function Spiritueux_Hover(){
	View_All();
	document.Spiritueux.src='images/Icone-Spiritueux-Hover.gif';
}

var image2 = preload('images/Icone-Spiritueux-Hover.gif');

function Spiritueux_Out(){
	Hide_All();
	document.Spiritueux.src='images/Icone-Spiritueux.gif';
}

function Cadeaux_Hover(){
	View_All();
	document.Cadeaux.src='images/Icone-Cadeaux_societes-Hover.gif';
}

var image3 = preload('images/Icone-Cadeaux_societes-Hover.gif');

function Cadeaux_Out(){
	Hide_All();
	document.Cadeaux.src='images/Icone-Cadeaux_societes.gif'
}

function Cafe_Hover(){
	View_All();
	document.Cafe.src='images/Icone-Cafe_machines_illy-Hover.gif';
}

var image4 = preload('images/Icone-Cafe_machines_illy-Hover.gif');

function Cafe_Out(){
	Hide_All();
	document.Cafe.src='images/Icone-Cafe_machines_illy.gif';
}

function News_Hover(){
	View_All();
	document.News.src='images/Icone-eaux_culligan-Hover.gif';
}

var image5 = preload('images/Icone-eaux_culligan-Hover.gif');

function News_Out(){
	Hide_All();
	document.News.src='images/Icone-eaux_culligan.gif';
}

function Receptions_Hover(){
	View_All();
	document.Receptions.src='images/Icone-receptions_banquets-Hover.gif';
}

var image6 = preload('images/Icone-receptions_banquets-Hover.gif');

function Receptions_Out(){
	Hide_All();
	document.Receptions.src='images/Icone-receptions_banquets.gif';
}

function Down_Hover(){
	View_All();
	document.Down.src='images/Icone-Vins-Hover.gif';
}

function Down_Out(){
	Hide_All();
	document.Down.src='images/Icone-Vins.gif';
}

function Commande_Hover(){
	View_All();
	document.Commande.src='images/Icone-Spiritueux-Hover.gif';
}

function Commande_Out(){
	Hide_All();
	document.Commande.src='images/Icone-Spiritueux.gif';
}

function Club_Hover(){
	View_All();
	document.Club.src='images/Icone-Cadeaux_societes-Hover.gif';
}

function Club_Out(){
	Hide_All();
	document.Club.src='images/Icone-Cadeaux_societes.gif'
}

function View_All(){
	/*document.getElementById('Menu_Elt_Vins').style.visibility='visible';
	document.getElementById('Menu_Elt_Spiritueux').style.visibility='visible';
	document.getElementById('Menu_Elt_Cadeaux').style.visibility='visible';
	document.getElementById('Menu_Elt_Cafe').style.visibility='visible';
	document.getElementById('Menu_Elt_Eaux').style.visibility='visible';
	document.getElementById('Menu_Elt_Receptions').style.visibility='visible';*/
}

function Hide_All(){
	/*document.getElementById('Menu_Elt_Vins').style.visibility='hidden';
	document.getElementById('Menu_Elt_Spiritueux').style.visibility='hidden';
	document.getElementById('Menu_Elt_Cadeaux').style.visibility='hidden';
	document.getElementById('Menu_Elt_Cafe').style.visibility='hidden';
	document.getElementById('Menu_Elt_Eaux').style.visibility='hidden';
	document.getElementById('Menu_Elt_Receptions').style.visibility='hidden';*/
}

function Popup(img){
	window.open('popup.php?img='+img,'Sobelvin','location=no,toolbar=no,status=no,directories=no,scrollbars=no,width=200,height=400');
}

function preload(img){
	image = new Image();
	image.src = img;
	return image;
}

/* Script qui permet d'envoyer des requetes http via JS */

var http=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  http = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   http = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   http = false;
  }
 }
@end @*/
if (!http && typeof XMLHttpRequest!='undefined') {
  http = new XMLHttpRequest();
}

function Send_Get(request){
 	http.open("GET",request,true);
		 http.onreadystatechange=function() {
		 	if (http.readyState == 4 && http.status == 200){
				alert('Le vin a été ajouté ŕ la commande');
			}
		 }
 	http.send(null);
}

function Set_Div_From_Url(request,Element_Id){
 	http.open("GET",request,true);
		 http.onreadystatechange=function() {
		 	if (http.readyState == 4 && http.status == 200){
		 		document.getElementById(Element_Id).innerHTML = http.responseText;
			}
		 }
 	http.send(null);
}

function Rm_Vin(id,Ref){
	if(confirm('Etes vous sűr de vouloir supprimer le vin '+Ref+' de la liste ?')){
		var request = "ext/del_from_com.php?id="+id;
	 	http.open("GET",request,true);
			 http.onreadystatechange=function() {
			 	if (http.readyState == 4 && http.status == 200){
					setTimeout("Set_Div_From_Url('ext/gen_com_list.php','Liste_Vins');",300);
				}
			 }
	 	http.send(null);
	}
}

function Add_Ref(Ref){
		var request = "ext/add_to_com.php?ref="+Ref;
	 	http.open("GET",request,true);
			 http.onreadystatechange=function() {
			 	if (http.readyState == 4 && http.status == 200){
					setTimeout("Set_Div_From_Url('ext/gen_com_list.php','Liste_Vins');",300);
				}
			 }
	 	http.send(null);
}
