// JavaScript Document


function AjaxPhpNoRefill(req)
{
	
		var xhr_object = null;
	
	if(window.XMLHttpRequest) // Firefox
	   xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	   xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	   return;
	}
	
	xhr_object.open("GET", req, true);
	xhr_object.onreadystatechange = function() {
	   if(xhr_object.readyState == 4){
		  reponse	=	 xhr_object.responseText;
		 // document.getElementById('cellmid').innerHTML=reponse;
			}	
	}
	//
	xhr_object.send(null);
	
	}	
	
	function GoSuiviCommande()
	{
		//
		var ncommande	=	document.getElementById('suivi').value;
		if(ncommande!="")
		{
			AjaxPhp("cellmid","CallPhpFunction.php?func=GoSuiviCommande&ncommande="+ncommande,1);
			HideItemPop();
		}
		var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
		try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/suivi_commande/");

} catch(err) {}
		
	}
	
	function GoSuiviCommandeDirect(nu)
	{
		//
		/*var ncommande	=	nu;
		if(ncommande!="")
		{
			AjaxPhp("cellmid","CallPhpFunction.php?func=GoSuiviCommande&ncommande="+ncommande,1);
			HideItemPop();
		}
		var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 500} ).start(1);*/
		SuiviCommande();GreenMenu('men8');
		
	}
	
	function DispElement(path)
	{
		
		if(document.getElementById('bigvisuprod').display=='block')
		{
			new Fx.Style('bigvisuprod','opacity','opacity', {duration: 500} ).start(0);
		}
		document.getElementById('bigvisuprod').src="img/blank.jpg";
		//
		
		var div = $('bigvisuprod').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
		document.getElementById('bigvisuprod').src=path;
		
	}
	
	
function GetConfirmPage()
{
	if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}

		AjaxPhp("cellmid","CallPhpFunction.php?func=GetConfirmPage");
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
}

function GetLexiqueWord(id,word)
{
	
	HideItem();
	if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}

		AjaxPhp("cellmid","CallPhpFunction.php?func=GetLexiqueWord&id="+id+"&word="+word,0);

			try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/lexique/"+word);

} catch(err) {}
}


function GetIndex()
{

var myurl	=	document.location;

		AjaxPhp("cellmid","CallPhpFunction.php?func=GetIndex",0);
		AjaxPhp("cellmid","CallPhpFunction.php?func=GetIndex",0);
/*		if(!document.getElementById('bigvisuaccueil'))
		{
			if(myurl=="http://www.siecle-paris.com")
			{
			AjaxPhp("cellmid","CallPhpFunction.php?func=GetIndex",0);
			}
		}*/
if(document.getElementById('cellmid').display=='none')
		{		
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
		}
}

function Simul()
{
	AjaxPhp("cellmid","CallPhpFunction.php?func=Simul",1);
}

function ModCompte()
{
			if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}

		AjaxPhp("cellmid","CallPhpFunction.php?func=ModCompte",0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
}
function GetLastSearch()
{
		if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
		AjaxPhp("cellmid","CallPhpFunction.php?func=GetLastSearch",0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
	
}

function AjaxPhpEval(req)
{
			var xhr_object = null;
	
	if(window.XMLHttpRequest) // Firefox
	   xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	   xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	   return;
	}
	xhr_object.open("GET", req, true);
	xhr_object.onreadystatechange = function() {
	   if(xhr_object.readyState == 4){
		   //xhr_object.responseText;
		   
		  eval(xhr_object.responseText);
			}
	}
	//
	xhr_object.send(null);
	
	
}
function AjaxPhpEvalLivraison(tofill,req)
{
			var xhr_object = null;
	
	if(window.XMLHttpRequest) // Firefox
	   xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	   xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	   return;
	}
	xhr_object.open("GET", req, true);
	xhr_object.onreadystatechange = function() {
	   if(xhr_object.readyState == 4){
		   try
		   {
			   eval(xhr_object.responseText);
		   }
		   catch(err)
		   {
			   document.getElementById(tofill).innerHTML=err+":"+xhr_object.responseText;
		   }
		  
			}
	}
	//
	xhr_object.send(null);
	
	
}
function UpdateDispo(id)
{
	AjaxPhpEval("CallPhpFunction.php?func=UpdateDispo&id="+id);
	
	
}

function SetCadeau(id,prix)
{
	if(document.getElementById(id).checked)
	{
		/*	if(document.getElementById('cellmid').display=='block')
			{
				new Fx.Style('cartelement','opacity','opacity', {duration: 500} ).start(0);
			}*/
			AjaxPhpEval("CallPhpFunction.php?func=SetCadeau&id="+id+"&prix="+prix,0);
			/*var div = $('cartelement').setStyles({
			display:'block',
			opacity: 0
			
			});
			new Fx.Style(div, 'opacity', {duration: 500} ).start(1);	*/
			//GetTotalCart();
			//RecapCommande();
			
	}
	else
	{

			AjaxPhpEval("CallPhpFunction.php?func=UnSetCadeau&id="+id,0);

	}
}

function SuiviCommande()
{
	//HideItem();
	HideAllMenu();
	if(document.getElementById('pop').display=='block')
	{
		new Fx.Style('pop','opacity','opacity', {duration: 500} ).start(0);
	}
	var pos	=	Math.round(document.body.clientWidth/2)-150;
	document.getElementById('pop').style.left=pos+"px";
	AjaxPhp("pop","CallPhpFunction.php?func=SuiviCommande",1);
	var div = $('pop').setStyles({
		display:'block',
		opacity: 0
	});
	new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
}

function Emballage()
{
	if(document.getElementById('popjour').display=='block')
	{
		new Fx.Style('popjour','opacity','opacity', {duration: 500} ).start(0);
	}
	var pos	=	Math.round(document.body.clientWidth/2)-216;
	document.getElementById('popjour').style.left=pos+"px";
	document.getElementById('popjour').style.height="570px";
	document.getElementById('popjour').style.top = '50px';
	AjaxPhp("popjour","CallPhpFunction.php?func=Emballage",0);
	var div = $('popjour').setStyles({
		display:'block',
		opacity: 0
	});
	new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
}

