CC.Tool={setCompareTextboxFocus:function(){$$("#compare_box .autocompleter").each(function(A){A.addEvent("focus",function(){if(A.value=="School name"){A.value=""}});A.addEvent("blur",function(){if(A.value==""){A.value="School name"}})})},setFACTextboxFocus:function(){$$("#ccc_box .autocompleter").each(function(A){A.addEvent("focus",function(){if(A.value=="School name"){A.value=""}});A.addEvent("blur",function(){if(A.value==""){A.value="School name"}})})},noLoginFinancial:function(){var A="/tools/save_submit_data.php?name=financial";var B=new Ajax(A,{method:"post",evalScripts:true,postBody:$("financial_form"),onComplete:function(){CC.openMOOdalBox("/tools/financial_alert_ajax.php","470 100")},headers:{"If-Modified-Since":"Sat, 1 Jan 2000 00:00:00 GMT"}});B.request()},noLoginWAMC:function(){var A="/tools/save_submit_data.php?name=wamc";var B=new Ajax(A,{method:"post",evalScripts:true,postBody:$("chances_form"),onComplete:function(){CC.openMOOdalBox("/tools/wamc_alert_ajax.php","470 100")},headers:{"If-Modified-Since":"Sat, 1 Jan 2000 00:00:00 GMT"}});B.request()},goToCompareSchool:function(E){var B=$(E).toQueryString();var C="/dashboard/college_compare_ajax.php";var F=B.split("&");var A=0;for(var D=0;D<F.length;D++){if(F[D]!="school_name[]="&&F[D]!="from=college"&&F[D]!="school_name[]=School%20name"){A++}}if(A>1){E.submit()}else{CC.alertMooDalBox("Please enter school name to compare")}return false},goToFinancial:function(E){var B=$(E).toQueryString();var C="/workspace/financial_calc.inc.php";var F=B.split("&");var A=0;for(var D=0;D<F.length;D++){if(F[D]!="school_name[]="&&F[D]!="from=college"&&F[D]!="school_name[]=School%20name"){A++}}if(A>0){CC.loadContent($("left_content_body"),C+"?"+B)}else{CC.alertMooDalBox("Please enter one or more schools to proceed.")}return false},loadCollegeBoundWindow:function(A){var C="/collegebound/index.php?cb_link="+escape(A);var B=window.open(C,"collegebound","toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=875,height=450,left=100,top=200");if(!B){alert("Please disable your browsers pop-up window blocker to proceed.")}B.focus()}};CC.Tool.WAMC={inputArray:[{elID:"sat_verbal",text:"SAT VERBAL"},{elID:"sat_math",text:"SAT MATH"},{elID:"sat_writing",text:"SAT WRITING"}],init:function(){this.inputArray.each(function(A){$(A.elID).addEvent("focus",function(){$(this).value=""})})},onSubmitWAMCForm:function(){var C=200;var A=800;for(var B=0;B<this.inputArray.length;B++){if(this.validate_score(CC.Tool.WAMC.inputArray[B].elID,C,A,false)){}else{alert("score must be between 200 - 800 ");return false}}return true},validate_score:function(B,A,D,C){if(C){if($(B).value==""){return true}}else{if($(B).value==""){return false}}if(($(B).value>=parseInt(A))&&($(B).value<=parseInt(D))){return true}else{return false}}};CC.Tool.FinancialCalc={init:function(){new Tips($$(".label"),{fixed:true});this.registerEvents();this.calculateTotalsForAllColleges()},submitFinancialForm:function(B){var A="/tools/financial_aid_result.php";CC.postContent("left_content_body",A,null,$(B));return false},registerEvents:function(){$$(".financial-calc input.amount").each(function(A){A.value=CC.Tool.FinancialCalc.formatAmount(A.value);if(!A.readOnly){A.addEvent("blur",function(){if(CC.Tool.FinancialCalc.validateAmount(A.value)){A.value=CC.Tool.FinancialCalc.formatAmount(A.value);CC.Tool.FinancialCalc.calculateTotalsForAllColleges()}else{CC.alertMooDalBox("Invalid number");A.select();A.focus()}});A.addEvent("focus",function(){A.value=CC.Tool.FinancialCalc.unformatAmount(A.value);A.select()})}});$$(".financial-calc select").each(function(A){A.addEvent("change",function(){CC.Tool.FinancialCalc.calculateTotalsForAllColleges()})});$$(".financial-calc input.radio").each(function(A){A.addEvent("change",function(){CC.Tool.FinancialCalc.calculateTotalsForAllColleges()})})},checkLivingOnOffCampus:function(B){var A=window.ie?"block":"table-row";if($("liveOnCampus_"+B).checked){this.enableCalculate($("roomOnCampus_"+B),true);this.enableCalculate($("transportOnCampus_"+B),true);this.enableCalculate($("transportOffCampus_"+B),false);this.enableCalculate($("rent_"+B),false);this.enableCalculate($("utilities_"+B),false);this.enableCalculate($("telecom_"+B),false);$("roomOnCampus_"+B).value=CC.Tool.FinancialCalc.formatAmount($("roomOnCampus_hide_"+B).value);$("transportOnCampus_"+B).value=CC.Tool.FinancialCalc.formatAmount($("transportOnCampus_hide_"+B).value);$("transportOffCampus_"+B).value=CC.Tool.FinancialCalc.formatAmount(0);$("rent_"+B).value=CC.Tool.FinancialCalc.formatAmount(0);$("utilities_"+B).value=CC.Tool.FinancialCalc.formatAmount(0);$("telecom_"+B).value=CC.Tool.FinancialCalc.formatAmount(0)}else{this.enableCalculate($("roomOnCampus_"+B),false);this.enableCalculate($("transportOnCampus_"+B),false);this.enableCalculate($("transportOffCampus_"+B),true);this.enableCalculate($("rent_"+B),true);this.enableCalculate($("utilities_"+B),true);this.enableCalculate($("telecom_"+B),true);$("roomOnCampus_"+B).value=CC.Tool.FinancialCalc.formatAmount(0);$("transportOnCampus_"+B).value=CC.Tool.FinancialCalc.formatAmount(0);$("transportOffCampus_"+B).value=CC.Tool.FinancialCalc.formatAmount($("transportOffCampus_hide_"+B).value);$("rent_"+B).value=CC.Tool.FinancialCalc.formatAmount($("rent_hide_"+B).value);$("utilities_"+B).value=CC.Tool.FinancialCalc.formatAmount($("utilities_hide_"+B).value);$("telecom_"+B).value=CC.Tool.FinancialCalc.formatAmount($("telecom_hide_"+B).value)}},enableCalculate:function(B,A){if(A){if(B.hasClass("disable_calculate")){B.removeClass("disable_calculate")}B.addClass("enable_calculate")}else{if(B.hasClass("enable_calculate")){B.removeClass("enable_calculate")}B.addClass("disable_calculate")}},validateAmount:function(A){return !isNaN(A.toString().replace(/,/g,""))},formatAmount:function(A){if(A==""){A="0"}return new Number(A.toString().replace(/,/g,"")).numberFormat("#,#.##")},unformatAmount:function(B){var A=new Number(B.replace(/,/g,""));return A},calculateMonthsNotStudy:function(B){var C=$("monthsStudying_"+B).selectedIndex;var A=12-C;$("monthsOffTime_"+B).selectedIndex=A},calculateTotals:function(B){this.calculateMonthsNotStudy(B);var D=0;D+=this.unformatAmount($("currentSavings").value)/$("years_"+B).getValue();D+=this.unformatAmount($("familyAssistance").value)/$("years_"+B).getValue();D+=$("monthsStudying_"+B).getValue()*this.unformatAmount($("monthlyIncomeStudying_"+B).value);D+=$("monthsOffTime_"+B).getValue()*this.unformatAmount($("monthlyIncomeOffTime_"+B).value);D+=this.unformatAmount($("loansBursaries_"+B).value);$("totalAnnualIncomes_"+B).value=this.formatAmount(D);var A=0;A+=this.unformatAmount($("tuitionOnCampus_"+B).value);if($("liveOnCampus_"+B).checked){A+=this.unformatAmount($("roomOnCampus_"+B).value);A+=this.unformatAmount($("transportOnCampus_"+B).value)}else{A+=this.unformatAmount($("transportOffCampus_"+B).value)}if($("liveOffCampus_"+B).checked){A+=12*this.unformatAmount($("rent_"+B).value);A+=12*this.unformatAmount($("utilities_"+B).value);A+=12*this.unformatAmount($("telecom_"+B).value)}else{}A+=12*this.unformatAmount($("automotive_"+B).value);A+=12*this.unformatAmount($("groceries_"+B).value);A+=12*this.unformatAmount($("personalCare_"+B).value);A+=12*this.unformatAmount($("clothing_"+B).value);A+=12*this.unformatAmount($("health_"+B).value);A+=12*this.unformatAmount($("entertainment_"+B).value);A+=this.unformatAmount($("parking_"+B).value);A+=this.unformatAmount($("travelSpring_"+B).value);A+=this.unformatAmount($("travelHometown_"+B).value);$("totalAnnualCosts_"+B).value=this.formatAmount(A);var C=D-A;$("annualNet_"+B).value=this.formatAmount(C);$("annualNet_"+B).setStyle("color",C<0?"red":"green")},calculateTotalsForAllColleges:function(){$$(".financial-calc td.college-name img").each(function(B){var A=B.id.split("_")[1];CC.Tool.FinancialCalc.calculateTotals(A)})}};CC.Tool.Compare={init:function(){var B=new Array(1,2,4,9,12);for(var A=0;A<B.length;A++){$("category_name_"+B[A]).getChildren()[0].getChildren()[0].checked=true}this.submitCompare(false);this.initOnCheckbokChange()},initOnCheckbokChange:function(){$$(".showme").each(function(A){A.addEvent("click",function(){setTimeout("CC.Tool.Compare.submitCompare(false)",500)})})},submitCompare:function(C){var D=false;$$(".category_name").each(function(E){var F=E.getChildren()[0].getChildren()[0];if(F.checked){D=true}});var A=$("compare_form").toQueryString();var B="/dashboard/do_compare_ajax.php";if(!D){CC.alertMooDalBox("Please select at lease one category")}else{if(C){CC.loadContent($("compare_college_category"),B+"?"+A,this.hideControlpanel)}else{CC.loadContent($("compare_college_category"),B+"?"+A)}}},hideControlpanel:function(){var A=$("controlpanel_arrow");if(A.hasClass("controlpanel_arrow_expand")){A.removeClass("controlpanel_arrow_expand");A.title="Collapse";$("controlpanel_body").setStyle("display","block")}else{A.addClass("controlpanel_arrow_expand");$("controlpanel_body").setStyle("display","none");A.title="Expand"}},showCategory:function(){$$(".category_name").each(function(A){var B=A.getChildren()[0].getChildren()[0];if(B.checked){$$(".category_"+B.value).each(function(C){if(navigator.appName=="Microsoft Internet Explorer"){C.setStyle("display","block")}else{C.setStyle("display","table-row")}})}else{$$(".category_"+B.value).each(function(C){C.setStyle("display","none")})}});CC.refreshFlexcroll()}};