
/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt  */ var YAHOO=window.YAHOO||{};YAHOO.namespace=function(ns){if(!ns||!ns.length){return null;}var _2=ns.split(".");var _3=YAHOO;for(var i=(_2[0]=="YAHOO")?1:0;i<_2.length;++i){_3[_2[i]]=_3[_2[i]]||{};_3=_3[_2[i]];}return _3;};YAHOO.log=function(_5,_6,_7){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(_5,_6,_7);}else{return false;}};YAHOO.extend=function(_9,_10){var f=function(){};f.prototype=_10.prototype;_9.prototype=new f();_9.prototype.constructor=_9;_9.superclass=_10.prototype;if(_10.prototype.constructor==Object.prototype.constructor){_10.prototype.constructor=_10;}};YAHOO.namespace("util");YAHOO.namespace("widget");YAHOO.namespace("example");

/****************************************************************
/****************************************************************
/* Copyright (c) 2006, Yahoo! Inc. All rights reserved.  Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt */ YAHOO.util.Dom=function(){var ua=navigator.userAgent.toLowerCase();var isOpera=(ua.indexOf('opera')>-1);var isSafari=(ua.indexOf('safari')>-1);var isIE=(window.ActiveXObject);var id_counter=0;var util=YAHOO.util;var property_cache={};var toCamel=function(property){var convert=function(prop){var test=/(-[a-z])/i.exec(prop);return prop.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());};while(property.indexOf('-')>-1){property=convert(property);}return property;};var toHyphen=function(property){if(property.indexOf('-')>-1){return property;}var converted='';for(var i=0,len=property.length;i<len;++i){if(property.charAt(i)==property.charAt(i).toUpperCase()){converted=converted+'-'+property.charAt(i).toLowerCase();}else{converted=converted+property.charAt(i);}}return converted;};var cacheConvertedProperties=function(property){property_cache[property]={camel:toCamel(property),hyphen:toHyphen(property)};};return{get:function(el){if(!el){return null;}if(typeof el!='string'&&!(el instanceof Array)){return el;}if(typeof el=='string'){return document.getElementById(el);}else{var collection=[];for(var i=0,len=el.length;i<len;++i){collection[collection.length]=util.Dom.get(el[i]);}return collection;}return null;},getStyle:function(el,property){var f=function(el){var value=null;var dv=document.defaultView;if(!property_cache[property]){cacheConvertedProperties(property);}var camel=property_cache[property]['camel'];var hyphen=property_cache[property]['hyphen'];if(property=='opacity'&&el.filters){value=1;try{value=el.filters.item('DXImageTransform.Microsoft.Alpha').opacity/100;}catch(e){try{value=el.filters.item('alpha').opacity/100;}catch(e){}}}else if(el.style[camel]){value=el.style[camel];}else if(isIE&&el.currentStyle&&el.currentStyle[camel]){value=el.currentStyle[camel];}else if(dv&&dv.getComputedStyle){var computed=dv.getComputedStyle(el,'');if(computed&&computed.getPropertyValue(hyphen)){value=computed.getPropertyValue(hyphen);}}return value;};return util.Dom.batch(el,f,util.Dom,true);},setStyle:function(el,property,val){if(!property_cache[property]){cacheConvertedProperties(property);}var camel=property_cache[property]['camel'];var f=function(el){switch(property){case'opacity':if(isIE&&typeof el.style.filter=='string'){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}}else{el.style.opacity=val;el.style['-moz-opacity']=val;el.style['-khtml-opacity']=val;}break;default:el.style[camel]=val;}};util.Dom.batch(el,f,util.Dom,true);},getXY:function(el){var f=function(el){if(el.offsetParent===null||this.getStyle(el,'display')=='none'){return false;}var parentNode=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var doc=document;if(!this.inDocument(el)&&parent.document!=document){doc=parent.document;if(!this.isAncestor(doc.documentElement,el)){return false;}}var scrollTop=Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);var scrollLeft=Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);return[box.left+scrollLeft,box.top+scrollTop];}else{pos=[el.offsetLeft,el.offsetTop];parentNode=el.offsetParent;if(parentNode!=el){while(parentNode){pos[0]+=parentNode.offsetLeft;pos[1]+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}}if(isSafari&&this.getStyle(el,'position')=='absolute'){pos[0]-=document.body.offsetLeft;pos[1]-=document.body.offsetTop;}}if(el.parentNode){parentNode=el.parentNode;}else{parentNode=null;}while(parentNode&&parentNode.tagName.toUpperCase()!='BODY'&&parentNode.tagName.toUpperCase()!='HTML'){pos[0]-=parentNode.scrollLeft;pos[1]-=parentNode.scrollTop;if(parentNode.parentNode){parentNode=parentNode.parentNode;}else{parentNode=null;}}return pos;};return util.Dom.batch(el,f,util.Dom,true);},getX:function(el){return util.Dom.getXY(el)[0];},getY:function(el){return util.Dom.getXY(el)[1];},setXY:function(el,pos,noRetry){var f=function(el){var style_pos=this.getStyle(el,'position');if(style_pos=='static'){this.setStyle(el,'position','relative');style_pos='relative';}var pageXY=this.getXY(el);if(pageXY===false){return false;}var delta=[parseInt(this.getStyle(el,'left'),10),parseInt(this.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=(style_pos=='relative')?0:el.offsetLeft;}if(isNaN(delta[1])){delta[1]=(style_pos=='relative')?0:el.offsetTop;}if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';}if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';}var newXY=this.getXY(el);if(!noRetry&&(newXY[0]!=pos[0]||newXY[1]!=pos[1])){this.setXY(el,pos,true);}};util.Dom.batch(el,f,util.Dom,true);},setX:function(el,x){util.Dom.setXY(el,[x,null]);},setY:function(el,y){util.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){var region=new YAHOO.util.Region.getRegion(el);return region;};return util.Dom.batch(el,f,util.Dom,true);},getClientWidth:function(){return util.Dom.getViewportWidth();},getClientHeight:function(){return util.Dom.getViewportHeight();},getElementsByClassName:function(className,tag,root){var method=function(el){return util.Dom.hasClass(el,className)};return util.Dom.getElementsBy(method,tag,root);},hasClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)');var f=function(el){return re.test(el['className']);};return util.Dom.batch(el,f,util.Dom,true);},addClass:function(el,className){var f=function(el){if(this.hasClass(el,className)){return;}el['className']=[el['className'],className].join(' ');};util.Dom.batch(el,f,util.Dom,true);},removeClass:function(el,className){var re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,className)){return;}var c=el['className'];el['className']=c.replace(re,' ');if(this.hasClass(el,className)){this.removeClass(el,className);}};util.Dom.batch(el,f,util.Dom,true);},replaceClass:function(el,oldClassName,newClassName){var re=new RegExp('(?:^|\\s+)'+oldClassName+'(?:\\s+|$)','g');var f=function(el){if(!this.hasClass(el,oldClassName)){this.addClass(el,newClassName);return;}el['className']=el['className'].replace(re,' '+newClassName+' ');if(this.hasClass(el,oldClassName)){this.replaceClass(el,oldClassName,newClassName);}};util.Dom.batch(el,f,util.Dom,true);},generateId:function(el,prefix){prefix=prefix||'yui-gen';el=el||{};var f=function(el){if(el){el=util.Dom.get(el);}else{el={};}if(!el.id){el.id=prefix+id_counter++;}return el.id;};return util.Dom.batch(el,f,util.Dom,true);},isAncestor:function(haystack,needle){haystack=util.Dom.get(haystack);if(!haystack||!needle){return false;}var f=function(needle){if(haystack.contains&&!isSafari){return haystack.contains(needle);}else if(haystack.compareDocumentPosition){return!!(haystack.compareDocumentPosition(needle)&16);}else{var parent=needle.parentNode;while(parent){if(parent==haystack){return true;}else if(parent.tagName.toUpperCase()=='HTML'){return false;}parent=parent.parentNode;}return false;}};return util.Dom.batch(needle,f,util.Dom,true);},inDocument:function(el){var f=function(el){return this.isAncestor(document.documentElement,el);};return util.Dom.batch(el,f,util.Dom,true);},getElementsBy:function(method,tag,root){tag=tag||'*';root=util.Dom.get(root)||document;var nodes=[];var elements=root.getElementsByTagName(tag);if(!elements.length&&(tag=='*'&&root.all)){elements=root.all;}for(var i=0,len=elements.length;i<len;++i){if(method(elements[i])){nodes[nodes.length]=elements[i];}}return nodes;},batch:function(el,method,o,override){var id=el;el=util.Dom.get(el);var scope=(override)?o:window;if(!el||el.tagName||!el.length){if(!el){return false;}return method.call(scope,el,o);}var collection=[];for(var i=0,len=el.length;i<len;++i){if(!el[i]){id=id[i];}collection[collection.length]=method.call(scope,el[i],o);}return collection;},getDocumentHeight:function(){var scrollHeight=-1,windowHeight=-1,bodyHeight=-1;var marginTop=parseInt(util.Dom.getStyle(document.body,'marginTop'),10);var marginBottom=parseInt(util.Dom.getStyle(document.body,'marginBottom'),10);var mode=document.compatMode;if((mode||isIE)&&!isOpera){switch(mode){case'CSS1Compat':scrollHeight=((window.innerHeight&&window.scrollMaxY)?window.innerHeight+window.scrollMaxY:-1);windowHeight=[document.documentElement.clientHeight,self.innerHeight||-1].sort(function(a,b){return(a-b);})[1];bodyHeight=document.body.offsetHeight+marginTop+marginBottom;break;default:scrollHeight=document.body.scrollHeight;bodyHeight=document.body.clientHeight;}}else{scrollHeight=document.documentElement.scrollHeight;windowHeight=self.innerHeight;bodyHeight=document.documentElement.clientHeight;}var h=[scrollHeight,windowHeight,bodyHeight].sort(function(a,b){return(a-b);});return h[2];},getDocumentWidth:function(){var docWidth=-1,bodyWidth=-1,winWidth=-1;var marginRight=parseInt(util.Dom.getStyle(document.body,'marginRight'),10);var marginLeft=parseInt(util.Dom.getStyle(document.body,'marginLeft'),10);var mode=document.compatMode;if(mode||isIE){switch(mode){case'CSS1Compat':docWidth=document.documentElement.clientWidth;bodyWidth=document.body.offsetWidth+marginLeft+marginRight;winWidth=self.innerWidth||-1;break;default:bodyWidth=document.body.clientWidth;winWidth=document.body.scrollWidth;break;}}else{docWidth=document.documentElement.clientWidth;bodyWidth=document.body.offsetWidth+marginLeft+marginRight;winWidth=self.innerWidth;}var w=[docWidth,bodyWidth,winWidth].sort(function(a,b){return(a-b);});return w[2];},getViewportHeight:function(){var height=-1;var mode=document.compatMode;if((mode||isIE)&&!isOpera){switch(mode){case'CSS1Compat':height=document.documentElement.clientHeight;break;default:height=document.body.clientHeight;}}else{height=self.innerHeight;}return height;},getViewportWidth:function(){var width=-1;var mode=document.compatMode;if(mode||isIE){switch(mode){case'CSS1Compat':width=document.documentElement.clientWidth;break;default:width=document.body.clientWidth;}}else{width=self.innerWidth;}return width;}};}();YAHOO.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};YAHOO.util.Region.prototype.contains=function(region){return(region.left>=this.left&&region.right<=this.right&&region.top>=this.top&&region.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();

