// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

var current_tab = 'product_2';

function setCurrentTab(new_tab) {
  $(current_tab).src = $(current_tab).src.replace(/-over/, "").replace(/(.*)\.(jpg|gif|png)$/i, "$1.$2");
  current_tab = new_tab;
  $(current_tab).src = $(current_tab).src.replace(/-over/, "").replace(/(.*)\.(jpg|gif|png)$/i, "$1-over.$2");
}

function setRolloverTab(new_tab) {
  if (new_tab != current_tab) {
    $(new_tab).src = $(new_tab).src.replace(/-over/, "").replace(/(.*)\.(jpg|gif|png)$/i, "$1-over.$2");
  }
}

function resetRolloverTab(new_tab) {
  if (new_tab != current_tab) {
    $(new_tab).src = $(new_tab).src.replace(/-over/, "").replace(/(.*)\.(jpg|gif|png)$/i, "$1.$2");
  }
}

function setElementText(element, text) {
  $(element).innerHTML = text;
}

function zoomPhoto(image_name) {
  var win = window.open('/products/zoom/?image_name=' + image_name, 'detail', 'width=809,height=650,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0');
  win.focus();
}

function markForDestroy(element) {
  $(element).next('.should_destroy').value = 1;
  $(element).up('.variation_tier_price').hide();
}
