//dbugScripts - will include non-compressed versions of this code if "jsdebug=true" is in the url of this page,
//otherwise it will execute this code.
//example: dbugScripts("/the/location/of/my/scripts/",["script1.js","script2.js","etc"])
//returns true if scripts are included, otherwise false.
if(!dbugScripts("http://c18-x-publish1.cnet.com:8100/html/rb/js/download/cat/",["download.product.detail.js"])){
/* start packed code */
var InputValidator=new Class({initialize:function(className,options){this.setOptions({errorMsg:'Validation failed.',test:function(field){return true}},options);this.className=className},test:function(field){if($(field))return this.options.test($(field),this.getProps(field));else return false},getError:function(field){var err=this.options.errorMsg;if($type(err)=="function")err=err($(field),this.getProps(field));return err},getProps:function(field){if($(field)&&$(field).getProperty('validatorProps')){try{return Json.evaluate($(field).getProperty('validatorProps'))}catch(e){return{}}}else{return{}}}});InputValidator.implement(new Options);var FormValidator=new Class({options:{fieldSelectors:"input, select, textarea",useTitles:false,evaluateOnSubmit:true,evaluateFieldsOnBlur:true,evaluateFieldsOnChange:true,serial:true,warningPrefix:"Warning: ",errorPrefix:"Error: ",onFormValidate:function(isValid,form){},onElementValidate:function(isValid,field){}},initialize:function(form,options){this.setOptions(options);try{this.form=$(form);if(this.options.evaluateOnSubmit)this.form.addEvent('submit',this.onSubmit.bind(this));if(this.options.evaluateFieldsOnBlur)this.watchFields()}catch(e){}},getFields:function(){return this.fields=this.form.getElementsBySelector(this.options.fieldSelectors)},watchFields:function(){try{this.getFields().each(function(el){el.addEvent('blur',this.validateField.pass([el,false],this));if(this.options.evaluateFieldsOnChange)el.addEvent('change',this.validateField.pass([el,true],this))},this)}catch(e){}},onSubmit:function(event){if(!this.validate(event))new Event(event).stop();else{this.stop();this.reset()}},reset:function(){this.getFields().each(this.resetField,this)},validate:function(event){var result=this.getFields().map(function(field){return this.validateField(field,true)},this);result=result.every(function(val){return val});this.fireEvent('onFormValidate',[result,this.form,event]);return result},validateField:function(field,force){if(this.paused)return true;field=$(field);var result=true;var failed=this.form.getElement('.validation-failed');var warned=this.form.getElement('.warning');if(field&&(!failed||force||field==failed||(failed&&!this.options.serial))){var validators=field.className.split(" ").some(function(cn){return this.getValidator(cn)},this);result=field.className.split(" ").map(function(className){return this.test(className,field)},this);result=result.every(function(val){return val});if(validators&&!field.hasClass('warnOnly')){if(result)field.addClass('validation-passed').removeClass('validation-failed');else field.addClass('validation-failed').removeClass('validation-passed')}if(!warned||force||(warned&&!this.options.serial)){var warnings=field.className.split(" ").some(function(cn){if(cn.test('^warn-')||field.hasClass('warnOnly'))return this.getValidator(cn.replace(/^warn-/,""));return null},this);field.removeClass('warning');var warnResult=field.className.split(" ").map(function(cn){if(cn.test('^warn-')||field.hasClass('warnOnly'))return this.test(cn.replace(/^warn-/,""),field,true);return null},this)}}return result},getPropName:function(className){return'__advice'+className},test:function(className,field,warn){if(field.hasClass('ignoreValidation'))return true;warn=$pick(warn,false);if(field.hasClass('warnOnly'))warn=true;field=$(field);var isValid=true;if(field){var validator=this.getValidator(className);if(validator&&this.isVisible(field)){isValid=validator.test(field);if(!isValid&&validator.getError(field)){if(warn)field.addClass('warning');var advice=this.makeAdvice(className,field,validator.getError(field),warn);this.insertAdvice(advice,field);this.showAdvice(className,field)}else this.hideAdvice(className,field);this.fireEvent('onElementValidate',[isValid,field])}}if(warn)return true;return isValid},showAdvice:function(className,field){var advice=this.getAdvice(className,field);if(advice&&!field[this.getPropName(className)]&&(advice.getStyle('display')=="none"||advice.getStyle('visiblity')=="hidden"||advice.getStyle('opacity')==0)){field[this.getPropName(className)]=true;if(advice.smoothShow)advice.smoothShow();else advice.setStyle('display','block')}},hideAdvice:function(className,field){var advice=this.getAdvice(className,field);if(advice&&field[this.getPropName(className)]){field[this.getPropName(className)]=false;if(advice.smoothHide)advice.smoothHide();else advice.setStyle('display','none')}},isVisible:function(field){while(field.tagName!='BODY'){if($(field).getStyle('display')=="none")return false;field=field.getParent()}return true},getAdvice:function(className,field){return $('advice-'+className+'-'+this.getFieldId(field))},makeAdvice:function(className,field,error,warn){var errorMsg=(warn)?this.options.warningPrefix:this.options.errorPrefix;errorMsg+=(this.options.useTitles)?$pick(field.title,error):error;var advice=this.getAdvice(className,field);if(!advice){var cssClass=(warn)?'warning-advice':'validation-advice';advice=new Element('div').addClass(cssClass).setProperty('id','advice-'+className+'-'+this.getFieldId(field)).setStyle('display','none').appendText(errorMsg)}else{advice.setHTML(errorMsg)}return advice},insertAdvice:function(advice,field){switch(field.type.toLowerCase()){case'radio':var p=$(field.parentNode);if(p){p.adopt(advice);break}default:advice.injectAfter($(field))}},getFieldId:function(field){return field.id?field.id:field.id="input_"+field.name},resetField:function(field){field=$(field);if(field){var cn=field.className.split(" ");cn.each(function(className){if(className.test('^warn-'))className=className.replace(/^warn-/,"");var prop=this.getPropName(className);if(field[prop])this.hideAdvice(className,field);field.removeClass('validation-failed');field.removeClass('warning');field.removeClass('validation-passed')},this)}},stop:function(){this.paused=true},start:function(){this.paused=false},ignoreField:function(field,warn){field=$(field);if(field){this.enforceField(field);if(warn)field.addClass('warnOnly');else field.addClass('ignoreValidation')}},enforceField:function(field){field=$(field);if(field){field.removeClass('warnOnly');field.removeClass('ignoreValidation')}}});FormValidator.implement(new Options);FormValidator.implement(new Events);FormValidator.adders={validators:{},add:function(className,options){this.validators[className]=new InputValidator(className,options);if(!this.initialize){this.implement({validators:this.validators})}},addAllThese:function(validators){$A(validators).each(function(validator){this.add(validator[0],validator[1])},this)},getValidator:function(className){return this.validators[className]}};Object.extend(FormValidator,FormValidator.adders);FormValidator.implement(FormValidator.adders);FormValidator.add('IsEmpty',{errorMsg:false,test:function(element){if(element.type=="select-one"||element.type=="select")return!(element.selectedIndex>=0&&element.options[element.selectedIndex].value!="");else return((element.getValue()==null)||(element.getValue().length==0))}});FormValidator.addAllThese([['required',{errorMsg:function(element){return'This field is required.'},test:function(element){return!FormValidator.getValidator('IsEmpty').test(element)}}],['minLength',{errorMsg:function(element,props){if($type(props.minLength))return'Please enter at least '+props.minLength+' characters (you entered '+element.getValue().length+' characters).';else return''},test:function(element,props){if($type(props.minLength))return(element.getValue().length>=$pick(props.minLength,0));else return true}}],['maxLength',{errorMsg:function(element,props){if($type(props.maxLength))return'Please enter no more than '+props.maxLength+' characters (you entered '+element.getValue().length+' characters).';else return''},test:function(element,props){return(element.getValue().length<=$pick(props.maxLength,10000))}}],['validate-number',{errorMsg:'Please enter a valid number in this field.',test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||!/[^\d+$]/.test(element.getValue())}}],['validate-digits',{errorMsg:'Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.',test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||(/[^a-zA-Z]/.test(element.getValue())&&/[\d]/.test(element.getValue()))}}],['validate-alpha',{errorMsg:'Please use letters only (a-z) in this field.',test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||/^[a-zA-Z]+$/.test(element.getValue())}}],['validate-alphanum',{errorMsg:'Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.',test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||!/\W/.test(element.getValue())}}],['validate-date',{errorMsg:function(element,props){if(Date.parse){var format=props.dateFormat||"%x";return'Please enter a valid date such as '+new Date().format(format)}else{return'Please enter a valid date such as MM/DD/YYYY (i.e. "12/31/1999")'}},test:function(element,props){if(FormValidator.getValidator('IsEmpty').test(element))return true;if(Date.parse){var format=props.dateFormat||"%x";var d=Date.parse(element.getValue());var formatted=d.format(format);if(formatted!="invalid date")element.setProperty('value',formatted);return!isNaN(d)}else{var regex=/^(\d{2})\/(\d{2})\/(\d{4})$/;if(!regex.test(element.getValue()))return false;var d=new Date(element.getValue().replace(regex,'$1/$2/$3'));return(parseInt(RegExp.$1,10)==(1+d.getMonth()))&&(parseInt(RegExp.$2,10)==d.getDate())&&(parseInt(RegExp.$3,10)==d.getFullYear())}}}],['validate-email',{errorMsg:'Please enter a valid email address. For example fred@domain.com .',test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(element.getValue())}}],['validate-url',{errorMsg:'Please enter a valid URL.',test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||/^(http|https|ftp|rmtp|mms):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(element.getValue())}}],['validate-date-au',{errorMsg:'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.',test:function(element){if(FormValidator.getValidator('IsEmpty').test(element))return true;var regex=/^(\d{2})\/(\d{2})\/(\d{4})$/;if(!regex.test(element.getValue()))return false;var d=new Date(element.getValue().replace(regex,'$2/$1/$3'));return(parseInt(RegExp.$2,10)==(1+d.getMonth()))&&(parseInt(RegExp.$1,10)==d.getDate())&&(parseInt(RegExp.$3,10)==d.getFullYear())}}],['validate-currency-dollar',{errorMsg:'Please enter a valid $ amount. For example $100.00 .',test:function(element){return FormValidator.getValidator('IsEmpty').test(element)||/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(element.getValue())}}],['validate-one-required',{errorMsg:'Please enter something for at least one of the above options.',test:function(element){var p=element.parentNode;var options=p.getElements('input');return $A(options).some(function(el){return el.getValue()})}}]]);var SimpleSlideShow=new Class({options:{startIndex:0,slides:[],currentSlideClass:'currentSlide',currentIndexContainer:false,maxContainer:false,nextLink:false,prevLink:false,wrap:true,disabledLinkClass:'disabled',onNext:Class.empty,onPrev:Class.empty,onSlideClick:Class.empty,crossFadeOptions:{}},initialize:function(options){this.setOptions(options);this.slides=this.options.slides;this.makeSlides();this.setCounters();this.setUpNav();this.now=this.options.startIndex;if(this.slides.length>0)this.showSlide(this.now)},setCounters:function(){if($(this.options.currentIndexContainer))$(this.options.currentIndexContainer).setHTML(this.now+1);if($(this.options.maxContainer))$(this.options.maxContainer).setHTML(this.slides.length)},makeSlides:function(){this.slides.each(function(slide,index){if(index!=this.now)slide.setStyle('display','none');else slide.setStyle('display','block');this.makeSlide(slide)},this)},makeSlide:function(slide){slide.addEvent('click',function(){this.fireEvent('onSlideClick')}.bind(this))},setUpNav:function(){if($(this.options.nextLink))$(this.options.nextLink).addEvent('click',function(){this.cycleForward()}.bind(this));if($(this.options.prevLink))$(this.options.prevLink).addEvent('click',function(){this.cycleBack()}.bind(this))},cycleForward:function(){if($type(this.now)&&this.now<this.slides.length-1)this.showSlide(this.now+1);else if($type(this.now)&&this.options.wrap)this.showSlide(0);else this.showSlide(this.options.startIndex);this.fireEvent('onNext');if(this.now==this.slides.length&&!this.options.wrap&&$(this.options.nextLink))$(this.options.nextLink).addClass(this.options.disabledLinkClass);else if($(this.options.nextLink))$(this.options.nextLink).removeClass(this.options.disabledLinkClass)},cycleBack:function(){if(this.now>0){this.showSlide(this.now-1);this.fireEvent('onPrev')}else if(this.options.wrap&&this.slides.length>1){this.showSlide(this.slides.length-1);this.fireEvent('onPrev')}if(this.now==0&&!this.options.wrap&&$(this.options.prevSlide))$(this.options.prevSlide).addClass(this.options.disabledLinkClass);else if($(this.options.prevSlide))$(this.options.prevSlide).removeClass(this.options.disabledLinkClass)},showSlide:function(iToShow){var now=this.now;var s=this.slides[iToShow];function fadeIn(s,resetOpacity){s.setStyle('display','block');if(s.fxOpacityOk()){if(resetOpacity)s.setStyle('opacity',0);s.effect('opacity',this.options.crossFadeOptions).start(1)}};if(s){if($type(this.now)&&this.now!=iToShow){if(s.fxOpacityOk()){this.slides[this.now].effect('opacity',this.options.crossFadeOptions).start(0).chain(function(){this.slides[now].setStyle('display','none');s.addClass(this.options.currentSlideClass);fadeIn.bind(this,[s,true])()}.bind(this))}else{this.slides[this.now].setStyle('display','none');fadeIn.bind(this,s)()}}else fadeIn.bind(this,s)();this.now=iToShow;this.setCounters()}},slideClick:function(){this.fireEvent('onSlideClick',[this.slides[this.now],this.now])}});SimpleSlideShow.implement(new Events);SimpleSlideShow.implement(new Options);var SimpleImageSlideShow=SimpleSlideShow.extend({options:{imgUrls:[],imgClass:'screenshot',container:false},initialize:function(options){this.parent(options);this.options.imgUrls.each(function(url){this.addImg(url)},this);this.showSlide(this.options.startIndex)},addImg:function(url){if($(this.options.container)){var img=new Element('img').setProperties({'src':url,'id':this.options.imgClass+this.slides.length}).addClass(this.options.imgClass).setStyle('display','none').injectInside($(this.options.container)).addEvent('click',this.slideClick.bind(this));this.slides.push(img);this.makeSlide(img);this.setCounters()}}});var InsertedLogInForm=new Class({response:null,formShell:null,formElem:null,validator:null,isOpen:false,errorDiv:null,lastElem:null,options:{template:null,validate:true,onLogin:Class.empty},initialize:function(options){this.setOptions(options);this.formShell=$(this.options.template).clone();this.formShell.inject(document.body);this.formElem=(this.formShell.nodeName=="FORM")?this.formShell:$E('form',this.formShell);this.formElem.addEvent('submit',function(e){this.submitForm(e)}.bind(this));this.formShell.setStyles({'overflow':'hidden','height':'0','clear':'both'});$ES('.close',this.formElem).each(function(aClose){aClose.addEvent('click',function(){this.close()}.bind(this))}.bind(this))},submitForm:function(e){new Event(e).stop();var myAjax=new Ajax(getLoginUrl(this.formElem),{postBody:this.formElem,onComplete:function(response){this.evalResponse(response)}.bind(this)}).request()},evalResponse:function(response){this.response=eval("("+response+")");dbug.log(this.response);if(this.response.returnCode==1)this.onSuccess();else this.onFailure()},onSuccess:function(){UserVars=new LocalVars.UserVars({loggedIn:'1',rememberMe:(this.response.rememberMe=='false')?'0':'1',ursRegId:this.response.registrationId,userName:this.response.displayName});this.formShell.setHTML(this.statusMessage['1']);(function(){this.chain(function(){this.hide()}.bind(this));this.chain(function(){this.fireEvent('onLogin')}.bind(this));this.callChain()}).delay(1250,this)},onFailure:function(){$each(this.response.errors,function(anError){new Element('p').appendText(anError.text).injectInside(this.getErrorDiv())}.bind(this));this.show()},open:function(elem){if(UserVars.loggedIn)return;if(elem!=this.lastElem||!this.isOpen){var regContainer=this.regParent(elem);if(regContainer){if(this.isOpen)this.chain(function(){this.hide()}.bind(this));this.chain(function(){this.placeForm(regContainer)}.bind(this));this.chain(function(){this.show()}.bind(this));this.callChain();this.lastElem=elem}}else{this.close()}},close:function(){this.chain(function(){this.hide()});this.chain(function(){this.formShell.setStyle('display','none');this.formElem.reset();this.errorDiv.remove();this.errorDiv=null});this.callChain()},regParent:function(elem){var testElem=elem;do{if(testElem.hasClass('reg'))return testElem;testElem=testElem.getParent()}while(testElem!=document.body);return false},show:function(){this.formShell.setStyle('display','block');this.formShell.effect('height',{duration:250}).start(this.findShowHeight());this.callChain();this.isOpen=true;this.formElem.focus()},hide:function(){if(this.formShell.offsetHeight>0)this.formShell.effect('height',{duration:250}).start(0).chain(function(){this.callChain()}.bind(this));else{this.callChain()}this.isOpen=false},placeForm:function(elem){if(elem.hasClass('regAbove'))this.formShell.injectBefore(elem);else this.formShell.injectAfter(elem);this.callChain()},findShowHeight:function(){if(this.formShell.offsetHeight<this.formShell.scrollHeight){return this.formShell.scrollHeight}else{var toHeight;var nowHeight=this.formShell.getStyle('height');var sizer=new Element('div',{styles:{'height':nowHeight}});this.formShell.replaceWith(sizer);sizer.adopt(this.formShell);this.formShell.setStyle('height','auto');toHeight=this.formShell.offsetHeight;this.formShell.setStyle('height',nowHeight);sizer.replaceWith(this.formShell);return toHeight}return null},statusMessage:{'1':'<h4>You have successfully logged in.</h4><p>Thank you.</p>'},getErrorDiv:function(){var eDiv=this.errorDiv;if(!eDiv){eDiv=new Element('div',{'class':'error'});eDiv.injectAfter($E('h4',this.formShell));this.errorDiv=eDiv}else{eDiv.setHTML('')}return eDiv}});InsertedLogInForm.implement(new Options);InsertedLogInForm.implement(new Chain);InsertedLogInForm.implement(new Events);var getLoginUrl=function(form,options){options=options||{};var ursUrl;if($chk(form.action)&&form.action.match("/1325")){ursUrl=form.action}else{ursUrl="/1325-4_"+PageVars.siteId+"-";ursUrl+=$pick(options.appId,"103");ursUrl+=".html"}if(ursUrl.match("path="))return ursUrl;var sep=(ursUrl.indexOf("?")>-1)?"&":"?";var loc=document.location.toString().urlEncode();ursUrl+=sep+"path="+loc;return ursUrl};var ReplyToReview=new Class({launchElem:null,formShell:null,formElem:null,validator:null,opinonId:null,isOpen:false,onComplete:Class.empty,options:{template:'replyShell',pageType:9246,productId:false,loginObj:false},initialize:function(link,options){this.setOptions(options);this.launchElem=$(link);this.opinionId=this.getOpinionId();if(!this.opinionId){dbug.log("opinionId not found: %s",this.launchElem);return false}this.launchElem.addEvent('click',function(){this.toggleShell()}.bind(this))},toggleShell:function(){if(this.isOpen)this.hide();else this.show()},createReplyForm:function(){this.formShell=$(this.options.template).clone();this.formShell.id+="_"+this.opinionId;this.formShell.setStyles({display:'none',height:'0',overflow:'hidden'});this.formElem=(this.formShell.nodeName=='FORM')?this.formShell:$E('form',this.formShell);this.formElem.id+="_"+this.opinionId;this.formShell.injectAfter(this.findParentDiv(this.launchElem));this.formElem.reviewedOpinionId.value=this.opinionId;$ES('.close',this.formShell).each(function(aClose){aClose.addEvent('click',function(){this.hide()}.bind(this))}.bind(this));this.validator=new FormValidator(this.formElem,{evaluateOnSubmit:false,evaluateFieldsOnBlur:false,evaluateFieldsOnChange:false});this.submitUrl=this.getSubmitUrl();this.formElem.addEvent('submit',function(e){if(this.validator.validate()){this.submitForm()}else{this.show.delay(500,this)}}.bind(this))},findParentDiv:function(elem){do{if($(elem).nodeName=="DIV")return $(elem);elem=$(elem).getParent()}while(elem!=document.body);return false},submitForm:function(e){new Ajax(this.submitUrl,{postBody:this.formElem,onComplete:function(response){this.evalResponse(response);this.formShell.effect('opacity',{duration:250}).start(1);this.formElem.setAttribute('disabled','')}.bind(this),onRequest:function(){this.formShell.effect('opacity',{duration:250}).start(.6);this.formElem.setAttribute('disabled','disabled')}.bind(this),onFailure:function(){this.formShell.effect('opacity',{duration:250}).start(1);this.formElem.setAttribute('disabled','');var errDiv=$pick($E('.error',this.formShell),new Element('div',{'class':'error'}).injectBefore($E('input',this.formElem)));errDiv.setHTML('<p class="error">We\'re sorry. We seem to be having trouble contacting the server. Please wait a few minutes and try again.</p>')}.bind(this)}).request()},evalResponse:function(response){this.response=eval("("+response+")");if(this.response.status==1)this.onSuccess();else this.onFailure()},onSuccess:function(){this.formElem.replaceWith(new Element('div').appendText(this.response.message));this.show()},onFailure:function(){var errDiv=$pick($E('.error',this.formShell),new Element('div',{'class':'error'}).injectBefore($E('div.field',this.formElem)));new Element('h4').appendText('We have found the following errors:').injectInside(errDiv);$each(this.response.errors,function(anError){if(anError.message)new Element('p').appendText(anError.message).injectInside(errDiv)});this.show()},getSubmitUrl:function(){var url="/";url+=this.options.pageType;url+="-"+PageVars.nodeId+"_"+PageVars.siteId+'-';url+=$pick(this.options.productId||this.formElem.reviewedProductId.value);url+=".html";return url},getOpinionId:function(){var target=this.launchElem;var id=false;do{id=target.getProperty('opinionId');if(id)return id;target=target.getParent()}while(target!=document.body);return false},show:function(){if(!UserVars.loggedIn){this.options.loginObj.open(this.launchElem);return false}if(!this.formShell)this.createReplyForm();this.formShell.setStyle("display","block");this.formShell.effect('height').start(this.findShowHeight());this.isOpen=true},hide:function(){this.formShell.effect('height').start(0);this.isOpen=false},findShowHeight:function(){if(this.formShell.offsetHeight>=this.formShell.scrollHeight){var toHeight;var nowHeight=this.formShell.getStyle('height');var sizer=new Element('div',{styles:{'height':nowHeight}}).injectInside(this.formShell.getParent()).adopt(this.formShell);this.formShell.setStyle('height','auto');toHeight=this.formShell.offsetHeight;this.formShell.setStyle('height',nowHeight);sizer.replaceWith(this.formShell);return toHeight}else{return this.formShell.scrollHeight}return null}});ReplyToReview.implement(new Options);var HelpfulVote=new Class({event:null,launchElem:null,errorDiv:null,options:{loginObj:null},initialize:function(e,options){this.event=new Event(e);this.event.stop();this.launchElem=this.event.target;this.setOptions(options);if(!UserVars.loggedIn){this.options.loginObj.open(this.launchElem);return false}new Ajax(this.launchElem.getAttribute('value'),{method:'get',onComplete:function(response){this.evalResponse(response)}.bind(this)}).request()},evalResponse:function(response){this.response=eval("("+response+")");if(this.response.status==1)this.success();else this.failure()},success:function(){this.findParent().setHTML(this.response.message)},failure:function(){$each(this.response.errors,function(anError){this.getErrorDiv().appendText(anError.message)}.bind(this))},findParent:function(){var myTarget=$(this.launchElem);do{if(myTarget.hasClass('helpful')){return myTarget}myTarget=myTarget.getParent()}while(myTarget!=document.body);return false},getErrorDiv:function(){var eDiv=$E('div.error',this.findParent());if(!eDiv){eDiv=new Element('div',{'class':'error'});eDiv.injectBefore($E('strong',this.findParent()));this.errorDiv=eDiv}else{eDiv.setHTML('')}return eDiv}});HelpfulVote.implement(new Options);var RatingsSubmit=new Class({response:null,validator:null,uoForm:null,submitUrl:null,initialize:function(id){this.uoForm=$(id);this.submitUrl=this.uoForm.action;this.uoForm.action="javascript:void(0)";this.validator=new FormValidator(this.uoForm,{evaluateOnSubmit:false,evaluateOnBlur:false});this.validator.add('isDefaultStars',{message:"Please select a star rating",test:function(elem){dbug.log(elem.value);if(elem.value==-1)return false;return true}});this.uoForm.addEvent('submit',function(){if(this.validator.validate()){if(this.uoForm.rating.value!=-1)this.submitForm();else{this.getErrorDiv().setHTML('');var p=new Element('p').appendText("Please select a star rating").injectInside(this.getErrorDiv())}}}.bind(this))},submitForm:function(){new Ajax(this.submitUrl,{postBody:this.uoForm,onComplete:function(response){this.evalResponse(response)}.bind(this),onFailure:function(){this.getErrorDiv().setHTML('There has been a problem contacting the Download.com servers. Please try again later.')}.bind(this)}).request()},evalResponse:function(response){this.response=eval("("+response+")");if(this.response.status==1){this.success()}else{this.failure()}},success:function(){this.uoForm.replaceWith(new Element('div').setHTML("<b>Thank you for your submission.</b><br />Your review will appear on the site shortly."))},failure:function(){this.getErrorDiv().setHTML('');$each(this.response.errors,function(anError){var p=new Element('p').appendText(anError.message).injectInside(this.getErrorDiv())}.bind(this))},getErrorDiv:function(){var errDiv=$E('.error',this.uoForm);if(!errDiv){errDiv=new Element('div',{'class':'error'}).injectBefore(this.uoForm.getFirst())}return errDiv}});window.addEvent('domready',function(){if($('prod-submit-review'))try{new RatingsSubmit('prod-submit-review')}catch(e){dbug.log("RatingsSubmit error: %s",e)}});var ReportOffensive=new Class({launchElem:null,formShell:null,formElem:null,opinonId:null,opinionShell:null,validator:false,isOpen:false,errorDiv:false,options:{template:null,pageType:9251,productId:false},initialize:function(link,options){this.setOptions(options);this.launchElem=$(link);this.opinionId=this.getOpinionId();if(!this.opinionId){dbug.log("opinionId not found");return false}this.launchElem.addEvent('click',this.toggleShell.bind(this))},createReportForm:function(){this.formShell=$(this.options.template).clone();this.formShell.id+="_"+this.opinionId;this.formShell.setStyles({display:'none',height:'0',overflow:'hidden'});this.formElem=(this.formShell.nodeName=='FORM')?this.formShell:$E('form',this.formShell);this.formElem.id+="_"+this.opinionId;this.formShell.injectAfter(this.findParentDiv(this.launchElem));this.formElem.OpinionId.value=this.opinionId;this.formElem.FoundOnURL.value=document.location.href;this.validator=new FormValidator(this.formElem,{evaluateOnSubmit:false,evaluateFieldsOnBlur:false,evaluateFieldsOnChange:false});this.validator.add('validate_radio_selected',{errorMsg:'Please select one of the options above',test:function(elem){var eName=elem.getAttribute('name');return $A(elem.form[eName]).some(function(anElem){return anElem.checked})}});this.validator.add('isDefaultValue',{errorMsg:'Please enter a value.',test:function(elem){return(elem.value!=elem.defaultValue)}});$ES('.close',this.formShell).each(function(aClose){aClose.addEvent('click',function(){this.hide()}.bind(this))}.bind(this));this.appendInputs();this.submitUrl=this.getSubmitUrl();this.formElem.addEvent('submit',function(e){if(this.validator.validate()){this.submitForm()}else{this.show.delay(500,this)}}.bind(this))},findParentDiv:function(elem){do{if($(elem).nodeName=="DIV")return $(elem);elem=$(elem).getParent()}while(elem!=document.body);return false},submitForm:function(){new Ajax(this.submitUrl,{postBody:this.formElem,onComplete:function(response){this.formShell.effect('opacity',{duration:250}).start(1);this.formElem.setProperty('disabled','');this.evalResponse(response)}.bind(this),onRequest:function(){this.formShell.effect('opacity',{duration:250}).start(.6);this.formElem.setProperty('disabled','disabled');this.show()}.bind(this),onFailure:function(){this.formShell.effect('opacity',{duration:250}).start(1);this.formElem.setProperty('disabled','');var errDiv=$pick($E('.error',this.formShell),new Element('div',{'class':'error'}).injectBefore($E('input',this.formElem)));errDiv.setHTML('<p class="error">We\'re sorry. We seem to be having trouble contacting the server. Please wait a few minutes and try again.</p>');this.show()}.bind(this)}).request()},appendInputs:function(){$ES('input',this.opinionShell).each(function(anInput){if(anInput.hasClass('offenseInfo'))anInput.clone().injectInside(this.formElem)},this)},evalResponse:function(response){this.response=eval("("+response+")");if(this.response.status==1)this.onSuccess();else this.onFailure()},onSuccess:function(){this.formElem.replaceWith(new Element('div').appendText(this.response.message));this.show()},onFailure:function(){var errDiv=$pick($E('.error',this.formShell),new Element('div',{'class':'error'}).injectBefore($E('input',this.formElem)));new Element('h4').appendText('We have found the following errors:').injectInside(errDiv);$each(this.response.errors,function(anError){if(anError.message)new Element('p').appendText(anError.message).injectInside(errDiv)});this.show()},getSubmitUrl:function(){var url="/";url+=this.options.pageType;url+="-"+PageVars.nodeId+"_"+PageVars.siteId+'-';url+=$pick(this.options.productId||this.formElem.reviewedProductId.value);url+=".html";return url},getOpinionId:function(){var target=this.launchElem;var id=false;do{if(id=target.getAttribute('opinionid')){this.opinionShell=target;return id}target=target.getParent()}while(target!=document.body);return false},toggleShell:function(){if(this.isOpen)this.hide();else this.show()},show:function(){if(!this.formShell)this.createReportForm();this.formShell.setStyle("display","block");this.formShell.effect('height').start(this.findShowHeight());this.isOpen=true},hide:function(){this.formShell.effect('height').start(0);this.isOpen=false},findShowHeight:function(){if(this.formShell.offsetHeight>=this.formShell.scrollHeight){var toHeight;var nowHeight=this.formShell.getStyle('height');var sizer=new Element('div',{styles:{'height':nowHeight}}).injectInside(this.formShell.getParent()).adopt(this.formShell);this.formShell.setStyle('height','auto');toHeight=this.formShell.offsetHeight;this.formShell.setStyle('height',nowHeight);sizer.replaceWith(this.formShell);return toHeight}else{return this.formShell.scrollHeight}return null},getErrorDiv:function(){var eDiv=this.errorDiv;if(!eDiv){errDiv=new Element('div',{'class':'error'}).injectBefore($E('input',this.formElem))}return errDiv}});ReportOffensive.implement(new Options);var ratings={currentRatings:[],goToSubmitReview:function(pagetype,node,id,score){if(score>=0)window.location.href='/'+pagetype+'-'+node+'-'+id+'.html?stars='+score},confirmScore:function(score){if(score>0)return confirm("You can only rate this item once. Are you sure you want to give it a "+score+"?");else if(score==0)return confirm("You can rate this item only once. Are you sure you want to mark it as not being your style?");else return false},submitRating:function(id,score){if(score){this.setRating(id,score);if($("back_"+id))$("back_"+id).value=parent.document.location.href;document.forms["RateIt_"+id].submit()}},submitHelpfulVote:function(id,voteValue){if($("vote_"+id)){$("vote_"+id).value=voteValue;$("back_"+id).value=parent.document.location.href;document.forms["HelpfulnessVote_"+id].submit()}},setRating:function(id,score){this.currentRatings[id]=score;if($("rating_"+id))$("rating_"+id).value=score;if($("stars_"+id))$("stars_"+id).src=this.getImg(true,rating)},getImg:function(){return new Element('img')}};if(PageVars.siteId==4){$extend(ratings,{msgs:["","Though it may have some useful functions, this product is unstable, riddled with spyware, or otherwise difficult to use. Download at your own risk.","This program has major flaws, though it is not completely without merit. I cannot recommend this download unless it is the only one of its kind.","This is a decent, solid program. It has no major flaws, but it didn't knock my socks off. There may be similar programs that work better, have more features, or are easier to use.","Despite a few minor flaws, this program is generally excellent. I recommend this download.","I can't recommend this product highly enough."],getMsg:function(index){if(index>=0)return new Element('p').addClass('star-explanation').adopt(new Element('strong').appendText(index+' stars:')).appendText(' '+this.msgs[index]);else return new Element('p')},getImg:function(score){score=$pick(score,0);if(score<0)score=0;return"/i/dl/global/strs/user_reviews_stars_"+score+".gif"},ratingsOver:function(id,rating){this.currentRatings[id]=$pick(this.currentRatings[id],-1);if($("stars_"+id))$("stars_"+id).src=this.getImg(rating);if($('ratetxt'))$('ratetxt').setHTML("").adopt(this.getMsg(rating))},ratingsOut:function(id){this.currentRatings[id]=$pick(this.currentRatings[id],-1);if($("stars_"+id))$("stars_"+id).src=this.getImg(this.currentRatings[id]);if($('ratetxt'))$('ratetxt').setHTML("").adopt(this.getMsg(this.currentRatings[id]))}})};var setRating=(ratings.setRating)?ratings.setRating.bind(ratings):null;var setRatingdl=(ratings.setRating)?ratings.setRating.bind(ratings):null;var setMDLRating=(ratings.setRating)?ratings.setRating.bind(ratings):null;var submitRating=(ratings.submitRating)?ratings.submitRating.bind(ratings):null;var submitMDLRating=(ratings.submitRating)?ratings.submitRating.bind(ratings):null;var goToSubmitReview=(ratings.goToSubmitReview)?ratings.goToSubmitReview.bind(ratings):null;var submitHelpfulVote=(ratings.submitHelpfulVote)?ratings.submitHelpfulVote.bind(ratings):null;var nmsOver=(ratings.nmsOver)?ratings.nmsOver.bind(ratings):null;var nmsOut=(ratings.nmsOut)?ratings.nmsOut.bind(ratings):null;var ratingsOver=(ratings.ratingsOver)?ratings.ratingsOver.bind(ratings):null;var ratingsOut=(ratings.ratingsOut)?ratings.ratingsOut.bind(ratings):null;var rateObj=(ratings.setRating)?ratings.setRating.bind(ratings):null;var ratingsOverdl=(ratings.ratingsOver)?ratings.ratingsOver.bind(ratings):null;var ratingsOutdl=(ratings.ratingsOut)?ratings.ratingsOut.bind(ratings):null;var rateObjdl=(ratings.setRating)?ratings.setRating.bind(ratings):null;var mobileLogin=[];var killLoginForms=function(){$each(mobileLogin,function(aLogin){aLogin.formShell.remove()});$('prod-submit-review').smoothShow()};window.addEvent('domready',function(){if(!UserVars.loggedIn){try{mobileLogin.push(new InsertedLogInForm({template:'tdLoginShell',onLogin:killLoginForms}));var ratingsSubmit=$('prod-submit-review');mobileLogin.push(new InsertedLogInForm({template:'tdLoginShell',onLogin:killLoginForms}));mobileLogin[mobileLogin.length-1].open(ratingsSubmit);ratingsSubmit.hide()}catch(e){dbug.log(e)}};$$('.reply-dots a.reply').each(function(aLink){new ReplyToReview(aLink,{template:'replyShell',loginObj:mobileLogin[0]})});$$('a.helpVote').each(function(aLink){aLink.addEvent('click',function(e){new HelpfulVote(e,{loginObj:mobileLogin[0]})})});try{new SimpleSlideShow({startIndex:0,slides:$$('#screenShotImgs a'),container:'screenShotImgs',currentIndexContainer:'ghetto',maxContainer:'ghettoMax',nextLink:'nextImg',prevLink:'prevImg'})}catch(e){dbug.log('Error creating slideshow: %o',e)}});function handleAjaxError(request){if(request.responseText.indexOf("COMPONENT_RESPONSE_CODE=401")>0){document.location='http://www.download.com/1383-20_4-151.html?path=http://www.download.com/Ad-Aware-2007/3000-8022_4-10708241.html'+escape("?addWatchItem=true")}else{ajaxErrorPopup('Woops!','There has been an error contacting Download.com servers. Please try back later or <a href="http://www.download.com/1200-20_4-750000.html">visit our help center</a>.','product-quickfacts',0,0,'UR','UR');$('addWatchItem').innerHTML=''}};function toggleMenu(currMenu,prevMenu){currMenu=$(currMenu);prevMenu=$(prevMenu);if(currMenu.getStyle('display')=='block'){currMenu.setStyle('display','none');prevMenu.setStyle('display','block')}else{currMenu.setStyle('display','block');prevMenu.setStyle('display','none')}return false};FormValidator.implement({insertAdvice:function(advice,field){switch(field.type.toLowerCase()){case'radio':var p=$(field.parentNode);if(p){p.adopt(advice);break}default:advice.injectBefore($(field))}}});
} //end debug scripts
