
// Menu principal - Cacher le menu déroulant
function cacherMenuDeroulant(value) {
	if(document.getElementById('discov_value_' + value).value != 1) {
		document.getElementById('discovmenu' + value).style.visibility='hidden';
	}
}

// Pagination des commentaires - Page produits
function goPageCommentaires(newPage) {
	var PageCommentairesActuelle = document.getElementById('PageCommentairesActuelle').value;
	document.getElementById('divCommentaire' + PageCommentairesActuelle).style.display='none';

	document.getElementById('divCommentaire' + newPage).style.display='block';
	document.getElementById('PageCommentairesActuelle').value = newPage;
}


// Correction bug onglet "Commentaires"
function cacherActuel(value) {
	if(value == 1) { var action = 'visible'; }
	else { var action = 'hidden'; }
	
	var PageCommentairesActuelle = document.getElementById('PageCommentairesActuelle').value;
	document.getElementById('divCommentaire' + PageCommentairesActuelle).style.visibility=action;
}

// Changer d'onglet dans la page produits
function ChangeMenuProduit(numero) {
	var value_menuselected=document.getElementById('current_menuselected').value;
	document.getElementById('current_menuselected').value = numero;

	document.getElementById('affichagecontenu' + value_menuselected).style.visibility='hidden';
	
	document.getElementById('affichagecontenu' + numero).style.visibility='visible';
	if(numero == 5) { cacherActuel('1'); } else { 	cacherActuel('0'); }
}

// Switch images des produits - Miniatures
function switch_smallimg(image,site) {
  document.getElementById('big_img').innerHTML='<img src="http://www.shop2be.com/_centralize/_class/func_miniature.php?img=../../../'+site+'/_content/_images/upload_products/'+image+'&amp;compression=90&amp;w=119&amp;h=119&site='+site+'" alt="" />';	
}

// Switch images des produits - Grand modele
function switch_bigimg(image,site) {
	document.getElementById('mostbig_img').innerHTML='<img src="http://www.shop2be.com/_centralize/_class/func_miniature.php?img=../../../'+site+'/_content/_images/upload_products/'+image+'&amp;compression=90&amp;w=590&amp;h=400&site='+site+'" alt="" />';	
}

// Ajout aux favoris
function AddFavorites(description) { 
  var description;
if ( navigator.appName != 'Microsoft Internet Explorer' )  { window.sidebar.addPanel(description,window.location.href,""); } 
	else { window.external.AddFavorite(window.location.href,description); } 
}

// Ouverture d'une popup
function popup_it() {
	this.name = document.getElementById('name_user').value;
	this.email = document.getElementById('email_user').value;
	this.type = document.getElementById('type_user').value;
	this.site = document.getElementById('site').value;
	window.open("http://URL/PAGE.php?type="+this.type+"&email="+this.email+"&name="+this.name+"&site="+this.site,"PopUpConversation","menubar=no, status=no, scrollbars=no, menubar=no, width=620, height=600");
}

// Champ de recherche de produits
function search_products(value,condition) {
	if(document.getElementById('recherche').value==condition) {
		document.getElementById('recherche').value=value;
	}
}

// Fonctions de preload / mouseover images
function MM_swapImgRestore() {
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}