function GetEspaceContact()
{
	HideItem();
	if(document.getElementById('popjour').display=='block')
	{
		new Fx.Style('popjour','opacity','opacity', {duration: 500} ).start(0);
	}
	var pos	=	Math.round(document.body.clientWidth/2)-216;
	document.getElementById('popjour').style.left=pos+"px";
	AjaxPhp("popjour","CallPhpFunction.php?func=GetEspaceContact",1);
	var div = $('popjour').setStyles({
		display:'block',
		opacity: 0
	});
	new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
	
	
			try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/espace_contact/");

} catch(err) {}
	
}
function GoContact()
{
	var nom		=	document.getElementById('nom_fr').value;
	var prenom	=	document.getElementById('prenom').value;
	var email	=	document.getElementById('email').value;
	var objet	=	document.getElementById('objet').value;
	var num_tel	=	document.getElementById('telephone').value;
	var heure	=	document.getElementById('heure').value;
	var message	=	document.getElementById('message').value;
	
	AjaxPhpEval("CallPhpFunction.php?func=GoContact&nom="+nom+"&prenom="+prenom+"&email="+email+"&objet="+objet+"&num_tel="+num_tel+"&heure="+heure+"&message="+message,0);
	
}
function GoJournaliste()
{
	var societe	=	document.getElementById('journaliste_societe').value;
	var nom		=	document.getElementById('journaliste_nom').value;
	var prenom	=	document.getElementById('journaliste_prenom').value;
	var email	=	document.getElementById('journaliste_email').value;
	var objet	=	document.getElementById('journaliste_objet').value;
	var num_tel	=	document.getElementById('journaliste_telephone').value;
	var heure	=	document.getElementById('journaliste_heure').value;
	var message	=	document.getElementById('journaliste_message').value;
	
	AjaxPhpEval("CallPhpFunction.php?func=GoJournaliste&societe="+societe+"&nom="+nom+"&prenom="+prenom+"&email="+email+"&objet="+objet+"&num_tel="+num_tel+"&heure="+heure+"&message="+message,0);
	
}
function Journaliste()
{
	HideItem();
	if(document.getElementById('popjour').display=='block')
	{
		new Fx.Style('popjour','opacity','opacity', {duration: 500} ).start(0);
	}
	var pos	=	Math.round(document.body.clientWidth/2)-216;
	document.getElementById('popjour').style.left=pos+"px";
	AjaxPhp("popjour","CallPhpFunction.php?func=Journaliste",1);
	var div = $('popjour').setStyles({
		display:'block',
		opacity: 0
	});
	new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
	
}

function InitBulles()
{
window.addEvent('domready', function(){ 	
	var Tips2 = new Tips($$('.Tips2'), {
		initialize:function(){
			this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 100, wait: false}).set(1);
		},
		hideDelay: 0,
		onShow: function(toolTip) {
			this.fx.start(1);
			//HideTips();
		},
		onHide: function(toolTip) {
			this.fx.start(0);
			HideTips();
		}
	});
});

}
function RecalcDispo(ens_id,ele_id,qtity)
{
		//alert('ensemble n:'+ens_id);
		
		AjaxPhpEval("CallPhpFunction.php?func=RecalcDispo&ens_id="+ens_id+"&ele_id="+ele_id+"&qtity="+qtity);
}
function GoLogin()
{
	var logine=document.getElementById('logine').value;
	var pass=document.getElementById('passe').value;

	if(logine!='' && pass!='')
	{
	AjaxPhpEval("CallPhpFunction.php?func=GoLogin&login="+logine+"&pass="+pass);
	}
}	

function SaveAdresseLivraison()
{
	var err=0;
	
	var pays	=	document.getElementById('pays1').value;
	var cadeau	=	document.getElementById('motdest').value;
	cadeau	=	nl2br(cadeau);

	var titre	=	document.getElementById('titre').value;
	if(titre=="")
	{
		document.getElementById('titre').style.backgroundColor='#5F8E1B';
		document.getElementById('titre').style.color='#FFFFFF';
			err=1;
	}
	var nom	=	document.getElementById('nom1').value;
	if(nom=="")
	{
		document.getElementById('nom1').style.backgroundColor='#5F8E1B';
		document.getElementById('nom1').style.color='#FFFFFF';
			err=1;
	}
	if(pays=="null")
	{
		//alert('Veuillez sélectioner un pays');
		AjaxPhpEval("CallPhpFunction.php?func=ChoisirPays",0);		
			err=1;
	}
	var prenom	=	document.getElementById('prenom').value;
	
	if(prenom=="")
	{
		document.getElementById('prenom').style.backgroundColor='#5F8E1B';
		document.getElementById('prenom').style.color='#FFFFFF';
			err=1;
	}
	
	var adresse	=	document.getElementById('adresse1').value;
	adresse=	nl2br(adresse);

	if(adresse=="")
	{
		document.getElementById('adresse1').style.backgroundColor='#5F8E1B';
		document.getElementById('adresse1').style.color='#FFFFFF';
			err=1;
	}
	
	var cp	=	document.getElementById('cp1').value;
	var ville	=	document.getElementById('ville1').value;
	if(cp=="")
	{
		document.getElementById('cp1').style.backgroundColor='#5F8E1B';
		document.getElementById('cp1').style.color='#FFFFFF';
			err=1;
	}
		if(ville=="")
	{
		document.getElementById('ville1').style.backgroundColor='#5F8E1B';
		document.getElementById('ville1').style.color='#FFFFFF';
			err=1;
	}
	if(err!=1)
	{
		
		if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
		AjaxPhp("cellmid","CallPhpFunction.php?func=SaveAdresseLivraison&titre="+titre+"&nom="+nom+"&prenom="+prenom+"&adresse="+adresse+"&cp="+cp+"&ville="+ville+"&pays="+pays+"&cadeau="+cadeau,0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
		ModeLivraison();
	}
	
	
}
function nl2br( str ) {
 
    return str.replace(/([^>])\n/g, '$1<br />\n');
}
function AdresseLivraison()
{
	//AjaxPhpEval("CallPhpFunction.php?func=HasMemorized");
	//AdresseLivraison
	var state = document.getElementById('mmadresse').checked;
	//Livraison();
	if(!state)
	{
		
		document.getElementById('titre').disabled= false;
		document.getElementById('nom1').disabled=false;
		document.getElementById('prenom').disabled=false;
		document.getElementById('adresse1').disabled=false;
		document.getElementById('cp1').disabled=false;
		document.getElementById('ville1').disabled=false;
		document.getElementById('pays1').disabled=false;
		document.getElementById('cadeau').disabled=false;
		document.getElementById('motdest').disabled= false;
		document.getElementById('titre').value="";
		document.getElementById('nom1').value="";
		document.getElementById('prenom').value="";
		document.getElementById('adresse1').value="";
		document.getElementById('cp1').value="";
		document.getElementById('ville1').value="";
		document.getElementById('pays1').value="";
		//
	}
	else
	{
	

		AjaxPhpEvalLivraison("cellmid","CallPhpFunction.php?func=FillInTheBlanks&same=oui");
		
	}
}

function Livraison()
{

		if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}

		AjaxPhp("cellmid","CallPhpFunction.php?func=Livraison",0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
		//ent
		var div_content = document.getElementById('cellmid').innerText;
		//walert(div_content);//.search("your password")

		AjaxPhpEvalLivraison("cellmid","CallPhpFunction.php?func=FillInTheBlanks");
			try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/adresse_livraison/");

} catch(err) {}
		
}

