/***************************************************************************************************** * name: overlay.js * description: used to control/process the creation of the EA Shopping Cart / EA Add to Cart overlay. * coded: christopher volz @ Surly Burro ******************************************************************************************************/ /**************************************** * Add Onload Functions to init Array ****************************************/ initArray[initArray.length] = updateGUSCartQty; /**************************************** * Objects ****************************************/ function product(name, id, platform, thumbnail, productType, releaseDate, preorderEnabled, purchaseEnabled, isOrderable, deliveryMethod, price, language ) { this.name = name; this.id = id; this.platform = platform; this.thumbnail = thumbnail; this.productType = productType; this.releaseDate = releaseDate; this.preorderEnabled = preorderEnabled; this.purchaseEnabled = purchaseEnabled; this.isOrderable = isOrderable; this.deliveryMethod = deliveryMethod; this.price = price; this.language = language; } function error( id, err ) { this.id = id; this.error = err; } function widthHeight() { this.width = 0; this.height = 0; } var prodArray = new Array(); var errorArray = new Array(); var addToCartArray = new Array(); var drCurrentOverlay = ""; var moo = false; var utilsXML = false; if( typeof xmlDocs == "undefined" ) { var xmlDocs = new Array(); } /**************************************** * XML Processing Methods ****************************************/ function loadOverlayData( args ) { var mooAjax = null; gameName = formatGameTitle( args ); // change to ea URL during integration if(!xmlDocs[drCurrentOverlay]) { if(utilsXML) loadXMLDoc("/service/digitalriver/skud-data/"+gameNamedrCurrentOverlay,handleXMLresponse, overlayXMLWait); if(moo) mooAjax = new Ajax("/service/digitalriver/skud-data/"+gameName, {method: "get", onComplete: handleXMLresponse}).request(); } else { handleXMLresponse(); } return; } function handleXMLresponse(text, xml) { var skudxml = ""; // detect errors if( (utilsXML && !xmlDocs[drCurrentOverlay]) || (moo && xml == null) ) { drSurfaceError(); return; } // get xml if( moo && xml != null ) { skudxml = xml; // second argument == moo Ajax response XML } if( utilsXML && xmlDocs[drCurrentOverlay] ) { var skudxml = xmlDocs[drCurrentOverlay].xml; } // last chance to detect errors if(!skudxml) { drSurfaceError(); return; } parseXML(skudxml); return; } function parseXML(xml) { var skudxml = xml; var products = new Array(); var productNodes = skudxml.getElementsByTagName("product"); // process the XML for(i=0;i'); } catch( e ) { skudthumb = document.createElement("div"); skudthumb.setAttribute("id", "skudthumb"); } oc.appendChild(skudthumb); } if( !skform ) { try { skform = document.createElement('
'); } catch( e ) { skform = document.createElement("div"); skform.setAttribute("id", "skudform"); } oc.appendChild(skform); } else { removeChildren( skform ); // remove any child nodes } var p = prodArray[0]; createThumbnail( p ); // create product thumbnail str = "Before we can add " + p.name + " to your cart, please make the following selection:"; changeInfoBanner( str ); // populate the Info Banner changeOverlayState(0); return; } function createPlatformSelector() { div = document.getElementById("skudform"); // create the platform heading strong = document.createElement("strong"); strong.setAttribute('id', 'skudplat'); strong.innerHTML = "Platform:" div.appendChild(strong); var opt; var sel; var hasDigitalProductBeenCreated = false; // to aggregate all digital products under 1 heading try { sel = document.createElement('