TaggingUtils={};if(!window.TaggingOptions){var TaggingOptions={}}if(!TaggingOptions.strings){TaggingOptions.strings={}}TaggingUtils.sUserAgent=navigator.userAgent;TaggingUtils.fAppVersion=parseFloat(navigator.appVersion);TaggingUtils.isOpera=TaggingUtils.sUserAgent.indexOf("Opera")>-1;TaggingUtils.isSafari=TaggingUtils.sUserAgent.indexOf("Safari")>-1;TaggingUtils.isIE=TaggingUtils.sUserAgent.indexOf("compatible")>-1&&TaggingUtils.sUserAgent.indexOf("MSIE")>-1&&!TaggingUtils.isOpera;TaggingUtils.isMinIE4=TaggingUtils.isMinIE5=TaggingUtils.isMinIE5_5=TaggingUtils.isMinIE6=false;TaggingUtils.ascii="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";TaggingUtils.diacritics="%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%A8%C3%A9%C3%AA%C3%AB%C3%AC%C3%AD%C3%AE%C3%AF%C3%B0%C3%B1%C3%B2%C3%B3%C3%B4%C3%B5%C3%B6%C3%B9%C3%BA%C3%BB%C3%BC%C3%BD%C3%BF%C3%80%C3%81%C3%82%C3%83%C3%84%C3%85%C3%86%C3%87%C3%88%C3%89%C3%8A%C3%8B%C3%8C%C3%8D%C3%8E%C3%8F%C3%90%C3%91%C3%92%C3%93%C3%94%C3%95%C3%96%C3%98%C3%99%C3%9A%C3%9B%C3%9C%C3%9D%C3%9F";TaggingUtils.asciiEx=TaggingUtils.ascii+"0123456789-_ ";TaggingUtils.getDocumentCharset=function(){var a=document.charset||document.defaultCharset||document.characterSet;if(a){a=a.toLowerCase()}return a};TaggingUtils.getAcceptedChars=function(){if(!TaggingUtils.acceptedChars){TaggingOptions.realm=TaggingOptions.realm||"USAmazon";if(TaggingUtils.getDocumentCharset()=="shift_jis"){return TaggingUtils.acceptedChars=""}else{if(0&&(TaggingOptions.realm=="USAmazon"||TaggingOptions.realm=="GBAmazon")){TaggingUtils.acceptedChars=TaggingUtils.asciiEx}else{TaggingUtils.acceptedChars=TaggingUtils.asciiEx+decodeURIComponent(TaggingUtils.diacritics)}}}return TaggingUtils.acceptedChars};TaggingUtils.validateKanji=function(a){return(19968<=a&&a<=40869)||(12293<=a&&a<=12295)};TaggingUtils.validateHiragana=function(a){return(12352<=a&&a<=12446)};TaggingUtils.validateKatakana=function(a){return(12449<=a&&a<=12542)||(65382<=a&&a<=65437)};TaggingUtils.validateJP=function(a){if(TaggingUtils.asciiEx.indexOf(a)+1){return true}a=a.charCodeAt(0);if(a==12539||a==12316){return true}return TaggingUtils.validateKanji(a)||TaggingUtils.validateHiragana(a)||TaggingUtils.validateKatakana(a)};if(TaggingUtils.isIE){var reIE=new RegExp("MSIE (\\d+\\.\\d+);");reIE.test(TaggingUtils.sUserAgent);var fIEVersion=parseFloat(RegExp["$1"]);TaggingUtils.isMinIE4=fIEVersion>=4;TaggingUtils.isMinIE5=fIEVersion>=5;TaggingUtils.isMinIE5_5=fIEVersion>=5.5;TaggingUtils.isMinIE6=fIEVersion>=6}if(TaggingUtils.isOpera){var fOperaVersion;if(navigator.appName=="Opera"){fOperaVersion=TaggingUtils.fAppVersion}else{var reOperaVersion=new RegExp("Opera (\\d+\\.\\d+)");reOperaVersion.test(TaggingUtils.sUserAgent);fOperaVersion=parseFloat(RegExp["$1"])}TaggingUtils.isMinOpera4=fOperaVersion>=4;TaggingUtils.isMinOpera5=fOperaVersion>=5;TaggingUtils.isMinOpera6=fOperaVersion>=6;TaggingUtils.isMinOpera7=fOperaVersion>=7;TaggingUtils.isMinOpera7_5=fOperaVersion>=7.5;TaggingUtils.isMinOpera8=fOperaVersion>=8;TaggingUtils.isMinOpera9=fOperaVersion>=9}TaggingUtils.getClientWidth=function(){var a=0;if(self.innerHeight){a=self.innerWidth}else{if(document.documentElement&&document.documentElement.clientHeight){a=document.documentElement.clientWidth}else{if(document.body){a=document.body.clientWidth}}}return a};TaggingUtils.getClientHeight=function(){var a=0;if(self.innerHeight){a=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){a=document.documentElement.clientHeight}else{if(document.body){a=document.body.clientHeight}}}return a};TaggingUtils.getPageSizeWithScroll=function(){var a=0;var b=0;if(window.innerHeight&&window.scrollMaxY){a=window.innerHeight+window.scrollMaxY;b=window.innerWidth+window.scrollMaxX}else{if(document.body.scrollHeight>document.body.offsetHeight){a=document.body.scrollHeight;b=document.body.scrollWidth}else{a=document.body.offsetHeight;b=document.body.offsetWidth}}return{width:b,height:a}};TaggingUtils.getPageLeft=function(b){b=$(b);if(!b){return 0}var a=0;while(b){if(b.offsetLeft){a+=b.offsetLeft}b=b.offsetParent?b.offsetParent:null}return a};TaggingUtils.getPageTop=function(a){a=$(a);if(!a){return 0}var b=0;while(a){if(a.offsetTop){b+=a.offsetTop}a=a.offsetParent?a.offsetParent:null}return b};TaggingUtils.getScrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0};TaggingUtils.getScrollLeft=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0};TaggingUtils.observe=function(d,c,b,a){d=$(d);a=a||false;if(d.addEventListener){d.addEventListener(c,b,a)}else{if(d.attachEvent){d.attachEvent("on"+c,b)}}};TaggingUtils.stopObserving=function(d,c,b,a){d=$(d);a=a||false;if(d.removeEventListener){d.removeEventListener(c,b,a)}else{if(d.detachEvent){d.detachEvent("on"+c,b)}}};TaggingUtils.remove=function(a){a=$(a);a.parentNode.removeChild(a)};TaggingUtils.replace=function(c,a){c=$(c);a=$(a);var b=c.parentNode;b.replaceChild(a,c)};TaggingUtils.isParent=function(a,c){var b=c.parentNode;while(b){if(b==a){return true}b=b.parentNode}return false};TaggingUtils.getParent=function(c,b){c=$(c);if(!c){return null}var a=c.parentNode;if(b){b=b.toLowerCase()}while(a&&b&&a.nodeName.toLowerCase()!=b){a=a.parentNode}return a};TaggingUtils.firstChild=function(b,c,a){var d=$(b).firstChild;if(a){a=a.toUpperCase()}if(c&&c!=1){while(d&&d.nodeType!=c){d=d.nextSibling}}else{if(a){while(d&&(d.nodeType!=1||(d.nodeType==1&&d.nodeName.toUpperCase()!=a))){d=d.nextSibling}}else{while(d&&d.nodeType!=1){d=d.nextSibling}}}return d};TaggingUtils.nextSibling=function(b,c,a){var d=$(b).nextSibling;if(a){a=a.toUpperCase()}if(c&&c!=1){while(d&&d.nodeType!=c){d=d.nextSibling}}else{if(a){while(d&&(d.nodeType!=1||(d.nodeType==1&&d.nodeName.toUpperCase()!=a))){d=d.nextSibling}}else{while(d&&d.nodeType!=1){d=d.nextSibling}}}return d};TaggingUtils.prevSibling=function(b,c,a){var d=$(b).previousSibling;if(a){a=a.toUpperCase()}if(c&&c!=1){while(d&&d.nodeType!=c){d=d.previousSibling}}else{if(a){while(d&&(d.nodeType!=1||(d.nodeType==1&&d.nodeName.toUpperCase()!=a))){d=d.previousSibling}}else{while(d&&d.nodeType!=1){d=d.previousSibling}}}return d};TaggingUtils.getParentIndex=function(c){var d=c.parentNode.childNodes;var a=0;for(var b=0;b<d.length;b++){if(d[b]==c){return a}if(d[b].nodeType==1){a++}}return -1};TaggingUtils.swapNode=function(e,b){if(e.swapNode){e.swapNode(b)}else{var f=e.nextSibling;var d=b.nextSibling;var c=e.parentNode;c.removeChild(e,true);var a=b.parentNode;a.removeChild(b,true);c.insertBefore(b,f);a.insertBefore(e,d)}};TaggingUtils.findNodes=function(f,e,d){var b=f.getElementsByTagName(e);if(d){var a=new Array();for(var c=0;c<b.length;c++){if(b[c].getAttribute(d)){a.push(b[c])}}return a}else{return b}};TaggingUtils.copyObject=function(a,b){for(property in b){a[property]=b[property]}return a};TaggingUtils.bind=function(c,b){var a=c;return function(){a.apply(b,arguments)}};TaggingUtils.bindAsEventListener=function(c,b){var a=c;return function(d){return a.apply(b,[d||window.event])}};TaggingUtils.getEventPageX=function(a){if(a.pageX){return a.pageX}else{if(a.clientX){return a.clientX+TaggingUtils.getScrollLeft()}}return 0};TaggingUtils.getEventPageY=function(a){if(a.pageY){return a.pageY}else{if(a.clientY){return a.clientY+TaggingUtils.getScrollTop()}}return 0};TaggingUtils.isLeftClick=function(a){return((a.which)&&(a.which==1))||((a.button)&&(a.button==1))};TaggingUtils.getEventKeyCode=function(a){if(a.keyCode){return a.keyCode}else{if(a.charCode){return a.charCode}else{if(a.which){return a.which}}}};TaggingUtils.getEventTarget=function(a){return a.target||a.srcElement};TaggingUtils.stopEvent=function(a){if(a.preventDefault){a.preventDefault();a.stopPropagation()}else{a.cancelBubble=true;a.returnValue=false}};TaggingUtils.trim=function(b){if(b!=null){var a=b.replace(/^\s+/g,"");return a.replace(/\s+$/g,"")}};TaggingUtils.substringEncodedText=function(h,d,e){if(!h||!d){return}if(h.length<d){return h}var g=d;var a=0;var b=0;var f=false;for(;b<h.length&&a<g;b++){var j=h.charAt(b);if(j=="&"){f=true}else{if(j==";"&&f){f=false;a++}else{if(!f){a++}}}}return h.substring(0,b)+"..."};TaggingUtils.insertSpaces=function(g,e){if(!g){return}if(!e){e=20}if(g.length<e){return g}var a="";var f=false;var b=0;for(var d=0;d<g.length;d++){var h=g.charAt(d);if(h==" "){b=0}else{if(h=="&"){f=true}else{if(h==";"&&f){f=false;b++}else{if(!f){b++}}}}a=a+h;if(b==e){a=a+" ";b=0}}return a};TaggingUtils.sanitizeTag=function(b){var a="";b=TaggingUtils.trim(b);if(b&&b.length>0){for(var d=0;d<b.length;d++){var e=b.charAt(d);if(TaggingUtils.isValidTagChar(e)){if(e!=" "||(e==" "&&a.charAt(a.length-1)!=" ")){a=a+e}}else{if(a.charAt(a.length-1)!=" "){a=a+" "}}}}return TaggingUtils.trim(a)};TaggingUtils.isValidTagChar=function(a){if(TaggingUtils.getDocumentCharset()=="shift_jis"){return TaggingUtils.validateJP(a)}return TaggingUtils.getAcceptedChars().indexOf(a)>=0};function $(){var c=new Array();for(var b=0;b<arguments.length;b++){var a=arguments[b];if(typeof a=="string"){a=document.getElementById(a)}if(arguments.length==1){return a}c.push(a)}return c}TaggingUtils.isInArray=function(a,c){if(!a||!c){return false}for(var b=0;b<a.length;b++){if(a[b]==c){return true}}return false};TaggingUtils.getTextFromArray=function(b,e,d){if(b.length<=1){return b.join()}var e=e||", ";if(typeof d==="undefined"){return b.join(e)}var c=b.concat();var f=c.pop();return[c.join(e),f].join(d)};function emptyFunction(){}var TaggingAjax={};TaggingAjax.getTransport=function(){if(window.XMLHttpRequest){return new XMLHttpRequest()}else{if(window.ActiveXObject){var a=new Array("MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP");for(var b=0;b<a.length;b++){try{return new ActiveXObject(a[b])}catch(c){}}}}};TaggingAjax.isSupported=TaggingAjax.getTransport()?true:false;TaggingAjax.Request=function(a){this.options=TaggingUtils.copyObject({method:"GET",asynchronous:true,sameInstance:true,parameters:""},a)};TaggingAjax.Request.prototype.responseIsSuccess=function(){return this.transport.status=="undefined"||this.transport.status==0||(this.transport.status>=200&&this.transport.status<300)};TaggingAjax.Request.prototype.responseIsFailure=function(){return !this.responseIsSuccess()};function tEncodeQS(a){var e=a.split("&"),d;for(var c=0;c<e.length&&(d=e[c].split("="));c++){for(var b=1;b<d.length;b++){if(!(d[b].indexOf("%")+1)){d[b]=encodeURIComponent(d[b])}}e[c]=d.join("=")}return e.join("&")}TaggingAjax.Request.prototype.makeRequest=function(b){var c=tEncodeQS(this.options.parameters||"");try{if(this.options.method=="GET"&&c.length>0){if(b.indexOf("?")==-1){b+="?"+c}else{b+="&"+c}}if(this.transport){if(this.options.sameInstance&&this.transport){if(this.transport.readyState!=0&&this.transport.readyState!=4){this.transport.abort()}}}else{this.transport=TaggingAjax.getTransport()}if(!this.transport){return}if(b.indexOf("?")==-1){b+="?ts="+(new Date()).getTime()}else{b+="&ts="+(new Date()).getTime()}this.transport.open(this.options.method,b,this.options.asynchronous);this.transport.onreadystatechange=TaggingUtils.bind(this.onStateChange,this);this.setRequestHeaders();var a=this.options.postBody?this.options.postBody:c;this.timeoutid=setTimeout(TaggingUtils.bind(function(){this.respondToReadyState(5)},this),10000);this.errorFired=false;this.triggeredComplete=false;this.transport.send(this.options.method=="POST"?a:null)}catch(d){if(this.timeoutid){clearTimeout(this.timeoutid)}if(!this.errorFired){(this.options.onError||emptyFunction)(this.transport);this.errorFired=true}}};TaggingAjax.Request.prototype.setRequestHeaders=function(){var b=new Array();if(this.options.method=="POST"){b.push("Content-type","application/x-www-form-urlencoded");if(this.transport.overrideMimeType){b.push("Connection","close")}}if(this.options.requestHeaders){b.push.apply(b,this.options.requestHeaders)}for(var a=0;a<b.length;a+=2){this.transport.setRequestHeader(b[a],b[a+1])}};TaggingAjax.Request.prototype.onStateChange=function(){var a=this.transport.readyState;if(a!=1){this.respondToReadyState(this.transport.readyState)}};TaggingAjax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete","Timeout"];TaggingAjax.Request.prototype.respondToReadyState=function(a){var b=TaggingAjax.Request.Events[a];if(b=="Complete"&&!this.triggeredComplete){if(this.timeoutid){clearTimeout(this.timeoutid)}this.triggeredComplete=true;if(this.responseIsSuccess()){(this.options["on"+this.transport.status]||this.options.onSuccess||emptyFunction)(this.transport)}else{if(!this.errorFired){(this.options["on"+this.transport.statusText]||this.options.onError||emptyFunction)(this.transport);this.errorFired=true}}}else{(this.options["on"+b]||emptyFunction)(this.transport)}if(b=="Complete"){this.transport.onreadystatechange=emptyFunction}};function TaggingInputKeyDown(b,a){var c=TaggingUtils.getEventKeyCode(b);if(a==undefined){a=false}if(c==13&&a==false){TaggingUtils.stopEvent(b)}if(!document.all){if((c==46||c==8||c==9||c==37||c==39||c==35||c==36)){window.taggingAllowKey=true}}}function TaggingInputKeyPress(b,c,a){var d=TaggingUtils.getEventKeyCode(b);if(a==undefined){a=false}if(!document.all){if(window.taggingAllowKey){window.taggingAllowKey=false;return}}if(d==13&&a==false){TaggingUtils.stopEvent(b)}if(!(d==32||d==45||d==8||(d==13&&a==true)||(c&&d==",".charCodeAt(0))||TaggingUtils.isValidTagChar(String.fromCharCode(d))>=0||(48<=d&&d<=57)||(65<=d&&d<=90)||d==95||(97<=d&&d<=122))){TaggingUtils.stopEvent(b)}}function TaggingProcessInput(f){if(f){var c=f.split(",");var a="";for(var d=0;d<c.length;d++){c[d]=TaggingUtils.trim(c[d]);if(c[d]&&c[d].length>0){var e=false;for(var b=0;b<d;b++){if(c[b]==c[d]){e=true;break}}if(e){continue}if(c[d].length>0){if(a.length!=0){a+=","+c[d]}else{a=c[d]}}}}return a}}function appendTagToString(b,a,c){var e=a.split(c);b=TaggingUtils.trim(b).toLowerCase();for(var f=0;f<e.length;f++){e[f]=TaggingUtils.trim(e[f]).toLowerCase();if(e[f]==b){return a}}var d=TaggingUtils.trim(a);if(d.length==0){return b}else{if(d.charAt(d.length-1)==","){return a+" "+b}else{return a+c+" "+b}}}function removeTagFromString(b,a,c){var d=a.split(c);var f="";b=TaggingUtils.trim(b).toLowerCase();for(var e=0;e<d.length;e++){var g=TaggingUtils.trim(d[e]).toLowerCase();if(g==b){continue}else{if(f!=""){f+=c}f+=d[e]}}return TaggingUtils.trim(f)}function tagging_AllowEnhancedUI(){return TaggingAjax.isSupported&&((!TaggingUtils.isIE)||(TaggingUtils.isIE&&TaggingUtils.isMinIE5_5))&&((!TaggingUtils.isOpera)||(TaggingUtils.isOpera&&TaggingUtils.isMinOpera8))}function tStylesheetMerge(){var b=jQuery;if(!b.browser.msie||(b("link[rel='stylesheet']").length+b("style").length)==document.styleSheets.length){return}var a=b("#tags-css");if(a.length){a=a[0];var c=document.styleSheets[document.styleSheets.length-1];c.cssText+=a.innerHTML}}if(typeof window.jQuery!="undefined"){jQuery(document).ready(tStylesheetMerge)}if(typeof amznJQ!=="undefined"){amznJQ.available("inlineJS.tagging",function(){var a=0;var c=function(){if(taggingScriptsToLoad>1&&++a==taggingScriptsToLoad){amznJQ.declareAvailable("externalJS.tagging");amznJQ.declareAvailable("onDemandJS.tagging")}};var b=["tags-twister","tags-common","your-tags","tags-piles","tags-voting"];jQuery.each(b,function(e,d){amznJQ.available(d+".tagging",c)})})}if(typeof amznJQ!=="undefined"){amznJQ.declareAvailable("tags-common.tagging")};