function RecapCommande()
{
HideItem();
		if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
		AjaxPhp("cellmid","CallPhpFunction.php?func=RecapCommande",0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
}
function ModeLivraison()
{
	
		if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}

		AjaxPhp("cellmid","CallPhpFunction.php?func=ModeLivraison",0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
					try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/mode_livraison/");

} catch(err) {}
}
function ShowCartItem(id)
{
	AjaxPhp("pop","CallPhpFunction.php?func=ShowCartItem&id="+id,1);
	var pos	=	Math.round(document.body.clientWidth/2)-150;
	document.getElementById('pop').style.left=pos+"px";
	var div = $('pop').setStyles({
		display:'block',
		opacity: 0
	});
	new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
	if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
	
	
}

function ShowPop(path)
{
	HideItem();
	var pos	=	Math.round(document.body.clientWidth/2)-162;
	document.getElementById('enlarge').style.left=pos+"px";
	document.getElementById('fermer').style.left="500px";
	document.getElementById('fermer').style.left="275px"
	document.getElementById('pic').src	= path;
	var div = $('enlarge').setStyles({
		display:'block',
		opacity: 0
	});
	new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
	/*//if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}*/
}
function ShowPopBig(path)
{
	var pos	=	Math.round(document.body.clientWidth/2)-422;
	document.getElementById('engros').style.left=pos+"px";
	document.getElementById('engros').style.top="75px";
	document.getElementById('picgros').src	= document.getElementById('bigvisuprod').src;
	var div = $('engros').setStyles({
		display:'block',
		opacity: 0
	});
	new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
	/*//if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}*/
}

function HidePopBig()
{
	new Fx.Style('engros','opacity','opacity', {duration: 500} ).start(0);
	document.getElementById('picgros').src	= "";
		document.getElementById('engros').style.display	= 'none';
	/*GetLastSearch();*/
}

function HidePopjour()
{
	new Fx.Style('popjour','opacity','opacity', {duration: 500} ).start(0);
	document.getElementById('popjour').style.display	= 'none';
	document.getElementById('popjour').style.height = '405px';
	document.getElementById('popjour').style.top = '150px';
	/*GetLastSearch();*/
}

function HidePop()
{
	new Fx.Style('enlarge','opacity','opacity', {duration: 500} ).start(0);
	document.getElementById('pic').src	= "";
	document.getElementById('enlarge').style.display	= 'none';
	/*GetLastSearch();*/
}

function ShowVisuAccueil()
{
	var pos	=	Math.round(document.body.clientWidth/2)-425;
	document.getElementById('vitrine').style.left=pos+"px";
	AjaxPhp("vitrine","CallPhpFunction.php?func=ShowVisuAccueil",0);
	var div = $('vitrine').setStyles({
		display:'block',
		opacity: 0
	});
	new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
	if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
	
}
function HideTips()
{
	   var as = getElementsByClasName(document,"div","tool-title"); 
	   var ab = getElementsByClasName(document,"div","tool-text"); 
	   
    // el.addEventListener("click", GetUrl, false); 
	 for (i=0; i < as.length;i++)
	 {
	 	as[i].style.display="none";
		ab[i].style.display="none";
	 }
}

function ShowItem(id)
{
	
	HidePopBig();
		Charge();
		HideTips();
	var pos	=	Math.round(document.body.clientWidth/2)-425;
	document.getElementById('vitrine').style.left=pos+"px";

	AjaxPhp("vitrine","modules/ficheX.php?id="+id,0);
	/*var div = $('vitrine').setStyles({
		display:'block',
		opacity: 1
	});*/
	document.getElementById('vitrine').style.visibility = 'visible';
new Fx.Style('vitrine', 'opacity', {duration: 500} ).start(1);document.getElementById('vitrine').style.display='block';
	try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/articles/"+id);

} catch(err) {}
	
}

function DispBigone()
{
	document.getElementById('cellmid').style.display='block';
	if(document.getElementById('bigone').style.display=="none")
	{
	var dive = $('loadres').setStyles({
		display:'block',
		opacity: 0
	});
new Fx.Style(dive, 'opacity', {duration: 500} ).start(0);
var div = $('bigone').setStyles({
		display:'block',
		opacity: 0
	});
new Fx.Style(div, 'opacity', {duration: 1000} ).start(1);
	

	}
	
	
}
function Br2Nl(string,id)
{
			var string=string.replace(/<br \/>/g, /\n/g );
		document.getElementById(id).value=string;
}
function HideItem()
{
	if(document.getElementById('vitrine').style.display == "block")
	{
		new Fx.Style('vitrine','opacity','opacity', {duration: 500} ).start(0);
		document.getElementById('vitrine').innerHTML="";
		var div = $('cellmid').setStyles({
			display:'block',
			opacity: 0
			});
			new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
	}
	HidePopBig();
	//HidePop();
	HideItemPop();
}
function HideItemPop()
{
	var affiche;
	if(document.getElementById('pop').style.display=='block')
	{
		affiche=1;
	}
	else
	{
		affiche=0
	}
	document.getElementById('men8').style.color='#663366';
	new Fx.Style('pop','opacity','opacity', {duration: 500} ).start(0);
	document.getElementById('pop').innerHTML="";
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
		if(affiche==1)
		{
		document.location = "#close";
		}
	//GetLastSearch();
}

