function StringBuilder(a){this.data=[];this.length=0;this.append=function(b){if(b){this.data.push(b)}this.length+=b.length};this.clear=function(){this.data.length=this.length=0};this.toString=function(){return this.data.join("")};if(typeof(a)!="undefined"){this.append(a)}}var ImageLoader=new function(){var c="/template/default/images/loading.gif";var b="";var d=null;var f=false;var a=new Image();var g=function(h){f=false;if(d.attr("src")!=b){d.attr("src",b);d.fadeIn("fast")}};var e=function(){f=false};a.onload=g;a.onerror=e;a.onabort=e;this.loadImg=function(h,i){if(f){return}if((!d&&h)||(h&&d&&d.attr("id")!=h)){d=$("#"+h)}if(!d){return}if(b!=i){b=i;f=true;a.src=b}}};function chgGallery(a,b){if(!b){b="imgMain"}ImageLoader.loadImg(b,a);return false}function imgsw(b,a){$("#"+b).attr("src",a);return false}var CPSearch=new function(){var d=9;var c=new Array(d);var e=0;var a="searchkw";var b="||";var f=function(){var h=new Array();var g=e;do{if(c[g]!=undefined){h.push(c[g])}g=g==c.length?0:g+1}while(g!=e);return h};this.validateParam=function(l){var k="";if(typeof(l)!="string"){return k}var h='0123456789abcdefjhijklmnopqrstuvwxyzABCDEFJHIJKLMNOPQRSTUVWXYZ_- "??a?¡é?¡À';for(var g=0;g<l.length;g++){var j=l.charAt(g);if(h.indexOf(j,0)>=0){k+=j}}return k};this.addKeyword=function(g){if(!g){return}c[e]=g;e=e==c.length?0:e+1;this.updateList();this.save()};this.updateList=function(){if($("#functionarea").length==0){return}var j="";var g=f();if(g.length==0){$("dd.records > p").show();$("dd.records > ul").html(j)}else{for(var h=0;h<g.length;h++){j+="<li><a href='#' onclick='return newSearch(this)'>"+g[h]+"</a></li>\n"}$("dd.records > p").hide();$("dd.records > ul").html(j)}};this.save=function(){var j="";var h=f();for(var g=0;g<h.length;g++){if(h[g].length){j+=(j.length?b:"")+h[g]}}setCookie(a,j)};this.load=function(){var j=getCookie(a);if(j&&j.length){var h=j.split(b);for(var g=0;g<h.length;g++){c[g]=h[g]}e=h.length;if(e==c.length-1){e=0}}};this.restore=function(){this.load();this.updateList()}};function searchSubmit(){var c="kw";var a="input keywords here ...";var b=$("#"+c);var d=b.val();if(!d||a==d){b.val(a);return false}if(CPSearch){var e=CPSearch.validateParam(d);if(e!=d){b.val(e)}CPSearch.addKeyword(e)}return true}function newSearch(b,a){var c=$(b).text();if(a){c='"'+c+'"'}$("#kw").val(c);if(CPSearch){CPSearch.addKeyword(c)}$("#frmsearch").submit();return false}var CPfavorite=new function(){var aryFav=[null,null,null,null,];this.exist=function(sId){for(var i in aryFav){if(aryFav[i]!=null&&aryFav[i]==sId){return true}}return false};this.add=function(sId){for(var i in aryFav){if(aryFav[i]!=null&&aryFav[i]==sId){return -1}}for(var i in aryFav){if(aryFav[i]==null){aryFav[i]=sId;save();this.update_list(true);return i}}return -1};this.del=function(sId){for(var i in aryFav){if(aryFav[i]!=null&&aryFav[i]==sId){aryFav[i]=null;save();return i}}return -1};var save=function(){var sSave="";for(var i in aryFav){var sObject="null";if(aryFav[i]!=null){sObject="'"+aryFav[i]+"'"}sSave+=(sSave.length>0?",":"")+sObject}sSave="["+sSave+"]";setCookie("favorite",sSave)};var load=function(){var sLoad=getCookie("favorite");if(sLoad&&sLoad.length>0){aryFav=eval(sLoad)}};this.update_list=function(bActive){for(var i in aryFav){if(aryFav[i]!=null){$("#chkpop_"+aryFav[i]).attr("checked",true)}}};this.add_del=function(sId,bAdd){var nRtn=-1;if(bAdd&&sId.substr(0,4)=="NTBK"){if(aryFav[0]!=null&&aryFav[0].substr(0,4)!="NTBK"){alert("Sorry, desktops cannot be compared with notebooks.");$("#chkpop_"+sId).attr("checked",false);return nRtn}nRtn=this.add(sId);if(nRtn==-1){alert("Sorry, but we can just handle up to 4 systems for the comparison.");$("#chkpop_"+sId).attr("checked",false)}}else{if(bAdd){if(aryFav[0]!=null&&aryFav[0].substr(0,4)=="NTBK"){alert("Sorry, notebooks cannot be compared with desktops.");$("#chkpop_"+sId).attr("checked",false);return nRtn}nRtn=this.add(sId);if(nRtn==-1){alert("Sorry, but we can just handle up to 4 systems for the comparison.");$("#chkpop_"+sId).attr("checked",false)}}else{nRtn=this.del(sId)}}this.update_list();return nRtn};this.removeall=function(){for(var i in aryFav){if(aryFav[i]!=null){aryFav[i]=null;save()}}};this.restore=function(){load();this.update_list()};this.count=function(){load();var iRtn=0;for(var i=0;i<aryFav.length;i++){iRtn+=aryFav[i]?1:0}return iRtn}};var CPAlternative=new function(){var aryAlt=[null,null,null,null,null,null,null,null];var getModel=function(sId,sKey,sName,nPrice,sPic,bAdd){return{id:sId,key:sKey,name:sName,price:nPrice,picture:sPic}};this.length=function(){var iRtn=0;for(var i=0;i<aryAlt.length;i++){if(aryAlt[i]!=null){iRtn++}}return iRtn};var selected=function(sId){for(var i=0;i<aryAlt.length;i++){if(aryAlt[i]&&aryAlt[i].id==sId){return true}}return false};this.add=function(sId,sKey,sName,nPrice,sPic,bAdd){var iRtn=-1;for(var i in aryAlt){if(aryAlt[i]!=null&&aryAlt[i].id==sId){return i}}for(var i in aryAlt){if(aryAlt[i]==null){aryAlt[i]=getModel(sId,sKey,sName,nPrice,sPic);save();return i}}return iRtn};this.del=function(sId){CPfavorite.add_del(sId,false);for(var i in aryAlt){if(aryAlt[i]!=null&&aryAlt[i].id==sId){aryAlt[i]=null;save();this.update_ui(true);return i}}return -1};var save=function(){var sSave="";for(var i in aryAlt){var sObject="null";if(aryAlt[i]!=null){sObject="{id:'"+aryAlt[i].id+"',key:'"+aryAlt[i].key+"',name:'"+aryAlt[i].name+"',price:"+aryAlt[i].price+",picture:'"+aryAlt[i].picture+"'}"}sSave+=(sSave.length>0?",":"")+sObject}sSave="["+sSave+"]";setCookie("alternative",sSave)};var load=function(){var sLoad=getCookie("alternative");if(sLoad&&sLoad.length>0){aryAlt=eval(sLoad)}};var update_list=function(){var sHtml="";var sURL="";$("input[name='compare']").attr("checked",false);for(var i in aryAlt){if(aryAlt[i]==null){sHtml+=""}else{sHtml+="<dd "+(i==aryAlt.length-1?">":'class="space3px">');sHtml+='<span><input type="checkbox"  value=\''+aryAlt[i].id+'\'  name="chkpop" id="chkpop_'+aryAlt[i].id+'" '+(CPfavorite.exist(aryAlt[i].id)?" checked":"");sHtml+=" onclick=\" CPfavorite.add_del('"+aryAlt[i].id+"', this.checked)\";";sHtml+="/></span>";sHtml+='<div class="tfpre"><img src="'+aryAlt[i].picture+'"   style="width: 45px; height: 45px;" /></div>';sHtml+='<div class="tfinfo">';sHtml+="<h3>"+aryAlt[i].name+"</h3>";sHtml+="<h4>$"+aryAlt[i].price+"</h4>";sHtml+="<div>";sHtml+='<a class="gobtn" href="/system/'+aryAlt[i].key+'/"><span>Customize</span></a><a class="delbtn" title="remove this" href="#" onclick="CPAlternative.add_del(\''+aryAlt[i].id+"',false); return false;\"><span>Remove</span></a>";sHtml+=" </div>";sHtml+=" </div>";sHtml+="</dd>";sURL+=(sURL.length?",":"")+aryAlt[i].id;$("#chk_"+aryAlt[i].id).attr("checked",true)}}if(sHtml==""){sHtml="<dd style='text-align:left'> No systems added to the favorite.<br>Add systems here to compare.<dd>"}$("div#topfavorite  dl").html(sHtml);$("#urlcompare").val(sURL)};this.update_fav=function(){CPfavorite.update_list(true)};this.auto_show=function(){if(this.length()>0){CPHeader.change_head_view(2)}};this.add_del=function(sId,sKey,sName,nPrice,sPic,bAdd){var nRtn=-1;if(bAdd){nRtn=this.add(sId,sKey,sName,nPrice,sPic);if(nRtn==-1){alert("Sorry, but we can just handle up to 4 systems for the favorite.")}}else{nRtn=this.del(sId)}this.update_ui(true);update_list();return nRtn};this.update_ui=function(){if($("div#topfavorite").length){update_list(true)}};this.restore=function(){load();this.update_ui()};this.removeall=function(){for(var i in aryAlt){if(aryAlt[i]!=null){CPAlternative.del(aryAlt[i].id)}}CPfavorite.removeall();this.update_ui()};this.comp_list_del=function(idx,sId){CPAlternative.del(sId);$("td[id*="+idx+"]").html("")}};function footerShowHide(){var b=$("#footer_sitemap");var a=$("img#footer_status",b);var d=25;var c=300;var f=b.height()==d?c:d;var e=a.attr("src");e=f==d?e.replace("Close","Open"):e.replace("Open","Close");b.height(f);a.attr("src",e)}function scrollTop(){$("html, body").animate({scrollTop:0},500)}var menuFavoriteHelper=new function(){var b=null;var f=null;var c={bInPopup:false};var e=function(i){if(i){f.show()}else{f.hide()}};var h=function(i){e(true)};var g=function(i){if(!c.bInPopup){e(false)}};var a=function(i){c.bInPopup=true};var d=function(i){c.bInPopup=false;e(false)};this.create=function(){b=$("#likelink");f=$("#topfavorite");b.hoverIntent({interval:0,over:h,timeout:200,out:g});f.hoverIntent({interval:0,over:a,timeout:200,out:d})}};var menuSearchHelper=new function(){var b=null;var f=null;var c={bInPopup:false};var e=function(i){if(i){f.show()}else{f.hide()}};var h=function(i){e(true)};var g=function(i){if(!c.bInPopup){e(false)}};var a=function(i){c.bInPopup=true};var d=function(i){c.bInPopup=false;e(false)};this.create=function(){b=$("#searchlink");f=$("#topsearch");b.hoverIntent({interval:0,over:h,timeout:200,out:g});f.hoverIntent({interval:0,over:a,timeout:200,out:d})}};var menuShareHelper=new function(){var b=null;var f=null;var c={bInPopup:false};var e=function(i){if(i){f.show()}else{f.hide()}};var h=function(i){e(true)};var g=function(i){if(!c.bInPopup){e(false)}};var a=function(i){c.bInPopup=true};var d=function(i){c.bInPopup=false;e(false)};this.create=function(){b=$("#sharelink");f=$("#addtoshare");b.hoverIntent({interval:0,over:h,timeout:200,out:g});f.hoverIntent({interval:0,over:a,timeout:200,out:d})}};var menuRatingHelper=new function(){var b=null;var f=null;var c={bInPopup:false};var e=function(i){if(i){f.show()}else{f.hide()}};var h=function(i){e(true)};var g=function(i){if(!c.bInPopup){e(false)}};var a=function(i){c.bInPopup=true};var d=function(i){c.bInPopup=false;e(false)};this.create=function(){b=$("#ratinglink");f=$("#prereviews");b.hoverIntent({interval:0,over:h,timeout:200,out:g});f.hoverIntent({interval:0,over:a,timeout:200,out:d})}};$(function(){var b=null;var a=null;if($.browser.msie&&$.browser.version<"7"){b=$("#navigations");a=$("#popmenu");b.css("position","absolute");a.css("position","absolute");$(window).scroll(function(){b.css("top",$(window).scrollTop()+"px");a.css("top",$(window).scrollTop()+42+"px")})}});$(function(){CPAlternative.restore();CPfavorite.restore();menuFavoriteHelper.create();menuSearchHelper.create();menuShareHelper.create();menuRatingHelper.create();if($("div#comparebox").length||$("#featuremenu").length||$(".searchresults").length){if($.browser.mozilla){$(window).bind("pageshow",function(){CPAlternative.restore()});$("input[name='compare']").attr("checked",false)}else{setTimeout(function(){$("ipnut[name='compare']").attr("checked",false);CPAlternative.restore()},0)}}});function addkw(){var a=$("#kw").val();CPSearch.addKeyword(a)}function popaddtoshare(){$("#sharelink").mouseenter(function(){$("#addtoshare").show()});$("#addtoshare").mouseleave(function(){$("#addtoshare").hide()});$("#favoritelink").mouseenter(function(){$("#addtoshare").hide()});$("#printlink").mouseenter(function(){$("#addtoshare").hide()})}function compareformsubmit(){var a=CPfavorite.count();if(a>=2){document.f1.action="/search/syscompare.aspx";document.f1.submit();return false}}function makeWin2(b,a,c){agent=navigator.userAgent;windowName="Sitelet";params="";params+="toolbar=0,";params+="location=0,";params+="directories=0,";params+="status=0,";params+="menubar=0,";params+="scrollbars=1,";params+="resizable=1,";if(a=="null"){params+="width=500,";params+="height=350"}else{params+="width="+a+",";params+="height="+c}if(typeof(win)=="object"&&!win.closed){win.close()}win=window.open(b,windowName,params);if(agent.indexOf("Mozilla/2")!=-1&&agent.indexOf("Win")==-1){win=window.open(b,windowName,params)}if(!win.opener){win.opener=window}win.focus()}function setCookie(c,e,b){var d="";if(b){var a=new Date();a.setTime(a.getTime()+(b*24*60*60*1000));d="; expires="+a.toGMTString()}document.cookie=c+"="+escape(e)+d+"; path=/"}function getCookie(e){var f;var d=e+"=";var a=document.cookie.split(";");for(var b=0;b<a.length;b++){var c=a[b];while(c.charAt(0)==" "){c=c.substring(1,c.length)}if(0==c.indexOf(d)){f=c.substring(d.length,c.length);break}}return f?unescape(f):f}function delCookie(a){setCookie(a,"",-1)}var menuHelper=new function(){var sRootId="root";var oCats={};var oJQUIs={menuroot:null,menusubs:null};var bIE6=$.browser.msie&&$.browser.version<"7.0";var oInitStatus={oCatCur:null};var oRunStatus={oRootItmCur:null,oRootItmPre:null,oSubCatCur:null,oSubCatPre:null,oSubCatItmCur:null,oSubCatItmPre:null,oSysCur:null,oSysPre:null,bInRoot:false,bInCat:false,binMenu:false};this.menu_cats_begin=function(){};this.menu_cats_end=function(){};this.menu_cat_begin=function(args){var oCat={id:args[0],name:args[1],url:args[2],target:args[3],cats:[],systems:[],parent:oInitStatus.oCatCur};if(oCat.parent){oCat.parent.cats.push(oCat)}oCats[oCat.id]=oCat;oInitStatus.oCatCur=oCat};this.menu_cat_end=function(){oInitStatus.oCatCur=oInitStatus.oCatCur.parent};this.menu_sys=function(args){var oSys={id:args[0],key:args[1],name:args[2],price:args[3],picture:args[4],specs:args[5]};oInitStatus.oCatCur.systems.push(oSys)};var build_menu_cat=function(oCat){if(typeof(sDisableStr)!="undefined"&&oCat.name.toLowerCase().indexOf(sDisableStr.toLowerCase())>=0){return""}var sBDHtml=new StringBuilder();var iDDWidth=220;if(oCat.cats.length>0){sBDHtml.append('<div class="ptbox" mdata="'+oCat.id+'"><span class="closepm" title="close this menu"><img src="/template/default/images/closepm.png" onclick="menuHelper.hidemenu();"></span><dl class="pmtabs">');for(var iSubCat=0;iSubCat<oCat.cats.length;iSubCat++){var oSubCat=oCat.cats[iSubCat];if(typeof(sDisableStr)!="undefined"&&oSubCat.name.toLowerCase().indexOf(sDisableStr.toLowerCase())>=0){continue}sBDHtml.append('<dd><a href="'+oSubCat.url+'" target="'+oSubCat.target+'" mdata="'+oSubCat.id+'">&#187; '+oSubCat.name+"</a></dd>")}sBDHtml.append("</dl></div>")}if(oCat.systems.length>0){sBDHtml.append('<div class="pmbox" mdata="'+oCat.id+'"><dl class="pmlist" style="width:'+(iDDWidth*oCat.systems.length)+'px">');for(var iSys=0;iSys<oCat.systems.length;iSys++){var oSys=oCat.systems[iSys];if(typeof(sDisableStr)!="undefined"&&oSys.name.toLowerCase().indexOf(sDisableStr.toLowerCase())>=0){continue}sBDHtml.append('<dd class="outbor"onmouseover="this.className=\'overbor\';" onmouseout="this.className=\'outbor\';"><a href="/system/'+oSys.key+'/" title="Click to customize"><div class="pl_img"><img src="/images/'+oSys.picture+'"/></div><h3 class="pl_name">'+oSys.name+'</h3><ul class="pl_info">');for(var iSpec=0;iSpec<oSys.specs.length;iSpec++){sBDHtml.append("<li>&#8226; "+oSys.specs[iSpec]+"</li>")}sBDHtml.append('</ul><div class="pl_more"><h4>$'+oSys.price+"</h4></div></a></dd>")}sBDHtml.append("</dl></div>")}if(oCat.cats.length>0){for(var iSubCat=0;iSubCat<oCat.cats.length;iSubCat++){var oSubCat=oCat.cats[iSubCat];sBDHtml.append(build_menu_cat(oSubCat))}}return sBDHtml.toString()};this.build_menu=function(){var oRoot=oCats[sRootId];var sBDHtmlRoot=new StringBuilder();for(var iCat=0;iCat<oRoot.cats.length;iCat++){var oCat=oRoot.cats[iCat];if(typeof(sDisableStr)!="undefined"&&oCat.name.toLowerCase().indexOf(sDisableStr.toLowerCase())>=0){continue}sBDHtmlRoot.append('<li><a href="'+oCat.url+'" target="'+oCat.target+'" mdata="'+oCat.id+'">'+oCat.name+"</a></li>")}oJQUIs.menuroot=$("ul#popmenuroot");oJQUIs.menuroot.html(sBDHtmlRoot.toString());oJQUIs.menusubs=$("div#popmenu>div.inner");var sBDHtml=new StringBuilder();for(iCat=0;iCat<oRoot.cats.length;iCat++){var oCat=oRoot.cats[iCat];sBDHtml.append(build_menu_cat(oCat))}oJQUIs.menusubs.html(sBDHtml.toString());oJQUIs.menuroot.hoverIntent({interval:0,over:cat_root_mouseover,timeout:400,out:cat_root_mouseout});$("li>a",oJQUIs.menuroot).hoverIntent({interval:100,over:cat_root_item_mouseover,timeout:0,out:cat_root_item_mouseout});$("div.ptbox",oJQUIs.menusubs).hoverIntent({interval:0,over:cat_sub_mouseover,timeout:400,out:cat_sub_mouseout});$("div.ptbox>dl>dd>a[mdata]",oJQUIs.menusubs).hoverIntent({interval:0,over:cat_sub_item_mouseover,timeout:0,out:cat_sub_item_mouseout});$("div.pmbox",oJQUIs.menusubs).hoverIntent({interval:0,over:sys_mouseover,timeout:100,out:sys_mouseout})};var update_menu=function(){with(oRunStatus){if(binMenu||bInCat){return}if(oSysCur){oSysCur.hide()}if(oSysPre){oSysPre.hide()}}};var update_cat=function(){with(oRunStatus){if(bInRoot||bInCat||binMenu){return}if(oSubCatPre){oSubCatPre.hide()}if(oSubCatCur){oSubCatCur.hide()}if(oSubCatItmPre){oSubCatItmPre.removeClass("stayhere")}if(oSubCatItmCur){oSubCatItmCur.removeClass("stayhere")}}update_menu()};var update_root=function(){with(oRunStatus){if(bInRoot||bInCat||binMenu){return}if(oRootItmPre){oRootItmPre.removeClass("stay")}if(oRootItmCur){oRootItmCur.removeClass("stay")}}update_cat()};this.hidemenu=function(){with(oRunStatus){if(oRootItmPre){oRootItmPre.removeClass("stay")}if(oRootItmCur){oRootItmCur.removeClass("stay")}if(oSubCatPre){oSubCatPre.hide()}if(oSubCatCur){oSubCatCur.hide()}if(oSysPre){oSysPre.hide()}if(oSysCur){oSysCur.hide()}}};var cat_root_mouseover=function(e){oRunStatus.bInRoot=true};var cat_root_mouseout=function(e){with(oRunStatus){bInRoot=false;update_root()}};var cat_root_item_mouseover=function(e){with(oRunStatus){oRootItmPre=oRootItmCur;oRootItmCur=$(this);if(oRootItmPre){oRootItmPre.removeClass("stay")}oRootItmCur.addClass("stay");var id=oRootItmCur.attr("mdata");oSubCatPre=oSubCatCur;oSubCatCur=$('div.ptbox[mdata="'+id+'"]',oJQUIs.menusubs);if(oSubCatPre){oSubCatPre.hide()}oSubCatCur.show();if(oSysPre){oSysPre.hide()}if(oSysCur){oSysCur.hide()}if(oSubCatItmCur){oSubCatCur.removeClass("stayhere")}if(oSubCatItmPre){oSubCatItmPre.removeClass("stayhere")}}};var cat_root_item_mouseout=function(e){};var cat_sub_mouseover=function(e){oRunStatus.bInCat=true};var cat_sub_mouseout=function(e){oRunStatus.bInCat=false;update_root()};var cat_sub_item_mouseover=function(e){with(oRunStatus){oSubCatItmPre=oSubCatItmCur;oSubCatItmCur=$(this);if(oSubCatItmPre){oSubCatItmPre.removeClass("stayhere")}oSubCatItmCur.addClass("stayhere");var id=oSubCatItmCur.attr("mdata");oSysPre=oSysCur;oSysCur=$('div.pmbox[mdata="'+id+'"]',oJQUIs.menusubs);if(oSysPre){oSysPre.hide()}oSysCur.show()}};var cat_sub_item_mouseout=function(e){};var sys_mouseover=function(e){oRunStatus.binMenu=true};var sys_mouseout=function(e){oRunStatus.binMenu=false;update_root()};var sys_item_mouseover=function(e){};var sys_item_mouseout=function(e){};this.test=function(){return oCats};this.oJQUIs=function(){return oJQUIs}};function menu_cats_begin(a){menuHelper.menu_cats_begin(a)}function menu_cats_end(){menuHelper.menu_cats_end(arguments)}function menu_cat_begin(){menuHelper.menu_cat_begin(arguments)}function menu_cat_end(){menuHelper.menu_cat_end(arguments)}function menu_sys(){menuHelper.menu_sys(arguments)}$(function(){menuHelper.build_menu()});
