var raph=null;var shapes=[];var maxPaperWidth=800;var maxPaperHeight=650;var paperWidth=600;var paperHeight=600;var rings=[[],[],[],[],[]];var ringDistance=[50,100,150,200,250];var centerShape=null;var subjectColor=["#FADD4D","#FCD2A6","#5A8D26","#ff9900","#339900","#003300"];var showLibraryNodes=false;
var showAnswerNodes=false;var showParentNodes=true;var nowZoomed=false;var animating=false;var paperCenterX=+(paperWidth/2)-20;var paperCenterY=+(paperHeight/2)-50;var aboutLink=null;function isInternetExplorer(){var A=(document.all)?true:false;return A;}function isIPhone(){return iPhone;}function setupViewport(A){if(iPhone){paperWidth=320;
paperHeight=320;paperCenterX=+(paperWidth/2);paperCenterY=+(paperHeight/2);rings=[[],[],[],[],[]];ringDistance=[50,100,150,200,250];}else{if(A){paperWidth=756;paperHeight=756;paperCenterX=320;paperCenterY=256;rings=[[],[],[],[],[]];ringDistance=[50,100,150,200,250];}else{paperWidth=800;paperHeight=500;
paperCenterX=+(paperWidth/2)-50;paperCenterY=270;rings=[[],[],[],[],[]];ringDistance=[50,100,250,400,500];}}}$(document).ready(function(){var B=Raphael("netGraphPanel",maxPaperWidth,maxPaperHeight);if(B!=undefined&&B!=null&&B!=""){raph=B;createGraph();createNodes();setCenterShape(shapes[selectedNode]);
pickRecommendedNodes();startAnimateToDestination();if(isInternetExplorer()){setInterval("glowDriver()",1000);}else{setInterval("glowDriver()",1000);}}if(raph!=undefined&&raph!=null&&raph!=""){var A=raph.image("/prep/images/note_section.png",10,10,120,106);}});function createGraph(){setupViewport(nowZoomed);
}function resetGraph(){raph.clear();createGraph();createNodes();setCenterShape(shapes[selectedNode]);}function protoNode(){this.shortName="nameme";this.importance=1;this.description="describeme";this.velocityX=0;this.velocityY=0;this.hidden=false;this.totalDescendents=0;this.locationX=(Math.random()-0.5)*256;
this.locationY=(Math.random()-0.5)*256;this.nodeType="Proto";this.children=[];this.init=function(){this.gfx=this.createGraphic();this.colorNode();this.gfx.attr("title",this.name);setLinkCursor(this.gfx);};this.getSize=function(){return 9;};this.createGraphic=function(){this.radius=this.getSize();return raph.circle(this.locationX,this.locationY,this.radius);
};this.colorNode=function(){var A="30-#aaa-#fa3";this.gfx.attr("gradient",A);this.gfx.attr("fill-opacity",1);this.gfx.mousedown(createSelectShapeHandler(this));};}function ContentAreaNode(A){this.getSize=function(){if(this.contentCategoryType=="GOAL"){return 25;}else{if(this.contentCategoryType=="SUBJECT"){return 20;
}}return getSizeFromImportance(A.importance);};this.colorNode=function(){var G=["#CC0000","#ff0000","#ff3300","#ff9900","#339900","#003300"];var E=[0.4,0.6,0.7,0.8,0.9];var B;var F=2;var C="#888888";if(this.contentCategoryType=="GOAL"){B="#62ACD1";}else{if(this.accuracy<=0){B=C;}else{if(G.length-E.length!=1){alert("Error in data tables in color node");
}var D=0;while(D<E.length&&this.accuracy>E[D]){D++;}B=G[D];}}this.gfx.attr("fill",B);this.gfx.attr("fill-opacity",1);this.gfx.attr("stroke","#C6D7DE");this.gfx.attr("stroke-width","3");this.gfx.mousedown(createSelectShapeHandler(this));};this.createGraphic=function(){this.radius=this.getSize();return raph.circle(this.locationX,this.locationY,this.radius);
};this.children=[];this.id=A.id;this.parentId=A.parentId;this.name=A.name;this.shortName=A.shortName;this.description=A.description;this.importance=A.importance;this.accuracy=A.accuracy;this.certainty=A.certainty;this.recommend=A.recommend;this.totalCorrect=A.totalCorrect;this.totalWrong=A.totalWrong;
this.nodeType="ContentArea";this.contentAreaId="CA"+A.id;this.contentCategoryType=A.contentType;this.lessonActivityId=A.lessonActivityId;this.exerciseActivityId=A.exerciseActivityId;this.lessonId=A.lessonId;this.exerciseId=A.exerciseId;this.lessonContentRepositoryId=A.lessonContentRepositoryId;this.exerciseContentRepositoryId=A.exerciseContentRepositoryId;
this.rank=A.rank;this.displayOrder=A.displayOrder;}var sharedProtoNode=new protoNode();ContentAreaNode.prototype=sharedProtoNode;function LibraryNode(A){this.getSize=function(){return 9;};this.createGraphic=function(){this.radius=this.getSize();return raph.rect(100,200,12,12);};this.colorNode=function(){this.gfx.attr("fill","#0a0");
this.gfx.attr("stroke","#00a");this.gfx.mousedown(createSelectShapeHandler(this));};this.children=[];this.id="L"+A.id;this.libraryId=A.id;this.parentId=A.contentAreaId;this.name=A.name;this.shortName=A.name;this.description=A.description;this.author=A.author;this.typ=A.type;this.nodeType="LibraryItem";
this.contentAreaId="CA"+A.id;}LibraryNode.prototype=sharedProtoNode;function createNodes(){for(var E in nodeArray){var B=nodeArray[E];var D=new ContentAreaNode(B);D.init();shapes[D.id]=D;}if(showLibraryNodes){for(var C=0;C<libraryList.length;C++){var A=libraryList[C];var D=new LibraryNode(A);D.init();
shapes[D.id]=D;}}}function setFontAttr(A){if(!A){return ;}if(!isInternetExplorer()){A.attr("font","Arial");}}function setLinkCursor(A){if(!A){return ;}if(isInternetExplorer()){A.node.style.cursor="pointer";}else{A.node.style.cursor="pointer";}}function makeZoomBox(){if(iPhone){return ;}var A=paperWidth-16;
var B=raph.rect(A,72,16,16);B.attr({"stroke":"blue","stroke-width":2,"fill":"aliceblue"});B.mousedown(zoomBoxHandler());}function makeAboutLink(){var A=460;if(iPhone){A=paperHeight-20;}aboutLink=raph.text(10,460,"About This Graph").attr({"text-anchor":"start"});aboutLink.attr("font-size","14");aboutLink.attr("fill","blue");
aboutLink.mousedown(aboutHandler());setLinkCursor(aboutLink);}function zoomBoxHandler(){return function(){if(nowZoomed){$(".leftNavBarHidden").removeClass("leftNavBarHidden").addClass("leftNavBar");$(".topBarSmall").removeClass("topBarSmall").addClass("topBar");nowZoomed=false;}else{$(".leftNavBar").removeClass("leftNavBar").addClass("leftNavBarHidden");
$(".topBar").removeClass("topBar").addClass("topBarSmall");nowZoomed=true;}resetGraph();};}function aboutHandler(){return function(){var A=appBase+"/explore/about/";window.location=A;};}function createMouseDownHierarchyHandler(A){return function(){setCenterShape(A);};}var pathNodes=[];function pathDriver(){var C=[];
var D=centerShape;while(D){C[C.length]=D;if(D.parentId<0){D=null;}else{D=shapes[D.parentId];}}C.reverse();for(var B=0;B<pathNodes.length;B++){if(pathNodes[B]!=C[B]){if(pathNodes[B]){if(pathNodes[B].hierarchyTextNode){pathNodes[B].hierarchyTextNode.remove();pathNodes[B].hierarchyTextNode=null;}pathNodes[B]=null;
}}}for(var B=0;B<C.length;B++){if(pathNodes[B]!=C[B]){pathNodes[B]=C[B];var A=raph.text(6+B*8,10+B*16,pathNodes[B].name).attr({"text-anchor":"start"});pathNodes[B].hierarchyTextNode=A;setFontAttr(A);A.attr("font-size","14");A.attr("fill","blue");A.mousedown(createMouseDownHierarchyHandler(pathNodes[B]));
setLinkCursor(A);}}}var glowNodes=[];var GLOW_NODE_COUNT=3;function pickRecommendedNodes(){for(var B in shapes){var C=shapes[B];if(!C.hidden){if(glowNodes.length<GLOW_NODE_COUNT){glowNodes.push(C);}else{for(var A=0;A<glowNodes.length;A++){if(glowNodes[A].recommend<C.recommend){glowNodes[A]=C;break;}}}}}}function isRecommendedNode(B){for(var A=0;
A<glowNodes.length;A++){if(glowNodes[A]==B){return true;}}return false;}var glowToggle=false;function glowDriver(){if(animating){return ;}glowToggle=!glowToggle;for(var A in glowNodes){var B=glowNodes[A];if(!B.hidden){if(glowToggle){B.gfx.animate({"fill-opacity":0.8,"stroke-width":2,"stroke":"orange"},900);
}else{B.gfx.animate({"fill-opacity":1,"stroke-width":4,"stroke":"yellow"},900);}}}}function findShapeIndexByContentAreaId(B){var A=shapes[B];if(A.nodeType=="ContentArea"&&A.contentAreaId=="CA"+B){return B;}alert("findShapeIndexByContentAreaId is broken!");return -1;}var testNodes=[];function getTestNode(C,B,A){if(!testNodes[C]){if(!A){return null;
}testNodes[C]=[];}if(!testNodes[C][0]){if(!A){return null;}var D=raph.text(paperCenterX,paperCenterY,"Questions");testNodes[C][0]=D;D.contentAreaId=C;D.testId=B;D.parentId=C;D.name="History";D.radius=4;D.nodeType="TestNode";D.locationX=paperCenterX;D.locationY=paperCenterY;D.velocityX=0;D.velocityY=0;
D.children=[];D.totalDescendents=0;D.hidden=false;D.gfx.attr("fill","black");D.gfx.node.onmouseover=createMouseOverQuizNodeHandler(D);D.id=shapes.length;D.gfx.mousedown(dragger);shapes[D.id]=D;}return testNodes[C][0];}function getCorrectNode(B,A){if(!B){return null;}if(B.correctNode){return B.correctNode;
}if(!A){return null;}var C=raph.text(paperCenterX,paperCenterY,"Correct");B.correctNode=C;C.parentId=B.id;C.name=B.name+" Correct";C.radius=3;C.nodeType="CorrectNode";C.locationX=paperCenterX;C.locationY=paperCenterY;C.velocityX=0;C.velocityY=0;C.children=[];C.totalDescendents=0;C.hidden=false;C.gfx.attr("fill","green");
C.id=shapes.length;shapes[C.id]=C;C.mousedown(dragger);return C;}function getIncorrectNode(B,A){if(!B){return null;}if(B.incorrectNode){return B.incorrectNode;}if(!A){return null;}var C=raph.text(paperCenterX,paperCenterY,"Incorrect");B.incorrectNode=C;C.parentId=B.id;C.name=B.name+" Incorrect";C.radius=3;
C.nodeType="IncorrectNode";C.locationX=paperCenterX;C.locationY=paperCenterY;C.velocityX=0;C.velocityY=0;C.children=[];C.totalDescendents=0;C.hidden=false;C.gfx.attr("fill","red");C.id=shapes.length;shapes[C.id]=C;C.mousedown(dragger);return C;}function getUnansweredNode(B,A){if(!B){return null;}if(B.unansweredNode){return B.unansweredNode;
}if(!A){return null;}var C=raph.text(paperCenterX,paperCenterY,"Unanswered");B.unansweredNode=C;C.parentId=B.id;C.name=B.name+" Unanswered";C.radius=3;C.nodeType="UnansweredNode";C.locationX=paperCenterX;C.locationY=paperCenterY;C.velocityX=0;C.velocityY=0;C.children=[];C.totalDescendents=0;C.hidden=false;
C.gfx.attr("fill","black");C.id=shapes.length;shapes[C.id]=C;C.gfx.mousedown(dragger);return C;}function addShapesForAnswers(){for(var A in answerList){var C=answerList[A];var D=findShapeIndexByContentAreaId(C.contentArea);var B=getTestNode(D,C.tstId,true);var F=null;if(C.answerStatus<0){F=getIncorrectNode(B,true);
}else{if(C.answerStatus>0){F=getCorrectNode(B,true);}else{F=getUnansweredNode(B,true);}}var E=raph.rect(paperCenterX-3,paperCenterY-3,7,7);E.id=shapes.length;E.parentId=F.id;E.name=A;E.radius=2;E.nodeType="Answer";E.questionId="Q"+A;E.locationX=paperCenterX;E.locationY=paperCenterY;E.velocityX=0;E.velocityY=0;
E.children=[];E.totalDescendents=0;E.hidden=false;if(C.answerStatus<0){E.gfx.attr("fill","red");}else{if(C.answerStatus>0){E.gfx.attr("fill","green");}else{E.gfx.attr("fill","black");}}shapes[E.id]=E;E.gfx.mousedown(dragger);}}var QUIZ_IN_TOPIC=1;var HISTORY_ALL_IN_TOPIC=2;var HISTORY_INCORRECT_IN_TOPIC=3;
var HISTORY_SUMMARY_IN_TOPIC=4;var DOCUMENTS_IN_TOPIC=5;var QUESTIONS_IN_TOPIC=6;var globalX=0;var globalY=0;$().mousedown(function(A){globalX=A.pageX;globalY=A.pageY;mouseOutHandler();});var initialYOffset=-10;var popupBox=null;var popUpImage=null;function mouseOutHandler(B){if(!popUpImage){return ;
}var D=true;var C=true;if(entryGlobalX>globalX){D=entryGlobalX-globalX<25;}else{D=entryGlobalX-globalX>-100;}if(entryGlobalY>globalY){C=entryGlobalY-globalY<10;}else{C=entryGlobalY-globalY>-60;}if(D&&C){return ;}if(popUpImage.commandText){for(var A=0;A<popUpImage.commandText.length;A++){if(popUpImage.commandText[A]){popUpImage.commandText[A].remove();
popUpImage.commandText[A]=null;}}}popUpImage.remove();popUpImage=null;}function limitStringSize(B,A){if(B.length<=A){return B;}return B.substr(0,A-3)+"...";}function createMouseOverCommandTextHandler(A){return function(){A.attr("fill","red");};}function createMouseOutCommandTextHandler(A){return function(){A.attr("fill","blue");
};}function createMouseDownCommandTextHandler(A){return function(){doPopupCommand(A);};}function makePopupText(E,G,A,H,D,F){var C=limitStringSize(G,26);var B=raph.text(A,H,C).attr({"text-anchor":"start"});B.s=E;B.name=C;setFontAttr(B);B.attr("font-size",D);B.attr("fill","blue");if(F){B.node.onmouseover=createMouseOverCommandTextHandler(B);
B.node.onmouseout=createMouseOutCommandTextHandler(B);B.mousedown(createMouseDownCommandTextHandler(B));B.command=F;B.toFront();}return B;}function makePopupBox(C,D){if(popupBox){return null;}var B=D*12+4;initialYOffset=B+8;var A=Math.floor(C.locationX)-75;var E=Math.floor(C.locationY)-initialYOffset;
popupBox=raph.rect(A,E,150,B,5);popupBox.attr("fill","#aed0ea");popupBox.attr("fill-opacity",0.85);popupBox.commandText=[];popupBox.x=A;popupBox.y=E;entryGlobalX=globalX;entryGlobalY=globalY;return popupBox;}var entryGlobalX=0;var entryGlobalY=0;function createMouseOverContentNodeHandler(A){return ;return function(){var B=makePopupBox(A,6);
if(!B){return ;}B.commandText[0]=makePopupText(A,A.name,B.x+5,B.y+8,"12",null);B.commandText[1]=makePopupText(A,"Show Topic Score",B.x+15,B.y+20,"10",HISTORY_SUMMARY_IN_TOPIC);B.commandText[2]=makePopupText(A,"View All Questions",B.x+15,B.y+31,"10",HISTORY_ALL_IN_TOPIC);B.commandText[3]=makePopupText(A,"View Incorrect Questions",B.x+15,B.y+42,"10",HISTORY_INCORRECT_IN_TOPIC);
B.commandText[4]=makePopupText(A,"Take Quiz In This Topic ",B.x+15,B.y+53,"10",QUIZ_IN_TOPIC);B.commandText[5]=makePopupText(A,"View Related Documents",B.x+15,B.y+64,"10",DOCUMENTS_IN_TOPIC);};}function createMouseOverQuizNodeHandler(A){return function(){var B=makePopupBox(A,3);if(!B){return ;}B.commandText[0]=makePopupText(A,A.name,B.x+5,B.y+8,"12",null);
B.commandText[1]=makePopupText(A," View All Questions",B.x+15,B.y+20,"10",null);B.commandText[2]=makePopupText(A," View Incorrect Questions",B.x+15,B.y+31,"10",null);};}function doPopupCommand(C){if(C.command==QUIZ_IN_TOPIC){var B=appBase+"/tst/createQuiz/"+C.s.id;var A=window.open(B);}else{if(C.command==HISTORY_ALL_IN_TOPIC){var B=appBase+"/tst/history/"+C.s.id;
window.location=B;}else{if(C.command==HISTORY_INCORRECT_IN_TOPIC){var B=appBase+"/tst/history/"+C.s.id+"?incorrect=true";window.location=B;}else{if(C.command==HISTORY_SUMMARY_IN_TOPIC){var B=appBase+"/explore/topic/"+C.s.id;window.location=B;}else{if(C.command==DOCUMENTS_IN_TOPIC){var B=appBase+"/library/index/"+C.s.id;
window.location=B;}else{alert("To Be Done");}}}}}}function doCenterShapeCommand(C){if(C==QUIZ_IN_TOPIC){var B=appBase+"/tst/take/dynamicIntro?contentArea="+centerShape.id;alert(B);var A=window.open(B);}else{if(C==HISTORY_ALL_IN_TOPIC){var B=appBase+"/tst/history/"+centerShape.id;window.location=B;}else{if(C==HISTORY_INCORRECT_IN_TOPIC){var B=appBase+"/tst/history/"+centerShape.id+"?incorrect=true";
window.location=B;}else{if(C==HISTORY_SUMMARY_IN_TOPIC){var B=appBase+"/explore/topic/"+centerShape.id;window.location=B;}else{if(C==DOCUMENTS_IN_TOPIC){var B=appBase+"/library/index/"+centerShape.id;window.location=B;}else{if(C==QUESTIONS_IN_TOPIC){var B=appBase+"/question/list/"+centerShape.id;window.location=B;
}else{alert("To Be Done");}}}}}}}function createSelectShapeHandler(A){return function(){setCenterShape(A);};}function countTotalDescendents(C){var A=C.children.length;C.totalDescendents=1;for(var B=0;B<A;B++){var D=C.children[B];if(!D.hidden){C.totalDescendents+=countTotalDescendents(D);}}return C.totalDescendents;
}function calculateShapeDestination(C){if(!C||C.hidden){return ;}if(C==centerShape){C.destinationX=paperCenterX;C.destinationY=paperCenterY;C.destinationRadius=0;}else{if(centerShape.contentCategoryType=="SUBJECT"&&C.contentCategoryType=="SUBTOPIC"){C.destinationRadius=175;}else{C.destinationRadius=ringDistance[C.generation];
}C.destinationX=paperCenterX+C.destinationRadius*Math.cos(C.destinationAngle);C.destinationY=paperCenterY+C.destinationRadius*Math.sin(C.destinationAngle);var D=1;C.destinationX=(C.destinationX-paperCenterX)*D+paperCenterX;var B=C.destinationX-paperCenterX;var A=C.destinationY-paperCenterY;C.destinationRadius=Math.sqrt(B*B+A*A);
C.destinationAngle=Math.atan2(A,B);}}function calculateMinimumStep(){for(var A in shapes){var B=shapes[A];if(B.hidden){B.minimumTravelRadius=0;B.minimumTravelArc=0;}else{B.minimumTravelRadius=ringDistance[B.generation]/100;B.minimumTravelArc=B.angleToCenter/100;}}}function calculateDesiredArcs(C){if(!C){C=centerShape;
}C.children.sort(sortByAngleToParent);var A=C.children.length;C.sumOfChildrenDesiredArc=0;for(var B=0;B<A;B++){var E=C.children[B];if(!E.hidden){C.sumOfChildrenDesiredArc+=calculateDesiredArcs(E);}}if(C==centerShape){C.desiredArc=C.sumOfChildrenDesiredArc;}else{var D=((Math.PI/5)/C.generation);C.desiredArc=Math.max(D,C.sumOfChildrenDesiredArc);
}return C.desiredArc;}function calculatePositionOfChildren(D){if(!D.children||D.children.length<=0||D.hidden){return ;}var E=D.arc/D.sumOfChildrenDesiredArc;var A=D.destinationAngle-D.arc/2;var B=D.children.length;for(var C=0;C<B;C++){var F=D.children[C];if(!F||F.hidden){continue;}F.arc=F.desiredArc*E;
F.destinationAngle=A+F.arc/2;A=A+F.arc;calculateShapeDestination(F);if(!F.hidden){calculatePositionOfChildren(F);}}}function calculateDestinationPosition(){for(var B in shapes){var C=shapes[B];if(C.nodeType=="LibraryItem"&&C.hidden==false){var A=1;}if(!C||C.hidden){continue;}var E=C.locationX-paperCenterX;
var D=C.locationY-paperCenterY;C.distanceFromCenter=Math.sqrt(E*E+D*D);C.angleToCenter=Math.atan2(D,E);}calculateDesiredArcs(null);centerShape.destinationX=paperCenterX;centerShape.destinationY=paperCenterY;centerShape.arc=Math.PI*2;centerShape.destinationAngle=0;calculateShapeDestination(centerShape);
calculatePositionOfChildren(centerShape);}function placeNodesOnRings(){for(var C=0;C<rings.length;C++){rings[C].length=0;}for(var B in shapes){var D=shapes[B];D.generation=0;var A=D.parent;while(A){D.generation++;A=A.parent;}if(D.generation<=4&&D.generation>0){(rings[D.generation-1]).push(D);}}}function getParentById(A){if(!A||A==centerShape){return null;
}var C=centerShape;while(C){if(C.parentId<0){break;}var B=shapes[C.parentId];if(B==A){return C;}C=B;}if(!A.parentId||A.parentId<0){return null;}return shapes[A.parentId];}function cleanChildAndParent(){for(var A in shapes){var B=shapes[A];B.parent=null;B.children.length=0;B.totalDescendents=0;}}function setUpChildAndParent(){for(var A in shapes){var B=shapes[A];
B.parent=getParentById(B);if(B.parent){B.parent.children.push(B);}}}function hideShape(A){if(!A){return ;}A.gfx.translate(paperCenterX-A.locationX,paperCenterY-A.locationY);A.locationX=paperCenterX;A.locationY=paperCenterY;A.gfx.hide();A.hidden=true;}function showShape(A){if(!A){return ;}A.gfx.show();
A.hidden=false;}function isInSubtree(B,A){if(!B||!A){return false;}if(B==A){return true;}if(!A.parentId||A.parentId<1){return false;}return isInSubtree(B,shapes[A.parentId]);}function hideParentNodes(){for(var A in shapes){var B=shapes[A];if(!isInSubtree(centerShape,B)&&(B.id!=centerShape.parentId)){hideShape(B);
}}}function hideDistantChildren(C){for(var A in shapes){var B=shapes[A];if((B.generation>C)||(centerShape.contentCategoryType=="GOAL"&&B.contentCategoryType=="SUBTOPIC"&&B.rank>3)||(centerShape.contentCategoryType=="SUBJECT"&&B.contentCategoryType=="SUBTOPIC"&&B.rank>10)){hideShape(B);}else{showShape(B);
}}}function setCenterShapeByLibraryId(D){var C="L"+D;for(var A in shapes){var B=shapes[A];if(B.libraryId==C){setCenterShape(B);return ;}}}function setCenterShapeByContentAreaId(A){setCenterShape(shapes[A]);}function setCenterShape(A){if(A&&A.contentCategoryType=="SUBTOPIC"){if(A.lessonActivityId!=""&&A.lessonActivityId!=null){document.getElementById("lessonActivityId").value=A.lessonActivityId;
document.getElementById("lessonId").value=A.lessonId;document.getElementById("lessonContentRepoId").value=A.lessonContentRepositoryId;}if(A.exerciseActivityId!=""&&A.exerciseActivityId!=null){document.getElementById("exerciseActivityId").value=A.exerciseActivityId;document.getElementById("exerciseId").value=A.exerciseId;
document.getElementById("exerciseContentRepoId").value=A.exerciseContentRepositoryId;}createOnMouseClickSubTopicPopup(A);return ;}if(centerShape&&centerShape.nodeType=="ContentArea"){centerShape.gfx.animate({"fill-opacity":1,"stroke-width":1,"stroke":"black"},990);}centerShape=A;cleanChildAndParent();
setUpChildAndParent();countTotalDescendents(centerShape);placeNodesOnRings();if(iPhone){hideDistantChildren(1);}else{if(nowZoomed){hideDistantChildren(7);}else{hideDistantChildren(2);}}if(!showParentNodes){hideParentNodes();}calculateDestinationPosition();startAnimateToDestination();setContextualPanel();
}function startAnimateToDestination(){var A=2000;var D=A;if(noInterpolation){D=200;}animating=true;for(var B in shapes){var C=shapes[B];if(C.connectionLine){C.connectionLine.remove();C.connectionLine=null;}if(C.shortNameText){C.shortNameText.remove();C.shortNameText=null;}if(C.shortNameTextBox){C.shortNameTextBox.remove();
C.shortNameTextBox=null;}if(!C.hidden){C.locationX=C.destinationX;C.locationY=C.destinationY;if(C.nodeType=="ContentArea"){C.gfx.animate({cx:C.destinationX,cy:C.destinationY},D,"elastic");}else{C.gfx.animate({x:C.destinationX,y:C.destinationY},D,"elastic");}}}setTimeout(finishAnimateToDestination,(A*0.8));
}function finishAnimateToDestination(){for(var B in shapes){var D=shapes[B];if(D.connectionLine){D.connectionLine.remove();D.connectionLine=null;}if(D.shortNameText){D.shortNameText.remove();D.shortNameText=null;}if(D.shortNameTextBox){D.shortNameTextBox.remove();D.shortNameTextBox=null;}if(!D.hidden&&D.parent&&!D.parent.hidden){D.connectionLine=createNewConnection(D,D.parent);
}if(!D.hidden&&D.shortName){var A=D.shortName;if(A.length>20){A=D.shortName.substring(0,20)+"...";}if(D.contentCategoryType=="SUBJECT"){A=A.toUpperCase();}D.shortNameText=raph.text(D.locationX,D.locationY,A);setFontAttr(D.shortNameText);D.shortNameText.attr("fill","#5C5C5C");if(D.contentCategoryType=="GOAL"){D.shortNameText.attr("text-anchor","center");
D.shortNameText.attr("font-size","12");D.shortNameText.attr("font-weight","bold");D.shortNameText.attr("fill","#FFFFFF");}else{if(D.contentCategoryType=="SUBJECT"){D.shortNameText.attr("font-size","11");D.shortNameText.attr("font-weight","bold");D.shortNameText.attr("fill",subjectColor[D.displayOrder]);
}else{D.shortNameText.attr("text-anchor","left");D.shortNameText.attr("font-size","10");}}var E=D.shortNameText.getBBox();var C=2;E.x-=C;E.y-=C;E.x=(E.x+E.width/2);E.y=(E.y+E.height/2);if(D.contentCategoryType!="GOAL"){D.shortNameText.translate(E.width/2+D.radius+4,E.height/2-D.radius);}E.width+=C*2;
E.height+=C*2;setLinkCursor(D.shortNameText);D.shortNameText.mousedown(createSelectShapeHandler(D));D.shortNameText.toFront();}}animating=false;}function setContextualPanel(){setContextLinks();}function openGetSmartDocumentWindow(B){var A=appBase+"/library/show/"+B;window.open(A);}function setContextLinks(){if(!centerShape){jQuery("#topicTitlePanel").html("");
jQuery("#topicDetailPanel").html("");return ;}var C="";if(isRecommendedNode(centerShape)){C="<br/><span style='font-style:italic;'>GetSmart recommends you study this topic.</span>";}var B=centerShape.name;var A=B;if(!iPhone){A="<h2 style='text-align:left;'>"+B+"</h2>";}jQuery("#topicTitlePanel").html(A);
var D="<div style='position:relative;width:70%;font-size:small;'>";if(centerShape.nodeType=="ContentArea"){D=D+"Score : "+centerShape.totalCorrect+" / "+(centerShape.totalCorrect+centerShape.totalWrong);D=D+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Importance : "+centerShape.importance;D=D+C;D=D+"<p>"+centerShape.description+"</p>";
D=D+"</div>";if(!iPhone){jQuery("#topicDetailPanel").html(D);$("#topicDetailPanelTemplate").clone().appendTo("#topicDetailPanel");$("#WithinTopicTitle").html(centerShape.name);}}else{if(centerShape.nodeType=="LibraryItem"){D=D+"<p>"+centerShape.description+"</p>";D=D+"<p>Author:"+centerShape.author+"</p>";
var E=appBase+"/images/download.jpg";D=D+"<p><img src='"+E+"' border='0' "+" onclick='openGetSmartDocumentWindow("+centerShape.libraryId+");'/>  </p>";D=D+"</div>";jQuery("#topicDetailPanel").html(D);}else{jQuery("#topicDetailPanel").html("");}}}function cheggCurrentTopic(){var B=centerShape.name;B=B.replace(/^\s+/,"");
B=B.replace(/\s+$/,"");B=B.replace(" ","+");B=B.replace(" ","+");B=B.replace(" ","+");var A="http://www.chegg.com/search/"+B;window.open(A,A);}function cramsterCurrentTopic(){var B=centerShape.name;B=B.replace(/^\s+/,"");B=B.replace(/\s+$/,"");var A="http://www.cramster.com/search/index.aspx?search="+B;
window.open(A,A);}function getSizeFromImportance(A){if(A<6){return 7;}return Math.round(Math.sqrt(A)+10);}var isDrag=false;var dragger=function(A){isDrag=this;isDrag.dx=A.clientX;isDrag.dy=A.clientY;isDrag.startDragX=A.clientX;isDrag.startDragY=A.clientY;isDrag.hasBeenDragged=false;};function roundTwoDecimals(A){return(Math.round(A*100))/100;
}function sortByAngleToParent(B,A){if(!B||!A||!B.angleToCenter||!A.angleToCenter){return 0;}return B.angleToParent-A.angleToParent;}function createNewConnection(I,H){if(!I||!H||!raph){return null;}var F="3";var L="#64b2d8";if(H.contentCategoryType=="GOAL"){F="4";L="#000000";}if(I.contentCategoryType=="SUBTOPIC"&&H.contentCategoryType=="SUBJECT"){F="1";
L=subjectColor[H.displayOrder];}var B=I.locationX;var G=I.locationY;var A=H.locationX;var E=H.locationY;var D=Math.sqrt((B-A)*(B-A)+(G-E)*(G-E));var K=D-I.radius;if(K>1){B=A+(K/D)*(B-A);G=E+(K/D)*(G-E);}D=Math.sqrt((B-A)*(B-A)+(G-E)*(G-E));K=D-H.radius;if(K>1){A=B+(K/D)*(A-B);E=G+(K/D)*(E-G);}B=Math.round(B);
A=Math.round(A);G=Math.round(G);E=Math.round(E);var C="M"+B+","+G+" L"+A+","+E;var J=raph.path(C);J.attr("stroke",L);J.attr("stroke-width",F);if(I.nodeType!=H.nodeType){J.attr("stroke-dasharray","--");}J.toBack();return J;}function viewLessonOrExerciseByContentType(J){var F=document.getElementById("cid").value;
var I=document.getElementById("planId").value;var D=document.getElementById("userId").value;var G=document.getElementById("lessonActivityId").value;var B=document.getElementById("exerciseActivityId").value;if(J=="lesson"){var H=document.getElementById("lessonId").value;var C=document.getElementById("lessonContentRepoId").value;
window.location.href=ctx+"/secure/readLesson.action?bstate=lesson"+"&cId="+F+"&activityId="+G+"&planId="+I+"&lId="+H+"&contentRepoId="+C;}else{if(J=="exercise"){var E=document.getElementById("exerciseId").value;var A=document.getElementById("exerciseContentRepoId").value;window.location.href=ctx+"/secure/exercises.action?bstate=exercise"+"&cid="+F+"&activityId="+B+"&eid="+E+"&contentRepoId="+A;
}}}var popUpPaneldivTag="";var popUpDiagPanel="";function displayDialogPopUP(A){var F="";var J="";var K=false;var I="";var K=true;var C="240px";popUpPaneldivTag=A;var E=document.getElementById(A);var B=document.getElementById(A+"-title");var H=document.body.scrollHeight;var G=document.body.scrollWidth;
if(E!==undefined&&E!==""){E.style.display="block";E.style.visibility="visible";}popUpDiagPanel=new YAHOO.widget.Panel(A,{width:C,constraintoviewport:true,visible:true,modal:true,underlay:"none",close:true});popUpDiagPanel.render();popUpDiagPanel.center();if(B!=null){B.innerHTML=I;}var L=document.getElementById(A+"_mask");
if(L!=null){L.style.height=H;L.style.width="100%";}var D=document.getElementById(A+"_c");if(D!=null&&K==false){D.style.top="0";}}function closeDialogPanelPopUp(){pageScrollUp();var B=document.getElementById("panelDummyDiv_"+popUpPaneldivTag);if(B==null){B=document.createElement("div");B.id="panelDummyDiv_"+popUpPaneldivTag;
B.style.height="0px";B.style.zIndex=0;}document.body.appendChild(B);var A=document.getElementById(popUpPaneldivTag);A.style.display="none";A.style.visibility="hidden";B.appendChild(A);popUpDiagPanel.hide();popUpDiagPanel.destroy();}var box=null;var exerciseViewLink=null;var lessonViewLink=null;function createOnMouseClickSubTopicPopup(B){if(popUpImage){exerciseViewLink.remove();
lessonViewLink.remove();popUpImage.remove();exerciseViewLink=null;lessonViewLink=null;popUpImage=null;}popUpImage=makeLessonAndExercisePopupBox(B,2);if(!popUpImage){return ;}var A=Math.floor(B.locationX)+20;var C=Math.floor(B.locationY)+15;exerciseViewLink=makeSubTopicExerciseLink(B,"Exercises",A,C,"11");
popUpImage.commandText[0]=exerciseViewLink;lessonViewLink=makeSubTopicLessonLink(B,"Lessons",A,C+15,"11");popUpImage.commandText[1]=lessonViewLink;}var popUpImageOffsetXValue=48;var popUpImageOffsetYValue=17;function makeLessonAndExercisePopupBox(C,D){if(popUpImage){return null;}var B=D*10+25;initialYOffset=B+8;
var A=Math.floor(C.locationX)+5;var E=Math.floor(C.locationY)+10;popUpImage=raph.image("/prep/images/popUp.png",(A-popUpImageOffsetXValue),E,90,60);popUpImage.commandText=[];entryGlobalX=C.locationX+320;entryGlobalY=C.locationY+112;return popUpImage;}function makeSubTopicLessonLink(E,F,A,G,D){var C=limitStringSize(F,26);
var B=raph.text((A-popUpImageOffsetXValue),(G+popUpImageOffsetYValue),C).attr({"text-anchor":"start"});B.s=E;B.name=C;setFontAttr(B);B.attr("font-size",D);B.attr("fill","black");B.attr("font-weight","bold");B.attr("href","javascript:viewLessonOrExerciseByContentType('lesson');");B.toFront();return B;
}function makeSubTopicExerciseLink(E,F,A,G,D){var C=limitStringSize(F,26);var B=raph.text((A-popUpImageOffsetXValue),(G+popUpImageOffsetYValue),C).attr({"text-anchor":"start"});B.s=E;B.name=C;setFontAttr(B);B.attr("font-size",D);B.attr("fill","black");B.attr("font-weight","bold");B.attr("href","javascript:viewLessonOrExerciseByContentType('exercise');");
B.toFront();return B;}
