//top

function CurrencyPopup(QueryString)
{
  CurrencyWindow = window.open ('', 'CurrencyWindow', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,height=170,width=600')
  CurrencyWindow.focus()
  CurrencyWindow.location.href = 'http://www.xe.net/ecc/input.cgi?Template=sw&'+QueryString
}

function LoadShopDropsA()
{
   var sf = document.buy_form.s.value;
   var opt_idx = 1;

   switch (sf) {
      case '1':  opt_idx = 0;  break; /* USD */
      case '4':  opt_idx = 1;  break; /* EUR */
      case '8':  opt_idx = 2;  break; /* GBP */
   }   
 
   //document.top_search_form.csa.selectedIndex = opt_idx;
   document.side_dummy_form.csb.selectedIndex = opt_idx;
   //document.side_dummy_form.csc.selectedIndex = opt_idx;
   //document.bottom_dummy_form.csd.selectedIndex = opt_idx;
   if (document.buy_form) {
      if (document.buy_form.currency_changer) {
	     document.buy_form.currency_changer.selectedIndex = opt_idx;
	  }
   }
}

function SwitchToShop(droper)
{
   var page;
   if (droper.options[droper.selectedIndex].value != document.buy_form.s.value)
   {
      page = String(window.location.href);
      page = page.substring(page.lastIndexOf('/'));
      switch (droper.options[droper.selectedIndex].value) {
         case '1': self.location = '../cat-usa-usd' + page;  break;
	     case '4': self.location = '../cat-eu-eur'  + page;  break;
	     case '8': self.location = '../cat-gb-gbp'  + page;  break;
	  }
   }
}


function FixAllProductImageSizes() {
   var imgs = new Array();
   if (document.getElementsByTagName) {
      imgs = document.getElementsByTagName('IMG');
   }
   for (x=0; x < imgs.length; x++) {
      if (String(imgs[x].src).indexOf('objetdoutre.com/product-img/small/') != -1) {
	     h = imgs[x].height;
	     w = imgs[x].width;
/*
	     if (w > h) {
*/
	        if (w > 182) {
		       imgs[x].width = 182;
			   imgs[x].height = (h / w) * 182
		    }
/*
	     } else {
	        if (h > 182) {
		       imgs[x].height = 182;
			   imgs[x].width = (w / h) * 182
		    }
	     } 
*/
      }
   }
}



function goto_cat_page(page_name) {
   var s = 1;
   //var page_prefix = 'http://localhost/rng/zee_new_site/web1 - Objetdoutre/';
   var page_prefix = 'http://www.objetdoutre.com/v5/';
   
   // determine shop flag
   if (document.buy_form) {
      if (document.buy_form.s) {
	     s = parseInt(document.buy_form.s.value);
	  }
   }

   switch (s) {
      case 1:  page_prefix += 'cat-usa-usd/';  break;
      case 4:  page_prefix += 'cat-eu-eur/';   break;
      case 8:  page_prefix += 'cat-gb-gbp/';   break;
	  
      default: page_prefix += 'cat-usa-usd/';   break;
   }
   
   location = page_prefix + page_name;
}

function goto_noncat_page(page_name) {
   var s = 1;
   //var page_prefix = 'http://localhost/rng/zee_new_site/web1 - Objetdoutre/';
   var page_prefix = 'http://www.objetdoutre.com/v5/';
   
   // determine shop flag
   if (document.buy_form) {
      if (document.buy_form.s) {
	     s = parseInt(document.buy_form.s.value);
	  }
   }
   
   location = page_prefix + page_name + '?s=' + s;
}

function goto_ssl_gateway(page_options) {
   var s = 1;
   //var page_name = 'https://vault1.secured-url.com/pendragongothic/objetdoutre/ssl/gateway.php';
   var page_name = 'https://www.otherwayup.com/ssl_objetdoutre/ssl/gateway.php';
   
   // determine shop flag
   if (document.buy_form) {
      if (document.buy_form.s) {
	     s = parseInt(document.buy_form.s.value);
	  }
   }
   
   location = page_name + '?s=' + s + '&' + page_options;
}