/****************************************************************
/****************************************************************
/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt  */ YAHOO.util.CustomEvent=function(_1,_2,_3){this.type=_1;this.scope=_2||window;this.silent=_3;this.subscribers=[];if(YAHOO.util.Event){YAHOO.util.Event.regCE(this);}if(!this.silent){}};YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_5,_6){this.subscribers.push(new YAHOO.util.Subscriber(fn,_5,_6));},unsubscribe:function(fn,_7){var _8=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,_7)){this._delete(i);_8=true;}}return _8;},fire:function(){var len=this.subscribers.length;var _12=[];for(var i=0;i<arguments.length;++i){_12.push(arguments[i]);}if(!this.silent){}for(i=0;i<len;++i){var s=this.subscribers[i];if(s){if(!this.silent){}var _13=(s.override)?s.obj:this.scope;s.fn.call(_13,this.type,_12,s.obj);}}},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(i);}},_delete:function(_14){var s=this.subscribers[_14];if(s){delete s.fn;delete s.obj;}delete this.subscribers[_14];},toString:function(){return "CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,_16){this.fn=fn;this.obj=obj||null;this.override=(_16);};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){return (this.fn==fn&&this.obj==obj);};YAHOO.util.Subscriber.prototype.toString=function(){return "Subscriber { obj: "+(this.obj||"")+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var _17=false;var _18=[];var _19=[];var _20=[];var _21=[];var _22=[];var _23=[];var _24=0;var _25=[];var _26=[];var _27=0;return {POLL_RETRYS:200,POLL_INTERVAL:50,EL:0,TYPE:1,FN:2,WFN:3,SCOPE:3,ADJ_SCOPE:4,isSafari:(/Safari|Konqueror|KHTML/gi).test(navigator.userAgent),isIE:(!this.isSafari&&!navigator.userAgent.match(/opera/gi)&&navigator.userAgent.match(/msie/gi)),addDelayedListener:function(el,_29,fn,_30,_31){_19[_19.length]=[el,_29,fn,_30,_31];if(_17){_24=this.POLL_RETRYS;this.startTimeout(0);}},startTimeout:function(_32){var i=(_32||_32===0)?_32:this.POLL_INTERVAL;var _33=this;var _34=function(){_33._tryPreloadAttach();};this.timeout=setTimeout(_34,i);},onAvailable:function(_35,_36,_37,_38){_25.push({id:_35,fn:_36,obj:_37,override:_38});_24=this.POLL_RETRYS;this.startTimeout(0);},addListener:function(el,_39,fn,_40,_41){if(!fn||!fn.call){return false;}if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=(this.on(el[i],_39,fn,_40,_41)&&ok);}return ok;}else{if(typeof el=="string"){var oEl=this.getEl(el);if(_17&&oEl){el=oEl;}else{this.addDelayedListener(el,_39,fn,_40,_41);return true;}}}if(!el){return false;}if("unload"==_39&&_40!==this){_20[_20.length]=[el,_39,fn,_40,_41];return true;}var _44=(_41)?_40:el;var _45=function(e){return fn.call(_44,YAHOO.util.Event.getEvent(e),_40);};var li=[el,_39,fn,_45,_44];var _48=_18.length;_18[_48]=li;if(this.useLegacyEvent(el,_39)){var _49=this.getLegacyIndex(el,_39);if(_49==-1){_49=_22.length;_26[el.id+_39]=_49;_22[_49]=[el,_39,el["on"+_39]];_23[_49]=[];el["on"+_39]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),_49);};}_23[_49].push(_48);}else{if(el.addEventListener){el.addEventListener(_39,_45,false);}else{if(el.attachEvent){el.attachEvent("on"+_39,_45);}}}return true;},fireLegacyEvent:function(e,_50){var ok=true;var le=_23[_50];for(var i=0,len=le.length;i<len;++i){var _52=le[i];if(_52){var li=_18[_52];if(li&&li[this.WFN]){var _53=li[this.ADJ_SCOPE];var ret=li[this.WFN].call(_53,e);ok=(ok&&ret);}else{delete le[i];}}}return ok;},getLegacyIndex:function(el,_55){var key=this.generateId(el)+_55;if(typeof _26[key]=="undefined"){return -1;}else{return _26[key];}},useLegacyEvent:function(el,_57){if(!el.addEventListener&&!el.attachEvent){return true;}else{if(this.isSafari){if("click"==_57||"dblclick"==_57){return true;}}}return false;},removeListener:function(el,_58,fn,_59){if(!fn||!fn.call){return false;}if(typeof el=="string"){el=this.getEl(el);}else{if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],_58,fn)&&ok);}return ok;}}if("unload"==_58){for(i=0,len=_20.length;i<len;i++){var li=_20[i];if(li&&li[0]==el&&li[1]==_58&&li[2]==fn){delete _20[i];return true;}}return false;}var _60=null;if("undefined"==typeof _59){_59=this._getCacheIndex(el,_58,fn);}if(_59>=0){_60=_18[_59];}if(!el||!_60){return false;}if(el.removeEventListener){el.removeEventListener(_58,_60[this.WFN],false);}else{if(el.detachEvent){el.detachEvent("on"+_58,_60[this.WFN]);}}delete _18[_59][this.WFN];delete _18[_59][this.FN];delete _18[_59];return true;},getTarget:function(ev,_62){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(_64){if(_64&&_64.nodeName&&"#TEXT"==_64.nodeName.toUpperCase()){return _64.parentNode;}else{return _64;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}}return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}}return y;},getXY:function(ev){return [this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else{if(ev.type=="mouseover"){t=ev.fromElement;}}}return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(e){return t;}}return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;}c=c.caller;}}return ev;},getCharCode:function(ev){return ev.charCode||((ev.type=="keypress")?ev.keyCode:0);},_getCacheIndex:function(el,_68,fn){for(var i=0,len=_18.length;i<len;++i){var li=_18[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==_68){return i;}}return -1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+_27;++_27;el.id=id;}return id;},_isValidCollection:function(o){return (o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},regCE:function(ce){_21.push(ce);},_load:function(e){_17=true;},_tryPreloadAttach:function(){if(this.locked){return false;}this.locked=true;var _72=!_17;if(!_72){_72=(_24>0);}var _73=[];for(var i=0,len=_19.length;i<len;++i){var d=_19[i];if(d){var el=this.getEl(d[this.EL]);if(el){this.on(el,d[this.TYPE],d[this.FN],d[this.SCOPE],d[this.ADJ_SCOPE]);delete _19[i];}else{_73.push(d);}}}_19=_73;var _75=[];for(i=0,len=_25.length;i<len;++i){var _76=_25[i];if(_76){el=this.getEl(_76.id);if(el){var _77=(_76.override)?_76.obj:el;_76.fn.call(_77,_76.obj);delete _25[i];}else{_75.push(_76);}}}_24=(_73.length===0&&_75.length===0)?0:_24-1;if(_72){this.startTimeout();}this.locked=false;return true;},purgeElement:function(el,_78,_79){var _80=this.getListeners(el,_79);if(_80){for(var i=0,len=_80.length;i<len;++i){var l=_80[i];this.removeListener(el,l.type,l.fn,l.index);}}if(_78&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],_78,_79);}}},getListeners:function(el,_82){var _83=[];if(_18&&_18.length>0){for(var i=0,len=_18.length;i<len;++i){var l=_18[i];if(l&&l[this.EL]===el&&(!_82||_82===l[this.TYPE])){_83.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.SCOPE],adjust:l[this.ADJ_SCOPE],index:i});}}}return (_83.length)?_83:null;},_unload:function(e,me){for(var i=0,len=_20.length;i<len;++i){var l=_20[i];if(l){var _85=(l[this.ADJ_SCOPE])?l[this.SCOPE]:window;l[this.FN].call(_85,this.getEvent(e),l[this.SCOPE]);}}if(_18&&_18.length>0){for(i=0,len=_18.length;i<len;++i){l=_18[i];if(l){this.removeListener(l[this.EL],l[this.TYPE],l[this.FN],i);}}this.clearCache();}for(i=0,len=_21.length;i<len;++i){_21[i].unsubscribeAll();delete _21[i];}for(i=0,len=_22.length;i<len;++i){delete _22[i][0];delete _22[i];}},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement;db=document.body;if(dd&&dd.scrollTop){return [dd.scrollTop,dd.scrollLeft];}else{if(db){return [db.scrollTop,db.scrollLeft];}else{return [0,0];}}}};}();YAHOO.util.Event.on=YAHOO.util.Event.addListener;if(document&&document.body){YAHOO.util.Event._load();}else{YAHOO.util.Event.on(window,"load",YAHOO.util.Event._load,YAHOO.util.Event,true);}YAHOO.util.Event.on(window,"unload",YAHOO.util.Event._unload,YAHOO.util.Event,true);YAHOO.util.Event._tryPreloadAttach();}

/****************************************************************
/****************************************************************
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
*/
YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_header:{},_has_http_headers:false,_default_post_header:true,_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:[],_timeOut:[],_polling_interval:50,_transaction_id:0,setProgId:function(id)
{this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b)
{this._default_post_header=b;},setPollingInterval:function(i)
{if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId)
{var obj,http;try
{http=new XMLHttpRequest();obj={conn:http,tId:transactionId};}
catch(e)
{for(var i=0;i<this._msxml_progid.length;++i){try
{http=new ActiveXObject(this._msxml_progid[i]);obj={conn:http,tId:transactionId};break;}
catch(e){}}}
finally
{return obj;}},getConnectionObject:function()
{var o;var tId=this._transaction_id;try
{o=this.createXhrObject(tId);if(o){this._transaction_id++;}}
catch(e){}
finally
{return o;}},asyncRequest:function(method,uri,callback,postData)
{var o=this.getConnectionObject();if(!o){return null;}
else{if(this._isFormSubmit){if(this._isFileUpload){this.uploadFile(o.tId,callback,uri);this.releaseObject(o);return;}
if(method=='GET'){uri+="?"+this._sFormData;}
else if(method=='POST'){postData=this._sFormData;}
this._sFormData='';}
o.conn.open(method,uri,true);if(this._isFormSubmit||(postData&&this._default_post_header)){this.initHeader('Content-Type','application/x-www-form-urlencoded');if(this._isFormSubmit){this._isFormSubmit=false;}}
if(this._has_http_headers){this.setHeader(o);}
this.handleReadyState(o,callback);postData?o.conn.send(postData):o.conn.send(null);return o;}},handleReadyState:function(o,callback)
{var timeOut=callback.timeout;var oConn=this;try
{if(timeOut!==undefined){this._timeOut[o.tId]=window.setTimeout(function(){oConn.abort(o,callback,true)},timeOut);}
this._poll[o.tId]=window.setInterval(function(){if(o.conn&&o.conn.readyState==4){window.clearInterval(oConn._poll[o.tId]);oConn._poll.splice(o.tId);if(timeOut){oConn._timeOut.splice(o.tId);}
oConn.handleTransactionResponse(o,callback);}},this._polling_interval);}
catch(e)
{window.clearInterval(oConn._poll[o.tId]);oConn._poll.splice(o.tId);if(timeOut){oConn._timeOut.splice(o.tId);}
oConn.handleTransactionResponse(o,callback);}},handleTransactionResponse:function(o,callback,isAbort)
{if(!callback){this.releaseObject(o);return;}
var httpStatus,responseObject;try
{if(o.conn.status!==undefined&&o.conn.status!=0){httpStatus=o.conn.status;}
else{httpStatus=13030;}}
catch(e){httpStatus=13030;}
if(httpStatus>=200&&httpStatus<300){responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);}
else{callback.success.apply(callback.scope,[responseObject]);}}}
else{switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,isAbort);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}
break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);}
else{callback.failure.apply(callback.scope,[responseObject]);}}}}
this.releaseObject(o);},createResponseObject:function(o,callbackArg)
{var obj={};var headerObj={};try
{var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i<header.length;i++){var delimitPos=header[i].indexOf(':');if(delimitPos!=-1){headerObj[header[i].substring(0,delimitPos)]=header[i].substring(delimitPos+2);}}}
catch(e){}
obj.tId=o.tId;obj.status=o.conn.status;obj.statusText=o.conn.statusText;obj.getResponseHeader=headerObj;obj.getAllResponseHeaders=headerStr;obj.responseText=o.conn.responseText;obj.responseXML=o.conn.responseXML;if(typeof callbackArg!==undefined){obj.argument=callbackArg;}
return obj;},createExceptionObject:function(tId,callbackArg,isAbort)
{var COMM_CODE=0;var COMM_ERROR='communication failure';var ABORT_CODE=-1;var ABORT_ERROR='transaction aborted';var obj={};obj.tId=tId;if(isAbort){obj.status=ABORT_CODE;obj.statusText=ABORT_ERROR;}
else{obj.status=COMM_CODE;obj.statusText=COMM_ERROR;}
if(callbackArg){obj.argument=callbackArg;}
return obj;},initHeader:function(label,value)
{if(this._http_header[label]===undefined){this._http_header[label]=value;}
else{this._http_header[label]=value+","+this._http_header[label];}
this._has_http_headers=true;},setHeader:function(o)
{for(var prop in this._http_header){if(this._http_header.propertyIsEnumerable){o.conn.setRequestHeader(prop,this._http_header[prop]);}}
delete this._http_header;this._http_header={};this._has_http_headers=false;},setForm:function(formId,isUpload,secureUri)
{this._sFormData='';if(typeof formId=='string'){var oForm=(document.getElementById(formId)||document.forms[formId]);}
else if(typeof formId=='object'){var oForm=formId;}
else{return;}
if(isUpload){(typeof secureUri=='string')?this.createFrame(secureUri):this.createFrame();this._isFormSubmit=true;this._isFileUpload=true;this._formNode=oForm;return;}
var oElement,oName,oValue,oDisabled;var hasSubmit=false;for(var i=0;i<oForm.elements.length;i++){oDisabled=oForm.elements[i].disabled;oElement=oForm.elements[i];oName=oForm.elements[i].name;oValue=oForm.elements[i].value;if(!oDisabled&&oName)
{switch(oElement.type)
{case'select-one':case'select-multiple':for(var j=0;j<oElement.options.length;j++){if(oElement.options[j].selected){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oElement.options[j].value||oElement.options[j].text)+'&';}}
break;case'radio':case'checkbox':if(oElement.checked){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';}
break;case'file':case undefined:case'reset':case'button':break;case'submit':if(hasSubmit==false){this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';hasSubmit=true;}
break;default:this._sFormData+=encodeURIComponent(oName)+'='+encodeURIComponent(oValue)+'&';break;}}}
this._isFormSubmit=true;this._sFormData=this._sFormData.substr(0,this._sFormData.length-1);},createFrame:function(secureUri){if(window.ActiveXObject){var io=document.createElement('<IFRAME name="ioFrame" id="ioFrame">');if(secureUri){io.src=secureUri;}}
else{var io=document.createElement('IFRAME');io.id='ioFrame';io.name='ioFrame';}
io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},uploadFile:function(id,callback,uri){this._formNode.action=uri;this._formNode.enctype='multipart/form-data';this._formNode.method='POST';this._formNode.target='ioFrame';this._formNode.submit();this._formNode=null;this._isFileUpload=false;this._isFormSubmit=false;var uploadCallback=function()
{var oResponse={tId:id,responseText:document.getElementById("ioFrame").contentWindow.document.body.innerHTML,argument:callback.argument}
if(callback.upload){if(!callback.scope){callback.upload(oResponse);}
else{callback.upload.apply(callback.scope,[oResponse]);}}
YAHOO.util.Event.removeListener("ioFrame","load",uploadCallback);window.ioFrame.location.replace('#');setTimeout("document.body.removeChild(document.getElementById('ioFrame'))",100);};YAHOO.util.Event.addListener("ioFrame","load",uploadCallback);},abort:function(o,callback,isTimeout)
{if(this.isCallInProgress(o)){window.clearInterval(this._poll[o.tId]);this._poll.splice(o.tId);if(isTimeout){this._timeOut.splice(o.tId);}
o.conn.abort();this.handleTransactionResponse(o,callback,true);return true;}
else{return false;}},isCallInProgress:function(o)
{if(o.conn){return o.conn.readyState!=4&&o.conn.readyState!=0;}
else{return false;}},releaseObject:function(o)
{o.conn=null;o=null;}};

