
<!-- REQUEST ID: TIME=1329983174728:NODE=c2a6002:THREAD=1231 -->
  <!--!esi:include src="/store?Action=DisplayESIPage&Currency=USD&ESIHC=3de49a36&Env=DESIGN&Locale=en_US&SiteID=ubina&ThemeID=8605600&ceid=184658500&cename=DRProductInfo&content=image+displayName+price+buyLink&id=DRProductInfoJSPage&productID=218942200&version=2"-->







<!-- REQUEST ID: TIME=1329983174867:NODE=c2a6002:THREAD=1231; ESI Fragment - CREATED: Thu Feb 23 01:46:14 CST 2012 MAX-AGE: 0+180 -->









  
  
    /* Digital River ProductInfo Widget */
    /* HTML Output */
    
    
    
    
    
      
      
        
        (function(){
          
          var jsonData = {"productInfo":{"product":{"productID":218942200,"image":{"alt":"Might & Magic Heroes VI - Deluxe Edition","src":"//drh2.img.digitalriver.com/DRHM/Storefront/Company/ubi/images/product/detail/MMH6_PC_BXSHT_DLX_FINAL.jpg"},"displayName":"Might & Magic Heroes VI - Deluxe Edition","price":{"taxIncludedInPrice":false,"discounted":false,"unitPrice":"$54.99","unitPriceWithDiscount":"$54.99"},"buyLink":{"text":{"preOrder":false,"#text":"buy now"},"href":"http://shop.ubi.com/store/ubina/en_US/buy/ThemeID.8605600/productID.218942200"}}}};
          // Continue if at least 1 product exists
          if (jsonData.productInfo.product) {
            // Wrap the content in a certain HTML tag
            function tagWrap(className, innerContent, tagName) {
              tagName = tagName || 'div';
              return '<'+tagName+' class="'+className+'">'+innerContent+'</'+tagName+'>';
            }
            // Determine how to build the HTML for each piece of content
            function getSwitchOutput(productJson) {
              var output = '';
              for (var propertyName in productJson) {
                if (propertyName != 'productID') {
                  var data = productJson[propertyName];
                  if (data) { 
                    var piece = '';
                    switch (propertyName) {
                      
                      
                        
                          
                            
                          
                          
                            case 'image' :
                            case 'thumbnail' :
                              // Only create the <img> tag when the src exists
                              if (data.src) {
                                piece = '<img src="'+data.src+'" alt="'+data.alt.replace(/\"/g,'&quot;')+'"/>';
                              }
                              break;
                            
                          
                          
                          
                        
                      
                        
                          
                            
                          
                          
                          
                            
                              
                            
                            
                              
                              case 'displayName' :
                                piece = tagWrap('dr_productName', data);
                                break;
                            
                          
                          
                            
                            
                            
                              
                            
                            
                              
                              
                              
                              
                              
                            
                          
                        
                      
                        
                          
                            
                          
                          
                          
                            
                              
                            
                            
                          
                          
                            
                            
                            
                              
                            
                            
                              
                              
                              
                              
                              
                                case 'price' :
                                  var productPrice = '';
                                  // Strike-through price
                                  if (data.discounted) {
                                    productPrice += tagWrap('dr_regularPriceLabel', "Regular Price:", 'span');
                                    productPrice += tagWrap('dr_strikePrice', '<span style="text-decoration:line-through">' + data.unitPrice + '</span>', 'span');
                                    if (data.taxIncludedInPrice) {
                                      productPrice += ' ' + tagWrap('lightgray', "incl. VAT", 'span');
                                    }
                                    productPrice += '<br/>' + tagWrap('dr_promoPriceLabel', "Promo Price:", 'span');
                                  }
                                  // Actual (discounted) price
                                  productPrice += tagWrap('dr_actualPrice', data.unitPriceWithDiscount, 'span');
                                  if (data.taxIncludedInPrice) {
                                    productPrice += ' ' + tagWrap('lightgray', "incl. VAT", 'span');
                                  }
                                  // Final product price
                                  piece = tagWrap('dr_productPrice', productPrice);
                                  break;
                              
                            
                          
                        
                      
                        
                          
                            
                          
                          
                          
                            
                              
                            
                            
                          
                          
                            
                            
                            
                              
                            
                            
                              
                                case 'buyLink' :
                                  piece = tagWrap('dr_siteButton', '<a href="'+data.href+'">' + data.text['#text'] + '</a>');
                                  break;
                              
                              
                              
                              
                              
                            
                          
                        
                      
                      default :
                        piece = tagWrap('dr_'+propertyName, data);
                    } 
                    output += piece;
                  } 
                } 
              } 
              return output;
            }
            // Shortcut variable to the product array
            var product = jsonData.productInfo.product;
            // If only 1 product was requested, turn it into an array
            if (product.constructor != Array) {
              product = [product];
            }
            // Write out the content for each product
            for (var i=0;i<product.length;i++) {
              if (product[i].error) {
                document.write(tagWrap('dr_error', product[i].error['#text'], 'span'));
              }
              else {
                document.write(tagWrap('dr_productInfoProduct', getSwitchOutput(product[i])));
              }
            }
          }
        })();
      
    
  


<!--!/esi:include -->