function ChargeImages()
{
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=ChargeImages.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 Preload()
{
		ChargeImages('img/hover/menu_haut_bijoux_h.png',
					 'img/hover/menu_haut_decoration_h.png',
					 'img/hover/menu_haut_decoupage_h.png', 
					 'img/highus.png',
					 'img/world.jpg',
					 'img/higheurope.png',
					 'img/highfrance.png',
					 'img/highasie.png',
					 'img/hover/menu_haut_ideescadeau_h.png',
					 'img/en/hover/menu_haut_bijoux_h_en.png',
					 'img/en/hover/menu_haut_decoration_h_en.png',
					 'img/en/hover/menu_haut_decoupage_h_en.png', 
					 'img/en/hover/menu_haut_ideescadeau_h_en.png',
					 'img/ajax-loader.gif',
					 'lyte/bubblev2.png'
					 );
	
}
function nextentries()
{
	AjaxPhp("cellmid","CallPhpFunction.php?func=GetItemsUsingCML&table=items&from=450&nb=15&cml=std_items_thumbview",0);
	//document.parent.
}

function GetInfosLegales()
{
	HideItem();
	HideAllMenu();
	if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
		AjaxPhp("cellmid","CallPhpFunction?func=GetInfos&what=infoslegales",1);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
		
			try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/informations_legales/");

} catch(err) {}
}

function Login()
{
	if(document.getElementById('email').value == "")
	{
		document.getElementById('email').style.backgroundColor='#5F8E1B';
		document.getElementById('email').style.color='#FFFFFF';
	}
	if(document.getElementById('password').value == "")
	{
		document.getElementById('password').style.backgroundColor='#5F8E1B';
		document.getElementById('password').style.color='#FFFFFF';
	}

}

function GoNews()
{
		var email	=	document.getElementById('news').value;
		if(document.getElementById('resultnews').display=='block')
		{
			new Fx.Style('resultnews','opacity','opacity', {duration: 500} ).start(0);
		}
		AjaxPhp("resultnews","CallPhpFunction.php?func=GoNews&email="+email,0);
		var div = $('resultnews').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
	
}
function GetPayPage()
{
		if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
		for(i=0;i<2;i++)
		{

					if(document.liv.livraison[i].checked)
					{
							var frais	=	document.liv.livraison[i].value;
							AjaxPhp("cellmid","CallPhpFunction.php?func=GetPayPage&frais_port="+frais,0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
							return;
					}

		}
		
		//alert(frais);

	
	
}

function AffichePrincipCompte()
{
	
		if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
		AjaxPhp("cellmid","CallPhpFunction.php?func=AffichePrincipCompte",0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
		
	
}
function GetMonCompte()
{
	HideItem();
		AjaxPhp("cellmid","CallPhpFunction.php?func=GetMonCompte",0);
	HideAllMenu();

				try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/mon_compte/");

} catch(err) {}
}
function GetCGV()
{
	HideItem();
	HideAllMenu();
	if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
			AjaxPhp("cellmid","CallPhpFunction?func=GetInfos&what=cgv",1);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
			try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/cgv/");

} catch(err) {}
}

function GetPaiement(ancre)
{
	HideItem();
	HideAllMenu();	
	if(ancre=="")
	{
		var ancre="debut";	
	}
	if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
		//alert(ancre);
/*		if(window.ActiveXObject)
		{
			AjaxPhp("cellmid","CallPhpFunction?func=GetInfos",1);
		}
		else
		{*/
			AjaxPhp("cellmid","CallPhpFunction?func=GetInfos&what=paiement#"+ancre,1);
		/*}*/
		
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);

		
			try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/service_client/");

} catch(err) {}
}
function go_anchor(n)
{

	
}
// Remplace toutes les occurences d'une chaine
function replaceAll(str, search, repl)
{
 while (str.indexOf(search) != -1)
 {
  str = str.replace(search, repl);
 }
 return str;
}

// Remplace les caractères accentués
function AccentToNoAccent(str)
{
 var norm = new Array('À','Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë',
'Ì','Í','Î','Ï', 'Ð','Ñ','Ò','Ó','Ô','Õ','Ö','Ø','Ù','Ú','Û','Ü','Ý',
'Þ','ß', 'à','á','â','ã','ä','å','æ','ç','è','é','ê','ë','ì','í','î',
'ï','ð','ñ', 'ò','ó','ô','õ','ö','ø','ù','ú','û','ü','ý','ý','þ','ÿ');
var spec = new Array('A','A','A','A','A','A','A','C','E','E','E','E',
'I','I','I','I', 'D','N','O','O','O','0','O','O','U','U','U','U','Y',
'b','s', 'a','a','a','a','a','a','a','c','e','e','e','e','i','i','i',
'i','d','n', 'o','o','o','o','o','o','u','u','u','u','y','y','b','y');
 for (var i = 0; i < spec.length; i++)
 {
  str = replaceAll(str, norm[i], spec[i]);
 return str;
 }
}
function PerformSearch(word,page)
{
	HideItem();
	//alert(word);
	if(word="")
	{
		var words =document.getElementById('search').value;
	}
	else
	{
		var words=word;
	}
	var words =document.getElementById('search').value;
	//document.location = "/#/search/"+words;
	if(words != "")
	{
		if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
		words=AccentToNoAccent(words);
	  //alert(words);
	  if (navigator.appName=="Microsoft Internet Explorer")
	  {
			var nav = "ie";  
	  }
		AjaxPhp("cellmid","CallPhpFunction.php?func=Search&search="+words+"&page="+page+"&nav="+nav,0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
	}

	try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/recherche/"+word);

} catch(err) {}
	
}

