function logScriptError(E,D,A){var H="SWVideo Script Errors";var B="Admin";var C="support@snapwiz.com";if(E.indexOf("Error loading script")>-1){return ;}var G="File: "+D+", Line: "+A+" (SCRIPT ERROR)";if(A==1){G=E+", File: "+D+", Line: "+A+" (SCRIPT ERROR)";}var F=E+"\r\nFile: "+D+"\r\nLine: "+A+"\r\n\r\nPage: "+location.href+"\r\n\r\n";
for(key in navigator){F+=key+":"+navigator[key]+"\r\n";}alert(G+"\n"+F);return true;}var isSafari=navigator.userAgent.indexOf("Safari")>-1;var isWebKit=navigator.userAgent.indexOf("WebKit")>-1;var current_pointer_box=null;var arrowSwitched=false;var currentPage=0;function loadObjectFromDoc(A){if(A.id){return A;
}else{return document.getElementById(A);}}function deleteNode(A){if(A&&A.parentNode){A.parentNode.removeChild(A);}}function getFrameWindow(A){var B=document.getElementById(A);if(B&&B.contentWindow){B=B.contentWindow;}return B;}function addListener(B,A,C){if(!B){alert("bad object for "+A+", obj:"+B+", fn:"+C+", caller:"+addListener.caller);
return ;}if(B.addEventListener){return B.addEventListener(A,C,true);}else{if(B.attachEvent){return B.attachEvent("on"+A,C);}}}function cancelEvent(A){A.cancelBubble=true;if(A.preventDefault){A.preventDefault();}if(A.stopPropagation){A.stopPropagation();}return false;}function arrayRemove(C,B){for(var A=0;
A<C.length;A++){if(C[A]==B){C.splice(A,1);}}}function getLeft(A){if(A.offsetParent){return A.offsetLeft+getLeft(A.offsetParent);}else{return A.offsetLeft;}}function getTop(A){if(A.offsetParent){var B=A.offsetTop+getTop(A.offsetParent);return B;}else{return A.offsetTop;}}function getDescendantByClassName(D,C){if(D.className==C){return D;
}for(var A=0;A<D.childNodes.length;A++){var B=getDescendantByClassName(D.childNodes[A],C);if(B!=null){return B;}}return null;}function trace(C,B){var A=document.getElementById("txt");if(A==null){return ;}A.value+=C+"\r\n";if(B){for(key in C){A.value+=key+":"+C[key]+"\r\n";}A.value+="\r\n\r\n";}}function writeDebugLog(C,A){if(window.dontLog){return ;
}var B=document.getElementById("debugLogDiv");if(A){B.value="";}if(B!=null){B.value=B.value+"\n"+C;B.scrollTop=B.scrollHeight;}return true;}function logMulti(){if(window.dontLog){return ;}var C="";var A=true;for(var B=0;B<logMulti.arguments.length;B++){if(!A){C+=", ";}C+=logMulti.arguments[B];A=false;
}writeDebugLog(C);}function alertMulti(){var C="";var A=true;for(var B=0;B<alertMulti.arguments.length;B++){if(!A){C+=", ";}C+=alertMulti.arguments[B];A=false;}alert(C);}function PngSrc(A,B){A=loadObjectFromDoc(A);if(document.all&&navigator.appVersion.indexOf("MSIE 6")>-1){B=B.replace(".png",".gif");
}A.src=B;}function GetPngSrc(A){if(document.all&&navigator.appVersion.indexOf("MSIE 6")>-1){return A.replace(".png",".gif");}return A;}function SetPngSrc(A,B){A=loadObjectFromDoc(A);if(document.all&&navigator.appVersion.indexOf("MSIE 6")>-1){B=B.replace(".png",".gif");}A.src=B;}function getGreater(B,A){if(B>A){return B;
}return A;}function getLesser(B,A){if(B<A){return B;}return A;}function moveElementTo(B,A,D){var C=loadObjectFromDoc(B);C.style.left=A+"px";C.style.top=D+"px";}function slideElementTo(F,I,H,D,J){var E=loadObjectFromDoc(F);if(E.cancelSlide){E.cancelSlide=null;return ;}var C=parseInt(E.style.left);var B=parseInt(E.style.top);
if(!isNaN(C)){var A=C+(I-C)/D;E.style.left=A+"px";}if(!isNaN(B)){var K=B+(H-B)/D;E.style.top=K+"px";}if(D>1){J=J?true:false;var G="slideElementTo('"+E.id+"', "+I+", "+H+", "+(D-1)+", "+J+")";setTimeout(G,30);}else{if(J){E.style.display="none";}}}function fadeElementOut(E,B,D){D=D?D:document;try{var C=D.getElementById(E);
if(!C){writeDebugLog("bad object: "+E);return ;}C.style.filter="alpha(opacity:"+B+")";C.style.MozOpacity=B/100;C.style.opacity=B/100;if(B>0){setTimeout(function(){fadeElementOut(E,B-5,D);},30);}else{C.style.display="none";}}catch(A){}}function createCookie(C,D,E){if(E){var B=new Date;B.setTime(B.getTime()+E*24*60*60*1000);
var A="; expires="+B.toGMTString();}else{var A="";}document.cookie=C+"="+D+A+"; path=/";}function readCookie(B){var D=B+"=";var A=document.cookie.split(";");for(var C=0;C<A.length;C++){var E=A[C];while(E.charAt(0)==" "){E=E.substring(1,E.length);}if(E.indexOf(D)==0){return E.substring(D.length,E.length);
}}return null;}function eraseCookie(A){createCookie(A,"",-1);}function getSelectValue(A){A=loadObjectFromDoc(A);return A.options[A.selectedIndex].value;}function setSelectValue(A,C,D){A=loadObjectFromDoc(A);for(var B=0;B<A.options.length;B++){if(A.options[B].value==C){A.selectedIndex=B;return B;}}if(D){}return -1;
}function format(A){for(var B=1;B<format.arguments.length;B++){A=A.replace("{"+(B-1)+"}",format.arguments[B]);}return A;}function trim(A){return A.replace(/^\s+|\s+$/g,"");}function ltrim(A){return A.replace(/^\s+/g,"");}function getProtocol(){return location.href.split(":")[0];}var SWVState=new Object;
SWVState.None=0;SWVState.PLine=1;SWVState.BoxShape=2;SWVState.Move=3;SWVState.Erase=4;SWVState.CShape=5;SWVState.Text=6;SWVState.View=7;var DrawColors=new Object;DrawColors.Red="#C02F2F";DrawColors.Blue="#3624C5";DrawColors.Green="#48A228";DrawColors.Yellow="#FEE927";DrawColors.Black="#271616";var PenSizes=new Object;
PenSizes.Small=2;PenSizes.Medium=5;PenSizes.Large=10;var canvas;var slideCover;var drawMode=0;var singleSelectBoxId=-1;var offX=0;var offY=75;var canvasWidth=875;var canvasHeight=1000;function PLine(C,A,B){this.lastX=0;this.lastY=0;this.lineCap="round";this.strokeStyle=A;this.lineWidth=B;this.ready=true;
this.drawing=false;this.points=C;this.pageNumber=currentPage;}PLine.prototype.StoreXY=function(A){pline.points[pline.points.length]=mouse.x+7;pline.points[pline.points.length]=mouse.y+7;pline.lastX=mouse.x;pline.lastY=mouse.y;};PLine.prototype.Draw=function(C){if(!C){C=c;}if(this.points.length<2){return ;
}C.lineCap=this.lineCap;C.lineJoin=this.lineCap;C.strokeStyle=this.strokeStyle;C.lineWidth=this.lineWidth;C.beginPath();var D=true;for(var B=1;B<this.points.length;B+=2){var A=parseInt(this.points[B-1]);var E=parseInt(this.points[B]);if(D){C.moveTo(A,E);}else{C.lineTo(A,E);}D=false;}C.stroke();};function BoxShape(C,G,B,D,F,A,E,H){this.x1=C;
this.y1=G;this.x2=B;this.y2=D;this.lineCap="round";this.shapeType=F;this.strokeStyle=A;this.fillStyle="";this.lineWidth=E;this.northWest=(H==null)?true:H;this.drawing=false;this.pageNumber=currentPage;}BoxShape.ShapeTypes=new Object;BoxShape.ShapeTypes.Line=0;BoxShape.ShapeTypes.Square=1;BoxShape.ShapeTypes.Oval=2;
BoxShape.ShapeTypes.RBox=3;BoxShape.ShapeTypes.ETriangle=5;BoxShape.ShapeTypes.RTriangle=6;BoxShape.ShapeTypes.Arrow=7;BoxShape.prototype.JoinPoints=function(){return this.x1+","+this.y1+","+this.x2+","+this.y2;};BoxShape.prototype.Width=function(){return this.x2-this.x1;};BoxShape.prototype.Height=function(){return this.y2-this.y1;
};BoxShape.prototype.Draw=function(B){if(!B){B=SWCanvas.context;}B.lineCap=this.lineCap;B.lineJoin=this.lineCap;B.strokeStyle=this.strokeStyle;B.lineWidth=this.lineWidth;B.beginPath();switch(this.shapeType){case BoxShape.ShapeTypes.Line:if(this.northWest){B.moveTo(this.x1,this.y1);B.lineTo(this.x2,this.y2);
}else{B.moveTo(this.x2,this.y1);B.lineTo(this.x1,this.y2);}B.stroke();break;case BoxShape.ShapeTypes.Square:B.strokeRect(this.x1,this.y1,(this.x2-this.x1),(this.y2-this.y1));break;case BoxShape.ShapeTypes.Oval:var A=getLesser(Math.abs(this.x1-this.x2)/2,Math.abs(this.y1-this.y2)/2);this.DrawRoundedRect(B,A);
break;case BoxShape.ShapeTypes.RBox:var A=20;this.DrawRoundedRect(B,A);break;case BoxShape.ShapeTypes.RTriangle:this.DrawRTriangle(B);break;case BoxShape.ShapeTypes.ETriangle:this.DrawETriangle(B);break;case BoxShape.ShapeTypes.Arrow:if(this.northWest){drawLineArrow(B,this.x1,this.y1,this.x2,this.y2);
}else{drawLineArrow(B,this.x2,this.y1,this.x1,this.y2);}break;default:}};BoxShape.prototype.DrawRTriangle=function(D){var B=this.x1;var A=this.x2;var E=this.y1;var C=this.y2;if(this.x1>this.x2){B=this.x2;A=this.x1;}D.beginPath();D.moveTo(B,E);D.lineTo(B,C);D.lineTo(A,C);D.closePath();D.stroke();};BoxShape.prototype.DrawETriangle=function(F){var D=this.x1;
var B=this.x2;var G=this.y1;var E=this.y2;if(this.x1>this.x2){D=this.x2;B=this.x1;}F.beginPath();F.moveTo(D,G);var A=D+2*(B-D);var C=G;F.lineTo(B,E);F.lineTo(A,C);F.closePath();F.stroke();};BoxShape.prototype.DrawRoundedRect=function(F,B){var D=this.x1;var C=this.x2;var H=this.y1;var E=this.y2;if(this.x1>this.x2){D=this.x2;
C=this.x1;}if(this.y1>this.y2){H=this.y2;E=this.y1;}var G=C-D;var A=E-H;if(B>G/2){B=Math.floor(G/2);}if(B>A/2){B=Math.floor(A/2);}F.beginPath();F.arc(D+B,H+B,B,Math.PI,3*Math.PI/2,false);F.lineTo(C-B,H);F.arc(C-B,H+B,B,3*Math.PI/2,4*Math.PI/2,false);F.lineTo(C,E-B);F.arc(C-B,E-B,B,0,Math.PI/2,false);
F.lineTo(D+B,E);F.arc(D+B,E-B,B,Math.PI/2,Math.PI,false);F.lineTo(D,H+B);F.stroke();};var mouse=new Object;mouse.x=0;mouse.y=0;mouse.chillFF=false;mouse.frameWindow=null;mouse.GridSizes={None:1,Small:10,Large:25};mouse.gridSize=mouse.GridSizes.None;mouse.sniff=function(D,B){if(!mouse.frameWindow){mouse.frameWindow=getFrameWindow("canvasFrame");
}var C=0;var A=0;try{if(mouse.frameWindow&&mouse.frameWindow.document&&mouse.frameWindow.document.body){C=parseInt(mouse.frameWindow.document.body.scrollLeft);A=parseInt(mouse.frameWindow.document.body.scrollTop);}}catch(D){}mouse.x=D.clientX+C;mouse.y=D.clientY+A;if(B&&mouse.gridSize!=mouse.GridSizes.None){mouse.x=mouse.gridRound(mouse.x);
mouse.y=mouse.gridRound(mouse.y);}};mouse.gridRound=function(A){return Math.round(A/mouse.gridSize)*mouse.gridSize;};mouse.IsOnCanvas=function(A){if(mouse.x<0||mouse.x>canvasWidth||mouse.y<20||A.clientX>SWCanvas.doc.body.clientWidth-20||A.clientY>SWCanvas.doc.body.clientHeight-20){return false;}return true;
};mouse.chill=function(){this.chillFF=true;setTimeout("mouse.unchill()",1);};mouse.unchill=function(){this.chillFF=false;};var pline=new PLine(new Array,"#C02F2F",PenSizes.Medium);var boxShape=new BoxShape(0,0,0,0,BoxShape.ShapeTypes.RBox,"#C02F2F",PenSizes.Medium);var eraser=new Object;eraser.lastX=0;
eraser.lastY=0;eraser.halfSize=30;eraser.ready=true;eraser.drawing=false;eraser.points=new Array;eraser.StoreXY=function(A){eraser.points[eraser.points.length]=mouse.x;eraser.points[eraser.points.length]=mouse.y;eraser.lastX=mouse.x;eraser.lastY=mouse.y;};var arrow=[[-15,-5],[-8,0],[-15,5],[2,0]];function drawFilledPolygon(A,B){if(!A){A=SWCanvas.context;
}writeDebugLog("Draw polygon with "+B);A.beginPath();A.moveTo(B[0][0],B[0][1]);writeDebugLog("point ("+B[0][0]+","+B[0][1]+")");for(p in B){if(p>0){writeDebugLog("point ("+B[p][0]+","+B[p][1]+")");A.lineTo(B[p][0],B[p][1]);}}writeDebugLog("point ("+B[0][0]+","+B[0][1]+")");A.lineTo(B[0][0],B[0][1]);A.fill();
}function translateShape(B,A,D){var C=[];for(p in B){C.push([B[p][0]+A,B[p][1]+D]);}return C;}function rotateShape(A,B){var C=[];for(p in A){C.push(rotatePoint(B,A[p][0],A[p][1]));}return C;}function rotatePoint(B,A,C){writeDebugLog("Rotating :: ("+A+","+C+") by "+B);return[(A*Math.cos(B))-(C*Math.sin(B)),(A*Math.sin(B))+(C*Math.cos(B))];
}function drawLineArrow(A,D,F,B,E){writeDebugLog("Drawing arrow from ("+D+", "+F+") to ("+B+","+E+")");if(!A){A=SWCanvas.context;}if(arrowSwitched){A.beginPath();A.moveTo(B,E);A.lineTo(D,F);A.stroke();var C=Math.atan2(F-E,D-B);drawFilledPolygon(A,translateShape(rotateShape(arrow,C),D,F));arrowSwitched=false;
}else{A.beginPath();A.moveTo(D,F);A.lineTo(B,E);A.stroke();var C=Math.atan2(E-F,B-D);drawFilledPolygon(A,translateShape(rotateShape(arrow,C),B,E));}}function clearCanvas(A){try{if(!A){A=SWCanvas.context;}if(A&&A.clearRect){A.clearRect(0,0,SWCanvas.width,SWCanvas.height);}if(A&&SWCanvas.context&&A==SWCanvas.context){SWCanvas.clear();
}}catch(B){}}function Scribble(){this.doc=null;this.lastDrawMode=null;this.isSinglePage=false;this.pageNumber=currentPage;}SWCanvas=new Scribble;Scribble.prototype.init=function(A){SWCanvas.doc=A;c.lineCap=pline.lineCap;c.strokeStyle=pline.strokeStyle;c.lineWidth=pline.lineWidth;c.lineJoin="round";if(this.hasController){this.initController(A);
}if(document.all){getFrameWindow("canvasFrame").document.getElementById("slideCover").style.zIndex=210;}};function setDrawMode(G,F){writeDebugLog("set: "+G);drawMode=G;if(F!=null){if(drawMode==SWVState.BoxShape||drawMode==SWVState.CShape){boxShape.shapeType=F;}else{if(drawMode==SWVState.Text){SWCanvas.spawnMode=F;
}}}try{SWCanvas.doc.getElementById("slideCover");}catch(E){writeDebugLog("not ready to setDrawMode");return ;setTimeout(function(){setDrawMode(G,F);},100);return ;}var C=SWCanvas.doc.getElementById("slideCover");var D=SWCanvas.doc.getElementById("mainCanvas");var A=SWCanvas.doc.getElementById("overlayCanvas");
if(C){if(drawMode==SWVState.None){if(!SWCanvas.isSinglePage){C.style.display="none";D.style.display="none";A.style.display="none";}else{}SWCanvas.hideBoxes();}else{C.style.display="inline";D.style.display="inline";A.style.display="inline";SWCanvas.showBoxes();}switch(G){case SWVState.PLine:if(isWebKit){C.style.cursor="url(http://www.snapwiz.com/prep/images/video/pencil_small_up.cur), crosshair";
A.style.cursor="url(http://www.snapwiz.com/prep/images/video/pencil_small_up.cur), crosshair";}else{C.style.cursor="url(http://www.snapwiz.com/prep/images/video/pen.gif), crosshair";A.style.cursor="url(http://www.snapwiz.com/prep/images/video/pen.gif), crosshair";}break;case SWVState.Erase:C.style.cursor="url(http://www.snapwiz.com/prep/images/video/eraser.cur), crosshair";
A.style.cursor="url(http://www.snapwiz.com/prep/images/video/eraser.cur), crosshair";break;case SWVState.BoxShape:case SWVState.CShape:C.style.cursor="crosshair";A.style.cursor="crosshair";break;case SWVState.None:C.style.cursor="auto";A.style.cursor="auto";break;case SWVState.Move:C.style.cursor="default";
A.style.cursor="default";break;case SWVState.Text:C.style.cursor="text";A.style.cursor="text";break;case SWVState.View:C.style.cursor="default";A.style.cursor="default";break;default:}}var B=SWContext.currentUser;if(B){B.drawMode=drawMode;B.shapeType=boxShape.shapeType;}if(SWCanvas.over){SWCanvas.over.hideHandle();
}if(SWCanvas.hasController){}if(window.MenuPanel){MenuPanel.CloseAll(true);}}function MenuPanel(B,A){this.showing=false;this.timeout=null;this.div=loadObjectFromDoc(B);this.div.menuRef=this;addListener(this.div,"mouseover",this.MouseOver);addListener(this.div,"mouseout",this.MouseOut);if(A){this.trigger=loadObjectFromDoc(A);
this.trigger.menuRef=this;addListener(this.trigger,"mouseover",this.MouseOver);addListener(this.trigger,"mouseout",this.MouseOut);}MenuPanel.menus.push(this);}MenuPanel.menus=new Array;MenuPanel.suppressOpen=false;MenuPanel.CloseAll=function(B){if(B){setTimeout("MenuPanel.suppressOpen = false",1000);
MenuPanel.suppressOpen=true;}for(var A=0;A<MenuPanel.menus.length;A++){MenuPanel.menus[A].Close();}};MenuPanel.IsContained=function(A){if(!A){return false;}else{if(A.menuRef){return true;}else{if(A.parentNode){return MenuPanel.IsContained(A.parentNode);}}}return false;};MenuPanel.GetMenuRef=function(A){if(!A){return null;
}else{if(A.menuRef){return A.menuRef;}else{if(A.parentNode){return MenuPanel.GetMenuRef(A.parentNode);}}}return null;};MenuPanel.prototype.Open=function(){MenuPanel.CloseAll();if(!MenuPanel.suppressOpen){this.showing=true;this.div.style.display="block";}};MenuPanel.prototype.Close=function(){this.showing=false;
this.div.style.display="none";};MenuPanel.prototype.Toggle=function(){if(this.showing){this.Close();}else{this.Open();}};MenuPanel.prototype.MouseOver=function(C){var B=C.target?C.currentTarget:C.srcElement;var A=MenuPanel.GetMenuRef(B);if(A){if(A.timeout){clearTimeout(A.timeout);A.timeout=null;}A.Open();
}};MenuPanel.prototype.MouseOut=function(F){var D=F.relatedTarget?F.relatedTarget:F.toElement;var B=MenuPanel.GetMenuRef(D);if(!B){var E=F.target?F.currentTarget:F.srcElement;var A=MenuPanel.GetMenuRef(E);if(A){var C=document.all?500:1000;A.timeout=setTimeout(function(){A.Close();},C);}}};function addDeepListener(C,B,D){addListener(C,B,D);
for(var A=0;A<C.childNodes.length;A++){addDeepListener(C.childNodes[A],B,D);}}var xmlhttp=null;var responseLength=0;var ieStateCheckTimeout;var canvasFrame;var slideCover;var cvMain;var cvTemp;var skipReload=false;var viewingCacheID="";var picker;var whiteboard=new Object;whiteboard.history=new Array;
function WhiteBoard_init(){current_pointer_box=null;whiteboard.ready=true;if(!SWCanvas){setTimeout("WhiteBoard_init()",100);return ;}if(window.PngFix){window.PngFix();}canvasFrame=document.getElementById("canvasFrame");if(SWCanvas.hasController){addListener(document,"keydown",SWCanvas.keydown);addListener(document,"keyup",SWCanvas.keyup);
addListener(window,"unload",function(){sendVoice(false);sendExit();});}setDrawMode(SWVState.PLine);loadCanvas(canvasFrame);}function slideCover_click(A){}function navigateForward(){var A=getHistoryIndex();if(A>0){loadCache(whiteboard.history[A-1],true);}}function navigateBack(){var A=getHistoryIndex();
if(A>=0&&A<whiteboard.history.length-1){loadCache(whiteboard.history[A+1],true);}}function getHistoryIndex(){if(viewingCacheID==""){return whiteboard.history.length-1;}for(var A=0;A<whiteboard.history.length;A++){if(whiteboard.history[A]==viewingCacheID){return A;}}return -1;}function setLocationText(A){}function prepareLoad(){showWaitMessage();
}function load(A){if(!skipReload){showWaitMessage();SWCanvas.clear();canvasFrame.src=A+"&following=1";}skipReload=false;}function loadCache(C,B){if(!skipReload){if(viewingCacheID!=C){if(JCanvas&&SWCanvas){SWCanvas.clear();}showWaitMessage();var D="";if(B){D="&mode=nav";}var A="/Show.aspx?cacheID="+C+D;
canvasFrame.src=A;}}skipReload=false;}function showWaitMessage(){var A=GetCanvasDoc();if(A&&A.getElementById("divWait")){A.getElementById("divWait").style.display="block";}}function showCanvas(){if(drawMode==SWVState.None&&SWCanvas.lastDrawMode==null){setDrawMode(SWVState.PLine);}else{}}function setColor(C,B){var A=SWContext.GetUser(C);
if(A){A.color=B;SWContext.currentUser.color=B;}}function setPenSize(B,C){var A=SWContext.GetUser(B);if(A){A.penSize=C;SWContext.currentUser.penSize=C;}}function setVoice(B,C){var A=SWContext.GetUser(B);if(A){A.voice=C;}}function setControlType(A){SWContext.controlType=A;setDrawMode(drawMode);}function setSetUsername(B,C){var A=SWContext.GetUser(B);
if(A){A.name=C;}}function drawLine(C,D){var B=SWContext.GetUser(C);if(B){var A=new PLine(D,B.color,B.penSize);A.Draw();showCanvas();setImpliedUserDrawMode(C,SWVState.PLine,0);}}function drawBoxShape(D,H,E,G,C,F){var B=SWContext.GetUser(D);if(B){var A=new BoxShape(E,G,C,F,H,B.color,B.penSize);A.Draw();
showCanvas();setImpliedUserDrawMode(D,SWVState.BoxShape,0);noteUserActivity(D,A);}}function drawCShape(E,B,G,I,H,A,J,L,K,F,D){var M=SWCanvas.getBoxById(B);if(drawMode==SWVState.View){movePointer(I-5+A,H+(J/2));var C=document.getElementById("canvasFrame");C.contentWindow.scrollBy(0,H);}if(!M){M=new CShape(G,I,H,A,J,L,K,F,D);
M.boxID=B;SWCanvas.addBox(M);setImpliedUserDrawMode(E,SWVState.CShape,M.shapeType);}M.pos.x=I;M.pos.y=H;M.resize(A,J);M.stroke=L;M.fill=K;M.weight=F;M.rebuild();M.draw(SWCanvas.context);showCanvas();noteUserActivity(E,M);}function drawCPolyLine(B,E,A,H,G,F,D){writeDebugLog("drawCPolyLine: boxId - "+E);
var C=SWCanvas.getBoxById(E);if(!C){C=new CPolyLine(D,G,F);C.boxID=E;SWCanvas.addBox(C);}C.hasSent=true;C.pos.x=parseInt(A);C.pos.y=parseInt(H);C.draw(SWCanvas.context);showCanvas();noteUserActivity(B,C);setImpliedUserDrawMode(B,SWVState.PLine,0);}function movePointer(B,G){var E="<img src='http://www.snapwiz.com/prep/images/video/pen.gif' />";
var D;if(current_pointer_box){var C=get_points_line(current_pointer_box.pos.x,current_pointer_box.pos.y,B,G,10);var A="";try{A=YAHOO.lang.JSON.stringify(C);}catch(F){alert("stringify failed "+F);}tracePoints(A);}else{current_pointer_box=new TransBox(null,B,G,5,5,E,"","");SWCanvas.addBox(current_pointer_box);
current_pointer_box.pos.x=parseInt(B);current_pointer_box.pos.y=parseInt(G);current_pointer_box.draw(SWCanvas.context);}}function addImage(C){if(C&&C.src&&C.nodeName==="IMG"){var B=C.src;var A=new ImageBox(null,0,0,5,5,B);SWCanvas.addBox(A);A.pos.x=parseInt(100);A.pos.y=parseInt(100);A.draw(SWCanvas.context);
sendImagePosition(A);}}function setEqnImage(){var C=document.getElementById("eqnInput").value;if(C!=""){var A=document.createElement("img");A.src="http://www.india.snapwiz.com/cgi-bin/mathtex.cgi?"+escape(C);A.alt=C;A.title=C;var B=document.getElementById("eqnContainer");if(B.hasChildNodes()){while(B.childNodes.length>=1){B.removeChild(B.firstChild);
}}B.appendChild(A);}}YAHOO.util.Event.onDOMReady(function(){var B=function(){var G=document.getElementById("eqnInput").value;if(G!=""){var I='<p style="font-size: 15px;"><img alt="'+G+'" title="'+G+'" '+'style="vertical-align: -1pt; font-size: 15px;" '+'src="http://www.india.snapwiz.com/cgi-bin/mathtex.cgi?'+escape(G)+'"></p>';
var H=new TransBox(null,200,100,300,100,"","",null);SWCanvas.addBox(H);SWCanvas.select(H);setLabelContent(344215,H.boxID,I);var F=computeTextboxWidth(I);H.resize(F,H.height);sendLabelPosition(H);sendTextPosition(H);}this.hide();};var E=function(){this.cancel();};var A=function(F){};var D=function(F){alert("Submission failed: "+F.status);
};YAHOO.util.Dom.removeClass("eqnDialog","eqnDialog");var C=new YAHOO.widget.Dialog("eqnDialog",{width:"30em",fixedcenter:true,visible:false,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},constraintoviewport:true,buttons:[{text:"Submit",handler:B,isDefault:true},{text:"Cancel",handler:E}]});
C.setHeader("Enter Equation");C.callback={success:A,failure:D};C.render();YAHOO.util.Event.addListener("eqnId","click",C.show,C,true);});YAHOO.util.Event.onDOMReady(function(){var B=function(){var H=document.getElementById("file").value;if(H==""){document.getElementById("photoUploadError").innerHTML="Please select photo path";
}else{var F=ctxPath;var G=new ImageBox(null,0,0,25,25,"");G.setZIndex(10002);SWCanvas.addBox(G);G.pos.x=parseInt(350);G.pos.y=parseInt(250);G.draw(SWCanvas.context);fileUploadAction(F+"/secure/lbvImageUpload.action?photoName="+H,"photoUpload","",G.div.id);this.hide();}};var E=function(){this.cancel();
};var A=function(F){};var C=function(F){alert("Submission failed: "+F.status);};YAHOO.util.Dom.removeClass("dialog1","dialog1");var D=new YAHOO.widget.Dialog("dialog1",{width:"30em",fixedcenter:true,visible:false,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},constraintoviewport:true,buttons:[{text:"Submit",handler:B,isDefault:true},{text:"Cancel",handler:E}]});
D.setHeader("Upload Image");D.callback={success:A,failure:C};D.render();YAHOO.util.Event.addListener("imgUpload","click",D.show,D,true);});YAHOO.util.Event.onDOMReady(function(){var B=function(){var I=document.getElementById("swAutoInput");var K=document.getElementById("swAutoContainer");var F=K.innerHTML;
if(F===""||F==undefined){getExpForQuestion();}var H=F.split("<swbr></swbr>");mouse.x=300;mouse.y=200;for(k=0;k<H.length;k++){var J="<p><strong>"+H[k]+"</strong></p>";var G=new TransBox(null,300,200+k*30,600,30,"","",null);SWCanvas.addBox(G);SWCanvas.select(G);setLabelContent(344215,G.boxID,J);sendTextPosition(G);
}this.hide();};var E=function(){this.cancel();};var A=function(F){};var D=function(F){alert("Submission failed: "+F.status);};YAHOO.util.Dom.removeClass("expImpDialog","expImpDialog");var C=new YAHOO.widget.Dialog("expImpDialog",{width:"30em",fixedcenter:true,visible:false,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},constraintoviewport:true,buttons:[{text:"Submit",handler:B,isDefault:true},{text:"Cancel",handler:E}]});
C.setHeader("Import Explanation");C.callback={success:A,failure:D};C.render();YAHOO.util.Event.addListener("expImpId","click",C.show,C,true);});function getExpForQuestion(){var A=document.getElementById("swAutoInput");var B=A.value;renderAction(ctx+"/secure/expForQuestion.action","&qid="+B,"swAutoContainer");
}function tracePoints(H){if(H.length>0){var C=[];try{C=YAHOO.lang.JSON.parse(H);}catch(G){alert("Invalid product data :: "+H);}var E="<img src='http://www.snapwiz.com/prep/images/video/pen.gif' />";var D;if(C.length>0){if(current_pointer_box){var B=C.shift();SWCanvas.addBox(current_pointer_box);current_pointer_box.pos.x=parseInt(B.x);
current_pointer_box.pos.y=parseInt(B.y);current_pointer_box.draw(SWCanvas.context);if(C.length>0){var A=YAHOO.lang.JSON.stringify(C);var F="tracePoints"+"('"+A+"')";setTimeout(F,25);}}}}}function get_intermediate_points(B,H,A,G){var I=new Array();var D=0;var K=B;var J=H;var F=Math.sqrt(Math.pow(B-A,2)+Math.pow(H-G,2));
var E=Math.floor(F/10);while(D<E){K=K+(A-K)*Math.random();J=J+(G-J)*Math.random();var C={"x":K,"y":J};I[D]=C;D++;}var C={"x":A,"y":G};I[D]=C;return I;}function get_line_equation(C,F,B,E){var A=(E-F)/(B-C);b=E-(A*B);var D=new Array();D[0]=A;D[1]=b;return D;}function get_points_line(C,K,A,J,D){var M=new Array();
var G=0;if(C!=A&&K!=J){var L=get_line_equation(C,K,A,J);var E=L[0];var I=L[1];var O=C;var N=K;var H=Math.abs(A-C);var B=Math.floor(H/D);if(C>A){B=-1*B;}if(B>0){while(H>0){O=O+B;N=E*O+I;var F={"x":O,"y":N};M[G]=F;G++;H=H-Math.abs(B);}}var F={"x":A,"y":J};M[G]=F;}else{if(C==A&&K!=J){var O=C;var N=K;var H=Math.abs(J-K);
var B=Math.floor(H/D);if(C>A){B=-1*B;}if(B>0){while(H>0){O=C;N=N+B;var F={"x":O,"y":N};M[G]=F;G++;H=H-Math.abs(B);}}var F={"x":A,"y":J};M[G]=F;}}return M;}function selectObject(A){if(A!=null&&A!=undefined){var B=SWCanvas.getBoxById(A);if(B&&(B.type=="Box"||B.type=="CShape"||B.type=="CPolyLine")){if(SWCanvas.over&&SWCanvas.over!=B){SWCanvas.over.hideHandle();
SWCanvas.over=null;SWCanvas.invalidate();}SWCanvas.over=B;if(SWCanvas.selected==null||B!=SWCanvas.selected){B.showHandle("move");singleSelectBoxId=A;}else{}}}idValue=A;setMoveMode();}function setLabelPosition(updateUserID,boxID,type,x,y,width,height,content,src){writeDebugLog("setLabelPosition: boxId - "+boxID+" type - "+type);
x=parseInt(x);y=parseInt(y);width=parseInt(width);height=parseInt(height);if(drawMode==SWVState.View){movePointer(x-5+width,y+(height/2));var canvasFrame=document.getElementById("canvasFrame");canvasFrame.contentWindow.scrollBy(0,y);}var box=SWCanvas.getBoxById(boxID);if(!box){var pattern=SWCanvas.getPatternByClassName(type);
if(pattern){box=pattern.spawn(x,y,new Point(0,0),content);if(box){box.boxID=boxID;SWCanvas.addBox(box);}}else{var objectType=eval(type);box=new objectType(null,x,y,width,height,content,"",src);box.boxID=boxID;SWCanvas.addBox(box);}}if(box){box.pos.x=x;box.pos.y=y;box.resize(width,height);box.draw(SWCanvas.context);
noteUserActivity(updateUserID,box);setImpliedUserDrawMode(updateUserID,SWVState.Move,0);}}function setLabelContent(A,D,C){var B=SWCanvas.getBoxById(D);if(!B){return ;}B.setContent(C);noteUserActivity(A,B);setImpliedUserDrawMode(A,SWVState.Text,0);}function setLabelStyle(A,D,B){var C=SWCanvas.getBoxById(D);
if(!C){return ;}C.setStyle(B);setImpliedUserDrawMode(A,SWVState.Text,0);}function setNextSlide(A){if(userID==A){return ;}var C=userID==A;var B=getFrameWindow("canvasFrame");if(B&&B.scribd_setNextPage){B.scribd_setNextPage();}else{if(B&&B.SWVideoGP&&B.SWVideoGP.next){SWCanvas.clear();B.SWVideoGP.next(C);
}}}function setPrevSlide(A){if(userID==A){return ;}var C=userID==A;var B=getFrameWindow("canvasFrame");if(B&&B.scribd_setPreviousPage){B.scribd_setPreviousPage();}else{if(B&&B.SWVideoGP&&B.SWVideoGP.prev){SWCanvas.clear();B.SWVideoGP.prev(C);}}}function removeLabel(A,C){var B=SWCanvas.onremove;SWCanvas.onremove=null;
SWCanvas.removeBox(C);SWCanvas.onremove=B;}function reinstateLabel(A,C){var B=SWCanvas.onreinstate;SWCanvas.onreinstate=null;SWCanvas.reinstateBox(C);SWCanvas.onreinstate=B;}function setLabelOrder(A,B,C){if(C=="front"){SWCanvas.bringToFront(B);}else{SWCanvas.sendToBack(B);}}function noteUserActivity(B,C){if(userID==B){return ;
}var A=SWContext.GetUser(B);if(A){}}function setImpliedUserDrawMode(B,E,C){var A=SWContext.GetUser(B);if(A){var D=false;if(A.drawMode!=E||A.shapeType!=C){D=true;}A.drawMode=E;A.shapeType=C;if(userID==B){A.drawMode=drawMode;A.shapeType=boxShape.shapeType;}else{}}}function clear(){SWCanvas.clear();}function sendJoin(){SWContext.SendJoin();
}function sendExit(){var A="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=exit"+SWContext.GetRandomToken();}function sendBoxShape(A){var B="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=boxShape&type="+A.shapeType+"&points="+A.JoinPoints();}function sendCShape(A){recordUserAction("cshape",A.boxID,A.pos.x,A.pos.y,A.width,A.height,A.stroke,A.weight,A.shapeType,A.northWest);
}function sendCPolyLine(A){var B="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=cpolyline"+"&id="+A.boxID+"&x="+A.pos.x+"&y="+A.pos.y+"&stroke="+escape(A.stroke)+"&weight="+A.weight;var C="";if(!A.hasSent){C=A.points.join();A.hasSent=true;}recordUserAction("cpolyline",A.boxID,A.pos.x,A.pos.y,A.width,A.height,A.stroke,A.weight,C,false);
}function sendErase(B){var A="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=erase&points="+B.join();}function sendClear(){var A="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=clear"+SWContext.GetRandomToken();}function sendChat(){SWContext.SendChat();}function sendColor(B){var A=SWContext.currentUser;
if(A&&A.color!=B){var C="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=color&color="+escape(B)+SWContext.GetRandomToken();setColor(userID,B);}}function sendPenSize(A){setPenSize(userID,A);}function sendVoice(B){var A="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=voice&on="+escape(B)+SWContext.GetRandomToken();
}function sendNewBox(E,B,H,D,A,G){var F=Math.random();var C="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=labelposition"+"&id="+F+"&type="+E+"&x="+B+"&y="+H+"&width="+D+"&height="+A+"&content="+escape(G)+SWContext.GetRandomToken();}function sendDelete(A){recordUserAction("delete",A.boxID,"","","","","","","","");
}function sendImagePosition(A){if(A.className==ImageBox.className){content='<IMG src="'+(A.img.src)+'" />';recordUserAction("htmlText",A.boxID,A.pos.x,A.pos.y,A.width,A.height,"","",content,"");}}function sendTextPosition(B){if(B.className==TransBox.className){var A=B.contentElement.innerHTML;A=A.replace("'","&#39;");
recordUserAction("htmlText",B.boxID,B.pos.x,B.pos.y,B.width,B.height,"","",A,"");}}function sendLabelPosition(B){if(B.type=="CShape"){switch(B.shapeType){case CShape.ShapeTypes.PLine:sendCPolyLine(B);break;default:sendCShape(B);break;}return ;}var A="";if(B.className==ImageBox.className){A=encodeURIComponent(B.img.src);
}if(!B.isActive){recordUserAction("delete",B.boxID,0,0,"","","","","","");}else{recordUserAction("move",B.boxID,B.pos.x,B.pos.y,B.width,B.height,"","","","");}}function sendLabelContent(C,B){var A="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=labelcontent"+"&id="+C.boxID+"&text="+encodeURIComponent(B);
if(C.styleString){A+="&style="+encodeURIComponent(C.styleString);}}function sendNoteImage(B){var A="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=noteimage"+"&src="+B.img.src;}function sendLabelRemove(B){var A="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=labelremove"+"&id="+B.boxID;
}function sendLabelReinstate(B){if(B.type=="CShape"){switch(B.shapeType){case CShape.ShapeTypes.PLine:sendCPolyLine(B);break;default:sendCShape(B);break;}return ;}else{if(B.type=="Box"){if(B.div.className=="editableImageBox"){sendTextPosition(B);return ;}}}var A="";if(B.className==ImageBox.className){A=encodeURIComponent(B.img.src);
}if(!B.isActive){recordUserAction("delete",B.boxID,0,0,"","","","","","");}else{recordUserAction("move",B.boxID,B.pos.x,B.pos.y,B.width,B.height,"","","","");}}function sendLabelOrder(B,C){var A="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=labelorder"+"&id="+B.boxID+"&direction="+C;if(C=="front"){SWCanvas.bringToFront(B.boxID);
}else{SWCanvas.sendToBack(B.boxID);}}function sendLoadSnapshot(B){if(!SWContext.canControl()){return ;}var A="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=snapshot"+"&actionID="+B+SWContext.GetRandomToken();OneWaySocket.Send(A);}function sendNextSlide(){if(!SWContext.canControl()){return ;
}var A="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=nextslide"+SWContext.GetRandomToken();}function sendPrevSlide(){if(!SWContext.canControl()){return ;}var A="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=prevslide"+SWContext.GetRandomToken();}function sendUsername(B){var A="/SWVideoController?"+SWContext.GetUniqueIDString()+"&mode=username&username="+B+SWContext.GetRandomToken();
}function sendLoad(B){if(!SWContext.canControl()){return ;}var A="/Show.aspx?url="+escape(B);showWaitMessage();if(SWCanvas&&SWCanvas.clear){SWCanvas.clear();}canvasFrame.src=A;}function resizeFrame(B,A){return ;}function GetCanvasDoc(){if(getFrameWindow("canvasFrame")){try{return getFrameWindow("canvasFrame").document;
}catch(A){}}return null;}function loadCanvas(A){if(!whiteboard.ready){writeDebugLog("waiting for whiteboard");setTimeout("loadCanvas()",100);return ;}if(!A){A=getFrameWindow("canvasFrame").document;}SWCanvas.init(getFrameWindow("canvasFrame").document);setDrawMode(drawMode);}var divPop;var framePop;var popFrameOpen=false;
function openPop(){if(!divPop){divPop=document.getElementById("divPop");framePop=document.getElementById("framePop");}if(divPop){divPop.style.display="block";divPop.style.zIndex=12000;popFrameOpen=true;MenuPanel.CloseAll(true);}}function closePop(){if(!divPop){divPop=document.getElementById("divPop");
}if(divPop){divPop.style.display="none";divPop.style.zIndex=-90;}popFrameOpen=false;}function tryClosePop(){if(popFrameOpen){closePop();}}function getScrollTop(){alert(document.body.parentNode.scrollTop);}var LoadContentService=new Object;LoadContentService.xmlhttp=null;LoadContentService.baseUrl="/WebServices/LoadContentService.aspx";
LoadContentService.callback=null;LoadContentService.loadXMLDoc=function(A){LoadContentService.xmlhttp=null;if(LoadContentService.xmlhttp==null){if(window.XMLHttpRequest){LoadContentService.xmlhttp=new XMLHttpRequest;}else{if(window.ActiveXObject){LoadContentService.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}}}if(LoadContentService.xmlhttp!=null){LoadContentService.xmlhttp.onreadystatechange=LoadContentService.state_Change;LoadContentService.xmlhttp.open("GET",A,true);LoadContentService.xmlhttp.send(null);}else{alert("Your browser does not support XMLHTTP.");}};LoadContentService.state_Change=function(){if(!window.LoadContentService.xmlhttp){writeDebugLog("got to state_Change() with LoadContentService.xmlhttp undefined");
return ;}if(LoadContentService.xmlhttp.readyState==4){if(LoadContentService.xmlhttp.status==200){writeDebugLog("response:"+LoadContentService.xmlhttp.responseText);try{if(LoadContentService.xmlhttp&&LoadContentService.xmlhttp.responseText&&LoadContentService.xmlhttp.responseText!=""){var A=LoadContentService.xmlhttp.responseText;
var C=A.indexOf("|");if(C>0){var E=A.substr(0,C);var B=A.substr(C+1);B=LoadContentService.FixRelativeLinks(B);if(document.getElementById(E)){document.getElementById(E).innerHTML=B;}}if(LoadContentService.callback){LoadContentService.callback();}}}catch(D){}}else{alert("Pushing a new build.  Chill a second, then hit OK.");
}}};LoadContentService.FixRelativeLinks=function(A){var B=new RegExp(LoadContentService.baseUrl,"g");A=A.replace(B,location.pathname,true);return A;};LoadContentService.Load=function(B,C,D,E){var A=this.baseUrl+"?control="+B+"&target="+C;if(D){A=A+"&"+D;}A=A+"&rand="+Math.random();this.callback=E;this.loadXMLDoc(A);
};LoadContentService.ExecuteWebServiceRequest=function(A,B){this.callback=B;this.loadXMLDoc(A);};LoadContentService.LoadMedia=function(A){this.Load("MediaToolPalette","divMediaPalleteScroll",null,A);};LoadContentService.LoadSnapShot=function(B,A){this.Load("SnapShotActions","divActions","actionID="+A,B);
};LoadContentService.CopyMedia=function(D,C,B){var A=format("/WebServices/CopyMediaService.aspx")+"?userid="+C+"&src="+B+"&rand="+Math.random();this.ExecuteWebServiceRequest(A,D);};LoadContentService.LoadUserStatus=function(A){this.Load("UserStatusBlock","divUserStatus",null,A);};function SWVideoUser(F,C,B,A,D,E){this.id=F;
this.name=C;this.imageUrl=B;this.color=A;this.penSize=D;this.present=E;this.voice=false;this.drawMode=SWVState.PLine;this.shapeType=0;}SWVideoUser.prototype.type="SWVideoUser";SWVideoUser.prototype.stuff=function(E,B,D,C,A){};var swVideoUsers=new Object;function ClearUsers(){swVideoUsers=new Object;}function AddUser(G,D,C,B,E,F){if(!E){E=PenSizes.Medium;
}var A=new SWVideoUser(G,D,C,B,E,F);swVideoUsers["user"+G]=A;setColor(G,B);if(G==userID){picker.setColor(B);SWContext.currentUser=A;}}var xmlhttp=null;var sessionID=90326;var userID=344213;var SWContext=new Object;SWContext.init=function(){SWContext.SendJoin();};SWContext.GetUser=function(B){var A=swVideoUsers["user"+B];
if(!A){A=new SWVideoUser(0,"Unknown","/images/video/nobody_64.gif",DrawColors.Red,PenSizes.Medium);}return A;};SWContext.currentUser=new SWVideoUser(0,"Unknown","/images/video/nobody_64.gif",DrawColors.Red,PenSizes.Small);SWContext.pendingMessageCount=0;SWContext.AppendUserRow=function(B,C){var E=document.createElement("DIV");
E.className="attendee";var A=document.createElement("IMG");A.className="indicator";A.src="/images/video/toolbar/status-mask-small.png";A.style.backgroundColor=C.color;E.appendChild(A);if(C.voice){var D=document.createElement("IMG");D.className="voiceicon";D.src="/images/video/toolbar/status-headset.png";
E.appendChild(D);}E.appendChild(SWContext.GetUserIcon(C));if(C.id==userID&&C.name.indexOf("guest")==0){SWContext.AppendGuestUserTextField(C,E);}else{E.appendChild(document.createTextNode(C.name));}B.appendChild(E);};SWContext.AppendUrlBox=function(A,B,C){var D=format("<img src='/images/video/arrow1.gif' alt='' style='margin-bottom:-2px;'/> <a href='{0}' onclick='sendLoad(\"{1}\");return false'>{2}</a>",C,C,C);
SWContext.AppendChatBox(A,B,D,true);};SWContext.AppendSnapshotBox=function(B,C,F,G,D){var A=G.replace("thumb","full");var E=format("<a href='/Account/SnapshotViewer.aspx?actionID={0}' onclick='sendLoadSnapshot({1});return false;' title='{2}' class='snaplink'><img src='{3}' alt='{4}'/></a> <b>Snapshot: {5}</b><br /><a href='{6}' onclick='sendLoad(\"http://{8}{7}\");return false;' >- view as image</a><br /><a href='/Account/SnapshotViewer.aspx?actionID={9}' onclick='sendLoadSnapshot({10});return false;' target='_blank'>- view original</a><br /><br style='clear:both' />",F,F,D,G,D,D,A,A,location.hostname,F,F);
SWContext.AppendChatBox(B,C,E,true);};SWContext.AppendImageBox=function(A,D,I){var F=I.replace("full","thumb");var C=format("<a href='{0}' onclick='sendLoad(\"{1}\");return false;' class='snaplink'><img src='{2}' alt='' width='64' height='64'/></a>",I,I,F);var E=format("<a href='{0}' onclick='sendLoad(\"{1}\");return false;' >- view image</a><br />",I,I);
var H=format("<a href='{0}' onclick='sendCopyImage({1}, \"{2}\");return false;' >- add to My Media</a><br />",I,D.id,I);var G=format("<a href='{0}' onclick='SWContext.TransmitFile(\"{1}\");return false;' >- save to my computer</a><br />",I,I);var B=format("<br /><a href='{0}' onclick='sendLoad(\"{1}\");return false;' >- flag as inappropriate</a><br />",I,I);
B="";var J=C+E+H+G+B+"<br style='clear:both' />";SWContext.AppendChatBox(A,D,J,true);};SWContext.AppendDocumentBox=function(B,D,H,A){var C=format("<br/><a href='{0}' onclick='sendLoad(\"{1}\");return false;' class='snaplink'><img src='{2}' alt='' width='64' height='64' style='border:none;'/></a>",H,H,A);
var E=format("<br /><a href='{0}' onclick='sendLoad(\"{1}\");return false;' >&nbsp;- view document</a><br />",H,H);var G=format("<a href='{0}' onclick='sendCopyImage({1}, \"{2}\");return false;' >&nbsp;- add to My Media</a><br />",H,D.id,H);var F=format("<a href='{0}' onclick='window.open(\"{1}\");return false;' >&nbsp;- save to my computer</a><br />",H,H);
G="";var I=C+E+G+F+"<br style='clear:both' />";SWContext.AppendChatBox(B,D,I,true);};SWContext.GetUniqueIDString=function(){return"sessionID="+sessionID+"&userID="+userID;};SWContext.GetRandomToken=function(){return"&rnd="+Math.random();};function ResizeHandle(C,B,A){this.box=C;this.width=B;this.height=A;
this.pageNumber=currentPage;}ResizeHandle.prototype.type="ResizeHandle";ResizeHandle.prototype.draw=function(A){};function Box(G,B,F,D,A,E,C){if(!G&&E){G=this.spawnDiv(B,F,D,A,E,C);}this.className=Box.className;if(G){this.construct(G,B,F,D,A);this.resize(D,A);this.draw();}}Box.prototype.type="Box";Box.className="Box";
Box.prototype.construct=function(G,B,F,D,A,E,C){this.boxID=Math.random();this.pos=new Point(B,F);this.width=D;this.height=A;this.anchors=new Array;this.resizeHandle=new ResizeHandle(this,16,16);this.editing=false;this.isActive=true;if(G.id){this.div=G;}else{this.div=document.getElementById(G);}this.div.jref=this;
this.contentElement=getDescendantByClassName(this.div,"boxContent");this.isDirty=false;this.chromePadding=new Object;this.chromePadding.top=0;this.chromePadding.left=0;this.chromePadding.right=0;this.chromePadding.bottom=0;this.contentPadding=new Object;this.contentPadding.top=0;this.contentPadding.left=0;
this.contentPadding.right=0;this.contentPadding.bottom=0;if(this.hasController){this.constructController();}this.pageNumber=currentPage;};Box.prototype.setContent=function(C){if(this.contentElement){this.contentElement.style.overflow="hidden";this.contentElement.innerHTML=C;var B=this.contentElement.scrollWidth+this.contentPadding.left+this.contentPadding.right;
var A=this.contentElement.scrollHeight+this.contentPadding.top+this.contentPadding.bottom;if(B>this.width||A>this.height){if(B<this.width){B=this.width;}if(A<this.height){A=this.height;}this.resize(B,A);}this.contentElement.style.overflow="visible";}};Box.prototype.getContent=function(){if(this.contentElement){return this.contentElement.innerHTML;
}else{return ;}};Box.prototype.setStyle=function(D){if(D&&this.contentElement){var C=/(-([a-z]))/;var F=D.split(";");for(var A=0;A<F.length;A++){if(F[A]!=""){var G=F[A].split(":");if(G.length==2){var B=G[0];var E=G[1];while(B.match(C)){B=B.replace(C,RegExp.$2.toUpperCase());}this.contentElement.style[B]=E;
}}}}};Box.prototype.remove=function(){this.div.style.display="none";this.isActive=false;if(SWCanvas.onremove){SWCanvas.onremove(this);}};Box.prototype.reinstate=function(){this.div.style.display="";this.isActive=true;this.draw();if(SWCanvas.onreinstate){SWCanvas.onreinstate(this);}};Box.prototype.containsPoint=function(A,B){if(this.pos.x<A&&A<this.pos.x+this.width&&this.pos.y<B&&B<this.pos.y+this.height){return true;
}return false;};Box.prototype.getObjectAtPosition=function(B,D){if(SWCanvas.selected==this&&this.pos.x+this.width-this.chromePadding.left-this.resizeHandle.width<B&&this.pos.x+this.width>B&&this.pos.y+this.height-this.chromePadding.top-this.resizeHandle.height<D&&this.pos.y+this.height>D){return this.resizeHandle;
}for(var A=0;A<this.anchors.length;A++){var C=this.anchors[A];if(C.containsPoint(B,D)){return C;}}return this;};Box.prototype.storeLastState=function(){if(!this.lastState){this.lastState={isActive:false,x:-1000,y:0,width:0,height:0,clone:function(){return{isActive:this.isActive,x:this.x,y:this.y,width:this.width,height:this.height};
}};}else{this.lastState.isActive=this.isActive;this.lastState.x=this.pos.x;this.lastState.y=this.pos.y;this.lastState.width=this.width;this.lastState.height=this.height;}};Box.prototype.revertToLastState=function(){this.isActive=this.lastState.isActive;this.pos.x=this.lastState.x;this.pos.y=this.lastState.y;
this.width=this.lastState.width;this.height=this.lastState.height;this.draw();};Box.prototype.revertToState=function(A){this.isActive=A.isActive;this.pos.x=A.x;this.pos.y=A.y;this.width=A.width;this.height=A.height;this.draw();};Box.prototype.toScript=function(){var B="";if(this.contentElement&&RichText){RichText.saveContext();
RichText.sniff(this.contentElement);B=RichText.toString();RichText.loadContext();}var A=format("new {0}(null, {1}, {2}, {3}, {4}, '{5}', '{6}');",this.className,this.pos.x,this.pos.y,this.width,this.height,this.contentElement?this.scriptEncode(this.contentElement.innerHTML):"",B);return A;};Box.prototype.scriptEncode=function(A){A=A.replace(/\n/g,"\\n");
A=A.replace(/'/g,"\\'");return A;};Box.prototype.spawnDiv=function(B,G,D,A,E,C){var F={id:"box"+Math.random(),className:"stickiBox",childNodes:[{className:"boxContent"}]};this.div=Box.buildComplexNode(F);this.div.style.position="absolute";this.contentElement=getDescendantByClassName(this.div,"boxContent");
this.contentElement.innerHTML=E;this.setStyle(C);document.body.appendChild(this.div);return this.div;};Box.prototype.draw=function(B){try{if(!this.isActive){this.div.style.display="none";return ;}this.div.style.left=this.pos.x+"px";this.div.style.top=this.pos.y+"px";if(this.hasController){this.cover.style.left=this.pos.x+this.chromePadding.left+"px";
this.cover.style.top=this.pos.y+this.chromePadding.top+"px";var D=SWCanvas.over&&SWCanvas.over.div.id==this.div.id;for(var A=0;A<this.anchors.length;A++){this.anchors[A].draw(B,D);}}}catch(C){}};Box.prototype.show=function(){if(this.isActive){this.div.style.display="block";}if(this.hasController){}};
Box.prototype.hide=function(){if(this.div&&this.div.style){this.div.style.display="none";if(this.hasController){this.cover.style.display="none";}}};Box.prototype.resize=function(D,A){var C=this.contentPadding.top+this.contentPadding.bottom;var B=this.contentPadding.left+this.contentPadding.right;if(D<B){this.pos.x=this.pos.x+D-B;
D=B;}if(A<C){this.pos.y=this.pos.y+A-C;A=C;}this.width=D;this.height=A;this.div.style.width=this.width+"px";this.div.style.height=this.height+"px";if(this.contentElement){this.contentElement.style.height=(this.height-C)+"px";}this.updateCover();};Box.prototype.showHandle=function(){};Box.prototype.hideHandle=function(){};
Box.prototype.updateCover=function(){};Box.prototype.showEdit=function(){};Box.prototype.hideEdit=function(){};Box.prototype.renderSelector=function(){};Box.prototype.sizeSelector=function(){};Box.prototype.pushUndoMoveSizeSpawn=function(){};Box.prototype.noteActivity=function(A){};Box.prototype.setZIndex=function(A){this.div.style.zIndex=A;
};Box.buildComplexNode=function(B,C){C=C?C:document;var E=C.createElement("DIV");for(key in B){if(key=="childNodes"){var D=B[key];for(var A=0;A<D.length;A++){E.appendChild(Box.buildComplexNode(D[A],C));}}else{E[key]=B[key];}}return E;};Box.buildContextMenu=function(A){var B=new ContextMenu;B.AddLink(null,"Edit Text","http://www.snapwiz.com/prep/images/video/edit_box.png",function(C){setTimeout("SWCanvas.contextMenu_Box.context.showEdit()",100);
SWCanvas.hideContextMenu();showTextEditor();return cancelEvent(C);});B.AddLink(null,"Split Text","http://www.snapwiz.com/prep/images/video/edit_box.png",function(G){var M=SWCanvas.getBoxById(SWCanvas.contextMenu_Box.context.boxID);var I=M.getContent();var L=I.split("</p>");if(L.length>1){SWCanvas.removeBox(SWCanvas.contextMenu_Box.context.boxID,true);
var J=M.width;var C=parseInt(M.height)/(L.length);var E=M.pos.x;for(var K=0;K<L.length;K++){var H=L[K];H=trim(H);if(H&&H.length>0){var D=M.pos.y+K*C+40;H=H+"</p>";var F=new TransBox(null,E,D,J,C,"","",null);SWCanvas.addBox(F);SWCanvas.select(F);setLabelContent(344215,F.boxID,H);sendTextPosition(F);}}}SWCanvas.hideContextMenu();
return cancelEvent(G);});B.AddLink(null,"Delete","http://www.snapwiz.com/prep/images/video/delete_shape.png",function(C){SWCanvas.removeBox(SWCanvas.contextMenu_Box.context.boxID,true);SWCanvas.hideContextMenu();return cancelEvent(C);});B.AddSeparator();B.AddLink(null,"Bring to Front","http://www.snapwiz.com/prep/images/video/bring_forward.png",function(C){sendLabelOrder(SWCanvas.contextMenu_Box.context,"front");
SWCanvas.hideContextMenu();return cancelEvent(C);});B.AddLink(null,"Send to Back","http://www.snapwiz.com/prep/images/video/push_back.png",function(C){sendLabelOrder(SWCanvas.contextMenu_Box.context,"back");SWCanvas.hideContextMenu();return cancelEvent(C);});A.contextMenu_Box=B;};Box.prototype.showContextMenu=function(C,B){if(drawMode==SWVState.None||drawMode==SWVState.Move){var A=SWCanvas.contextMenu_Box;
A.show(this,C,B);}};function Point(A,B){this.x=A;this.y=B;}function ImageBox(F,B,E,C,A,D){if(!F){F=this.spawnDiv(B,E,C,A,D);}this.className=ImageBox.className;this.construct(F,B,E,C,A);this.chromePadding=new Object;this.chromePadding.top=0;this.chromePadding.left=0;this.chromePadding.right=0;this.chromePadding.bottom=0;
this.contentPadding=new Object;this.contentPadding.top=10;this.contentPadding.left=10;this.contentPadding.right=10;this.contentPadding.bottom=10;this.img=new Image;this.img=getDescendantByClassName(this.div,"boxImage");this.aspectRatio=0;if(C>0){this.resize(C,A);this.draw();}if(D&&D!=""){this.setContent(D);
}this.img.jref=this;if(this.hasController){this.constructSpecificController();}this.pageNumber=currentPage;}ImageBox.prototype=new Box;ImageBox.className="ImageBox";ImageBox.prototype.setContent=function(B){if(this.img.src!=B){this.aspectRatio=0;var A=this.img;var C=this;A.onload=function(D){C.resize(A.offsetWidth,A.offsetHeight);
};}this.img.src=B;};ImageBox.prototype.toScript=function(){var A=format("new {0}(null, {1}, {2}, {3}, {4}, '{5}');",this.className,this.pos.x,this.pos.y,this.width,this.height,this.img.src);return A;};ImageBox.prototype.spawnDiv=function(B,H,D,A,E,C){var G={id:"box"+Math.random(),className:"imageBox"};
this.div=Box.buildComplexNode(G);this.div.style.position="absolute";this.img=new Image;this.img.src=E;this.img.className="boxImage";this.div.appendChild(this.img);var F=document;if(JCanvas&&SWCanvas&&SWCanvas.doc){F=SWCanvas.doc;}F.body.appendChild(this.div);return this.div;};ImageBox.prototype.resize=function(D,A){var C=this.contentPadding.top+this.contentPadding.bottom;
var B=this.contentPadding.left+this.contentPadding.right;if(D<B){this.pos.x=this.pos.x+D-B;D=B;}if(A<C){this.pos.y=this.pos.y+A-C;A=C;}this.width=D;this.height=A;this.div.style.width=this.width+"px";this.div.style.height=this.height+"px";this.updateCover();this.img.width=this.width;this.img.height=this.height;
this.img.style.width=this.width+"px";this.img.style.height=this.height+"px";};ImageBox.buildContextMenu=function(A){var B=new ContextMenu;if(!SWCanvas.isSinglePage){B.AddLink(null,"Show Full Size","http://www.snapwiz.com/prep/images/video/arrow_out.png",function(C){SWCanvas.hideDragging();sendLoad(SWCanvas.contextMenu_ImageBox.context.img.src);
SWCanvas.hideContextMenu();return cancelEvent(C);});}B.AddLink(null,"Delete","http://www.snapwiz.com/prep/images/video/icons/delete_shape.png",function(C){SWCanvas.removeBox(SWCanvas.contextMenu_ImageBox.context.boxID,true);SWCanvas.hideContextMenu();return cancelEvent(C);});B.AddSeparator();B.AddLink(null,"Bring to Front","http://www.snapwiz.com/prep/images/video/icons/bring_forward.png",function(C){sendLabelOrder(SWCanvas.contextMenu_ImageBox.context,"front");
SWCanvas.hideContextMenu();return cancelEvent(C);});B.AddLink(null,"Send to Back","http://www.snapwiz.com/prep/images/video/icons/push_back.png",function(C){sendLabelOrder(SWCanvas.contextMenu_ImageBox.context,"back");SWCanvas.hideContextMenu();return cancelEvent(C);});A.contextMenu_ImageBox=B;};ImageBox.prototype.showContextMenu=function(C,B){if(drawMode==SWVState.None||drawMode==SWVState.Move){var A=SWCanvas.contextMenu_ImageBox;
A.show(this,C,B);}};function EditableImageBox(H,B,G,D,A,E,C,F){if(D>0){this.constructEditableImageBox(H,B,G,D,A,E,C,F);}}EditableImageBox.prototype=new Box;EditableImageBox.className="EditableImageBox";EditableImageBox.prototype.constructEditableImageBox=function(H,B,G,D,A,E,C,F){if(!H){H=this.spawnDiv(B,G,D,A,E,C,F);
}this.className=EditableImageBox.className;this.construct(H,B,G,D,A);this.chromePadding=new Object;this.chromePadding.top=0;this.chromePadding.left=0;this.chromePadding.right=0;this.chromePadding.bottom=0;this.contentPadding=new Object;this.contentPadding.top=20;this.contentPadding.left=2;this.contentPadding.right=5;
this.contentPadding.bottom=5;this.img=new Image;this.img=getDescendantByClassName(this.div,"boxImage");this.resize(D,A);this.draw();if(E&&E!=""){this.setContent(E);}this.img.jref=this;if(this.hasController){this.constructSpecificController();}this.pageNumber=currentPage;};function setCanvasHeight(){var B=canvasTopAndHeightValue.split("_");
var A=B.sort(function(E,D){return D-E;});var C=getFrameWindow("canvasFrame").document;canvas=C.getElementById("mainCanvas");canvas.style.height="99%";}EditableImageBox.prototype.resize=function(D,A){var C=this.contentPadding.top+this.contentPadding.bottom;var B=this.contentPadding.left+this.contentPadding.right;
if(D<B){this.pos.x=this.pos.x+D-B;D=B;}if(A<C){this.pos.y=this.pos.y+A-C;A=C;}this.width=D;this.height=A;this.div.style.width=this.width+"px";this.div.style.height=this.height+"px";var E=document.all?1:2;this.contentElement.style.height=(this.height-(this.contentPadding.top+this.contentPadding.bottom)*E)+"px";
this.contentElement.style.width=(this.width-(this.contentPadding.left+this.contentPadding.right)*E)+"px";this.updateCover();this.img.width=this.width;this.img.height=this.height;};var canvasTopAndHeightValue="";EditableImageBox.prototype.spawnDiv=function(G,F,C,I,E,B,A){if(!A){A="http://www.snapwiz.com/prep/images/video/symbols/sticki1.png";
}var H=document;if(JCanvas&&SWCanvas&&SWCanvas.doc){H=SWCanvas.doc;}var D={id:"box"+Math.random(),className:"editableImageBox",childNodes:[{className:"boxContent"}]};canvasTopAndHeightValue=canvasTopAndHeightValue+"_"+parseInt(F+I);this.div=Box.buildComplexNode(D,H);this.div.style.position="absolute";
if(navigator.appName=="Microsoft Internet Explorer"){this.div.style.paddingTop=15+"px";}this.contentElement=getDescendantByClassName(this.div,"boxContent");this.contentElement.innerHTML=E;this.setStyle(B);this.img=H.createElement("IMG");this.img.src=A;if(document.all&&navigator.appVersion.indexOf("MSIE 6")>-1){this.img.src=A.replace(".png",".gif");
}this.img.className="boxImage";this.div.insertBefore(this.img,this.contentElement);H.body.appendChild(this.div);return this.div;};function TransBox(H,B,G,D,A,E,C,F){if(!F){F="http://www.snapwiz.com/prep/images/video/pixel.jpeg";}this.constructEditableImageBox(H,B,G,D,A,E,C,F);this.className=TransBox.className;
this.chromePadding=new Object;this.chromePadding.top=0;this.chromePadding.left=0;this.chromePadding.right=0;this.chromePadding.bottom=0;this.contentPadding=new Object;this.contentPadding.top=0;this.contentPadding.left=0;this.contentPadding.right=0;this.contentPadding.bottom=0;this.contentElement.style.padding="0px";
this.pageNumber=currentPage;}TransBox.prototype=new EditableImageBox;TransBox.className="TransBox";function StickiBox(H,B,G,D,A,E,C,F){if(!F){F="http://www.snapwiz.com/prep/images/video/symbols/stickI1.png";}this.constructEditableImageBox(H,B,G,D,A,E,C,F);this.className=StickiBox.className;this.chromePadding=new Object;
this.chromePadding.top=0;this.chromePadding.left=0;this.chromePadding.right=0;this.chromePadding.bottom=0;this.contentPadding=new Object;this.contentPadding.top=10;this.contentPadding.left=10;this.contentPadding.right=10;this.contentPadding.bottom=10;this.contentElement.style.padding="10px 10px 10px 10px";
this.pageNumber=currentPage;}StickiBox.prototype=new EditableImageBox;StickiBox.className="StickiBox";function BubbleBox(H,B,G,D,A,E,C,F){if(!F){F="http://www.snapwiz.com/prep/images/video/symbols/stickI2.png";}this.constructEditableImageBox(H,B,G,D,A,E,C,F);this.className=BubbleBox.className;this.chromePadding=new Object;
this.chromePadding.top=0;this.chromePadding.left=0;this.chromePadding.right=0;this.chromePadding.bottom=0;this.contentPadding=new Object;this.contentPadding.top=10;this.contentPadding.left=10;this.contentPadding.right=10;this.contentPadding.bottom=50;this.contentElement.style.padding="10px 10px 50px 10px";
this.pageNumber=currentPage;}BubbleBox.prototype=new EditableImageBox;BubbleBox.className="BubbleBox";function FlowBox(H,B,G,D,A,E,C,F){if(!F){F="http://www.snapwiz.com/prep/images/video/symbols/flowbox_285.png";}this.constructEditableImageBox(H,B,G,D,A,E,C,F);this.className=FlowBox.className;this.chromePadding=new Object;
this.chromePadding.top=0;this.chromePadding.left=0;this.chromePadding.right=0;this.chromePadding.bottom=0;this.contentPadding=new Object;this.contentPadding.top=10;this.contentPadding.left=10;this.contentPadding.right=10;this.contentPadding.bottom=10;this.contentElement.style.padding="10px 10px 10px 10px";
this.pageNumber=currentPage;}FlowBox.prototype=new EditableImageBox;FlowBox.className="FlowBox";function Pattern(E,D,B,A,C){if(E.id){this.div=E;}else{this.div=document.getElementById(E);}this.pos=new Point(getLeft(this.div),getTop(this.div));if(B!=null&&A!=null){this.width=B;this.height=A;}this.shapeType=D;
this.content=C;this.div.jref=this;addListener(this.div,"mouseover",this.mouseover);addListener(this.div,"mouseout",this.mouseout);addListener(this.div,"mousedown",this.mousedown);this.pageNumber=currentPage;}Pattern.over=null;Pattern.BoxTypes=new Object;Pattern.BoxTypes.Box="Box";Pattern.BoxTypes.StickiBox="StickiBox";
Pattern.BoxTypes.BubbleBox="BubbleBox";Pattern.BoxTypes.FlowBox="FlowBox";Pattern.prototype.type="Pattern";Pattern.prototype.draw=function(A){};Pattern.prototype.mouseover=function(C){var B=C.target?C.currentTarget:C.srcElement;var A=Pattern.GetJRef(B);if(A){Pattern.over=A;}else{trace(B.tagName+" "+B.id+" no jref");
}};Pattern.prototype.mouseout=function(A){Pattern.over=null;};Pattern.prototype.mousedown=function(A){if(window.drawMode&&window.SWVState){}};Pattern.prototype.containsPoint=function(A,B){if(this.pos.x<A&&A<this.pos.x+this.width&&this.pos.y<B&&B<this.pos.y+this.height){return true;}return false;};Pattern.prototype.spawn=function(C,B,E,F){var I=C;
var H=B;var A=this.div.cloneNode(true);if(!false&&document.all){try{A=SWCanvas.doc.createElement("DIV");}catch(G){writeDebugLog("couldn't add elements to this document");return null;}A.outerHTML=this.div.outerHTML;A.innerHTML=this.div.innerHTML;A.className=this.div.className;A.style.cssText=this.div.style.cssText;
}A.id="box"+SWCanvas.boxes.length;A.style.position="absolute";SWCanvas.doc.body.appendChild(A);var D=new (this.shapeType)(A,I-E.x,H-E.y,this.width,this.height,F);if(F){D.setContent(F);}else{if(this.content){D.setContent(this.content);}else{if(!this.content&&D.contentElement){}}}Pattern.over=null;return D;
};Pattern.GetJRef=function(A){if(!A){return null;}else{if(A.jref){return A.jref;}else{if(A.parentNode){return Pattern.GetJRef(A.parentNode);}}}return null;};function ContextMenu(){this.div=SWCanvas.doc.createElement("DIV");this.div.className="contextMenu";this.div.style.display="none";this.div.style.zIndex="16000";
SWCanvas.doc.body.appendChild(this.div);this.subnav=document.createElement("DIV");this.subnav.className="contextnav";this.subnav.style.display="none";this.context=null;}ContextMenu.prototype.listen=function(A){};ContextMenu.prototype.show=function(A,C,B){this.context=A;if(!B){this.div.style.left=C.x+"px";
this.div.style.top=C.y+"px";this.div.style.display="";}this.subnav.style.display="";};ContextMenu.prototype.hide=function(){this.div.style.display="none";this.subnav.style.display="none";};ContextMenu.prototype.AddLink=function(B,D,A,C){this.div.appendChild(this.BuildLink(SWCanvas.doc,B,D,A,C));this.subnav.appendChild(this.BuildLink(document,B,D,A,C));
};ContextMenu.prototype.BuildLink=function(F,B,G,A,C){var D=F.createElement("A");D.href=B?B:"javascript:void(null);";D.title=G;if(C){addListener(D,"mousedown",C);}var E="<img src='_1_' alt='_0_'/> _0_";E=E.replace(/_0_/g,G);E=E.replace(/_1_/g,A?A:"/images/video/pixel.gif");D.innerHTML=E;return D;};ContextMenu.prototype.AddSeparator=function(){var A=SWCanvas.doc.createElement("HR");
this.div.appendChild(A);};function CShape(C,F,E,A,G,H,I,D,B){this.className=CShape.className;if(C!=null){this.construct(C,F,E,A,G,H,I,D,B);}}CShape.prototype=new Box;CShape.prototype.type="CShape";CShape.className="CShape";CShape.ShapeTypes=new Object;CShape.ShapeTypes.Line=0;CShape.ShapeTypes.Square=1;
CShape.ShapeTypes.Oval=2;CShape.ShapeTypes.RBox=3;CShape.ShapeTypes.PLine=4;CShape.ShapeTypes.RTriangle=6;CShape.ShapeTypes.Arrow=7;CShape.prototype.construct=function(C,F,E,A,G,H,I,D,B){this.northWest=(B==null)?true:B;if(A<0){F=F+A;A=-A;this.northWest=!this.northWest;}if(G<0){E=E+G;G=-G;this.northWest=!this.northWest;
if(C==CShape.ShapeTypes.Arrow){arrowSwitched=true;}}this.boxID=Math.random();this.pos=new Point(F,E);this.width=A;this.height=G;this.shapeType=C;this.stroke=H;this.fill=I;this.weight=parseInt(D);this.contextPad=Math.floor(D/2);this.anchors=new Array;this.resizeHandle=new ResizeHandle(this,16,16);this.editing=false;
this.isActive=true;this.chromePadding=new Object;this.chromePadding.top=0;this.chromePadding.left=0;this.chromePadding.right=0;this.chromePadding.bottom=0;this.contentPadding=new Object;this.contentPadding.top=10;this.contentPadding.left=10;this.contentPadding.right=10;this.contentPadding.bottom=10;this.rebuild();
this.contentElement=null;this.isDirty=false;if(this.hasController){this.constructController();}this.pageNumber=currentPage;};CShape.prototype.rebuild=function(){if(this.div){deleteNode(this.div);clearCanvas(this.context);}this.div=null;this.context=null;var A=CShape.createCanvas(this.pos.x-this.contextPad,this.pos.y-this.contextPad,this.width+this.weight,this.height+this.weight,SWCanvas.doc);
this.div=A.div;this.context=A.context;this.render();this.div.jref=this;SWCanvas.refreshOrder();};CShape.prototype.render=function(){if(!this.isActive){this.div.style.display="none";return ;}var A=new BoxShape(this.contextPad,this.contextPad,this.width+this.contextPad,this.height+this.contextPad,this.shapeType,this.stroke,this.weight,this.northWest);
A.Draw(this.context);if(SWCanvas.selected==this){this.renderSelector();}};CShape.prototype.toScript=function(){var A=format("new {0}({1}, {2}, {3}, {4}, {5}, '{6}', '{7}', {8}, {9});",this.className,this.shapeType,this.pos.x,this.pos.y,this.width,this.height,this.stroke,this.fill,this.weight,this.northWest);
return A;};CShape.prototype.containsPoint=function(A,C){if(!this.pos){return false;}var B=0;if(this.width<5||this.height<5){B=this.weight+1;}if(this.pos.x-B<A&&A<this.pos.x+this.width+B&&this.pos.y-B<C&&C<this.pos.y+this.height+B){return true;}return false;};CShape.prototype.draw=function(A){this.div.style.left=this.pos.x-this.contextPad+"px";
this.div.style.top=this.pos.y-this.contextPad+"px";if(this.hasController){this.cover.style.left=this.pos.x-this.contextPad+this.chromePadding.left+"px";this.cover.style.top=this.pos.y-this.contextPad+this.chromePadding.top+"px";if(this.activityLabel){this.activityLabel.style.left=this.pos.x+"px";this.activityLabel.style.top=this.pos.y+"px";
}}this.render();};CShape.prototype.resize=function(B,A){if(boxShape.drawing){boxShape.x2=mouse.x;boxShape.y2=mouse.y;clearCanvas(contextTemp);boxShape.Draw(contextTemp);this.hideHandle();}else{if(B<0){this.pos.x=this.pos.x+B;B=-B;}if(A<0){this.pos.y=this.pos.y+A;A=-A;}this.width=B;this.height=A;this.updateCover();
}if(this.hasController&&SWCanvas.selected==this){this.renderSelector();}};CShape.prototype.showContextMenu=function(C,B){if(drawMode==SWVState.None||drawMode==SWVState.Move){var A=SWCanvas.contextMenu_CShape;A.show(this,C,B);}};CShape.buildContextMenu=function(A){var B=new ContextMenu;B.AddLink(null,"Delete","http://www.snapwiz.com/prep/images/video/delete_shape.png",function(C){SWCanvas.removeBox(SWCanvas.contextMenu_CShape.context.boxID,true);
SWCanvas.hideContextMenu();return cancelEvent(C);});B.AddSeparator();B.AddLink(null,"Bring to Front","http://www.snapwiz.com/prep/images/video/bring_forward.png",function(C){sendLabelOrder(SWCanvas.contextMenu_CShape.context,"front");SWCanvas.hideContextMenu();return cancelEvent(C);});B.AddLink(null,"Send to Back","http://www.snapwiz.com/prep/images/video/push_back.png",function(C){sendLabelOrder(SWCanvas.contextMenu_CShape.context,"back");
SWCanvas.hideContextMenu();return cancelEvent(C);});A.contextMenu_CShape=B;};CShape.createCanvas=function(B,H,E,A,F){var D;var G=F.createElement("DIV");G.style.position="absolute";G.style.left=B+"px";G.style.top=H+"px";G.style.width=E+"px";G.style.height=A+"px";G.width=E;G.height=A;G.style.textAlign="left";
var C=F.createElement("CANVAS");C.style.position="absolute";C.style.width=E+"px";C.style.height=A+"px";C.width=E;C.height=A;G.appendChild(C);F.body.appendChild(G);if(C.getContext){D=C.getContext("2d");}else{C=G_vmlCanvasManager.initElement(C);D=C.getContext("2d");}return new CanvasPack(G,D);};function CanvasPack(B,A){this.div=B;
this.context=A;}function CPolyLine(B,D,C,A,E){this.className=CPolyLine.className;this.hasSent=false;if(B){this.readPoints(B);this.construct(this.type,this.x,this.y,this.width,this.height,D,null,C);if(A>0||E>0){this.pos.x=A;this.pos.y=E;this.draw(SWCanvas.context);}}}CPolyLine.prototype=new CShape;CPolyLine.prototype.type="CPolyLine";
CPolyLine.className="CPolyLine";CPolyLine.prototype.readPoints=function(C){this.points=C;this.x=10000;this.y=10000;this.width=0;this.height=0;this.pageNumber=currentPage;for(var B=1;B<this.points.length;B+=2){var A=parseInt(this.points[B-1]);var D=parseInt(this.points[B]);if(A<this.x){this.x=A;}if(D<this.y){this.y=D;
}}for(var B=1;B<this.points.length;B+=2){var A=parseInt(this.points[B-1])-this.x;var D=parseInt(this.points[B])-this.y;if(A>this.width){this.width=A;}if(D>this.height){this.height=D;}this.points[B-1]=A;this.points[B]=D;}};CPolyLine.prototype.render=function(){if(!this.pline){this.pline=new PLine(this.points,this.stroke,this.weight);
for(var A=0;A<this.pline.points.length;A++){this.pline.points[A]=parseInt(this.pline.points[A])+this.contextPad;}}this.pline.Draw(this.context);};CPolyLine.prototype.draw=function(A){if(this.div&&this.div.style&&this.pos){this.div.style.left=(this.pos.x-this.contextPad)+"px";this.div.style.top=(this.pos.y-this.contextPad)+"px";
if(this.hasController&&this.cover&&this.cover.style){this.cover.style.left=(this.pos.x-this.contextPad)+this.chromePadding.left+"px";this.cover.style.top=(this.pos.y-this.contextPad)+this.chromePadding.top+"px";}}};CPolyLine.prototype.toScript=function(){var B=format("[{0}]",this.points.join(","));var A=format("new {0}({1}, '{2}', {3}, {4}, {5});",this.className,B,this.stroke,this.weight,this.pos.x,this.pos.y);
return A;};function ToggleButton(A){this.link=loadObjectFromDoc(A);this.link.jref=this;this.checked=false;this.onChange=null;addListener(this.link,"click",this.click);}ToggleButton.prototype.click=function(B){var A=B.target?B.target:B.srcElement;if(A.tagName=="IMG"){A=A.parentNode;}A.jref.toggle();A.blur();
};ToggleButton.prototype.render=function(){if(this.checked){this.link.className="selected";}else{this.link.className="";}};ToggleButton.prototype.toggle=function(){this.checked=!this.checked;this.render();if(this.onChange!=null){this.onChange(this);}};ToggleButton.prototype.setIsChecked=function(B,A){this.checked=B;
this.render();if(this.onChange!=null&&!A){this.onChange(this);}};function RadioButtonList(){this.links=new Array;for(var A=0;A<arguments.length;A++){var B=loadObjectFromDoc(arguments[A]);B.jref=this;B.checked=false;B.index=this.links.length;this.links[this.links.length]=B;addListener(B,"click",this.click);
}this.setSelectedIndex(0);this.onChange=null;}RadioButtonList.prototype.click=function(B){var A=B.target?B.target:B.srcElement;if(A.tagName=="IMG"){A=A.parentNode;}A.jref.setSelectedIndex(A.index);A.blur();};RadioButtonList.prototype.render=function(){for(var A=0;A<this.links.length;A++){var B=this.links[A];
if(B.checked){B.className="selected";}else{B.className="";}}};RadioButtonList.prototype.setSelectedIndex=function(B){for(var A=0;A<this.links.length;A++){var C=this.links[A];C.checked=false;}this.selectedIndex=B;this.links[B].checked=true;this.render();if(this.onChange!=null){this.onChange(this,this.selectedIndex);
}};var RichText=new Object;RichText.fontFamily="Arial,Sans-Serif";RichText.fontSize="14px";RichText.fontWeight="normal";RichText.fontStyle="normal";RichText.textAlign="left";RichText.color="#555";RichText.savedContext=null;RichText.ScriptEquivilants={color:"color","background-color":"backgroundColor","background-image":"backgroundImage","background-repeat":"backgroundRepeat","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","text-decoration":"textDecoration","text-align":"textAlign",padding:"padding","padding-left":"paddingLeft","padding-right":"paddingRight","padding-top":"paddingTop","padding-bottom":"paddingBottom"};
RichText.onChange=null;RichText.init=function(){RichText.boldButton=new ToggleButton("btnTextBold");RichText.italicButton=new ToggleButton("btnTextItalic");RichText.TextAlignList=new RadioButtonList("btnTextAlignLeft","btnTextAlignCenter","btnTextAlignRight");RichText.boldButton.onChange=RichText.settingChange;
RichText.italicButton.onChange=RichText.settingChange;RichText.TextAlignList.onChange=RichText.settingChange;};RichText.initHidden=function(){RichText.settingChange=function(){};RichText.sniff=function(A){if(A.sniffable){RichText.fontFamily=A.style.fontFamily;RichText.fontSize=A.style.fontSize;RichText.fontWeight=A.style.fontWeight;
RichText.fontStyle=A.style.fontStyle;RichText.textAlign=A.style.textAlign;RichText.color=A.style.color;if(RichText.onChange){RichText.onChange();}}};};RichText.settingChange=function(){var B=document.getElementById("rtFontFamily");var A=document.getElementById("rtFontSize");RichText.fontFamily=getSelectValue("rtFontFamily");
RichText.fontSize=getSelectValue("rtFontSize");RichText.fontWeight=RichText.boldButton.checked?"bold":"normal";RichText.fontStyle=RichText.italicButton.checked?"italic":"normal";switch(RichText.TextAlignList.selectedIndex){case 0:RichText.textAlign="left";break;case 1:RichText.textAlign="center";break;
case 2:RichText.textAlign="right";break;default:}B.style.fontFamily=RichText.fontFamily;if(RichText.onChange){RichText.onChange();}};RichText.apply=function(A){A.style.fontFamily=RichText.fontFamily;A.style.fontSize=RichText.fontSize;A.style.fontWeight=RichText.fontWeight;A.style.fontStyle=RichText.fontStyle;
A.style.textAlign=RichText.textAlign;A.style.color=RichText.color;A.sniffable=true;};RichText.sniff=function(A){if(A.sniffable){RichText.fontFamily=A.style.fontFamily;RichText.fontSize=A.style.fontSize;RichText.fontWeight=A.style.fontWeight;RichText.fontStyle=A.style.fontStyle;RichText.textAlign=A.style.textAlign;
RichText.color=A.style.color;setSelectValue("rtFontFamily",RichText.fontFamily,false);setSelectValue("rtFontSize",RichText.fontSize,false);RichText.boldButton.setIsChecked(RichText.fontWeight=="bold",true);RichText.italicButton.setIsChecked(RichText.fontWeight=="italic",true);switch(RichText.textAlign){case"left":RichText.TextAlignList.setSelectedIndex(0);
break;case"center":RichText.TextAlignList.setSelectedIndex(1);break;case"right":RichText.TextAlignList.setSelectedIndex(2);break;default:}if(RichText.onChange){RichText.onChange();}}};RichText.parse=function(B){var C=B.split(/;/);for(var A=0;A<C.length;A++){if(C[A]&&C[A].indexOf(":")>-1){var D=C[A].split(/:/);
RichText[RichText.ScriptEquivilants[D[0]]]=D[1];}}};RichText.saveContext=function(){RichText.savedContext=new Object;for(var A in RichText.ScriptEquivilants){var B=RichText.ScriptEquivilants[A];RichText.savedContext[B]=RichText[B];}};RichText.loadContext=function(){if(RichText.savedContext){for(var A in RichText.ScriptEquivilants){var B=RichText.ScriptEquivilants[A];
RichText[B]=RichText.savedContext[B];}}};RichText.toString=function(){return"font-family:"+RichText.fontFamily+";"+"font-size:"+RichText.fontSize+";"+"font-weight:"+RichText.fontWeight+";"+"font-style:"+RichText.fontStyle+";"+"text-align:"+RichText.textAlign+";"+"color:"+RichText.color+";";};RichText.processUserContent=function(A){A=A.replace(/</g,"&lt;");
A=A.replace(/\r\n/g,"<br/>");A=A.replace(/\n/g,"<br/>");A=A.replace(/  /g,"&nbsp;&nbsp;");A=A.replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;");return A;};RichText.unProcessUserContent=function(A){A=A.replace(/&nbsp;&nbsp;/g,"  ");A=A.replace(/<br\/>/gi,"\r\n");A=A.replace(/<br>/gi,"\r\n");A=A.replace(/&lt;/g,"<");
A=A.replace(/&gt;/g,">");return A;};function RichText_change(){if(SWCanvas.editing){var A=SWCanvas.getEditingBox();if(A){RichText.apply(A.editBox);RichText.apply(A.contentElement);A.styleString=RichText.toString();A.isDirty=true;}}}function RichText_init(){RichText.init();RichText.onChange=RichText_change;
RichText.settingChange();}var SWCanvas={context:null,contextTemp:null,ready:false,boxes:{},removedBoxes:{},connectors:{},patterns:{},undoStack:{}};var JCanvas={current:SWCanvas};var Scribble={current:SWCanvas};var jCanvas=SWCanvas;var contextTemp;SWCanvas.init=function(F){if(!F){F=getFrameWindow("canvasFrame").document;
}this.doc=F;this.canvas=F.getElementById("mainCanvas");this.canvasOverlay=F.getElementById("overlayCanvas");this.slideCover=F.getElementById("slideCover");this.canvas.width=getGreater((F.body.clientWidth),F.body.scrollWidth);this.canvas.height=getGreater((F.body.clientHeight-20),F.body.scrollHeight-20);
this.canvas.style.width=this.canvas.width+"px";this.canvas.style.height=document.body.clientHeight+"px";if(!this.canvas.getContext){alert("canvas not initialized");}this.context=this.canvas.getContext("2d");if(this.canvasOverlay&&this.slideCover){this.canvasOverlay.width=this.canvas.width;this.canvasOverlay.height=this.canvas.height;
this.canvasOverlay.style.width=this.canvas.width+"px";this.canvasOverlay.style.height=this.canvas.height+"px";this.slideCover.style.width=this.canvas.width+"px";this.slideCover.style.height=this.canvas.height+"px";this.contextTemp=this.canvasOverlay.getContext("2d");contextTemp=this.contextTemp;}this.width=this.canvas.width;
this.height=this.canvas.height;this.left=0;this.top=75;this.timeout=null;this.over=null;this.downPoint=null;this.editing=false;this.selected=null;this.selectedGroup=[];this.selectorDiv=null;this.clipboard=null;this.boxes=new Array;this.removedBoxes=new Array;this.connectors=new Array;this.patterns=new Array;
this.undoStack=new Array;this.onspawn=null;this.onmovesize=null;this.ontextchange=null;this.ontextclear=null;this.onremove=null;this.onreinstate=null;var C=this.doc.styleSheets[0];for(var B=0;B<document.styleSheets.length;B++){var E=document.styleSheets[B];if(E.title=="swvideo"){var G=E.cssRules?E.cssRules:E.rules;
for(var A=0;A<G.length;A++){if(C.insertRule){C.insertRule(G[A].cssText,0);}else{if(G[A].style.cssText){C.addRule(G[A].selectorText,G[A].style.cssText);}}}}}if(this.hasController){this.constructController();var D=getFrameWindow("canvasFrame");if(D){D.document.getElementById("slideCover").style.zIndex=210;
}}if(window.MediaPalette_init){MediaPalette_initStock();MediaPalette_init();}if(SWCanvas.hasController){SWCanvas.onspawn=Canvas_onspawn;SWCanvas.onmovesize=sendLabelPosition;SWCanvas.ontextchange=sendLabelContent;SWCanvas.ontextclear=sendLabelRemove;SWCanvas.onremove=sendLabelRemove;SWCanvas.onreinstate=sendLabelReinstate;
}SWCanvas.draw();};SWCanvas.getObjectAtPosition=function(E,C){var A=E;var F=C;if(Pattern.over){return Pattern.over;}for(var B=this.boxes.length-1;B>=0;B--){var D=this.boxes[B];if(D.containsPoint(A,F)){return D.getObjectAtPosition(A,F);}}return null;};SWCanvas.getBoxById=function(C){for(var A=0;A<this.boxes.length;
A++){var B=this.boxes[A];if(B.boxID==C){return B;}}for(var A=0;A<this.removedBoxes.length;A++){var B=this.removedBoxes[A];if(B.boxID==C){return B;}}return null;};SWCanvas.getBoxByDivId=function(B){for(var A=0;A<this.boxes.length;A++){var C=this.boxes[A];if(C.div.id==B){return C;}}for(var A=0;A<this.removedBoxes.length;
A++){var C=this.removedBoxes[A];if(C.div.id==B){return C;}}return null;};SWCanvas.getIndexById=function(C){for(var A=0;A<this.boxes.length;A++){var B=this.boxes[A];if(B.boxID==C){return A;}}return -1;};SWCanvas.getEditingBox=function(){for(var A=0;A<this.boxes.length;A++){var B=this.boxes[A];if(B.editing){return B;
}}return null;};SWCanvas.getPatternByClassName=function(B){for(var A=0;A<this.patterns.length;A++){var C=this.patterns[A];if(C.shapeType.className==B){return C;}}return null;};SWCanvas.forceClear=function(){for(var A=this.boxes.length-1;A>=0;A--){var B=this.boxes[A];this.removedBoxes.push(this.boxes.splice(A,1)[0]);
B.div.style.display="none";B.isActive=false;}};SWCanvas.addBox=function(A){writeDebugLog("Adding box to page :: "+A.pageNumber);this.boxes.push(A);this.refreshOrder();};SWCanvas.removeBox=function(C,D){for(var A=0;A<this.boxes.length;A++){var B=this.boxes[A];if(B.boxID==C){this.removedBoxes.push(this.boxes.splice(A,1)[0]);
B.remove();}}if(D){this.undoStack.push(function(){SWCanvas.reinstateBox(C,false);});}recordUserAction("delete",C,0,0,"","","","","","");};SWCanvas.reinstateBox=function(C,D){for(var A=0;A<this.removedBoxes.length;A++){var B=this.removedBoxes[A];if(B.boxID==C){this.boxes.push(this.removedBoxes.splice(A,1)[0]);
B.reinstate();}}};SWCanvas.showBoxes=function(){for(var A=0;A<this.boxes.length;A++){this.boxes[A].show();}};SWCanvas.hideBoxes=function(){for(var A=0;A<this.boxes.length;A++){this.boxes[A].hide();}};SWCanvas.sendToBack=function(B){var A=this.getIndexById(B);if(A>-1){var C=this.boxes.splice(A,1);this.boxes.splice(0,0,C[0]);
}this.invalidate();this.refreshOrder();};SWCanvas.bringToFront=function(B){var A=this.getIndexById(B);if(A>-1){var C=this.boxes.splice(A,1);this.boxes.push(C[0]);}this.invalidate();this.refreshOrder();};SWCanvas.refreshOrder=function(){for(var A=0;A<this.boxes.length;A++){if(this.boxes[A].setZIndex){this.boxes[A].setZIndex(100+A);
}else{this.boxes[A].div.style.zIndex=100+A;this.boxes[A].cover.style.zIndex=101+A;}}};SWCanvas.clearCanvas=function(A){if(A&&A.clearRect){A.clearRect(0,0,SWCanvas.width,SWCanvas.height);}};SWCanvas.clear=function(){for(var A=0;A<this.boxes.length;A++){var B=this.boxes[A];if(B!=null){B.remove();}B=null;
}this.boxes=new Array;};SWCanvas.invalidate=function(){if(this.timeout!=null){clearTimeout(this.timeout);}this.timeout=setTimeout("SWCanvas.draw()",10);};SWCanvas.draw=function(){for(var A=0;A<this.boxes.length;A++){this.boxes[A].draw(this.context);}};SWCanvas.hideEdit=function(){for(var A=0;A<this.boxes.length;
A++){this.boxes[A].hideEdit();}};SWCanvas.toScript=function(){var B="";if(window.viewingCacheID&&viewingCacheID!=""){B+=format("loadCache('{0}');",viewingCacheID);}for(var A=0;A<this.boxes.length;A++){var C=this.boxes[A];if(C.isActive){B+=C.toScript();}}return B;};function Canvas_onspawn(A){setDrawMode(SWVState.Move);
if(A.className==ImageBox.className&&A.img.src.toLowerCase().indexOf("usermedia")>-1){sendNoteImage(A);}}Box.prototype.constructController=function(){this.storeLastState();this.updateCover();};Box.prototype.hasController=true;Box.prototype.updateCover=function(){if(!this.cover){this.cover=SWCanvas.doc.createElement("DIV");
this.cover.className="coverHighlight";this.cover.jref=this;SWCanvas.doc.body.appendChild(this.cover);this.resizeImage=SWCanvas.doc.createElement("IMG");this.resizeImage.src="http://www.snapwiz.com/prep/images/video/boxResizeHandle.gif";this.resizeImage.className="resizeImage";this.resizeImage.ondragstart=function(){return false;
};this.resizeImage.jref=this;addListener(this.resizeImage,"mouseover",this.mouseover);addListener(this.resizeImage,"mouseout",this.mouseout);this.closeLink=SWCanvas.doc.createElement("A");this.hideHandle();}this.sizeSelector(this.cover,false);if(SWCanvas.selected==this&&!this.editing){this.renderSelector();
}};Box.prototype.showEdit=function(){if(!this.contentElement){return ;}if(SWCanvas.selected!=this){SWCanvas.select(this);}this.editing=true;SWCanvas.editing=true;};Box.prototype.hideEdit=function(){if(!this.contentElement){return ;}if(this.editBox){logMulti("editing",this.contentElement,this.isDirty);
if(this.contentElement&&this.isDirty){writeDebugLog("dirty");var A=RichText.processUserContent(this.editBox.value);this.setContent(A);this.isDirty=false;if(this.editBox.value==""){if(SWCanvas.ontextclear){SWCanvas.ontextclear(this);}}else{if(SWCanvas.ontextchange){if(this.editBox.value.length>1000&&this.width<800){this.resize(800,this.height);
sendLabelPosition(this);}SWCanvas.ontextchange(this,A);}}this.contentElement.style.display="";}else{if(this.contentElement){this.contentElement.style.display="";}}this.editBox.style.display="none";}this.editing=false;SWCanvas.editing=false;};Box.prototype.noteActivity=function(A){if(!this.activityLabel){this.activityLabel=SWCanvas.doc.createElement("DIV");
this.activityLabel.className="fadelabel";this.activityLabel.jref=this;this.activityLabel.id=Math.random();this.div.appendChild(this.activityLabel);}this.activityLabel.innerHTML=A.name;this.activityLabel.style.filter="alpha(opacity:100)";this.activityLabel.style.MozOpacity=1;this.activityLabel.style.display="block";
setTimeout("fadeElementOut('"+this.activityLabel.id+"', 95, SWCanvas.doc)",1000);};Box.prototype.showHandle=function(A){if(this.hasController){this.relativeZIndex=parseInt(this.div.style.zIndex)%100;this.div.style.zIndex=15000+this.relativeZIndex;this.cover.style.zIndex=15001+this.relativeZIndex;this.resizeImage.style.display="block";
this.closeLink.style.display="block";this.cover.style.display="block";if(A){this.cover.style.cursor=A;}}};Box.prototype.hideHandle=function(){if(this.hasController){SWCanvas.refreshOrder();this.resizeImage.style.display="none";this.closeLink.style.display="none";this.cover.style.display="none";}};Box.prototype.renderSelector=function(){if(!SWCanvas.selectorDiv){SWCanvas.selectorDiv=SWCanvas.doc.createElement("DIV");
SWCanvas.selectorDiv.className="boxSelector";addListener(SWCanvas.selectorDiv,"click",this.click);var A=SWCanvas.doc.createElement("IMG");A.src="http://www.snapwiz.com/prep/images/video/boxResizeHandle.gif";A.className="resizeImage";A.ondragstart=function(){return false;};SWCanvas.selectorDiv.appendChild(A);
}this.div.appendChild(SWCanvas.selectorDiv);this.sizeSelector(SWCanvas.selectorDiv,true);SWCanvas.selectorDiv.jref=this;};Box.prototype.sizeSelector=function(F,B){var E=document.all?0:2;var D=this.weight?this.weight:0;var A=this.width-this.chromePadding.left-this.chromePadding.right+D-E;var C=this.height-this.chromePadding.top-this.chromePadding.bottom+D-E;
A=A>0?A:0;C=C>0?C:0;F.style.width=A+"px";F.style.height=C+"px";if(B){F.style.display="block";}};Box.prototype.pushUndoMoveSizeSpawn=function(){var B=this;var A=this.lastState.clone();SWCanvas.undoStack.push(function(){B.revertToState(A);sendLabelPosition(B);});};Box.prototype.setZIndex=function(A){if(this.div&&this.div.style&&this.cover&&this.cover.style){this.div.style.zIndex=A;
this.cover.style.zIndex=A+1;}};Box.prototype.mouseover=function(A){};Box.prototype.mouseout=function(A){};Box.prototype.click=function(A){};Box.prototype.editBox_keydown=function(B){var A=B.target?B.currentTarget:B.srcElement;if(A.jref){A.jref.isDirty=true;switch(B.keyCode){case 13:break;case 9:A.jref.isDirty=true;
A.jref.hideEdit();SWCanvas.deselect();setDrawMode(SWVState.Move,null);default:}}};CShape.prototype.constructController=function(){this.storeLastState();this.updateCover();};CShape.prototype.hasController=true;CShape.prototype.updateCover=function(){if(!this.cover){this.cover=SWCanvas.doc.createElement("DIV");
this.cover.className="coverHighlight";this.cover.jref=this;SWCanvas.doc.body.appendChild(this.cover);this.resizeImage=SWCanvas.doc.createElement("IMG");this.resizeImage.src="http://www.snapwiz.com/prep/images/video/icons/boxResizeHandle.gif";this.resizeImage.className="resizeImage";this.resizeImage.ondragstart=function(){return false;
};this.resizeImage.jref=this;this.closeLink=SWCanvas.doc.createElement("A");this.hideHandle();}this.sizeSelector(this.cover,false);if(SWCanvas.selected==this){this.renderSelector();}};CShape.prototype.showHandle=Box.prototype.showHandle;CShape.prototype.hideHandle=Box.prototype.hideHandle;CShape.prototype.renderSelector=Box.prototype.renderSelector;
CShape.prototype.noteActivity=function(A){if(!this.activityLabel){this.activityLabel=SWCanvas.doc.createElement("DIV");this.activityLabel.className="fadelabel";this.activityLabel.jref=this;this.activityLabel.id=Math.random();this.activityLabel.style.marginTop="0px";this.activityLabel.style.zIndex="500";
this.div.offsetParent.appendChild(this.activityLabel);}this.activityLabel.style.left=this.pos.x+"px";this.activityLabel.style.top=this.pos.y+"px";this.activityLabel.innerHTML=A.name;this.activityLabel.style.filter="alpha(opacity:100)";this.activityLabel.style.MozOpacity=1;this.activityLabel.style.opacity=1;
this.activityLabel.style.display="block";setTimeout("fadeElementOut('"+this.activityLabel.id+"', 95, SWCanvas.doc)",1000);};CShape.prototype.mouseover=function(B){var A=B.target?B.currentTarget:B.srcElement;if(A.jref){SWCanvas.over=A.jref;SWCanvas.invalidate();if(A.jref!=SWCanvas.selected){A.jref.showHandle();
}}return false;};CShape.prototype.mouseout=function(B){var A=B.target?B.currentTarget:B.srcElement;if(A.jref){SWCanvas.over=null;SWCanvas.invalidate();A.jref.hideHandle();}return false;};CShape.prototype.click=Box.prototype.click;CPolyLine.prototype.updateCover=function(){if(!this.cover){this.cover=SWCanvas.doc.createElement("DIV");
this.cover.className="coverHighlight";this.cover.jref=this;SWCanvas.doc.body.appendChild(this.cover);this.resizeImage=SWCanvas.doc.createElement("IMG");this.resizeImage.jref=this;this.resizeHandle.width=0;this.resizeHandle.height=0;this.closeLink=SWCanvas.doc.createElement("A");this.hideHandle();}var C=document.all?0:2;
var A=this.width-this.chromePadding.left-this.chromePadding.right+this.weight-C;var B=this.height-this.chromePadding.top-this.chromePadding.bottom+this.weight-C;A=A>0?A:0;B=B>0?B:0;this.cover.style.width=A+"px";this.cover.style.height=B+"px";};ImageBox.prototype.constructSpecificController=function(){this.img.onload=this.imgload;
};ImageBox.prototype.hasController=true;ImageBox.prototype.imgload=function(A){if(this.jref){this.jref.aspectRatio=this.width/this.height;}return false;};ImageBox.prototype.baseResize=ImageBox.prototype.resize;ImageBox.prototype.resize=function(B,A){var C=B/A;if(this.aspectRatio!=0&&this.aspectRatio!=1){if(C>this.aspectRatio){B=Math.floor(A*this.aspectRatio);
}else{A=Math.floor(B/this.aspectRatio);}}else{this.aspectRatio=C;}this.baseResize(B,A);};EditableImageBox.prototype.constructSpecificController=function(){};EditableImageBox.prototype.hasController=true;function ColorPicker(B,F,E,A,C){this.x=B;this.y=F;this.width=E;this.height=A;this.showing=C;this.colors=new Array;
this.fore=null;var D=CShape.createCanvas(B,F,E,A,document);this.div=D.div;this.context=D.context;this.div.style.border="solid 1px #cccccc";this.div.style.zIndex="11000";this.div.jref=this;if(!this.showing){this.hide();}this.render();addListener(this.div,"mousemove",ColorPicker.prototype.mouseMove);addListener(this.div,"mousedown",ColorPicker.prototype.mouseDown);
addListener(this.div,"mouseup",ColorPicker.prototype.mouseUp);this.onColorChange=null;this.onShow=null;this.onHide=null;}ColorPicker.showing=false;ColorPicker.showingSamples=false;ColorPicker.prototype.addSample=function(B,G,E,A,C,D){var F=document.createElement("DIV");F.style.position="absolute";F.style.left=B+"px";
F.style.top=G+"px";F.style.width=E+"px";F.style.height=A+"px";F.style.padding="0px";F.style.margin="0px";F.style.fontSize="1px";F.width=E;F.height=A;F.color=C;F.jref=this;F.style.backgroundColor=C;F.style.border="solid 1px #888";document.body.appendChild(F);if(D){this.fore=F;F.style.zIndex="11002";addListener(F,"click",ColorPicker.prototype.clickFore);
}else{this.back=F;F.style.zIndex="11001";addListener(F,"click",ColorPicker.prototype.clickBack);}return F;};ColorPicker.prototype.addSampleToElement=function(E,B,H,F,A,C,D){var G=document.createElement("DIV");G.style.width=F+"px";G.style.height=A+"px";G.style.padding=B+"px";G.style.margin=H+"px";G.style.fontSize="1px";
G.width=F;G.height=A;G.color=C;G.jref=this;G.style.backgroundColor=C;G.style.border="solid 1px #888";E.appendChild(G);if(D){this.fore=G;G.style.zIndex="11002";addListener(G,"click",ColorPicker.prototype.clickFore);}else{this.back=G;G.style.zIndex="11001";addListener(G,"click",ColorPicker.prototype.clickBack);
}return G;};ColorPicker.prototype.render=function(C){if(document.all){var A=new Image;A.src="/images/video/picker_400.jpg";A.width=this.width;A.height=this.height;A.jref=this;A.ondragstart=function(){return false;};this.div.appendChild(getColorsArray());this.div.appendChild(A);}else{var D=this.context.createLinearGradient(0,0,this.width,0);
D.addColorStop(0,"#ff0000");D.addColorStop(0.16666666666666666,"#ffff00");D.addColorStop(0.3333333333333333,"#00ff00");D.addColorStop(0.5,"#00ffff");D.addColorStop(0.6666666666666666,"#0000ff");D.addColorStop(0.8333333333333334,"#ff00ff");D.addColorStop(1,"#ff0000");var B=this.context.createLinearGradient(0,0,0,this.height);
B.addColorStop(0,"rgba(0,0,0,1)");B.addColorStop(0.5,"rgba(0,0,0,0)");B.addColorStop(0.5,"rgba(255,255,255,0)");B.addColorStop(1,"rgba(255,255,255,1)");this.context.lineCap="round";this.context.strokeStyle="#cccccc";this.context.lineWidth=1;this.context.fillStyle=D;this.context.fillRect(0,0,this.width,this.height);
this.context.fillStyle=B;this.context.fillRect(0,0,this.width,this.height);this.div.appendChild(getColorsArray());}};ColorPicker.prototype.setColor=function(A){this.fore.color=A;picker.fore.style.backgroundColor=picker.fore.color;if(picker.onColorChange){picker.onColorChange(A);}};ColorPicker.prototype.show=function(){this.showing=true;
ColorPicker.showing=true;this.div.style.display="block";if(this.onShow){this.onShow();}};ColorPicker.prototype.hide=function(){this.showing=false;ColorPicker.showing=false;this.div.style.display="none";if(this.fore){this.fore.style.backgroundColor=this.fore.color;}if(this.onHide){this.onHide();}};ColorPicker.prototype.showSamples=function(){this.fore.style.display="";
this.back.style.display="";};ColorPicker.prototype.hideSamples=function(){this.fore.style.display="none";this.back.style.display="none";};ColorPicker.prototype.mouseMove=function(G){var F=G.target?G.currentTarget:G.srcElement;var D=F.jref;if(!D||!D.fore){return ;}var B="";if(G.target!=undefined&&G.target.nodeName==="SPAN"&&G.target.id.indexOf("color")==0){var A=new Array("red","orange","yellow","green","teal","blue","purple","pink","white","gray","black","brown");
var C=G.target.id.indexOf("color")+5;var E=parseInt(G.target.id.substring(C));B=A[E];}else{B=ColorPicker.calculateColor(D,G);}if(B){D.fore.style.backgroundColor=B;}return cancelEvent(G);};ColorPicker.prototype.mouseDown=function(A){return cancelEvent(A);};ColorPicker.prototype.mouseUp=function(G){var F=G.target?G.currentTarget:G.srcElement;
var D=F.jref;if(!D||!D.fore){return ;}var B="";if(G.target!=undefined&&G.target.nodeName==="SPAN"&&G.target.id.indexOf("color")==0){var A=new Array("red","orange","yellow","green","teal","blue","purple","pink","white","gray","black","brown");var C=G.target.id.indexOf("color")+5;var E=parseInt(G.target.id.substring(C));
B=A[E];}else{B=ColorPicker.calculateColor(D,G);}if(B){D.fore.color=B;if(D.onColorChange){D.onColorChange(B);}}D.hide();D.fore.style.backgroundColor=D.fore.color;};ColorPicker.prototype.clickFore=function(B){var A=B.target?B.currentTarget:B.srcElement;if(A.jref.showing){picker.fore.style.backgroundColor=picker.fore.color;
A.jref.hide();}else{A.jref.show();}};ColorPicker.prototype.clickBack=function(C){var B=C.target?C.currentTarget:C.srcElement;B.jref.hide();var A=B.jref.fore.color;B.jref.fore.color=B.jref.back.color;B.jref.back.color=A;B.jref.fore.style.backgroundColor=B.jref.fore.color;B.jref.back.style.backgroundColor=B.jref.back.color;
if(B.jref.onColorChange){B.jref.onColorChange(B.jref.fore.color);}};ColorPicker.calculateColor=function(C,D){var G=D.clientX-C.x;var E=D.clientY-C.y;if(G>=0&&G<=C.width&&E>=0&&E<=C.height){var I=G/C.width;var F=E/C.height;var A=ColorPicker.stepOutput(I,4);var B=ColorPicker.stepOutput(I,2);var H=ColorPicker.stepOutput(I,0);
if(F<0.5){F=F*2;A=Math.floor(A*F);B=Math.floor(B*F);H=Math.floor(H*F);}else{F=(F-0.5)*2;A=Math.floor(A+(256-A)*F);B=Math.floor(B+(256-B)*F);H=Math.floor(H+(256-H)*F);}return"rgb("+A+","+B+","+H+")";}return null;};ColorPicker.stepOutput=function(C,D){var A=(C*6+D)%6;var B=Math.floor(A);switch(B){case 0:case 1:return 0;
case 2:return parseInt((A-B)*255,10);case 3:case 4:return 255;case 5:return parseInt((1-A+B)*255,10);default:}return 0;};var toolStrip=new Object;toolStrip.toolMenuTimeout=null;toolStrip.hasNewActivity=false;toolStrip.init=function(){document.getElementById("divDrawingTools").style.display="";var B=getLeft(document.getElementById("imgColorLocator"))+35;
var A=document.all?15:13;picker=new ColorPicker(B,75,400,400,false);picker.addSample(B,52,A,A,"#ff0000",true);picker.addSample(B+7,58,A,A,"#ffff00",false);picker.onColorChange=function(C){sendColor(C);};new RadioButtonList("btnGridNone","btnGridSmall","btnGridLarge");};toolStrip.noteActivity=function(){};
toolStrip.repaint=function(){for(var A=0;A<toolStrip.Indicator.buttons.length;A++){var B=toolStrip.Indicator.buttons[A];var C="";if(B.drawMode==drawMode&&(B.shapeType==null||drawMode==SWVState.Text&&B.shapeType==SWCanvas.spawnMode||B.shapeType==boxShape.shapeType)){C="selected";}document.getElementById(B.id).className=C;
}switch(drawMode){case SWVState.PLine:if(picker){picker.showSamples();}document.getElementById("divDrawingTools").style.display="inline";document.getElementById("divShapeTools").style.display="none";document.getElementById("divTextTools").style.display="none";document.getElementById("divBoxTools").style.display="none";
document.getElementById("divClearTools").style.display="inline";document.getElementById("divGridTools").style.display="inline";break;case SWVState.Erase:if(picker){picker.showSamples();}document.getElementById("divDrawingTools").style.display="inline";document.getElementById("divShapeTools").style.display="none";
document.getElementById("divTextTools").style.display="none";document.getElementById("divBoxTools").style.display="none";document.getElementById("divClearTools").style.display="inline";document.getElementById("divGridTools").style.display="none";break;case SWVState.BoxShape:case SWVState.CShape:if(picker){picker.showSamples();
}document.getElementById("divDrawingTools").style.display="inline";document.getElementById("divShapeTools").style.display="inline";document.getElementById("divTextTools").style.display="none";document.getElementById("divBoxTools").style.display="none";document.getElementById("divClearTools").style.display="none";
document.getElementById("divGridTools").style.display="inline";break;case SWVState.Move:if(picker){picker.hideSamples();}document.getElementById("divDrawingTools").style.display="none";document.getElementById("divShapeTools").style.display="none";document.getElementById("divTextTools").style.display="none";
document.getElementById("divBoxTools").style.display="none";document.getElementById("divClearTools").style.display="none";document.getElementById("divGridTools").style.display="inline";break;case SWVState.Text:if(picker){picker.hideSamples();}document.getElementById("divDrawingTools").style.display="none";
document.getElementById("divShapeTools").style.display="none";document.getElementById("divTextTools").style.display="inline";document.getElementById("divBoxTools").style.display="inline";document.getElementById("divClearTools").style.display="none";document.getElementById("divGridTools").style.display="none";
break;default:if(picker){picker.hideSamples();}document.getElementById("divDrawingTools").style.display="none";document.getElementById("divShapeTools").style.display="none";document.getElementById("divTextTools").style.display="none";document.getElementById("divBoxTools").style.display="none";document.getElementById("divClearTools").style.display="none";
document.getElementById("divGridTools").style.display="none";break;}};toolStrip.EnsureDrawing=function(){if(drawMode==SWVState.None){setDrawMode(SWVState.PLine);}};toolStrip.HideDrawMenu=function(){};toolStrip.HighlightArea=function(C){if(C&&C.parentNode){for(var A=0;A<C.parentNode.childNodes.length;
A++){var B=C.parentNode.childNodes[A];if(B.tagName=="A"){B.className="";}}C.className="selected";C.blur();}};toolStrip.Indicator=new Object;toolStrip.Indicator.buttons=[{id:"btnTools",drawMode:SWVState.None,shapeType:null},{id:"btnPLine",drawMode:SWVState.PLine,shapeType:null},{id:"btnErase",drawMode:SWVState.Erase,shapeType:null},{id:"btnLabels",drawMode:SWVState.Move,shapeType:null},{id:"btnText",drawMode:SWVState.Text,shapeType:null},{id:"btnCShape",drawMode:SWVState.CShape,shapeType:null},{id:"btnCShape0",drawMode:SWVState.CShape,shapeType:BoxShape.ShapeTypes.Line},{id:"btnCShape1",drawMode:SWVState.CShape,shapeType:BoxShape.ShapeTypes.Square},{id:"btnCShape2",drawMode:SWVState.CShape,shapeType:BoxShape.ShapeTypes.Oval},{id:"btnCShape3",drawMode:SWVState.CShape,shapeType:BoxShape.ShapeTypes.RBox},{id:"btnSpawnMode0",drawMode:SWVState.Text,shapeType:Pattern.BoxTypes.Box},{id:"btnSpawnMode1",drawMode:SWVState.Text,shapeType:Pattern.BoxTypes.StickiBox},{id:"btnSpawnMode2",drawMode:SWVState.Text,shapeType:Pattern.BoxTypes.BubbleBox},{id:"btnSpawnMode3",drawMode:SWVState.Text,shapeType:Pattern.BoxTypes.FlowBox}];
toolStrip.Indicator.btnids=new Array("btnTools","btnPLine","btnErase","btnLabels","btnText","btnCShape","btnCShape1","btnCShape3","btnCShape2","btnSpawnMode0","btnSpawnMode1","btnSpawnMode2","btnSpawnMode3");toolStrip.Indicator.Slide=function(){};function flashStyles(A){}if(!SWCanvas.isSinglePage){}else{}var dropHistoryTimeout=null;
function getColorsArray(){var B=document.createElement("DIV");B.style.top="-41px";B.style.position="absolute";B.style.border="2px solid white";var A=new Array("red","orange","yellow","green","teal","blue","purple","pink","white","gray","black","brown");for(k=0;k<A.length;k++){var D=document.createElement("SPAN");
D.id="color"+k;D.style.position="absolute";D.style.left=(33*k)+"px";D.style.border="solid 1px white";D.style.background=A[k];D.style.height="33px";D.style.width="33px";D.style.margin="1px";var C=document.createElement("a");C.href="javascript:alert('clicked "+A[k]+"')";C.title=A[k];D.appendChild(C);B.appendChild(D);
}return B;}function getSizesArray(A,G){var C=document.createElement("DIV");C.className="pensizes";C.id="pensizes";C.style.position="absolute";C.style.left=A+"px";C.style.top=G+"px";C.zIndex=11000;var E=new Array(1,3,6,12,20);for(k=0;k<E.length;k++){var F=document.createElement("DIV");F.id="pensize"+k;
F.className="pensize";F.style.position="absolute";F.style.top=(22*k)+"px";F.style.border="solid 1px gray";F.style.height="22px";F.style.width="22px";F.style.margin="0px";F.style.background="#E0ECFF";var D=document.createElement("a");D.setAttribute("onclick","javascript:sendPenSize("+E[k]+");hide_pen_settings();");
D.href="javascript:void(null);";D.title=E[k];var B=document.createElement("img");B.src="http://www.snapwiz.com/prep/images/video/pensize"+(k+1)+".png";D.appendChild(B);F.appendChild(D);C.appendChild(F);}return C;}function dropHistory(){if(document.getElementById("divHistory").style.display=="none"){document.getElementById("divHistory").style.display="";
document.getElementById("divHistoryUrl").style.display="none";}else{document.getElementById("divHistory").style.display="none";}}function divHistory_over(){if(dropHistoryTimeout){clearTimeout(dropHistoryTimeout);dropHistoryTimeout=null;}}function divHistory_out(){dropHistoryTimeout=setTimeout("document.getElementById('divHistory').style.display = 'none'",500);
}function dropHistoryUrl(){if(document.getElementById("divHistoryUrl").style.display=="none"){document.getElementById("divHistory").style.display="none";document.getElementById("divHistoryUrl").style.display="";}else{document.getElementById("divHistoryUrl").style.display="none";}}function divHistoryUrl_over(){if(dropHistoryTimeout){clearTimeout(dropHistoryTimeout);
dropHistoryTimeout=null;}}function divHistoryUrl_out(){dropHistoryTimeout=setTimeout("document.getElementById('divHistoryUrl').style.display = 'none'",2000);}function ElementCallout(E,F,D){this.obj=loadObjectFromDoc(E);if(!this.obj){return ;}this.text=F;this.duration=D?D:2000;this.objLeft=getLeft(this.obj);
this.objTop=getTop(this.obj);var C=this.obj.style.backgroundColor;this.obj.style.backgroundColor="yellow";this.callout=document.createElement("DIV");this.callout.className="fadelabel";this.callout.innerHTML=F;this.callout.id=Math.random();document.body.appendChild(this.callout);this.setPosition();var B=this.obj.id;
var A=this.callout.id;setTimeout(function(){try{fadeElementOut(A,95,document);document.getElementById(B).style.backgroundColor=C;}catch(G){}},this.duration);}ElementCallout.prototype.setPosition=function(){this.callout.style.left=parseInt(this.objLeft+this.obj.offsetWidth/2-this.callout.offsetWidth/2)+"px";
this.callout.style.top=(this.objTop+this.obj.offsetHeight+5+15)+"px";};function addElementCallout(B,C,A){new ElementCallout(B,C,A);}var TabStrip={tabs:[],panels:[],allowNavigation:false};TabStrip.initTabs=function(){var D=document.getElementsByTagName("A");for(var C=0;C<D.length;C++){var E=D[C];if(E.className=="tab"){var B=TabStrip.getTarget(E);
if(B){E.panel=B;TabStrip.tabs.push(E);TabStrip.panels.push(B);addListener(E,"click",TabStrip.onTabClick);}}}var A=TabStrip.getTarget(location);if(A){for(var C=0;C<TabStrip.tabs.length;C++){if(TabStrip.tabs[C].panel==A){TabStrip.selectTab(TabStrip.tabs[C]);}}}};TabStrip.onTabClick=function(B){var A=B.target?B.target:B.srcElement;
if(A.panel){TabStrip.selectTab(A);}if(!TabStrip.allowNavigation){return cancelEvent(B);}};TabStrip.getTarget=function(A){if(A.href&&A.href.indexOf&&A.href.indexOf("#")>-1){var B=A.href.substr(A.href.indexOf("#")+1);return document.getElementById(B);}return null;};TabStrip.selectTab=function(B){for(var A=0;
A<TabStrip.panels.length;A++){TabStrip.panels[A].style.display="none";}B.panel.style.display="block";B.selected="selected";};SWCanvas.constructController=function(){SWCanvas.spawnMode=Pattern.BoxTypes.Box;addListener(SWCanvas.doc,"keydown",SWCanvas.keydown);addListener(SWCanvas.doc,"mousedown",SWCanvas.mousedown);
addListener(SWCanvas.doc,"mouseup",SWCanvas.mouseup);addListener(SWCanvas.doc,"mousemove",SWCanvas.mousemove);addListener(SWCanvas.doc,"mouseout",SWCanvas.mouseout);addListener(SWCanvas.doc,"click",SWCanvas.click);addListener(SWCanvas.doc,"selectstart",SWCanvas.selectstart);addListener(SWCanvas.doc,"contextmenu",SWCanvas.contextmenu);
if(SWCanvas.doc&&SWCanvas.doc!=document&&!SWCanvas.parentEventsRegistered){addListener(document,"mousedown",SWCanvas.mousedown_parent);addListener(document,"mouseup",SWCanvas.mouseup_parent);addListener(document,"mousemove",SWCanvas.mousemove_parent);addListener(document,"selectstart",function(A){return cancelEvent(A);
});SWCanvas.parentEventsRegistered=true;}Box.buildContextMenu(this);ImageBox.buildContextMenu(this);CShape.buildContextMenu(this);};SWCanvas.hasController=true;SWCanvas.showDragging=function(){var A=document.getElementById("divSWVideoTrash");if(A){A.style.display="";}};SWCanvas.hideDragging=function(){var A=document.getElementById("divSWVideoTrash");
if(A){A.style.display="none";}};SWCanvas.select=function(A){SWCanvas.selected=A;A.hideHandle();A.renderSelector();SWCanvas.hideContextMenu();A.showContextMenu(null,true);};SWCanvas.deselect=function(){SWCanvas.selected=null;if(SWCanvas.selectorDiv){try{SWCanvas.selectorDiv.style.display="none";}catch(A){}}JCanvas.UpdateDiagnostics();
};SWCanvas.undo=function(){if(SWCanvas.undoStack&&SWCanvas.undoStack.length>0){var A=SWCanvas.undoStack.pop();A();}};SWCanvas.keydown=function(A){if(A.ctrlKey){switch(A.keyCode){case 67:SWCanvas.copy();break;case 83:getSWFObject("SnapWizCreator").menuSelection(id);break;case 86:SWCanvas.paste();break;
case 88:SWCanvas.cut();break;case 90:SWCanvas.undo();break;default:}}else{if(SWCanvas.selected&&!SWCanvas.selected.editing){switch(A.keyCode){case 46:case 8:SWCanvas.removeBox(SWCanvas.selected.boxID,true);SWCanvas.selected=null;return cancelEvent(A);break;default:}}}if(location.href.indexOf("sniff")>0){alert(A.keyCode+", "+A.ctrlKey);
}};SWCanvas.keyup=function(A){switch(A.keyCode){case 78:getSWFObject("SnapWizCreator").onSpacebarPress();break;default:}};SWCanvas.mousedown=function(C,A){var B=C.target?C.currentTarget:C.srcElement;mouse.sniff(C,SWCanvas.getSnap(C));if(!B&&(drawMode!=SWVState.Move||mouse.y<document.body.offsetHeight-SWCanvas.top)){return true;
}if(mouse.x<document.body.offsetWidth-25){return SWCanvas.dispatch("mousedown",C,A);}};SWCanvas.mouseup=function(A){mouse.sniff(A,SWCanvas.getSnap(A));return SWCanvas.dispatch("mouseup",A);};SWCanvas.mousemove=function(A){mouse.sniff(A,SWCanvas.getSnap(A));return SWCanvas.dispatch("mousemove",A);};SWCanvas.mousedown_parent=function(A){var B=new Object;
B.clientX=A.clientX;B.clientY=A.clientY-SWCanvas.top;SWCanvas.mousedown(B,true);};SWCanvas.mouseup_parent=function(A){var B=new Object;B.clientX=A.clientX;B.clientY=A.clientY-SWCanvas.top;SWCanvas.mouseup(B);};SWCanvas.mousemove_parent=function(A){var B=new Object;B.clientX=A.clientX;B.clientY=A.clientY-SWCanvas.top;
SWCanvas.mousemove(B);};SWCanvas.mouseout=function(A){};SWCanvas.click=function(A){mouse.sniff(A,SWCanvas.getSnap(A));return SWCanvas.dispatch("click",A);};SWCanvas.dispatch=function(B,C,A){switch(drawMode){case SWVState.PLine:return StrokeAction[B](C);case SWVState.Erase:return EraseAction[B](C);case SWVState.Move:return ShiftAction[B](C,A);
case SWVState.CShape:return DrawShapeAction[B](C);case SWVState.Text:return TextAction[B](C);default:}};SWCanvas.getSnap=function(A){if(A.shiftKey){return false;}return true;};SWCanvas.cut=function(){if(SWCanvas.selected&&!SWCanvas.selected.editing){SWCanvas.clipboard=SWCanvas.selected;SWCanvas.removeBox(SWCanvas.selected.boxID,true);
SWCanvas.clipboard.pasteCount=-1;}};SWCanvas.copy=function(){if(SWCanvas.selected&&!SWCanvas.selected.editing){SWCanvas.clipboard=SWCanvas.selected;SWCanvas.clipboard.pasteCount=0;}};SWCanvas.paste=function(){if(!SWCanvas.clipboard||!SWCanvas.clipboard.toScript||(SWCanvas.selected&&SWCanvas.selected.editing)){return ;
}SWCanvas.clipboard.pasteCount++;var box=eval(SWCanvas.clipboard.toScript());box.boxID=Math.random();box.pos.x+=SWCanvas.clipboard.pasteCount*10;box.pos.y+=SWCanvas.clipboard.pasteCount*10;SWCanvas.addBox(box);switch(box.type){case Box.className:sendLabelPosition(box);break;case CShape.className:sendCShape(box);
break;case CPolyLine.className:sendCPolyLine(box);break;default:writeDebugLog("unhandled paste: "+box.type);}};SWCanvas.selectstart=function(A){if(SWCanvas.cargo){writeDebugLog("Cancel selectstart");return cancelEvent(A);}if(drawMode==SWVState.PLine||drawMode==SWVState.BoxShape){return cancelEvent(A);
}return true;};SWCanvas.contextmenu=function(B){writeDebugLog("SWCanvas.contextmenu");SWCanvas.hideContextMenu();mouse.sniff(B,false);var A=SWCanvas.getObjectAtPosition(mouse.x,mouse.y);if(A&&A.showContextMenu){A.showContextMenu(mouse,false);return cancelEvent(B);}return true;};SWCanvas.hideContextMenu=function(A){if(SWCanvas.contextMenu_Box){SWCanvas.contextMenu_Box.hide();
}if(SWCanvas.contextMenu_ImageBox){SWCanvas.contextMenu_ImageBox.hide();}if(SWCanvas.contextMenu_CShape){SWCanvas.contextMenu_CShape.hide();}};SWCanvas.spawnImage=function(B,G,F,C,A){var E=SWCanvas.getPatternByClassName("ImageBox");var D;if(E){D=E.spawn(B,G,new Point(0,0),null);D.aspectRatio=0;if(C!=0&&A!=0){D.resize(C,A);
}D.setContent(F);SWCanvas.addBox(D);}else{alert("no pattern found!");}SWCanvas.draw(SWCanvas.context);if(D&&SWCanvas.onspawn){SWCanvas.onspawn(D);sendLabelPosition(D);}};SWCanvas.SetGridSize=function(A){switch(A){case 1:this.canvas.style.background="transparent url(../../images/video/notebook_style_1.png) repeat";
break;case 2:this.canvas.style.background="transparent url(../../images/video/notebook_style_2.png) repeat";break;case 3:this.canvas.style.background="transparent url(../../images/video/notebook_style_3.png) repeat";break;case 4:this.canvas.style.background="transparent url(../../images/video/notebook_style_4.png) repeat";
break;case 0:this.canvas.style.background="transparent";break;default:writeDebugLog("unknown grid size");return ;}mouse.gridSize=A;};JCanvas.GetCumulativeScrollTop=function(D){var A=0;var B=10;while(D.parentNode!=null&&B-->0){var C=parseInt(D.scrollTop);if(!isNaN(C)){A+=C;}D=D.parentNode;}return A;};
JCanvas.UpdateDiagnostics=function(){var D=document.getElementById("divDiagnostics");if(D){var C=SWCanvas.selected;var B=SWCanvas.cargo;var E=SWCanvas.over;var A="s:"+(C?C.className+C.boxID:"(none)")+"<br>c:"+(B?B.className+B.boxID:"(none)")+"<br>o:"+(E?E.className+E.boxID:"(none)");D.innerHTML=A;}};
var StrokeAction={setContext:function(A,B){pline.strokeStyle=A;pline.lineWidth=B;SWCanvas.contextTemp.lineCap=pline.lineCap;SWCanvas.contextTemp.strokeStyle=pline.strokeStyle;SWCanvas.contextTemp.lineWidth=pline.lineWidth;},mousedown:function(C,B){var A=SWContext.currentUser;if(A){StrokeAction.setContext(A.color,A.penSize);
}SWCanvas.contextTemp.beginPath();SWCanvas.contextTemp.moveTo(mouse.x,mouse.y);pline.points=new Array;pline.StoreXY(C);pline.drawing=true;return cancelEvent(C);},mouseup:function(B){if(pline.drawing){pline.drawing=false;if(pline.points.length>2){SWCanvas.contextTemp.stroke();var A=new CPolyLine(pline.points,pline.strokeStyle,pline.lineWidth);
SWCanvas.addBox(A);sendCPolyLine(A);A.pushUndoMoveSizeSpawn();SWCanvas.clearCanvas(SWCanvas.contextTemp);}else{return ;}}return cancelEvent(B);},mousemove:function(C){if(drawMode==SWVState.View){return ;}if(mouse.y<0){return StrokeAction.mouseup(C);}if(pline.drawing){var D=Math.pow(mouse.x-pline.lastX,2)+Math.pow(mouse.y-pline.lastY,2);
if(D>10000||pline.ready){var A=SWContext.currentUser;if(A){}SWCanvas.contextTemp.moveTo(pline.lastX+7,pline.lastY+7);SWCanvas.contextTemp.lineTo(mouse.x+7,mouse.y+7);SWCanvas.contextTemp.stroke();SWCanvas.contextTemp.beginPath();SWCanvas.contextTemp.moveTo(mouse.x+7,mouse.y+7);pline.StoreXY(C);pline.ready=false;
setTimeout("pline.ready = true",10);if(false&&pline.points.length>100){var B=new CPolyLine(pline.points,pline.strokeStyle,pline.lineWidth);JCanvas.current.addBox(B);sendCPolyLine(B);B.pushUndoMoveSizeSpawn();pline.points=new Array;pline.StoreXY(C);pline.Draw();}}}return cancelEvent(C);},click:function(A){}};
var DrawShapeAction={mousedown:function(C,B){var A=SWContext.currentUser;if(A){boxShape.strokeStyle=A.color;boxShape.lineWidth=A.penSize;pline.strokeStyle=A.color;pline.lineWidth=A.penSize;}boxShape.lineCap=pline.lineCap;boxShape.x1=mouse.x;boxShape.y1=mouse.y;boxShape.x2=mouse.x;boxShape.y2=mouse.y;
boxShape.drawing=true;return cancelEvent(C);},mouseup:function(B){if(boxShape.drawing){boxShape.drawing=false;SWCanvas.clearCanvas(SWCanvas.contextTemp);if(boxShape.x1!=boxShape.x2||boxShape.y1!=boxShape.y2){var A=new CShape(boxShape.shapeType,boxShape.x1,boxShape.y1,boxShape.Width(),boxShape.Height(),pline.strokeStyle,null,pline.lineWidth,boxShape.northWest);
JCanvas.current.addBox(A);sendCShape(A);A.pushUndoMoveSizeSpawn();}else{}}return cancelEvent(B);},mousemove:function(A){if(boxShape.drawing){boxShape.x2=mouse.x;boxShape.y2=mouse.y;SWCanvas.clearCanvas(SWCanvas.contextTemp);boxShape.Draw(SWCanvas.contextTemp);}return cancelEvent(A);},click:function(A){}};
var ShiftAction={mousedown:function(E,D){if(SWCanvas.cargo){return ;}SWCanvas.downPoint=new Point(mouse.x,mouse.y);mouse.sniff(E,false);SWCanvas.cargo=SWCanvas.getObjectAtPosition(mouse.x,mouse.y);if(singleSelectBoxId!=-1&&singleSelectBoxId!=SWCanvas.cargo.boxID){SWCanvas.cargo=null;return ;}writeDebugLog(SWCanvas.cargo);
if(SWCanvas.cargo){mouse.sniff(E,true);switch(SWCanvas.cargo.type){case"Box":case"CShape":case"CPolyLine":if(!D){SWCanvas.dragOffset=new Point(mouse.x-mouse.gridRound(SWCanvas.cargo.pos.x),mouse.y-mouse.gridRound(SWCanvas.cargo.pos.y));SWCanvas.showDragging();SWCanvas.cargo.storeLastState();}else{SWCanvas.cargo=null;
return ;}break;case"Pattern":SWCanvas.dragOffset=new Point(mouse.gridRound(E.clientX-getLeft(SWCanvas.cargo.div)),mouse.gridRound(E.clientY-getTop(SWCanvas.cargo.div)+JCanvas.GetCumulativeScrollTop(SWCanvas.cargo.div)));var C=SWCanvas.cargo.spawn(mouse.x-SWCanvas.left,mouse.y-SWCanvas.top,SWCanvas.dragOffset);
if(C){SWCanvas.addBox(C);SWCanvas.cargo=C;SWCanvas.draw(SWCanvas.context);SWCanvas.showDragging();SWCanvas.dragOffset.y+=SWCanvas.top;if(SWCanvas.onspawn){SWCanvas.onspawn(C);}}else{alert("no box???");}break;case"ResizeHandle":if(SWCanvas.cargo.box.type=="CShape"){var B=SWContext.currentUser;if(B){boxShape.strokeStyle=B.color;
boxShape.lineWidth=B.penSize;}boxShape.lineCap=pline.lineCap;boxShape.strokeStyle=SWCanvas.cargo.box.stroke;boxShape.lineWidth=SWCanvas.cargo.box.weight;boxShape.shapeType=SWCanvas.cargo.box.shapeType;boxShape.x1=SWCanvas.cargo.box.pos.x;boxShape.y1=SWCanvas.cargo.box.pos.y;boxShape.x2=mouse.x;boxShape.y2=mouse.y;
boxShape.drawing=true;SWCanvas.cargo.box.hide();var F=getFrameWindow("canvasFrame");if(F){var A=getFrameWindow("canvasFrame").document.getElementById("cvTemp");A.style.display="inline";}}else{SWCanvas.dragOffset=new Point(mouse.x-SWCanvas.cargo.box.pos.x,mouse.y-SWCanvas.cargo.box.pos.y);}SWCanvas.cargo.box.storeLastState();
break;default:}if(document.selection){setTimeout("if (document.selection){document.selection.clear();}",1);}SWCanvas.cancelClick=false;}},mouseup:function(C){SWCanvas.hideDragging();if(SWCanvas.cargo&&SWCanvas.downPoint){var A=new Point(SWCanvas.downPoint.x-(SWCanvas.dragOffset?SWCanvas.dragOffset.x:0),SWCanvas.downPoint.y-(SWCanvas.dragOffset?SWCanvas.dragOffset.y:0));
switch(SWCanvas.cargo.type){case"Box":case"CShape":case"CPolyLine":if(mouse.x<0||mouse.y<0||C.clientY<0){SWCanvas.cargo.pos.x=A.x;SWCanvas.cargo.pos.y=A.y;SWCanvas.removeBox(SWCanvas.cargo.boxID,true);}else{SWCanvas.cargo.pushUndoMoveSizeSpawn();if(SWCanvas.onmovesize){SWCanvas.onmovesize(SWCanvas.cargo);
}}SWCanvas.cargo=null;break;case"Connector":var B=SWCanvas.getObjectAtPosition(mouse.x,mouse.y);if(B&&B.type=="Anchor"&&SWCanvas.cargo.from!=B){SWCanvas.cargo=SWCanvas.cargo.setTo(B);}else{arrayRemove(SWCanvas.cargo.from.connectors,SWCanvas.cargo);SWCanvas.cargo=null;}break;case"ResizeHandle":if(SWCanvas.cargo.box.type=="CShape"){boxShape.drawing=false;
SWCanvas.cargo.box.resize(mouse.x-SWCanvas.cargo.box.pos.x,mouse.y-SWCanvas.cargo.box.pos.y);SWCanvas.cargo.box.rebuild();SWCanvas.cargo.box.show();clearCanvas(SWCanvas.contextTemp);}SWCanvas.cargo.box.pushUndoMoveSizeSpawn();if(SWCanvas.onmovesize){SWCanvas.onmovesize(SWCanvas.cargo.box);}SWCanvas.cargo=null;
break;default:}SWCanvas.invalidate();Pattern.over=null;return cancelEvent(C);}else{}return cancelEvent(C);},mousemove:function(B){if(SWCanvas.cargo){switch(SWCanvas.cargo.type){case"Box":case"CShape":case"CPolyLine":if(singleSelectBoxId!=-1&&singleSelectBoxId!=SWCanvas.cargo.boxID){return ;}SWCanvas.cargo.pos.x=mouse.x-SWCanvas.dragOffset.x;
SWCanvas.cargo.pos.y=mouse.y-SWCanvas.dragOffset.y;if(SWCanvas.cargo.pos.y<0&&mouse.y>0){SWCanvas.cargo.pos.y=0;}if(SWCanvas.cargo.pos.x<SWCanvas.left&&mouse.x>SWCanvas.left){SWCanvas.cargo.pos.x=SWCanvas.left;}SWCanvas.cargo.draw(SWCanvas.contextTemp);break;case"Connector":SWCanvas.cargo.pos.x=mouse.x-SWCanvas.dragOffset.x;
SWCanvas.cargo.pos.y=mouse.y-SWCanvas.dragOffset.y;break;case"ResizeHandle":SWCanvas.cargo.box.resize(mouse.x-SWCanvas.cargo.box.pos.x,mouse.y-SWCanvas.cargo.box.pos.y);break;default:}if(!document.all){mouse.chill();}}else{if(SWCanvas.over){if(SWCanvas.over.editing){return ;}SWCanvas.over.hideHandle();
}var A=SWCanvas.getObjectAtPosition(mouse.x,mouse.y);if(A&&(A.type=="Box"||A.type=="CShape"||A.type=="CPolyLine")){if(singleSelectBoxId!=-1&&singleSelectBoxId!=A.boxID){A=SWCanvas.getBoxById(singleSelectBoxId);}if(SWCanvas.over!=A){SWCanvas.invalidate();}SWCanvas.over=A;if(SWCanvas.selected==null||A!=SWCanvas.selected){A.showHandle("move");
}else{}}else{if(A&&A.type=="ResizeHandle"){if(SWCanvas.over!=A.box){SWCanvas.invalidate();}SWCanvas.over=A.box;if(SWCanvas.selected==null||A.box!=SWCanvas.selected){A.box.showHandle("move");}else{}}else{if(SWCanvas.over!=null){SWCanvas.invalidate();}SWCanvas.over=null;}}}return cancelEvent(B);},click:function(B){writeDebugLog("ShiftAction.click");
if(!SWCanvas.downPoint||mouse.x!=SWCanvas.downPoint.x||mouse.y!=SWCanvas.downPoint.y){writeDebugLog("not a real click");return cancelEvent(B);}var A=SWCanvas.getObjectAtPosition(mouse.x,mouse.y);if(singleSelectBoxId!=-1&&singleSelectBoxId!=A.boxID){return ;}if(A){writeDebugLog("clicked on a box of some sort. (and it's a real click)");
if(B.button>0){writeDebugLog("should be showing context menu");return SWCanvas.contextmenu(B);}if(A!=SWCanvas.selected){writeDebugLog("not selected. select it.");SWCanvas.hideEdit();SWCanvas.deselect();SWCanvas.select(A);}else{if(A.contentElement){writeDebugLog("click on point in a contentElement");if(A.editing){writeDebugLog("click on something we're editing");
SWCanvas.hideContextMenu();SWCanvas.hideEdit();SWCanvas.deselect();setDrawMode(SWVState.Move,null);}else{if(A==SWCanvas.selected){writeDebugLog("click on selected");writeDebugLog("should show edit");SWCanvas.hideContextMenu();SWCanvas.hideEdit();A.showEdit();}else{writeDebugLog("click on content that's not sel'd");
}}}}}else{writeDebugLog("clicked the canvas");SWCanvas.hideContextMenu();SWCanvas.hideEdit();SWCanvas.deselect();return true;}return cancelEvent(B);}};var EraseAction={mousedown:function(B,A){StrokeAction.setContext("#ffffff",50);SWCanvas.contextTemp.lineCap=pline.lineCap;SWCanvas.contextTemp.strokeStyle=pline.strokeStyle;
SWCanvas.contextTemp.lineWidth=pline.lineWidth;SWCanvas.contextTemp.beginPath();SWCanvas.contextTemp.moveTo(mouse.x,mouse.y);pline.points=new Array;pline.StoreXY(B);pline.drawing=true;},mouseup:function(A){return StrokeAction.mouseup(A);},mousemove:function(A){return StrokeAction.mousemove(A);},click:function(A){return StrokeAction.click(A);
}};var TextAction={mousedown:function(B,A){SWCanvas.downPoint=new Point(mouse.x,mouse.y);return cancelEvent(B);},mouseup:function(A){return cancelEvent(A);},mousemove:function(B){if(SWCanvas.over){if(SWCanvas.over.editing){return ;}SWCanvas.over.hideHandle();}var A=SWCanvas.getObjectAtPosition(mouse.x,mouse.y);
if(A&&A.type=="Box"&&A.contentElement){SWCanvas.over=A;SWCanvas.invalidate();if(SWCanvas.selected==null||A!=SWCanvas.selected){A.showHandle("text");}}else{SWCanvas.over=null;SWCanvas.invalidate();}return cancelEvent(B);},click:function(C){var B=SWCanvas.getObjectAtPosition(mouse.x,mouse.y);if(B&&B.contentElement&&SWCanvas.downPoint&&mouse.x==SWCanvas.downPoint.x&&mouse.y==SWCanvas.downPoint.y){writeDebugLog("click on point in a contentElement");
if(B.editing){writeDebugLog("click on something we're editing");SWCanvas.hideContextMenu();SWCanvas.hideEdit();SWCanvas.deselect();}else{if(B==SWCanvas.selected){writeDebugLog("click on selected");}else{writeDebugLog("click on not sel'd");}writeDebugLog("should show edit");SWCanvas.hideContextMenu();
SWCanvas.hideEdit();B.showEdit();SWCanvas.select(B);showTextEditor();}}else{if(drawMode==SWVState.Text&&!SWCanvas.editing&&SWCanvas.downPoint&&mouse.x==SWCanvas.downPoint.x&&mouse.y==SWCanvas.downPoint.y){writeDebugLog("spawn text?");if(SWCanvas.cancelClick){writeDebugLog("No spawn. cancelClick");SWCanvas.cancelClick=false;
return ;}var A;switch(SWCanvas.spawnMode){case Pattern.BoxTypes.Box:A=new TransBox(null,mouse.x,mouse.y,300,50,"","",null);break;case Pattern.BoxTypes.StickiBox:A=new StickiBox(null,mouse.x,mouse.y,128,128,"","",null);break;case Pattern.BoxTypes.BubbleBox:A=new BubbleBox(null,mouse.x,mouse.y,128,128,"","",null);
break;case Pattern.BoxTypes.FlowBox:A=new FlowBox(null,mouse.x,mouse.y,128,128,"","",null);break;default:}SWCanvas.addBox(A);SWCanvas.select(A);sendLabelPosition(A);A.showEdit();}else{if(SWCanvas.editing){writeDebugLog("clicked canvas while editing");SWCanvas.hideContextMenu();SWCanvas.hideEdit();SWCanvas.deselect();
}else{writeDebugLog("fallback");}}}}};function importQuestionToPosition(I,H){mouse.x=I;mouse.y=H;var C="";var F=document.getElementById("questionStr");if(F){var C=F.value;var A="<p><strong>Q: "+C+"</strong></p>";var J=new TransBox(null,I,H,600,100,"","",null);SWCanvas.addBox(J);SWCanvas.select(J);setLabelContent(344215,J.boxID,A);
sendTextPosition(J);}var E="";var G=document.getElementById("answerChoicesStr");if(G){var E=G.value;var D="<p>"+E+"</p>";var B=new TransBox(null,I,H+120,300,100,"","",null);SWCanvas.addBox(B);SWCanvas.select(B);setLabelContent(344215,B.boxID,D);sendTextPosition(B);}setMoveMode();}function showTextEditor(){var E="";
var B=FCKeditorAPI.GetInstance("textEditor");var C=SWCanvas.selected;if(C){E=C.getContent();B.StartupValue=E;}var A=new YAHOO.widget.Panel("resizablepanel",{draggable:true,width:"750px",height:"300px",autofillheight:"body",constraintoviewport:true,context:["showbtn","tl","bl"]});A.center();A.render();
setTimeout(function(){var F=FCKeditorAPI.GetInstance("textEditor");F.SetHTML(E);},1000);YAHOO.util.Event.on("showbtn","click",A.show,A,true);YAHOO.util.Event.on("saveTextBtn","click",function(){D();},A,true);YAHOO.util.Event.on("cancelEdit","click",A.hide,A,true);function D(){var G=FCKeditorAPI.GetInstance("textEditor");
document.getElementById("fck-editor-content").innerHTML=G.GetHTML();var I=document.getElementById("fck-editor-content");var H=I.getElementsByTagName("*");for(i=0;i<H.length;i++){var F=H[i];if(F.style.fontSize==""){F.style.fontSize="15px";}}A.hide();}}function getSWFObject(A){if(navigator.appName.indexOf("Microsoft")!=-1){return window[A];
}else{return document[A];}}function recordUserAction(E,A,G,F,B,I,J,D,H,C){getSWFObject("SnapWizCreator").recordUserAction(sessionID,userID,E,A,G,F,B,I,J,D,H,C);}function processInstruction(str){str=unescape(str);str=str.replace("\r"," ");writeDebugLog("** processInstruction - "+str);try{eval(str);}catch(e){writeDebugLog("The string "+str+" contained incorrect JS syntax.");
}}function setMoveMode(){var A=document.getElementById("Select");highlight_icon(A);singleSelectBoxId=-1;setDrawMode(SWVState.Move);closePop();return true;}function setGridSize(A){SWCanvas.SetGridSize(A);}function setGridSize2(A){SWCanvas.SetGridSize(A);recordUserAction("background","-1",0,0,"","","","",A,"");
}function focus_tab(A){var C=YAHOO.util.Dom.getElementsByClassName("tab");for(k=0;k<C.length;k++){var E=C[k];var D=E.getAttribute("class");if(D==null||D===""||D==undefined){D=E.getAttribute("className");}var F=E.getAttribute("id");if(F===A){var B=D.indexOf("selected");if(B<0){D=D+" selected";}}else{var B=D.indexOf(" selected");
if(B>=0){D=D.replace(/ selected/,"");}}E.setAttribute("className",D);E.setAttribute("class",D);}show_tab_content(A);}YAHOO.util.Event.onContentReady("color-circle-sectn",function(){if(picker==null){var C=400;var A=15;var B=document.getElementById("color-circle-sectn");picker=new ColorPicker(C,75,400,400,false);
picker.addSampleToElement(B,0,0,A,A,"#ff0000",true);picker.onColorChange=function(D){sendColor(D);};}});function show_tab_content(A){var F=YAHOO.util.Dom.getElementsByClassName("tab-content");for(k=0;k<F.length;k++){var D=F[k];var H=D.getAttribute("id");var G=A+"-content";if(H===G){D.style.display="block";
if(A=="tab1"){if(picker==null){var E=400;var B=15;var C=document.getElementById("color-circle-sectn");picker=new ColorPicker(E,75,400,400,false);picker.addSampleToElement(C,0,0,B,B,"#ff0000",true);picker.onColorChange=function(I){sendColor(I);};}}}else{D.style.display="none";}}}function enable_highlights(B){var A=document.getElementById("Highlight");
highlight_icon(A);setDrawMode(SWVState.PLine);setPenSize(SWContext.currentUser,30);setColor(SWContext.currentUser,"rgba(255, 255, 0, 0.25)");}function show_pen_settings(D){var C=document.getElementById("Pensize");highlight_icon(C);setDrawMode(SWVState.PLine);var E=document.getElementById("pensizes");
sendColor(picker.fore.color);if(E){hide_pen_settings();}else{var B=getSizesArray(D.clientX,D.clientY);var A=document.getElementById("pen-size-sectn");document.body.appendChild(B);}}function hide_pen_settings(){var A=document.getElementById("pensizes");if(A){if(A.parentNode){A.parentNode.removeChild(A);
}}}function showPage(H){currentPage=H;var C="pagelink"+H;var G=YAHOO.util.Dom.getElementsByClassName("pagelink");var K=false;for(var I=0;I<G.length;I++){pagelink=G[I];if(pagelink.id===C){pagelink.setAttribute("className","current pagelink");pagelink.setAttribute("class","current pagelink");K=true;}else{pagelink.setAttribute("className","pagelink");
pagelink.setAttribute("class","pagelink");}}if(K==false){writeDebugLog("Appending new page "+G.length);var F=G[G.length-1];var J=document.createElement("a");var E=F.id;var D=parseInt(E.substring(E.length-1))+1;J.setAttribute("id","pagelink"+D);J.setAttribute("className","current pagelink");J.setAttribute("class","current pagelink");
J.setAttribute("href","javascript:void(0);");J.setAttribute("onclick","gotoPage("+D+","+(D+1)+");");J.innerHTML=D+1+" ";var A=document.createElement("span");A.appendChild(J);var B=document.getElementById("plusNode");YAHOO.util.Dom.insertBefore(A,B);}}function gotoPage(C,D){if(C!=D){currentPage=C;getSWFObject("SnapWizCreator").showPage(currentPage);
}else{currentPage=C;getSWFObject("SnapWizCreator").newPage();var E="<p><strong>"+(currentPage+1)+"</strong></p>";var A=new TransBox(null,680,4,24,32,"","",null);SWCanvas.addBox(A);SWCanvas.select(A);setLabelContent(344215,A.boxID,E);sendTextPosition(A);}var G="pagelink"+C;var F=YAHOO.util.Dom.getElementsByClassName("pagelink");
for(var B=0;B<F.length;B++){pagelink=F[B];if(pagelink.id===G){pagelink.setAttribute("className","current pagelink");pagelink.setAttribute("class","current pagelink");}else{pagelink.setAttribute("className","pagelink");pagelink.setAttribute("class","pagelink");}}}function highlight_icon(D){var A="#FFFA00";
var B=YAHOO.util.Dom.getElementsByClassName("icon-setn");for(k=0;k<B.length;k++){var C=B[k];if(C.id===D.id){if(C&&C.parentNode){C.style.backgroundColor=A;}}else{if(C&&C.parentNode){C.style.backgroundColor="";}}}}function process_nav_event(B,A){var D=B.id;if(D=="Select"){setMoveMode();}else{if(D=="Text"){setDrawMode(SWVState.Text);
highlight_icon(B);}else{if(B.id=="Draw"){setDrawMode(SWVState.PLine);setPenSize(SWContext.currentUser,1);highlight_icon(B);}else{if(D=="PenSize"){setColor(SWContext.currentUser,"rgba(0, 0, 0, 1.0)");setDrawMode(SWVState.PLine);setPenSize(SWContext.currentUser,A);}else{if(D=="Highlight"){setPenSize(SWContext.currentUser,30);
setColor(SWContext.currentUser,"rgba(255, 255, 0, 0.25)");highlight_icon(B);}else{if(D.indexOf("GridSize")==0){var C=parseInt(D.charAt(D.length-1));setGridSize2(C);}else{if(D=="Record"){clearCanvas(SWCanvas.context);highlight_icon(B);setRecordMesg("record");}else{if(D=="AlignToVoice"){clearCanvas(SWCanvas.context);
highlight_icon(B);setRecordMesg("align");}else{if(D=="Play"){highlight_icon(B);setRecordMesg("play");}else{if(D=="Stop"){highlight_icon(B);setRecordMesg("stop");}else{if(D.indexOf("shape")>0){highlight_icon(B);switch(D){case"sqshape":setDrawMode(SWVState.CShape,CShape.ShapeTypes.Square);break;case"cirshape":setDrawMode(SWVState.CShape,CShape.ShapeTypes.Oval);
break;case"rttrshape":setDrawMode(SWVState.CShape,BoxShape.ShapeTypes.RTriangle);break;case"lnshape":setDrawMode(SWVState.CShape,BoxShape.ShapeTypes.Line);break;case"arshape":setDrawMode(SWVState.CShape,BoxShape.ShapeTypes.Arrow);break;case"cbshape":break;case"cyshape":break;default:}}}}}}}}}}}}getSWFObject("SnapWizCreator").menuSelection(D);
if(D=="Save"){alert("Save Sucessful.");location.reload(true);}}function setRecordMesg(D){var A="";var C="";if(D=="record"){A="Recording in Progress";C="red";}else{if(D=="play"){A="Play in Progress";C="lightgreen";}else{if(D=="stop"){A="Stopped";C="red";}else{if(D=="align"){A="Sound Playing";C="lightgreen";
}}}}var B=document.getElementById("recTabStatus");B.innerHTML=A;B.style.color=C;B.style.fontStyle="italic";B.style.fontSize="15px";B.style.fontWeight="bold";B.style.styleFloat="right";B.style.position="relative";B.style.top="30px";}function player_control(A){return ;}function getText(A){if(typeof A=="string"){A=document.getElementById(A);
}if(typeof A.textContent=="string"){return A.textContent;}if(typeof A.innerText=="string"){return A.innerText;}return rec(A);}function rec(E){var F,C=E.childNodes;var B="";for(var D=0,A=C.length;D<A;++D){F=C[D];if(3==F.nodeType){B+=F.data;}else{if(1==F.nodeType){B+=rec(F);}}}return B.replace(/\s+/g," ");
}function computeTextboxWidth(E){var B=document.createElement("span");B.innerHTML=E;var D=getText(B);var F=SWCanvas.selected;var J=SWCanvas.doc.getElementById("mainCanvas");var K=J.clientWidth-F.pos.x;var A=0;try{var C=parseInt(D.length);A+=C*15;}catch(G){}var H=YAHOO.util.Dom.getChildrenBy(YAHOO.util.Dom.getFirstChild(B),function(L){return(L.nodeName=="IMG"||L.nodeName=="img");
});var I=0;for(k=0;k<H.length;k++){I+=H[k].width;}A+=I;if(A>K){A=K;}return A;}function saveEditorText(){var A=FCKeditorAPI.GetInstance("textEditor");var D=document.getElementById("fck-editor-content").innerHTML;document.getElementById("fck-editor-content").innerHTML="";var C=SWCanvas.selected;setLabelContent(344215,C.boxID,D);
var B=computeTextboxWidth(D);C.resize(B,C.height);sendLabelPosition(C);sendTextPosition(C);}function closeEditor(){}document.onkeydown=handleDeleteKey;function handleDeleteKey(A){if(B==null||B==undefined){A=A||window.event;var B=A.keyCode;if(B==46){SWCanvas.removeBox(idValue,true);SWCanvas.hideContextMenu();
}else{if(B==90){SWCanvas.undo();}}}}