/****************************************************************
/****************************************************************
// Copyright © 2006 Yahoo! Inc. All rights reserved.

var yactionsDomain = 'sm.feeds.yahoo.com';
var yactionsSrcJS  = 'http://'+ yactionsDomain +'/Buttons/V2.0/yactions_core1.3.3.js';
var yactionsSrcCSS = 'http://'+ yactionsDomain +'/Buttons/V2.0/yactions_core1.3.3.css';
var yBaseSrcPath   = 'http://us.js2.yimg.com/us.js.yimg.com/lib/common/utils/';
var yPositionSrc   = yBaseSrcPath + 'position_1.1.0.js';
var yEventSrc      = yBaseSrcPath + 'event_0.10.1.js';
var yAnimationSrc  = yBaseSrcPath + 'animation_1.1.0.js';

document.write( '<style type="text/css">@import url('+ yactionsSrcCSS  +');</style>'  );
document.write( '<script type="text/javascript" src="' + yPositionSrc   +'"></script>' );
document.write( '<script type="text/javascript" src="' + yEventSrc      +'"></script>' );
document.write( '<script type="text/javascript" src="' + yAnimationSrc  +'"></script>' );
document.write( '<script type="text/javascript" src="' + yactionsSrcJS +'"></script>' );/****************************************************************
/****************************************************************
Class: BuyDialog
Purpose: Class for handling the construction, positioning, 
	and behavior of the dialog for enabling users to purchase
	tracks and/or albums from Album pages and similar pages.
Requires:
	Latest version of YUI YAHOO (namespace) JS file.
	Latest version of YUI DOM JS file.
	Latest version of YUI Event JS file.
	Latest version of YUI Connect JS file.
****************************************************************/

