CC.Dashboard={accountID:"",mainContentID:"left_content_body",savedCollegeID:"saved_college",currentContent:null,MAX_COLLEGES_TO_COMPARE_FINANCIAL:3,MAX_COLLEGES_TO_COMPARE:3,initialize:function(A){if(A){this.accountID=A}},reload:function(){var A="/dashboard/main_content.inc.php";CC.loadContent($(CC.Dashboard.mainContentID),A);this.currentContent=null},reloadSavedCollege:function(){var B=true;if(arguments.length>0){B=arguments[0]}var A="/dashboard/saved_colleges_data.inc.php";CC.loadContent($(CC.Dashboard.savedCollegeID),A);if(B&&this.currentContent=="breakout"){CC.Dashboard.SavedCollege.loadBreakout()}},goToFinancialCalculator:function(E){var B=$(E).toQueryString();var C="/workspace/financial_calc.inc.php";var G="";var F=B.split("&");var A=0;for(var D=0;D<F.length;D++){if(F[D]!="fcColleges[]="){A++;G+=F[D]+"&"}}if(A==0){CC.alertMooDalBox("Please select at least one college.")}else{if(A>CC.Dashboard.MAX_COLLEGES_TO_COMPARE_FINANCIAL){CC.alertMooDalBox("Please select no more than "+CC.Dashboard.MAX_COLLEGES_TO_COMPARE_FINANCIAL+" colleges.")}else{new Ajax("/common/ajax/validate_college_name_ajax.php?"+B,{method:"get",onComplete:function(){if(this.response.text!=""){var J=Json.evaluate(this.response.text);if(J.successful){CC.loadContent($(CC.Dashboard.mainContentID),C+"?"+G)}else{var H=J.message;for(var I=0;I<3;I++){$("fcColleges"+I).setStyle("background-color","#FFF")}for(var I=0;I<H.length;I++){$("fcColleges"+H[I]).setStyle("background-color","#FBE3E4");$("fcColleges"+H[I]).focus();var K="Oops! We didn't recognize this school name. Please type in the first 3 letters of a college name, then select from the options presented.";CC.alertMooDalBox(K)}}}}}).request()}}return false},goToHighschoolPage:function(B,A){if(A&&A!=""){CC.Highschool.loadGroup(B,A)}else{CC.Highschool.load(B)}},goToCompareSchool:function(E){var B=$(E).toQueryString();var C="/dashboard/college_compare_ajax.php";var G="";var F=B.split("&");var A=0;for(var D=0;D<F.length;D++){if(F[D]!="fcColleges[]="){A++;G+=F[D]+"&"}}if(A<2){CC.alertMooDalBox("Please select at two or more colleges to compare.")}else{if(A>CC.Dashboard.MAX_COLLEGES_TO_COMPARE){CC.alertMooDalBox("Please select no more than "+CC.Dashboard.MAX_COLLEGES_TO_COMPARE+" colleges.")}else{new Ajax("/common/ajax/validate_college_name_ajax.php?"+B,{method:"get",onComplete:function(){if(this.response.text!=""){var J=Json.evaluate(this.response.text);if(J.successful){CC.loadContent($(CC.Dashboard.mainContentID),C+"?"+G)}else{var H=J.message;for(var I=0;I<3;I++){$("fcColleges"+I).setStyle("background-color","#FFF")}for(var I=0;I<H.length;I++){$("fcColleges"+H[I]).setStyle("background-color","#FBE3E4");$("fcColleges"+H[I]).focus();var K="Oops! We didn't recognize this school name. Please type in the first 3 letters of a college name, then select from the options presented.";CC.alertMooDalBox(K)}}}}}).request()}}return false}};CC.Dashboard.SavedCollege={load:function(B){CC.Dashboard.BreakoutCollege.clear();CC.Dashboard.currentContent="view";var A="/workspace/view_college.inc.php?college_id="+B;CC.loadContent($(CC.Dashboard.mainContentID),A)},loadBreakout:function(){CC.Dashboard.BreakoutCollege.clear();CC.Dashboard.currentContent="breakout";var A="/workspace/breakout_college.inc.php";CC.loadContent($(CC.Dashboard.mainContentID),A)}};CC.Dashboard.BreakoutCollege={colleges:[],categories:[],drops:[],currentDrag:null,uncategoryBox:null,nloaded:0,clear:function(){this.colleges=[];this.categories=[];this.drops=[];this.currentDrag=null;this.uncategoryBox=null},initialize:function(){new Tips($$(".tip"),{showDelay:400,hideDelay:400,fixed:true});this.uncategoryBox=$("uncategory_box");this.uncategoryDropArea=this.uncategoryBox.getLast();this.uncategoryBox.setStyles({height:"0px",margin:"0px",padding:"0px"});this.uncategoryDropArea.setStyles({height:"0px",margin:"0px",padding:"0px"});$$(".college_drop_area").each(function(B,A){CC.Dashboard.BreakoutCollege.categories[A]=B;B.category=$E("input",B).value;var C=$ES(".item_drop_area",B);C.each(function(E){var F=$E(".item_breakout_college",E);if(F){var D=$E("input",F);F.collegeID=D.value;F.area=E;F.location={};F.location.top=F.getTop();F.location.left=F.getLeft();E.setStyle("height",F.offsetHeight);E.drag=F}})});$$(".item_breakout_college").each(function(A){new Drag.Move(A,{droppables:$$(".item_drop_area")});A.addEvents({mousedown:function(B){if(CC.Dashboard.BreakoutCollege.currentDrag!=null){CC.Dashboard.BreakoutCollege.currentDrag.removeClass("item_breakout_college_hover")}CC.Dashboard.BreakoutCollege.currentDrag=this;this.addClass("item_breakout_college_hover")},emptydrop:function(B){if(this.area.category!=0){CC.Dashboard.BreakoutCollege.drop(this,CC.Dashboard.BreakoutCollege.uncategoryDropArea)}else{CC.Dashboard.BreakoutCollege.drop(this,this.area)}CC.Dashboard.BreakoutCollege.currentDrag=null}});A.fx=A.effects({transition:Fx.Transitions.Back.easeOut})});$$(".item_drop_area").each(function(A,B){A.addEvents({over:function(C,D){this.addClass("item_drop_area_hover")},leave:function(C,D){this.removeClass("item_drop_area_hover")},drop:function(C,D){this.removeClass("item_drop_area_hover");CC.Dashboard.BreakoutCollege.drop(C,this);CC.Dashboard.BreakoutCollege.currentDrag=null}});A.fx=A.effects({transition:Fx.Transitions.Back.easeOut})});this.refresh();window.addEvent("resize",function(){if(CC.Dashboard.BreakoutCollege.uncategoryBox){CC.Dashboard.BreakoutCollege.refresh()}})},inject:function(B,A){if(A.drag&&A.drag.location.top>B.location.top){B.area.injectAfter(A)}else{B.area.injectBefore(A)}},drop:function(A,B){if(A.area!=B){this.inject(A,B);this.refresh()}else{this.setDragLocation(A,A.location)}if(this.currentDrag!=null){this.currentDrag.removeClass("item_breakout_college_hover")}},setDragLocation:function(B,A){B.fx.start({top:A.top,left:A.left})},refresh:function(){var C=this.uncategoryDropArea.getLeft()+this.uncategoryDropArea.getStyle("padding-left").toInt();for(var E=0;E<this.categories.length;E++){var A=this.categories[E];var I=A.getTop();var G=0;var H=$ES(".item_drop_area",A);for(var D=0;D<H.length;D++){var B=H[D];var F=$E(".item_breakout_college",B);if(F&&F.offsetHeight>0){G+=B.getStyle("border-top-width").toInt();G+=B.getStyle("padding-top").toInt();F.location.top=I+G;F.location.left=C;this.setDragLocation(F,F.location);G+=F.offsetHeight;G+=B.getStyle("padding-bottom").toInt();G+=B.getStyle("border-bottom-width").toInt();B.setStyle("height",F.offsetHeight)}else{G+=B.offsetHeight}}A.setStyle("height",G)}},register:function(B,A){college={};college.id=B;college.element=$(A);this.colleges.push(college)},compare:function(A){this.nloaded=0;this.colleges.each(function(B){if(A){B.element.setHTML("Loading ...");CC.loadContent(B.element,"/common/ajax/college_stat.php?stat_id="+A+"&college_id="+B.id,function(){CC.Dashboard.BreakoutCollege.nloaded++;if(CC.Dashboard.BreakoutCollege.nloaded==CC.Dashboard.BreakoutCollege.colleges.length){CC.Dashboard.BreakoutCollege.refresh()}},false)}else{B.element.setHTML("");CC.Dashboard.BreakoutCollege.nloaded++;if(CC.Dashboard.BreakoutCollege.nloaded==CC.Dashboard.BreakoutCollege.colleges.length){CC.Dashboard.BreakoutCollege.refresh()}}})},updateAll:function(){var A="";$$(".college_drop_area").each(function(C){var B=$ES(".item_breakout_college",C);B.each(function(E,D){A+="&college_ids[]="+E.collegeID;A+="&categories[]="+C.category;A+="&ordinals[]="+(D+1)})});new Ajax("/common/ajax/workspace.php?action=update_all_college"+A,{method:"get",onComplete:function(){CC.Dashboard.reloadSavedCollege(false)}}).request()}};CC.Dashboard.Media={mediaListIDs:["media_picture_list","media_video_list","media_articles_list"],initialize:function(){this.loadMyList()},loadMyList:function(){if(this.loadMyList.arguments.length>0){var C=this.loadMyList.arguments[0];CC.loadContent(this.mediaListIDs[C-1],"/dashboard/media_list.inc.php?type="+C+"&boxId="+this.mediaListIDs[C-1])}else{for(var B=0;B<this.mediaListIDs.length;B++){var D=this.mediaListIDs[B];var A="/dashboard/media_list.inc.php?type="+(B+1)+"&boxId="+this.mediaListIDs[B];CC.loadContent($(D),A)}}},remove:function(A){CC.ConfirmDialog.show("Are you sure that you want to delete this media",function(){var B=new Ajax("/common/ajax/media.php?action=remove",{method:"get",data:Object.toQueryString({id:A}),onComplete:function(){if(this.response.text!=""){var C=Json.evaluate(this.response.text);if(C.successful){CC.Dashboard.Media.loadMyList(C.media_type)}}CC.Dashboard.Media.slider.show()}});B.request()})}};CC.Dashboard.Ambassador={showInviteBox:function(){MOOdalBox.options.evalScripts=true;MOOdalBox.open("/dashboard/ambassador_invite.php","","500 450")},sendInvitation:function(A){$("email_sending").setStyle("visibility","visible");var B=new Ajax("/dashboard/ambassador_invite.php",{method:"post",data:$(A).toQueryString(),onComplete:function(){$("email_sending").setStyle("visibility","hidden");if(this.response.text!=""){var C=Json.evaluate(this.response.text);if(C.successful){$("email_error").setStyle("display","none");$("email_button").setStyle("display","none");$("email_success").setHTML(C.message).setStyle("display","block");$("email_close").setStyle("display","block")}else{$("email_success").setStyle("display","none");$("email_error").setHTML(C.message).setStyle("display","block")}}}});B.request();return false}};CC.Dashboard.Feed={init:function(){$("all_feeds").addEvent("click",function(){if(CC.Dashboard.Feed.isAlreadyClick($("all_feeds"))){return }CC.Dashboard.Feed.getAllFeed();CC.Dashboard.Feed.tabClick($("all_feeds"))});$("college_feeds").addEvent("click",function(){if(CC.Dashboard.Feed.isAlreadyClick($("college_feeds"))){return }CC.Dashboard.Feed.getCollegeFeed();CC.Dashboard.Feed.tabClick($("college_feeds"))});$("friend_feeds").addEvent("click",function(){if(CC.Dashboard.Feed.isAlreadyClick($("friend_feeds"))){return }CC.Dashboard.Feed.getFreindFeed();CC.Dashboard.Feed.tabClick($("friend_feeds"))});$("all_feeds").addClass("feed_tab_click");CC.Dashboard.Feed.getAllFeed()},getAllFeed:function(){CC.showAjaxLoading($("feed_content"));var A=new Ajax("/dashboard/all_feed_ajax.php",{method:"get",update:$("feed_content"),onComplete:function(){CC.showAjaxLoading($("hideAjaxLoading"))}});A.request()},getFreindFeed:function(){CC.showAjaxLoading($("feed_content"));var A=new Ajax("/dashboard/friend_feeds_ajax.php",{method:"get",update:$("feed_content"),onComplete:function(){CC.showAjaxLoading($("hideAjaxLoading"))}});A.request()},getCollegeFeed:function(){CC.showAjaxLoading($("feed_content"));var A=new Ajax("/dashboard/college_feed_ajax.php",{method:"get",update:$("feed_content"),onComplete:function(){CC.showAjaxLoading($("hideAjaxLoading"))}});A.request()},tabClick:function(A){if($("all_feeds").hasClass("feed_tab_click")){$("all_feeds").removeClass("feed_tab_click")}if($("college_feeds").hasClass("feed_tab_click")){$("college_feeds").removeClass("feed_tab_click")}if($("friend_feeds").hasClass("feed_tab_click")){$("friend_feeds").removeClass("feed_tab_click")}A.addClass("feed_tab_click")},isAlreadyClick:function(A){if(A.hasClass("feed_tab_click")){return true}else{return false}}};