if(!document.domain) {
  document.domain = '21torr.com';
}

function GetMappedProductID(productIdentifier,onSuccess) {
  $.getJSON(OXID_FULLDOMAIN+'/iwc2oxid.php', 'productIdentifier='+productIdentifier, onSuccess);
}

// Method that is called to trigger the contact form
function InvokeRequestInfo(productIdentifier,countryCode) {
  GetMappedProductID(productIdentifier,function(data) {
    window.top.location.href=OXID_FULLDOMAIN+'/index.php?cl=contact&anid='+data.OXID+'';
  });
}

// Method that is called to trigger the email a friend function
// // ProductIdentifier: the IWC product reference
function InvokeShowEmailAFriend(productIdentifier) {
  GetMappedProductID(productIdentifier,function(data) {
    window.top.location.href=OXID_FULLDOMAIN+'/empfehlen/?anid='+data.OXID+'';
  });
}
// // Method to invoke the add to wishlist function
// // ProductIdentifier: the IWC product reference
function InvokeAddToWishList(productIdentifier) {
  GetMappedProductID(productIdentifier,function(data) {
    window.top.location.href=OXID_FULLDOMAIN+'/index.php?cl=details&aid='+data.OXID+'&anid='+data.OXID+'&fnc=towishlist&am=1&cnid='+OXID_CNID+'&listtype=list';
  });
}
// // Method to invoke the add to basket function
// // ProductIdentifier: the IWC product reference
// // countryCode: the country to add the product for
function InvokeAddToBasket(productIdentifier, countryCode) {
  GetMappedProductID(productIdentifier,function(data) {
    oxid.popup.load();
    
    $.ajax({
      url: OXID_FULLDOMAIN+'/index.php',
      type: "GET",
      data: 'force_sid='+OXID_SID+'&cnid='+OXID_CNID+'&cl=start&fnc=tobasket&aid='+data.OXID+'&anid='+data.OXID+'&pgNr=-1&am=1',

      success: function(data2){
        window.top.location.href=OXID_FULLDOMAIN+'?cl=details&anid='+data.OXID+'';
        //OXID_CURRENT;
        // '/index.php?cl=start&cnid='+OXID_CNID+'&anid='+productIdentifier+'';
      }
    });
  });
}
// // Method to return current language 
function GetLanguageCode() {
  return 'de';
}
// // Method to return the current country 
function GetCountryCode() {
  return 'DE';
}
// // Method to be called when the pricing webservice failed
function InvokePricingWebserviceFailed() {
  alert('Could not determine the most recent price for this product.');
}