// Declare namespace.
YAHOO.namespace('YAHOO.Music');

 
/****************************************************************
Method: constructor
Purpose: Create and initialize an instance of the object.
Notes: 
****************************************************************/
YAHOO.Music.BuyDialog = function BuyDialog(p_userSignedIn, p_userIsSubscriber, p_ymeInstalled, p_pageType)
{
	this.userSignedIn = p_userSignedIn;
	this.userIsSubscriber = p_userIsSubscriber;
	this.ymeInstalled = p_ymeInstalled;
	this.pageType = p_pageType;
	this.contentCode = (this.userIsSubscriber) ? 3 : 1;
	this.htmlBuilt = false;
};


/****************************************************************
Enum: ContentTypeEnum
Purpose: Defines constants for the Fill Content types.
Notes: To be used instead of numeric codes when calling 
	this.contentCode or this.fillContent().
****************************************************************/
YAHOO.Music.BuyDialog.prototype.ContentTypeEnum = 
{
	Custom: 0,
	NonSubscriber_BuySubscribeOptions: 1,
	NonSubscriber_BuyYmeNotInstalled: 2,
	Subscriber_BuyAddtoMyMusicOptions: 3,
	Subscriber_AddToMyMusicSuccess: 4,
	AddToMyMusicError: 5,
	Waiting: 6
};

