function validate_required(d,b){with(d){return value==null||value==""?(alert(b),!1):!0}}function validate_email(a,c){var b=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;if(b.test(a)==false){alert(c);return false}else{return true}}function validate_refform(d){with(d){if(validate_required(fn,"Your firstname must be filled out!")==!1){return fn.focus(),!1}if(validate_required(sn,"Your surname must be filled out!")==!1){return sn.focus(),!1}if(validate_required(add1,"The first line of your address must be filled out!")==!1){return add1.focus(),!1}if(validate_required(tn,"Your town must be filled out!")==!1){return tn.focus(),!1}if(validate_required(cnty,"Your county must be filled out!")==!1){return cnty.focus(),!1}if(validate_required(pc,"Your postcode must be filled out!")==!1){return pc.focus(),!1}if(validate_required(tel,"Your telephone number must be filled out!")==!1){return tel.focus(),!1}if(validate_required(email,"Your email address must be filled out, you'll need this to log in.")==!1){return email.focus(),!1}if(validate_required(pw1,"Your password must be filled out, you'll need this to log in.")==!1){return pw1.focus(),!1}if(validate_required(pw2,"Please type your password again.")==!1){return pw2.focus(),!1}}}$(document).ready(function(){function o(c,b){$(c.target).animate({left:b+"px"},function(){o(c,-b)})}function q(b){RegExp.multiline=!0;return b.replace(/\s/g,"").length==0?!0:!1}function k(b){tempvar=b}function h(a){r=50;if($("#make").val()!="0"){switch($("#make").val()){case"Apple":r+=60;break;case"Alienware":r+=20;break;case"Dell":r+=20;break;case"Sony":r+=35;break;case"Toshiba":r+=10;break;case"Advent":r-=15;break;case"Philips":r-=30;break;case"Other":r-=20;break;case"Emachines":r-=30;break;case"Fujitsu-Siemens":r-=25;break;case"Packard Bell":r-=15;break;case"Gateway":r-=15;break;case"IBM":r-=15;break;case"NEC":r-=15;break;case"Panasonic":r-=15}}else{return alert("Please select a make."),$("#make").focus(),!1}if($("#processor").val()!="0"){switch($("#processor").val()){case"amdTurion":r-=20;break;case"amdTurionX2":r+=5;break;case"amdAthlonX2":r+=5;break;case"amdSempron":r-=20;break;case"amdDuron":r-=20;break;case"intelAtom":r-=25;break;case"intelCoreDuo":r+=10;break;case"intelCore2Duo":r+=20;break;case"intelCoreI3":r+=100;break;case"intelCoreI5":r+=150;break;case"intelCoreI7":r+=220;break;case"intelCeleronM":r-=20;break;case"intelPentiumM":r-=40;break}}else{return alert("Please select a processor."),$("#processor").focus(),!1}if($("#hdd").val()!="0"){switch($("#hdd").val()){case"60gb":r-=10;break;case"80gb":r+=8;break;case"100gb":r+=13;break;case"120gb":r+=18;break;case"160gb":r+=23;break;case"250gb":r+=28;break;case"320gb":r+=33;break;case"360gb":r+=43;break;case"500gb":r+=53}}else{return alert("Please select a hard drive size."),$("#hdd").focus(),!1}if($("#ram").val()!="0"){switch($("#ram").val()){case"512mb":r-=35;break;case"1gb":r-=10;break;case"2gb":r+=5;break;case"3gb":r+=10;break;case"4gb":r+=15}}else{return alert("Please select a memory (RAM) size."),$("#ram").focus(),!1}if($("#ssize").val()!="0"){switch($("#ssize").val()){case"17":r+=r*0.15}}else{return alert("Please select a screen size."),$("#ssize").focus(),!1}if($("#condition").val()!="0"){switch($("#condition").val()){case"Excellent":r+=5;break;case"Good":r+=5}}else{return alert("Please select a condition."),$("#condition").focus(),!1}if($("#originalMedia").val()!="0"){switch($("#originalMedia").val()){case"yes":r+=5}}else{return alert("Please select whether you have the original media."),$("#originalMedia").focus(),!1}if($("#opticalDrive").val()!="0"){switch($("#opticalDrive").val()){case"dvd":r+=10;break;case"cd":r+=5;break;case"no":r-=15}}else{return alert("Please select an optical drive."),$("#opticalDrive").focus(),!1}$("#qarea").html("<h2>We'll pay <span id='prce'>\u00a3"+r+"</span> for your laptop</h2><p>To accept this quote, just fill out your details below, pick a date for the courier to collect your laptop and hit the 'Send' button!</p>");$("#price").val(r);$("#kind").val("quoted");$("#custdetails").show();$("#purchase").show();$("#teesandcees").show();$("#submitbut").show();n=new Date(m.getTime()+86400000);function b(c){dmy=c.getDate()+"-"+(c.getMonth()+1)+"-"+c.getFullYear();if($.inArray(dmy,a)==-1){return[true,""]}else{return[false,"","Unavailable"]}}$("#datepicker").datepicker({minDate:new Date(n.getFullYear(),n.getMonth(),n.getDate()),constrainInput:true,minDate:+1,beforeShowDay:b,onSelect:function(c){l=c}})}$("#dammissdiv").hide();$("#custdetails").hide();$("#couraddy").hide();$("#purchase").hide();$("#teesandcees").hide();$("#submitbut").hide();$("#poordescdiv").hide();$(".help").hide();$(".wobble").hover(function(b){$(this).stop().animate({left:"-5px"},120,function(){o(b,5)})},function(){$(this).stop().animate({left:"0"},120)});$("#otheraddychk").change(function(){$(this).attr("checked")?$("#couraddy").slideDown():$("#couraddy").slideUp()});$("#dammisschk").change(function(){$(this).attr("checked")?$("#dammissdiv").show():($("#dammiss").val(""),$("#dammiss").text(""),$("#dammissdiv").hide())});$(".lapvalid").click(function(){$("#qarea").html("");$("#custdetails").hide();$("#purchase").hide();$("#poordescdiv").hide();$("#teesandcees").hide();$("#submitbut").hide()});$("#dammisschk").click(function(){$("#qarea").html("");$("#custdetails").hide();$("#purchase").hide();$("#poordescdiv").hide();$("#teesandcees").hide();$("#submitbut").hide()});var r,m=new Date,n,l="nope",p=!0;$("#firstbut").click(function(){p=!0;$("#qarea").html("");$("#custdetails").hide();$("#purchase").hide();$("#poordescdiv").hide();$("#teesandcees").hide();var b=!0;$(".lapvalid").each(function(){if(q($(this).val())||$(this).val()=="0"){alert("Please select an option for "+$(this).attr("rel")+"."),$(this).focus(),p=b=!1}});b||(p=!1);$("#hdd").val()=="under60gb"&&($("#qarea").html("<h2>Sorry!</h2><p>Unfortunately your laptop is below our minimum specification and we cannot purchase your laptop.</p>"),p=!1);$("#ram").val()=="under512mb"&&($("#qarea").html("<h2>Sorry!</h2><p>Unfortunately your laptop is below our minimum specification and we cannot purchase your laptop.</p>"),p=!1);$("#condition").val()=="poor"&&($("#kind").val("tellusmore"),$("#qarea").html("<p>Unforunately due to the options you've selected we cannot give you an accurate online quote. Please fill in your details and we'll email you once one of our technicians has looked over your laptops specification.</p>"),$("#custdetails").show(),$("#poordescdiv").show(),$("#teesandcees").show(),$("#submitbut").show(),p=!1);$("#dammisschk").attr("checked")&&($("#kind").val("tellusmore"),$("#qarea").html("<p>Unforunately due to the options you've selected we cannot give you an accurate online quote. Please fill in your details and we'll email you once one of our technicians has looked over your laptops specification.</p>"),$("#custdetails").show(),$("#teesandcees").show(),$("#submitbut").show(),p=!1);$("#processor").val()=="pentiumQuadCore"&&($("#qarea").html("<h2>Wow!</h2><p>The specification you have selected is too high for us to give you a fair online-quote. Please fill out your details and one of our team will get in touch with a price.</p>"),$("#custdetails").show(),$("#teesandcees").show(),$("#submitbut").show(),p=!1);if(p){h(ud)}else{return k(),!1}});$("#submitbut").click(function(){var b=!0;$(".custvalid").each(function(){if($(this).attr("id")!="caddy2"&&$(this).attr("id")!="ctel"&&$(this).attr("id")!="chowhear"&&q($(this).val())){return alert("Please fill in your "+$(this).attr("rel")+"."),$(this).focus(),b=!1}});if(validate_email($("#cemail").val(),"Your email address is invalid")==!1){$("#cemail").focus();return false}if($("#cemail").val()!=$("#cemailtwo").val()){alert("Your email addresses do not match");$("#cemailtwo").focus();return false}if($("#chowhear").val()=="0"){return alert("Please select how you heard of us."),$("#chowhear").focus(),b=!1}if(!b){return !1}if(!$("#tccheck").is(":checked")){return alert("You must accept the terms and conditions"),b=!1}if($("#kind").val()=="quoted"){if(l=="nope"){return alert("You must select a date for collection by our courier"),$("#datepicker").focus(),b=!1}var d=new Date(l);if((m.getDay()==6||m.getDay()==7)&&d.getDay()==1){return alert("We cannot arrange for a Monday collection over the weekend, please choose a later date."),b=!1}if(d.getDay()==d.getDay()+1&&m.getHours()>13){return alert("We can only arrange next day collection before 1pm, please choose a later date."),b=!1}}$("#submitbut").val("Sending... please wait");$("#submitbut").attr("disabled","disabled");b&&$.post("syl.ajax.php",{op:"submitQuote",kind:$("#kind").val(),make:$("#make").val(),model:$("#model").val(),processor:$("#processor").val(),hdd:$("#hdd").val(),ram:$("#ram").val(),condition:$("#condition").val(),screensize:$("#ssize").val(),originalMedia:$("#originalMedia").val(),opticalDrive:$("#opticalDrive").val(),dammiss:$("#dammiss").val(),cfname:$("#cfname").val(),csname:$("#csname").val(),caddy1:$("#caddy1").val(),caddy2:$("#caddy2").val(),ctown:$("#ctown").val(),ccounty:$("#ccounty").val(),cpostcode:$("#cpostcode").val(),ctel:$("#ctel").val(),cemail:$("#cemail").val(),chowhear:$("#chowhear").val(),cpay:$("#cpay").val(),ppemail:$("#ppemail").val(),cref:$("#cref").val(),price:$("#price").val(),courier:l,otheradd:$("#otheraddychk").attr("checked"),couraddy1:$("#couraddy1").val(),couraddy2:$("#couraddy2").val(),courtown:$("#courtown").val(),courcounty:$("#courcounty").val(),courpostcode:$("#courpostcode").val(),courtel:$("#courtel").val(),cpoordesc:$("#poordesc").val(),campaign:$("#campaign").val()},function(c){if(c=="success"){window.location="thanks.php?"+$("#kind").val()}else{$("#submitbut").removeAttr("disabled");$("#submitbut").val("Failed :(")}});return !1});$(".haylp").focus(function(){var b=$(this).attr("id");$("#h"+b).fadeIn("slow")}).blur(function(){var b=$(this).attr("id");$("#h"+b).fadeOut("slow")});$("#mailsub").click(function(){$("#realname").val()==""||$("#realname").val()==" "?(alert("Please enter your name."),$("#realname").focus()):$("#mremail").val()==""||$("#mremail").val()==" "?(alert("Please enter your email address."),$("#mremail").focus()):$("#mrphone").val()==""||$("#mrphone").val()==" "?(alert("Please enter your phone number."),$("#mrphone").focus()):$("#mrhowhear").val()==""||$("#mrhowhear").val()==" "?(alert("Please select how you heard of us."),$("#mrhowhear").focus()):$("#mrsubject").val()==""||$("#mrsubject").val()==" "?(alert("Please enter your subject."),$("#mrsubject").focus()):$("#mrmessage").val()==""||$("#mrmessage").val()==" "?(alert("Please enter your message."),$("#mrmessage").focus()):q($("#mapson").val())&&$.post("syl.ajax.php",{op:"email",conname:$("#realname").val(),conmail:$("#mremail").val(),connumber:$("#mrphone").val(),conhowhear:$("#mrhowhear").val(),subject:$("#mrsubject").val(),message:$("#mrmessage").val()},function(b){var c=parseInt(b);if(c==1){alert("Thank you! Your message has been sent.")}else{alert("There was a problem. Sorry!")}});return !1});$("#webeatsend").live("click",function(b){if($("#make").val()==0){return alert("Please select a make"),b.preventDefault(),!1}else{if(q($("#model").val())){return alert("Please enter a model"),b.preventDefault(),!1}else{if($("#processor").val()==0){return alert("Please select a processor"),b.preventDefault(),!1}else{if($("#hdd").val()==0){return alert("Please select an HDD size"),b.preventDefault(),!1}else{if($("#ram").val()==0){return alert("Please select an amount of RAM"),b.preventDefault(),!1}else{if($("#ssize").val()==0){return alert("Please select your screen size"),b.preventDefault(),!1}else{if($("#condition").val()==0){return alert("Please choose a condition"),b.preventDefault(),!1}else{if($("#originalMedia").val()==0){return alert("Please select whether you have the original media"),b.preventDefault(),!1}else{if($("#opticalDrive").val()==0){return alert("Please select your optical drive"),b.preventDefault(),!1}else{if(q($("#oqprice").val())){return alert("Please enter the price you were quoted"),b.preventDefault(),!1}else{if(q($("#oqweb").val())){return alert("Please enter the address of the website your quote came from"),b.preventDefault(),!1}else{if(q($("#cfname").val())){return alert("Please enter your first name"),b.preventDefault(),!1}else{if(q($("#csname").val())){return alert("Please enter your surname"),b.preventDefault(),!1}else{if(q($("#caddy1").val())){return alert("Please enter your street and number"),b.preventDefault(),!1}else{if(q($("#ctown").val())){return alert("Please enter your town or city"),b.preventDefault(),!1}else{if(q($("#ccounty").val())){return alert("Please enter your county"),b.preventDefault(),!1}else{if(q($("#cpostcode").val())){return alert("Please enter your postcode"),b.preventDefault(),!1}else{if(q($("#cemail").val())){return alert("Please enter your email address"),b.preventDefault(),!1}else{if(q($("#chowhear").val())){return alert("Please select how you heard of us"),b.preventDefault(),!1}}}}}}}}}}}}}}}}}}}})});
