//Copyright 2011 Novawave Inc.
function requestObj(){var b;var a=navigator.appName;if(a=="Microsoft Internet Explorer"){b=new ActiveXObject("Microsoft.XMLHTTP")}else{b=new XMLHttpRequest()}return b}var http=requestObj();function handle(){if(http.readyState==4){if(http.responseText=="err"){$("#dialog-err").dialog("open");$("#buildmid").html("<p>Click 'Build my PC'</p>");return false}var a=jQuery.parseJSON(http.responseText);if(a.g_name.length>40){gputitle=a.g_name.substring(0,40)+"..."}else{gputitle=a.g_name}gpuprice="$"+a.g_price.substring(0,a.g_price.length-2)+"."+a.g_price.substring(a.g_price.length-2);$("#gpu").html('<img src="images/products/gpu/'+a.g_asin+'.jpg" /> <a href="'+a.g_link+'" target="_blank">'+gputitle+"</a><br/>Score: ~"+a.g_score+"<br/>Price: "+gpuprice);if(a.c_name.length>40){cputitle=a.c_name.substring(0,40)+"..."}else{cputitle=a.c_name}cpuprice="$"+a.c_price.substring(0,a.c_price.length-2)+"."+a.c_price.substring(a.c_price.length-2);$("#cpu").html('<span class="textl"><a href="'+a.c_link+'" target="_blank">'+cputitle+"</a><br/>Score: ~"+a.c_score+"<br/>Price: "+cpuprice+'</span><img src="images/products/cpu/'+a.c_asin+'.jpg" />');if(a.m_name!=null){if(a.m_name.length>40){mobotitle=a.m_name.substring(0,40)+"..."}else{mobotitle=a.m_name}moboprice="$"+a.m_price.substring(0,a.m_price.length-2)+"."+a.m_price.substring(a.m_price.length-2);$("#mobo").html('<img src="images/products/mobo/'+a.m_asin+'.jpg" /> <a href="'+a.m_link+'" target="_blank">'+mobotitle+"</a><br/>Socket "+a.m_socket+"<br/>Price: "+moboprice)}else{$("#mobo").html('<img src="images/builder/mobo_small.png" />Sorry, we couldn\'t find a compatible motherboard.<br/><a target="_blank" href="http://www.amazon.com/gp/redirect.html?camp=2025&creative=386001&location=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fsearch%3Fkeywords%3D'+a.c_socket+' motherboard%2B%26url%3Dsearch-alias%253Delectronics&linkCode=xm2&tag=citeomati-20&SubscriptionId=AKIAJILVKG4KQWV4AZ5A">Search for Socket '+a.c_socket+" Motherboards</a>");a.m_price=0}ramprice="$"+a.r_price.substring(0,a.r_price.length-2)+"."+a.r_price.substring(a.r_price.length-2);$("#ram").html('<span class="textl"><a href="'+a.r_link+'" target="_blank">'+a.r_name+"</a><br/>Type: "+a.r_type+"<br/>Score: ~"+a.r_score+"<br/>Average Price: "+ramprice+'</span><br/><img src="images/builder/ram_small.png" />');$("#buildmid").css("padding-top",13);$("#buildmid").css("margin-bottom",-13);totalprice=parseInt(a.c_price)+parseInt(a.m_price)+parseInt(a.g_price)+parseInt(a.r_price);totalprice=totalprice.toString();totalprice=totalprice.substring(0,totalprice.length-2)+"."+totalprice.substring(totalprice.length-2);totalscore=parseInt(a.c_score)+parseInt(a.r_score)+parseInt(a.g_score);$("#buildmid").html("<p>Price:<br/><strong>$"+totalprice+"</strong><br/>NovaBench Score:<br/>~<strong>"+totalscore+"</strong></p>")}}$(function(){$("#dialog-err").dialog({modal:true,autoOpen:false,buttons:{Ok:function(){$(this).dialog("close")}}});$("#dialog-info").dialog({autoOpen:false,});$("#slide").slider();$("div.slide").slider().linkedSliders({total:100,policy:"next"});$("div.slide").slider().bind("slidestop",function(a,b){$("#settings").find("input:radio:checked").removeProp("checked");$("#radio").buttonset("refresh")});$("div.slide:first").slider("value",33);$("div.slide:eq(1)").slider("value",33);$("#radio").buttonset();$("#radio1").attr("checked","checked");$("#radio").buttonset("refresh");$("#buildit").button()});function preset(a){if(a==0){$("div.slide:first").slider("value",33);$("div.slide:eq(1)").slider("value",33)}else{$("div.slide:first").slider("value",50);$("div.slide:eq(1)").slider("value",50)}}function info(){$("#dialog-info").dialog("open")}function buildpc(){budget=parseInt(document.forms[0].budget.value,10);if(!budget||budget<200){alert("Your budget must be greater than $200");return false}$("#buildmid").html('<p><img src="images/loader_small.gif" /> Building PC...</p>');http.open("get","http://novabench.com/data/builder.php?b="+document.forms[0].budget.value+"&c="+$("div.slide:eq(0)").slider("value")+"&r="+$("div.slide:eq(1)").slider("value")+"&g="+$("div.slide:eq(2)").slider("value")+"&gp="+document.forms[0].gpupref.value+"&cp="+document.forms[0].cpupref.value,true);http.onreadystatechange=handle;http.send(null);return false};