/****************************************************************
Method: toString
Purpose: Returns the type name of the object.
Notes: Would probably be used only for debugging purposes.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.toString = function BuyDialog_toString()
{
	return "BuyDialog object";
};
	
/****************************************************************
Method: buildHTML
Purpose: Builds the HTML for the Buy dialog through the DOM.
Notes: Should only be done once per page. Expects to be styled 
	via CSS.
	Generally only used internally.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.buildHtml = function BuyDialog_buildHtml()
{
	if (this.htmlBuilt !== true)
	{
		var oDialog = document.createElement("div");
		if (oDialog)
		{
			oDialog.id = "divBuyDialog";
			oDialog.style.left = "-1000px";
			
			//Create Arrow Container div.
			var oArrowContainer = document.createElement("div");
			if (oArrowContainer)
			{
				oArrowContainer.id = "divBuyDialog_ArrowContainer";
				var oArrow = document.createElement("div");
				if (oArrow)
				{
					//Create Arrow div.
					oArrow.id = "divBuyDialog_Arrow";
					oArrowContainer.appendChild(oArrow);
					oArrow = null;
				}
				oDialog.appendChild(oArrowContainer);
				oArrowContainer = null;
			}
			
			//Create the container for everything besides the Arrow container.
			var oNotArrow = document.createElement("div");
			if (oNotArrow)
			{
				oNotArrow.id = "divBuyDialog_NotArrow";
				var oTopContainer = document.createElement("div");
				if (oTopContainer)
				{
					//Create the container div for the content as well as the right-side border.
					oTopContainer.id = "divBuyDialog_TopContainer";
					
					//Create the content container.
					var oContentContainer = document.createElement("div");
					if (oContentContainer) 
					{
						oContentContainer.id = "divBuyDialogContentContainer";
						//Create Close Box.
						var oCloseBox = document.createElement("div");
						if (oCloseBox)
						{
							oCloseBox.id = "divBuyDialogCloseBox";
							YAHOO.util.Event.addListener(oCloseBox, "click", this.closeDialog, this, true);
							oContentContainer.appendChild(oCloseBox);
							oCloseBox = null;
						}
						//Create content div.
						var oContent = document.createElement("div");
						if (oContent)
						{
							oContent.id = "divBuyDialogContent";
							oContentContainer.appendChild(oContent);
							oContent = null;
						}
						//Create the container for the OK button.
						var oOKContainer = document.createElement("div");
						if (oOKContainer)
						{
							oOKContainer.id = "divBuyDialogOkContainer";
							//Create the OK button div.
							var oOKButton = document.createElement("div");
							if (oOKButton)
							{
								oOKButton.id = "divBuyDialogOkButton";
								YAHOO.util.Event.addListener(oOKButton, "click", this.handleOkClick, this, true);
								//Create the a tag, and enclosed span tag, for the OK button.
								oOKButton.innerHTML = "<a href=\"#\" onclick=\"return false;\"><span>OK</span></a>";
								oOKContainer.appendChild(oOKButton);
								oOKButton = null;
							}
							//Create the YME button div.
							var oYmeButton = document.createElement("div");
							if (oYmeButton)
							{
								oYmeButton.id = "divBuyDialogYmeButton";
								YAHOO.util.Event.addListener(oYmeButton, "click", this.handleYmeClick, this, true);
								oYmeButton.innerHTML = "<a href=\"#\" onclick=\"return false;\"><span>Get the FREE Music Jukebox</span></a>";
								oOKContainer.appendChild(oYmeButton);
								oYmeButton = null;
							}
							//Create the Yes & No buttons div.
							var oYesNoButtonContainer = document.createElement("div");
							if (oYesNoButtonContainer)
							{
								oYesNoButtonContainer.id = "divBuyDialogYesNoButtonContainer";
								//Create Yes Button
								var oYesButton = document.createElement("div");
								if (oYesButton)
								{
									oYesButton.id = "divBuyDialogYesButton";
									YAHOO.util.Event.addListener(oYesButton, "click", this.handleYesClick, this, true);
									oYesButton.innerHTML = "<a href=\"#\" onclick=\"return false;\"><span>Yes</span></a>";
									oYesNoButtonContainer.appendChild(oYesButton);
									oYesButton = null;
								}
								//Create No Button
								var oNoButton = document.createElement("div");
								if (oNoButton)
								{
									oNoButton.id = "divBuyDialogNoButton";
									YAHOO.util.Event.addListener(oNoButton, "click", this.handleNoClick, this, true);
									oNoButton.innerHTML = "<a href=\"#\" onclick=\"return false;\"><span>No</span></a>";
									oYesNoButtonContainer.appendChild(oNoButton);
									oNoButton = null;
								}
								oOKContainer.appendChild(oYesNoButtonContainer);
								oYesNoButtonContainer = null;
							}
							oContentContainer.appendChild(oOKContainer);
							oOKContainer = null;							
						}
						oTopContainer.appendChild(oContentContainer);
						oContentContainer = null;
						
						//Create right-side border div.
						var oRightBorder = document.createElement("div");
						if (oRightBorder) 
						{
							oRightBorder.id = "divBuyDialog_bd_r";
							oTopContainer.appendChild(oRightBorder);
							oRightBorder = null;
						}						
					}			
					oNotArrow.appendChild(oTopContainer);
					oTopContainer = null;
					
					//Create the bottom border div.
					var oBottomBorder = document.createElement("div");
					if (oBottomBorder)
					{
						oBottomBorder.id = "divBuyDialog_bd_b";
						oNotArrow.appendChild(oBottomBorder);
						oBottomBorder = null;
					}	
					//Create the bottom-right corner div.
					var oBrCorner = document.createElement("div");
					if (oBrCorner)
					{
						oBrCorner.id = "divBuyDialog_cn_br";
						oNotArrow.appendChild(oBrCorner);
						oBrCorner = null;
					}
				}
				oDialog.appendChild(oNotArrow);
				oNotArrow = null;
			}
			
			
			//Append the dialog to the body.
			document.body.appendChild(oDialog);
			oDialog = null;
		}
		this.htmlBuilt = true;
	}
};
	
/****************************************************************
Method: showDialog
Purpose: Displays the dialog and positions it next to the button 
	that was pushed.
Notes: This is probably the only method that should need to be 
	called externally.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.showDialog = function BuyDialog_showDialog(p_oSourceElm, p_sContentType, p_sContentID, p_sEvtCode, p_nPrice)
{
	//Verify that a valid source element reference was passed.
	if (!p_oSourceElm || !p_sContentType || !p_sContentID)
	{
		throw new Error("Missing parameter.");
		return false;
	}
	
	//Set some object properties based on the parameters passed in.
	this.sourceElement = p_oSourceElm;
	this.contentType = p_sContentType;
	this.contentID = p_sContentID;
	this.evtCode = p_sEvtCode;
	this.price = (p_nPrice) ? Number(p_nPrice) : 0;
	this.contentCode = (this.userIsSubscriber) ? this.ContentTypeEnum.Subscriber_BuyAddtoMyMusicOptions : this.ContentTypeEnum.NonSubscriber_BuySubscribeOptions;
	
	//Make sure the object is initialized.
	if (this.htmlBuilt !== true)
	{
		this.buildHtml();
	}
	
	//Set a few defaults.
	this.showOkButton(true);
	this.showYmeButton(false);
	this.showYesNoButtons(false);
	
	//Enter the appropriate content.
	this.fillContent(this.contentCode);
		
	p_oSourceElm = null;
	
	return false;
};

/****************************************************************
Method: getContentHeight
Purpose: Returns the height (in pixels) of the content div.
Notes: Generally only used internally.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.getContentHeight = function BuyDialog_getContentHeight()
{
	//Calculate height of content.
	var nMinHeight = 34; //Height of arrow image is 30px, plus a little more on either side.
	var nContentHeight = 100; //Default value.
	var oContent = document.getElementById("divBuyDialogContentContainer");
	if (oContent)
	{
		nContentHeight = (oContent.offsetHeight > nMinHeight) ? oContent.offsetHeight : nMinHeight;
	}
	oContent = null;
	
	return nContentHeight;
};

/****************************************************************
Method: adjustBorderSize
Purpose: Adjusts the height of the right-side border div to the 
	same height as the content div.
Notes: Generally only used internally.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.adjustBorderSize = function BuyDialog_adjustBorderSize(p_nContentHeight)
{
	//Adjust the height of the right-side border div so that it doesn't push down the height of the container.
	var oBorderRight = document.getElementById("divBuyDialog_bd_r");
	if (oBorderRight) {
		oBorderRight.style.height = p_nContentHeight + "px";
		oBorderRight = null;
	}
};

/****************************************************************
Method: setDialogPosition
Purpose: Sets the position of the dialog box.
Notes: Generally only used internally.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.setDialogPosition = function BuyDialog_setDialogPosition()
{
	var nContentHeight = this.getContentHeight();
	
	//Position dialog arrow to middle height.
	var nArrowTop = (nContentHeight - 30) / 2;
	var nArrowMiddle = nArrowTop + 13;
	var oArrow = document.getElementById("divBuyDialog_Arrow");
	if (oArrow)
	{
		oArrow.style.top = nArrowTop + "px";
	}
	oArrow = null;
	
	//Get position and dimensions of source element.
	var xy = YAHOO.util.Dom.getXY(this.sourceElement);
	var nWidth = this.sourceElement.offsetWidth;
	var nHeight = this.sourceElement.offsetHeight;
	var nButtonMiddle = nHeight / 2;
	
	var nOffsetX = 4; //distance from right edge of button where dialog will appear.
	var nOffsetY = nArrowMiddle; //distance from middle of source button to top of dialog.
	var x = xy[0] + nWidth - nOffsetX;
	var y = xy[1] + nButtonMiddle - nOffsetY;
	xy[0] = x;
	xy[1] = y;
	
	//Position the dialog according to the above calculations.
	var oDialog = document.getElementById("divBuyDialog");
	YAHOO.util.Dom.setXY(oDialog, xy);
	
	oDialog = null;
};

/****************************************************************
Method: closeDialog
Purpose: Close the dialog box.
Notes: It is important for proper functioning of the code in 
	showDialog which resizes the dialog that the dialog continue 
	to be rendered. So this code actually changes the coordinates
	of the dialog so that it is displayed off-screen.
	Could be used externally, but most often, will be used as the
	handler for the user clicking on a "close" box, which is
	connected internally, in the buildHtml method.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.closeDialog	= function BuyDialog_closeDialog()
{
	var oDialog = document.getElementById("divBuyDialog");
	oDialog.style.left = "-1000px";
	oDialog = null;
	//Reset a few values.
	this.contentCode = (this.userIsSubscriber) ? 3 : 1;
	this.showOkButton(true);
	this.showYmeButton(false);
};

/****************************************************************
Method: getSubscribeRedirect
Purpose: Gets the redirect string for subscribing to YMU for 
	the current page type.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.getSubscribeRedirect = function BuyDialog_getSubscribeRedirect()
{
	switch (this.pageType)
	{
		case "artistmain":
		{
			return "http://us.rd.yahoo.com/launch/ms/artistmain/ymusubscribe/evt=42117/*";
			break;
		}
		case "album":
		{
			return "http://us.rd.yahoo.com/launch/ms/artist/album/ymusubscribe/evt=42116/*";
			break;
		}
		case "song":
		{
			return "http://us.rd.yahoo.com/launch/ms/artist/song/ymusubscribe/evt=42119/*";
			break;
		}
		case "downloads":
		{
			return "http://us.rd.yahoo.com/launch/ms/artist/downloads/ymusubscribe/evt=42118/*";
			break;
		}
		case "searchresults":
		{
			return "http://us.rd.yahoo.com/launch/ms/searchresults/ymusubscribe/evt=42877/*";
			break;
		}
		default:
		{
			return "";
			break;
		}
	}
}
	
/****************************************************************
Method: handleOkClick
Purpose: Handle the user click of the "OK" button.
Note: This handler is connected to the click event in the 
	buildHtml method.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.handleOkClick = function BuyDialog_handleOkClick()
{

	switch (this.contentCode)
	{
		
		case this.ContentTypeEnum.NonSubscriber_BuySubscribeOptions: //User chose to buy album/track. User is not a subscriber.
		{
			var radioOptionSelected = this.getSelectedOption();
			if (radioOptionSelected == 1)
			{
				//Open YME.
				this.openYME();
				this.closeDialog();
			}
			else if (radioOptionSelected == 2)
			{
				var sRedirect = this.getSubscribeRedirect();
				window.location.href = sRedirect + window.srv + "/unlimited/";
			}
			break;
		}
		case this.ContentTypeEnum.NonSubscriber_BuyYmeNotInstalled: //The OK should not be showing with this code.
		{
			this.closeDialog();
			break;
		}
		case this.ContentTypeEnum.Subscriber_BuyAddtoMyMusicOptions:
		{		
			var radioOptionSelected = this.getSelectedOption();
			if (radioOptionSelected == 1)
			{
				//Add to My Music
				this.addBookmark();
			}
			else if (radioOptionSelected == 2)
			{
				this.closeDialog();
				this.openYME();
			}
			break;
		}
		/*
		case this.ContentTypeEnum.Subscriber_AddToMyMusicSuccess:
		{
			this.closeDialog();
			break;
		}
		case this.ContentTypeEnum.AddToMyMusicError:
		{
			this.closeDialog();
			break;
		}
		*/
		default:
		{
			this.closeDialog();
			break;
		}
	}
	return false;
};