function ConfirmInsc()
{
	//if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
	AjaxPhp("cellmid","cml/std_mess_confirm.xml",0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
}

function PerformFilter(words,filtre)
{
	HideItem();
	//var words =document.getElementById('combofiltre').value;
	//alert(filtre);
	if(words != "")
	{
		if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
		AjaxPhp("cellmid","CallPhpFunction.php?func=Search&search="+words+"&filtre="+filtre,0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
	}
}
//#######################################################################################################
function Identification()
{
	HideItem();
	var login	=	document.getElementById('email').value;
	var pass	=	document.getElementById('passw').value;
	var err;
	err=0;
	if(login == "")
	{
		document.getElementById('email').style.backgroundColor='#5F8E1B';
		document.getElementById('email').style.color='#FFFFFF';
		err=1;
	}
	if(pass == "")
	{
		document.getElementById('passw').style.backgroundColor='#5F8E1B';
		document.getElementById('passw').style.color='#FFFFFF';
		err=1;
	}
	if(err==1)
	{
		return;
	}
	
		AjaxPhpEval("CallPhpFunction.php?func=Identification&login="+login+"&pass="+pass,0);
			try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/identification/");

} catch(err) {}

}

function SetLanguage(langue)
{
	//alert(langue);
	//AjaxPhpNoRefill("CallPhpFunction.php?func=SetLanguage&langue="+langue);
	//AjaxPhp('cellmid',"CallPhpFunction.php?func=SetLanguage&langue="+langue,0);
	window.location.href = "http://www.siecle-paris.com/en/index.php?l="+langue;

	try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/langage/"+langue);

} catch(err) {}
}

function SetCurrency(currency)
{
//alert(currency);

//AjaxPhpEval("CallPhpFunction.php?func=SetCurrency&currency="+currency);
	/*	//	//AjaxPhp('cellmid',"CallPhpFunction.php?func=SetLanguage&langue="+langue,0);*/
	window.location.href = "http://www.siecle-paris.com/currency/index.php?c="+currency;
	try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/currency/"+currency);

} catch(err) {}

}

function Deconect()
{

	
	
			var xhr_object = null;
	
	if(window.XMLHttpRequest) // Firefox
	   xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	   xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	   return;
	}
	req = "CallPhpFunction.php?func=Deconect";
	xhr_object.open("GET", req, true);
	xhr_object.onreadystatechange = function() {
	   if(xhr_object.readyState == 4){
		  eval(xhr_object.responseText);
			}
	}
	//
	xhr_object.send(null);

}	

