function popWin(page) {
  window.open(page, "","height=385,width=436,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=no,toolbar=no,directories=no");
}
function popCoupon(page,width,height) {
  window.open(page, "","height="+(height+20)+",width="+(width+20)+",location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no,directories=no");
}
function popFeedback(page,width,height) {
  window.open(page, "","height="+(height)+",width="+(width)+",location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=no,toolbar=no,directories=no");
}


function changeTab(tab) {
  tabs = ['Main','Types','Gallery'];
  for(i=0; i<tabs.length; i++) {
    i_tab = tabs[i];
    if (i_tab == tab) {
      $('Tab' + i_tab).addClassName('on');
      $('TabCopy' + i_tab).show();
    } else {
      $('Tab' + i_tab).removeClassName('on');
      $('TabCopy' + i_tab).hide();
    }
  }
}


var gallery_types = [];
var gallery_type = '';
var gallery_number = '';

function changeGalleryMain() {
  $('Main_Image').src = '/Skins/Shared/tabs/Images/gallery-optimized/' + gallery_type + '_' + gallery_number + '.jpg';

  for(i=1; i<= 6; i++) {
    if (i == gallery_number) {
      $('Thumbnail_' + gallery_type + '_' + i).addClassName('on');
    } else {
      $('Thumbnail_' + gallery_type + '_' + i).removeClassName('on');
    }
  }
}

function changeGalleryMainPrevious() {
  gallery_number--;
  if (gallery_number < 1) gallery_number = 6;
  changeGalleryMain();
}

function changeGalleryMainNext() {
  gallery_number++;
  if (gallery_number > 6) gallery_number = 1;
  changeGalleryMain();
}

function changeGalleryMainFromThumbnail(number) {
  gallery_number = number;
  changeGalleryMain();
}

function changeGalleryType(type) {
  gallery_type = type;
  gallery_number = 1;

  for(i=0; i<gallery_types.length; i++) {
    i_type = gallery_types[i];
    if (i_type == type) {
      $('Type_' + i_type).addClassName('on');
      $('Thumbnails_' + i_type).show();
    } else {
      $('Type_' + i_type).removeClassName('on');
      $('Thumbnails_' + i_type).hide();
    }
  }

  changeGalleryMain();
}