/****************************************************************
Method: handleYmeClick
Purpose: Handles the user click of the "Get YME" button.
Note: This handler is connected to the click event in the 
	buildHtml method.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.handleYmeClick = function BuyDialog_handleYmeClick()
{
	window.location.href = window.srv + "/musicengine/";
};

/****************************************************************
Method: handleYesClick
Purpose: Handles the user click of the "Yes" button.
Note: This handler is connected to the click event in the 
	buildHtml method.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.handleYesClick = function BuyDialog_handleYesClick()
{
	//Open YME.
	this.openYME();	
	
	var nReturn = this.getCheckSelection();
	if (nReturn != 0)
	{
		//Set cookie not to prompt again.
		this.setPromptCookie();
	}
};

/****************************************************************
Method: handleNoClick
Purpose: Handles the user click of the "No" button.
Note: This handler is connected to the click event in the 
	buildHtml method.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.handleNoClick = function BuyDialog_handleNoClick()
{
	//Close dialog
	this.closeDialog();
	
	var nReturn = this.getCheckSelection();
	if (nReturn != 0)
	{
		//Set cookie not to prompt again.
		this.setPromptCookie();
	}
};

/****************************************************************
Method: getSelectedOption
Purpose: Determines which option button the user has selected.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.getSelectedOption = function BuyDialog_getSelectedOption()
{
	var nReturn = 0;
	var oForm = document.forms.BuyDialog_form;
	if (oForm)
	{	
		var oRadioOptions = oForm.BuyDialog_options;
		if (oRadioOptions)
		{
			if (oForm.BuyDialog_options.tagName && oForm.BuyDialog_options.tagName.toLowerCase() == "input") {
				return oForm.BuyDialog_options.checked;
			}
			else {
				for (var nI = 0, nL = (oRadioOptions.length) ? oRadioOptions.length : 1; nI < nL; nI++) {
					var oOption = oRadioOptions[nI]
					if (oOption.checked) 
					{
						nReturn = oOption.value;
						oOption = null;
						break;
					}
					oOption = null;
				}
			}
			oRadioOptions = null;
		}
		oForm = null;
	}
	
	return nReturn;
};

/****************************************************************
Method: getCheckSelection
Purpose: Determines whether or not the user has checked the 
	prompt checkbox.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.getCheckSelection = function BuyDialog_getCheckSelection()
{
	var nReturn = 0;
	var oChk = document.getElementById("BuyDialog_promptCheckbox");
	if (oChk)
	{
		nReturn = (oChk.selected);
		oChk = null;
	}
	
	return nReturn;
};

/****************************************************************
Method: setPromptCookie
Purpose: Sets a cookie which indicates that the user does not
	wish to be prompted to open YME when they have added a
	song/album to My Music.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.setPromptCookie = function BuyDialog_setPromptCookie()
{
	var dExp = new Date();
	//Set to expire one year from now.
	var expireTime = dExp.getTime() + (365 * 24 * 60 * 60 *1000);
	dExp.setTime(expireTime);
	
	document.cookie = "BD_promptYME=0;expires=" + dExp.toGMTString();
}

/****************************************************************
Method: getPromptCookie
Purpose: Retrieves the cookie which indicates whether or not the 
	user wishes to be prompted to open YME when they have added a
	song/album to My Music.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.getPromptCookie = function BuyDialog_getPromptCookie()
{	
	var sCookie = parseCookie("BD_promptYME");
	if (sCookie == "0")
	{
		return false;
	}
	else
	{
		return true;
	}
}

/****************************************************************
Method: fillContent
Purpose: Fill the dialog with the appropriate text, images, option
	buttons, etc.
Note: Generally only used internally.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.fillContent = function BuyDialog_fillContent(p_ContentCode, p_HtmlContent)
{
	var oContent = document.getElementById("divBuyDialogContent");
	if (oContent)
	{
		this.contentCode = p_ContentCode;
		if (this.contentCode > 0)
		{
			//Fill with the appropriate content.
			oContent.innerHTML = this.getContent();
		}
		else
		{
			oContent.innerHTML = p_HtmlContent;
		}
		oContent = null;
		var nContentHeight = this.getContentHeight();
		this.adjustBorderSize(nContentHeight);
		this.setDialogPosition();
	}
};
	
/****************************************************************
Method: getContent
Purpose: Returns the appropriate content to display in the content
	area of the dialog.
Notes: This seems unnecessary as a separate function. The functionality
	could possibly be rolled into fillContent.
	Generally only used internally.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.getContent = function BuyDialog_getContent()
{
	var sHTML = "";
	
	/************************************************************************************************************
	Content Codes:
		1 = Non-subscriber; buy album/track; option buttons to buy or subscribe
		2 = Non-subscriber; buy album/track; user chose option to buy, but does not have YME installed.
		3 = Subscriber; add album/track; option buttons to add to "My Music" or buy.
		4 = Subscriber; add album/track; user chose to add to "My Music"; "Yes" or "No" buttons to launch YME.
		5 = Error adding album/track to My Music.
		6 = Processing/Waiting
	************************************************************************************************************/
	
	var aHTML = new Array();
	
	switch (this.contentCode)
	{
		case this.ContentTypeEnum.NonSubscriber_BuySubscribeOptions:
		// Options for Non-Subscribers: Buy or Subscribe to YMU.
		{
			aHTML.push('<form id="BuyDialog_form">\n');
			aHTML.push('<div class="BuyDialog_radioOptionContainer" id="BuyDialog_radioOptionContainer_1">\n');
			aHTML.push('<input type="radio" name="BuyDialog_options" id="radBuyDialog_1" checked="checked" class="BuyDialog_radioButton" value="1"/>\n');
			aHTML.push('<div class="BuyDialog_radioLabel">\n');
			aHTML.push('<div class="BuyDialog_content_headline">Buy this ');
			aHTML.push((this.contentType == 'album') ? 'Album' : 'Song');
			if (this.price > 0)
			{
				aHTML.push(' for ');
				aHTML.push(this.getFormattedPrice());
			}
			aHTML.push('</div>\n');
			aHTML.push('<div class="BuyDialog_content_text">Purchase and download this ');
			aHTML.push((this.contentType == 'album') ? 'album' : 'song');
			if (this.price > 0)
			{
				aHTML.push(' for ');
				aHTML.push(this.getFormattedPrice());
			}
			aHTML.push(' using the FREE Yahoo! Music Jukebox.</div>\n');
			aHTML.push('</div>\n');
			aHTML.push('</div>\n');
			/*
			aHTML.push('<div class="BuyDialog_radioOptionContainer" id="BuyDialog_radioOptionContainer_2">\n');
			aHTML.push('<input type="radio" name="BuyDialog_options" id="radBuyDialog_2" class="BuyDialog_radioButton" value="2"/>\n');
			aHTML.push('<div class="BuyDialog_radioLabel">\n');			
			if (this.price > 0)
			{
			    aHTML.push('<div class="BuyDialog_content_headline">Tired of paying ');
				aHTML.push(this.getFormattedPrice());
			    aHTML.push((this.contentType == 'album') ? ' an album' : ' a song');
			    aHTML.push('?</div>\n');
			}
			else
			{
			    aHTML.push('<div class="BuyDialog_content_headline">Want a Better Deal?</div>\n');
			}
			aHTML.push('<div class="BuyDialog_content_text">Get this ');
			aHTML.push((this.contentType == 'album') ? 'album' : 'song');
			aHTML.push(' and over 2 million more');
			if (this.contentType == 'album')
			{
			    aHTML.push(' songs');
            }
			aHTML.push('. 6 bucks a month with Yahoo! Music Unlimited.</div>\n');
			aHTML.push('<div class="BuyDialog_content_headline">Try it FREE!</div>\n');
			aHTML.push('</div>\n');
			aHTML.push('</div>\n');
			aHTML.push('<div id="divLogInContainer" class="logInContainer">\n');
			aHTML.push('<div class="logInText">Already a Yahoo! Music Unlimited subscriber?</div>\n');
			aHTML.push('<div class="logInLink">\n');
			aHTML.push('<a href="#" onclick="document.location.href=\'http://us.rd.yahoo.com/launch/nav/yahoo/*http://login.yahoo.com/config/login?.src=launch&.done=\' + escape(parent.document.location.href); return false;">Sign In</a>\n');
			aHTML.push('</div>\n');
			*/
			aHTML.push('</div>\n');
			aHTML.push('</form>\n');
			
			sHTML = aHTML.join('');
			break;
		}
		case this.ContentTypeEnum.NonSubscriber_BuyYmeNotInstalled:
		// Prompt to install YME.
		{
			aHTML.push('<div class="BuyDialog_headerImage">\n');
			aHTML.push('<img src="http://us.music1.yimg.com/music.yahoo.com/common/resources/images/BuyDialog/logo_ymj.gif"/>\n');
			aHTML.push('</div>\n');
			aHTML.push('<div class="BuyDialog_content_text">You need to download and install the <span class="BuyDialog_content_text_strong">FREE Yahoo! Music Jukebox</span> to purchase and download albums and songs to your PC.</div>\n');
		
			sHTML = aHTML.join('');
			break;
		}
		case this.ContentTypeEnum.Subscriber_BuyAddtoMyMusicOptions:
		// Options for Subscribers: Add to My Music or Buy.
		{
			aHTML.push('<form id="BuyDialog_form">\n');
			aHTML.push('<div class="BuyDialog_radioOptionContainer" id="BuyDialog_radioOptionContainer_1">\n');
			aHTML.push('<input type="radio" name="BuyDialog_options" id="radBuyDialog_1" checked="checked" class="BuyDialog_radioButton" value="1"/>\n');
			aHTML.push('<div class="BuyDialog_radioLabel">\n');
			aHTML.push('<div class="BuyDialog_content_headline">ADD TO MY MUSIC</div>\n');
			aHTML.push('<div class="BuyDialog_content_text">Add this ');
			aHTML.push((this.contentType == 'album') ? 'album' : 'song');
			aHTML.push(' to My Music for FREE in Yahoo! Music Unlimited.</div>\n');
			aHTML.push('</div>\n');
			aHTML.push('</div>\n');
			aHTML.push('<div class="BuyDialog_radioOptionContainer" id="BuyDialog_radioOptionContainer_2">\n');
			aHTML.push('<input type="radio" name="BuyDialog_options" id="radBuyDialog_2" class="BuyDialog_radioButton" value="2"/>\n');
			aHTML.push('<div class="BuyDialog_radioLabel">\n');
			aHTML.push('<div class="BuyDialog_content_headline">BUY ');
			aHTML.push((this.contentType == 'album') ? 'ALBUM' : 'SONG');
			aHTML.push('</div>\n');
			aHTML.push('<div class="BuyDialog_content_text">Purchase and download this ');
			aHTML.push((this.contentType == 'album') ? 'album' : 'song');
			if (this.price > 0)
			{
				aHTML.push(' for $');
				aHTML.push(this.price);
			}
			aHTML.push(' with the FREE Yahoo! Music Jukebox.</div>\n');
			aHTML.push('</div>\n');
			aHTML.push('</div>\n');
			aHTML.push('</form>\n');
			
			sHTML = aHTML.join('');
			break;
		}
		case this.ContentTypeEnum.Subscriber_AddToMyMusicSuccess:
		// Successfully added album/track to My Music.
		{
			aHTML.push('<div class="BuyDialog_content_headline">MUSIC HAS BEEN ADDED TO MY MUSIC.</div>\n');
			var bShowYMEprompt = this.getPromptCookie();
			if (bShowYMEprompt === true && this.ymeInstalled === true)
			{
				aHTML.push('<div class="BuyDialog_content_text">Do you want to start up the Yahoo! Music Jukebox now?</div>\n');
				aHTML.push('<div class="BuyDialog_checkboxContainer" id="divBuyDialog_checkboxContainer">\n');
				aHTML.push('<input type="checkbox" id="BuyDialog_promptCheckbox"/>\n');
				aHTML.push('<div class="BuyDialog_checkbox_label">Don\'t ask again.</div>\n');
			}
			aHTML.push('</div>\n');
			
			sHTML = aHTML.join('');
			break;
		}
		case this.ContentTypeEnum.AddToMyMusicError:
		// Error adding album/track to My Music.
		{
			aHTML.push('<div class="BuyDialog_content_headline">We\'re Sorry.</div>\n');
			aHTML.push('<div class="BuyDialog_content_text">There was an error adding the selected ' + this.contentType + ' to My Music.</div>\n');
			aHTML.push('</div>\n');
			
			sHTML = aHTML.join('');
			break;
		}
		case this.ContentTypeEnum.Waiting:
		// Processing request.
		{
			aHTML.push('<div class="BuyDialog_waiting_container">');
			aHTML.push('<div class="BuyDialog_wait_text">Processing. Please wait...</div>');
			aHTML.push('<div class="BuyDialog_wait_image">');
			aHTML.push('<img src="http://us.music1.yimg.com/music.yahoo.com/common/resources/images/BuyDialog/progress_bar2.gif" height="10" width="136"/>');
			aHTML.push('</div>\n');
			aHTML.push('</div>\n');
			
			sHTML = aHTML.join('');
			break;
		}
	}
	
	return sHTML;
};


