//-->
function MM_swapImgRestore() { //v3.0
  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() { //v3.0
  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];}
}


function redirect()
{
location.href=document.rapide.acces.value;
}

function agrandir() {
  false;
}
function opennewwindow(page, nom, hauteur, largeur) {
options='height='+hauteur+',width='+largeur+',left=2, top=2,toolbar=no,scrollbars=yes';
newWindow=window.open(page, nom,options); 
}

function afficheMaxi(chemin)
	{
	Imageslim = new Image;
	Imageslim.src = chemin;
	titre='Jetsetmagazine.net';
	popupImage = window.open('','grande','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,height=10,width=10,left=0, top=0');
	html = '<HTML><HEAD><TITLE>'+titre+'</TITLE><link href="../../styles/styles.css" rel="stylesheet" type="text/css"></HEAD><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0 onLoad="self.focus();">';
	html =html+'<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr>';
    html =html+'<td valign="middle"><table border="0" align="center" cellpadding="0" cellspacing="0"><tr>';
	html =html+'<td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr>';
	html =html+'<td align="left"><strong><img src="../../images/logo_min.gif" width="97" height="40" hspace="10" vspace="3"></strong></td>';
    html =html+'<td align="right" valign="bottom"><img src="../../images/url.gif" width="136" height="10" hspace="3" vspace="2"></td>';
    html =html+'</tr></table></td></tr><tr>';
    html =html+'<td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr>';
	html =html+'<td width="10" valign="top" background="../../images/bg_v.gif"><img src="../../images/coinv.gif" width="13" height="17" border="0"></td>';
   	html =html+'<td rowspan="2" bgcolor="#FFFFFF" class="photolarge"><IMG SRC="'+chemin+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(document.imageTest.width+50,document.imageTest.height+110);window.moveTo(100,100);self.focus();"></td>';
    html =html+'</tr><tr><td valign="bottom" background="../../images/bg_v.gif"><img src="../../images/coinfooter.gif" width="13" height="28" border="0" style="background-color:#292C33"></td></tr>';
    html =html+'</table></td></tr></table></td></tr></table></body></HTML>';      
      
		
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close();
	}
function VerificationEmail(elm)
{
if (elm.value.indexOf("@") != "-1" &&
    elm.value.indexOf(".") != "-1" &&
    elm.value != "")
    return true;

return false;
}

function Verifmail(formulaire)
{
	//alert(formulaire.email_newsletter.value);
	if(VerificationEmail(formulaire.email_newsletter) == false)

		{
		alert('Adresse e-mail invalide!!');
        formulaire.email_newsletter.focus();
		return false;		
		}
		else return true;
}


window.onload=montre;
function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
	
if (d) {d.style.display='block';}

}


function clientcase(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('client_cas'+i)) {document.getElementById('client_cas'+i).style.display='none';}
	}
	
if (d) {d.style.display='block';}

}

function SwapOver(id)
{
	
	var ong = document.getElementById('onglet'+id);
	var spa = document.getElementById('span_onglet'+id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('onglet'+i)) {document.getElementById('onglet'+i).style.background="url(../../images/bg_off_corner_sousmenu.gif)";}
		
				if (document.getElementById('span_onglet'+i)) {document.getElementById('span_onglet'+i).style.background="url(../../images/bg_menu.gif)";}
	}
	
if (ong) ong.style.background="url(../../images/bg_over_corner_sousmenu.gif)";
if (spa) 
{
spa.style.background="url(../../images/bg_over_sousmenu.gif)";
spa.style.backgroundPosition='right top';
}
 

}


function SwapOverProduct(id)
{
	var ong = document.getElementById('product_onglet'+id);
	var spa = document.getElementById('product_span_onglet'+id);

if (ong) 
{
ong.style.background="url(../../images/bg_over_corner_product.gif)";
ong.style.backgroundPosition='left top';
ong.style.backgroundRepeat='no-repeat';
}
if (spa) 
{
spa.style.background="url(../../images/bg_over_product.gif)";
spa.style.backgroundPosition='right top';
spa.style.backgroundRepeat='no-repeat';
spa.style.color='#FFFFFF';
}
}




