/*MooTools, My Object Oriented Javascript Tools. Copyright (c) 2006-2007 Valerio Proietti, <http://mad4milk.net>, MIT Style License.||Clientcide Copyright (c) 2006-2008, http://www.clientcide.com/wiki/cnet-libraries#license*/

var Clientcide={version:'805',setAssetLocation:function(baseHref){if(window.StickyWin&&StickyWin.ui){StickyWin.UI.refactor({options:{baseHref:baseHref+'/stickyWinHTML/'}});if(StickyWin.alert){var CGFsimpleErrorPopup=StickyWin.alert.bind(window);StickyWin.alert=function(msghdr,msg,base){return CGFsimpleErrorPopup(msghdr,msg,base||baseHref+"/simple.error.popup")}}}if(window.TagMaker){TagMaker=TagMaker.refactor({options:{baseHref:baseHref+'/tips/'}})}if(window.ProductPicker){ProductPicker.refactor({options:{baseHref:baseHref+'/Picker'}})}if(window.Autocompleter){var AcClientcide={options:{baseHref:baseHref+'/autocompleter/'}};Autocompleter.Base.refactor(AcClientcide);if(Autocompleter.Ajax){["Base","Xhtml","Json"].each(function(c){if(Autocompleter.Ajax[c])Autocompleter.Ajax[c].refactor(AcClientcide)})}if(Autocompleter.Local)Autocompleter.Local.refactor(AcClientcide);if(Autocompleter.JsonP)Autocompleter.JsonP.refactor(AcClientcide)}if(window.Lightbox){Lightbox.refactor({options:{assetBaseUrl:baseHref+'/slimbox/'}})}if(window.Waiter){Waiter.refactor({options:{baseHref:baseHref+'/waiter/'}})}},preLoadCss:function(){if(window.DatePicker)new DatePicker();if(window.ProductPicker)new ProductPicker();if(window.TagMaker)new TagMaker();if(window.StickyWin&&StickyWin.ui)StickyWin.ui();if(window.StickyWin&&StickyWin.pointy)StickyWin.pointy();Clientcide.preloaded=true;return true},preloaded:false};(function(){if(!window.addEvent)return;var preload=function(){if(window.dbug)dbug.log('preloading clientcide css');if(!Clientcide.preloaded)Clientcide.preLoadCss()};window.addEvent('domready',preload);window.addEvent('load',preload)})();setCNETAssetBaseHref=Clientcide.setAssetLocation;var dbug={logged:[],timers:{},firebug:false,enabled:false,log:function(){dbug.logged.push(arguments)},nolog:function(msg){dbug.logged.push(arguments)},time:function(name){dbug.timers[name]=new Date().getTime()},timeEnd:function(name){if(dbug.timers[name]){var end=new Date().getTime()-dbug.timers[name];dbug.timers[name]=false;dbug.log('%s: %s',name,end)}else dbug.log('no such timer: %s',name)},enable:function(silent){var con=window.firebug?firebug.d.console.cmd:window.console;if((!!window.console&&!!window.console.warn)||window.firebug){try{dbug.enabled=true;dbug.log=function(){(con.debug||con.log).apply(con,arguments)};dbug.time=function(){con.time.apply(con,arguments)};dbug.timeEnd=function(){con.timeEnd.apply(con,arguments)};if(!silent)dbug.log('enabling dbug');for(var i=0;i<dbug.logged.length;i++){dbug.log.apply(con,dbug.logged[i])}dbug.logged=[]}catch(e){dbug.enable.delay(400)}}},disable:function(){if(dbug.firebug)dbug.enabled=false;dbug.log=dbug.nolog;dbug.time=function(){};dbug.timeEnd=function(){}},cookie:function(set){var value=document.cookie.match('(?:^|;)\\s*jsdebug=([^;]*)');var debugCookie=value?unescape(value[1]):false;if((!$defined(set)&&debugCookie!='true')||($defined(set)&&set)){dbug.enable();dbug.log('setting debugging cookie');var date=new Date();date.setTime(date.getTime()+(24*60*60*1000));document.cookie='jsdebug=true;expires='+date.toGMTString()+';path=/;'}else dbug.disableCookie()},disableCookie:function(){dbug.log('disabling debugging cookie');document.cookie='jsdebug=false;path=/;'}};(function(){var fb=!!window.console||!!window.firebug;var con=window.firebug?window.firebug.d.console.cmd:window.console;var debugMethods=['debug','info','warn','error','assert','dir','dirxml'];var otherMethods=['trace','group','groupEnd','profile','profileEnd','count'];function set(methodList,defaultFunction){for(var i=0;i<methodList.length;i++){dbug[methodList[i]]=(fb&&con[methodList[i]])?con[methodList[i]]:defaultFunction}};set(debugMethods,dbug.log);set(otherMethods,function(){})})();if((!!window.console&&!!window.console.warn)||window.firebug){dbug.firebug=true;var value=document.cookie.match('(?:^|;)\\s*jsdebug=([^;]*)');var debugCookie=value?unescape(value[1]):false;if(window.location.href.indexOf("jsdebug=true")>0||debugCookie=='true')dbug.enable();if(debugCookie=='true')dbug.log('debugging cookie enabled');if(window.location.href.indexOf("jsdebugCookie=true")>0){dbug.cookie();if(!dbug.enabled)dbug.enable()}if(window.location.href.indexOf("jsdebugCookie=false")>0)dbug.disableCookie()}var Occlude=new Class({occlude:function(property,element){element=$(element||this.element);var instance=element.retrieve(property||this.property);if(instance&&(this.occluded===null||this.occluded)){this.occluded=instance}else{this.occluded=false;element.store(property||this.property,this)}return this.occluded||false}});var ToElement=new Class({toElement:function(){return this.element}});var IframeShim=new Class({Implements:[Options,Events,Occlude,ToElement],options:{className:'iframeShim',display:false,zindex:null,margin:0,offset:{x:0,y:0},browsers:(Browser.Engine.trident4||(Browser.Engine.gecko&&!Browser.Engine.gecko19&&Browser.Platform.mac))},property:'IframeShim',initialize:function(element,options){this.element=$(element);if(this.occlude())return this.occluded;this.setOptions(options);this.makeShim();return},makeShim:function(){this.shim=new Element('iframe').store('IframeShim',this);if(!this.options.browsers)return;var pos=this.element.getStyle('position');if(pos=="static"||!pos)this.element.setStyle('position','relative');if(this.element.getStyle('z-Index').toInt()<1||isNaN(this.element.getStyle('z-Index').toInt()))this.element.setStyle('z-Index',5);var z=this.element.getStyle('z-Index')-1;if($chk(this.options.zindex)&&this.element.getStyle('z-Index').toInt()>this.options.zindex)z=this.options.zindex;this.shim.set({src:(window.location.protocol=='https')?'://0':'javascript:void(0)',frameborder:'0',scrolling:'no',styles:{position:'absolute',zIndex:z,border:'none',filter:'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'},'class':this.options.className});var inject=function(){this.shim.inject(this.element,'after');if(this.options.display)this.show();else this.hide();this.fireEvent('onInject')};if(Browser.Engine.trident&&!IframeShim.ready)window.addEvent('load',inject.bind(this));else inject.run(null,this)},position:function(shim){if(!this.options.browsers||!IframeShim.ready)return this;var size=this.element.measure(function(){return this.getSize()});if($type(this.options.margin)){size.x=size.x-(this.options.margin*2);size.y=size.y-(this.options.margin*2);this.options.offset.x+=this.options.margin;this.options.offset.y+=this.options.margin}this.shim.set({'width':size.x,'height':size.y}).setPosition({relativeTo:this.element,offset:this.options.offset});return this},hide:function(){if(this.options.browsers)this.shim.hide();return this},show:function(){if(!this.options.browsers)return this;this.shim.show();return this.position()},dispose:function(){if(this.options.browsers)this.shim.dispose();return this}});window.addEvent('load',function(){IframeShim.ready=true});Hash.implement({getFromPath:function(notation){var source=this.getClean();notation.replace(/\[([^\]]+)\]|\.([^.[]+)|[^[.]+/g,function(match){if(!source)return;var prop=arguments[2]||arguments[1]||arguments[0];source=(prop in source)?source[prop]:null;return match});return source},cleanValues:function(method){method=method||$defined;this.each(function(v,k){if(!method(v))this.erase(k)},this);return this},run:function(){var args=$arguments;this.each(function(v,k){if($type(v)=="function")v.run(args)})}});String.implement({stripTags:function(){return this.replace(/<\/?[^>]+>/gi,'')},parseQuery:function(encodeKeys,encodeValues){encodeKeys=$pick(encodeKeys,true);encodeValues=$pick(encodeValues,true);var vars=this.split(/[&;]/);var rs={};if(vars.length)vars.each(function(val){var keys=val.split('=');if(keys.length&&keys.length==2){rs[(encodeKeys)?encodeURIComponent(keys[0]):keys[0]]=(encodeValues)?encodeURIComponent(keys[1]):keys[1]}});return rs},tidy:function(){var txt=this.toString();$each({"[\xa0\u2002\u2003\u2009]":" ","\xb7":"*","[\u2018\u2019]":"'","[\u201c\u201d]":'"',"\u2026":"...","\u2013":"-","\u2014":"--","\uFFFD":"&raquo;"},function(value,key){txt=txt.replace(new RegExp(key,'g'),value)});return txt},cleanQueryString:function(method){return this.split("&").filter(method||function(set){return $chk(set.split("=")[1])}).join("&")},findAllEmails:function(){return this.match(new RegExp("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?","gi"))||[]}});Element.implement({measure:function(fn){var restore=this.expose();var result=fn.apply(this);restore();return result},expose:function(){if(this.getStyle('display')!='none')return $empty;var before={};var styles={visibility:'hidden',display:'block',position:'absolute'};$each(styles,function(value,style){before[style]=this.style[style]||''},this);this.setStyles(styles);return(function(){this.setStyles(before)}).bind(this)},getDimensions:function(options){options=$merge({computeSize:false},options);var dim={};function getSize(el,options){return(options.computeSize)?el.getComputedSize(options):el.getSize()};if(this.getStyle('display')=='none'){var restore=this.expose();dim=getSize(this,options);restore()}else{try{dim=getSize(this,options)}catch(e){}}return $chk(dim.x)?$extend(dim,{width:dim.x,height:dim.y}):$extend(dim,{x:dim.width,y:dim.height})},getComputedSize:function(options){options=$merge({styles:['padding','border'],plains:{height:['top','bottom'],width:['left','right']},mode:'both'},options);var size={width:0,height:0};switch(options.mode){case'vertical':delete size.width;delete options.plains.width;break;case'horizontal':delete size.height;delete options.plains.height;break};var getStyles=[];$each(options.plains,function(plain,key){plain.each(function(edge){options.styles.each(function(style){getStyles.push((style=="border")?style+'-'+edge+'-'+'width':style+'-'+edge)})})});var styles=this.getStyles.apply(this,getStyles);var subtracted=[];$each(options.plains,function(plain,key){size['total'+key.capitalize()]=0;size['computed'+key.capitalize()]=0;plain.each(function(edge){size['computed'+edge.capitalize()]=0;getStyles.each(function(style,i){if(style.test(edge)){styles[style]=styles[style].toInt();if(isNaN(styles[style]))styles[style]=0;size['total'+key.capitalize()]=size['total'+key.capitalize()]+styles[style];size['computed'+edge.capitalize()]=size['computed'+edge.capitalize()]+styles[style]}if(style.test(edge)&&key!=style&&(style.test('border')||style.test('padding'))&&!subtracted.contains(style)){subtracted.push(style);size['computed'+key.capitalize()]=size['computed'+key.capitalize()]-styles[style]}})})});if($chk(size.width)){size.width=size.width+this.offsetWidth+size.computedWidth;size.totalWidth=size.width+size.totalWidth;delete size.computedWidth}if($chk(size.height)){size.height=size.height+this.offsetHeight+size.computedHeight;size.totalHeight=size.height+size.totalHeight;delete size.computedHeight}return $extend(styles,size)}});window.addEvent('domready',function(){var test=new Element('div').setStyles({position:'fixed',top:0,right:0}).inject(document.body);var supported=(test.offsetTop===0);test.dispose();Browser.supportsPositionFixed=supported});Element.implement({pin:function(enable){if(!Browser.loaded)dbug.log('cannot pin '+this+' natively because the dom is not ready');if(this.getStyle('display')=='none'){dbug.log('cannot pin '+this+' because it is hidden');return}if(enable!==false){var p=this.getPosition();if(!this.retrieve('pinned')){var pos={top:(p.y-window.getScroll().y),left:(p.x-window.getScroll().x)};if(Browser.supportsPositionFixed){this.setStyle('position','fixed').setStyles(pos)}else{this.store('pinnedByJS',true);this.setStyles({position:'absolute',top:p.y,left:p.x});this.store('scrollFixer',function(){if(this.retrieve('pinned')){var to={top:(pos.top.toInt()+window.getScroll().y),left:(pos.left.toInt()+window.getScroll().x)};this.setStyles(to)}}.bind(this));window.addEvent('scroll',this.retrieve('scrollFixer'))}this.store('pinned',true)}}else{var op;if(!Browser.Engine.trident){if(this.getParent().getComputedStyle('position')!='static')op=this.getParent();else op=this.getParent().getOffsetParent()}var p=this.getPosition(op);this.store('pinned',false);var reposition;if(Browser.supportsPositionFixed&&!this.retrieve('pinnedByJS')){reposition={top:(p.y+window.getScroll().y),left:(p.x+window.getScroll().x)}}else{this.store('pinnedByJS',false);window.removeEvent('scroll',this.retrieve('scrollFixer'));reposition={top:(p.y),left:(p.x)}}this.setStyles($merge(reposition,{position:'absolute'}))}return this.addClass('isPinned')},unpin:function(){return this.pin(false).removeClass('isPinned')},togglepin:function(){this.pin(!this.retrieve('pinned'))}});Element.Properties.position={set:function(options){this.setPosition(options)},get:function(options){if(options)this.setPosition(options);return this.getPosition()}};Element.implement({setPosition:function(options){$each(options||{},function(v,k){if(!$defined(v))delete options[k]});options=$merge({relativeTo:document.body,position:{x:'center',y:'center'},edge:false,offset:{x:0,y:0},returnPos:false,relFixedPosition:false,ignoreMargins:false,allowNegative:false},options);var parentOffset={x:0,y:0};var parentPositioned=false;var offsetParent=this.measure(function(){return $(this.getOffsetParent())});if(offsetParent&&offsetParent!=this.getDocument().body){parentOffset=offsetParent.measure(function(){return this.getPosition()});parentPositioned=true;options.offset.x=options.offset.x-parentOffset.x;options.offset.y=options.offset.y-parentOffset.y}var fixValue=function(option){if($type(option)!="string")return option;option=option.toLowerCase();var val={};if(option.test('left'))val.x='left';else if(option.test('right'))val.x='right';else val.x='center';if(option.test('upper')||option.test('top'))val.y='top';else if(option.test('bottom'))val.y='bottom';else val.y='center';return val};options.edge=fixValue(options.edge);options.position=fixValue(options.position);if(!options.edge){if(options.position.x=='center'&&options.position.y=='center')options.edge={x:'center',y:'center'};else options.edge={x:'left',y:'top'}}this.setStyle('position','absolute');var rel=$(options.relativeTo)||document.body;var calc=rel==document.body?window.getScroll():rel.getPosition();var top=calc.y;var left=calc.x;if(Browser.Engine.trident){var scrolls=rel.getScrolls();top+=scrolls.y;left+=scrolls.x}var dim=this.getDimensions({computeSize:true,styles:['padding','border','margin']});if(options.ignoreMargins){options.offset.x=options.offset.x-dim['margin-left'];options.offset.y=options.offset.y-dim['margin-top']}var pos={};var prefY=options.offset.y;var prefX=options.offset.x;var winSize=window.getSize();switch(options.position.x){case'left':pos.x=left+prefX;break;case'right':pos.x=left+prefX+rel.offsetWidth;break;default:pos.x=left+((rel==document.body?winSize.x:rel.offsetWidth)/2)+prefX;break};switch(options.position.y){case'top':pos.y=top+prefY;break;case'bottom':pos.y=top+prefY+rel.offsetHeight;break;default:pos.y=top+((rel==document.body?winSize.y:rel.offsetHeight)/2)+prefY;break};if(options.edge){var edgeOffset={};switch(options.edge.x){case'left':edgeOffset.x=0;break;case'right':edgeOffset.x=-dim.x-dim.computedRight-dim.computedLeft;break;default:edgeOffset.x=-(dim.x/2);break};switch(options.edge.y){case'top':edgeOffset.y=0;break;case'bottom':edgeOffset.y=-dim.y-dim.computedTop-dim.computedBottom;break;default:edgeOffset.y=-(dim.y/2);break};pos.x=pos.x+edgeOffset.x;pos.y=pos.y+edgeOffset.y}pos={left:((pos.x>=0||parentPositioned||options.allowNegative)?pos.x:0).toInt(),top:((pos.y>=0||parentPositioned||options.allowNegative)?pos.y:0).toInt()};if(rel.getStyle('position')=="fixed"||options.relFixedPosition){var winScroll=window.getScroll();pos.top=pos.top.toInt()+winScroll.y;pos.left=pos.left.toInt()+winScroll.x}if(options.returnPos)return pos;else this.setStyles(pos);return this}});Element.implement({isVisible:function(){return this.getStyle('display')!='none'},toggle:function(){return this[this.isVisible()?'hide':'show']()},hide:function(){var d;try{if('none'!=this.getStyle('display'))d=this.getStyle('display')}catch(e){}this.store('originalDisplay',d||'block');this.setStyle('display','none');return this},show:function(display){original=this.retrieve('originalDisplay')?this.retrieve('originalDisplay'):this.get('originalDisplay');this.setStyle('display',(display||original||'block'));return this},swapClass:function(remove,add){return this.removeClass(remove).addClass(add)},fxOpacityOk:function(){return!Browser.Engine.trident4}});var Modalizer=new Class({defaultModalStyle:{display:'block',position:'fixed',top:0,left:0,'z-index':5000,'background-color':'#333',opacity:0.8},setModalOptions:function(options){this.modalOptions=$merge({width:(window.getScrollSize().x),height:(window.getScrollSize().y),elementsToHide:'select, embed, object',hideOnClick:true,modalStyle:{},updateOnResize:true,layerId:'modalOverlay',onModalHide:$empty,onModalShow:$empty},this.modalOptions,options);return this},layer:function(){if(!this.modalOptions.layerId)this.setModalOptions();return $(this.modalOptions.layerId)||new Element('div',{id:this.modalOptions.layerId}).inject(document.body)},resize:function(){if(this.layer()){this.layer().setStyles({width:(window.getScrollSize().x),height:(window.getScrollSize().y)})}},setModalStyle:function(styleObject){this.modalOptions.modalStyle=styleObject;this.modalStyle=$merge(this.defaultModalStyle,{width:this.modalOptions.width,height:this.modalOptions.height},styleObject);if(this.layer())this.layer().setStyles(this.modalStyle);return(this.modalStyle)},modalShow:function(options){this.setModalOptions(options);this.layer().setStyles(this.setModalStyle(this.modalOptions.modalStyle));if(Browser.Engine.trident4)this.layer().setStyle('position','absolute');this.layer().removeEvents('click').addEvent('click',function(){this.modalHide(this.modalOptions.hideOnClick)}.bind(this));this.bound=this.bound||{};if(!this.bound.resize&&this.modalOptions.updateOnResize){this.bound.resize=this.resize.bind(this);window.addEvent('resize',this.bound.resize)}if($type(this.modalOptions.onModalShow)=="function")this.modalOptions.onModalShow();this.togglePopThroughElements(0);this.layer().setStyle('display','block');return this},modalHide:function(override,force){if(override===false)return false;this.togglePopThroughElements(1);if($type(this.modalOptions.onModalHide)=="function")this.modalOptions.onModalHide();this.layer().setStyle('display','none');if(this.modalOptions.updateOnResize){this.bound=this.bound||{};if(!this.bound.resize)this.bound.resize=this.resize.bind(this);window.removeEvent('resize',this.bound.resize)}return this},togglePopThroughElements:function(opacity){if(Browser.Engine.trident4||(Browser.Engine.gecko&&Browser.Platform.mac)){$$(this.modalOptions.elementsToHide).each(function(sel){sel.setStyle('opacity',opacity)})}}});var StyleWriter=new Class({createStyle:function(css,id){window.addEvent('domready',function(){try{if($(id)&&id)return;var style=new Element('style',{id:id||''}).inject($$('head')[0]);if(Browser.Engine.trident)style.styleSheet.cssText=css;else style.set('text',css)}catch(e){dbug.log('error: %s',e)}}.bind(this))}});var StickyWin=new Class({Implements:[Options,Events,StyleWriter,ToElement],options:{closeClassName:'closeSticky',pinClassName:'pinSticky',content:'',zIndex:10000,className:'',width:false,height:false,timeout:-1,allowMultipleByClass:false,allowMultiple:true,showNow:true,useIframeShim:true,iframeShimSelector:'',inject:{where:'bottom'}},css:'.SWclearfix:after {content: "."; display: block; height: 0; clear: both; visibility: hidden;}'+'.SWclearfix {display: inline-table;}'+'* html .SWclearfix {height: 1%;}'+'.SWclearfix {display: block;}',initialize:function(options){this.setOptions(options);this.options.inject.target=this.options.inject.target||document.body;this.id=this.options.id||'StickyWin_'+new Date().getTime();this.makeWindow();if(this.options.content)this.setContent(this.options.content);if(this.options.timeout>0){this.addEvent('onDisplay',function(){this.hide.delay(this.options.timeout,this)}.bind(this))}if(this.options.showNow)this.show();this.createStyle(this.css,'StickyWinClearFix')},makeWindow:function(){this.destroyOthers();if(!$(this.id)){this.win=new Element('div',{id:this.id}).addClass(this.options.className).addClass('StickyWinInstance').addClass('SWclearfix').setStyles({display:'none',position:'absolute',zIndex:this.options.zIndex}).inject(this.options.inject.target,this.options.inject.where).store('StickyWin',this)}else this.win=$(this.id);this.element=this.win;if(this.options.width&&$type(this.options.width.toInt())=="number")this.win.setStyle('width',this.options.width.toInt());if(this.options.height&&$type(this.options.height.toInt())=="number")this.win.setStyle('height',this.options.height.toInt());return this},show:function(suppressEvent){this.showWin();if(!suppressEvent)this.fireEvent('onDisplay');if(this.options.useIframeShim)this.showIframeShim();this.visible=true;return this},showWin:function(){if(!this.positioned)this.position();this.win.show()},hide:function(suppressEvent){if(!suppressEvent)this.fireEvent('onClose');this.hideWin();if(this.options.useIframeShim)this.hideIframeShim();this.visible=false;return this},hideWin:function(){this.win.setStyle('display','none')},destroyOthers:function(){if(!this.options.allowMultipleByClass||!this.options.allowMultiple){$$('div.StickyWinInstance').each(function(sw){if(!this.options.allowMultiple||(!this.options.allowMultipleByClass&&sw.hasClass(this.options.className)))sw.retrieve('StickyWin').destroy()},this)}},setContent:function(html){if(this.win.getChildren().length>0)this.win.empty();if($type(html)=="string")this.win.set('html',html);else if($(html))this.win.adopt(html);this.win.getElements('.'+this.options.closeClassName).each(function(el){el.addEvent('click',this.hide.bind(this))},this);this.win.getElements('.'+this.options.pinClassName).each(function(el){el.addEvent('click',this.togglepin.bind(this))},this);return this},position:function(options){this.positioned=true;this.setOptions(options);this.win.setPosition({allowNegative:true,relativeTo:this.options.relativeTo,position:this.options.position,offset:this.options.offset,edge:this.options.edge});if(this.shim)this.shim.position();return this},pin:function(pin){if(!this.win.pin){dbug.log('you must include element.pin.js!');return this}this.pinned=$pick(pin,true);this.win.pin(pin);return this},unpin:function(){return this.pin(false)},togglepin:function(){return this.pin(!this.pinned)},makeIframeShim:function(){if(!this.shim){var el=(this.options.iframeShimSelector)?this.win.getElement(this.options.iframeShimSelector):this.win;this.shim=new IframeShim(el,{display:false,name:'StickyWinShim'})}},showIframeShim:function(){if(this.options.useIframeShim){this.makeIframeShim();this.shim.show()}},hideIframeShim:function(){if(this.shim)this.shim.hide()},destroy:function(){if(this.win)this.win.dispose();if(this.options.useIframeShim&&this.shim)this.shim.dispose();if($('modalOverlay'))$('modalOverlay').dispose()}});StickyWin.Fx=new Class({Extends:StickyWin,options:{fade:true,fadeDuration:150,draggable:false,dragOptions:{},dragHandleSelector:'.dragHandle',resizable:false,resizeOptions:{},resizeHandleSelector:''},setContent:function(html){this.parent(html);if(this.options.draggable)this.makeDraggable();if(this.options.resizable)this.makeResizable();return this},hideWin:function(){if(this.options.fade)this.fade(0);else this.parent()},showWin:function(){if(this.options.fade)this.fade(1);else this.parent()},hide:function(){this.parent(this.options.fade)},show:function(){this.parent(this.options.fade)},fade:function(to){if(!this.fadeFx){this.win.setStyles({opacity:0,display:'block'});var opts={property:'opacity',duration:this.options.fadeDuration};if(this.options.fadeTransition)opts.transition=this.options.fadeTransition;this.fadeFx=new Fx.Tween(this.win,opts)}if(to>0){this.win.setStyle('display','block');this.position()}this.fadeFx.clearChain();this.fadeFx.start(to).chain(function(){if(to==0){this.win.setStyle('display','none');this.fireEvent('onClose')}else{this.fireEvent('onDisplay')}}.bind(this));return this},makeDraggable:function(){dbug.log('you must include Drag.js, cannot make draggable')},makeResizable:function(){dbug.log('you must include Drag.js, cannot make resizable')}});var StickyWinFx=StickyWin.Fx;if(typeof Drag!="undefined"){StickyWin.Fx.implement({makeDraggable:function(){var toggled=this.toggleVisible(true);if(this.options.useIframeShim){this.makeIframeShim();var onComplete=(this.options.dragOptions.onComplete||$empty);this.options.dragOptions.onComplete=function(){onComplete();this.shim.position()}.bind(this)}if(this.options.dragHandleSelector){var handle=this.win.getElement(this.options.dragHandleSelector);if(handle){handle.setStyle('cursor','move');this.options.dragOptions.handle=handle}}this.win.makeDraggable(this.options.dragOptions);if(toggled)this.toggleVisible(false)},makeResizable:function(){var toggled=this.toggleVisible(true);if(this.options.useIframeShim){this.makeIframeShim();var onComplete=(this.options.resizeOptions.onComplete||$empty);this.options.resizeOptions.onComplete=function(){onComplete();this.shim.position()}.bind(this)}if(this.options.resizeHandleSelector){var handle=this.win.getElement(this.options.resizeHandleSelector);if(handle)this.options.resizeOptions.handle=this.win.getElement(this.options.resizeHandleSelector)}this.win.makeResizable(this.options.resizeOptions);if(toggled)this.toggleVisible(false)},toggleVisible:function(show){if(!this.visible&&Browser.Engine.webkit&&$pick(show,true)){this.win.setStyles({display:'block',opacity:0});return true}else if(!$pick(show,false)){this.win.setStyles({display:'none',opacity:1});return false}return false}})}(function(){var modalWinBase=function(extend){return{Extends:extend,initialize:function(options){options=options||{};this.setModalOptions($merge(options.modalOptions||{},{onModalHide:function(){this.hide(false)}.bind(this)}));this.parent(options)},show:function(showModal){if($pick(showModal,true)){this.modalShow();if(this.modalOptions.elementsToHide)this.win.getElements(this.modalOptions.elementsToHide).setStyle('opacity',1)}this.parent()},hide:function(hideModal){if($pick(hideModal,true))this.modalHide();else this.parent()}}};StickyWin.Modal=new Class(modalWinBase(StickyWin));StickyWin.Modal.implement(new Modalizer());if(StickyWin.Fx)StickyWin.Fx.Modal=new Class(modalWinBase(StickyWin.Fx));try{StickyWin.Fx.Modal.implement(new Modalizer())}catch(e){}})();var StickyWinModal=StickyWin.Modal;if(StickyWin.Fx)var StickyWinFxModal=StickyWin.Fx.Modal;(function(){var SWA=function(extend){return{Extends:extend,options:{url:'',showNow:false,requestOptions:{method:'get'},wrapWithUi:false,caption:'',uiOptions:{},handleResponse:function(response){var responseScript="";this.Request.response.text.stripScripts(function(script){responseScript+=script});if(this.options.wrapWithUi)response=StickyWin.ui(this.options.caption,response,this.options.uiOptions);this.setContent(response);this.show();if(this.evalScripts)$exec(responseScript)}},initialize:function(options){this.parent(options);this.evalScripts=this.options.requestOptions.evalScripts;this.options.requestOptions.evalScripts=false;this.createRequest()},createRequest:function(){this.Request=new Request(this.options.requestOptions).addEvent('onSuccess',this.options.handleResponse.bind(this))},update:function(url,options){this.Request.setOptions(options).send({url:url||this.options.url});return this}}};try{StickyWin.Ajax=new Class(SWA(StickyWin))}catch(e){}try{StickyWin.Fx.Ajax=new Class(SWA(StickyWin.Fx))}catch(e){}try{StickyWin.Modal.Ajax=new Class(SWA(StickyWin.Modal))}catch(e){}try{StickyWin.Fx.Modal.Ajax=new Class(SWA(StickyWin.Fx.Modal))}catch(e){}})();if(window.StickyWinModal)StickyWinModal.Ajax=StickyWin.Modal.Ajax;if(StickyWin.Fx){StickyWinFx.Ajax=StickyWin.Fx.Ajax;StickyWinFxModal.Ajax=StickyWin.Fx.Modal.Ajax}StickyWin.alert=function(msghdr,msg,baseHref){baseHref=baseHref||"http://www.cnet.com/html/rb/assets/global/simple.error.popup";msg='<p class="errorMsg SWclearfix" style="margin: 0px;min-height:10px">'+'<img src="'+baseHref+'/icon_problems_sm.gif"'+' class="bang clearfix" style="float: left; width: 30px; height: 30px; margin: 3px 5px 5px 0px;">'+msg+'</p>';var body=StickyWin.ui(msghdr,msg,{width:250});return new StickyWin.Modal({modalOptions:{modalStyle:{zIndex:11000}},zIndex:110001,content:body,position:'center'})};StickyWin.UI=new Class({Implements:[Options,ToElement,StyleWriter],options:{width:300,css:"div.DefaultStickyWin div.body{font-family:verdana; font-size:11px; line-height: 13px;}"+"div.DefaultStickyWin div.top_ul{background:url({%baseHref%}full.png) top left no-repeat; height:30px; width:15px; float:left}"+"div.DefaultStickyWin div.top_ur{position:relative; left:0px !important; left:-4px; background:url({%baseHref%}full.png) top right !important; height:30px; margin:0px 0px 0px 15px !important; margin-right:-4px; padding:0px}"+"div.DefaultStickyWin h1.caption{clear: none !important; margin:0px !important; overflow: hidden; padding:0 !important; font-weight:bold; color:#555; font-size:14px !important; position:relative; top:8px !important; left:5px !important; float: left; height: 22px !important;}"+"div.DefaultStickyWin div.middle, div.DefaultStickyWin div.closeBody {background:url({%baseHref%}body.png) top left repeat-y; margin:0px 20px 0px 0px !important;	margin-bottom: -3px; position: relative;	top: 0px !important; top: -3px;}"+"div.DefaultStickyWin div.body{background:url({%baseHref%}body.png) top right repeat-y; padding:8px 30px 8px 0px !important; margin-left:5px !important; position:relative; right:-20px !important;}"+"div.DefaultStickyWin div.bottom{clear:both}"+"div.DefaultStickyWin div.bottom_ll{background:url({%baseHref%}full.png) bottom left no-repeat; width:15px; height:15px; float:left}"+"div.DefaultStickyWin div.bottom_lr{background:url({%baseHref%}full.png) bottom right; position:relative; left:0px !important; left:-4px; margin:0px 0px 0px 15px !important; margin-right:-4px; height:15px}"+"div.DefaultStickyWin div.closeButtons{text-align: center; background:url({%baseHref%}body.png) top right repeat-y; padding: 0px 30px 8px 0px; margin-left:5px; position:relative; right:-20px}"+"div.DefaultStickyWin a.button:hover{background:url({%baseHref%}big_button_over.gif) repeat-x}"+"div.DefaultStickyWin a.button {background:url({%baseHref%}big_button.gif) repeat-x; margin: 2px 8px 2px 8px; padding: 2px 12px; cursor:pointer; border: 1px solid #999 !important; text-decoration:none; color: #000 !important;}"+"div.DefaultStickyWin div.closeButton{width:13px; height:13px; background:url({%baseHref%}closebtn.gif) no-repeat; position: absolute; right: 0px; margin:10px 15px 0px 0px !important; cursor:pointer;top:0px}"+"div.DefaultStickyWin div.dragHandle {	width: 11px;	height: 25px;	position: relative;	top: 5px;	left: -3px;	cursor: move;	background: url({%baseHref%}drag_corner.gif); float: left;}",cornerHandle:false,cssClass:'',baseHref:'http://www.cnet.com/html/rb/assets/global/stickyWinHTML/',buttons:[],cssId:'defaultStickyWinStyle',cssClassName:'DefaultStickyWin',closeButton:true},initialize:function(){var args=this.getArgs(arguments);this.setOptions(args.options);this.legacy();var css=this.options.css.substitute({baseHref:this.options.baseHref},/\\?\{%([^}]+)%\}/g);if(Browser.Engine.trident4)css=css.replace(/png/g,'gif');this.createStyle(css,this.options.cssId);this.build();this.setContent(args.caption,args.body)},getArgs:function(){return StickyWin.UI.getArgs.apply(this,arguments)},legacy:function(){var opt=this.options;if(opt.confirmTxt)opt.buttons.push({text:opt.confirmTxt,onClick:opt.onConfirm||$empty});if(opt.closeTxt)opt.buttons.push({text:opt.closeTxt,onClick:opt.onClose||$empty})},build:function(){var opt=this.options;var container=new Element('div',{'class':opt.cssClassName});if(opt.width)container.setStyle('width',opt.width);this.element=container;this.element.store('StickyWinUI',this);if(opt.cssClass)container.addClass(opt.cssClass);var bodyDiv=new Element('div').addClass('body');this.body=bodyDiv;var top_ur=new Element('div').addClass('top_ur');this.top_ur=top_ur;this.top=new Element('div').addClass('top').adopt(new Element('div').addClass('top_ul')).adopt(top_ur);container.adopt(this.top);if(opt.cornerHandle)new Element('div').addClass('dragHandle').inject(top_ur,'top');container.adopt(new Element('div').addClass('middle').adopt(bodyDiv));if(opt.buttons.length>0){var closeButtons=new Element('div').addClass('closeButtons');opt.buttons.each(function(button){if(button.properties&&button.properties.className){button.properties['class']=button.properties.className;delete button.properties.className}var properties=$merge({'class':'closeSticky'},button.properties);new Element('a').addEvent('click',button.onClick||$empty).appendText(button.text).inject(closeButtons).setProperties(properties).addClass('button')});container.adopt(new Element('div').addClass('closeBody').adopt(closeButtons))}container.adopt(new Element('div').addClass('bottom').adopt(new Element('div').addClass('bottom_ll')).adopt(new Element('div').addClass('bottom_lr')));if(this.options.closeButton)container.adopt(new Element('div').addClass('closeButton').addClass('closeSticky'));return this},makeCaption:function(caption){if(!caption)return this.destroyCaption();this.caption=caption;var opt=this.options;var h1Caption=new Element('h1').addClass('caption');if(opt.width)h1Caption.setStyle('width',(opt.width-(opt.cornerHandle?55:40)-(opt.closeButton?10:0)));if($(this.caption))h1Caption.adopt(this.caption);else h1Caption.set('html',this.caption);this.top_ur.adopt(h1Caption);this.h1=h1Caption;if(!this.options.cornerHandle)this.h1.addClass('dragHandle');return this},destroyCaption:function(){if(this.h1){this.h1.destroy();this.h1=null}return this},setContent:function(){var args=this.getArgs.apply(this,arguments);var caption=args.caption;var body=args.body;if(this.h1)this.destroyCaption();this.makeCaption(caption);if($(body))this.body.empty().adopt(body);else this.body.set('html',body);return this}});StickyWin.UI.getArgs=function(){var input=$type(arguments[0])=="arguments"?arguments[0]:arguments;var cap=input[0],bod=input[1];var args=Array.link(input,{options:Object.type});if(input.length==3||(!args.options&&input.length==2)){args.caption=cap;args.body=bod}else if(($type(bod)=='object'||!bod)&&cap&&$type(cap)!='object'){args.body=cap}return args};StickyWin.ui=function(caption,body,options){return $(new StickyWin.UI(caption,body,options))};