/****************************************************************
Method: showOkButton
Purpose: Displays or hides the "OK" button.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.showOkButton = function BuyDialog_showOkButton(p_bShow)
{
	var oOkButton = document.getElementById("divBuyDialogOkButton");
	if (oOkButton)
	{
		oOkButton.style.display = (p_bShow === true) ? "block" : "none";
		oOkButton = null;
	}
};

/****************************************************************
Method: showYmeButton
Purpose: Displays or hides the "Get Music Jukebox" button.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.showYmeButton = function BuyDialog_BuyDialog_showYmeButton(p_bShow)
{
	var oOkButton = document.getElementById("divBuyDialogYmeButton");
	if (oOkButton)
	{
		oOkButton.style.display = (p_bShow === true) ? "block" : "none";
		oOkButton = null;
	}
};

/****************************************************************
Method: showYesNoButton
Purpose: Displays or hides the "Yes" and "No" buttons.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.showYesNoButtons = function BuyDialog_showYesNoButtons(p_bShow)
{
	var oContainer = document.getElementById("divBuyDialogYesNoButtonContainer");
	if (oContainer)
	{
		oContainer.style.display = (p_bShow === true) ? "block" : "none";
		oContainer = null;
	}
};

YAHOO.Music.BuyDialog.prototype.getFormattedPrice = function BuyDialog_getFormattedPrice()
{
    var sPrice = String(this.price);
    var nIndex = sPrice.indexOf(".");
    if (nIndex == -1 || nIndex == (sPrice.length - 1))
    {
	    return "$" + sPrice + ".00";
    }
    else if (nIndex == (sPrice.length - 2))
    {
        if (this.price < 1)
        {
            return sPrice.substr(sPrice.length - 1, 1) + "0&#162;";
        }
        else
        {
	        return "$" + sPrice + "0";
	    }
    }
    else
    {
        if (this.price < 1)
        {
            return sPrice.substr(sPrice.length - 2, 2) + "&#162;";
        }
        else
        {
	        return "$" + sPrice;
	    }
    }
}

/****************************************************************
Method: addBookmark
Purpose: Calls a web service to add the selected song/album
	to My Music.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.addBookmark = function BuyDialog_addBookmark()
{
	var sURL = "";
	var bIsSearch = false;
	bIsSearch = (window.location.href.indexOf("search.") > -1) ? true : false;
	if (bIsSearch == true)
	{
		var server = (window.location.href.indexOf("stage.") > -1) ? "http://search.stage.music.yahoo.com" : ((window.location.href.indexOf("dev.") > -1) ? "http://search.dev.music.yahoo.com" : "http://search.music.yahoo.com");
		sURL = server + "/search/BuyDialog_ServiceProxy.php?resultFormat=text&";
	}
	else
	{
		sURL = "/common/includes/asp/BuyDialog_ServiceProxy.asp?resultFormat=text&"; //trackID=1996132";
	}
	if (this.contentType == "track")
	{
		sURL += "trackID=" + this.contentID;
	}
	else if (this.contentType == "album")
	{
		sURL += "albumID=" + this.contentID;
	}
	
	//Declare callback object.
	var cb = {
		success: this.handleSuccess,
		failure: this.handleFailure,
		scope: this
	};
	
	//Display "Please Wait" text.
	this.fillContent(this.ContentTypeEnum.Waiting);
	
	//Hide the OK button while the request is pending.
	this.showOkButton(false);
	
	//Make http request via Y! Connect object.
	var req = YAHOO.util.Connect.asyncRequest("GET", sURL, cb, null);
}

/****************************************************************
Method: handleSuccess
Purpose: Callback function which is executed when the web service
	in addBokmark is called successfully.
Note: Does not necessarily mean that the web service successfully
	added the song/album to My Music - only that the service was
	called without an error.  The service's return value indicates
	whether or not the song/album was successfully added.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.handleSuccess = function BuyDialog_handleSuccess(p_oResponse)
{
	try
	{
		//Check the return value.
		
		/*
		//XML Method - fails on Firefox due to cross-domain scripting issues.
		var xDoc = p_oResponse.responseXML;
		var nd = xDoc.selectSingleNode("/launchWebService/returnCode");
		var sReturnValue = nd.getAttribute("value");
		*/
		
		//Text method. Cross-browser safe.
		var sResponse = p_oResponse.responseText;
		//Parse response text to determine return code.
		var nStart = 0;
		var nEnd = sResponse.indexOf('|');
		var sReturnValue = sResponse.substr(0, nEnd - nStart);
		nStart = nEnd + 1;
		nEnd = sResponse.length;
		var sErrorText = sResponse.substr(nStart,  nEnd - nStart);
		if (sReturnValue == '0')
		{
			// The web service returned success.
						
			this.fillContent(this.ContentTypeEnum.Subscriber_AddToMyMusicSuccess);
			var bShowYMEprompt = this.getPromptCookie();
			if (bShowYMEprompt === true && this.ymeInstalled === true)
			{
				//Show the Yes & No buttons
				this.showYesNoButtons(true);
			}
			else
			{
				//Show the OK button.
				this.showOkButton(true);
			}
		}
		else
		{
			//The web service indicated failure.
			
			//Display failure message.
			var aHtml = new Array();
			aHtml.push('<div class="">Sorry, there was an error trying to add to My Music:</div>');
			aHtml.push('<div class="BuyDialog_errorText">');
			aHtml.push(sReturnValue);
			aHtml.push(' - ');
			aHtml.push(sErrorText);
			aHtml.push('</div>');;
			aHtml.push('</div>');
			this.fillContent(this.ContentTypeEnum.Custom, aHtml.join(''));
			//Show the OK button.
			this.showOkButton(true);
		}
	}
	catch (ex)
	{
		//There was an error trying to determine the return code, or trying to display the results.
		
		//Show the OK button.
		this.showOkButton(true);
		
		//Display the Failure message to the user.
		var aHtml = new Array();
		aHtml.push('<div class="">Sorry, there was an error trying to add to My Music:</div>');
		aHtml.push('<div class="BuyDialog_errorText">');
		if (ex.message)
		{
			aHtml.push(ex.message);
		}
		else
		{
			aHtml.push(ex);
		}
		aHtml.push('</div>');;
		aHtml.push('</div>');
		var sHtml = aHtml.join('');
		this.fillContent(this.ContentTypeEnum.Custom, sHtml);		
	}
}