function SwapOffProduct()
{
	for (var i = 1; i<=30; i++) {
	if(document.onglets.actif.value!=i)	

{

if (document.getElementById('product_onglet'+i)) 
{
document.getElementById('product_onglet'+i).style.background="url(../../images/bg_off_corner_product.gif)";
document.getElementById('product_onglet'+i).style.backgroundPosition='left top';
document.getElementById('product_onglet'+i).style.backgroundRepeat='no-repeat';

}
		
if (document.getElementById('product_span_onglet'+i)) 
{
document.getElementById('product_span_onglet'+i).style.background="url(../../images/bg_off_product.gif)";
document.getElementById('product_span_onglet'+i).style.backgroundPosition='right top';
document.getElementById('product_span_onglet'+i).style.backgroundRepeat='no-repeat';
document.getElementById('product_span_onglet'+i).style.color='#0E3192';
}

}
}
}





function ActivProduct(id)
{
	document.onglets.actif.value=id;
	SwapOffProduct();
	
	
	var d = document.getElementById('content_product'+id);
	for (var i = 1; i<=30; i++) {
		if (document.getElementById('content_product'+i)) {document.getElementById('content_product'+i).style.display='none';}
	}
	
if (d) {d.style.display='block';}
	
}






function SwapOverCat(id)
{
	var ong = document.getElementById('cat_onglet'+id);
	var spa = document.getElementById('cat_span_onglet'+id);

if (ong) 
{
ong.style.background="url(../../images/bg_over_corner_cat.gif)";
ong.style.backgroundPosition='left top';
ong.style.backgroundRepeat='no-repeat';
}
if (spa) 
{
spa.style.background="url(../../images/bg_over_cat.gif)";
spa.style.backgroundPosition='right top';
spa.style.backgroundRepeat='no-repeat';
spa.style.color='#0E3192';
}
}




function SwapOffCat()
{
	for (var i = 1; i<=30; i++) {
	if(document.onglets.actif.value!=i)	

{

if (document.getElementById('cat_onglet'+i)) 
{
document.getElementById('cat_onglet'+i).style.background="url(../../images/bg_off_corner_cat.gif)";
document.getElementById('cat_onglet'+i).style.backgroundPosition='left top';
document.getElementById('cat_onglet'+i).style.backgroundRepeat='no-repeat';

}
		
if (document.getElementById('cat_span_onglet'+i)) 
{
document.getElementById('cat_span_onglet'+i).style.background="url(../../images/bg_off_cat.gif)";
document.getElementById('cat_span_onglet'+i).style.backgroundPosition='right top';
document.getElementById('cat_span_onglet'+i).style.backgroundRepeat='no-repeat';
document.getElementById('cat_span_onglet'+i).style.color='#FFFFFF';
}

}
}
}





function ActivCat(id)
{
	document.onglets.actif.value=id;
	SwapOffCat();
	
	
	var d = document.getElementById('content_cat'+id);
	for (var i = 1; i<=30; i++) {
		if (document.getElementById('content_cat'+i)) {document.getElementById('content_cat'+i).style.display='none';}
	}
	
if (d) {d.style.display='block';}
	
}
















function compare_products()
{
	var vartopass='';
	for (var i = 1; i<=10; i++) {
		if(eval('document.products.compare'+i))
		{
		valeur_comp=eval('document.products.compare'+i+'.value');
		check_comp=eval('document.products.compare'+i+'.checked');
		if (check_comp) vartopass=vartopass+valeur_comp+',';
		}
	}
	//alert(vartopass);
	url="comparateur.php?tocompare="+vartopass;
	opennewwindow(url, "nom", 700, 980);
}

