
function showproduit(id){
			new Ajax.Updater('main_product_image', 'image_display.php?url='+id, {asynchronous:true});
	}
	
function showminis(model,color,path){
			new Ajax.Updater('the_miniatures', 'image_display_2.php?themodel='+model+'&thecolor='+color+'&thepath='+path, {evalScripts:true,asynchronous:true});
	}	


		function checkstock(){
	
var params = Form.serialize($('productinfo'));
//alert(params);
new Ajax.Updater('stockcheck', 'stock_check.php', {evalScripts:true, asynchronous:true, parameters:params});

}	
	
	
			function checkstock_stockdp(){
	
var params = Form.serialize($('productinfo'));
//alert(params);
new Ajax.Updater('taillescheckstock', 'size_stock_check.php', {evalScripts:true, asynchronous:true, parameters:params});

}	





var RedBox = {

  showInline: function(id)
  {
    this.showOverlay();
    new Effect.Appear('RB_window', {duration: 0.4, queue: 'end'});        
    Element.scrollTo('RB_window');
    this.cloneWindowContents(id);
  },

  loading: function()
  {
    this.showOverlay();
    Element.show('RB_loading');
    this.setWindowPosition();
  },

  addHiddenContent: function(id)
  {
    this.removeChildrenFromNode($('RB_window'));
    this.moveChildren($(id), $('RB_window'));
    Element.hide('RB_loading');
    new Effect.Appear('RB_window', {duration: 0.4, queue: 'end'});  
    Element.scrollTo('RB_window');
    this.setWindowPosition();
  },

  close: function()
  {
    new Effect.Fade('RB_window', {duration: 0.4});
    new Effect.Fade('RB_overlay', {duration: 0.4});
  },

  showOverlay: function()
  {
    if ($('RB_redbox'))
    {
      Element.update('RB_redbox', "");
      new Insertion.Top($('RB_redbox'), '<div id="RB_window" style="display: none;"></div><div id="RB_overlay" style="display: none;"></div>');  
    }
    else
    {
      new Insertion.Bottom(document.body, '<div id="RB_redbox" align="center"><div id="RB_window" style="display: none;"></div><div id="RB_overlay" style="display: none;"></div></div>');      
    }
    new Insertion.Top('RB_overlay', '<div id="RB_loading" style="display: none"></div>');  

    this.setOverlaySize();
    new Effect.Appear('RB_overlay', {duration: 0.4, to: 0.3, queue: 'end'});
  },

  setOverlaySize: function()
  {
    if (window.innerHeight && window.scrollMaxY)
    {  
      yScroll = window.innerHeight + window.scrollMaxY;
    } 
    else if (document.body.scrollHeight > document.body.offsetHeight)
    { // all but Explorer Mac
      yScroll = document.body.scrollHeight;
    }
    else
    { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
      yScroll = document.body.offsetHeight;
    }
    $("RB_overlay").style['height'] = yScroll +"px";
  },

  setWindowPosition: function()
  {
    var pagesize = this.getPageSize();  
  
    $("RB_window").style['width'] = 'auto';
    $("RB_window").style['height'] = 'auto';

    var dimensions = Element.getDimensions($("RB_window"));
    var width = dimensions.width;
    var height = dimensions.height;        
    
    $("RB_window").style['left'] = ((pagesize[0] - width)/2) + "px";
    $("RB_window").style['top'] = ((pagesize[1] - height)/2) + "px";
  },


  getPageSize: function() {
    var de = document.documentElement;
    var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
    var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
  
    arrayPageSize = new Array(w,h) 
    return arrayPageSize;
  },

  removeChildrenFromNode: function(node)
  {
    while (node.hasChildNodes())
    {
      node.removeChild(node.firstChild);
    }
  },

  moveChildren: function(source, destination)
  {
    while (source.hasChildNodes())
    {
      destination.appendChild(source.firstChild);
    }
  },

  cloneWindowContents: function(id)
  {
    var content = $(id).cloneNode(true);
    content.style['display'] = 'block';
    $('RB_window').appendChild(content);  

    this.setWindowPosition();
  }

}



function majQuantity(qty,i)
{
     quantity = document.cart_quantity['cart_quantity['+i+']'].value;
     quantity = parseInt(quantity) + parseInt(qty)
     if (quantity < 1)
     {
      quantity = 0;
     }
     document.cart_quantity['cart_quantity['+i+']'].value = quantity;
}


	function send_tf(){

var params = Form.serialize($('sendtofriend_f'));

new Ajax.Updater('send_box_bis', 'sendtofriend_ajax.php', {evalScripts:true, asynchronous:true,onSuccess:function(request){}, parameters:params});

}



	function send_nl(){

var params = Form.serialize($('nl_f'));

new Ajax.Updater('send_box_bis', 'nl_ajax.php', {evalScripts:true, asynchronous:true,onSuccess:function(request){}, parameters:params});

}