/****************************************************************
Method: handleFailure
Purpose: Callback function which is executed when the web service
	in addBokmark encounters an error.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.handleFailure = function BuyDialog_handleFailure(p_oResponse)
{
	//TODO: Parse error code and display.
	
	//Show the OK button.
	this.showOkButton(true);
	
	//Display the Failure message to the user.
	this.fillContent(this.ContentTypeEnum.AddToMyMusicError);
}

/****************************************************************
Method: openYME
Purpose: Opens YME to the appropriate song/album.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.openYME = function BuyDialog_openYME()
{
	//Open YME to song/album page.
	var sURL = "http://us.rd.yahoo.com/evt="
		+ this.evtCode
		+ "/*" 
		+ window.srv 
		+ "/artist/singledownload/?" 
		+ ((this.contentType == "album") ? "albumid" : "songid") 
		+ "=" 
		+ this.contentID 
		+ "&dest="
		+ window.srv
		+ "/"
		+ ((this.contentType == "album") ? "release" : "track")
		+ "/"
		+ this.contentID
		+ "&hasYME=" 
		+ ((this.ymeInstalled == true) ? "1" : "0");
	window.location.href = sURL;
}


/****************************************************************
Method: cleanUp
Purpose: Release any resources being used by the object.
Notes: Should be called externally prior to unloading the page.
****************************************************************/
YAHOO.Music.BuyDialog.prototype.cleanUp = function BuyDialog_cleanUp()
{
	this.sourceElement = null;
};


/****************************************************************
Method: parseCookie
Purpose: Generic function to retrieve a named cookie value.
****************************************************************/
function parseCookie(p_cookieName)
{
	var sAllCookies = document.cookie;
	var iStart = sAllCookies.indexOf(p_cookieName + "=");
	if (iStart > -1)
	{
		iStart += p_cookieName.length + 1;
		var iEnd = sAllCookies.indexOf(";", iStart);
		if (iEnd > iStart)
		{
			return sAllCookies.substr(iStart, iEnd - iStart);
		}
	}
}