function compare_products_fiche()
{
	var vartopass='';
	
	if(document.comparateur.reference_produit.value) vartopass=document.comparateur.reference_produit.value+',';
	liste=document.comparateur.liste1;

i=0;
if (liste.options.selectedIndex>=0) 
{
	while(i<liste.options.length)
	{
		if(liste.options[i].selected) 
		{
			valeur_comp=valeur_comp=liste.options[i].value;	
			vartopass=vartopass+valeur_comp+',';
		}

	//
	i=i+1;
	}	
}
	url="comparateur.php?tocompare="+vartopass;
	opennewwindow(url, "nom", 700, 980);


}


function positionne(id) {
	
	var d = document.getElementById(id);
marge=(screen.width-953)/2+'px';
if (d) 
	{
	d.style.right=marge;
	d.style.display='block';
	}

}


function verifSupport()
{ 

 /////////sujet
if(document.contact.sujet.value == "")
 {
alert(' Saisissez votre sujet !!');
document.contact.sujet.focus();
return false; 
 }


 /////////message
if(document.contact.message.value == "")
 {
alert(' Saisissez votre message !!');
document.contact.message.focus();
return false; 
 }


else
return true;
}














function verifForm(formulaire)
{ 
///////////NOM
if(document.contact.nom.value == "")
 {
alert(' Entrez votre nom svp !!');
document.contact.nom.focus();
return false; 
 }
/////////PRENOM
if(document.contact.prenom.value == "")
 {
alert(' Entrez votre prénom svp !!');
document.contact.prenom.focus();
return false; 
 }
/////////Fonction
if(document.contact.fonction.value == "")
 {
alert(' Entrez votre fonction svp !!');
document.contact.fonction.focus();
return false; 
 }
 /////////societe
if(document.contact.societe.value == "")
 {
alert(' Entrez votre société svp !!');
document.contact.societe.focus();
return false; 
 }

    /////////tel
if(document.contact.tel.value == "")
 {
alert(' Entrez votre téléphone svp !!');
document.contact.tel.focus();
return false; 
 }
/////////////MAIL



	adresse = document.contact.mail.value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);
	if ((place > -1)&&(adresse.length >2)&&(point > 1))
		{

}
	else
		{
		alert('Adresse email invalide!!');
        document.contact.mail.focus();
return false;		
}
	
if(document.contact.mail.value == "")
 {
alert(' Entrez votre adresse Email !!');
document.contact.mail.focus();
return false; 
 }
/////////SUJET
//if(document.contact.sujet.value == "")
 //{
//alert(' Choisissez l\'objet de votre message !!');
//document.contact.sujet.focus();
//return false; 
 //}
 /////////message
if(document.contact.message.value == "")
 {
alert(' Saisissez votre projet !!');
document.contact.message.focus();
return false; 
 }
if(document.contact.code.value == "")
 {
alert(' Recopiez le code svp  !!');
document.contact.code.focus();
return false; 
 }

else
return true;
}


function verifFormInscription(formulaire)
{

	 ///////////NOM
if(document.contact.societe.value == "")
 {
alert(' Entrez votre le nom de votre societe !!');
document.contact.societe.focus();
return false; 
 }
/////////PRENOM
/*if(document.contact.type_societe.value == "")
 {
alert(' Entrez la forme juridique de votre societe svp !!');
document.contact.type_societe.focus();
return false; 
 }*/

/////////PRENOM
if(document.contact.adresse.value == "")
 {
alert(' Entrez votre adresse svp !!');
document.contact.adresse.focus();
return false; 
 }


/////////tel
if(document.contact.tel.value == "")
 {
alert(' Entrez votre Numéro de téléphone svp  !!');
document.contact.tel.focus();
return false; 
 }

/////////fax
if(document.contact.fax.value == "")
 {
alert(' Entrez votre Numéro de fax svp  !!');
document.contact.fax.focus();
return false; 
 }



	adresse = document.contact.mail.value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);
	if ((place > -1)&&(adresse.length >2)&&(point > 1))
		{

}
	else
		{
		alert('Adresse email invalide!!');
        document.contact.mail.focus();
return false;		
}
 
 
 	 ///////////NOM
