<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="/res/preview.xsl"?>
<rss version="2.0">
  <channel>
    <title>Amazon.com: On Sale Now - Apparel</title>
    <link>http://amazon.com/o/redirect?tag=thewholeedcatalo&amp;path=tg/browse/-/13851881</link>
    <description><![CDATA[Amazon.com: On Sale Now - Apparel]]></description>
    <lastBuildDate>Tue, 16 Mar 2010 03:21:55 GMT</lastBuildDate>
    <generator>Feed43 Proxy/1.0 (www.feed43.com)</generator>
    <ttl>360</ttl>

<item>
<guid isPermaLink="false">dd14b41c1095b8198204e257acdf1cc7</guid>
<description><![CDATA[<html> <head> <style type="text/css"><!-- BODY { font-family: verdana,arial,helvetica,sans-serif; font-size: small; background-color: #FFFFFF; color: #000000; margin-top: 0px; } TD, TH { font-family: verdana,arial,helvetica,sans-serif; font-size: small; } .serif { font-family: times,serif; font-size: medium; } .sans { font-family: verdana,arial,helvetica,sans-serif; font-size: medium; } .small { font-family: verdana,arial,helvetica,sans-serif; font-size: small; } .h1 { font-family: verdana,arial,helvetica,sans-serif; color: #E47911; font-size: medium; } .h3color { font-family: verdana,arial,helvetica,sans-serif; color: #E47911; font-size: small; } h2.small {margin-bottom: 0em; } h2.h1 { margin-bottom: 0em; } h2.h3color { margin-bottom: 0em; } .tiny { font-family: verdana,arial,helvetica,sans-serif; font-size: x-small; } .tinyprice { font-family: verdana,arial,helvetica,sans-serif; color: #990000; font-size: x-small; } .highlight { font-family: verdana,arial,helvetica,sans-serif; color: #990000; font-size: small; } .listprice { font-family: arial,verdana,helvetica,sans-serif; text-decoration: line-through; } .price { font-family: arial,verdana,helvetica,sans-serif; color: #990000; } .popover-tiny { font-size: x-small; font-family: verdana,arial,helvetica,sans-serif; } .horizontal-search { font-weight: bold; font-size: small; color: #FFFFFF; font-family: verdana,arial,helvetica,sans-serif; } .horizontal-websearch { font-size: x-small; font-family: verdana,arial,helvetica,sans-serif; padding-left: 12px; } .big { font-size: xx-large; font-family: verdana,arial,helvetica,sans-serif; } .amabot_widget .headline { color: #E47911; font-size: medium; display: block; font-weight: bold; } div.unified_widget .headline { color: #E47911; font-size: medium; display: block; font-weight: bold; } div#page-wrap { min-width:980px;} * html div#page-wrap { border-right: 980px solid #fff; width: 100%; margin-right: 25px;} * html div#content { float: left; position:relative; margin-right: -980px; } div#leftcol, div#leftcolhidden { float: left; width: 180px; margin:5px 0px 0px 5px; display: inline;} div#rightcol, div#rightcolhidden { float: right; width: 300px; margin-top:5px;} div#leftcolhidden { clear:left;} div#rightcolhidden { clear:right; } div#center1, div#centercol, div#centerrightspancol { overflow: hidden; } * html div#center1 { width: 100% } * html div#centercol { width:100%; } * html div#centerrightspancol { width: 100%; } div#page-footer { clear: both; } a:link { font-family: verdana,arial,helvetica,sans-serif; color: #004B91; } a:visited { font-family: verdana,arial,helvetica,sans-serif; color: #996633; } a:active { font-family: verdana,arial,helvetica,sans-serif; color: #FF9933; } a.dynamic, a.dynamic:visited { color: #004B91; text-decoration: none; border-bottom: 1px dashed; } a.noclick, a.noclick:visited { color: #000000; text-decoration: none; border-bottom: 1px dashed; } .noLinkDecoration a { text-decoration: none; border-bottom: none; } .noLinkDecoration a:hover { text-decoration: underline; } .noLinkDecoration a.dynamic:hover { text-decoration: none; border-bottom: 1px dashed; } .noLinkDecoration a.noclick:hover { color: #000000; text-decoration: none; border-bottom: 1px dashed; } .attention { background-color: #FFFFD5; } .alertgreen { color: #009900; font-weight: bold; } .alert { color: #FF0000; font-weight: bold; } .topnav { font-family: verdana,arial,helvetica,sans-serif; font-size: 12px; text-decoration: none; } .topnav a:link, .topnav a:visited { text-decoration: none; color: #003399; } .topnav a:hover { text-decoration: none; color: #E47911; } .topnav-active a:link, .topnav-active a:visited { font-family: verdana,arial,helvetica,sans-serif; font-size: 12px; color: #E47911; text-decoration: none; } .eyebrow { font-family: verdana,arial,helvetica,sans-serif; font-size: 10px; font-weight: bold;text-transform: uppercase; text-decoration: none; color: #FFFFFF; } .eyebrow a:link { text-decoration: none; } .popover-tiny a, .popover-tiny a:visited { text-decoration: none; color: #003399; } .popover-tiny a:hover { text-decoration: none; color: #E47911; } .tabon a:hover, .taboff a:hover { text-decoration: underline; } .tabon div, .taboff div { margin-top: 7px; margin-left: 9px; margin-bottom: 5px; } .tabon a, .tabon a:visited { font-size: 10px; color: #FFCC66; font-family: verdana,arial,helvetica,sans-serif; text-decoration: none; text-transform: uppercase; font-weight: bold; line-height: 10px; } .taboff a, .taboff a:visited { font-size: 10px; color: #000000; font-family: verdana,arial,helvetica,sans-serif; text-decoration: none; text-transform: uppercase; font-weight: bold; line-height: 10px; } .indent { margin-left: 1em; } .half { font-size: .5em; } .list div { margin-bottom: 0.25em; text-decoration: none; } .hr-center { margin: 15px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: dotted; border-right-style: none; border-bottom-style: none; border-left-style: none; border-top-color: #999999; border-right-color: #999999; border-bottom-color: #999999; border-left-color: #999999; } .amabot_right .h1 { color: #E47911; font-size: .92em; } .amabot_right .amabot_widget .headline, .amabot_left .amabot_widget .headline { color: #E47911; font-size: .92em; display: block; font-weight: bold; } .amabot_left .h1 { color: #E47911; font-size: .92em; } .amabot_left .amabot_widget, .amabot_right .amabot_widget, .tigerbox { padding-top: 8px; padding-bottom: 8px; padding-left: 8px; padding-right: 8px; border-bottom: 1px solid #C9E1F4; border-left: 1px solid #C9E1F4; border-right: 1px solid #C9E1F4; border-top: 1px solid #C9E1F4; } .amabot_center div.unified_widget, .amabot_center .amabot_widget { font-size: 12px; } .amabot_right div.unified_widget, .amabot_right .amabot_widget { font-size: 12px; } .amabot_left div.unified_widget, .amabot_left .amabot_widget { font-size: 12px; } .rightArrow { color: #E47911; font-weight: bold; padding-right: 6px; } .nobullet { list-style-type: none } .homepageTitle { font-size: 28pt; font-family: 'Arial Bold', Arial; font-weight: 800; font-variant: normal; color: #80B6CE; line-height:1em; } div.unified_widget p { margin:0 0 0.5em 0; line-height:1.4em; } div.unified_widget h2 { color:#E47911; padding:0; } .amabot_right div.unified_widget .headline, .amabot_left div.unified_widget .headline { color: #E47911; font-size: .92em; display: block; font-weight: bold; } div.unified_widget sup { font-weight:normal; font-size: 75%; } div.unified_widget h2 sup { font-size: 50%; } td.amabot_left div.unified_widget h2, td.amabot_right div.unified_widget h2, div.amabot_left div.unified_widget h2, div.amabot_right div.unified_widget h2 { font-size:100%; margin:0 0 0.5em 0; } td.amabot_center div.unified_widget h2, div.amabot_center div.unified_widget h2 { font-size:135%; font-weight:bold; margin:0 0 0.35em 0px; } td.amabot_center div.unified_widget, div.amabot_center div.unified_widget { margin-left:10px; } td.amabot_center, div.amabot_center { padding:5px; } div.unified_widget ul { margin: 1em 0; padding: 0 0 0 15px; list-style-position:inside; } div.unified_widget ol { margin:0; padding:0 0 0 2.5em; } div.unified_widget a:link, div.unified_widget a:visited { text-decoration:underline; } div.unified_widget a:hover { text-decoration:underline; } div.unified_widget p.seeMore { clear:both; font-family:verdana,arial,helvetica,sans-serif; margin:0; padding-left:1.15em; text-indent: -1.15em; font-size:100%; font-weight:normal; } div.unified_widget p.seeMore a:link, div.unified_widget p.seeMore a:visited { text-decoration:underline; } div.unified_widget p.seeMore a:hover { text-decoration: underline; } div.unified_widget .carat, div.left_nav .carat { font-weight:bold; font-size:120%; font-family: verdana,arial,helvetica,sans-serif; color:#E47911; margin-right:0.20em; } div.unified_widget a img { border:0; } div.h_rule { clear:both; } div#centerrightspancol div.h_rule { clear:right; } div.unified_widget { margin-bottom:2em; clear:both; } div.unified_widget div.col1 { width: 100%; } div.unified_widget div.col2 { width: 49%; } div.unified_widget div.col3 { width: 32%; } div.unified_widget div.col4 { width: 24%; } div.unified_widget div.col5 { width: 19%; } div.unified_widget table { border:0; border-collapse:collapse; width:100%; } div.unified_widget td { padding:0 8px 8px 0; vertical-align:top; } div.unified_widget table.col1 td { width:100%; } div.unified_widget table.col2 td { width:49%; } div.unified_widget table.col3 td { width:32%; } div.unified_widget table.col4 td { width:24%; } div.unified_widget table.col5 td { width:19%; } div.unified_widget td.bottom { vertical-align:baseline; } div.unified_widget table h4, div.unified_widget h4 { color:#000; font-size:100%; font-weight:normal; margin:0; padding:0; } div.rcmBody div.prodImage, amabot_widget div.prodImage {float:left; margin:0px 0.5em 0.25em 0px;} td.amabot_right div.unified_widget, td.amabot_left div.unified_widget, div.amabot_right div.unified_widget, div.amabot_left div.unified_widget { border: 1px solid #C9E1F4; padding: 8px; margin-bottom:20px; } * html td.amabot_right div.unified_widget, * html div.amabot_right div.unified_widget { height:100%; } * html td.amabot_left div.unified_widget, * html div.amabot_left div.unified_widget { height:100%; } div.rcmBody, amabot_widget div.rcmBody { line-height:1.4em; } div.rcmBody a:link, div.rcmBody a:visited { text-decoration: underline; } div.rcmBody p.seeMore, amabot_widget div.rcmBody p.seeMore { margin-top:0.5em; } div.rcmBody div.bannerImage { text-align:center; } div.rcmBody h2 span.homepageTitle { display:block; margin-bottom:-0.3em; margin-top:-0.12em; line-height:1em; } div.rcmBody h2 img { float:none; } table.coopTable div.rcmBody .headline { font-size: 110%; } table.coopTable div.rcmBody h2 { font-size: 110%; font-weight:bold; } table.promo div.rcmBody h2 { font-size: 100%; font-weight:bold; } div.left_nav { font-family: Arial, sans-serif; font-size:100%; margin:0; line-height:1.05em; width:100%; border: 1px solid #C9E1F4; padding-bottom:10px; } div.left_nav h2 { margin:0 0 0 0; color: #000000; font-weight: bold; line-height: 1.25em; font-size: 100%; font-family: verdana,arial,helvetica,sans-serif; padding: 3px 6px; background-color: #EAF3FE; } div.left_nav h3 { font-family: verdana,arial,helvetica,sans-serif; margin:0.5em 0 0.4em 0.5em; color: #E47911; font-weight: bold; line-height: 1em; font-size:100%; padding-right:0.5em; } div.left_nav ul { margin:0; padding:0; } div.left_nav li, div.left_nav p { list-style: none; margin:0.5em 0.5em 0 1em; line-height:1.2em; } div.left_nav hr { margin: 1em 0.5em; border-top:0; border-left:0; border-right:0; border-bottom: 1px dashed #cccccc; } div.left_nav a:link, div.left_nav a:visited { color: #003399; text-decoration: none; font-family: Arial, sans-serif; } div.left_nav a:hover { color: #2a70fc; text-decoration: underline; } div.left_nav p.seeMore { padding-left:0.9em; text-indent:-0.9em; margin-top: 0.35em; margin-bottom: 1em; } div.left_nav p.seeMore a:link, div.left_nav p.seeMore a:visited { text-decoration:none; } div.left_nav p.seeMore a:hover { text-decoration:underline; } div.seller_central li { font-size:95%; } div.leftnav_popover { width:35em; border:3px solid #ededd3; padding:10px; } div.leftnav_popover li { font-size: 100%; } div.leftnav_popover h2 { font-family:verdana,arial,helvetica,sans-serif; margin:0 0 0.5em 0; color:#E47911; line-height: 1em; font-size:100%; padding-right:0.5em; background-color: #FFFFFF; padding-left:0; } div.leftnav_popover ul.popover_col { float:left; width:33%; margin:0; padding:0; } div.leftnav_popover ul.popover_col li { list-style:none; font-size:90%; line-height:1.5em; line-height:1.2em; margin: 0 5px 0.7em 0 } div.leftnav_popover ul.popover_col li a { text-decoration:none; } div.leftnav_popover ul.popover_col li a:hover { text-decoration:underline; } div.leftnav_popover p.seeMore { margin-left:0; } div.leftnav_popover div.h_rule_popup { clear:left; margin-bottom: 5px; border-bottom:1px dashed #cccccc; } div.asinItem { float:left; margin-bottom:1em; width:32%; } div.asinTextBlock { padding:0 8px 8px 0; } div.asinItem div.prodImage { height:121px; display:table-cell; vertical-align:bottom; } div.asinItem div.localImage { display:table-cell; vertical-align:bottom; } div.asinItem span { margin: 0.5em 0 0.25em 0; } div.asinItem ul { margin:0; padding:0 0 0.5em 1.3em; text-indent: -1.3em; font-size:90%; } div.asinTitle {padding-top:3px; padding-bottom:2px;} div.row { clear:both; } body.dp {} body.dp div.h_rule { clear:none; } body.dp div.unified_widget { clear:none; } div.asinCoop div.asinItem { float:none; width:100%;} div.asinCoop_header {} div.asinCoop_footer {} div.newAndFuture div.asinItem ul { font-size:100%; } div.newAndFuture div.asinItem li { list-style-position: outside; margin:0 0 0.35em 20px; padding:0; text-indent: 0; } div.newAndFuture h3 { font-size:100%; margin:1em 0 ; } div.newAndFuture a:link, div.newAndFuture a:visited { text-decoration:underline; } div.newAndFuture a:hover { text-decoration:underline; } div.newAndFuture p.seeMore { margin:-0.75em 0 0 35px; } div.unified_widget ol.topList { margin: 0; padding: 0; list-style: none; } div.unified_widget ol.topList li { list-style: none; clear: both; display: list-item; padding-top: 6px; } div.unified_widget ol.topList .productImage { display: block; float: left;vertical-align: top;text-align: center;width:60px; } div.unified_widget ol.topList .productText { display: block; float: left; padding-left:10px; vertical-align: top; } :root div.unified_widget span.productImage { display: table-cell; float: none; } :root div.unified_widget span.productText { display: table-cell; float: none; } div.unified_widget dl.priceBlock {margin:0 0 0.45em 0;} div.unified_widget dl.priceBlock dt {clear:left; font-weight:bold; float:left; margin:0 0.3em 0 0;} div.unified_widget dl.priceBlock dd {margin:0 0 0.2em 0;} div.unified_widget .bold {font-weight:bold;} div.unified_widget .byline { font-size: 95%; font-weight: normal; } table.thirdLvlNavContent div.blurb { margin:10px; } div.pageBanner h1 { font-family:Arial, Helvetica, sans-serif; font-weight:normal; font-size:225%; color: #e47911; letter-spacing:-0.03em; margin:0; } div.pageBanner p { font-size:90%; color:#888888; margin:0; } div.pageBanner h1.bkgnd { background-repeat:no-repeat; background-color:#FFFFFF; overflow:hidden; text-indent:-100em; } div.blurb div.title { font-weight:bold; padding-top:5px; padding-bottom:2px; } --></style> <style> .tcg h2, .tcg h2 a {font-family:Arial,Verdana,Helvetica,sans-serif;} .tcg1 .hdlnblk h2, .tcg2 .hdlnblk h2 { font-size:37px; line-height:1em; } .tcg1 .subhed { font-size:23px; } .tcg4 .hdlnblk h2 { font-size:29px; } .tcg4 .subhed { font-size:1.6em; } </style> <script language="Javascript1.1" type="text/javascript"> <!-- function amz_js_PopWin(url,name,options){ var ContextWindow = window.open(url,name,options); ContextWindow.focus(); return false; } //--> </script> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="Find, shop for and buy On Sale Now at Amazon.com"/> <title>Amazon.com: On Sale Now: Clothing</title> <link type='text/css' href='http://z-ecx.images-amazon.com/images/G/01/nav2/gamma/amazonJQ/amazonJQ-combined-coreCSS-8516._V231938213_.css' rel='stylesheet'> <link type='text/css' href='http://z-ecx.images-amazon.com/images/G/01/nav2/gamma/navbarCSSUSTFS/navbarCSSUSTFS-navbarUSTFS-4179._V202086600_.css' rel='stylesheet'> <link type='text/css' href='http://z-ecx.images-amazon.com/images/G/01/nav2/gamma/websiteGridCSS/websiteGridCSS-websiteGridCSS-61831._V229339557_.css' rel='stylesheet'> <script type="text/javascript"> var amznJQ = { addLogical: function() {}, addStyle: function() {}, declareAvailable: function() {}, available: function() {}, onReady: function() {}, onCompletion: function() {}, completedStage: function() {}, strings: {}, chars: { EOL: String.fromCharCode(0x0A), SQUOTE: String.fromCharCode(0x27), DQUOTE: String.fromCharCode(0x22), BACKSLASH: String.fromCharCode(0x5C), YEN: String.fromCharCode(0xA5) } } </script> </head> <body> <a name="top"></a> <!-- BeginNav --> <script type='text/javascript'><!-- function Navbar(options) { options = options || {}; this._loadedCount = 0; this._hasUedata = (typeof uet == 'function'); this._finishLoadQuota = options['finishLoadQuota'] || 2; this._startedLoading = false; this._btfFlyoutContents = []; this.addToBtfFlyoutContents = function(content, callback) { this._btfFlyoutContents.push({content: content, callback: callback}); } this.getBtfFlyoutContents = function() { return this._btfFlyoutContents; } this.loading = function() { if (!this._startedLoading && this._isReportingEvents()) { uet('ns'); } this._startedLoading = true; } this.componentLoaded = function() { this._loadedCount++; if (this._startedLoading && this._isReportingEvents() && (this._loadedCount == this._finishLoadQuota)) { uet('ne'); } } this._isReportingEvents = function() { return this._hasUedata; } } _navbar = new Navbar({ finishLoadQuota: 1}); _navbar.loading(); amznJQ.available('jQuery', function() { _navbar._navPopoverBorderSpriteImage_h = new Image(); _navbar._navPopoverBorderSpriteImage_h.src = 'http://g-ecx.images-amazon.com/images/G/01/gno/popover/sprites-h._V264091373_.gif'; _navbar._navPopoverBorderSpriteImage_v = new Image(); _navbar._navPopoverBorderSpriteImage_v.src = 'http://g-ecx.images-amazon.com/images/G/01/gno/popover/sprites-v._V264091375_.gif'; }); window.navSAFlyoutDelay = 0; --></script> <style type="text/css"><!-- .navSprite, .navSpriteH, .navSaJs li.navSaMenuItem { background-image: url(http://g-ecx.images-amazon.com/images/G/01/gno/images/orangeBlue/navPackedSprites-US-15._V202471683_.png); } .navSpritePopoverH { background-image: url(http://g-ecx.images-amazon.com/images/G/01/gno/popover/sprites-h._V264091373_.gif); } .navSpritePopoverV { background-image: url(http://g-ecx.images-amazon.com/images/G/01/gno/popover/sprites-v._V264091375_.gif); } #navbar .tiny, .navbar .tiny, .navShopAllPopLevel .tiny, .navShopAllPopNonRootLevel .tiny { font-family: Arial, sans-serif; font-size: x-small; } .nav_popover .header .l { background: url(http://g-ecx.images-amazon.com/images/G/01/gno/popover/sprites-v._V264091375_.gif) -14px 0px no-repeat; } .nav_popover .header .r { background: url(http://g-ecx.images-amazon.com/images/G/01/gno/popover/sprites-h._V264091373_.gif) 0px -14px no-repeat; } .nav_popover .header .c { background: url(http://g-ecx.images-amazon.com/images/G/01/gno/popover/sprites-h._V264091373_.gif) 0px 0px repeat-x; } .nav_popover .footer .l { background: url(http://g-ecx.images-amazon.com/images/G/01/gno/popover/sprites-h._V264091373_.gif) 0px -21px no-repeat; } .nav_popover .footer .r { background: url(http://g-ecx.images-amazon.com/images/G/01/gno/popover/sprites-v._V264091375_.gif) -21px 0px no-repeat; } .nav_popover .footer .c { background: url(http://g-ecx.images-amazon.com/images/G/01/gno/popover/sprites-h._V264091373_.gif) 0px -7px repeat-x; } .nav_popover .body .l { background: url(http://g-ecx.images-amazon.com/images/G/01/gno/popover/sprites-v._V264091375_.gif) 0px 0px repeat-y; } .nav_popover .body .r { background: url(http://g-ecx.images-amazon.com/images/G/01/gno/popover/sprites-v._V264091375_.gif) -7px 0px repeat-y; } --></style> <img src="http://g-ecx.images-amazon.com/images/G/01/gno/images/orangeBlue/navPackedSprites-US-15._V202471683_.png" style="display:none" alt=""/> <img src="http://g-ecx.images-amazon.com/images/G/01/x-locale/common/transparent-pixel._V42752373_.gif" style="display:none" alt=""/> <!-- Tilu --> <div id="navbar" style="padding:0px;" class="navbar"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td rowspan="2" align='left' width="180" valign="bottom"><a id="navLogo" class="nonGateway" href="http://amazon.com/ref=gno_logo"> <span id="navLogoPrimary" class="navSprite"><span>amazon.com</span></span> <span id="navLogoSecondary" class="navSprite nonPrime"></span> </a></td> <td width="100%" align='left' height="26"> <table width="100%" id="welcomeRowTable" cellspacing="0" cellpadding="0" border="0"><tr> <td align="left" valign="bottom" class="navGreetingBkg"><div id="navidWelcomeMsg" style="white-space: nowrap;"> <span class="navGreeting">Hello.</span> <span class="navMessage" style="white-space: nowrap;"><a href="http://amazon.com/gp/yourstore/ref=pd_irl_gw?ie=UTF8&amp;signIn=1" rel="nofollow">Sign in</a> to get personalized recommendations.</span> <span class="navMessage" style="white-space: nowrap;">New customer? <a href="http://amazon.com/gp/flex/sign-out.html/ref=pd_irl_gw_r?ie=UTF8&amp;path=%2Fgp%2Fyourstore&amp;signIn=1&amp;useRedirectOnSuccess=1&amp;action=sign-out" rel="nofollow">Start here</a>.</span> </div></td> <td align="left">&nbsp;</td> <td id="navSwmSlot" align="right" valign="center" height="26"> <style> /* general code */ #marqueepd-outer { display: none; } #marqueepd-outer, #marqueepd-inner { width: 100%; height: 250px; padding: 0; margin: 0; visibility: hidden; } #marqueepd-wrapper { display: none; width: 100%; height: 0px; padding: 0; margin: 0; background: #030812; } #marqueepd-inner { min-width: 980px; position: relative; text-align: center; } .adNoOutline { outline: none; } #marqueepd-outer { width: 99%; background: #030812; position: absolute; z-index: 2; } /* ad-specific code */ #nav-sitewide-msg_444-close-button_img, #nav-sitewide-msg_444-close-button { height: 35px; width: 95px; position: absolute; } #nav-sitewide-msg_444-close-button_img { border: none; right: 0; top: 0; /* margin: 7px 17px 7px 7px; */ } #nav-sitewide-msg_444-close-button { right: 17px; top: 0pt; background-image: url(http://g-ecx.images-amazon.com/images/G/01/erm/marqueePushdown/motorola/close._V216169513_.png); z-index: 999; cursor: pointer; } #nav-sitewide-msg_444_movie_wrap { height: 250px; width: 980px; margin: 0 auto 0 auto; visibility: hidden; } </style> <script type="text/javascript"> if(typeof amznJQ !== "undefined"){ if (typeof window.d16g === "undefined") { window.d16g = {}; d16g.adDebug = false; d16g.loadJs = function(jsUrl) { var scriptElem = document.createElement('script'); scriptElem.src = jsUrl; document.getElementsByTagName('head')[0].appendChild(scriptElem); }; /* The following is a global declarations comment that is used by JSLint to recognize global variables */ /*global window,document,navigator,Image,ActiveXObject,console,swfobject,jQuery,amznJQ,d16g*/ /* d16g init */ d16g.types = {}; d16g.ads = {}; 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; } // get data from text/hidden inputs } else { params[this.name] = this.value; } }); // get the data from textareas jQuery(feedbackContainerId + " textarea").each(function(){ var tmp = this.value.substring(0, constants.CHAR_LIMIT); if(my.locale.toLowerCase() === "ja_jp" ){ params[this.name] = d16g.Base64.encodeBinary(tmp); }else{ params[this.name] = tmp; } }); // get the data from selects 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(); params.adContentId = my.adContentId; ids = d16g.adFeedback.getCreativeIdentifiers(my); params.cid = ids.cid; params.adId = ids.adId; return params; }; d16g.adFeedback.getCreativeIdentifiers = function(my){ var retVal = {}; var iframeSel = "#cachebust_" + my.randomId; jQuery(iframeSel).contents().each( function() { retVal.cid = jQuery.trim(jQuery(this).find(".d16g-ad-info > .d16g-cid").html()); retVal.adId = jQuery.trim(jQuery(this).find(".d16g-ad-info > .d16g-aid").html()); }); return retVal; } d16g.adFeedback.sendClog = function(params){ //log it! 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); } }; /* $Id: //brazil/src/appgroup/advertising/apps/GrandPrixAdTemplates/prerelease/templates/amazon/d16g/createAd.ftl#4 $ $Revision: #4 $ $Author: ranton $ $Change: 2775711 $ $DateTime: 2009/11/11 00:11:23 $ */ /** * createAd: generates a new ad with adId and adds to the d16g.ads object * @param adId string * @return void */ d16g.createAd = function (configHash) { d16g.log("d16g.createAd(" + configHash + ")"); d16g.createEventQueue('reposition'); var ad = d16g.make(d16g.types.Ad); ad.adId = configHash.adId; ad.adName = configHash.adName; ad.getLabel = function () { return 'd16g.ads["' + this.adName + '"]'; }; ad.adType = configHash.adType; d16g.log('.createAd(): ad instantiated, adName= "' + ad.adName + '"', this); ad.createStateMachine(configHash.initialState, configHash.model); 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); // despite being 'evil', this eval is necessary to get a dynamically-generated reference to a javascript function ad.stateMachine.onState(cb[i][0], func); } ad.clickUrls = {}; var cu = configHash.clickUrls; for(var key in cu) { ad.clickUrls[key] = cu[key].urls; d16g.log('.createAd(): added "' + key + '" clickUrl', this); } this.ads[configHash.adName] = ad; d16g.log(ad.getLabel() + ' added to d16g object'); }; d16g.loadJs = function(jsUrl) { var scriptElem = document.createElement('script'); scriptElem.src = jsUrl; document.getElementsByTagName('head')[0].appendChild(scriptElem); };/* $Id: //brazil/src/appgroup/advertising/apps/GrandPrixAdTemplates/prerelease/templates/amazon/d16g/logging.ftl#2 $ $Revision: #2 $ $Author: asaurav $ $Change: 2752128 $ $DateTime: 2009/10/30 00:41:20 $ */ // logging methods d16g.getLabel = function() { return "d16g"; }; /** * The getLabel() method of the passed object will be prepended to the error msg, if defined. * user can directly append label with method name and/or include : in the msg param * both examples below produce the same results... * example1: d16g.log(".myMethod(): here is my message", this); * example2: d16g.log(this.getLabel() + ".myMethod(): here is my message"); */ d16g.getLogMsg = function(msg, that) { if (typeof that !== "undefined" && typeof that.getLabel === "function"){ return that.getLabel() + msg; } else{ return msg; } }; d16g.log = function (msg, that) { if (typeof console !== 'undefined' && typeof console.log === 'function' && d16g.adDebug === true) { console.log(d16g.getLogMsg(msg, that)); } }; d16g.warn = function (msg, that) { if (typeof console !== 'undefined' && typeof console.warn === 'function' && d16g.adDebug === true) { console.warn(d16g.getLogMsg(msg, that)); } }; d16g.info = function (msg, that) { if (typeof console !== 'undefined' && typeof console.info === 'function' && d16g.adDebug === true) { console.info(d16g.getLogMsg(msg, that)); } }; d16g.error = function (msg, that) { if (typeof console !== 'undefined' && typeof console.error === 'function' && d16g.adDebug === true) { console.error(d16g.getLogMsg(msg, that)); } }; d16g.objToString = function (o) { if (d16g.adDebug === true) { var out = ""; var comma = false; for (var k in o) { if (true) { // for JSLint if (comma === true) { out += ', '; } else { comma = true; } out += k + ':' + o[k]; } } } return out; }; d16g.arrToString = function (a) { if (d16g.adDebug === true) { var out = ""; var comma = false; for (var i=0; i<a.length; i++) { if (true) { // for JSLint if (comma === true) { out += ', '; } else { comma = true; } out += a[i]; } } } return out; }; /* $Id: //brazil/src/appgroup/advertising/apps/GrandPrixAdTemplates/prerelease/templates/amazon/d16g/swfobject.ftl#3 $ $Revision: #3 $ $Author: asaurav $ $Change: 2752128 $ $DateTime: 2009/10/30 00:41:20 $ # Description: This is the swfobject source code as is. */ /* SWFObject v2.2 <http://code.google.com/p/swfobject/> is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> */ d16g.swfobject = function() { var UNDEF = "undefined", OBJECT = "object", SHOCKWAVE_FLASH = "Shockwave Flash", SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash", FLASH_MIME_TYPE = "application/x-shockwave-flash", EXPRESS_INSTALL_ID = "SWFObjectExprInst", ON_READY_STATE_CHANGE = "onreadystatechange", win = window, doc = document, nav = navigator, plugin = false, domLoadFnArr = [main], regObjArr = [], objIdArr = [], listenersArr = [], storedAltContent, storedAltContentId, storedCallbackFn, storedCallbackObj, isDomLoaded = false, isExpressInstallActive = false, dynamicStylesheet, dynamicStylesheetMedia, autoHideShow = true, /* Centralized function for browser feature detection - User agent string detection is only used when no good alternative is possible - Is executed directly for optimal performance */ ua = function() { var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF, u = nav.userAgent.toLowerCase(), p = nav.platform.toLowerCase(), windows = p ? /win/.test(p) : /win/.test(u), mac = p ? /mac/.test(p) : /mac/.test(u), webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html playerVersion = [0,0,0], d = null; if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) { d = nav.plugins[SHOCKWAVE_FLASH].description; if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+ plugin = true; ie = false; // cascaded feature detection for Internet Explorer d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10); playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10); playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0; } } else if (typeof win.ActiveXObject != UNDEF) { try { var a = new ActiveXObject(SHOCKWAVE_FLASH_AX); if (a) { // a will return null when ActiveX is disabled d = a.GetVariable("$version"); if (d) { ie = true; // cascaded feature detection for Internet Explorer d = d.split(" ")[1].split(","); playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; } } } catch(e) {} } return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac }; }(), /* Cross-browser onDomLoad - Will fire an event as soon as the DOM of a web page is loaded - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/ - Regular onload serves as fallback */ onDomLoad = function() { if (!ua.w3) { return; } if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically callDomLoadFunctions(); } if (!isDomLoaded) { if (typeof doc.addEventListener != UNDEF) { doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false); } if (ua.ie && ua.win) { doc.attachEvent(ON_READY_STATE_CHANGE, function() { if (doc.readyState == "complete") { doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee); callDomLoadFunctions(); } }); if (win == top) { // if not inside an iframe (function(){ if (isDomLoaded) { return; } try { doc.documentElement.doScroll("left"); } catch(e) { setTimeout(arguments.callee, 0); return; } callDomLoadFunctions(); })(); } } if (ua.wk) { (function(){ if (isDomLoaded) { return; } if (!/loaded|complete/.test(doc.readyState)) { setTimeout(arguments.callee, 0); return; } callDomLoadFunctions(); })(); } addLoadEvent(callDomLoadFunctions); } }(); function callDomLoadFunctions() { if (isDomLoaded) { return; } try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span")); t.parentNode.removeChild(t); } catch (e) { return; } isDomLoaded = true; var dl = domLoadFnArr.length; for (var i = 0; i < dl; i++) { domLoadFnArr[i](); } } function addDomLoadEvent(fn) { if (isDomLoaded) { fn(); } else { domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+ } } /* Cross-browser onload - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/ - Will fire an event as soon as a web page including all of its assets are loaded */ function addLoadEvent(fn) { if (typeof win.addEventListener != UNDEF) { win.addEventListener("load", fn, false); } else if (typeof doc.addEventListener != UNDEF) { doc.addEventListener("load", fn, false); } else if (typeof win.attachEvent != UNDEF) { addListener(win, "onload", fn); } else if (typeof win.onload == "function") { var fnOld = win.onload; win.onload = function() { fnOld(); fn(); }; } else { win.onload = fn; } } /* Main function - Will preferably execute onDomLoad, otherwise onload (as a fallback) */ function main() { if (plugin) { testPlayerVersion(); } else { matchVersions(); } } /* Detect the Flash Player version for non-Internet Explorer browsers - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description: a. Both release and build numbers can be detected b. Avoid wrong descriptions by corrupt installers provided by Adobe c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available */ function testPlayerVersion() { var b = doc.getElementsByTagName("body")[0]; var o = createElement(OBJECT); o.setAttribute("type", FLASH_MIME_TYPE); var t = b.appendChild(o); if (t) { var counter = 0; (function(){ if (typeof t.GetVariable != UNDEF) { var d = t.GetVariable("$version"); if (d) { d = d.split(" ")[1].split(","); ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; } } else if (counter < 10) { counter++; setTimeout(arguments.callee, 10); return; } b.removeChild(o); t = null; matchVersions(); })(); } else { matchVersions(); } } /* Perform Flash Player and SWF version matching; static publishing only */ function matchVersions() { var rl = regObjArr.length; if (rl > 0) { for (var i = 0; i < rl; i++) { // for each registered object element var id = regObjArr[i].id; var cb = regObjArr[i].callbackFn; var cbObj = {success:false, id:id}; if (ua.pv[0] > 0) { var obj = getElementById(id); if (obj) { if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match! setVisibility(id, true); if (cb) { cbObj.success = true; cbObj.ref = getObjectById(id); cb(cbObj); } } else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported var att = {}; att.data = regObjArr[i].expressInstall; att.width = obj.getAttribute("width") || "0"; att.height = obj.getAttribute("height") || "0"; if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); } if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); } // parse HTML object param element's name-value pairs var par = {}; var p = obj.getElementsByTagName("param"); var pl = p.length; for (var j = 0; j < pl; j++) { if (p[j].getAttribute("name").toLowerCase() != "movie") { par[p[j].getAttribute("name")] = p[j].getAttribute("value"); } } showExpressInstall(att, par, id, cb); } else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF displayAltContent(obj); if (cb) { cb(cbObj); } } } } else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content) setVisibility(id, true); if (cb) { var o = getObjectById(id); // test whether there is an HTML object element or not if (o && typeof o.SetVariable != UNDEF) { cbObj.success = true; cbObj.ref = o; } cb(cbObj); } } } } } function getObjectById(objectIdStr) { var r = null; var o = getElementById(objectIdStr); if (o && o.nodeName == "OBJECT") { if (typeof o.SetVariable != UNDEF) { r = o; } else { var n = o.getElementsByTagName(OBJECT)[0]; if (n) { r = n; } } } return r; } /* Requirements for Adobe Express Install - only one instance can be active at a time - fp 6.0.65 or higher - Win/Mac OS only - no Webkit engines older than version 312 */ function canExpressInstall() { return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312); } /* Show the Adobe Express Install dialog - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75 */ function showExpressInstall(att, par, replaceElemIdStr, callbackFn) { isExpressInstallActive = true; storedCallbackFn = callbackFn || null; storedCallbackObj = {success:false, id:replaceElemIdStr}; var obj = getElementById(replaceElemIdStr); if (obj) { if (obj.nodeName == "OBJECT") { // static publishing storedAltContent = abstractAltContent(obj); storedAltContentId = null; } else { // dynamic publishing storedAltContent = obj; storedAltContentId = replaceElemIdStr; } att.id = EXPRESS_INSTALL_ID; if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; } if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; } doc.title = doc.title.slice(0, 47) + " - Flash Player Installation"; var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn", fv = "MMredirectURL=" + win.location.toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title; if (typeof par.flashvars != UNDEF) { par.flashvars += "&" + fv; } else { par.flashvars = fv; } // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work if (ua.ie && ua.win && obj.readyState != 4) { var newObj = createElement("div"); replaceElemIdStr += "SWFObjectNew"; newObj.setAttribute("id", replaceElemIdStr); obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf obj.style.display = "none"; (function(){ if (obj.readyState == 4) { obj.parentNode.removeChild(obj); } else { setTimeout(arguments.callee, 10); } })(); } createSWF(att, par, replaceElemIdStr); } } /* Functions to abstract and display alternative content */ function displayAltContent(obj) { if (ua.ie && ua.win && obj.readyState != 4) { // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work var el = createElement("div"); obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content el.parentNode.replaceChild(abstractAltContent(obj), el); obj.style.display = "none"; (function(){ if (obj.readyState == 4) { obj.parentNode.removeChild(obj); } else { setTimeout(arguments.callee, 10); } })(); } else { obj.parentNode.replaceChild(abstractAltContent(obj), obj); } } function abstractAltContent(obj) { var ac = createElement("div"); if (ua.win && ua.ie) { ac.innerHTML = obj.innerHTML; } else { var nestedObj = obj.getElementsByTagName(OBJECT)[0]; if (nestedObj) { var c = nestedObj.childNodes; if (c) { var cl = c.length; for (var i = 0; i < cl; i++) { if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) { ac.appendChild(c[i].cloneNode(true)); } } } } } return ac; } /* Cross-browser dynamic SWF creation */ function createSWF(attObj, parObj, id) { var r, el = getElementById(id); if (ua.wk && ua.wk < 312) { return r; } if (el) { if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content attObj.id = id; } if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML var att = ""; for (var i in attObj) { if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries if (i.toLowerCase() == "data") { parObj.movie = attObj[i]; } else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword att += ' class="' + attObj[i] + '"'; } else if (i.toLowerCase() != "classid") { att += ' ' + i + '="' + attObj[i] + '"'; } } } var par = ""; for (var j in parObj) { if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries par += '<param name="' + j + '" value="' + parObj[j] + '" />'; } } el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>'; objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only) r = getElementById(attObj.id); } else { // well-behaving browsers var o = createElement(OBJECT); o.setAttribute("type", FLASH_MIME_TYPE); for (var m in attObj) { if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword o.setAttribute("class", attObj[m]); } else if (m.toLowerCase() != "classid") { // filter out IE specific attribute o.setAttribute(m, attObj[m]); } } } for (var n in parObj) { if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element createObjParam(o, n, parObj[n]); } } el.parentNode.replaceChild(o, el); r = o; } } return r; } function createObjParam(el, pName, pValue) { var p = createElement("param"); p.setAttribute("name", pName); p.setAttribute("value", pValue); el.appendChild(p); } /* Cross-browser SWF removal - Especially needed to safely and completely remove a SWF in Internet Explorer */ function removeSWF(id) { var obj = getElementById(id); if (obj && obj.nodeName == "OBJECT") { if (ua.ie && ua.win) { obj.style.display = "none"; (function(){ if (obj.readyState == 4) { removeObjectInIE(id); } else { setTimeout(arguments.callee, 10); } })(); } else { obj.parentNode.removeChild(obj); } } } function removeObjectInIE(id) { var obj = getElementById(id); if (obj) { for (var i in obj) { if (typeof obj[i] == "function") { obj[i] = null; } } obj.parentNode.removeChild(obj); } } /* Functions to optimize JavaScript compression */ function getElementById(id) { var el = null; try { el = doc.getElementById(id); } catch (e) {} return el; } function createElement(el) { return doc.createElement(el); } /* Updated attachEvent function for Internet Explorer - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks */ function addListener(target, eventType, fn) { target.attachEvent(eventType, fn); listenersArr[listenersArr.length] = [target, eventType, fn]; } /* Flash Player and SWF content version matching */ function hasPlayerVersion(rv) { var pv = ua.pv, v = rv.split("."); v[0] = parseInt(v[0], 10); v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0" v[2] = parseInt(v[2], 10) || 0; return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false; } /* Cross-browser dynamic CSS creation - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php */ function createCSS(sel, decl, media, newStyle) { if (ua.ie && ua.mac) { return; } var h = doc.getElementsByTagName("head")[0]; if (!h) { return; } // to also support badly authored HTML pages that lack a head element var m = (media && typeof media == "string") ? media : "screen"; if (newStyle) { dynamicStylesheet = null; dynamicStylesheetMedia = null; } if (!dynamicStylesheet || dynamicStylesheetMedia != m) { // create dynamic stylesheet + get a global reference to it var s = createElement("style"); s.setAttribute("type", "text/css"); s.setAttribute("media", m); dynamicStylesheet = h.appendChild(s); if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) { dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1]; } dynamicStylesheetMedia = m; } // add style rule if (ua.ie && ua.win) { if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) { dynamicStylesheet.addRule(sel, decl); } } else { if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) { dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}")); } } } function setVisibility(id, isVisible) { if (!autoHideShow) { return; } var v = isVisible ? "visible" : "hidden"; if (isDomLoaded && getElementById(id)) { getElementById(id).style.visibility = v; } else { createCSS("#" + id, "visibility:" + v); } } /* Filter to avoid XSS attacks */ function urlEncodeIfNecessary(s) { var regex = /[\\\"<>\.;]/; var hasBadChars = regex.exec(s) != null; return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s; } /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only) */ var cleanup = function() { if (ua.ie && ua.win) { window.attachEvent("onunload", function() { // remove listeners to avoid memory leaks var ll = listenersArr.length; for (var i = 0; i < ll; i++) { listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]); } // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect var il = objIdArr.length; for (var j = 0; j < il; j++) { removeSWF(objIdArr[j]); } // cleanup library's main closures to avoid memory leaks for (var k in ua) { ua[k] = null; } ua = null; for (var l in d16g.swfobject) { d16g.swfobject[l] = null; } d16g.swfobject = null; }); } }(); return { /* Public API - Reference: http://code.google.com/p/swfobject/wiki/documentation */ registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) { if (ua.w3 && objectIdStr && swfVersionStr) { var regObj = {}; regObj.id = objectIdStr; regObj.swfVersion = swfVersionStr; regObj.expressInstall = xiSwfUrlStr; regObj.callbackFn = callbackFn; regObjArr[regObjArr.length] = regObj; setVisibility(objectIdStr, false); } else if (callbackFn) { callbackFn({success:false, id:objectIdStr}); } }, getObjectById: function(objectIdStr) { if (ua.w3) { return getObjectById(objectIdStr); } }, embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) { var callbackObj = {success:false, id:replaceElemIdStr}; if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) { setVisibility(replaceElemIdStr, false); addDomLoadEvent(function() { widthStr += ""; // auto-convert to string heightStr += ""; var att = {}; if (attObj && typeof attObj === OBJECT) { for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs att[i] = attObj[i]; } } att.data = swfUrlStr; att.width = widthStr; att.height = heightStr; var par = {}; if (parObj && typeof parObj === OBJECT) { for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs par[j] = parObj[j]; } } if (flashvarsObj && typeof flashvarsObj === OBJECT) { for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs if (typeof par.flashvars != UNDEF) { par.flashvars += "&" + k + "=" + flashvarsObj[k]; } else { par.flashvars = k + "=" + flashvarsObj[k]; } } } if (hasPlayerVersion(swfVersionStr)) { // create SWF var obj = createSWF(att, par, replaceElemIdStr); if (att.id == replaceElemIdStr) { setVisibility(replaceElemIdStr, true); } callbackObj.success = true; callbackObj.ref = obj; } else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install att.data = xiSwfUrlStr; showExpressInstall(att, par, replaceElemIdStr, callbackFn); return; } else { // show alternative content setVisibility(replaceElemIdStr, true); } if (callbackFn) { callbackFn(callbackObj); } }); } else if (callbackFn) { callbackFn(callbackObj); } }, switchOffAutoHideShow: function() { autoHideShow = false; }, ua: ua, getFlashPlayerVersion: function() { return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] }; }, hasFlashPlayerVersion: hasPlayerVersion, createSWF: function(attObj, parObj, replaceElemIdStr) { if (ua.w3) { return createSWF(attObj, parObj, replaceElemIdStr); } else { return undefined; } }, showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) { if (ua.w3 && canExpressInstall()) { showExpressInstall(att, par, replaceElemIdStr, callbackFn); } }, removeSWF: function(objElemIdStr) { if (ua.w3) { removeSWF(objElemIdStr); } }, createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) { if (ua.w3) { createCSS(selStr, declStr, mediaStr, newStyleBoolean); } }, addDomLoadEvent: addDomLoadEvent, addLoadEvent: addLoadEvent, getQueryParamValue: function(param) { var q = doc.location.search || doc.location.hash; if (q) { if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark if (param == null) { return urlEncodeIfNecessary(q); } var pairs = q.split("&"); for (var i = 0; i < pairs.length; i++) { if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1))); } } } return ""; }, // For internal usage only expressInstallCallback: function() { if (isExpressInstallActive) { var obj = getElementById(EXPRESS_INSTALL_ID); if (obj && storedAltContent) { obj.parentNode.replaceChild(storedAltContent, obj); if (storedAltContentId) { setVisibility(storedAltContentId, true); if (ua.ie && ua.win) { storedAltContent.style.display = "block"; } } if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); } } isExpressInstallActive = false; } } }; }(); d16g.tracking = {}; d16g.tracking.scriptUrls = []; d16g.tracking.addIFramedScript = function(baseUrl, url){ var encodedUrl = escape(url); d16g.tracking.scriptUrls.push({"baseUrl":baseUrl, "url": encodedUrl, "loaded": false}); }; d16g.tracking.loadIFramedScripts = function() { for(var i=0;i<d16g.tracking.scriptUrls.length;i++){ if(!d16g.tracking.scriptUrls[i].loaded) { var iframe = document.createElement("iframe"); iframe.src = d16g.tracking.scriptUrls[i].baseUrl + "#js=" + d16g.tracking.scriptUrls[i].url; iframe.height = 0; iframe.width = 0; iframe.style.border=0; iframe.style.margin=0; document.body.appendChild(iframe); d16g.tracking.scriptUrls[i].loaded = true; } } }; if(amznJQ !== null){ amznJQ.onReady('d16g_JS', function(){d16g.tracking.loadIFramedScripts();}); }/* $Id: //brazil/src/appgroup/advertising/apps/GrandPrixAdTemplates/prerelease/templates/amazon/d16g/utils.ftl#3 $ $Revision: #3 $ $Author: ranton $ $Change: 2775711 $ $DateTime: 2009/11/11 00:11:23 $ */ /** * @param function type (constructor function) * @return object instance **/ d16g.make = function (F) { return new F(); }; /** * @param function type (constructor function) * @return function type (constructor function) **/ d16g.extend = function(F) { var G = function () {}; G.prototype = new F(); return G; }; /** * parseBool: returns boolean of all the sort-of boolean values * @param value boolean, number, or string value to convert * @param default boolean bias to which value if the boolean conversion is not defined for a value/datatype * @return boolean representation of the value. Any string except '1', 'true', or 'yes' returns false. * if value and default are undefined returns undefined. * if value is null and defaultValue is null or undefined null will be returned. */ d16g.parseBool = function(value, defaultValue) { var result; if(value === null ) { if(defaultValue !== undefined && defaultValue !== null) { return d16g.parseBool(defaultValue); } else { d16g.error("d16g.parseBool(): both value and default are null"); return null; } } 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 { result = false; } break; case 'boolean': result = value; break; // automatic default cases case "undefined": if(defaultValue !== undefined ) { result = d16g.parseBool(defaultValue); } else { d16g.error("d16g.parseBool(): both value and default are undefined"); } break; case "function": d16g.error("d16g.parseBool(): value type is 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; }; /** * defaultBoolFalse: returns false if undefined or not boolean, otherwise value * @param value anytype value to convert * @return boolean */ 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; }; /** * defaultBoolTrue: returns true if undefined or not boolean, otherwise value * @param value anytype value to convert * @return boolean */ 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.eventQueues = {}; /** * d16g.createEventQueue: creates a master event queue for all ads on the page * @param eventName string * @return void */ d16g.createEventQueue = function (eventName) { if (typeof d16g.eventQueues[eventName] === "undefined") { d16g.log('.createEventQueue(' + eventName + ')', this); d16g.eventQueues[eventName] = d16g.make(d16g.types.CallbackQueue); d16g.eventQueues[eventName].runOnce = false; d16g.eventQueues[eventName].runAlways = false; } }; d16g.addEventCallback = function (eventName, func) { d16g.log('.addEventCallback(' + eventName + ')', this); d16g.eventQueues[eventName].addCallback(func); }; d16g.triggerEventCallbacks = function (eventName) { d16g.log('.triggerEventCallbacks(' + eventName + ')', this); d16g.eventQueues[eventName].run(); }; /* $Id: //brazil/src/appgroup/advertising/apps/GrandPrixAdTemplates/prerelease/templates/amazon/d16g/utilsBrowser.ftl#5 $ $Revision: #5 $ $Author: asaurav $ $Change: 2915517 $ $DateTime: 2010/01/28 18:32:24 $ # Description: detects browsers, determines if browser platform supports ERM # This file should be loaded from the d16g-bootstrap freemarker template, so the d16g object should already be instantiated. # deployed to edge cache (Media Central) # https://w.amazon.com/?Advertising/D16G/Frontend/Templates#Expandable_Rich_Media_.28ERM.29 # # Copyright (c)2009 Amazon.com, Inc. # All rights reserved. */ d16g.isErmSupportedPlatform = function() { d16g.log(this.getLabel() + ".isErmSupportedPlatform()"); return d16g.isErmBrowserCompatible() && d16g.isErmFlashCompatible() && !d16g.isBadBrowserPlugin(); }; d16g.isBadBrowserPlugin = function() { // This function has been overriden in the _erm-ad-js-overrides.ftl file. // Should be removed after Skype is fully tested to work with ERM. var result = false; if(d16g.allowSkype === false) { try { // Skype on Firefox 3 causes the ERM to halt. if (jQuery.browser.mozilla && typeof(navigator.mimeTypes["application/x-skype"]) === "object") { result = true; d16g.warn(this.getLabel() + ".isBadBrowserPlugin(): Skype extension detected, abandoning ERM rendering"); } } catch(e) { // Only BAD browsers are throwing exceptions result = true; } } return result; }; 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; } } // Allow Chrome on Win and Mac if (navigator.userAgent.indexOf("Chrome") > 0 && (platform.indexOf('Win') != -1 || platform.indexOf('Mac') != -1)) { if (d16g.allowChrome === true) { d16g.log(this.getLabel() + ": Detected Chrome and allowChrome is true, continuing..."); isCompatible = true; } else { d16g.log(this.getLabel() + ": Detected Chrome and allowChrome is false, aborting..."); isCompatible = false; } } return isCompatible; }; d16g.isErmFlashCompatible = function () { var method = ".isErmFlashCompatible()"; d16g.log(this.getLabel() + method); var isCompatible = false; var ermFlashVersion = false; // Flash player installed? if((navigator.platform.substr(0,3).toLowerCase().indexOf("win") != -1) && jQuery.browser.msie) { ermFlashVersion = d16g.getFlashActiveXVersion(); } else { ermFlashVersion = d16g.getFlashPluginVersion(); } if (ermFlashVersion) { // check for min version 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); // build version object 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) { // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry var axo; try { // version will be set for 7.X or greater players axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); flashVersionRaw = axo.GetVariable("$version"); // build version object 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; }; /* $Id: //brazil/src/appgroup/advertising/apps/GrandPrixAdTemplates/prerelease/templates/amazon/d16g/types/Ad.ftl#4 $ $Revision: #4 $ $Author: asaurav $ $Change: 2752128 $ $DateTime: 2009/10/30 00:41:20 $ # Description: constructor function and prototype definition for an Ad # this file is completely Javascript # https://w.amazon.com/?Advertising [TBD] # */ /** * Type: Ad */ d16g.types.Ad = function() { this.isLoaded = false; this.components = {}; this.pixels = {}; }; /** * recordEvent * only trigger pixels once * @param adEvent */ 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("show"); }; 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 + '"]'; }; if(typeof config.init !== "undefined") { d16g.log(".createComponent(): calling init: "+config.init, this); var func = eval(config.init); // unfortunately necessary eval. func(component); } switch(config.contentType) { case "image" : amznJQ.onReady(adName, function() {component.loadImage();}); component.elementId = component.componentId; // automatically generated id component.show = function () { component.showImage(); }; component.hide = function () { component.hideImage(); }; component.open = function () { }; component.close = function () { }; break; case "html" : amznJQ.onReady(adName, function() {component.loadHtml();}); //elementId is part of the html config component.elementId = component.componentId; // automatically generated id component.show = function () { component.showHtml(); }; component.hide = function () { component.hideHtml(); }; component.open = function () { component.openHtml(); }; component.close = function () { component.closeHtml(); }; break; case "flash" : amznJQ.onReady(adName, function() {component.loadFlash();}); component.elementId = component.componentId; // automatically generated id component.show = function () { component.showFlash(); }; component.hide = function () { component.hideFlash(); }; component.open = function () { component.openFlash(); }; component.close = function () { component.closeFlash(); }; break; case "static" : amznJQ.onReady(adName, function() {component.loadStatic();}); component.elementId = component.staticId; // the id of the static element already rendered on the page component.show = function () { component.showStatic(); }; component.hide = function () { component.hideStatic(); }; component.open = function () { }; component.close = function () { }; break; } this.components[cmpName] = component; // save reference to component in ad components object if (component.positioning.type !== "auto") { jQuery(window).bind("resize", function() { component.render(); }); } d16g.log(component.getLabel() + '.createComponent(): added'); }; d16g.types.Ad.prototype.clickedOpen = function (){ d16g.log(this.getLabel() + ".clickedOpen()"); this.stateMachine.trigger("clickedOpen"); this.recordEvent("expand"); }; d16g.types.Ad.prototype.clickedClose = function (){ d16g.log(this.getLabel() + ".clickedClose()"); this.stateMachine.trigger("clickedClose"); this.recordEvent("collapse"); }; d16g.types.Ad.prototype.opened = function (){ d16g.log(this.getLabel() + ".opened()"); this.stateMachine.trigger("isOpen"); }; d16g.types.Ad.prototype.closed = function (){ d16g.log(this.getLabel() + ".closed()"); this.stateMachine.trigger("isClosed"); }; d16g.types.Ad.prototype.trigger = function (name){ d16g.log(".trigger(" + name + "): ", this); this.stateMachine.trigger(name); }; 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 { var thisUrl = this.clickUrls[urlKey][0]; d16g.log('.clickedUrl(): url="' + thisUrl + '"', this); /* This is a loose check but could be overidden with robust regex from the campaign */ if ((thisUrl.search(d16g.internalDomainRegex) > 0) || (jQuery.browser.safari)) { d16g.log('.clickedUrl(): changing document location to "' + thisUrl + '"', this); document.location = thisUrl; } else { d16g.log('.clickedUrl(): opening new window to "' + thisUrl + '"', this); window.open(thisUrl); } } }; 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"; }; /** * removeComponents(): utility function to remove all HTML elements that are ERM containers from the DOM */ d16g.types.Ad.prototype.removeComponents = function () { jQuery('[d16gErm]').remove(); d16g.error(".removeComponents(): All ERM components removed.", this); }; /* $Id: //brazil/src/appgroup/advertising/apps/GrandPrixAdTemplates/prerelease/templates/amazon/d16g/types/AdComponent.ftl#8 $ $Revision: #8 $ $Author: pkahrl $ $Change: 2970555 $ $DateTime: 2010/02/26 18:25:53 $ # Description: constructor function and prototype definition for an Ad Component # this file is completely Javascript # https://w.amazon.com/?Advertising [TBD] # # requires the following Freemarker variables to be defined # (source) indicates where the variable is defined # * adName (db) */ /** * Type: AdComponent */ d16g.types.AdComponent = function () { this.isLoaded = false; this.anchor = ""; this.html = ""; // params defaults this.contentType = ""; this.templateFile = ""; this.name = ""; this.height = {}; this.width = {}; this.actualWidth = 0; this.clip = {}; this.positioning = {}; this.resizeWidth = {}; this.htmlInsertion = {}; this.pushdown = false; this.hidden = false; // needs to initialize in .render() method first this.isClipOpen = false; // decouple dependence on a particular state or states for clipping }; d16g.types.AdComponent.prototype.hideFlash = function() { d16g.log(this.getLabel() + ".hideFlash(), contentId=" + this.contentId); this.doUserCallback("hide"); if( jQuery.browser.msie ) { this.render('outOfView'); } else { this.render('hideContent', 'hideElement'); } this.hidden = true; }; d16g.types.AdComponent.prototype.showFlash = function() { d16g.log(this.getLabel() + ".showFlash(), contentId=" + this.contentId); this.hidden = false; this.render('positionToBase', 'showElement', 'showContent'); if (jQuery.browser.msie) { this.render('positionToBase'); } this.doUserCallback("show"); }; d16g.types.AdComponent.prototype.applyClip = function() { d16g.log(this.getLabel() + ".applyClip()"); if( this.wantsClipping === true ) { d16g.log(this.getLabel() + ".applyClip() wantsClipping"); var rectArr = this.getClipRectArr(); var delim = ","; if (jQuery.browser.msie) { delim = " "; } var rectStr = rectArr.join(delim); d16g.log('.applyClip(): clip rectangle string (T,R,B,L), ' + rectStr, this); jQuery('#' + this.elementId).css( 'clip','rect(' + rectStr + ')' ); } }; // utilities d16g.types.AdComponent.prototype.getClipRectArr = function() { d16g.log(".getClipRectArr()", this); var t = this.getClipOffsetValue(this.clip.top), l = this.getClipOffsetValue(this.clip.left), r = this.getClipOffsetValue(this.clip.right), b = this.getClipOffsetValue(this.clip.bottom); // clip values are measured from each edge, clip rect is measured from top and left. var T,R,B,L; T = this.getClipString(t); L = this.getClipString(l); R = this.getConvertedClipString(r, parseInt(this.width.unclipped, 10)); // convert to measure from left B = this.getConvertedClipString(b, parseInt(this.height.unclipped, 10)); // convert to measure from top return [T, R, B, L]; }; d16g.types.AdComponent.prototype.getClipOffsetValue = function(val) { d16g.log('.getClipOffsetValue(' + val + ')', this); // positive values apply an offset when open // negative values apply an offset when closed // anything else should have an offset of 0 (auto) var result = 0; // d16g.log('.getClipOffsetValue: isClipOpen='+this.isClipOpen,this); if ((val > 0 && this.isClipOpen === false) || (val < 0 && this.isClipOpen === true)) { result = Math.abs(val); d16g.log('.getClipOffsetValue: result=' + result, this); } return result; }; d16g.types.AdComponent.prototype.getClipString = function(val) { d16g.log('.getClipString(' + val + ')', this); // if value is 0, set to auto var result = 'auto'; // val is 0 or invalid if (val > 0) { result = val + "px"; } return result; }; d16g.types.AdComponent.prototype.getConvertedClipString = function(offset, dimension) { d16g.log('.getConvertedClipString(' + offset + ', ' + dimension + ')', this); // convert right/bottom offset to measure from left/top // dimension is a width or height var result; if (offset === 0) { result = 'auto'; // no clipping } else if (offset < dimension) { result = this.getClipString(dimension - offset); // convert to measure from left/top edge } else { result = 0; // clip entire width } return result; }; d16g.types.AdComponent.prototype.openFlash = function() { d16g.log(this.getLabel() + ".openFlash(), contentId=" + this.contentId); this.isClipOpen = true; this.doUserCallback("open"); this.render('doExpand'); }; d16g.types.AdComponent.prototype.closeFlash = function() { d16g.log(this.getLabel() + ".closeFlash(), contentId=" + this.contentId); this.isClipOpen = false; this.render('doCollapse'); this.doUserCallback("close"); }; d16g.types.AdComponent.prototype.loadFlash = function() { d16g.log(this.getLabel() + ".loadFlash()"); this.createContent(); // All components are initialized as this.hidden=false. // Flash needs to show for in order to load, and will be hidden again in .loaded() method if (jQuery.browser.msie) { this.render('outOfView'); } else { this.render('inView'); } if (typeof this.urls === 'undefined' || typeof this.urls.loader === 'undefined' || typeof this.urls.ad === 'undefined') { d16g.error('.loadFlash(): this component must have a urls.loader and urls.ad defined in the config', this); } else { var adName = this.ad.adName; var componentName = this.name; var loaderFile = this.urls.loader; var flashvars = { "adName": adName, "cmpName": componentName, "adDebug": d16g.adDebug, "adUrl": this.urls.ad }; if (typeof this.urls.video !== "undefined" && this.urls.video !== "") { flashvars.vidUrl = this.urls.video; } if (typeof this.height.unclipped === "undefined" || typeof this.width.unclipped === "undefined") { d16g.error('.loadFlash(): height.unclipped and/or width.unclipped is undefined (see ad config params)', this); } else { var width = this.width.unclipped; var height = this.height.unclipped; jQuery('#' + this.elementId).width(width); jQuery('#' + this.elementId).height(height); d16g.log('.loadFlash setting ' + this.elementId + ' width to:' + width + ' height to:' + height ,this); var params = { wmode: "transparent", allowscriptaccess: "always", scale: "showall", salign: "t" // was tl, want it centered at top. }; var attributes = { "styleclass": "adNoOutline ap_never_hide" }; 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); d16g.swfobject.embedSWF(loaderFile, this.contentId, width, height, "9.0.28", "expressInstall.swf", flashvars, params, attributes); } } d16g.log(this.getLabel() + ".loadFlash() end"); }; d16g.types.AdComponent.prototype.hideStatic = function(e) { d16g.log(this.getLabel() + ".hideStatic()"); this.render('hideElement'); this.doUserCallback("hide"); this.hidden = true; }; d16g.types.AdComponent.prototype.showStatic = function(e) { d16g.log(this.getLabel() + ".showStatic()"); this.hidden = false; this.render('showElement'); this.doUserCallback("show"); }; d16g.types.AdComponent.prototype.loadStatic = function() { d16g.log(this.getLabel() + ".loadStatic()"); this.loaded(); }; d16g.types.AdComponent.prototype.hideImage = function() { d16g.log(this.getLabel() + ".hideImage()"); this.render('hideElement', 'hideContent'); this.hidden = true; }; d16g.types.AdComponent.prototype.showImage = function() { d16g.log(this.getLabel() + ".showImage()"); d16g.fixPngs(jQuery("#" + this.elementId + "_click")); this.hidden = false; this.render('showElement', 'showContent', 'positionToBase'); }; 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('.loadImage(): Could not load image for d16g.ads["' + adName + '"].components["' + componentName + '"]', this); }; 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"); this.render('cssCollapse'); if( jQuery.browser.msie ) { this.render('outOfView'); } this.hidden = true; }; d16g.types.AdComponent.prototype.showHtml = function() { d16g.log(this.getLabel() + ".showHtml()"); this.hidden = false; this.render('cssExpand'); this.doUserCallback("show"); if( jQuery.browser.msie && this.positioning.type !== "overlay" && this.positioning.type !=="component" ) { this.render('undoOutOfView'); } this.render(); // auto-select strategy, positioning.type "auto" will be detected and no positioning will occur }; 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>'; // place secondary component this.doHtmlInsertion(); this.doUserCallback("load"); d16g.fixPngs(jQuery('#' + this.elementId)); this.loaded(); } }; d16g.types.AdComponent.prototype.openHtml = function() { d16g.log(this.getLabel() + ".openHtml(), contentId=" + this.contentId); this.doUserCallback("open"); }; d16g.types.AdComponent.prototype.closeHtml = function() { d16g.log(this.getLabel() + ".closeHtml(), contentId=" + this.contentId); this.doUserCallback("close"); }; 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]; try { this[userMethodName](); } catch (e) { d16g.error('.doUserCallback(): There was a problem trying to run a userCallback "' + cbName + '". ' + e, this); } } 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 + ")"); // copy params to this if (typeof params === 'object') { for (var key in params) { if (typeof key === "string") { this[key] = params[key]; } } } this.pushdown = d16g.parseBool( this.pushdown, false ); this.wantsClipping = d16g.parseBool( this.wantsClipping, false ); 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(): isLoaded=' + this.isLoaded); // static components are not affected at load time, but all other types are hidden until loading is complete if (this.contentType !== 'static') { if (this.contentType === 'flash' && !jQuery.browser.msie) { this.render('hideContent'); } this.hidden = true; } this.actualWidth = this.width.closed; this.isLoaded = true; this.ad.componentLoaded(); d16g.log(this.getLabel() + '.loaded(): component is now loaded. isLoaded=' + this.isLoaded + ', hidden="' + this.hidden + '"'); }; d16g.types.AdComponent.prototype.getBaseTarget = function() { d16g.log(this.getLabel() + ".getBaseTarget()"); var target; if (this.positioning.type === "component") { var targetComponent = this.ad.components[this.positioning.target]; d16g.log('.getBaseTarget(): positioning target=' + this.positioning.target + ', component is ' + typeof targetComponent, this); target = '#' + targetComponent.elementId; } else { target = this.positioning.target; // target is a css selector, '#' is already included in the config if it is an id for an element } 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 + '"'); if( typeof this.positioning.relative !== undefined && d16g.parseBool(this.positioning.relative, false) === true) { d16g.log(".getPos(): positioning.relative is true", this); posResult = { left: 0, top: 0 }; } else { d16g.log(".getPos(): positioning.relative is false", this); posResult = jQuery(target).eq(0).offset(); // accepts a document element or a jQuery selector. } // no current version of configs use targetLeft any longer we should consider removing it. 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); } d16g.log(this.getLabel() + '.getPos(): final left="' + posResult.left + '", top="' + posResult.top + '"'); if (this.wantsClipping === true) { d16g.log(".getPos(): wantsClipping is true", this); posResult.top -= Math.abs(parseInt(this.clip.top, 10)); posResult.left -= Math.abs(parseInt(this.clip.left, 10)); d16g.log(this.getLabel() + '.getPos(): final adjusted for clipping: left="' + posResult.left + '", top="' + posResult.top + '"'); } return posResult; }; d16g.types.AdComponent.prototype.doResizeWidth = function () { var elem = jQuery('#' + this.elementId); d16g.log(this.getLabel() + ".doResizeWidth(): resizeWidth.type is " + this.resizeWidth.type); if( this.resizeWidth.type === "auto" ) { var newWidth; if( typeof this.resizeWidth.target === "undefined" ) { var base = jQuery(this.getBaseTarget()); newWidth = base.width(); } else { d16g.log(this.getLabel() + ".doResizeWidth(): this.resizeWidth.target is " + this.resizeWidth.target); newWidth = jQuery(this.resizeWidth.target).width(); } if( typeof this.resizeWidth.minWidth !== "undefined" ) { var minWidth = this.resizeWidth.minWidth; d16g.log(this.getLabel() + ".doResizeWidth(): minWidth="+minWidth); if( newWidth < minWidth ) { d16g.log(this.getLabel() + ".doResizeWidth(): limiting resize to minWidth of " + minWidth); newWidth = minWidth; } } d16g.log(this.getLabel() + ".doResizeWidth(): auto resizing width to " + newWidth); elem.width(newWidth); this.actualWidth = newWidth; if ( this.contentType === "flash" && typeof this.resizeWidth.shrinkFlash !== "undefined" && d16g.parseBool( this.resizeWidth.shrinkFlash ) === true ) { var flashWidth; if ( this.isClipOpen === true ) { flashWidth = this.width.open; d16g.log(this.getLabel() + ".doResizeWidth(): using open width"); } else { flashWidth = this.width.closed; d16g.log(this.getLabel() + ".doResizeWidth(): using close width"); } if( flashWidth > newWidth ) { flashWidth = newWidth; } d16g.log(this.getLabel() + ".doResizeWidth(): resizing flash object to " + flashWidth); jQuery("#"+ this.contentId).width(flashWidth); } } }; d16g.types.AdComponent.prototype.RENDER_STRATEGIES = ['positionToBase','outOfView','undoOutOfView','fixLayout','inView','hideElement','showElement','hideContent','showContent','cssCollapse','cssExpand','doCollapse','doExpand','none']; d16g.types.AdComponent.prototype.render = function () { d16g.log(this.getLabel() + '.render(' + d16g.arrToString(arguments) + '): adType="' + this.ad.adType + '", positioning.type="' + this.positioning.type + '", hidden=' + this.hidden + ', isLoaded=' + this.isLoaded); if ( typeof this.positioning === "undefined" || typeof this.positioning.type === "undefined" ) { d16g.error(this.getLabel() + '.render(): positioning is not defined properly for this component'); } else { var strategyArr = []; if (arguments.length === 0) { if ( this.hidden === true || this.positioning.type === 'auto' ) { strategyArr.push('none'); d16g.info('render(): no rendering on hidden or auto-positioned components unless strategy is forced', this); } else { strategyArr.push('positionToBase'); } } else { strategyArr = arguments; } d16g.log('.render(): strategyArr=' + d16g.arrToString(strategyArr), this); var action; var positionRelative = false; if(typeof this.positioning.relative !== "undefined") { positionRelative = d16g.parseBool(this.positioning.relative,false); } for (var i=0; i<strategyArr.length; i++) { action = strategyArr[i]; if (jQuery.inArray(action, this.RENDER_STRATEGIES) === -1) { d16g.error(this.getLabel() + '.render(): "' + action + '" is not recognized as a strategy'); } else { d16g.log('.render(): action=' + action, this); var elem = jQuery('#' + this.elementId); var content = jQuery('#' + this.contentId); switch(action) { case 'positionToBase': // typical case // position to base element or component var adjustedPos = this.getPos(); elem.css({ position: "absolute", top: adjustedPos.top, right: "", bottom: "", left: adjustedPos.left }); d16g.log(this.getLabel() + '.render(): elementId="' + this.elementId + '", adjustedPos.left=' + adjustedPos.left + ', adjustedPos.top=' + adjustedPos.top); this.doResizeWidth(); this.applyClip(); break; case 'fixLayout': // fixLayout is to make IE correctly position relative positioned HTML components // containing flash if( positionRelative === true ) { d16g.log("fixLayout removing and reapplying relative position",this); elem.css("position","").css("position","relative"); } break; case 'outOfView': elem.css({ position: "absolute", left: "-99999px", right: "" }); break; case 'undoOutOfView': if( positionRelative !== true ) { elem.css({ position: "", left: "" }); } else { elem.css({ position: "relative", left: "" }); } break; case 'inView': elem.css({ position: "absolute", top: "", right: 0, bottom: 0, left: "" }); break; case 'hideElement': elem.css("visibility", "hidden"); break; case 'showElement': elem.css("visibility", "visible"); break; case 'hideContent': content.css("visibility", "hidden"); break; case 'showContent': content.css("visibility", "visible"); break; case 'cssCollapse': elem.removeClass("expanded").addClass("collapsed"); break; case 'cssExpand': elem.removeClass("collapsed").addClass("expanded").css("height", "auto"); break; case 'doCollapse': content.get(0).doCollapse(); this.applyClip(); break; case 'doExpand': content.get(0).doExpand(); this.applyClip(); break; case 'none': break; default: d16g.error(this.getLabel() + '.render(): "' + action + '" is not recognized as a strategy'); } } } } }; /** * doHtmlInsertion() * place this.html into the DOM (for any dynamic component type) */ 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; // validate target if (d16g.adDebug === true) { if (jQuery(target).length === 0) { d16g.error('.doHtmlInsertion(): target="' + target + '" is not a valid jQuery selector (see config)'); } else { d16g.log(this.getLabel() + ".doHtmlInsertion(): initialized for insertion, target=" + target + ", insertionType=" + insertionType); } } if (this.contentType === "flash") { if ( !jQuery.browser.msie && d16g.parseBool(this.positioning.relative, false) === false) { 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': case 'prepend': // select the target, perform the jQuery function indicated by htmlInsertion.type with the html content var newElem = jQuery(this.html); newElem.attr('d16gErm', '1'); // mark every ERM component for possible selection later (i.e. removal) jQuery(target)[insertionType](newElem); d16g.log(this.getLabel() + ".doHtmlInsertion() attempted: target=" + target + ", insertionType=" + insertionType); this.applyZIndex(); break; default: d16g.error(this.getLabel() + ".doHtmlInsertion(): invalid insertionType=" + insertionType); } } }; /** * applyZIndex() */ d16g.types.AdComponent.prototype.applyZIndex = function() { d16g.log(this.getLabel() + ".applyZIndex()"); if (this.contentType !== "static") { var containerId = this.elementId; var zIndex = "1"; if(typeof this.zIndex !== "undefined") { zIndex = this.zIndex; } d16g.log(this.getLabel() + ".applyZIndex(): zIndex="+zIndex); jQuery('#' + containerId).css("z-index", zIndex); } }; /** * createContent() */ d16g.types.AdComponent.prototype.createContent = function () { d16g.log(this.getLabel() + ".createContent()"); // div ids if (this.contentType === "static") { d16g.info(this.getLabel() + ".createContent(): static component, no action needed"); } else { var containerId = this.elementId; var wrapperId = this.elementId + "_wr"; // can be used for css clipping var contentId = this.elementId + "_co"; // build html string 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(); // hide content div, but this will be replaced and overridden by swfObject // swfObject is very persistent about keeping visibility "visible" on instantiation. // Setting display initially to "none" causes the flash object not to load at all. // An alternative would be to check when the object has replaced the div then set // the visibility to hidden. Note that FF and IE need to be handled separately. // IE won't load with Flash hidden, so the object must be positioned outside the viewport. // Conversely, FF will reload if the Flash object when the object is repositioned back in the viewport. jQuery('#' + contentId).css("visibility", "hidden"); // hide container until loaded, apply background jQuery('#' + containerId) .css("background", this.background) .css("visibility", "hidden"); d16g.lo<p><sub><i>-- Delivered by <a href="http://feed43.com/">Feed43</a> service</i></sub></p>
]]></description>
</item>


  </channel>
</rss>