function AfficheMoncompte()
{
	HideItem();
	var req	=	"CallPhpFunction.php?func=AfficheMoncompte";
	
	if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
	AjaxPhp("cellmid",req,0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
}


function CreateAccount()
{
	HideItem();
	var err=0;
	var email	=	document.getElementById('email_insc').value;

	if(email=="")
	{
		document.getElementById('email').style.backgroundColor='#5F8E1B';
		document.getElementById('email').style.color='#FFFFFF';
		err=1;
	}
	
	var pass	=	document.getElementById('pass').value;
	if(pass=="")
	{
		document.getElementById('pass').style.backgroundColor='#5F8E1B';
		document.getElementById('pass').style.color='#FFFFFF';
		err=1;
	}
	var passconfirm = document.getElementById('pass2').value;
	if(passconfirm=="")
	{
		document.getElementById('pass2').style.backgroundColor='#5F8E1B';
		document.getElementById('pass2').style.color='#FFFFFF';
			err=1;
	}
		if((passconfirm != pass))
	{
		document.getElementById('pass').style.backgroundColor='#5F8E1B';
		document.getElementById('pass').style.color='#FFFFFF';
		document.getElementById('pass2').style.backgroundColor='#5F8E1B';
		document.getElementById('pass2').style.color='#FFFFFF';
		
		AjaxPhpEval("CallPhpFunction.php?func=BadPass",0);
			err=1;
	}
/*	if(pass=!passconfirm)
	{
		document.getElementById('pass').style.backgroundColor='#5F8E1B';
		document.getElementById('pass').style.color='#FFFFFF';
		document.getElementById('pass2').style.backgroundColor='#5F8E1B';
		document.getElementById('pass2').style.color='#FFFFFF';
		err=1;
	}*/
	var titre	=	document.getElementById('titre').value;
	if(titre=="")
	{
		document.getElementById('titre').style.backgroundColor='#5F8E1B';
		document.getElementById('titre').style.color='#FFFFFF';
			err=1;
	}
	var nom	=	document.getElementById('nom1').value;
	if(nom=="")
	{
		document.getElementById('nom1').style.backgroundColor='#5F8E1B';
		document.getElementById('nom1').style.color='#FFFFFF';
			err=1;
	}
	var prenom	=	document.getElementById('prenom').value;
	
	if(prenom=="")
	{
		document.getElementById('prenom').style.backgroundColor='#5F8E1B';
		document.getElementById('prenom').style.color='#FFFFFF';
			err=1;
	}
	
	var adresse	=	document.getElementById('adresse1').value;
	var pays	=	document.getElementById('pays1').value;
	//alert(pays);
	if(pays=="null")
	{
		document.getElementById('pays1').style.backgroundColor='#5F8E1B';
		document.getElementById('pays1').style.color='#FFFFFF';
		AjaxPhpEval("CallPhpFunction.php?func=ChoisirPays",0);
			err=1;
	}
	if(adresse=="")
	{
		document.getElementById('adresse1').style.backgroundColor='#5F8E1B';
		document.getElementById('adresse1').style.color='#FFFFFF';
			err=1;
	}
		
	var cp	=	document.getElementById('cp1').value;
	var ville	=	document.getElementById('ville1').value;
		if(cp=="")
	{
		document.getElementById('cp1').style.backgroundColor='#5F8E1B';
		document.getElementById('cp1').style.color='#FFFFFF';
			err=1;
	}
		if(ville=="")
	{
		document.getElementById('ville1').style.backgroundColor='#5F8E1B';
		document.getElementById('ville1').style.color='#FFFFFF';
			err=1;
	}

	var pays	=	document.getElementById('pays1').value;
	var connu = document.getElementById('connu').value;
	var newsletter	=	document.getElementById('newsletter').value;
	if(document.getElementById('cgv').checked==false)
	{
		
		AjaxPhpEval("CallPhpFunction.php?func=AcceptCGV",0);
		err=1;
	}
	
	if(err==1)
	{
		return;
	}
	

	
	var req	=	"CallPhpFunction.php?func=CreateAccount&email="+email+"&pass="+pass+"&passconfirm="+passconfirm+"&titre="+titre+"&nom="+nom+"&prenom="+prenom+"&adresse="+adresse+"&cp="+cp+"&ville="+ville+"&pays="+pays+"&newsletter="+newsletter+"&connu="+connu;
	
	if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
	AjaxPhp("cellmid",req,0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
}


function ModAccount()
{
	HideItem();
	var err=0;
	var email	=	document.getElementById('email').value;
	if(email=="")
	{
		document.getElementById('email').style.backgroundColor='#5F8E1B';
		document.getElementById('email').style.color='#FFFFFF';
		err=1;
	}
	
	var pass	=	document.getElementById('pass').value;
	var anc_pass = document.getElementById('anc_pass').value;
	var passconfirm = document.getElementById('pass2').value;
	var usr_id = document.getElementById('idy').value;
	
	
	if((passconfirm != pass))
	{
		document.getElementById('pass').style.backgroundColor='#5F8E1B';
		document.getElementById('pass').style.color='#FFFFFF';
		document.getElementById('pass2').style.backgroundColor='#5F8E1B';
		document.getElementById('pass2').style.color='#FFFFFF';
			err=1;
	}

	var titre	=	document.getElementById('titre').value;
	if(titre=="")
	{
		document.getElementById('titre').style.backgroundColor='#5F8E1B';
		document.getElementById('titre').style.color='#FFFFFF';
			err=1;
	}
	var nom	=	document.getElementById('nom1').value;
	if(nom=="")
	{
		document.getElementById('nom1').style.backgroundColor='#5F8E1B';
		document.getElementById('nom1').style.color='#FFFFFF';
			err=1;
	}
	var prenom	=	document.getElementById('prenom').value;
	
	if(prenom=="")
	{
		document.getElementById('prenom').style.backgroundColor='#5F8E1B';
		document.getElementById('prenom').style.color='#FFFFFF';
			err=1;
	}
	
	var adresse	=	document.getElementById('adresse1').value;
	var adresse = adresse.replace(/\n/g,'<br />');
	var cp	=	document.getElementById('cp1').value;
	var ville	=	document.getElementById('ville1').value;
	var pays	=	document.getElementById('pays1').value;
	var newsletter	=	document.getElementById('newsletter').value;
	if(err==1)
	{
		return;
	}
	
	var req	=	"CallPhpFunction.php?func=ModAccount&email="+email+"&pass="+pass+"&passconfirm="+passconfirm+"&titre="+titre+"&nom="+nom+"&prenom="+prenom+"&adresse="+adresse+"&cp="+cp+"&ville="+ville+"&pays="+pays+"&newsletter="+newsletter+"&anc_pass="+anc_pass+"&usr_id="+usr_id;

	if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
	AjaxPhp("cellmid",req,0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
}


function InitDef()
{

	AjaxPhp("cellmid","CallPhpFunction.php?func=screenwidth&width="+document.body.clientWidth);
	  window.addEvent('domready', function(){
        var scroll = new Scroller('cartelement', {area: 100, velocity: 1});
        $('cartelement').addEvent('mouseover', scroll.start.bind(scroll));
        $('cartelement').addEvent('mouseout', scroll.stop.bind(scroll));
    });
}

function GetPage(page,word)
{

	HideItem();
	HideAllMenu();
	if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
/*		if(window.ActiveXObject && page=='lexique')
	{
		return;	
	}*/
	AjaxPhp("cellmid","CallPhpFunction.php?func=GetPage&page="+page+"&word="+word,0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
		Charge();
			try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/quisommesnous/"+page);

} catch(err) {}
}
function GetPresse(zone,page)
{
	HideItem();
	switch(zone)
	{
		case "fr" :
			var cml="std_presse_france.xml";
			break;
		case "eu" :
			var cml="std_presse_EU.xml";
		break;
		case "us" :
			var cml="std_presse_US.xml";
		break;
		case "as" :
			var cml="std_presse_AS.xml";
		break;
	}
	if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
	//AjaxPhp("cellmid","cml/"+cml,0);
	AjaxPhp("cellmid","CallPhpFunction.php?func=GetPresseZone&zone="+zone+"&page="+page,0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);

		try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/presse/"+zone);

} catch(err) {}
}
function PerformSearchMenu(words,page,filter,id)
{
			try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/menu/"+words);

} catch(err) {}
HideItem();
	if(filter===undefined)
	{
		var filter="";	
	}
	else
	{
		var filter=filter;
	}
	HideItem();
	if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
	AjaxPhp("cellmid","CallPhpFunction.php?func=Search&search="+words+"&page="+page+"&filtre="+filter,0);
var i;
//alert(id);
	/*for(i=0;i<31;i++)
	{
		if(i==id)
		{
			
			document.getElementById('sscat'+i).style.color	=	'#5F8E16';
		}
		else
		{
			document.getElementById('sscat'+i).style.color	=	'#4D4D4D';
		}
		
	}*/
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
}

function cleanmenu()
{
	
	for(i=1;i<31;i++)
	{

			document.getElementById('sscat'+i).style.color	=	'#4D4D4D';
			if(i==6 || i==7 || i==5 || i==8 || i==9)
			{
				
				document.getElementById('men'+i).style.color	=	'#663366';
			}
	}	
	
}
function GreenMenu(id)
{
	HideAllMenu();
	var id=id.replace("men","");
	var i;

	for(i=1;i<10;i++)
	{
		if(i==id)
		{
				document.getElementById('men'+i).style.color	=	'#5F8E16';
		}
		else
		{
			if(i!=6 && i!=7 && i!=5 && i!=8 && i!=9)
			{
			document.getElementById('men'+i).style.color	=	'#4D4D4D';
			}
			else
			{
				document.getElementById('men'+i).style.color	=	'#663366';
			}
		}
		
	}

	
}
function GreyMenu()
{
	for(i=1;i<10;i++)
	{
		if(i!=6 && i!=7 && i!=5 && i!=8 && i!=9)
		{
		document.getElementById('men'+i).style.color	=	'#4D4D4D';
		}
	}
}


function Info(titre,message)
{
	
	AjaxPhp("cellmid","CallPhpFunction.php?func=Information&titre="+titre+"&message="+message,0);
}

function noop()
{
}
	function changeimage(image)
	{
		var obj = document.getElementById("bigvisuprod");
		obj.src	= image;
	}
	function Ferme()
	{
		lytebox = "window.parent."+ window.name+".myLytebox";
		lytebox.end();
	}
function AddToCartEnsemble(id,path,qtity,form)
{
	var qt;
	//qt=document.getElementById('vitrine').getElementById('e2').value;	
	//alert(document.getElementByID('e1'));
	if(document.getElementById('cellmid').display=='block')
	{
		new Fx.Style('cartelement','opacity','opacity', {duration: 500} ).start(0);
	}
	for(i=1;i<7;i++)//on parcours les elements de l'ensemble pour savoir si la personne en prends plus
	{
		if(document.getElementById('e'+i))
		{
		qt=document.getElementById('e'+i).value;	
		if((qt!="--") && (qt!=""))
		{
			//alert(document.getElementById('e'+i).value);
			//alert(document.getElementById('id'+i).value);
			//alert(qt);
			var idelem	=	document.getElementById('id'+i).value;
			var pathelem=	document.getElementById('path'+i).value;
			AjaxPhp("cartelement","CallPhpFunction.php?func=AddToCart&id="+idelem+"&path="+pathelem+"&qtity="+qt,0);
				GetTotalCart();
		}
		}
	}
	//AjaxPhp("cartelement","CallPhpFunction.php?func=AddToCart&id="+id+"&path="+path+"&qtity="+qtity,0);
	
		var div = $('cartelement').setStyles({
		display:'block',
		opacity: 0
	});
		new Fx.Style(div, 'opacity', {duration: 500} ).start(1);	
	GetTotalCart();
	GetTotalCart();
}
function getElementsByName_iefix(tag, name) {
	var elem=document.getElementsByTagName(tag);
	var arr=new Array();
	for(i=0,iarr=0; i < elem.length; i++) {
		att=elem[i].getAttribute("name");
		if(att == name) {
			arr[iarr]=elem[i];
			iarr++;
		}
	}
	return arr;
}
function ForgotPass()
{
	if(document.getElementById('pop').display=='block')
	{
		new Fx.Style('pop','opacity','opacity', {duration: 500} ).start(0);
	}
	var pos	=	Math.round(document.body.clientWidth/2)-150;
	document.getElementById('pop').style.left=pos+"px";
	AjaxPhp("pop","CallPhpFunction.php?func=ForgotPass",1);
	var div = $('pop').setStyles({
		display:'block',
		opacity: 0
	});
	new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
	
}

function GoForgotPass()
{
			var email	=	document.getElementById('mail').value;
			document.getElementById('resultpass').innerHTML='';
		if(document.getElementById('resultpass').display=='block')
		{
			new Fx.Style('resultpass','opacity','opacity', {duration: 500} ).start(0);
		}
		AjaxPhp("resultpass","CallPhpFunction.php?func=GoForgotPass&email="+email,0);
		var div = $('resultpass').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
	
}

function Newsletter()
{
	//HideItem();
/*	if(document.getElementById('pop').display=='block')
	{
		new Fx.Style('pop','opacity','opacity', {duration: 500} ).start(0);
	}*/
	var pos	=	Math.round(document.body.clientWidth/2)-150;
	document.getElementById('pop').style.left=pos+"px";
	AjaxPhp("pop","CallPhpFunction.php?func=Newsletter",1);
	var div = $('pop').setStyles({
		display:'block',
		opacity: 0
	});
	new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
	
}
function LoginPop()
{
	//HideItem();
	if(document.getElementById('pop').display=='block')
	{
		new Fx.Style('pop','opacity','opacity', {duration: 500} ).start(0);
	}

	var pos	=	Math.round(document.body.clientWidth/2)-150;
	document.getElementById('pop').style.left=pos+"px";
	AjaxPhp("pop","CallPhpFunction.php?func=LoginPop",1);
	var div = $('pop').setStyles({
		display:'block',
		opacity: 0
	});
	new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
				try {
var pageTracker = _gat._getTracker("UA-7057543-1");
pageTracker._trackPageview("/login/");

} catch(err) {}
}

function ShowPayCheck()
{
	//HideItem();
	if(document.getElementById('pop').display=='block')
	{
		new Fx.Style('pop','opacity','opacity', {duration: 500} ).start(0);
	}

	var pos	=	Math.round(document.body.clientWidth/2)-150;
	document.getElementById('pop').style.left=pos+"px";
	AjaxPhp("pop","CallPhpFunction.php?func=ShowPayCheck",0);
	var div = $('pop').setStyles({
		display:'block',
		opacity: 0
	});
	new Fx.Style(div, 'opacity', {duration: 500} ).start(1);
}



function GoPayCheck(lang)
{
	var numcommande=document.getElementById('numcommande').value;

		HideItemPop();
		var commande_id=document.getElementById('numcommande').value;
		AjaxPhp("cellmid","CallPhpFunction.php?func=ValidCheckCommand&command_id="+commande_id,0)	
	
}

function AddToCart(id,path,qtity)
{
	//var qtity= document.getElementById('sauv').value;
	//alert(qtity);
	if(document.getElementById('cellmid').display=='block')
	{
		new Fx.Style('cartelement','opacity','opacity', {duration: 500} ).start(0);
	}
	AjaxPhp("cartelement","CallPhpFunction.php?func=AddToCart&id="+id+"&path="+path+"&qtity="+qtity,0);
	
		var div = $('cartelement').setStyles({
		display:'block',
		opacity: 0
	});
		new Fx.Style(div, 'opacity', {duration: 500} ).start(1);	
	GetTotalCart();

}


function GetCart()
{
//AjaxPhp2string("CallPhpFunction.php?func=GetCart");
//alert(document.getElementById('cartelement').innerHTML);
	if(document.getElementById('cartelement').display=='block')
	{
		new Fx.Style('cartelement','opacity','opacity', {duration: 500} ).start(0);
	}
	AjaxPhp("cartelement","CallPhpFunction.php?func=GetCart",0);

		var div = $('cartelement').setStyles({
		display:'block',
		opacity: 0
	});
		new Fx.Style(div, 'opacity', {duration: 500} ).start(1);	
		document.getElementById('cartelement').innerHTML = document.getElementById('cartelement').innerHTML +"allo";
	GetTotalCart();
}

function GetXY(element)
{
	alert(document.getElementById(element).offsetLeft || 0);	
	
}

function DelFromCart(elementid)
{
	AjaxPhpEval("CallPhpFunction.php?func=ConfirmDel&id="+elementid,0);	
	
}

function GoDelete(elementid)
{
	if(document.getElementById('cellmid').display=='block')
	{
		new Fx.Style('cartelement','opacity','opacity', {duration: 500} ).start(0);
	}
	AjaxPhp("cartelement","CallPhpFunction.php?func=DelFromCart&id="+elementid,0);
		var div = $('cartelement').setStyles({
		display:'block',
		opacity: 0
		
	});
		new Fx.Style(div, 'opacity', {duration: 500} ).start(1);	
		GetTotalCart();
	
}
function GetTotalCart()
{
	AjaxPhp("total","CallPhpFunction.php?func=GetTotalCart",0);
}

function InitDrag()
{

window.addEvent('domready', function(){
var drop = $('cartelement');
var dropFx = drop.effect('background-color', {wait: false}); // wait is needed so that to toggle the effect,
			
			$$('.items').each(function(item){
			
				item.addEvent('mousedown', function(e) {
					e = new Event(e).stop();
			
					var clone = this.clone()
						.setStyles(this.getCoordinates()) // this returns an object with left/top/bottom/right, so its perfect
						.setStyles({'opacity': 0.7, 'position': 'absolute'})
						.addEvent('emptydrop', function() {
														
							this.remove();
							drop.removeEvents();
						}).inject(document.body);
			
					drop.addEvents({
						'drop': function() {
							
							//item.clone().inject(drop);
							dropFx.start('7389AE').chain(dropFx.start.pass('ffffff', dropFx));
							drop.removeEvents();
							clone.setStyles({'visibility': 'hidden'});
							clone.remove();
							AddToCart('473','','1');
						},
						'over': function() {
							dropFx.start('98B5C1');
						},
						'leave': function() {
							dropFx.start('ffffff');
						}
					});
			
					var drag = clone.makeDraggable({
						droppables: [drop]
					}); // this returns the dragged element
					drag.start(e); // start the event manual
				});
			
			});
		}); 
}

function UpdateCart(id,qty)
{
			if(document.getElementById('cellmid').display=='block')
	{
		new Fx.Style('cartelement','opacity','opacity', {duration: 500} ).start(0);
	}AjaxPhp("cartelement","CallPhpFunction.php?func=UpdateCart&id="+id+"&qty="+qty,0);
		var div = $('cartelement').setStyles({
		display:'block',
		opacity: 0
		
	});
		new Fx.Style(div, 'opacity', {duration: 500} ).start(1);	
		GetTotalCart();
}

function UpdateCommandeCart(id,qty)
{
	AjaxPhpEval("CallPhpFunction.php?func=UpdateCommandeCart&id="+id+"&qty="+qty,0);
}
//############################################################################################################


function menugaucheshow()
{
	if(document.getElementById('menugauche').style.display=='none')
	{
				document.getElementById('menugauche').style.display='block';
	}
}
function Presse()
{
	HideItem();
	HideAllMenu();
	if(document.getElementById('cellmid').display=='block')
		{
			new Fx.Style('cellmid','opacity','opacity', {duration: 500} ).start(0);
		}
	AjaxPhp("cellmid","CallPhpFunction.php?func=GetPresse",0);
	var div = $('cellmid').setStyles({
		display:'block',
		opacity: 0
		});
		new Fx.Style(div, 'opacity', {duration: 700} ).start(1);
	
}
function menugauchehide()
{
	document.getElementById('menugauche').style.display='none';
}

function changeimage(image)
{
	var obj = document.getElementById("bigvisuprod");
	obj.src	= image;
}

function pausecomp(millis)
{
	var date = new Date();
	var curDate = null;
	
	do { curDate = new Date(); }
	while(curDate-date < millis);
}

function getElementsByClasName(oElm, strTagName, oClassNames) {
    var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
    var arrReturnElements = new Array();
    var arrRegExpClassNames = new Array();
    if(typeof oClassNames == "object") {
        for(var i=0; i<oClassNames.length; i++) {
            arrRegExpClassNames.push(new RegExp("(^|\s)" + oClassNames[i].replace(/-/g, "\-") + "(\s|$)"));
        }
    }
    else {
        arrRegExpClassNames.push(new RegExp("(^|\s)" + oClassNames.replace(/-/g, "\-") + "(\s|$)"));
    }
    var oElement;
    var bMatchesAll;
    for(var j=0; j<arrElements.length; j++) {
        oElement = arrElements[j];
        bMatchesAll = true;
        for(var k=0; k<arrRegExpClassNames.length; k++) {
            if(!arrRegExpClassNames[k].test(oElement.className)) {
                bMatchesAll = false;
                break;
            }
        }
        if(bMatchesAll) {
            arrReturnElements.push(oElement);
    }
    }
    return (arrReturnElements)
} 
// --- // Array support for the push method in IE 5
    if(typeof Array.prototype.push != "function") {
        Array.prototype.push = ArrayPush;
    function ArrayPush(value) {
        this[this.length] = value;
    }
     }

