$(document).ready(function(){$(".fax-number").each(function(){$(this).append("1-240-220-8961")});$("#email-placeholder").append('<a href="mailto:info&#64;writemyessay.com">info&#64;writemyessay.com</a>');$("#summary-container").show();function d(){if($("#faxRadio").is(":checked")){$("#uploadOption").hide();$("#emailOption").hide();$("#faxOption").show()}if($("#uploadRadio").is(":checked")){$("#faxOption").hide();$("#emailOption").hide();$("#uploadOption").show()}if($("#emailRadio").is(":checked")){$("#uploadOption").hide();$("#faxOption").hide();$("#emailOption").show()}if($("#noneRadio").is(":checked")){$("#uploadOption").hide();$("#faxOption").hide();$("#emailOption").hide()}}d();$("#uploadRadio").click(d);$("#faxRadio").click(d);$("#noneRadio").click(d);$("#emailRadio").click(d);function b(){var i=$("#amount_of_words").val();if(i.length>0){i=i.replace(",","")}var g=$("#amount_by_words").is(":checked");var h=$("#amount_by_pages").is(":checked");if(i==""||(!g&&!h)){return -1}var f=parseInt(i);if(isNaN(f)){return -1}if(h){return f}if(g){return Math.ceil(f/WORD_COUNT_PER_PAGE)}}function a(){var g=0;var n=$("input[name=plan_id]:checked");var k=0;var m=0;var i="";var s="";var o=new Array();if(n.length>0){k=n.val();m=n.attr("cost");i=$("#plan-time-"+k).text();s=n.attr("days")}if(i==""){$("#summary-rate").html("Not specified");$("#summary-time").html("Not specified")}else{$("#summary-rate").html("$"+m+" ("+s+")");$("#summary-time").html(i)}var h=b();var f="Not specified";if(h!=-1){if(h<3){f="Warning: less 3 pages"}else{f=h+" Page(s)"}}$("#summary-pages").html(f);var j=0;var l=false;if($("#citation_yes").is(":checked")&&$("#copies_yes").is(":checked")){l=true;var r=$("#amount_of_citation").val();var q=parseInt(r);if(!isNaN(q)){j=q*3.95}$("#summary-citations-container").show()}else{$("#summary-citations-container").hide()}$("#summary-citations").html(j==0?"Unavailable":"$"+j.toFixed(2));var p=0;f="";if(i!=""&&h>2){p=h*m+j;$("#total_cost_store").val(p.toFixed(2));f="$"+p.toFixed(2)}else{f="Unavailable"}if(l&&j==0){$("#total-help-container").show()}else{$("#total-help-container").hide()}$("#summary-total").html(f)}function e(f){var l=$("#amount_of_words").val();l=l.replace(",","");var j=$("#amount_by_words").is(":checked");var o=$("#amount_by_pages").is(":checked");var i="Enter the number of pages or words";var k=0;var h=0;var g="";if(l!=""){var m=parseInt(l);if(isNaN(m)){g="Please enter a number of pages or words."}else{if(!j&&!o){g="Please choose  would you like pages or words?"}}}if(g==""&&l!=""){var n=words2=parseInt(l);if(o){words2=n*WORD_COUNT_PER_PAGE;h=n;k=words2}if(j){words2=Math.ceil(n/WORD_COUNT_PER_PAGE);h=words2;k=n}g="";if(o&&n>100){g="Whoa! Did you mean <strong>"+n+" pages</strong> or did you mean <strong>"+n+" words</strong>? If you meant <strong>"+n+"</strong> pages, don't change anything. If you meant <strong>"+n+"</strong> words, please select &laquo;Words&raquo; instead of &laquo;Pages&raquo;."}if(o&&n<3){g="Please enter a minimum of three pages.  Each page has approximately "+WORD_COUNT_PER_PAGE+" words."}if(j&&n<WORD_COUNT_PER_PAGE*3){g="Please enter a minimum of "+(WORD_COUNT_PER_PAGE*3)+" words (3 pages). Each page has approximately "+WORD_COUNT_PER_PAGE+" words."}$("#amount_pages_description").html(h+" Pages ~ "+k+" Words")}else{$("#summary-pages").html("0 Pages ~ 0 Words")}if(g!=""){$("#amount_pages_help span").html(g);$("#amount_pages_help").show()}else{$("#amount_pages_help").hide();$("#amount_pages_help span").html(i)}a()}function c(h){var g=$("#citation_yes").is(":checked");var f=$("#citation_no").is(":checked");var i=(!g&&!f)||f;if(i){$("#amount-of-citation-container").hide();$("#citation-style-container").hide();$("#citation-copies-container").hide()}else{$("#amount-of-citation-container").show();$("#citation-style-container").show();$("#citation-copies-container").show();$("#amount_of_citation").keyup()}a()}if($.browser.msie){$("#citation_yes").click(c);$("#citation_no").click(c);$("#copies_yes").click(a);$("#copies_no").click(a);$("#amount_by_words").click(e);$("#amount_by_pages").click(e);$("input[name=plan_id]").click(a)}else{$("#citation_yes").change(c);$("#citation_no").change(c);$("#copies_yes").change(a);$("#copies_no").change(a);$("#amount_by_words").change(e);$("#amount_by_pages").change(e);$("input[name=plan_id]").change(a)}$("#amount_of_words").keyup(e);$("#amount_of_citation").keyup(a);$("#amount_of_words").keyup(a);c();$("#amount_of_citation").keyup();$("#amount_of_words").keyup();$("#add-material-none-label").click(function(){$("#noneRadio").attr("checked","checked");d()});$("#add-material-upload-label").click(function(){$("#uploadRadio").attr("checked","checked");d()});$("#add-material-fax-label").click(function(){$("#faxRadio").attr("checked","checked");d()});$("#add-material-email-label").click(function(){$("#emailRadio").attr("checked","checked");d()});$("#proceed-button").click(function(){var f=new Array();if($("#description").val().length==0){f.push("Please enter an essay description.")}if($("#amount_of_words").val().length==0){f.push("Please specify the number of pages or words for your order.")}if($("#citation_yes").is(":checked")){if($("#amount_of_citation").val().length==0){f.push("Please enter a number of amount of citations.")}if($("#citation_style").val()==""){f.push("Please select the citation style from list.")}}if($("input[name=plan_id]:checked").length==0){f.push("Please specify when you would like the essay delivered.")}if(f.length!=0){alert(f.join("\n"));return false}return true})});