/*
* Copyright (c)2009 Amazon.com, Inc.
* All rights reserved.
*/

d16g.types={};d16g.ads={};d16g.getLabel=function(){return"d16g";};d16g.log=function(msg,that){if(d16g.adDebug===true&&typeof console!=='undefined'&&typeof console.log==='function'){if(typeof that!=="undefined"&&typeof that.getLabel==="function"){console.log(that.getLabel()+msg);}else{console.log(msg);}}};d16g.warn=function(msg,that){if(d16g.adDebug===true&&typeof console!=='undefined'&&typeof console.warn==='function'){if(typeof that!=="undefined"&&typeof that.getLabel==="function"){console.warn(that.getLabel()+msg);}else{console.warn(msg);}}};d16g.info=function(msg,that){if(d16g.adDebug===true&&typeof console!=='undefined'&&typeof console.info==='function'){if(typeof that!=="undefined"&&typeof that.getLabel==="function"){console.info(that.getLabel()+msg);}else{console.info(msg);}}};d16g.error=function(msg,that){if(d16g.adDebug===true&&typeof console!=='undefined'&&typeof console.error==='function'){if(typeof that!=="undefined"&&typeof that.getLabel==="function"){console.error(that.getLabel()+msg);}else{console.error(msg);}}};d16g.loadJs=function(jsUrl){var scriptElem=document.createElement('script');scriptElem.src=jsUrl;document.getElementsByTagName('head')[0].appendChild(scriptElem);};d16g.make=function(F){return new F();};d16g.extend=function(F){var G=function(){};G.prototype=new F();return G;};d16g.parseBool=function(value){var result;switch(typeof value){case'number':result=(value!==0);break;case'string':var test=value.toLowerCase();if(test==='yes'||test==='1'||test==='true'){result=true;}else if(test==='no'||test==='0'||test==='false'||test===''){result=false;}
break;case'boolean':result=value;break;case"undefined":case"function":d16g.error("d16g.parseBool(): value type is undefined or a function! Parameter type="+typeof value+", value="+value);break;default:d16g.warn("d16g.parseBool(): value type is not handled explicitly. Parameter type="+typeof value+", value="+value);}
return result;};d16g.defaultBoolFalse=function(value){var result=value;if(typeof value!=='boolean'){result=false;d16g.log("d16g.defaultBoolFalse(): Returning false as default. Parameter type="+typeof value+", value="+value);}
return result;};d16g.defaultBoolTrue=function(value){var result=value;if(typeof value!=='boolean'){result=true;d16g.log("d16g.defaultBoolTrue(): Returning true as default. Parameter type="+typeof value+", value="+value);}
return result;};d16g.adFeedback={};d16g.adFeedback.constants=function(){return{USER_ACTION:"userAction",WIDGET_OPEN:"widgetOpened",WIDGET_SUBMITTED:"widgetSubmitted",CHAR_LIMIT:1000};};d16g.adFeedback.logOpen=function(my){var constants=d16g.adFeedback.constants();var params=d16g.adFeedback.getMetaData(my);params[constants.USER_ACTION]=constants.WIDGET_OPEN;d16g.adFeedback.sendClog(params);};d16g.adFeedback.log=function(my){var constants=d16g.adFeedback.constants();var params=d16g.adFeedback.getMetaData(my);var feedbackContainerId="#adfeedbackpopover"+my.randomId;params[constants.USER_ACTION]=constants.WIDGET_SUBMITTED;jQuery(feedbackContainerId+" input").each(function(){if((this.type==="radio")||(this.type==="checkbox")){if(this.checked){params[this.name]=this.value;}}else{params[this.name]=this.value;}});jQuery(feedbackContainerId+" textarea").each(function(){var tmp=this.value.substring(0,constants.CHAR_LIMIT);params[this.name]=tmp;});jQuery(feedbackContainerId+" select").each(function(){params[this.name]=this.value;});d16g.adFeedback.sendClog(params);};d16g.adFeedback.getMetaData=function(my){var params={};params.browser=navigator.userAgent;params.impressionId=my.impressionId;params.pagetype=my.pageType;params.pagesubtype=my.pageSubType;params.slot=my.slotName;params.questionGroupId=my.questionGroupId;params.screenRes="h="+jQuery(window).height()+",w="+jQuery(window).width();return params;};d16g.adFeedback.sendClog=function(params){d16g.log("data to be logged:",this);for(var i in params){if(params.hasOwnProperty(i)){d16g.log('key is: '+i+', value is: '+params[i],this);}}
if(typeof(window.clientLogger)!='undefined'){d16g.log("sendingCLOG",this);window.clientLogger.sendCLOGEntry("displayad","feedback",params);}};d16g.types.Ad=function(){this.isLoaded=false;this.components={};this.pixels={};};d16g.types.Ad.prototype.recordEvent=function(adEvent){d16g.log(this.getLabel()+".recordEvent("+adEvent+")");var thisEvent=this.pixels[adEvent];if(typeof thisEvent!=="undefined"){if(typeof thisEvent.loaded==='undefined'){d16g.log(this.getLabel()+".recordEvent(): loading "+thisEvent.urls.length+" tracking pixel(s), adEvent="+adEvent+", adName="+this.adName);thisEvent.loaded=[];for(var i=0;i<thisEvent.urls.length;i++){if(thisEvent.urls[i]!==""){d16g.log(this.getLabel()+".recordEvent(): now loading pixel url="+thisEvent.urls[i]);thisEvent.loaded[i]=new Image(1,1);thisEvent.loaded[i].src=thisEvent.urls[i];}else{d16g.warn(this.getLabel()+'.recordEvent(): empty string, urls['+i+']=""');}}}}else{d16g.error(this.getLabel()+'.recordEvent(): pixels["'+adEvent+"'] is not defined for adName="+this.adName);}};d16g.types.Ad.prototype.loaded=function(){d16g.log(this.getLabel()+".loaded()");this.isLoaded=true;this.stateMachine.trigger("isLoaded");this.recordEvent("showEvent");};d16g.types.Ad.prototype.createComponent=function(config){d16g.log(this.getLabel()+".createComponent("+config+")");var component=d16g.make(d16g.types.AdComponent);component.setAd(this);component.setParams(config);var adName=this.adName;var cmpName=component.name;component.getLabel=function(){return this.ad.getLabel()+'.components["'+this.name+'"]';};switch(config.contentType){case"image":amznJQ.onReady(adName,function(){component.loadImage();});component.elementId=component.componentId;component.show=function(){component.showImage();};component.hide=function(){component.hideImage();};break;case"html":amznJQ.onReady(adName,function(){component.loadHtml();});component.show=function(){component.showHtml();};component.hide=function(){component.hideHtml();};break;case"flash":amznJQ.onReady(adName,function(){component.loadFlash();});component.elementId=component.componentId;component.show=function(){component.showFlash();};component.hide=function(){component.hideFlash();};break;case"static":amznJQ.onReady(adName,function(){component.loadStatic();});component.elementId=component.staticId;component.show=function(){component.showStatic();};component.hide=function(){component.hideStatic();};break;}
this.components[cmpName]=component;if(component.positioning.type!=="auto"){jQuery(window).bind("resize",function(){d16g.ads[adName].components[cmpName].position();});}
d16g.log(component.getLabel()+'.createComponent(): added');};d16g.types.Ad.prototype.clickedOpen=function(){d16g.log(this.getLabel()+".clickedOpen()");d16g.ads[this.adName].stateMachine.trigger("clickedOpen");this.recordEvent("expandEvent");};d16g.types.Ad.prototype.clickedClose=function(){d16g.log(this.getLabel()+".clickedClose()");d16g.ads[this.adName].stateMachine.trigger("clickedClose");this.recordEvent("collapseEvent");};d16g.types.Ad.prototype.clickedUrl=function(urlKey){d16g.log(this.getLabel()+'.clickedUrl("'+urlKey+'")');if(typeof this.clickUrls==="undefined"||typeof this.clickUrls[urlKey]==="undefined"){d16g.error(this.getLabel()+'.clickedUrl(): clickUrls or clickUrls["'+urlKey+'"] is undefined');}else{d16g.info(this.getLabel()+'.clickedUrl(): changing document location to "'+this.clickUrls[urlKey]+'"');document.location=d16g.ads[this.adName].clickUrls[urlKey];}};d16g.types.Ad.prototype.componentLoaded=function(){d16g.log(this.getLabel()+".componentLoaded()");for(var c in this.components){if(this.components[c].isLoaded===false){d16g.log(this.getLabel()+".componentLoaded(): component "+c+" is not loaded yet...returning.");return;}}
d16g.log(this.getLabel()+".componentLoaded(): components all loaded.");this.loaded();};d16g.types.Ad.prototype.createStateMachine=function(initialState,configModel){d16g.log(this.getLabel()+".createStateMachine("+initialState+", "+configModel+")");var stateMachine=d16g.make(d16g.types.StateMachine);stateMachine.setCurrentState(initialState);stateMachine.setModel(configModel);stateMachine.setAd(this);stateMachine.getLabel=function(){return this.ad.getLabel()+'.stateMachine';};this.stateMachine=stateMachine;d16g.log(stateMachine.getLabel()+'.createStateMachine(): added, currentState='+initialState);};d16g.types.Ad.prototype.getLabel=function(){return"d16g.types.Ad";};d16g.types.AdComponent=function(){this.isLoaded=false;this.anchor="";this.html="";this.contentType="";this.templateFile="";this.name="";this.height={};this.width={};this.offsets={};this.positioning={};this.resizeWidth={};this.htmlInsertion={};this.pushdown=false;this.hidden=true;};d16g.types.AdComponent.prototype.hideFlash=function(){d16g.log(this.getLabel()+".hideFlash(), contentId="+this.contentId);this.doUserCallback("hide");var thisSwf=jQuery('#'+this.contentId);thisSwf.get(0).doCollapse();if(jQuery.browser.msie){jQuery('#'+this.elementId).css("position","absolute").css("left","-99999px");}else{thisSwf.css("visibility","hidden");}
this.hidden=true;};d16g.types.AdComponent.prototype.showFlash=function(){d16g.log(this.getLabel()+".showFlash(), contentId="+this.contentId);this.hidden=false;this.position();var thisSwf=jQuery("#"+this.contentId);thisSwf.css("visibility","visible");thisSwf.get(0).doExpand();if(jQuery.browser.msie){this.position();}
this.doUserCallback("show");};d16g.types.AdComponent.prototype.loadFlash=function(){d16g.log(this.getLabel()+".loadFlash()");this.createContent();this.hidden=false;this.position();var adName=this.ad.adName;var componentName=this.name;var loaderFile=this.urls.loader;var flashvars={"adName":adName,"cmpName":componentName,"adDebug":d16g.adDebug};if(typeof this.urls!=="undefined"&&typeof this.urls.video!=="undefined"&&this.urls.video!==""){flashvars.vidUrl=this.urls.video;}
var height=Math.max(this.height.open,this.height.closed);var width=Math.max(this.width.open,this.width.closed);var params={wmode:"transparent",allowscriptaccess:"always",scale:"showall"};var attributes={"styleclass":"adNoOutline"};d16g.log(this.getLabel()+".loadFlash arguments: loaderFile="+loaderFile+", contentId="+this.contentId+", width="+width+", height="+height+", flashvars adName="+flashvars.adName+", cmpName="+flashvars.cmpName+", adDebug="+d16g.adDebug);swfobject.embedSWF(loaderFile,this.contentId,width,height,"9.0.28","expressInstall.swf",flashvars,params,attributes);if(jQuery.browser.msie){jQuery('#'+this.elementId).css("position","absolute").css("left","-99999px");}
d16g.log(this.getLabel()+".loadFlash() end");};d16g.types.AdComponent.prototype.hideStatic=function(e){d16g.log(this.getLabel()+".hideStatic()");jQuery('#'+this.elementId).css("visibility","hidden");this.hidden=true;};d16g.types.AdComponent.prototype.showStatic=function(e){d16g.log(this.getLabel()+".showStatic()");jQuery('#'+this.elementId).css("visibility","");this.hidden=false;};d16g.types.AdComponent.prototype.loadStatic=function(){d16g.log(this.getLabel()+".loadStatic(): nothing to do");this.loaded();};d16g.types.AdComponent.prototype.hideImage=function(){d16g.log(this.getLabel()+".hideImage()");jQuery("#"+this.elementId).css("visibility","hidden");jQuery("#"+this.contentId).css("visibility","hidden");this.hidden=true;};d16g.types.AdComponent.prototype.showImage=function(){d16g.log(this.getLabel()+".showImage()");d16g.fixPngs(jQuery("#"+this.elementId+"_click"));jQuery("#"+this.elementId).css("visibility","visible");jQuery("#"+this.contentId).css("visibility","visible");this.hidden=false;this.position();d16g.log(this.getLabel()+".showImage(): overlay visible");};d16g.types.AdComponent.prototype.loadImage=function(){d16g.log(this.getLabel()+".loadImage()");this.createContent();var adName=this.ad.adName;var componentName=this.name;var imageId=adName+"_"+componentName+"_img";var clickId=adName+"_"+componentName+"_click";jQuery('#'+this.contentId).html('<span id="'+clickId+'"></span>');var loadCallback=function(){d16g.log('attempting to load image for d16g.ads["'+adName+'"].components["'+componentName+'"]');jQuery('#'+clickId).append(this);d16g.ads[adName].components[componentName].loaded();};var errorCallback=function(){d16g.error('Could not load image for d16g.ads["'+adName+'"].components["'+componentName+'"]');};var img=new Image();jQuery(img).load(loadCallback).error(errorCallback).attr('src',this.imageUrl).attr('id',imageId);jQuery('#'+clickId).click(function(){d16g.ads[adName].clickedOpen();});};d16g.types.AdComponent.prototype.hideHtml=function(){d16g.log(this.getLabel()+".hideHtml()");this.doUserCallback("hide");jQuery('#'+this.elementId).removeClass("expanded").addClass("collapsed");if(jQuery.browser.msie){jQuery('#'+this.elementId).css("position","absolute").css("left","-99999px");}
this.hidden=true;};d16g.types.AdComponent.prototype.showHtml=function(){d16g.log(this.getLabel()+".showHtml()");jQuery('#'+this.elementId).removeClass("collapsed").addClass("expanded").css("height","auto");this.doUserCallback("show");if(jQuery.browser.msie&&this.positioning.type!=="overlay"&&this.positioning.type!=="component"){jQuery('#'+this.elementId).css("position","").css("left","");}
this.hidden=false;this.position();};d16g.types.AdComponent.prototype.loadHtml=function(){d16g.log(this.getLabel()+".loadHtml()");if(typeof this.html==="undefined"){d16g.error(d16g.getLabel()+".loadHtml(): Did not define inner html for adName="+this.ad.adName+", componentName="+this.componentName);}else{this.html='<div id="'+this.elementId+'" class="collapsed">'+this.html+'</div>';this.doHtmlInsertion();this.doUserCallback("load");d16g.fixPngs(jQuery('#'+this.elementId));this.loaded();}};d16g.types.AdComponent.prototype.doUserCallback=function(cbName){d16g.log(this.getLabel()+".doUserCallback("+cbName+")");if(typeof this.userCallbacks!=="undefined"){if(typeof this.userCallbacks[cbName]!=="undefined"){var userMethodName=this.userCallbacks[cbName];this[userMethodName]();}else{d16g.info(this.getLabel()+'.doUserCallback(): this.userCallbacks["'+cbName+'"], one or more callbacks defined for this component, but not one for "'+cbName+'"');}}else{d16g.info(this.getLabel()+".doUserCallback(): no userCallbacks defined for this component");}};d16g.types.AdComponent.prototype.setAd=function(ad){d16g.log(this.getLabel()+".setAd("+ad+")");this.ad=ad;};d16g.types.AdComponent.prototype.setParams=function(params){d16g.log(this.getLabel()+".setParams("+params+")");if(typeof params==='object'){for(var key in params){if(typeof key==="string"){this[key]=params[key];}}}
this.pushdown=d16g.defaultBoolFalse(d16g.parseBool(this.pushdown));this.componentId=this.ad.adName+"_"+this.name;this.contentId=this.componentId+"_co";};d16g.types.AdComponent.prototype.setHtml=function(html){d16g.log(this.getLabel()+".setHtml("+html+")");if(typeof html==='string'){this.html=html;}else{d16g.error(this.getLabel()+".setHtml(): Invalid HTML = "+html);}};d16g.types.AdComponent.prototype.loaded=function(){d16g.log(this.getLabel()+".loaded()");if(!jQuery.browser.msie){jQuery("#"+this.contentId).css("visibility","hidden");}
this.isLoaded=true;this.hidden=true;this.ad.componentLoaded();};d16g.types.AdComponent.prototype.getBaseTarget=function(){d16g.log(this.getLabel()+".getBase()");var target;if(this.positioning.type==="component"){var targetComponent=this.ad.components[this.positioning.target];target='#'+targetComponent.elementId;}else{target=this.positioning.target;}
return target;};d16g.types.AdComponent.prototype.getPos=function(){d16g.log(this.getLabel()+".getPos()");var posResult={};var target=this.getBaseTarget();d16g.log(this.getLabel()+".getPos(): where positioning type="+this.positioning.type+", target="+target);posResult=jQuery(target).eq(0).offset();d16g.log(this.getLabel()+".getPos(): left="+posResult.left+", top="+posResult.top);if(typeof this.positioning.targetLeft!=="undefined"){var leftPos=jQuery(this.positioning.targetLeft).eq(0).offset();posResult.left=leftPos.left;d16g.log(this.getLabel()+'.getPos(): since targetLeft="'+this.positioning.targetLeft+'", overriding to left='+posResult.left);}
return posResult;};d16g.types.AdComponent.prototype.position=function(){d16g.log(this.getLabel()+".position(): adType="+this.ad.adType+", hidden="+this.hidden);if(this.hidden===true){d16g.info(this.getLabel()+".position(): positioning avoided while component is hidden");}else if(typeof this.positioning==="undefined"||typeof this.positioning.type==="undefined"){d16g.error(this.getLabel()+'.position(): positioning is not defined properly for this component');}else if(this.positioning.type==="auto"){d16g.info(this.getLabel()+'.position(): positioning not needed, type="auto"');return;}else if(this.positioning.target==="none"){d16g.error(this.getLabel()+'.position(): this component has positioning type="'+this.positioning.type+'" and target="'+this.positioning.target+'"');}else{var adPos={};var elem=jQuery('#'+this.elementId);var base=jQuery(this.getBaseTarget());var basePos=this.getPos();d16g.log(this.getLabel()+'.position(): base left='+basePos.left+', width='+base.width()+'; elementId="'+this.elementId+'", width='+elem.width());adPos.left=basePos.left;d16g.log(this.getLabel()+'.position(): base top='+basePos.top+', height='+base.height()+'; elementId="'+this.elementId+'", height='+elem.height());adPos.top=basePos.top;d16g.log(this.getLabel()+".position(): final position... adPos.left="+adPos.left+", adPos.top="+adPos.top);elem.css(adPos);}};d16g.types.AdComponent.prototype.doHtmlInsertion=function(){d16g.log(this.getLabel()+".doHtmlInsertion()");if(typeof this.htmlInsertion==="undefined"||typeof this.htmlInsertion.type==="undefined"){d16g.error(this.getLabel()+".doHtmlInsertion(): htmlInsertion is not defined properly for loading this component");}else if(this.htmlInsertion.type==="none"){d16g.log(this.getLabel()+".doHtmlInsertion(): type="+this.htmlInsertion.type+", no insertion needed");}else if(typeof this.htmlInsertion.target==="undefined"){d16g.error(this.getLabel()+".doHtmlInsertion(): htmlInsertion target is missing");}else{var insertionType=this.htmlInsertion.type;var target=this.htmlInsertion.target;d16g.log(this.getLabel()+".doHtmlInsertion(): initialized for insertion, target="+target+", insertionType="+insertionType);if(this.contentType==="flash"){if(!jQuery.browser.msie){target="body";insertionType="append";d16g.info(this.getLabel()+".doHtmlInsertion(): overriding for flash contentType, target="+target+", insertionType="+insertionType);}}
switch(insertionType){case'html':case'append':case'before':case'after':var newElem=jQuery(this.html);jQuery(target)[insertionType](newElem);d16g.log(this.getLabel()+".doHtmlInsertion() attempted: target="+target+", insertionType="+insertionType);break;default:d16g.error(this.getLabel()+".doHtmlInsertion(): invalid insertionType="+insertionType);}}};d16g.types.AdComponent.prototype.createContent=function(){d16g.log(this.getLabel()+".createContent()");if(this.contentType==="static"){d16g.info(this.getLabel()+".createContent(): static component, no action needed");}else{var containerId=this.elementId;var wrapperId=this.elementId+"_wr";var contentId=this.elementId+"_co";this.html="<div id='"+containerId+"'><div id='"+wrapperId+"'><div id='"+contentId+"'>this.html</div></div></div>";d16g.log(this.getLabel()+".createContent(): attempting insertion for containerId="+containerId+", contentId="+contentId);this.doHtmlInsertion();jQuery('#'+contentId).css("visibility","hidden");jQuery('#'+containerId).css("background",this.background).css("visibility","hidden");d16g.log(this.getLabel()+".createContent(): html inserted, bgcolor applied, content and outer divs hidden");}};d16g.fixPngs=function(obj){d16g.log(this.getLabel()+".fixPngs(): testing if .png fix is needed");var browserVer=parseFloat(jQuery.browser.version);if(jQuery.browser.msie===true&&browserVer>=5.5&&browserVer<7.0){d16g.info(this.getLabel()+".fixPngs(): browser requires .png fix, applying now...");obj.find("*").each(function(){var match=(jQuery(this).css("background-image")||"").match(/url\("(.*\.png)"\)/);if(match){d16g.log(this.getLabel()+".fixPngs(): background-image="+jQuery(this).css("background-image"));var png=match[1];jQuery(this).css("background-image","none");jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+png+"',sizingMethod='scale')";}});}};d16g.types.AdComponent.prototype.getLabel=function(){return"d16g.types.AdComponent";};d16g.types.StateMachine=function(){this.model={};};d16g.types.StateMachine.prototype.setCurrentState=function(newState){d16g.log(this.getLabel()+".setCurrentState("+newState+"): oldState="+this.currentState);this.currentState=newState;};d16g.types.StateMachine.prototype.setModel=function(model){d16g.log(this.getLabel()+".setModel("+model+")");for(var i=0;i<model.length;i++){var state=model[i][0];var event=model[i][1];var nextState=model[i][2];if(typeof this.model[state]==="undefined"){this.model[state]={};}
this.model[state][event]=nextState;}};d16g.types.StateMachine.prototype.setAd=function(ad){this.ad=ad;};d16g.types.StateMachine.prototype.onState=function(stateName,callback){d16g.log(this.getLabel()+".onState("+stateName+", function() )");if(typeof this.model[stateName]==="undefined"){d16g.error(this.getLabel()+'onState(): this.model["'+stateName+'"] is undefined');}else{d16g.log(this.getLabel()+".onState(): adding callback to: stateName="+stateName);jQuery().bind(this.ad.adName+"_"+stateName,callback);}};d16g.types.StateMachine.prototype.trigger=function(eventName){d16g.log(this.getLabel()+".trigger("+eventName+")");var nextState=(this.model[this.currentState])[eventName];if(typeof nextState!=="undefined"){d16g.log(this.getLabel()+".trigger(): trigger="+this.ad.adName+"_"+nextState);jQuery().trigger(this.ad.adName+"_"+nextState);this.setCurrentState(nextState);}else{d16g.error(this.getLabel()+".trigger(): Tried to trigger '"+eventName+"' event, while in '"+this.currentState+"' state.");}};d16g.types.StateMachine.prototype.getLabel=function(){return"d16g.types.StateMachine";};d16g.createAd=function(configHash){d16g.log("d16g.createAd("+configHash+")");var ad=d16g.make(d16g.types.Ad);ad.adId=configHash.adId;ad.adName=configHash.adName;ad.getLabel=function(){return'd16g.ads["'+this.adName+'"]';};ad.createStateMachine(configHash.initialState,configHash.model);ad.adType=configHash.adType;var i;for(i=0;i<configHash.components.length;i++){ad.createComponent(configHash.components[i]);}
var cb=configHash.callbacks;for(i=0;i<cb.length;i++){var statement='ad.components["'+cb[i][2]+'"].'+cb[i][1];var func=eval(statement);ad.stateMachine.onState(cb[i][0],func);}
ad.clickUrls={};var cu=configHash.clickUrls;for(i=0;i<cu.length;i++){ad.clickUrls[cu[i][0]]=cu[i][1];}
this.ads[configHash.adName]=ad;d16g.log(ad.getLabel()+' added');};d16g.isErmSupportedPlatform=function(){d16g.log(this.getLabel()+".isErmSupportedPlatform()");return d16g.isErmBrowserCompatible()&&d16g.isErmFlashCompatible();};d16g.isErmBrowserCompatible=function(){d16g.log(this.getLabel()+".isErmBrowserCompatible()");var isCompatible=false;var platform=navigator.platform;if(platform.indexOf('Win')!=-1){if(jQuery.browser.msie&&parseFloat(jQuery.browser.version.substr(0,3))>=6){isCompatible=true;}
else if(jQuery.browser.mozilla&&parseFloat(jQuery.browser.version.substr(0,3))>=1.9){isCompatible=true;}}else if(platform.indexOf('Mac')!=-1){if(jQuery.browser.safari||(jQuery.browser.mozilla&&parseFloat(jQuery.browser.version.substr(0,3))>=1.9)){isCompatible=true;}}
return isCompatible;};d16g.isErmFlashCompatible=function(){var method=".isErmFlashCompatible()";d16g.log(this.getLabel()+method);var isCompatible=false;var ermFlashVersion=false;if((navigator.platform.substr(0,3).toLowerCase().indexOf("win")!=-1)&&jQuery.browser.msie){ermFlashVersion=d16g.getFlashActiveXVersion();}else{ermFlashVersion=d16g.getFlashPluginVersion();}
if(ermFlashVersion){var flashMinVersion=d16g.getFlashMinVersion();if(ermFlashVersion.major>flashMinVersion.major){d16g.log(this.getLabel()+method+": Major version > min major");isCompatible=true;}else if(ermFlashVersion.major==flashMinVersion.major){d16g.log(this.getLabel()+method+": Major version == min major");if(ermFlashVersion.minor>flashMinVersion.minor){d16g.log(this.getLabel()+method+": Minor version > min minor");isCompatible=true;}else if(ermFlashVersion.minor==flashMinVersion.minor&&ermFlashVersion.rev>=flashMinVersion.rev){d16g.log(this.getLabel()+method+": Minor version == min minor and rev >= min rev");isCompatible=true;}}}
return isCompatible;};d16g.getFlashPluginVersion=function(){var method=".getFlashPluginVersion()";d16g.log(this.getLabel()+method);var ermFlashVersion=false;if(typeof navigator.plugins!=="undefined"){if(typeof navigator.plugins["Shockwave Flash"]!=="undefined"){var pluginName="Shockwave Flash";var flashVersionRaw=navigator.plugins[pluginName].description.substr(pluginName.length+1);var versionParts=flashVersionRaw.split(/ +/);var majorMinor=versionParts[0].split(/\./);ermFlashVersion={major:parseInt(majorMinor[0],10),minor:parseInt(majorMinor[1],10),rev:parseInt(versionParts[1].substr(1),10)};}}
return ermFlashVersion;};d16g.getFlashActiveXVersion=function(){var method=".getFlashActiveXVersion()";d16g.log(this.getLabel()+method);var flashVersionRaw="";var ermFlashVersion=false;if(jQuery.browser.msie){var axo;try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");flashVersionRaw=axo.GetVariable("$version");var versionParts=flashVersionRaw.split(/ +/);var versionNumbers=versionParts[1].split(/,/);ermFlashVersion={major:parseInt(versionNumbers[0],10),minor:parseInt(versionNumbers[1],10),rev:parseInt(versionNumbers[2],10)};}catch(e){}}
return ermFlashVersion;};d16g.getFlashMinVersion=function(){var method=".getFlashMinVersion()";d16g.log(this.getLabel()+method);var minVersion={major:9,minor:0,rev:45};return minVersion;};amznJQ.declareAvailable("d16g_JS");d16g.log("d16g: finished d16g-0.6.js");