if(document.contact.nom.value == "")
 {
alert(' Entrez votre nom !!');
document.contact.nom.focus();
return false; 
 }
/////////PRENOM
if(document.contact.prenom.value == "")
 {
alert(' Entrez votre prenom svp !!');
document.contact.prenom.focus();
return false; 
 }
 
 /////////fonction
if(document.contact.fonction.value == "")
 {
alert(' Entrez votre fonction svp !!');
document.contact.fonction.focus();
return false; 
 }
 
  /////////fonction
if( (document.contact.client[0].checked == false) && (document.contact.client[1].checked == false))
 {
alert(' Etes-vous client chez Proxi !!');

return false; 
 }
 
if(document.contact.code.value == "")
 {
alert(' Recopiez le code svp  !!');
document.contact.code.focus();
return false; 
 }

else
return true;
}


function hideCode(id)
{
	var d = document.getElementById(id);
	d.style.display='none';
}

function showCode(id)
{
	var d = document.getElementById(id);
	d.style.display='block';
}
function VerificationEmail(elm)
{
if (elm.value.indexOf("@") != "-1" &&
    elm.value.indexOf(".") != "-1" &&
    elm.value != "")
    return true;

return false;
}

function file(fichier)
     {
     if(window.XMLHttpRequest) // FIREFOX
          xhr_object = new XMLHttpRequest(); 
     else if(window.ActiveXObject) // IE
          xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
     else 
          return(false); 
     xhr_object.open("GET", fichier, false); 
     xhr_object.send(null); 
     if(xhr_object.readyState == 4) return(xhr_object.responseText);
     else return(false);
     }


function verifFormami()
{


if(VerificationEmail(document.ami.adresse_ami) == false)
{
		alert('Adresse email invalide!!');
        document.ami.adresse_ami.focus();
		return(false); 	
}
if(VerificationEmail(document.ami.adresse_vous) == false)
{
		alert('Adresse email invalide!!');
        document.ami.adresse_vous.focus();
		return(false); 
}

else 
{
	showCode('loading_send_mag');
	if(texte = file('http://www.proxi.com.tn/site/fr/envoi_ami.php?adresse_ami='+escape(document.ami.adresse_ami.value)+'&adresse_vous='+escape(document.ami.adresse_vous.value)+'&vos_commentaires='+escape(document.ami.vos_commentaires.value)+'&reference='+escape(document.ami.reference.value)))
	{
		
		if(texte == 1) 
		{
			hideCode('ami');
			hideCode('loading_send_mag');
			showCode('reponse_ami');
			//alert('reussite');
			return(false); 
			
		}
		
		else 
		{
			hideCode('ami');
			hideCode('loading_send_mag');
			showCode('probleme_ami');
			return(false); 
			//alert('fsd');
			
		}
		
	}
	else return(false); 
}

}
function plus_panier(champs)
{
var ous = document.getElementById(champs);
if(isNaN(ous.value)) ous.value=1;
ous.value = parseInt(ous.value)+1;
}
function moins_panier(champs)
{
var ous = document.getElementById(champs);
if(ous.value>1) ous.value = parseInt(ous.value)-1;
}

function add_panier(val)
{

	
	var ref=document.getElementById('reference'+val);
	var qte=document.getElementById('quantite'+val);
	var referer=document.getElementById('page');
	
location.href="add_panier.php?reference="+ref.value+"&quantite="+qte.value+"&referer="+referer.value;
}

function incremente_basket(inc)
{
	
	
	document.basket.quantite.value = parseInt(document.basket.quantite.value) + inc;
	if(isNaN(document.basket.quantite.value) || (document.basket.quantite.value<1)) document.basket.quantite.value=1;
	
	///calcul du prix//
	var prix_unitaire=document.basket.prix_unitaire.value;
	prix_unitaire.replace(' ', '');
	var new_price=prix_unitaire*document.basket.quantite.value;
	new_price=new_price.toFixed(3);
	
	new_price=new_price+' DHT';
	var ous = document.getElementById('final_price');
	ous.innerHTML=new_price;

}
