/*
 * jQuery Form Plugin
 * version: 2.25 (08-APR-2009)
 * @requires jQuery v1.2.2 or later
 *
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Amazon elects to use jQuery Form Plugin under the MIT license.
 *
 */
(function(b){b.fn.ajaxSubmit=function(r){if(!this.length){a("ajaxSubmit: skipping submit process - no element selected");return this}if(typeof r=="function"){r={success:r}}var e=this.attr("action")||window.location.href;e=(e.match(/^([^#]+)/)||[])[1];e=e||"";r=b.extend({url:e,type:this.attr("method")||"GET"},r||{});var t={};this.trigger("form-pre-serialize",[this,r,t]);if(t.veto){a("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(r.beforeSerialize&&r.beforeSerialize(this,r)===false){a("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var l=this.formToArray(r.semantic);if(r.data){r.extraData=r.data;for(var f in r.data){if(r.data[f] instanceof Array){for(var g in r.data[f]){l.push({name:f,value:r.data[f][g]})}}else{l.push({name:f,value:r.data[f]})}}}if(r.beforeSubmit&&r.beforeSubmit(l,this,r)===false){a("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[l,this,r,t]);if(t.veto){a("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var d=b.param(l);if(r.type.toUpperCase()=="GET"){r.url+=(r.url.indexOf("?")>=0?"&":"?")+d;r.data=null}else{r.data=d}var s=this,i=[];if(r.resetForm){i.push(function(){s.resetForm()})}if(r.clearForm){i.push(function(){s.clearForm()})}if(!r.dataType&&r.target){var o=r.success||function(){};i.push(function(j){b(r.target).html(j).each(o,arguments)})}else{if(r.success){i.push(r.success)}}r.success=function(q,k){for(var n=0,j=i.length;n<j;n++){i[n].apply(r,[q,k,s])}};var c=b("input:file",this).fieldValue();var p=false;for(var h=0;h<c.length;h++){if(c[h]){p=true}}if(r.iframe||p){if(r.closeKeepAlive){b.get(r.closeKeepAlive,m)}else{m()}}else{b.ajax(r)}this.trigger("form-submit-notify",[this,r]);return this;function m(){var v=s[0];if(b(":input[name=submit]",v).length){alert('Error: Form elements must not be named "submit".');return}var q=b.extend({},b.ajaxSettings,r);var F=b.extend(true,{},b.extend(true,{},b.ajaxSettings),q);var u="jqFormIO"+(new Date().getTime());var B=b('<iframe id="'+u+'" name="'+u+'" src="about:blank" />');var D=B[0];B.css({position:"absolute",top:"-1000px",left:"-1000px"});var E={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;B.attr("src","about:blank")}};var C=q.global;if(C&&!b.active++){b.event.trigger("ajaxStart")}if(C){b.event.trigger("ajaxSend",[E,q])}if(F.beforeSend&&F.beforeSend(E,F)===false){F.global&&b.active--;return}if(E.aborted){return}var k=0;var x=0;var j=v.clk;if(j){var w=j.name;if(w&&!j.disabled){r.extraData=r.extraData||{};r.extraData[w]=j.value;if(j.type=="image"){r.extraData[name+".x"]=v.clk_x;r.extraData[name+".y"]=v.clk_y}}}setTimeout(function(){var I=s.attr("target"),G=s.attr("action");v.setAttribute("target",u);if(v.getAttribute("method")!="POST"){v.setAttribute("method","POST")}if(v.getAttribute("action")!=q.url){v.setAttribute("action",q.url)}if(!r.skipEncodingOverride){s.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(q.timeout){setTimeout(function(){x=true;y()},q.timeout)}var H=[];try{if(r.extraData){for(var J in r.extraData){H.push(b('<input type="hidden" name="'+J+'" value="'+r.extraData[J]+'" />').appendTo(v)[0])}}B.appendTo("body");D.attachEvent?D.attachEvent("onload",y):D.addEventListener("load",y,false);v.submit()}finally{v.setAttribute("action",G);I?v.setAttribute("target",I):s.removeAttr("target");b(H).remove()}},10);var z=0;function y(){if(k++){return}D.detachEvent?D.detachEvent("onload",y):D.removeEventListener("load",y,false);var G=true;try{if(x){throw"timeout"}var H,J;J=D.contentWindow?D.contentWindow.document:D.contentDocument?D.contentDocument:D.document;if((J.body==null||J.body.innerHTML=="")&&!z){z=1;k--;setTimeout(y,100);return}E.responseText=J.body?J.body.innerHTML:null;E.responseXML=J.XMLDocument?J.XMLDocument:J;E.getResponseHeader=function(L){var K={"content-type":q.dataType};return K[L]};if(q.dataType=="json"||q.dataType=="script"){var n=J.getElementsByTagName("textarea")[0];E.responseText=n?n.value:E.responseText}else{if(q.dataType=="xml"&&!E.responseXML&&E.responseText!=null){E.responseXML=A(E.responseText)}}H=b.httpData(E,q.dataType)}catch(I){G=false;b.handleError(q,E,"error",I)}if(G){q.success(H,"success");if(C){b.event.trigger("ajaxSuccess",[E,q])}}if(C){b.event.trigger("ajaxComplete",[E,q])}if(C&&!--b.active){b.event.trigger("ajaxStop")}if(q.complete){q.complete(E,G?"success":"error")}setTimeout(function(){B.remove();E.responseXML=null},100)}function A(n,G){if(window.ActiveXObject){G=new ActiveXObject("Microsoft.XMLDOM");G.async="false";G.loadXML(n)}else{G=(new DOMParser()).parseFromString(n,"text/xml")}return(G&&G.documentElement&&G.documentElement.tagName!="parsererror")?G:null}}};b.fn.ajaxForm=function(c){return this.ajaxFormUnbind().bind("submit.form-plugin",function(){b(this).ajaxSubmit(c);return false}).each(function(){b(":submit,input:image",this).bind("click.form-plugin",function(f){var d=this.form;d.clk=this;if(this.type=="image"){if(f.offsetX!=undefined){d.clk_x=f.offsetX;d.clk_y=f.offsetY}else{if(typeof b.fn.offset=="function"){var g=b(this).offset();d.clk_x=f.pageX-g.left;d.clk_y=f.pageY-g.top}else{d.clk_x=f.pageX-this.offsetLeft;d.clk_y=f.pageY-this.offsetTop}}}setTimeout(function(){d.clk=d.clk_x=d.clk_y=null},10)})})};b.fn.ajaxFormUnbind=function(){this.unbind("submit.form-plugin");return this.each(function(){b(":submit,input:image",this).unbind("click.form-plugin")})};b.fn.formToArray=function(q){var p=[];if(this.length==0){return p}var d=this[0];var h=q?d.getElementsByTagName("*"):d.elements;if(!h){return p}for(var k=0,m=h.length;k<m;k++){var e=h[k];var f=e.name;if(!f){continue}if(q&&d.clk&&e.type=="image"){if(!e.disabled&&d.clk==e){p.push({name:f+".x",value:d.clk_x},{name:f+".y",value:d.clk_y})}continue}var r=b.fieldValue(e,true);if(r&&r.constructor==Array){for(var g=0,c=r.length;g<c;g++){p.push({name:f,value:r[g]})}}else{if(r!==null&&typeof r!="undefined"){p.push({name:f,value:r})}}}if(!q&&d.clk){var l=d.getElementsByTagName("input");for(var k=0,m=l.length;k<m;k++){var o=l[k];var f=o.name;if(f&&!o.disabled&&o.type=="image"&&d.clk==o){p.push({name:f+".x",value:d.clk_x},{name:f+".y",value:d.clk_y})}}}return p};b.fn.formSerialize=function(c){return b.param(this.formToArray(c))};b.fn.fieldSerialize=function(d){var c=[];this.each(function(){var h=this.name;if(!h){return}var f=b.fieldValue(this,d);if(f&&f.constructor==Array){for(var g=0,e=f.length;g<e;g++){c.push({name:h,value:f[g]})}}else{if(f!==null&&typeof f!="undefined"){c.push({name:this.name,value:f})}}});return b.param(c)};b.fn.fieldValue=function(h){for(var g=[],e=0,c=this.length;e<c;e++){var f=this[e];var d=b.fieldValue(f,h);if(d===null||typeof d=="undefined"||(d.constructor==Array&&!d.length)){continue}d.constructor==Array?b.merge(g,d):g.push(d)}return g};b.fieldValue=function(c,j){var e=c.name,p=c.type,q=c.tagName.toLowerCase();if(typeof j=="undefined"){j=true}if(j&&(!e||c.disabled||p=="reset"||p=="button"||(p=="checkbox"||p=="radio")&&!c.checked||(p=="submit"||p=="image")&&c.form&&c.form.clk!=c||q=="select"&&c.selectedIndex==-1)){return null}if(q=="select"){var k=c.selectedIndex;if(k<0){return null}var m=[],d=c.options;var g=(p=="select-one");var l=(g?k+1:d.length);for(var f=(g?k:0);f<l;f++){var h=d[f];if(h.selected){var o=h.value;if(!o){o=(h.attributes&&h.attributes.value&&!(h.attributes.value.specified))?h.text:h.value}if(g){return o}m.push(o)}}return m}return c.value};b.fn.clearForm=function(){return this.each(function(){b("input,select,textarea",this).clearFields()})};b.fn.clearFields=b.fn.clearInputs=function(){return this.each(function(){var d=this.type,c=this.tagName.toLowerCase();if(d=="text"||d=="password"||c=="textarea"){this.value=""}else{if(d=="checkbox"||d=="radio"){this.checked=false}else{if(c=="select"){this.selectedIndex=-1}}}})};b.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};b.fn.enable=function(c){if(c==undefined){c=true}return this.each(function(){this.disabled=!c})};b.fn.selected=function(c){if(c==undefined){c=true}return this.each(function(){var d=this.type;if(d=="checkbox"||d=="radio"){this.checked=c}else{if(this.tagName.toLowerCase()=="option"){var e=b(this).parent("select");if(c&&e[0]&&e[0].type=="select-one"){e.find("option").selected(false)}this.selected=c}}})};function a(){if(b.fn.ajaxSubmit.debug&&window.console&&window.console.log){window.console.log("[jquery.form] "+Array.prototype.join.call(arguments,""))}}})(jQuery);
/* Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Amazon elects to use livequery under the MIT license.
 *
 * Version: 1.0.3
 * Requires jQuery 1.1.3+
 * Docs: http://docs.jquery.com/Plugins/livequery
 */
(function(a){a.extend(a.fn,{livequery:function(f,e,d){var c=this,g;if(a.isFunction(f)){d=e,e=f,f=undefined}a.each(a.livequery.queries,function(h,j){if(c.selector==j.selector&&c.context==j.context&&f==j.type&&(!e||e.$lqguid==j.fn.$lqguid)&&(!d||d.$lqguid==j.fn2.$lqguid)){return(g=j)&&false}});g=g||new a.livequery(this.selector,this.context,f,e,d);g.stopped=false;g.run();return this},expire:function(f,e,d){var c=this;if(a.isFunction(f)){d=e,e=f,f=undefined}a.each(a.livequery.queries,function(g,h){if(c.selector==h.selector&&c.context==h.context&&(!f||f==h.type)&&(!e||e.$lqguid==h.fn.$lqguid)&&(!d||d.$lqguid==h.fn2.$lqguid)&&!this.stopped){a.livequery.stop(h.id)}});return this}});a.livequery=function(c,e,g,f,d){this.selector=c;this.context=e||document;this.type=g;this.fn=f;this.fn2=d;this.elements=[];this.stopped=false;this.id=a.livequery.queries.push(this)-1;f.$lqguid=f.$lqguid||a.livequery.guid++;if(d){d.$lqguid=d.$lqguid||a.livequery.guid++}return this};a.livequery.prototype={stop:function(){var c=this;if(this.type){this.elements.unbind(this.type,this.fn)}else{if(this.fn2){this.elements.each(function(d,e){c.fn2.apply(e)})}}this.elements=[];this.stopped=true},run:function(){if(this.stopped){return}var e=this;var f=this.elements,d=a(this.selector,this.context),c=d.not(f);this.elements=d;if(this.type){c.bind(this.type,this.fn);if(f.length>0){a.each(f,function(g,h){if(a.inArray(h,d)<0){a.event.remove(h,e.type,e.fn)}})}}else{c.each(function(){e.fn.apply(this)});if(this.fn2&&f.length>0){a.each(f,function(g,h){if(a.inArray(h,d)<0){e.fn2.apply(h)}})}}}};a.extend(a.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if(a.livequery.running&&a.livequery.queue.length){var c=a.livequery.queue.length;while(c--){a.livequery.queries[a.livequery.queue.shift()].run()}}},pause:function(){a.livequery.running=false},play:function(){a.livequery.running=true;a.livequery.run()},registerPlugin:function(){a.each(arguments,function(d,e){if(!a.fn[e]){return}var c=a.fn[e];a.fn[e]=function(){var f=c.apply(this,arguments);a.livequery.run();return f}})},run:function(c){if(c!=undefined){if(a.inArray(c,a.livequery.queue)<0){a.livequery.queue.push(c)}}else{a.each(a.livequery.queries,function(d){if(a.inArray(d,a.livequery.queue)<0){a.livequery.queue.push(d)}})}if(a.livequery.timeout){clearTimeout(a.livequery.timeout)}a.livequery.timeout=setTimeout(a.livequery.checkQueue,20)},stop:function(c){if(c!=undefined){a.livequery.queries[c].stop()}else{a.each(a.livequery.queries,function(d){a.livequery.queries[d].stop()})}}});a.livequery.registerPlugin("append","prepend","after","before","wrap","attr","removeAttr","addClass","removeClass","toggleClass","empty","remove");a(function(){a.livequery.play()});var b=a.prototype.init;a.prototype.init=function(d,f){var e=b.apply(this,arguments);if(d&&d.selector){e.context=d.context,e.selector=d.selector}if(typeof d=="string"){e.context=f||document,e.selector=d}return e};a.prototype.init.prototype=a.prototype})(jQuery);
/*
 * jQuery Form Example Plugin 1.4.1
 * Populate form inputs with example text that disappears on focus.
 *
 * Copyright (c) Paul Mucur (http://mucur.name), 2007-2008.
 * Dual-licensed under the BSD (BSD-LICENSE.txt) and GPL (GPL-LICENSE.txt)
 * licenses.
 *
 * Amazon elects to use jQuery Form Example Plugin under the BSD license.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 */
(function(a){a.fn.example=function(b,d){var c=a.isFunction(b);var e=a.extend({},d,{example:b});return this.each(function(){var g=a(this);if(a.metadata){var f=a.extend({},a.fn.example.defaults,g.metadata(),e)}else{var f=a.extend({},a.fn.example.defaults,e)}if(!a.fn.example.boundClassNames[f.className]){a(window).unload(function(){a("."+f.className).val("")});a("form").submit(function(){a(this).find("."+f.className).val("")});a.fn.example.boundClassNames[f.className]=true}if(a.browser.msie&&!g.attr("defaultValue")&&(c||g.val()==f.example)){g.val("")}if(g.val()==""&&this!=document.activeElement){g.addClass(f.className);g.val(c?f.example.call(this):f.example)}g.focus(function(){if(a(this).is("."+f.className)){a(this).val("");a(this).removeClass(f.className)}});g.blur(function(){if(a(this).val()==""){a(this).addClass(f.className);a(this).val(c?f.example.call(this):f.example)}})})};a.fn.example.defaults={className:"example"};a.fn.example.boundClassNames=[]})(jQuery);
(function(c){function d(){this._curHash="";this._callback=function(a){}}c.extend(d.prototype,{init:function(a){this._callback=a;this._curHash=location.hash;if(c.browser.msie){if(this._curHash==""){this._curHash="#"}c("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>');var b=c("#jQuery_history")[0].contentWindow.document;b.open();b.close();b.location.hash=this._curHash}else{if(c.browser.safari){this._historyBackStack=[];this._historyBackStack.length=history.length;this._historyForwardStack=[];this._isFirst=true;this._dontCheck=false}}this._callback(this._curHash.replace(/^#/,""));setInterval(this._check,100)},add:function(a){this._historyBackStack.push(a);this._historyForwardStack.length=0;this._isFirst=true},_check:function(){if(c.browser.msie){var l=c("#jQuery_history")[0];var i=l.contentDocument||l.contentWindow.document;var a=i.location.hash;if(a!=c.history._curHash){location.hash=a;c.history._curHash=a;c.history._callback(a.replace(/^#/,""))}}else{if(c.browser.safari){if(!c.history._dontCheck){var k=history.length-c.history._historyBackStack.length;if(k){c.history._isFirst=false;if(k<0){for(var j=0;j<Math.abs(k);j++){c.history._historyForwardStack.unshift(c.history._historyBackStack.pop())}}else{for(var j=0;j<k;j++){c.history._historyBackStack.push(c.history._historyForwardStack.shift())}}var b=c.history._historyBackStack[c.history._historyBackStack.length-1];if(b!=undefined){c.history._curHash=location.hash;c.history._callback(b)}}else{if(c.history._historyBackStack[c.history._historyBackStack.length-1]==undefined&&!c.history._isFirst){if(document.URL.indexOf("#")>=0){c.history._callback(document.URL.split("#")[1])}else{c.history._callback("")}c.history._isFirst=true}}}}else{var a=location.hash;if(a!=c.history._curHash){c.history._curHash=a;c.history._callback(a.replace(/^#/,""))}}}},load:function(b){var a;if(c.browser.safari){a=b}else{a="#"+b;location.hash=a}this._curHash=a;if(c.browser.msie){var j=c("#jQuery_history")[0];var h=j.contentWindow.document;h.open();h.close();h.location.hash=a;this._callback(b)}else{if(c.browser.safari){this._dontCheck=true;this.add(b);var i=function(){c.history._dontCheck=false};window.setTimeout(i,200);this._callback(b);location.hash=a}else{this._callback(b)}}}});c(document).ready(function(){c.history=new d()})})(jQuery);
(function(a){a.fn.webReaderLauncher=function(){this.livequery("click",function(b){var h=20;var g=40;var c=505;var i=355;var d=a(this).parent().find("[name=kindleASIN]").attr("value");var e=a(this).parent().find("[name=displayTitle]").attr("value");var j=function(){var m=a(window).scrollTop()+h/4;var l=a(window).scrollLeft()+h/4;return{top:m,left:l}};var f=function(){var m=a(window).width()-2*h;var l=a(window).height()-2*h-g;if(m<c){m=c}if(l<i){l=i}a("#kindleReaderContainer").width(m);a("#kindleReaderContainer").height(l)};var k=function(){f();var l=a("#kindleReaderContainer").width();a(".ap_popover_sprited").width(l+36);a(".ap_titlebar").width(l);a(".ap_title").width(l-34);var o=j();a(".ap_popover_sprited").css("top",o.top);a(".ap_popover_sprited").css("left",o.left);var n=a(document).width()+"x"+a(document).height();var m=a(window).width()+"x"+a(window).height()};jQuery("body").css("overflow","hidden");f();a.AmazonPopover.displayPopover({localContent:"#kindleReaderContainer",title:'<font color="#105a97">Amazon Kindle: </font><font color="#333333">'+e+"</font>",modal:true,closeEventExclude:["CLICK_TRIGGER","CLICK_OUTSIDE","MOUSE_ENTER","MOUSE_LEAVE"],onShow:function(){KindleReader.LoadSample({asin:d,width:"100%",height:"100%",containerID:"kindleReaderContainer"});a(".ap_content").css("paddingTop","8");a(".ap_footer").hide();a(window).resize(k);a(window).scroll(k)},onHide:function(){a("body").css("overflow","auto");a("#kindleReaderContainer").empty();a(window).unbind("resize",k);a(window).unbind("scroll",k)},width:null,location:j,paddingLeft:0,paddingRight:0,paddingBottom:0});if(a("#kindleReaderIFrame").css("visibility")=="hidden"){a("#kindleReaderIFrame").css("visibility","visible")}})}})(jQuery);
(function(a){a.fn.expandCollapseBelow=function(b){var c={targetId:"expandCollapseId",expandClass:"expandBelowButton",collapseClass:"collapseBelowButton",expandHtml:"",collapseHtml:"",remote:false,remoteUrl:null};var b=a.extend(c,b);return this.each(function(){var d=b;var g=a(this);var f=a("#"+d.targetId);var e=false;g.addClass(d.expandClass);f.hide();g.click(function(){g.blur();if(g.hasClass(d.expandClass)){if(g.parent().hasClass(d.expandClass)){g.parent().removeClass(d.expandClass).addClass(d.collapseClass)}g.removeClass(d.expandClass).addClass(d.collapseClass);g.html(d.collapseHtml);f.show();if(d.remote==true&&e==false){var h=d.remoteUrl;if(h==null){h=g.attr("href")}a.ajax({type:"get",url:h,beforeSend:function(i){i.setRequestHeader("Accept","application/javascript")},success:function(i){f.html(i);e=true},error:function(i,k,j){f.html("Sorry, something went wrong...")}})}}else{if(g.hasClass(d.collapseClass)){if(g.parent().hasClass(d.collapseClass)){g.parent().removeClass(d.collapseClass).addClass(d.expandClass)}g.removeClass(d.collapseClass).addClass(d.expandClass);g.html(d.expandHtml);f.hide()}}return false})})}})(jQuery);
window.AmazonPopoverImages={snake:"https://images-na.ssl-images-amazon.com/images/G/01/javascripts/lib/popover/images/snake._V265110081_.gif",btnClose:"https://images-na.ssl-images-amazon.com/images/G/01/javascripts/lib/popover/images/btn_close._V265110085_.gif",closeTan:"https://images-na.ssl-images-amazon.com/images/G/01/javascripts/lib/popover/images/btn_close._V265110085_.gif",closeTanDown:"https://images-na.ssl-images-amazon.com/images/G/01/javascripts/lib/popover/images/btn_close._V265110085_.gif",loadingBar:"https://images-na.ssl-images-amazon.com/images/G/01/javascripts/lib/popover/images/snake._V265110081_.gif",pixel:"https://images-na.ssl-images-amazon.com/images/G/01/icons/blank-pixel._V42753713_.gif"};var container=document.createElement("DIV");container.id="ap_container";if(document.body.childNodes.length){document.body.insertBefore(container,document.body.childNodes[0])}else{document.body.appendChild(container)};
