
/*
  switched tabs door middel classes:
  active: actieve tabblad (display: block oid)
  inactive: de verborgen tabbladen (display: none )
  open: het actieve tabje
*/
function activate_tab(prevtab, newtab)
{
  //schakel oude tab uit
  $('tab'+prevtab).removeClassName('active');
  $('tab'+prevtab).addClassName('inactive');
  $('tab'+prevtab + 'tab').removeClassName('active')
  if ($('tab'+(prevtab+1)+'tab')) $('tab'+(prevtab+1)+'tab').removeClassName('active-2');
  //schakel nieuwe tab in
  $('tab'+newtab).removeClassName('inactive');
  $('tab'+newtab).addClassName('active');
  $('tab'+newtab+'tab').addClassName('active');
  if ($('tab'+(newtab+1)+'tab')) $('tab'+(newtab+1)+'tab').addClassName('active-2');

  return newtab;
}

function activate_imagetab(prevtab, newtab)
{
  //schakel oude tab uit
  $(prevtab).removeClassName('active');
  $(prevtab).addClassName('inactive');
  //schakel nieuwe tab in
  $(newtab).removeClassName('inactive');
  $(newtab).addClassName('active');

  return newtab;
}

function add_compare_product_silent(product_id)
{
  new Ajax.Request('/Ajax?module=Productcompare', {
    parameters: {
      m: 'add_compare_product',
      id: product_id
    }
  });
}

function add_compare_product(product_id)
{
  /*
  var ca = $('compare-animation');
  ca.style.width = '700px';
  ca.style.height = '150px';
  ca.style.top = '100px',
  ca.style.left = '250px'
  ca.style.display = '';
  new Effect.Parallel(
    [ new Effect.Morph('compare-animation', {
      style: {
        width: '150px',
        height: '30px'
      }
     }),
    new Effect.Move('compare-animation', {
      x: 20,
      y: 300,
      mode: 'absolute'
    })
  ], {
    afterFinish: function() {
      $('compare-animation').style.display = 'none';
    }
  });
  */
  new Ajax.Updater('productvergelijkermenu', '/Ajax?module=Productcompare', {
    parameters: {
      m: 'add_compare_product',
      id: product_id
    },
    onComplete: function() {
      new Effect.Highlight('productvergelijkermenu', {
        startcolor: '#ff8800'
      });
    }
  });
}

function product_press_selectcolor(color) {
	if ($('pressimages')) {
		var elems_all = $('pressimages').getElementsByClassName('pimg');
		var elems_color = $('pressimages').getElementsByClassName('pimg-color-' + color);
	
		for (var i=0; i<elems_all.length; i++) {
			elems_all[i].style.display = 'none';
		}
	
		for (var c=0; c<elems_color.length; c++) {
			elems_color[c].style.display = 'block';
		}
	}
}