function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
function popupWindowProduct(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=700,height=700,screenX=150,screenY=150,top=150,left=150')
}


jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
    visible : 6,
        scroll : 5,
        animation : 1000,
        wrap: 'last'
        // auto : 1  animation : "slow ou "fast" ou en millisec.,
    });
    
       jQuery('#alsocarousel').jcarousel({
    visible : 6,
        scroll : 5,
        animation : 1000,
        wrap: 'last'
        // auto : 1  animation : "slow ou "fast" ou en millisec.,
    });
});

/* GESTION DES TABS*/
	function displayOnglet ( pDiv ){
		if ( pDiv == "tab-achete" ) {
			if ( document.getElementById('tab-description') )
				document.getElementById('tab-description').style.display ='none';
			if ( document.getElementById('tab-avis') )
				document.getElementById('tab-avis').style.display ='none';
			if ( document.getElementById('tab-service') )
				document.getElementById('tab-service').style.display ='none';
							if ( document.getElementById('tab-livraison') )
				document.getElementById('tab-livraison').style.display ='none';
		}
		
		if ( pDiv == "tab-description" ) {
			if ( document.getElementById('tab-achete') )
				document.getElementById('tab-achete').style.display ='none';
			if ( document.getElementById('tab-avis') )
				document.getElementById('tab-avis').style.display ='none';
			if ( document.getElementById('tab-service') )
				document.getElementById('tab-service').style.display ='none';
							if ( document.getElementById('tab-livraison') )
				document.getElementById('tab-livraison').style.display ='none';
		}
		
				if ( pDiv == "tab-avis" ) {
			if ( document.getElementById('tab-achete') )
				document.getElementById('tab-achete').style.display ='none';
			if ( document.getElementById('tab-description') )
				document.getElementById('tab-description').style.display ='none';
			if ( document.getElementById('tab-service') )
				document.getElementById('tab-service').style.display ='none';
							if ( document.getElementById('tab-livraison') )
				document.getElementById('tab-livraison').style.display ='none';
		}
		
		if ( pDiv == "tab-service" ) {
			if ( document.getElementById('tab-achete') )
				document.getElementById('tab-achete').style.display ='none';
			if ( document.getElementById('tab-description') )
				document.getElementById('tab-description').style.display ='none';
			if ( document.getElementById('tab-avis') )
				document.getElementById('tab-avis').style.display ='none';
							if ( document.getElementById('tab-livraison') )
				document.getElementById('tab-livraison').style.display ='none';
		}
		
		if ( pDiv == "tab-livraison" ) {
			if ( document.getElementById('tab-achete') )
				document.getElementById('tab-achete').style.display ='none';
			if ( document.getElementById('tab-description') )
				document.getElementById('tab-description').style.display ='none';
			if ( document.getElementById('tab-service') )
				document.getElementById('tab-service').style.display ='none';
							if ( document.getElementById('tab-avis') )
				document.getElementById('tab-avis').style.display ='none';
		}
				
			
		document.getElementById(pDiv).style.display ='';					
		
	}
	
	
	/* AFFICHE le prix en fonction de l'option */
   function FormatNumber(num)
   {
     if(isNaN(num)) { num = "0"; }
     sign = (num == (num = Math.abs(num)));
     num = Math.floor(num*100+0.50000000001);
     cents = num%100;
     num = Math.floor(num/100).toString();
     if(cents<10) { cents = "0" + cents; }
     for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
     {
       num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3));
     }
     return (((sign)?'':'-') + num + '.' + cents);
   }

     function FormatNumber1(num)
  {
    if(isNaN(num)) { num = "0"; }
    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num*1+0.50000000001);
    cents = num%100;
    num = Math.floor(num/100).toString();
    if(cents<10) { cents = "0" + cents; }
    for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
    {
      num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3));
    }
    return (((sign)?'':'-') + num + ',' + cents);
  }

  function showPrice(form)
  {
   var currencysymbol1 = "";
    var currencysymbol2 = "";
    var myTotalPrice = 0;
    var showUP = 0;
    var myMathProblem = "";
    myItemPrice = parseFloat(form.nuPrice.value);

   myDollarSign2 = form.nuPrice.value.indexOf("€",0)
   if ( myDollarSign2 != "-1" )
   {
      currencysymbol1 = "";
     currencysymbol2 = "€";
   } else {
     currencysymbol1 = "$";
     currencysymbol2 = "";
   }

   for (var i = 0; i < form.elements.length; i++)
    {
      var e = form.elements[i];
      if ( e.type == 'select-one' )
      {
        showUP = 1;
        Item = e.selectedIndex;
        myPrice = e.options[Item].text;
        myDollarSign = myPrice.indexOf("$",0)
        if ( myDollarSign != "-1" )
        {
        currencysymbol1 = "$";
        currencysymbol2 = "";
          myParSign = myPrice.indexOf(")", myDollarSign);
          myAttributeString = myPrice.substring(myDollarSign+1, myParSign);
          myAttributeString = myAttributeString.replace(/,/,"");
          myAttributePrice = parseFloat(myAttributeString);
          myMathProblem = myPrice.charAt(myDollarSign - 1);
        } else {
         myDollarSign1 = myPrice.indexOf("(",0)
         if ( myDollarSign1 != "-1" )
         {
         currencysymbol1 = "";
          currencysymbol2 = "€";
         myParSign = myPrice.indexOf(")", myDollarSign1);
         myAttributeString = myPrice.substring(myDollarSign1+1, myParSign);
         myAttributeString = myAttributeString.replace(/,/,"");
         myAttributePrice = parseFloat(myAttributeString);
         myMathProblem = myPrice.charAt(myDollarSign1 - 1);
         } else {
         myAttributePrice = 0;
         }
     
      }
          if (myMathProblem == "-")
          {
            myTotalPrice = myTotalPrice - myAttributePrice;
          } else {
            myTotalPrice = myTotalPrice + myAttributePrice;
          }
      }
    }
    if ( showUP )
    {
      myDollarSign3 = form.nuPrice.value.indexOf(".",0)
      if ( myDollarSign3 != "-1" )
      {
        myTotalPrice = FormatNumber(myTotalPrice + myItemPrice);
      } else {
        myTotalPrice = FormatNumber1(myTotalPrice + myItemPrice);
      }
        document.getElementById("productNEWprice").innerHTML = currencysymbol1 + myTotalPrice + currencysymbol2;
    }
  }

    function showPrice1(form)
  {
   var currencysymbol1 = "";
    var currencysymbol2 = "";
    var myTotalPrice = 0;
    var showUP = 0;
    var myMathProblem = "";
    myItemPrice = parseFloat(form.nuPrice1.value);

   myDollarSign2 = form.nuPrice1.value.indexOf("€",0)
   if ( myDollarSign2 != "-1" )
   {
      currencysymbol1 = "";
     currencysymbol2 = "€";
   } else {
     currencysymbol1 = "$";
     currencysymbol2 = "";
   }

   for (var i = 0; i < form.elements.length; i++)
    {
      var e = form.elements[i];
      if ( e.type == 'select-one' )
      {
        showUP = 1;
        Item = e.selectedIndex;
        myPrice = e.options[Item].text;
        myDollarSign = myPrice.indexOf("$",0)
        if ( myDollarSign != "-1" )
        {
        currencysymbol1 = "$";
        currencysymbol2 = "";
          myParSign = myPrice.indexOf(")", myDollarSign);
          myAttributeString = myPrice.substring(myDollarSign+1, myParSign);
          myAttributeString = myAttributeString.replace(/,/,"");
          myAttributePrice = parseFloat(myAttributeString);
          myMathProblem = myPrice.charAt(myDollarSign - 1);
        } else {
         myDollarSign1 = myPrice.indexOf("(",0)
         if ( myDollarSign1 != "-1" )
         {
         currencysymbol1 = "";
          currencysymbol2 = "€";
         myParSign = myPrice.indexOf(")", myDollarSign1);
         myAttributeString = myPrice.substring(myDollarSign1+1, myParSign);
         myAttributeString = myAttributeString.replace(/,/,"");
         myAttributePrice = parseFloat(myAttributeString);
         myMathProblem = myPrice.charAt(myDollarSign1 - 1);
         } else {
         myAttributePrice = 0;
         }
     
      }
          if (myMathProblem == "-")
          {
            myTotalPrice = myTotalPrice - myAttributePrice;
          } else {
            myTotalPrice = myTotalPrice + myAttributePrice;
          }
      }
    }
    if ( showUP )
    {
      myDollarSign3 = form.nuPrice1.value.indexOf(".",0)
      if ( myDollarSign3 != "-1" )
      {
        myTotalPrice = FormatNumber(myTotalPrice + myItemPrice);
      } else {
        myTotalPrice = FormatNumber1(myTotalPrice + myItemPrice);
      }
        document.getElementById("productNEWprice1").innerHTML = currencysymbol1 + myTotalPrice + currencysymbol2;
    }
  }

	
	