var new_image = new Image();
var check_complete = '';


// open pop-up
function open_popup(url, options, target)
  {
  if (!options)
    options = 'width=600,height=600,scrollbars=yes';
  if(!target)
    target = '';
    
  window.open(url,target, options).focus();
  return false;
  }


// change product_image
function change_product_image(image)
  {
  document.getElementById('master_product_image').src = image;
  }


// change amount in basket
function edit_basket(product_id, value, default_value)
  {
  var value = parseInt(value);
  if(!value)
    var request = 'action.html?action=change&product_id='+product_id+'&quantity='+default_value;
  else
    var request = 'action.html?action=change&product_id='+product_id+'&quantity='+value;

  document.location.href = request;
  }


// switch off one or more divs....
function show_layer(new_div, old_divs)
  {

  if(old_divs)
    {
    if(typeof(old_divs)==Array)
      {
      for (var i=0; i<old_divs.length; i++)
        {
        document.getElementById(old_divs[i]).style.visibility = 'hidden';
        document.getElementById(old_divs[i]).style.display = 'none';
        }
      }
    else
      {
      document.getElementById(old_divs).style.visibility = 'hidden';
      document.getElementById(old_divs).style.display = 'none';
      }
    }

  // show new layer
  document.getElementById(new_div).style.visibility = 'visible';
  document.getElementById(new_div).style.display = 'block';
  }


// clear search input-field
function clear_search(default_value)
  {
  if(default_value)
    document.getElementById('searchfield').value = default_value;
  else    
    document.getElementById('searchfield').value = '';
  }


