changeset 0:36959449f3b2 draft

add some files
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 19 Mar 2013 23:50:07 +0900
parents
children a3fdabc0613e
files css/viewer_form.css index.html js/.DS_Store js/1.3.15/jquery.jsPlumb-1.3.15-RC1.js js/1.3.15/jquery.jsPlumb-1.3.15-all-min.js js/1.3.15/jsPlumb-1.3.15-RC1.js js/1.3.15/jsPlumb-defaults-1.3.15-RC1.js js/1.3.15/jsPlumb-dom-adapter-1.3.15-RC1.js js/1.3.15/jsPlumb-renderers-canvas-1.3.15-RC1.js js/1.3.15/jsPlumb-renderers-svg-1.3.15-RC1.js js/1.3.15/jsPlumb-renderers-vml-1.3.15-RC1.js js/1.3.15/jsPlumb-util-1.3.15-RC1.js js/lib/jquery-1.8.1-min.js js/lib/jquery-ui-1.8.23-min.js js/lib/jquery.ui.touch-punch.min.js js/lib/jsBezier-0.4-min.js
diffstat 16 files changed, 10716 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/css/viewer_form.css	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,80 @@
+div.graphMainCss { 
+    background-color:#555;
+    background:-moz-linear-gradient(top,#fff,#ccf);
+<!--    background:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#ccf));
+-->
+}
+div.header {
+    position:absolute;
+    left:0;top:0;
+    z-index:5;
+    height:50px;
+    width:100%;
+    background:#ddd;
+    background:-moz-linear-gradient(top,#fff,#ddd);
+    background:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#ddd));
+    color:silver;
+    font-size:40px;
+}
+div.footer {
+    position:fixed;
+    left:0; 
+    bottom:0;
+    z-index:5;
+    height:50px;
+    width:100%;
+    background:#ddd;
+    background:-moz-linear-gradient(top,#fff,#ddd);
+    background:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#ddd));
+    color:black;
+    font-size:25px;
+}
+div.footer.up {
+    position:absolute;
+    left:0; 
+    padding-left:10px;
+    bottom:50px;
+    z-index:5;
+    height:25px;
+    width:100px;
+    background:#ddd;
+    background:-moz-linear-gradient(top,#fff,#ddd);
+    background:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#ddd));
+    color:black;
+    opacity:0.7;
+    font-size:20px;
+}
+
+label.relation {
+    position:relative;
+    top:10px;
+    margin-left:15px;
+    vertical-align:middle;
+}
+
+input.relation_input {
+
+}
+
+div.graphNode {
+    position:absolute; 
+    font-size:12px; padding:4px; background:white;
+    z-index:20;
+    width: 45px; 
+    height: 40px; 
+    border-radius:50px;
+    border:2px solid silver;
+    overflow:hidden;
+    cursor:pointer;
+}
+div.graphNodeContent {
+    position:absolute;
+    z-index:21;
+    font-size:12px;
+    background:white;
+    width: 50%;
+    height: 70%;
+    left: 10px;
+    top: 10px;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/index.html	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,629 @@
+<meta http-equiv="content-type" content="text/html;charset=utf-8" />
+<title>Graph Display</title>
+<link rel='stylesheet' href="css/viewer_form.css">
+<script type="text/javascript" src="js/lib/jquery-1.8.1-min.js"></script>
+<script type="text/javascript" src="js/lib/jquery-ui-1.8.23-min.js"></script>
+<script type="text/javascript" src="js/lib/jquery.ui.touch-punch.min.js"></script>
+<script type="text/javascript" src="js/lib/jsBezier-0.4-min.js"></script>
+<script type="text/javascript" src="js/1.3.15/jsPlumb-util-1.3.15-RC1.js"></script>
+<script type="text/javascript" src="js/1.3.15/jsPlumb-dom-adapter-1.3.15-RC1.js"></script>
+<script type="text/javascript" src="js/1.3.15/jsPlumb-1.3.15-RC1.js"></script>
+<script type="text/javascript" src="js/1.3.15/jsPlumb-defaults-1.3.15-RC1.js"></script>
+<script type="text/javascript" src="js/1.3.15/jsPlumb-renderers-svg-1.3.15-RC1.js"></script>
+<script type="text/javascript" src="js/1.3.15/jsPlumb-renderers-canvas-1.3.15-RC1.js"></script>
+<script type="text/javascript" src="js/1.3.15/jsPlumb-renderers-vml-1.3.15-RC1.js"></script>
+<script type="text/javascript" src="js/1.3.15/jquery.jsPlumb-1.3.15-RC1.js"></script>
+<script type="text/javascript" src="js/1.3.15/jquery.jsPlumb-1.3.15-all-min.js"></script>
+
+
+
+<div id="miniDisplay" style='position:fixed; left:0; top:70; width:250px; height:250px; border:solid 1px; border-radius:5px; opacity:0.5; z-index:10; visibility:hidden;'>
+    <div style='position:absolute; left:0; top:0; width:100%; height:100%; background:black; opacity:0.5;'>  </div>
+    <div id="closeMiniDisplay" style='position:absolute; right:5; top:-3; z-index:10; color:white;' onclick="$('#miniDisplay').css('visibility','hidden');" onmouseover="$('#closeMiniDisplay').css('color','yellow');" onmouseout="$('#closeMiniDisplay').css('color','white')" >CLOSE</div>
+    <div style='position:absolute; width:90%; height:90%;'>
+	<div style='position:absolute; left:5%; top:5%; width:100%; height:100%; background:white;'>
+	    <div id="miniDisplayTitle" style='position:absolute; left:10px; top:5px; font-size:24px; width:100%; text-align:left;'>
+	    </div>
+	    <div id="miniDisplayBody" style='position:absolute; left:20px; top:40px;'>
+	    </div>
+	</div>
+    </div>
+</div>
+
+
+
+<div class="graphMainCss" style="position:absolute; left:0; bottom:0; width:100%; height:75%;" id='graphMain'>
+    <div  style="position:absolute; width:0; height:0;left:0;" id='graphRoot'>
+    </div>
+</div>
+
+<script type="text/javascript">
+if(!Array.prototype.filter){
+    Array.prototype.filter=function(func){
+	var arr=[];
+	for(var i=0;i<this.length;i++)if(func(this[i]))arr.push(this[i]);
+	return arr;
+    }
+}
+
+function loadConsensus(id) {
+    function onload(json) {
+	var title = json.hogehoge ? json.hogehoge : "title";
+	document.title = title;
+    }
+}
+
+function loadUserList() {
+    $.ajax({
+	url:BASE_URL + "/users/all",
+	success:function(o) { userList = o.sort(); showUserList([]); },
+	type:"GET", cache:false,
+	error:function(o) { console.log("loadUserList error : ",o); }
+    });
+}
+
+function beginScript() {
+    DragHandler.attach($('#miniDisplay')[0]);
+}
+
+var DragHandler = {
+    _oElem : null,
+    attach : function(oElem) {
+	oElem.onmousedown = DragHandler._dragBegin;
+	return oElem;
+    },
+    _dragBegin : function(e) {
+	var oElem = DragHandler._oElem = this;
+	if (isNaN(parseInt(oElem.style.left))) { oElem.style.left = '0px'; }
+	if (isNaN(parseInt(oElem.style.top))) { oElem.style.top = '0px'; }
+	var x = parseInt(oElem.style.left);
+	var y = parseInt(oElem.style.top);
+	e = e ? e : window.event;
+	oElem.mouseX = e.clientX;
+	oElem.mouseY = e.clientY;
+	document.onmousemove = DragHandler._drag;
+	document.onmouseup = DragHandler._dragEnd;
+	return false;
+    },
+    _drag : function(e) {
+	var oElem = DragHandler._oElem;
+	var x = parseInt(oElem.style.left);
+	var y = parseInt(oElem.style.top);
+	e = e ? e : window.event;
+	oElem.style.left = x + (e.clientX - oElem.mouseX) + 'px';
+	oElem.style.top = y + (e.clientY - oElem.mouseY) + 'px';
+	oElem.mouseX = e.clientX;
+	oElem.mouseY = e.clientY;
+	return false;
+    },
+    _dragEnd : function() {
+	var oElem = DragHandler._oElem;
+	var x = parseInt(oElem.style.left);
+	var y = parseInt(oElem.style.top);
+	document.onmousemove = null;
+	document.onmouseup = null;
+	DragHandler._oElem = null;
+    }
+
+};
+
+function addLoadEvent(func) {
+    var oldonload = window.onload;
+    if (typeof window.onload != 'function') {
+	window.onload = func;
+    } else {
+	window.onload = function() {
+	    if (oldonload) {
+		oldonload();
+	    }
+	    func();
+	}
+    }
+}
+
+addLoadEvent(function() {
+    beginScript();
+});
+
+function writeMiniDisplay(title,str) {
+    $('#miniDisplayBody')[0].innerHTML = str;
+    if(title) {
+	$('#miniDisplayTitle')[0].innerHTML = title;
+    }
+}
+
+function writeJSONDataToMiniDisplay(jsonObj) {
+    var str = "";
+    for (var key in jsonObj.property) {
+	str = str + key + ": "+ jsonObj.property[key] + "<br>";
+    }
+    writeMiniDisplay(jsonObj.property.title, str);
+}
+
+
+function init() {
+    jsPlumb.importDefaults({
+	Connector : [ "Straight", { curviness:50 } ],
+	PaintStyle : { strokeStyle:"gray", lineWidth:2 },
+	EndpointStyle : {},
+	Anchors: ["BottomCenter","TopCenter"],
+    });
+    var rootDiv = $('#graphMain');
+    var rootLeft = rootDiv.offset().left;
+    var rootTop = rootDiv.offset().top;
+    $('#miniDisplay').css( {
+	left: rootLeft,
+	top: rootTop
+    });
+}
+
+function createLabelStr(value) {
+    return "<label class='relation'><input class='relation_input' type='checkbox' checked value='"+value+"'>"+value+"</label>";
+}
+
+function showMiniDisplay(jsonInfo) {
+    $("#miniDisplay").css("visibility", "visible");
+    writeJSONDataToMiniDisplay(jsonInfo)
+}
+
+var nodeNum = 0;
+var OFFSET = 100;
+var miniD = $('#miniDisplay')[0].style;
+var offsetLeft = parseInt(miniD.width.split('px')[0]);
+var offsetTop = parseInt(miniD.height.split('px')[0]);
+function calcNewNodePosition() {
+    var position = {};
+    position = {x: nodeNum*OFFSET + offsetLeft, y: nodeNum*OFFSET + offsetTop/2};
+    nodeNum++;
+    return position;
+}
+
+/*
+ *
+ */
+function clickNodeDiv(id) {
+    var graphData = GRAPH_DATA;
+    var node = graphData.nodes[id];
+    var inputDivs = $('.relation_input');
+			  
+    var rels = {evidence:1,
+		dependency:1,
+		derived:1,
+		version:1,
+		agreement:1};
+    showRelationNodes(graphData, node, rels);    
+}
+
+function returnCheckdRelation() {
+
+}
+
+function createNodeDiv(node) {
+    node.view = $("<div class='graphNode'/>");
+    node.view.click(function(){ clickNodeDiv(node.property.id) });
+    if(!node.position) node.position = calcNewNodePosition();
+    node.view.hover();
+    var div = $("<div class='graphNodeContent' />")[0];
+    div.innerHTML = node.property.title;
+    node.view[0].appendChild(div);
+    return node;
+}
+
+function updateNodeElement(node) {
+    var created = false;
+    if(!node.view) {
+	created = true;
+	createNodeDiv(node);
+    }
+    var div = node.view;
+    //    div.text(node.property.title);
+    div.click(function(){showMiniDisplay(node)});
+    DragHandler.attach($(node.view)[0]);
+    var kindBackground = {agree:"#aaf", rejected:"#fff"};
+    var kindBorder = {agree:"#66a", rejected:"#a66"};
+    div.css("background", kindBackground[node.kind]||"white");
+    div.css("border-color", kindBorder[node.kind] ||"#58f");
+    div.css({
+	left: node.position.x,
+	top: node.position.y
+    });
+    return created;    
+}
+
+
+function updateNode(node) {
+    if(updateNodeElement(node)) {
+	var fc = $('#graphRoot')[0].firstChild;
+	if(fc) {
+	    $('#graphRoot')[0].insertBefore(node.view[0], fc);
+	} else {
+	    $('#graphRoot').append(node.view);
+	}
+    }
+}
+
+var ViewParam = {
+    offsetTop:100,
+    offsetBottom:100,
+    offsetLeft:100,
+    offsetRight:100,
+    nodeWidth:120,
+    nodeHeight:60,
+    intervalX:140,
+    intervalY:120
+};
+
+
+function Edge(fromNode, toNode, relation) {
+    var obj = {from:fromNode, to:toNode, rel:relation };
+    return obj;
+}
+
+var arrowConnector = {
+    connector:"StateMachine",
+    //    paintStyle:{lineWidth:3,strokeStyle:"#056"},
+    paintStyle:{lineWidth:2,strokeStyle:"#aaf"},
+    hoverPaintStyle:{strokeStyle:"#dbe300"},
+    endpoint:"Blank",
+    anchor:"Continuous",
+    overlays:[ ["PlainArrow", {location:1, width:20, length:12} ]]
+};
+
+var arrowBothConnector = {
+    connector:"StateMachine",
+    paintStyle:{lineWidth:2,strokeStyle:"#aaf"},
+    hoverPaintStyle:{strokeStyle:"#dbe300"},
+    endpoint:"Blank",
+};
+
+function GraphData() {
+    var graphData = {};
+    graphData.nodes = {};
+    graphData.edges = {};
+    return graphData;
+}
+
+function parseJSONGraphData(memory ,jsonObj) {
+    var nodes = jsonObj.nodes;
+    for (var i=0; i<nodes.length; i++) {
+	var node = nodes[i];
+	memory.nodes[node.id] = {};
+	memory.nodes[node.id].in = [];
+	memory.nodes[node.id].out = [];
+	memory.nodes[node.id].both = [];
+	memory.nodes[node.id].property = node;
+    }
+    var edges = jsonObj.edges;
+    for (var i=0; i<edges.length; i++) {
+	var edge = edges[i];
+	var edgeId = edge.id;
+	memory.edges[edgeId] = {};
+	memory.edges[edgeId].property = edge;
+	if (edge.kind == "both") {
+	    memory.nodes[edge.from].both.push(edgeId);
+	    memory.nodes[edge.to].both.push(edgeId);
+	} else {
+	    memory.nodes[edge.from].out.push(edgeId);
+	    memory.nodes[edge.to].in.push(edgeId);
+	}
+    }
+    return memory;
+}
+
+function showEdge(graphData, edge) {
+    function connectEdge(fromNode, toNode, rel, type) {
+	var c;
+	if (type == 'both') {
+	    c = jsPlumb.connect({source:fromNode.view[0], target:toNode.view[0]}, arrowBothConnector);
+	} else {
+	    c = jsPlumb.connect({source:fromNode.view[0], target:toNode.view[0]}, arrowConnector);
+	}
+	//	jsPlumb.select({source:fromNode.view[0]}).removeAllOverlays();
+	c.setLabel({label:"<span style='color:#129; font-size:1.5em;'>"+rel+"</span>",cssStyle:""});
+	return c;
+    }
+    if (edge.visible) return;
+    var fromNode = graphData.nodes[edge.property.from];
+    var toNode = graphData.nodes[edge.property.to];
+    if (!fromNode.view && !toNode.view) return;
+    var rel = edge.property.rel;
+    var type = edge.property.type;
+    connectEdge(fromNode, toNode, rel, type);
+    edge.visible = true;
+}
+
+function createNodeFromEdge(graphData, edge, baseNode) {
+    if(edge.visible) return;
+    var fromNode = graphData.nodes[edge.property.from];
+    if (!fromNode.view) {
+	updateNode(fromNode);
+    }
+    var toNode = graphData.nodes[edge.property.to];
+    if (!toNode.view) {
+	updateNode(toNode);
+    }
+    showEdge(graphData, edge);
+}
+
+function getRelationEdgeIds(node) {
+    var edgeIds = [];
+    for (var i=0; i<node.in.length; i++) edgeIds.push(node.in[i]);
+    for (var i=0; i<node.out.length; i++) edgeIds.push(node.out[i]);
+    for (var i=0; i<node.both.length; i++) edgeIds.push(node.both[i]);
+    return edgeIds;
+}
+
+function getRelationNodeIds(graphData, node) {
+    var nodes = graphData.nodes;
+    var edges = graphData.edges;
+    var nodeIds = [];
+    for (var i=0; i<node.in.length; i++) {
+	var edgeId = node.in[i];
+	nodeIds.push(edges[edgeId].property.from);
+    }
+    for (var i=0; i<node.out.length; i++) {
+	var edgeId = node.out[i];
+	nodeIds.push(edges[edgeId].property.to);
+    }
+    for (var i=0; i<node.both.length; i++) {
+	var edgeId = node.both[i];
+	var fromId = edges[edgeId].property.from;
+	var toId = edges[edgeId].property.to;
+	if (fromId == node.property.id) {
+	    nodeIds.push(toId);
+	} else {
+	    nodeIds.push(fromId);
+	}
+    }
+    return nodeIds;
+}
+
+/*
+ * This function output all NODE thath are related [node]
+ */
+function updateRelationNodes(graphData, node) {
+    var id = node.property.id;
+    var edges = graphData.edges;
+    var edgeIds = getRelationEdgeIds(node);
+    for (var i=0; i<edgeIds.length; i++ ) {
+	createNodeFromEdge(graphData, edges[edgeIds[i]]);
+    }
+    jsPlumb.removeAllEndpoints();
+    jsPlumb.draggable($('.graphNode'));
+}
+
+/* 
+ * rels = {dependency:1, evidence:1}; 
+ * showRelationNodes(graphData, node, rels);
+ */
+function showRelationNodes(graphData, node, rels) {
+    var id = node.property.id;
+    var edges = graphData.edges;
+    var edgeIds = getRelationEdgeIds(node);
+    for (var i=0; i<edgeIds.length; i++) {
+	var edge = edges[edgeIds[i]];
+	if (rels[edge.property.rel]) {
+	    createNodeFromEdge(graphData, edges[edgeIds[i]]);	    
+	}
+    }
+    jsPlumb.removeAllEndpoints();
+    jsPlumb.draggable($('.graphNode'));
+}
+
+var BASE_THETA = -40;
+var BASE_ANGLE = 180;
+var BASE_DISTANCE = 180;
+function calcChildNodePosition(parent, num) {
+    var pX = parent.position.x;
+    var pY = parent.position.y;
+    var deg = BASE_ANGLE - num * BASE_THETA;
+    var theta = deg * (Math.PI / 180);
+    var cX = pX - (BASE_DISTANCE * Math.cos(theta));
+    var cY = pY - (BASE_DISTANCE * Math.sin(theta));
+    return {x:cX, y:cY};
+}
+
+function showAllEdge(graphData) {
+    var edges = graphData.edges;
+    for (var id in edges) {
+	showEdge(graphData, edges[id]);
+    }
+    jsPlumb.removeAllEndpoints();
+    jsPlumb.draggable($('.graphNode'));
+}
+
+function recursiveShowRelationNodes(graphData, node) {
+    if (!node.view) updateNode(node);
+    childNodeIds = getRelationNodeIds(graphData, node);
+    /* calcration of childNode position */
+    var numCalcChild = 0;
+    for (var i=0; i<childNodeIds.length; i++) {
+	var id = childNodeIds[i];
+	var childNode = graphData.nodes[id];
+	if (!childNode.position) {
+	    childNode.position = calcChildNodePosition(node, numCalcChild);
+	    updateNode(childNode);
+	}
+	numCalcChild++;
+    }
+    /* calcration of grandchildNode position  */
+    for (var i=0; i<childNodeIds.length; i++) {
+	var id = childNodeIds[i];
+	var childNode = graphData.nodes[id];
+	var ids = getRelationNodeIds(graphData, childNode);
+	for (var j=0; j<ids.length; j++) {
+	    var n = graphData.nodes[ids[j]];
+	    if (!n.position) {
+		recursiveShowRelationNodes(graphData, childNode);
+	    }
+	}
+    }
+}
+
+var EDGE_LIST = {
+    evidence:'evidence',
+    dependency:'dependency',
+    version:'version',
+    derived:'derived',
+    agreement:'agreement'
+};
+
+$(function() {
+    userName = localStorage.userName;
+    testStart();
+})
+
+function recursiveCalcPosition(graphData, parentNode) {
+    if (!parentNode.position) updateNode(parentNode);
+    childNodeIds = getRelationNodeIds(graphData, parentNode);
+    /* calcration of childNode position */
+    var numCalcChild = 0;
+    var childArray = {};
+    for (var i=0; i<childNodeIds.length; i++) {
+	var id = childNodeIds[i];
+	var childNode = graphData.nodes[id];
+	childArray[id] = childNode;
+	if (!childNode.position) {
+	    childNode.position = calcChildNodePosition(parentNode, numCalcChild);
+	    numCalcChild++;
+	}
+    }
+    /* calcration of grandchildNode position  */
+    for (var id in childArray) {
+	var childNode = childArray[id];
+	var grandChildIds = getRelationNodeIds(graphData, childNode);
+	for (var i=0; i<grandChildIds.length; i++) {
+	    var gId = grandChildIds[i];
+	    var grandChild = graphData.nodes[gId];
+	    if (!grandChild.position) {
+ 		recursiveCalcPosition(graphData, childNode);
+	    }
+	}
+    }
+}
+
+var GRAPH_DATA = new GraphData();
+var rootNode = {};
+function testStart() {
+    init();
+    var graphData = parseJSONGraphData(GRAPH_DATA, sampleJSONData);
+    var rootNodeId = "1";
+    rootNode = graphData.nodes[rootNodeId];
+    recursiveCalcPosition(graphData, rootNode);
+    updateNode(rootNode);
+}
+
+function logProperty(d) {
+    for(var key in d) {
+	console.log("key: "+key+ "\nvalue: "+d[key]);
+    }
+}
+
+sampleJSONData = {
+    nodes: [
+	{
+	    id:"1",
+	    title:"context1",
+	    kind:"agree",
+	    createdUser:"oshiro"
+	},
+	{
+	    id:"2",
+	    title:"task2",
+	    kind:"reject",
+	    createdUser:"kinjo"	    
+	},
+	{
+	    id:"3",
+	    title:"context3",
+	    createdUser:"tamayose"
+	},
+	{
+	    id:"4",
+	    title:"task4",
+	    kind:"agree",
+	    createdUser:"oshiro"
+	},
+	{
+	    id:"5",
+	    title:"conetxt5",
+ 	    createdUser:"oshiro"
+	},
+	{
+	    id:"6",
+	    title:"context6",
+ 	    createdUser:"kinjo"
+	},
+	{
+	    id:"7",
+	    title:"context7",
+ 	    createdUser:"tamayose"
+	},
+	{
+	    id:"8",
+	    title:"task2",
+ 	    createdUser:"tamayose"
+	}
+    ],
+    edges: [
+	{
+	    id:"11",
+	    from:"2",
+	    to:"1",
+	    rel:"dependency",
+	    type:""
+	},
+	{
+	    id:"12",
+	    from:"1",
+	    to:"3",
+	    rel:"evidence",
+	    type:""
+	},
+	{
+	    id:"13",
+	    from:"3",
+	    to:"4",
+	    rel:"evidence",
+	    type:""
+	},
+	{
+	    id:"14",
+	    from:"3",
+	    to:"5",
+	    rel:"derived",
+	    type:""
+	},
+	{
+	    id:"15",
+	    from:"1",
+	    to:"6",
+	    rel:"evidence",
+	    type:""
+	},
+	{
+	    id:"17",
+	    from:"7",
+	    to:"4",
+	    rel:"evidence",
+	    type:""
+	},
+	{
+	    id:"18",
+	    from:"7",
+	    to:"5",
+	    rel:"evidence",
+	    type:""
+	},
+	{
+	    id:"19",
+	    from:"8",
+	    to:"2",
+	    rel:"version",
+	    type:""
+	}
+    ]
+};
+
+</script>
+
Binary file js/.DS_Store has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/1.3.15/jquery.jsPlumb-1.3.15-RC1.js	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,379 @@
+/*
+ * jsPlumb
+ * 
+ * Title:jsPlumb 1.3.15
+ * 
+ * Provides a way to visually connect elements on an HTML page, using either SVG, Canvas
+ * elements, or VML.  
+ * 
+ * This file contains the jQuery adapter.
+ *
+ * Copyright (c) 2010 - 2012 Simon Porritt (http://jsplumb.org)
+ * 
+ * http://jsplumb.org
+ * http://github.com/sporritt/jsplumb
+ * http://code.google.com/p/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */ 
+/* 
+ * the library specific functions, such as find offset, get id, get attribute, extend etc.  
+ * the full list is:
+ * 
+ * addClass				adds a class to the given element
+ * animate				calls the underlying library's animate functionality
+ * appendElement		appends a child element to a parent element.
+ * bind					binds some event to an element
+ * dragEvents			a dictionary of event names
+ * extend				extend some js object with another.  probably not overly necessary; jsPlumb could just do this internally.
+ * getAttribute			gets some attribute from an element
+ * getDragObject		gets the object that is being dragged, by extracting it from the arguments passed to a drag callback
+ * getDragScope			gets the drag scope for a given element.
+ * getDropScope			gets the drop scope for a given element.
+ * getElementObject		turns an id or dom element into an element object of the underlying library's type.
+ * getOffset			gets an element's offset
+ * getOriginalEvent     gets the original browser event from some wrapper event
+ * getPageXY			gets the page event's xy location.
+ * getParent			gets the parent of some element.
+ * getScrollLeft		gets an element's scroll left.  TODO: is this actually used?  will it be?
+ * getScrollTop			gets an element's scroll top.  TODO: is this actually used?  will it be?
+ * getSize				gets an element's size.
+ * getUIPosition		gets the position of some element that is currently being dragged, by extracting it from the arguments passed to a drag callback.
+ * hasClass				returns whether or not the given element has the given class.
+ * initDraggable		initializes an element to be draggable 
+ * initDroppable		initializes an element to be droppable
+ * isDragSupported		returns whether or not drag is supported for some element.
+ * isDropSupported		returns whether or not drop is supported for some element.
+ * removeClass			removes a class from a given element.
+ * removeElement		removes some element completely from the DOM.
+ * setAttribute			sets an attribute on some element.
+ * setDraggable			sets whether or not some element should be draggable.
+ * setDragScope			sets the drag scope for a given element.
+ * setOffset			sets the offset of some element.
+ * trigger				triggers some event on an element.
+ * unbind				unbinds some listener from some element.
+ */
+(function($) {	
+	
+	//var getBoundingClientRectSupported = "getBoundingClientRect" in document.documentElement;
+
+	jsPlumb.CurrentLibrary = {					        
+		
+		/**
+		 * adds the given class to the element object.
+		 */
+		addClass : function(el, clazz) {
+			el = jsPlumb.CurrentLibrary.getElementObject(el);
+			try {
+				if (el[0].className.constructor == SVGAnimatedString) {
+					jsPlumbUtil.svg.addClass(el[0], clazz);
+				}
+			}
+			catch (e) {
+				// SVGAnimatedString not supported; no problem.
+			}
+			el.addClass(clazz);
+		},
+		
+		/**
+		 * animates the given element.
+		 */
+		animate : function(el, properties, options) {
+			el.animate(properties, options);
+		},				
+		
+		/**
+		 * appends the given child to the given parent.
+		 */
+		appendElement : function(child, parent) {
+			jsPlumb.CurrentLibrary.getElementObject(parent).append(child);			
+		},   
+
+		/**
+		* executes an ajax call.
+		*/
+		ajax : function(params) {
+			params = params || {};
+			params.type = params.type || "get";
+			$.ajax(params);
+		},
+		
+		/**
+		 * event binding wrapper.  it just so happens that jQuery uses 'bind' also.  yui3, for example,
+		 * uses 'on'.
+		 */
+		bind : function(el, event, callback) {
+			el = jsPlumb.CurrentLibrary.getElementObject(el);
+			el.bind(event, callback);
+		},
+		
+		/**
+         * mapping of drag events for jQuery
+         */
+		dragEvents : {
+			'start':'start', 'stop':'stop', 'drag':'drag', 'step':'step',
+			'over':'over', 'out':'out', 'drop':'drop', 'complete':'complete'
+		},
+				
+		/**
+		 * wrapper around the library's 'extend' functionality (which it hopefully has.
+		 * otherwise you'll have to do it yourself). perhaps jsPlumb could do this for you
+		 * instead.  it's not like its hard.
+		 */
+		extend : function(o1, o2) {
+			return $.extend(o1, o2);
+		},
+		
+		/**
+		 * gets the named attribute from the given element object.  
+		 */
+		getAttribute : function(el, attName) {
+			return el.attr(attName);
+		},
+		
+		getClientXY : function(eventObject) {
+			return [eventObject.clientX, eventObject.clientY];
+		},
+		
+		/**
+		 * takes the args passed to an event function and returns you an object representing that which is being dragged.
+		 */
+		getDragObject : function(eventArgs) {
+			return eventArgs[1].draggable;
+		},
+		
+		getDragScope : function(el) {
+			return el.draggable("option", "scope");
+		},
+
+		getDropEvent : function(args) {
+			return args[0];
+		},
+		
+		getDropScope : function(el) {
+			return el.droppable("option", "scope");		
+		},
+
+		/**
+		* gets a DOM element from the given input, which might be a string (in which case we just do document.getElementById),
+		* a selector (in which case we return el[0]), or a DOM element already (we assume this if it's not either of the other
+		* two cases).  this is the opposite of getElementObject below.
+		*/
+		getDOMElement : function(el) {
+			if (typeof(el) == "string") return document.getElementById(el);
+			else if (el.context || el.length != null) return el[0];
+			else return el;
+		},
+	
+		/**
+		 * gets an "element object" from the given input.  this means an object that is used by the
+		 * underlying library on which jsPlumb is running.  'el' may already be one of these objects,
+		 * in which case it is returned as-is.  otherwise, 'el' is a String, the library's lookup 
+		 * function is used to find the element, using the given String as the element's id.
+		 * 
+		 */		
+		getElementObject : function(el) {			
+			return typeof(el) == "string" ? $("#" + el) : $(el);
+		},
+		
+		/**
+		  * gets the offset for the element object.  this should return a js object like this:
+		  *
+		  * { left:xxx, top: xxx }
+		 */
+		getOffset : function(el) {
+			return el.offset();
+		},
+
+		getOriginalEvent : function(e) {
+			return e.originalEvent;
+		},
+		
+		getPageXY : function(eventObject) {
+			return [eventObject.pageX, eventObject.pageY];
+		},
+		
+		getParent : function(el) {
+			return jsPlumb.CurrentLibrary.getElementObject(el).parent();
+		},
+														
+		getScrollLeft : function(el) {
+			return el.scrollLeft();
+		},
+		
+		getScrollTop : function(el) {
+			return el.scrollTop();
+		},
+		
+		getSelector : function(spec) {
+			return $(spec);
+		},
+		
+		/**
+		 * gets the size for the element object, in an array : [ width, height ].
+		 */
+		getSize : function(el) {
+			return [el.outerWidth(), el.outerHeight()];
+		},
+
+        getTagName : function(el) {
+            var e = jsPlumb.CurrentLibrary.getElementObject(el);
+            return e.length > 0 ? e[0].tagName : null;
+        },
+		
+		/**
+		 * takes the args passed to an event function and returns you an object that gives the
+		 * position of the object being moved, as a js object with the same params as the result of
+		 * getOffset, ie: { left: xxx, top: xxx }.
+		 * 
+		 * different libraries have different signatures for their event callbacks.  
+		 * see getDragObject as well
+		 */
+		getUIPosition : function(eventArgs, zoom) {
+			
+			zoom = zoom || 1;
+			// this code is a workaround for the case that the element being dragged has a margin set on it. jquery UI passes
+			// in the wrong offset if the element has a margin (it doesn't take the margin into account).  the getBoundingClientRect
+			// method, which is in pretty much all browsers now, reports the right numbers.  but it introduces a noticeable lag, which
+			// i don't like.
+            
+			/*if ( getBoundingClientRectSupported ) {
+				var r = eventArgs[1].helper[0].getBoundingClientRect();
+				return { left : r.left, top: r.top };
+			} else {*/
+			if (eventArgs.length == 1) {
+				ret = { left: eventArgs[0].pageX, top:eventArgs[0].pageY };
+			}
+			else {
+				var ui = eventArgs[1],
+				  _offset = ui.offset;
+				  
+				ret = _offset || ui.absolutePosition;
+				
+				// adjust ui position to account for zoom, because jquery ui does not do this.
+				ui.position.left /= zoom;
+				ui.position.top /= zoom;
+			}
+            return { left:ret.left / zoom, top: ret.top / zoom };
+		},		
+		
+		hasClass : function(el, clazz) {
+			return el.hasClass(clazz);
+		},
+		
+		/**
+		 * initialises the given element to be draggable.
+		 */
+		initDraggable : function(el, options, isPlumbedComponent) {
+			options = options || {};
+			// remove helper directive if present.  
+			options.helper = null;
+			if (isPlumbedComponent)
+				options['scope'] = options['scope'] || jsPlumb.Defaults.Scope;
+			el.draggable(options);
+		},
+		
+		/**
+		 * initialises the given element to be droppable.
+		 */
+		initDroppable : function(el, options) {
+			options['scope'] = options['scope'] || jsPlumb.Defaults.Scope;
+			el.droppable(options);
+		},
+		
+		isAlreadyDraggable : function(el) {
+			el = jsPlumb.CurrentLibrary.getElementObject(el);
+			return el.hasClass("ui-draggable");
+		},
+		
+		/**
+		 * returns whether or not drag is supported (by the library, not whether or not it is disabled) for the given element.
+		 */
+		isDragSupported : function(el, options) {
+			return el.draggable;
+		},				
+						
+		/**
+		 * returns whether or not drop is supported (by the library, not whether or not it is disabled) for the given element.
+		 */
+		isDropSupported : function(el, options) {
+			return el.droppable;
+		},							
+		
+		/**
+		 * removes the given class from the element object.
+		 */
+		removeClass : function(el, clazz) {
+			el = jsPlumb.CurrentLibrary.getElementObject(el);
+			try {
+				if (el[0].className.constructor == SVGAnimatedString) {
+					jsPlumbUtil.svg.removeClass(el[0], clazz);
+				}
+			}
+			catch (e) {
+				// SVGAnimatedString not supported; no problem.
+			}
+			el.removeClass(clazz);
+		},
+		
+		removeElement : function(element, parent) {			
+			jsPlumb.CurrentLibrary.getElementObject(element).remove();
+		},
+		
+		/**
+		 * sets the named attribute on the given element object.  
+		 */
+		setAttribute : function(el, attName, attValue) {
+			el.attr(attName, attValue);
+		},
+		
+		/**
+		 * sets the draggable state for the given element
+		 */
+		setDraggable : function(el, draggable) {
+			el.draggable("option", "disabled", !draggable);
+		},
+		
+		/**
+		 * sets the drag scope.  probably time for a setDragOption method (roll this and the one above together)
+		 * @param el
+		 * @param scope
+		 */
+		setDragScope : function(el, scope) {
+			el.draggable("option", "scope", scope);
+		},
+		
+		setOffset : function(el, o) {
+			jsPlumb.CurrentLibrary.getElementObject(el).offset(o);
+		},
+		
+		/**
+		 * note that jquery ignores the name of the event you wanted to trigger, and figures it out for itself.
+		 * the other libraries do not.  yui, in fact, cannot even pass an original event.  we have to pull out stuff
+		 * from the originalEvent to put in an options object for YUI. 
+		 * @param el
+		 * @param event
+		 * @param originalEvent
+		 */
+		trigger : function(el, event, originalEvent) {
+			//originalEvent.stopPropagation();
+			//jsPlumb.CurrentLibrary.getElementObject(el).trigger(originalEvent);
+            var h = jQuery._data(jsPlumb.CurrentLibrary.getElementObject(el)[0], "handle");
+            h(originalEvent);
+            //originalEvent.stopPropagation();
+		},
+		
+		/**
+		 * event unbinding wrapper.  it just so happens that jQuery uses 'unbind' also.  yui3, for example,
+		 * uses..something else.
+		 */
+		unbind : function(el, event, callback) {
+			el = jsPlumb.CurrentLibrary.getElementObject(el);
+			el.unbind(event, callback);
+		}
+	};
+	
+	$(document).ready(jsPlumb.init);
+	
+})(jQuery);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/1.3.15/jquery.jsPlumb-1.3.15-all-min.js	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,1 @@
+jsPlumbUtil={isArray:function(b){return Object.prototype.toString.call(b)==="[object Array]"},isString:function(a){return typeof a==="string"},isBoolean:function(a){return typeof a==="boolean"},isObject:function(a){return Object.prototype.toString.call(a)==="[object Object]"},isDate:function(a){return Object.prototype.toString.call(a)==="[object Date]"},isFunction:function(a){return Object.prototype.toString.call(a)==="[object Function]"},clone:function(d){if(this.isString(d)){return new String(d)}else{if(this.isBoolean(d)){return new Boolean(d)}else{if(this.isDate(d)){return new Date(d.getTime())}else{if(this.isFunction(d)){return d}else{if(this.isArray(d)){var c=[];for(var e=0;e<d.length;e++){c.push(this.clone(d[e]))}return c}else{if(this.isObject(d)){var c={};for(var e in d){c[e]=this.clone(d[e])}return c}else{return d}}}}}}},merge:function(e,d){var k=this.clone(e);for(var h in d){if(k[h]==null||this.isString(d[h])||this.isBoolean(d[h])){k[h]=d[h]}else{if(this.isArray(d[h])&&this.isArray(k[h])){var f=[];f.push.apply(f,k[h]);f.push.apply(f,d[h]);k[h]=f}else{if(this.isObject(k[h])&&this.isObject(d[h])){for(var g in d[h]){k[h][g]=d[h][g]}}}}}return k},convertStyle:function(b,a){if("transparent"===b){return b}var g=b,f=function(h){return h.length==1?"0"+h:h},c=function(h){return f(Number(h).toString(16))},d=/(rgb[a]?\()(.*)(\))/;if(b.match(d)){var e=b.match(d)[2].split(",");g="#"+c(e[0])+c(e[1])+c(e[2]);if(!a&&e.length==4){g=g+c(e[3])}}return g},gradient:function(b,a){b=jsPlumbUtil.isArray(b)?b:[b.x,b.y];a=jsPlumbUtil.isArray(a)?a:[a.x,a.y];return(a[1]-b[1])/(a[0]-b[0])},normal:function(b,a){return -1/jsPlumbUtil.gradient(b,a)},lineLength:function(b,a){b=jsPlumbUtil.isArray(b)?b:[b.x,b.y];a=jsPlumbUtil.isArray(a)?a:[a.x,a.y];return Math.sqrt(Math.pow(a[1]-b[1],2)+Math.pow(a[0]-b[0],2))},segment:function(b,a){b=jsPlumbUtil.isArray(b)?b:[b.x,b.y];a=jsPlumbUtil.isArray(a)?a:[a.x,a.y];if(a[0]>b[0]){return(a[1]>b[1])?2:1}else{return(a[1]>b[1])?3:4}},intersects:function(f,e){var c=f.x,a=f.x+f.w,k=f.y,h=f.y+f.h,d=e.x,b=e.x+e.w,i=e.y,g=e.y+e.h;return((c<=d&&d<=a)&&(k<=i&&i<=h))||((c<=b&&b<=a)&&(k<=i&&i<=h))||((c<=d&&d<=a)&&(k<=g&&g<=h))||((c<=b&&d<=a)&&(k<=g&&g<=h))||((d<=c&&c<=b)&&(i<=k&&k<=g))||((d<=a&&a<=b)&&(i<=k&&k<=g))||((d<=c&&c<=b)&&(i<=h&&h<=g))||((d<=a&&c<=b)&&(i<=h&&h<=g))},segmentMultipliers:[null,[1,-1],[1,1],[-1,1],[-1,-1]],inverseSegmentMultipliers:[null,[-1,-1],[-1,1],[1,1],[1,-1]],pointOnLine:function(a,e,b){var d=jsPlumbUtil.gradient(a,e),i=jsPlumbUtil.segment(a,e),h=b>0?jsPlumbUtil.segmentMultipliers[i]:jsPlumbUtil.inverseSegmentMultipliers[i],c=Math.atan(d),f=Math.abs(b*Math.sin(c))*h[1],g=Math.abs(b*Math.cos(c))*h[0];return{x:a.x+g,y:a.y+f}},perpendicularLineTo:function(c,d,e){var b=jsPlumbUtil.gradient(c,d),f=Math.atan(-1/b),g=e/2*Math.sin(f),a=e/2*Math.cos(f);return[{x:d.x+a,y:d.y+g},{x:d.x-a,y:d.y-g}]},findWithFunction:function(b,d){if(b){for(var c=0;c<b.length;c++){if(d(b[c])){return c}}}return -1},indexOf:function(a,b){return jsPlumbUtil.findWithFunction(a,function(c){return c==b})},removeWithFunction:function(c,d){var b=jsPlumbUtil.findWithFunction(c,d);if(b>-1){c.splice(b,1)}return b!=-1},remove:function(b,c){var a=jsPlumbUtil.indexOf(b,c);if(a>-1){b.splice(a,1)}return a!=-1},addWithFunction:function(c,b,a){if(jsPlumbUtil.findWithFunction(c,a)==-1){c.push(b)}},addToList:function(d,b,c){var a=d[b];if(a==null){a=[],d[b]=a}a.push(c);return a},EventGenerator:function(){var c={},b=this;var a=["ready"];this.bind=function(d,e){jsPlumbUtil.addToList(c,d,e);return b};this.fire=function(g,h,d){if(c[g]){for(var f=0;f<c[g].length;f++){if(jsPlumbUtil.findWithFunction(a,function(i){return i===g})!=-1){c[g][f](h,d)}else{try{c[g][f](h,d)}catch(k){jsPlumbUtil.log("jsPlumb: fire failed for event "+g+" : "+k)}}}}return b};this.unbind=function(d){if(d){delete c[d]}else{c={}}return b};this.getListener=function(d){return c[d]}},logEnabled:true,log:function(){if(jsPlumbUtil.logEnabled&&typeof console!="undefined"){try{var b=arguments[arguments.length-1];console.log(b)}catch(a){}}},group:function(a){if(jsPlumbUtil.logEnabled&&typeof console!="undefined"){console.group(a)}},groupEnd:function(a){if(jsPlumbUtil.logEnabled&&typeof console!="undefined"){console.groupEnd(a)}},time:function(a){if(jsPlumbUtil.logEnabled&&typeof console!="undefined"){console.time(a)}},timeEnd:function(a){if(jsPlumbUtil.logEnabled&&typeof console!="undefined"){console.timeEnd(a)}}};(function(){var b=!!document.createElement("canvas").getContext,a=!!window.SVGAngle||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"),d=function(){if(d.vml==undefined){var f=document.body.appendChild(document.createElement("div"));f.innerHTML='<v:shape id="vml_flag1" adj="1" />';var e=f.firstChild;e.style.behavior="url(#default#VML)";d.vml=e?typeof e.adj=="object":true;f.parentNode.removeChild(f)}return d.vml};var c=function(i){var h={},g=[],f={},e={};this.register=function(n){var m=jsPlumb.CurrentLibrary;n=m.getElementObject(n);var p=i.getId(n),l=m.getDOMElement(n),k=m.getOffset(n);if(!h[p]){h[p]=n;g.push(n);f[p]={}}var o=function(u,q){if(u){for(var r=0;r<u.childNodes.length;r++){if(u.childNodes[r].nodeType!=3){var t=m.getElementObject(u.childNodes[r]),v=i.getId(t,null,true);if(v&&e[v]&&e[v]>0){var s=m.getOffset(t);f[p][v]={id:v,offset:{left:s.left-k.left,top:s.top-k.top}}}o(u.childNodes[r])}}}};o(l)};this.endpointAdded=function(m){var r=jsPlumb.CurrentLibrary,u=document.body,k=i.getId(m),t=r.getDOMElement(m),l=t.parentNode,o=l==u;e[k]=e[k]?e[k]+1:1;while(l!=u){var q=i.getId(l,null,true);if(q&&h[q]){var w=-1,s=r.getElementObject(l),n=r.getOffset(s);if(f[q][k]==null){var v=jsPlumb.CurrentLibrary.getOffset(m);f[q][k]={id:k,offset:{left:v.left-n.left,top:v.top-n.top}}}break}l=l.parentNode}};this.endpointDeleted=function(l){if(e[l.elementId]){e[l.elementId]--;if(e[l.elementId]<=0){for(var k in f){delete f[k][l.elementId]}}}};this.getElementsForDraggable=function(k){return f[k]};this.reset=function(){h={};g=[];f={};e={}}};if(!window.console){window.console={time:function(){},timeEnd:function(){},group:function(){},groupEnd:function(){},log:function(){}}}window.jsPlumbAdapter={headless:false,appendToRoot:function(e){document.body.appendChild(e)},getRenderModes:function(){return["canvas","svg","vml"]},isRenderModeAvailable:function(e){return{canvas:b,svg:a,vml:d()}[e]},getDragManager:function(e){return new c(e)},setRenderMode:function(i){var h;if(i){i=i.toLowerCase();var f=this.isRenderModeAvailable("canvas"),e=this.isRenderModeAvailable("svg"),g=this.isRenderModeAvailable("vml");if(i==="svg"){if(e){h="svg"}else{if(f){h="canvas"}else{if(g){h="vml"}}}}else{if(i==="canvas"&&f){h="canvas"}else{if(g){h="vml"}}}}return h}}})();(function(){var g=jsPlumbUtil.findWithFunction,G=jsPlumbUtil.indexOf,A=jsPlumbUtil.removeWithFunction,k=jsPlumbUtil.remove,r=jsPlumbUtil.addWithFunction,i=jsPlumbUtil.addToList,l=jsPlumbUtil.isArray,z=jsPlumbUtil.isString,u=jsPlumbUtil.isObject;var v=null,c=function(H,I){return n.CurrentLibrary.getAttribute(C(H),I)},d=function(I,J,H){n.CurrentLibrary.setAttribute(C(I),J,H)},y=function(I,H){n.CurrentLibrary.addClass(C(I),H)},h=function(I,H){return n.CurrentLibrary.hasClass(C(I),H)},m=function(I,H){n.CurrentLibrary.removeClass(C(I),H)},C=function(H){return n.CurrentLibrary.getElementObject(H)},s=function(I,H){var K=n.CurrentLibrary.getOffset(C(I));if(H!=null){var J=H.getZoom();return{left:K.left/J,top:K.top/J}}else{return K}},a=function(H){return n.CurrentLibrary.getSize(C(H))},o=jsPlumbUtil.log,F=jsPlumbUtil.group,f=jsPlumbUtil.groupEnd,E=jsPlumbUtil.time,t=jsPlumbUtil.timeEnd,p=function(){return""+(new Date()).getTime()},B=function(aa){var U=this,ab=arguments,S=false,M=aa.parameters||{},K=U.idPrefix,X=K+(new Date()).getTime(),W=null,ac=null;U._jsPlumb=aa._jsPlumb;U.getId=function(){return X};U.tooltip=aa.tooltip;U.hoverClass=aa.hoverClass||U._jsPlumb.Defaults.HoverClass||n.Defaults.HoverClass;jsPlumbUtil.EventGenerator.apply(this);this.clone=function(){var ad=new Object();U.constructor.apply(ad,ab);return ad};this.getParameter=function(ad){return M[ad]},this.getParameters=function(){return M},this.setParameter=function(ad,ae){M[ad]=ae},this.setParameters=function(ad){M=ad},this.overlayPlacements=[];var L=aa.beforeDetach;this.isDetachAllowed=function(ad){var ae=U._jsPlumb.checkCondition("beforeDetach",ad);if(L){try{ae=L(ad)}catch(af){o("jsPlumb: beforeDetach callback failed",af)}}return ae};var O=aa.beforeDrop;this.isDropAllowed=function(ai,af,ag,ad,ae){var ah=U._jsPlumb.checkCondition("beforeDrop",{sourceId:ai,targetId:af,scope:ag,connection:ad,dropEndpoint:ae});if(O){try{ah=O({sourceId:ai,targetId:af,scope:ag,connection:ad,dropEndpoint:ae})}catch(aj){o("jsPlumb: beforeDrop callback failed",aj)}}return ah};var Y=function(){if(W&&ac){var ad={};n.extend(ad,W);n.extend(ad,ac);delete U.hoverPaintStyle;if(ad.gradient&&W.fillStyle){delete ad.gradient}ac=ad}};this.setPaintStyle=function(ad,ae){W=ad;U.paintStyleInUse=W;Y();if(!ae){U.repaint()}};this.getPaintStyle=function(){return W};this.setHoverPaintStyle=function(ad,ae){ac=ad;Y();if(!ae){U.repaint()}};this.getHoverPaintStyle=function(){return ac};this.setHover=function(ad,af,ae){if(!U._jsPlumb.currentlyDragging&&!U._jsPlumb.isHoverSuspended()){S=ad;if(U.hoverClass!=null&&U.canvas!=null){if(ad){J.addClass(U.canvas,U.hoverClass)}else{J.removeClass(U.canvas,U.hoverClass)}}if(ac!=null){U.paintStyleInUse=ad?ac:W;ae=ae||p();U.repaint({timestamp:ae,recalc:false})}if(U.getAttachedElements&&!af){Z(ad,p(),U)}}};this.isHover=function(){return S};var V=null;this.setZIndex=function(ad){V=ad};this.getZIndex=function(){return V};var J=n.CurrentLibrary,I=["click","dblclick","mouseenter","mouseout","mousemove","mousedown","mouseup","contextmenu"],T={mouseout:"mouseexit"},N=function(af,ag,ae){var ad=T[ae]||ae;J.bind(af,ae,function(ah){ag.fire(ad,ag,ah)})},R=function(af,ae){var ad=T[ae]||ae;J.unbind(af,ae)};this.attachListeners=function(ae,af){for(var ad=0;ad<I.length;ad++){N(ae,af,I[ad])}};var Z=function(ah,ag,ad){var af=U.getAttachedElements();if(af){for(var ae=0;ae<af.length;ae++){if(!ad||ad!=af[ae]){af[ae].setHover(ah,true,ag)}}}};this.reattachListenersForElement=function(ae){if(arguments.length>1){for(var ad=0;ad<I.length;ad++){R(ae,I[ad])}for(var ad=1;ad<arguments.length;ad++){U.attachListeners(ae,arguments[ad])}}};var H=[],P=function(ad){return ad==null?null:ad.split(" ")},Q=function(ae){if(U.getDefaultType){var ag=U.getTypeDescriptor();var af=jsPlumbUtil.merge({},U.getDefaultType());for(var ad=0;ad<H.length;ad++){af=jsPlumbUtil.merge(af,U._jsPlumb.getType(H[ad],ag))}U.applyType(af);if(!ae){U.repaint()}}};U.setType=function(ad,ae){H=P(ad)||[];Q(ae)};U.getType=function(){return H};U.hasType=function(ad){return jsPlumbUtil.indexOf(H,ad)!=-1};U.addType=function(af,ag){var ae=P(af),ah=false;if(ae!=null){for(var ad=0;ad<ae.length;ad++){if(!U.hasType(ae[ad])){H.push(ae[ad]);ah=true}}if(ah){Q(ag)}}};U.removeType=function(ag,ah){var ae=P(ag),ai=false,af=function(ak){var aj=jsPlumbUtil.indexOf(H,ak);if(aj!=-1){H.splice(aj,1);return true}return false};if(ae!=null){for(var ad=0;ad<ae.length;ad++){ai=af(ae[ad])||ai}if(ai){Q(ah)}}};U.toggleType=function(ag,ah){var af=P(ag);if(af!=null){for(var ae=0;ae<af.length;ae++){var ad=jsPlumbUtil.indexOf(H,af[ae]);if(ad!=-1){H.splice(ad,1)}else{H.push(af[ae])}}Q(ah)}};this.applyType=function(ae){U.setPaintStyle(ae.paintStyle);U.setHoverPaintStyle(ae.hoverPaintStyle);if(ae.parameters){for(var ad in ae.parameters){U.setParameter(ad,ae.parameters[ad])}}}},x=function(M){B.apply(this,arguments);var S=this;this.overlays=[];var K=function(X){var V=null;if(l(X)){var U=X[0],W=n.extend({component:S,_jsPlumb:S._jsPlumb},X[1]);if(X.length==3){n.extend(W,X[2])}V=new n.Overlays[S._jsPlumb.getRenderMode()][U](W);if(W.events){for(var T in W.events){V.bind(T,W.events[T])}}}else{if(X.constructor==String){V=new n.Overlays[S._jsPlumb.getRenderMode()][X]({component:S,_jsPlumb:S._jsPlumb})}else{V=X}}S.overlays.push(V)},L=function(X){var T=S.defaultOverlayKeys||[],W=X.overlays,U=function(Y){return S._jsPlumb.Defaults[Y]||n.Defaults[Y]||[]};if(!W){W=[]}for(var V=0;V<T.length;V++){W.unshift.apply(W,U(T[V]))}return W};var I=L(M);if(I){for(var O=0;O<I.length;O++){K(I[O])}}var H=function(V){var T=-1;for(var U=0;U<S.overlays.length;U++){if(V===S.overlays[U].id){T=U;break}}return T};this.addOverlay=function(T,U){K(T);if(!U){S.repaint()}};this.getOverlay=function(U){var T=H(U);return T>=0?S.overlays[T]:null};this.getOverlays=function(){return S.overlays};this.hideOverlay=function(U){var T=S.getOverlay(U);if(T){T.hide()}};this.hideOverlays=function(){for(var T=0;T<S.overlays.length;T++){S.overlays[T].hide()}};this.showOverlay=function(U){var T=S.getOverlay(U);if(T){T.show()}};this.showOverlays=function(){for(var T=0;T<S.overlays.length;T++){S.overlays[T].show()}};this.removeAllOverlays=function(){for(var T=0;T<S.overlays.length;T++){if(S.overlays[T].cleanup){S.overlays[T].cleanup()}}S.overlays.splice(0,S.overlays.length);S.repaint()};this.removeOverlay=function(U){var T=H(U);if(T!=-1){var V=S.overlays[T];if(V.cleanup){V.cleanup()}S.overlays.splice(T,1)}};this.removeOverlays=function(){for(var T=0;T<arguments.length;T++){S.removeOverlay(arguments[T])}};var J="__label",R=function(V){var T={cssClass:V.cssClass,labelStyle:this.labelStyle,id:J,component:S,_jsPlumb:S._jsPlumb},U=n.extend(T,V);return new n.Overlays[S._jsPlumb.getRenderMode()].Label(U)};if(M.label){var P=M.labelLocation||S.defaultLabelLocation||0.5,Q=M.labelStyle||S._jsPlumb.Defaults.LabelStyle||n.Defaults.LabelStyle;this.overlays.push(R({label:M.label,location:P,labelStyle:Q}))}this.setLabel=function(T){var U=S.getOverlay(J);if(!U){var V=T.constructor==String||T.constructor==Function?{label:T}:T;U=R(V);this.overlays.push(U)}else{if(T.constructor==String||T.constructor==Function){U.setLabel(T)}else{if(T.label){U.setLabel(T.label)}if(T.location){U.setLocation(T.location)}}}if(!S._jsPlumb.isSuspendDrawing()){S.repaint()}};this.getLabel=function(){var T=S.getOverlay(J);return T!=null?T.getLabel():null};this.getLabelOverlay=function(){return S.getOverlay(J)};var N=this.applyType;this.applyType=function(U){N(U);S.removeAllOverlays();if(U.overlays){for(var T=0;T<U.overlays.length;T++){S.addOverlay(U.overlays[T],true)}}}},D=function(J,H,I){J.bind("click",function(K,L){H.fire("click",H,L)});J.bind("dblclick",function(K,L){H.fire("dblclick",H,L)});J.bind("contextmenu",function(K,L){H.fire("contextmenu",H,L)});J.bind("mouseenter",function(K,L){if(!H.isHover()){I(true);H.fire("mouseenter",H,L)}});J.bind("mouseexit",function(K,L){if(H.isHover()){I(false);H.fire("mouseexit",H,L)}})};var e=0,b=function(){var H=e+1;e++;return H};var w=function(I){this.Defaults={Anchor:"BottomCenter",Anchors:[null,null],ConnectionsDetachable:true,ConnectionOverlays:[],Connector:"Bezier",ConnectorZIndex:null,Container:null,DragOptions:{},DropOptions:{},Endpoint:"Dot",EndpointOverlays:[],Endpoints:[null,null],EndpointStyle:{fillStyle:"#456"},EndpointStyles:[null,null],EndpointHoverStyle:null,EndpointHoverStyles:[null,null],HoverPaintStyle:null,LabelStyle:{color:"black"},LogEnabled:false,Overlays:[],MaxConnections:1,PaintStyle:{lineWidth:8,strokeStyle:"#456"},ReattachConnections:false,RenderMode:"svg",Scope:"jsPlumb_DefaultScope"};if(I){n.extend(this.Defaults,I)}this.logEnabled=this.Defaults.LogEnabled;var a4={},al={};this.registerConnectionType=function(bA,bz){a4[bA]=n.extend({},bz)};this.registerConnectionTypes=function(bA){for(var bz in bA){a4[bz]=n.extend({},bA[bz])}};this.registerEndpointType=function(bA,bz){al[bA]=n.extend({},bz)};this.registerEndpointTypes=function(bA){for(var bz in bA){al[bz]=n.extend({},bA[bz])}};this.getType=function(bA,bz){return bz==="connection"?a4[bA]:al[bA]};jsPlumbUtil.EventGenerator.apply(this);var br=this,aO=b(),aR=br.bind,aE={},ad=1;this.setZoom=function(bA,bz){ad=bA;if(bz){br.repaintEverything()}};this.getZoom=function(){return ad};for(var aD in this.Defaults){aE[aD]=this.Defaults[aD]}this.bind=function(bA,bz){if("ready"===bA&&K){bz()}else{aR.apply(br,[bA,bz])}};br.importDefaults=function(bA){for(var bz in bA){br.Defaults[bz]=bA[bz]}};br.restoreDefaults=function(){br.Defaults=n.extend({},aE)};var O=null,bj=null,K=false,a0={},aV={},aW={},aj={},bu={},bk={},bq={},by=[],ag=[],R=this.Defaults.Scope,Y=null,W=function(bC,bA,bB){var bz=bC[bA];if(bz==null){bz=[];bC[bA]=bz}bz.push(bB);return bz},aX=function(bA,bz){if(br.Defaults.Container){n.CurrentLibrary.appendElement(bA,br.Defaults.Container)}else{if(!bz){jsPlumbAdapter.appendToRoot(bA)}else{n.CurrentLibrary.appendElement(bA,bz)}}},aF=1,an=function(){return""+aF++},aL=function(bz){return bz._nodes?bz._nodes:bz},be=function(bB,bD,bC){if(!jsPlumbAdapter.headless&&!a9){var bE=c(bB,"id"),bz=br.dragManager.getElementsForDraggable(bE);if(bC==null){bC=p()}br.anchorManager.redraw(bE,bD,bC);if(bz){for(var bA in bz){br.anchorManager.redraw(bz[bA].id,bD,bC,bz[bA].offset)}}}},aJ=function(bA,bC){var bD=null;if(l(bA)){bD=[];for(var bz=0;bz<bA.length;bz++){var bB=C(bA[bz]),bE=c(bB,"id");bD.push(bC(bB,bE))}}else{var bB=C(bA),bE=c(bB,"id");bD=bC(bB,bE)}return bD},ax=function(bz){return aW[bz]},bg=function(bD,bz,bG){if(!jsPlumbAdapter.headless){var bI=bz==null?false:bz,bE=n.CurrentLibrary;if(bI){if(bE.isDragSupported(bD)&&!bE.isAlreadyDraggable(bD)){var bH=bG||br.Defaults.DragOptions||n.Defaults.DragOptions;bH=n.extend({},bH);var bF=bE.dragEvents.drag,bA=bE.dragEvents.stop,bC=bE.dragEvents.start;bH[bC]=ap(bH[bC],function(){br.setHoverSuspended(true)});bH[bF]=ap(bH[bF],function(){var bJ=bE.getUIPosition(arguments,br.getZoom());be(bD,bJ);y(bD,"jsPlumb_dragged")});bH[bA]=ap(bH[bA],function(){var bJ=bE.getUIPosition(arguments,br.getZoom());be(bD,bJ);m(bD,"jsPlumb_dragged");br.setHoverSuspended(false)});var bB=H(bD);bq[bB]=true;var bI=bq[bB];bH.disabled=bI==null?false:!bI;bE.initDraggable(bD,bH,false);br.dragManager.register(bD)}}}},aC=function(bF,bA){var bz=n.extend({sourceIsNew:true,targetIsNew:true},bF);if(bA){n.extend(bz,bA)}if(bz.source&&bz.source.endpoint){bz.sourceEndpoint=bz.source}if(bz.source&&bz.target.endpoint){bz.targetEndpoint=bz.target}if(bF.uuids){bz.sourceEndpoint=ax(bF.uuids[0]);bz.targetEndpoint=ax(bF.uuids[1])}if(bz.sourceEndpoint&&bz.sourceEndpoint.isFull()){o(br,"could not add connection; source endpoint is full");return}if(bz.targetEndpoint&&bz.targetEndpoint.isFull()){o(br,"could not add connection; target endpoint is full");return}if(bz.sourceEndpoint){bz.sourceIsNew=false}if(bz.targetEndpoint){bz.targetIsNew=false}if(!bz.type&&bz.sourceEndpoint){bz.type=bz.sourceEndpoint.connectionType}if(bz.sourceEndpoint&&bz.sourceEndpoint.connectorOverlays){bz.overlays=bz.overlays||[];for(var bD=0;bD<bz.sourceEndpoint.connectorOverlays.length;bD++){bz.overlays.push(bz.sourceEndpoint.connectorOverlays[bD])}}bz.tooltip=bF.tooltip;if(!bz.tooltip&&bz.sourceEndpoint&&bz.sourceEndpoint.connectorTooltip){bz.tooltip=bz.sourceEndpoint.connectorTooltip}if(bz.target&&!bz.target.endpoint&&!bz.targetEndpoint&&!bz.newConnection){var bE=H(bz.target),bG=a1[bE],bB=aK[bE];if(bG){if(!am[bE]){return}var bC=bB!=null?bB:br.addEndpoint(bz.target,bG);if(bl[bE]){aK[bE]=bC}bz.targetEndpoint=bC;bC._makeTargetCreator=true;bz.targetIsNew=true}}if(bz.source&&!bz.source.endpoint&&!bz.sourceEndpoint&&!bz.newConnection){var bE=H(bz.source),bG=aB[bE],bB=a6[bE];if(bG){if(!ae[bE]){return}var bC=bB!=null?bB:br.addEndpoint(bz.source,bG);if(bc[bE]){a6[bE]=bC}bz.sourceEndpoint=bC;bz.sourceIsNew=true}}return bz},af=function(bD){var bC=br.Defaults.ConnectionType||br.getDefaultConnectionType(),bB=br.Defaults.EndpointType||ah,bA=n.CurrentLibrary.getParent;if(bD.container){bD.parent=bD.container}else{if(bD.sourceEndpoint){bD.parent=bD.sourceEndpoint.parent}else{if(bD.source.constructor==bB){bD.parent=bD.source.parent}else{bD.parent=bA(bD.source)}}}bD._jsPlumb=br;var bz=new bC(bD);bz.id="con_"+an();bw("click","click",bz);bw("dblclick","dblclick",bz);bw("contextmenu","contextmenu",bz);return bz},bx=function(bB,bC,bz){bC=bC||{};if(!bB.suspendedEndpoint){W(a0,bB.scope,bB)}if(!bC.doNotFireConnectionEvent&&bC.fireEvent!==false){var bA={connection:bB,source:bB.source,target:bB.target,sourceId:bB.sourceId,targetId:bB.targetId,sourceEndpoint:bB.endpoints[0],targetEndpoint:bB.endpoints[1]};br.fire("jsPlumbConnection",bA,bz);br.fire("connection",bA,bz)}br.anchorManager.newConnection(bB);be(bB.source)},bw=function(bz,bA,bB){bB.bind(bz,function(bD,bC){br.fire(bA,bB,bC)})},ay=function(bB){if(bB.container){return bB.container}else{var bz=n.CurrentLibrary.getTagName(bB.source),bA=n.CurrentLibrary.getParent(bB.source);if(bz&&bz.toLowerCase()==="td"){return n.CurrentLibrary.getParent(bA)}else{return bA}}},aH=function(bB){var bA=br.Defaults.EndpointType||ah;bB.parent=ay(bB);bB._jsPlumb=br;var bz=new bA(bB);bz.id="ep_"+an();bw("click","endpointClick",bz);bw("dblclick","endpointDblClick",bz);bw("contextmenu","contextmenu",bz);if(!jsPlumbAdapter.headless){br.dragManager.endpointAdded(bB.source)}return bz},V=function(bB,bE,bD){var bz=aV[bB];if(bz&&bz.length){for(var bC=0;bC<bz.length;bC++){for(var bA=0;bA<bz[bC].connections.length;bA++){var bF=bE(bz[bC].connections[bA]);if(bF){return}}if(bD){bD(bz[bC])}}}},Z=function(bA){for(var bz in aV){V(bz,bA)}},aw=function(bz,bA){if(bz!=null&&bz.parentNode!=null){bz.parentNode.removeChild(bz)}},aZ=function(bB,bA){for(var bz=0;bz<bB.length;bz++){aw(bB[bz],bA)}},bo=function(bA,bz){return aJ(bA,function(bB,bC){bq[bC]=bz;if(n.CurrentLibrary.isDragSupported(bB)){n.CurrentLibrary.setDraggable(bB,bz)}})},a7=function(bB,bC,bz){bC=bC==="block";var bA=null;if(bz){if(bC){bA=function(bE){bE.setVisible(true,true,true)}}else{bA=function(bE){bE.setVisible(false,true,true)}}}var bD=c(bB,"id");V(bD,function(bF){if(bC&&bz){var bE=bF.sourceId===bD?1:0;if(bF.endpoints[bE].isVisible()){bF.setVisible(true)}}else{bF.setVisible(bC)}},bA)},bm=function(bz){return aJ(bz,function(bB,bA){var bC=bq[bA]==null?false:bq[bA];bC=!bC;bq[bA]=bC;n.CurrentLibrary.setDraggable(bB,bC);return bC})},aS=function(bz,bB){var bA=null;if(bB){bA=function(bC){var bD=bC.isVisible();bC.setVisible(!bD)}}V(bz,function(bD){var bC=bD.isVisible();bD.setVisible(!bC)},bA)},X=function(bE){var bC=bE.timestamp,bz=bE.recalc,bD=bE.offset,bA=bE.elId;if(a9&&!bC){bC=bd}if(!bz){if(bC&&bC===bu[bA]){return aj[bA]}}if(bz||!bD){var bB=C(bA);if(bB!=null){ag[bA]=a(bB);aj[bA]=s(bB,br);bu[bA]=bC}}else{aj[bA]=bD;if(ag[bA]==null){var bB=C(bA);if(bB!=null){ag[bA]=a(bB)}}}if(aj[bA]&&!aj[bA].right){aj[bA].right=aj[bA].left+ag[bA][0];aj[bA].bottom=aj[bA].top+ag[bA][1];aj[bA].width=ag[bA][0];aj[bA].height=ag[bA][1];aj[bA].centerx=aj[bA].left+(aj[bA].width/2);aj[bA].centery=aj[bA].top+(aj[bA].height/2)}return aj[bA]},aQ=function(bz){var bA=aj[bz];if(!bA){bA=X({elId:bz})}return{o:bA,s:ag[bz]}},H=function(bz,bA,bC){var bB=C(bz);var bD=c(bB,"id");if(!bD||bD=="undefined"){if(arguments.length==2&&arguments[1]!=undefined){bD=bA}else{if(arguments.length==1||(arguments.length==3&&!arguments[2])){bD="jsPlumb_"+aO+"_"+an()}}if(!bC){d(bB,"id",bD)}}return bD},ap=function(bB,bz,bA){bB=bB||function(){};bz=bz||function(){};return function(){var bC=null;try{bC=bz.apply(this,arguments)}catch(bD){o(br,"jsPlumb function failed : "+bD)}if(bA==null||(bC!==bA)){try{bB.apply(this,arguments)}catch(bD){o(br,"wrapped function failed : "+bD)}}return bC}};this.connectorClass="_jsPlumb_connector";this.endpointClass="_jsPlumb_endpoint";this.overlayClass="_jsPlumb_overlay";this.Anchors={};this.Connectors={canvas:{},svg:{},vml:{}};this.Endpoints={canvas:{},svg:{},vml:{}};this.Overlays={canvas:{},svg:{},vml:{}};this.addClass=function(bA,bz){return n.CurrentLibrary.addClass(bA,bz)};this.removeClass=function(bA,bz){return n.CurrentLibrary.removeClass(bA,bz)};this.hasClass=function(bA,bz){return n.CurrentLibrary.hasClass(bA,bz)};this.addEndpoint=function(bC,bD,bM){bM=bM||{};var bB=n.extend({},bM);n.extend(bB,bD);bB.endpoint=bB.endpoint||br.Defaults.Endpoint||n.Defaults.Endpoint;bB.paintStyle=bB.paintStyle||br.Defaults.EndpointStyle||n.Defaults.EndpointStyle;bC=aL(bC);var bE=[],bH=bC.length&&bC.constructor!=String?bC:[bC];for(var bF=0;bF<bH.length;bF++){var bK=C(bH[bF]),bA=H(bK);bB.source=bK;X({elId:bA,timestamp:bd});var bJ=aH(bB);if(bB.parentAnchor){bJ.parentAnchor=bB.parentAnchor}W(aV,bA,bJ);var bI=aj[bA],bG=ag[bA];var bL=bJ.anchor.compute({xy:[bI.left,bI.top],wh:bG,element:bJ,timestamp:bd});var bz={anchorLoc:bL,timestamp:bd};if(a9){bz.recalc=false}bJ.paint(bz);bE.push(bJ)}return bE.length==1?bE[0]:bE};this.addEndpoints=function(bD,bA,bz){var bC=[];for(var bB=0;bB<bA.length;bB++){var bE=br.addEndpoint(bD,bA[bB],bz);if(l(bE)){Array.prototype.push.apply(bC,bE)}else{bC.push(bE)}}return bC};this.animate=function(bB,bA,bz){var bC=C(bB),bF=c(bB,"id");bz=bz||{};var bE=n.CurrentLibrary.dragEvents.step;var bD=n.CurrentLibrary.dragEvents.complete;bz[bE]=ap(bz[bE],function(){br.repaint(bF)});bz[bD]=ap(bz[bD],function(){br.repaint(bF)});n.CurrentLibrary.animate(bC,bA,bz)};this.checkCondition=function(bB,bD){var bz=br.getListener(bB);var bC=true;if(bz&&bz.length>0){try{for(var bA=0;bA<bz.length;bA++){bC=bC&&bz[bA](bD)}}catch(bE){o(br,"cannot check condition ["+bB+"]"+bE)}}return bC};this.connect=function(bC,bA){var bz=aC(bC,bA),bB;if(bz){if(bz.deleteEndpointsOnDetach==null){bz.deleteEndpointsOnDetach=true}bB=af(bz);bx(bB,bz)}return bB};this.deleteEndpoint=function(bA){var bF=(typeof bA=="string")?aW[bA]:bA;if(bF){var bC=bF.getUuid();if(bC){aW[bC]=null}bF.detachAll();if(bF.endpoint.cleanup){bF.endpoint.cleanup()}aZ(bF.endpoint.getDisplayElements());br.anchorManager.deleteEndpoint(bF);for(var bE in aV){var bz=aV[bE];if(bz){var bD=[];for(var bB=0;bB<bz.length;bB++){if(bz[bB]!=bF){bD.push(bz[bB])}}aV[bE]=bD}}if(!jsPlumbAdapter.headless){br.dragManager.endpointDeleted(bF)}}};this.deleteEveryEndpoint=function(){br.setSuspendDrawing(true);for(var bB in aV){var bz=aV[bB];if(bz&&bz.length){for(var bA=0;bA<bz.length;bA++){br.deleteEndpoint(bz[bA])}}}aV={};aW={};br.setSuspendDrawing(false,true)};var ba=function(bC,bE,bz){var bB=br.Defaults.ConnectionType||br.getDefaultConnectionType(),bA=bC.constructor==bB,bD=bA?{connection:bC,source:bC.source,target:bC.target,sourceId:bC.sourceId,targetId:bC.targetId,sourceEndpoint:bC.endpoints[0],targetEndpoint:bC.endpoints[1]}:bC;if(bE){br.fire("jsPlumbConnectionDetached",bD,bz);br.fire("connectionDetached",bD,bz)}br.anchorManager.connectionDetached(bD)},a8=function(bz){br.fire("connectionDrag",bz)},aT=function(bz){br.fire("connectionDragStop",bz)};this.detach=function(){if(arguments.length==0){return}var bD=br.Defaults.ConnectionType||br.getDefaultConnectionType(),bE=arguments[0].constructor==bD,bC=arguments.length==2?bE?(arguments[1]||{}):arguments[0]:arguments[0],bH=(bC.fireEvent!==false),bB=bC.forceDetach,bA=bE?arguments[0]:bC.connection;if(bA){if(bB||(bA.isDetachAllowed(bA)&&bA.endpoints[0].isDetachAllowed(bA)&&bA.endpoints[1].isDetachAllowed(bA))){if(bB||br.checkCondition("beforeDetach",bA)){bA.endpoints[0].detach(bA,false,true,bH)}}}else{var bz=n.extend({},bC);if(bz.uuids){ax(bz.uuids[0]).detachFrom(ax(bz.uuids[1]),bH)}else{if(bz.sourceEndpoint&&bz.targetEndpoint){bz.sourceEndpoint.detachFrom(bz.targetEndpoint)}else{var bG=H(bz.source),bF=H(bz.target);V(bG,function(bI){if((bI.sourceId==bG&&bI.targetId==bF)||(bI.targetId==bG&&bI.sourceId==bF)){if(br.checkCondition("beforeDetach",bI)){bI.endpoints[0].detach(bI,false,true,bH)}}})}}}};this.detachAllConnections=function(bB,bC){bC=bC||{};bB=C(bB);var bD=c(bB,"id"),bz=aV[bD];if(bz&&bz.length){for(var bA=0;bA<bz.length;bA++){bz[bA].detachAll(bC.fireEvent)}}};this.detachEveryConnection=function(bB){bB=bB||{};for(var bC in aV){var bz=aV[bC];if(bz&&bz.length){for(var bA=0;bA<bz.length;bA++){bz[bA].detachAll(bB.fireEvent)}}}a0={}};this.draggable=function(bB,bz){if(typeof bB=="object"&&bB.length){for(var bA=0;bA<bB.length;bA++){var bC=C(bB[bA]);if(bC){bg(bC,true,bz)}}}else{if(bB._nodes){for(var bA=0;bA<bB._nodes.length;bA++){var bC=C(bB._nodes[bA]);if(bC){bg(bC,true,bz)}}}else{var bC=C(bB);if(bC){bg(bC,true,bz)}}}};this.extend=function(bA,bz){return n.CurrentLibrary.extend(bA,bz)};this.getDefaultEndpointType=function(){return ah};this.getDefaultConnectionType=function(){return az};var bt=function(bD,bC,bA,bz){for(var bB=0;bB<bD.length;bB++){bD[bB][bC].apply(bD[bB],bA)}return bz(bD)},T=function(bD,bC,bA){var bz=[];for(var bB=0;bB<bD.length;bB++){bz.push([bD[bB][bC].apply(bD[bB],bA),bD[bB]])}return bz},aq=function(bB,bA,bz){return function(){return bt(bB,bA,arguments,bz)}},aA=function(bA,bz){return function(){return T(bA,bz,arguments)}},bv=function(bz,bC){var bB=[];if(bz){if(typeof bz=="string"){if(bz==="*"){return bz}bB.push(bz)}else{if(bC){bB=bz}else{for(var bA=0;bA<bz.length;bA++){bB.push(H(C(bz[bA])))}}}}return bB},aI=function(bB,bA,bz){if(bB==="*"){return true}return bB.length>0?G(bB,bA)!=-1:!bz};this.getConnections=function(bI,bA){if(!bI){bI={}}else{if(bI.constructor==String){bI={scope:bI}}}var bH=bI.scope||br.getDefaultScope(),bG=bv(bH,true),bz=bv(bI.source),bE=bv(bI.target),bD=(!bA&&bG.length>1)?{}:[],bJ=function(bL,bM){if(!bA&&bG.length>1){var bK=bD[bL];if(bK==null){bK=[];bD[bL]=bK}bK.push(bM)}else{bD.push(bM)}};for(var bC in a0){if(aI(bG,bC)){for(var bB=0;bB<a0[bC].length;bB++){var bF=a0[bC][bB];if(aI(bz,bF.sourceId)&&aI(bE,bF.targetId)){bJ(bC,bF)}}}}return bD};var L=function(bz,bA){return function(bC){for(var bB=0;bB<bz.length;bB++){bC(bz[bB])}return bA(bz)}},P=function(bz){return function(bA){return bz[bA]}};var Q=function(bz,bA){return{setHover:aq(bz,"setHover",bA),removeAllOverlays:aq(bz,"removeAllOverlays",bA),setLabel:aq(bz,"setLabel",bA),addOverlay:aq(bz,"addOverlay",bA),removeOverlay:aq(bz,"removeOverlay",bA),removeOverlays:aq(bz,"removeOverlays",bA),showOverlay:aq(bz,"showOverlay",bA),hideOverlay:aq(bz,"hideOverlay",bA),showOverlays:aq(bz,"showOverlays",bA),hideOverlays:aq(bz,"hideOverlays",bA),setPaintStyle:aq(bz,"setPaintStyle",bA),setHoverPaintStyle:aq(bz,"setHoverPaintStyle",bA),setParameter:aq(bz,"setParameter",bA),setParameters:aq(bz,"setParameters",bA),setVisible:aq(bz,"setVisible",bA),setZIndex:aq(bz,"setZIndex",bA),repaint:aq(bz,"repaint",bA),addType:aq(bz,"addType",bA),toggleType:aq(bz,"toggleType",bA),removeType:aq(bz,"removeType",bA),getLabel:aA(bz,"getLabel"),getOverlay:aA(bz,"getOverlay"),isHover:aA(bz,"isHover"),getParameter:aA(bz,"getParameter"),getParameters:aA(bz,"getParameters"),getPaintStyle:aA(bz,"getPaintStyle"),getHoverPaintStyle:aA(bz,"getHoverPaintStyle"),isVisible:aA(bz,"isVisible"),getZIndex:aA(bz,"getZIndex"),hasType:aA(bz,"hasType"),getType:aA(bz,"getType"),length:bz.length,each:L(bz,bA),get:P(bz)}};var aN=function(bA){var bz=Q(bA,aN);return n.CurrentLibrary.extend(bz,{setDetachable:aq(bA,"setDetachable",aN),setReattach:aq(bA,"setReattach",aN),setConnector:aq(bA,"setConnector",aN),detach:function(){for(var bB=0;bB<bA.length;bB++){br.detach(bA[bB])}},isDetachable:aA(bA,"isDetachable"),isReattach:aA(bA,"isReattach")})};var bf=function(bA){var bz=Q(bA,bf);return n.CurrentLibrary.extend(bz,{setEnabled:aq(bA,"setEnabled",bf),isEnabled:aA(bA,"isEnabled"),detachAll:function(){for(var bB=0;bB<bA.length;bB++){bA[bB].detachAll()}},"delete":function(){for(var bB=0;bB<bA.length;bB++){br.deleteEndpoint(bA[bB])}}})};this.select=function(bz){bz=bz||{};bz.scope=bz.scope||"*";var bA=br.getConnections(bz,true);return aN(bA)};this.selectEndpoints=function(bH){bH=bH||{};bH.scope=bH.scope||"*";var bM=!bH.element&&!bH.source&&!bH.target,bA=bM?"*":bv(bH.element),bB=bM?"*":bv(bH.source),bJ=bM?"*":bv(bH.target),bO=bv(bH.scope,true);var bP=[];for(var bF in aV){var bD=aI(bA,bF,true),bz=aI(bB,bF,true),bE=bB!="*",bK=aI(bJ,bF,true),bC=bJ!="*";if(bD||bz||bK){inner:for(var bI=0;bI<aV[bF].length;bI++){var bL=aV[bF][bI];if(aI(bO,bL.scope,true)){var bN=(bE&&bB.length>0&&!bL.isSource),bG=(bC&&bJ.length>0&&!bL.isTarget);if(bN||bG){continue inner}bP.push(bL)}}}}return bf(bP)};this.getAllConnections=function(){return a0};this.getDefaultScope=function(){return R};this.getEndpoint=ax;this.getEndpoints=function(bz){return aV[H(bz)]};this.getId=H;this.getOffset=function(bA){var bz=aj[bA];return X({elId:bA})};this.getSelector=function(bz){return n.CurrentLibrary.getSelector(bz)};this.getSize=function(bA){var bz=ag[bA];if(!bz){X({elId:bA})}return ag[bA]};this.appendElement=aX;var aU=false;this.isHoverSuspended=function(){return aU};this.setHoverSuspended=function(bz){aU=bz};var aY=function(bz){return function(){return jsPlumbAdapter.isRenderModeAvailable(bz)}};this.isCanvasAvailable=aY("canvas");this.isSVGAvailable=aY("svg");this.isVMLAvailable=aY("vml");this.hide=function(bz,bA){a7(bz,"none",bA)};this.idstamp=an;this.init=function(){if(!K){br.setRenderMode(br.Defaults.RenderMode);var bz=function(bA){n.CurrentLibrary.bind(document,bA,function(bG){if(!br.currentlyDragging&&Y==n.CANVAS){for(var bF in a0){var bH=a0[bF];for(var bD=0;bD<bH.length;bD++){var bC=bH[bD].connector[bA](bG);if(bC){return}}}for(var bE in aV){var bB=aV[bE];for(var bD=0;bD<bB.length;bD++){if(bB[bD].endpoint[bA](bG)){return}}}}})};bz("click");bz("dblclick");bz("mousemove");bz("mousedown");bz("mouseup");bz("contextmenu");K=true;br.fire("ready")}};this.log=O;this.jsPlumbUIComponent=B;this.makeAnchor=function(){if(arguments.length==0){return null}var bE=arguments[0],bB=arguments[1],bA=arguments[2],bC=null;if(bE.compute&&bE.getOrientation){return bE}else{if(typeof bE=="string"){bC=n.Anchors[arguments[0]]({elementId:bB,jsPlumbInstance:br})}else{if(l(bE)){if(l(bE[0])||z(bE[0])){if(bE.length==2&&z(bE[0])&&u(bE[1])){var bz=n.extend({elementId:bB,jsPlumbInstance:br},bE[1]);bC=n.Anchors[bE[0]](bz)}else{bC=new au(bE,null,bB)}}else{var bD={x:bE[0],y:bE[1],orientation:(bE.length>=4)?[bE[2],bE[3]]:[0,0],offsets:(bE.length==6)?[bE[4],bE[5]]:[0,0],elementId:bB};bC=new ab(bD);bC.clone=function(){return new ab(bD)}}}}}if(!bC.id){bC.id="anchor_"+an()}return bC};this.makeAnchors=function(bC,bA,bz){var bD=[];for(var bB=0;bB<bC.length;bB++){if(typeof bC[bB]=="string"){bD.push(n.Anchors[bC[bB]]({elementId:bA,jsPlumbInstance:bz}))}else{if(l(bC[bB])){bD.push(br.makeAnchor(bC[bB],bA,bz))}}}return bD};this.makeDynamicAnchor=function(bz,bA){return new au(bz,bA)};var a1={},aK={},bl={},at={},ac=function(bz,bA){bz.paintStyle=bz.paintStyle||br.Defaults.EndpointStyles[bA]||br.Defaults.EndpointStyle||n.Defaults.EndpointStyles[bA]||n.Defaults.EndpointStyle;bz.hoverPaintStyle=bz.hoverPaintStyle||br.Defaults.EndpointHoverStyles[bA]||br.Defaults.EndpointHoverStyle||n.Defaults.EndpointHoverStyles[bA]||n.Defaults.EndpointHoverStyle;bz.anchor=bz.anchor||br.Defaults.Anchors[bA]||br.Defaults.Anchor||n.Defaults.Anchors[bA]||n.Defaults.Anchor;bz.endpoint=bz.endpoint||br.Defaults.Endpoints[bA]||br.Defaults.Endpoint||n.Defaults.Endpoints[bA]||n.Defaults.Endpoint};this.makeTarget=function(bC,bD,bJ){var bA=n.extend({_jsPlumb:br},bJ);n.extend(bA,bD);ac(bA,1);var bH=n.CurrentLibrary,bI=bA.scope||br.Defaults.Scope,bE=!(bA.deleteEndpointsOnDetach===false),bB=bA.maxConnections||-1,bz=bA.onMaxConnections;_doOne=function(bO){var bM=H(bO);a1[bM]=bA;bl[bM]=bA.uniqueEndpoint,at[bM]=bB,am[bM]=true,proxyComponent=new B(bA);var bL=n.extend({},bA.dropOptions||{}),bK=function(){var bR=n.CurrentLibrary.getDropEvent(arguments),bT=br.select({target:bM}).length;br.currentlyDragging=false;var b3=C(bH.getDragObject(arguments)),bS=c(b3,"dragId"),b1=c(b3,"originalScope"),bY=bk[bS],bQ=bY.endpoints[0],bP=bA.endpoint?n.extend({},bA.endpoint):{};if(!am[bM]||at[bM]>0&&bT>=at[bM]){if(bz){bz({element:bO,connection:bY},bR)}return false}bQ.anchor.locked=false;if(b1){bH.setDragScope(b3,b1)}var bW=proxyComponent.isDropAllowed(bY.sourceId,H(bO),bY.scope,bY,null);if(bY.endpointsToDeleteOnDetach){if(bQ===bY.endpointsToDeleteOnDetach[0]){bY.endpointsToDeleteOnDetach[0]=null}else{if(bQ===bY.endpointsToDeleteOnDetach[1]){bY.endpointsToDeleteOnDetach[1]=null}}}if(bY.suspendedEndpoint){bY.targetId=bY.suspendedEndpoint.elementId;bY.target=bH.getElementObject(bY.suspendedEndpoint.elementId);bY.endpoints[1]=bY.suspendedEndpoint}if(bW){bQ.detach(bY,false,true,false);var b2=aK[bM]||br.addEndpoint(bO,bA);if(bA.uniqueEndpoint){aK[bM]=b2}b2._makeTargetCreator=true;if(b2.anchor.positionFinder!=null){var bZ=bH.getUIPosition(arguments,br.getZoom()),bV=s(bO,br),b0=a(bO),bU=b2.anchor.positionFinder(bZ,bV,b0,b2.anchor.constructorParams);b2.anchor.x=bU[0];b2.anchor.y=bU[1]}var bX=br.connect({source:bQ,target:b2,scope:b1,previousConnection:bY,container:bY.parent,deleteEndpointsOnDetach:bE,doNotFireConnectionEvent:bQ.endpointWillMoveAfterConnection});if(bY.endpoints[1]._makeTargetCreator&&bY.endpoints[1].connections.length<2){br.deleteEndpoint(bY.endpoints[1])}if(bE){bX.endpointsToDeleteOnDetach=[bQ,b2]}bX.repaint()}else{if(bY.suspendedEndpoint){if(bY.isReattach()){bY.setHover(false);bY.floatingAnchorIndex=null;bY.suspendedEndpoint.addConnection(bY);br.repaint(bQ.elementId)}else{bQ.detach(bY,false,true,true,bR)}}}};var bN=bH.dragEvents.drop;bL.scope=bL.scope||bI;bL[bN]=ap(bL[bN],bK);bH.initDroppable(bO,bL,true)};bC=aL(bC);var bG=bC.length&&bC.constructor!=String?bC:[bC];for(var bF=0;bF<bG.length;bF++){_doOne(C(bG[bF]))}return br};this.unmakeTarget=function(bA,bB){bA=n.CurrentLibrary.getElementObject(bA);var bz=H(bA);if(!bB){delete a1[bz];delete bl[bz];delete at[bz];delete am[bz]}return br};this.makeTargets=function(bB,bC,bz){for(var bA=0;bA<bB.length;bA++){br.makeTarget(bB[bA],bC,bz)}};var aB={},a6={},bc={},ae={},J={},N={},am={};this.makeSource=function(bD,bE,bI){var bB=n.extend({},bI);n.extend(bB,bE);ac(bB,0);var bH=n.CurrentLibrary,bC=bB.maxConnections||-1,bA=bB.onMaxConnections,bz=function(bQ){var bK=H(bQ),bR=bB.parent,bJ=bR!=null?br.getId(bH.getElementObject(bR)):bK;aB[bJ]=bB;bc[bJ]=bB.uniqueEndpoint;ae[bJ]=true;var bL=bH.dragEvents.stop,bP=bH.dragEvents.drag,bS=n.extend({},bB.dragOptions||{}),bN=bS.drag,bT=bS.stop,bU=null,bO=false;N[bJ]=bC;bS.scope=bS.scope||bB.scope;bS[bP]=ap(bS[bP],function(){if(bN){bN.apply(this,arguments)}bO=false});bS[bL]=ap(bS[bL],function(){if(bT){bT.apply(this,arguments)}br.currentlyDragging=false;if(bU.connections.length==0){br.deleteEndpoint(bU)}else{bH.unbind(bU.canvas,"mousedown");var bW=bB.anchor||br.Defaults.Anchor,bX=bU.anchor,bZ=bU.connections[0];bU.anchor=br.makeAnchor(bW,bK,br);if(bB.parent){var bY=bH.getElementObject(bB.parent);if(bY){var bV=bU.elementId;var b0=bB.container||br.Defaults.Container||n.Defaults.Container;bU.setElement(bY,b0);bU.endpointWillMoveAfterConnection=false;br.anchorManager.rehomeEndpoint(bV,bY);bZ.previousConnection=null;A(a0[bZ.scope],function(b1){return b1.id===bZ.id});br.anchorManager.connectionDetached({sourceId:bZ.sourceId,targetId:bZ.targetId,connection:bZ});bx(bZ)}}bU.repaint();br.repaint(bU.elementId);br.repaint(bZ.targetId)}});var bM=function(bZ){if(!ae[bJ]){return}var bX=br.select({source:bJ}).length;if(N[bJ]>=0&&bX>=N[bJ]){if(bA){bA({element:bQ,maxConnections:bC},bZ)}return false}if(bE.filter){var bV=bE.filter(bH.getOriginalEvent(bZ),bQ);if(bV===false){return}}var b3=X({elId:bK});var b2=((bZ.pageX||bZ.page.x)-b3.left)/b3.width,b1=((bZ.pageY||bZ.page.y)-b3.top)/b3.height,b7=b2,b6=b1;if(bB.parent){var b0=bH.getElementObject(bB.parent),bY=H(b0);b3=X({elId:bY});b7=((bZ.pageX||bZ.page.x)-b3.left)/b3.width,b6=((bZ.pageY||bZ.page.y)-b3.top)/b3.height}var b5={};n.extend(b5,bB);b5.isSource=true;b5.anchor=[b2,b1,0,0];b5.parentAnchor=[b7,b6,0,0];b5.dragOptions=bS;if(bB.parent){var bW=b5.container||br.Defaults.Container||n.Defaults.Container;if(bW){b5.container=bW}else{b5.container=n.CurrentLibrary.getParent(bB.parent)}}bU=br.addEndpoint(bK,b5);bO=true;bU.endpointWillMoveAfterConnection=bB.parent!=null;bU.endpointWillMoveTo=bB.parent?bH.getElementObject(bB.parent):null;var b4=function(){if(bO){br.deleteEndpoint(bU)}};br.registerListener(bU.canvas,"mouseup",b4);br.registerListener(bQ,"mouseup",b4);bH.trigger(bU.canvas,"mousedown",bZ)};br.registerListener(bQ,"mousedown",bM);J[bK]=bM};bD=aL(bD);var bG=bD.length&&bD.constructor!=String?bD:[bD];for(var bF=0;bF<bG.length;bF++){bz(C(bG[bF]))}return br};this.unmakeSource=function(bA,bB){bA=n.CurrentLibrary.getElementObject(bA);var bC=H(bA),bz=J[bC];if(bz){br.unregisterListener(_el,"mousedown",bz)}if(!bB){delete aB[bC];delete bc[bC];delete ae[bC];delete J[bC];delete N[bC]}return br};this.unmakeEverySource=function(){for(var bz in ae){br.unmakeSource(bz,true)}aB={};bc={};ae={};J={}};this.unmakeEveryTarget=function(){for(var bz in am){br.unmakeTarget(bz,true)}a1={};bl={};at={};am={};return br};this.makeSources=function(bB,bC,bz){for(var bA=0;bA<bB.length;bA++){br.makeSource(bB[bA],bC,bz)}return br};var aP=function(bD,bC,bE,bz){var bA=bD=="source"?ae:am;if(z(bC)){bA[bC]=bz?!bA[bC]:bE}else{if(bC.length){bC=aL(bC);for(var bB=0;bB<bC.length;bB++){var bF=_el=n.CurrentLibrary.getElementObject(bC[bB]),bF=H(_el);bA[bF]=bz?!bA[bF]:bE}}}return br};this.setSourceEnabled=function(bz,bA){return aP("source",bz,bA)};this.toggleSourceEnabled=function(bz){aP("source",bz,null,true);return br.isSourceEnabled(bz)};this.isSource=function(bz){bz=n.CurrentLibrary.getElementObject(bz);return ae[H(bz)]!=null};this.isSourceEnabled=function(bz){bz=n.CurrentLibrary.getElementObject(bz);return ae[H(bz)]===true};this.setTargetEnabled=function(bz,bA){return aP("target",bz,bA)};this.toggleTargetEnabled=function(bz){return aP("target",bz,null,true);return br.isTargetEnabled(bz)};this.isTarget=function(bz){bz=n.CurrentLibrary.getElementObject(bz);return am[H(bz)]!=null};this.isTargetEnabled=function(bz){bz=n.CurrentLibrary.getElementObject(bz);return am[H(bz)]===true};this.ready=function(bz){br.bind("ready",bz)};this.repaint=function(bA,bC,bB){if(typeof bA=="object"){for(var bz=0;bz<bA.length;bz++){be(C(bA[bz]),bC,bB)}}else{be(C(bA),bC,bB)}return br};this.repaintEverything=function(){for(var bz in aV){be(C(bz))}return br};this.removeAllEndpoints=function(bB){var bz=c(bB,"id"),bC=aV[bz];if(bC){for(var bA=0;bA<bC.length;bA++){br.deleteEndpoint(bC[bA])}}aV[bz]=[];return br};var ai={},bi=function(){for(var bA in ai){for(var bz=0;bz<ai[bA].length;bz++){var bB=ai[bA][bz];n.CurrentLibrary.unbind(bB.el,bB.event,bB.listener)}}ai={}};this.registerListener=function(bA,bz,bB){n.CurrentLibrary.bind(bA,bz,bB);W(ai,bz,{el:bA,event:bz,listener:bB})};this.unregisterListener=function(bA,bz,bB){n.CurrentLibrary.unbind(bA,bz,bB);A(ai,function(bC){return bC.type==bz&&bC.listener==bB})};this.reset=function(){br.deleteEveryEndpoint();br.unbind();a1={};aK={};bl={};at={};aB={};a6={};bc={};N={};bi();br.anchorManager.reset();if(!jsPlumbAdapter.headless){br.dragManager.reset()}};this.setDefaultScope=function(bz){R=bz;return br};this.setDraggable=bo;this.setId=function(bD,bz,bF){var bG=bD.constructor==String?bD:br.getId(bD),bC=br.getConnections({source:bG,scope:"*"},true),bB=br.getConnections({target:bG,scope:"*"},true);bz=""+bz;if(!bF){bD=n.CurrentLibrary.getElementObject(bG);n.CurrentLibrary.setAttribute(bD,"id",bz)}bD=n.CurrentLibrary.getElementObject(bz);aV[bz]=aV[bG]||[];for(var bA=0;bA<aV[bz].length;bA++){aV[bz][bA].elementId=bz;aV[bz][bA].element=bD;aV[bz][bA].anchor.elementId=bz}delete aV[bG];br.anchorManager.changeId(bG,bz);var bE=function(bK,bH,bJ){for(var bI=0;bI<bK.length;bI++){bK[bI].endpoints[bH].elementId=bz;bK[bI].endpoints[bH].element=bD;bK[bI][bJ+"Id"]=bz;bK[bI][bJ]=bD}};bE(bC,0,"source");bE(bB,1,"target")};this.setIdChanged=function(bA,bz){br.setId(bA,bz,true)};this.setDebugLog=function(bz){O=bz};var a9=false,bd=null;this.setSuspendDrawing=function(bA,bz){a9=bA;if(bA){bd=new Date().getTime()}else{bd=null}if(bz){br.repaintEverything()}};this.isSuspendDrawing=function(){return a9};this.CANVAS="canvas";this.SVG="svg";this.VML="vml";this.setRenderMode=function(bz){Y=jsPlumbAdapter.setRenderMode(bz);return Y};this.getRenderMode=function(){return Y};this.show=function(bz,bA){a7(bz,"block",bA);return br};this.sizeCanvas=function(bB,bz,bD,bA,bC){if(bB){bB.style.height=bC+"px";bB.height=bC;bB.style.width=bA+"px";bB.width=bA;bB.style.left=bz+"px";bB.style.top=bD+"px"}return br};this.getTestHarness=function(){return{endpointsByElement:aV,endpointCount:function(bz){var bA=aV[bz];return bA?bA.length:0},connectionCount:function(bz){bz=bz||R;var bA=a0[bz];return bA?bA.length:0},getId:H,makeAnchor:self.makeAnchor,makeDynamicAnchor:self.makeDynamicAnchor}};this.toggle=aS;this.toggleVisible=aS;this.toggleDraggable=bm;this.wrap=ap;this.addListener=this.bind;var bs=function(bE,bB){var bC=null,bz=bE;if(bB.tagName.toLowerCase()==="svg"&&bB.parentNode){bC=bB.parentNode}else{if(bB.offsetParent){bC=bB.offsetParent}}if(bC!=null){var bA=bC.tagName.toLowerCase()==="body"?{left:0,top:0}:s(bC,br),bD=bC.tagName.toLowerCase()==="body"?{left:0,top:0}:{left:bC.scrollLeft,top:bC.scrollTop};bz[0]=bE[0]-bA.left+bD.left;bz[1]=bE[1]-bA.top+bD.top}return bz};var ab=function(bD){var bB=this;this.x=bD.x||0;this.y=bD.y||0;this.elementId=bD.elementId;var bA=bD.orientation||[0,0];var bC=null,bz=null;this.offsets=bD.offsets||[0,0];bB.timestamp=null;this.compute=function(bI){var bH=bI.xy,bE=bI.wh,bF=bI.element,bG=bI.timestamp;if(bG&&bG===bB.timestamp){return bz}bz=[bH[0]+(bB.x*bE[0])+bB.offsets[0],bH[1]+(bB.y*bE[1])+bB.offsets[1]];bz=bs(bz,bF.canvas);bB.timestamp=bG;return bz};this.getOrientation=function(bE){return bA};this.equals=function(bE){if(!bE){return false}var bF=bE.getOrientation();var bG=this.getOrientation();return this.x==bE.x&&this.y==bE.y&&this.offsets[0]==bE.offsets[0]&&this.offsets[1]==bE.offsets[1]&&bG[0]==bF[0]&&bG[1]==bF[1]};this.getCurrentLocation=function(){return bz}};var a3=function(bF){var bD=bF.reference,bE=bF.referenceCanvas,bB=a(C(bE)),bA=0,bG=0,bz=null,bC=null;this.x=0;this.y=0;this.isFloating=true;this.compute=function(bK){var bJ=bK.xy,bI=bK.element,bH=[bJ[0]+(bB[0]/2),bJ[1]+(bB[1]/2)];bH=bs(bH,bI.canvas);bC=bH;return bH};this.getOrientation=function(bI){if(bz){return bz}else{var bH=bD.getOrientation(bI);return[Math.abs(bH[0])*bA*-1,Math.abs(bH[1])*bG*-1]}};this.over=function(bH){bz=bH.getOrientation()};this.out=function(){bz=null};this.getCurrentLocation=function(){return bC}};var au=function(bB,bA,bG){this.isSelective=true;this.isDynamic=true;var bJ=[],bI=this,bH=function(bK){return bK.constructor==ab?bK:br.makeAnchor(bK,bG,br)};for(var bF=0;bF<bB.length;bF++){bJ[bF]=bH(bB[bF])}this.addAnchor=function(bK){bJ.push(bH(bK))};this.getAnchors=function(){return bJ};this.locked=false;var bC=bJ.length>0?bJ[0]:null,bE=bJ.length>0?0:-1,bI=this,bD=function(bM,bK,bQ,bP,bL){var bO=bP[0]+(bM.x*bL[0]),bN=bP[1]+(bM.y*bL[1]);return Math.sqrt(Math.pow(bK-bO,2)+Math.pow(bQ-bN,2))},bz=bA||function(bU,bL,bM,bN,bK){var bP=bM[0]+(bN[0]/2),bO=bM[1]+(bN[1]/2);var bR=-1,bT=Infinity;for(var bQ=0;bQ<bK.length;bQ++){var bS=bD(bK[bQ],bP,bO,bU,bL);if(bS<bT){bR=bQ+0;bT=bS}}return bK[bR]};this.compute=function(bO){var bN=bO.xy,bK=bO.wh,bM=bO.timestamp,bL=bO.txy,bP=bO.twh;if(bI.locked||bL==null||bP==null){return bC.compute(bO)}else{bO.timestamp=null}bC=bz(bN,bK,bL,bP,bJ);bI.x=bC.x;bI.y=bC.y;return bC.compute(bO)};this.getCurrentLocation=function(){return bC!=null?bC.getCurrentLocation():null};this.getOrientation=function(bK){return bC!=null?bC.getOrientation(bK):[0,0]};this.over=function(bK){if(bC!=null){bC.over(bK)}};this.out=function(){if(bC!=null){bC.out()}}};var bn={},ak={},aM={},U={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"},bp=function(bI,bJ,bF,bC){if(bI===bJ){return{orientation:U.IDENTITY,a:["top","top"]}}var bA=Math.atan2((bC.centery-bF.centery),(bC.centerx-bF.centerx)),bD=Math.atan2((bF.centery-bC.centery),(bF.centerx-bC.centerx)),bE=((bF.left<=bC.left&&bF.right>=bC.left)||(bF.left<=bC.right&&bF.right>=bC.right)||(bF.left<=bC.left&&bF.right>=bC.right)||(bC.left<=bF.left&&bC.right>=bF.right)),bK=((bF.top<=bC.top&&bF.bottom>=bC.top)||(bF.top<=bC.bottom&&bF.bottom>=bC.bottom)||(bF.top<=bC.top&&bF.bottom>=bC.bottom)||(bC.top<=bF.top&&bC.bottom>=bF.bottom));if(!(bE||bK)){var bH=null,bB=false,bz=false,bG=null;if(bC.left>bF.left&&bC.top>bF.top){bH=["right","top"]}else{if(bC.left>bF.left&&bF.top>bC.top){bH=["top","left"]}else{if(bC.left<bF.left&&bC.top<bF.top){bH=["top","right"]}else{if(bC.left<bF.left&&bC.top>bF.top){bH=["left","top"]}}}}return{orientation:U.DIAGONAL,a:bH,theta:bA,theta2:bD}}else{if(bE){return{orientation:U.HORIZONTAL,a:bF.top<bC.top?["bottom","top"]:["top","bottom"],theta:bA,theta2:bD}}else{return{orientation:U.VERTICAL,a:bF.left<bC.left?["right","left"]:["left","right"],theta:bA,theta2:bD}}}},a5=function(bN,bJ,bH,bI,bO,bK,bB){var bP=[],bA=bJ[bO?0:1]/(bI.length+1);for(var bL=0;bL<bI.length;bL++){var bQ=(bL+1)*bA,bz=bK*bJ[bO?1:0];if(bB){bQ=bJ[bO?0:1]-bQ}var bG=(bO?bQ:bz),bD=bH[0]+bG,bF=bG/bJ[0],bE=(bO?bz:bQ),bC=bH[1]+bE,bM=bE/bJ[1];bP.push([bD,bC,bF,bM,bI[bL][1],bI[bL][2]])}return bP},bb=function(bA,bz){return bA[0]>bz[0]?1:-1},aa=function(bz){return function(bB,bA){var bC=true;if(bz){if(bB[0][0]<bA[0][0]){bC=true}else{bC=bB[0][1]>bA[0][1]}}else{if(bB[0][0]>bA[0][0]){bC=true}else{bC=bB[0][1]>bA[0][1]}}return bC===false?-1:1}},M=function(bA,bz){var bC=bA[0][0]<0?-Math.PI-bA[0][0]:Math.PI-bA[0][0],bB=bz[0][0]<0?-Math.PI-bz[0][0]:Math.PI-bz[0][0];if(bC>bB){return 1}else{return bA[0][1]>bz[0][1]?1:-1}},a2={top:bb,right:aa(true),bottom:aa(true),left:M},ar=function(bz,bA){return bz.sort(bA)},ao=function(bA,bz){var bC=ag[bA],bD=aj[bA],bB=function(bK,bR,bG,bJ,bP,bO,bF){if(bJ.length>0){var bN=ar(bJ,a2[bK]),bL=bK==="right"||bK==="top",bE=a5(bK,bR,bG,bN,bP,bO,bL);var bS=function(bV,bU){var bT=bs([bU[0],bU[1]],bV.canvas);ak[bV.id]=[bT[0],bT[1],bU[2],bU[3]];aM[bV.id]=bF};for(var bH=0;bH<bE.length;bH++){var bM=bE[bH][4],bQ=bM.endpoints[0].elementId===bA,bI=bM.endpoints[1].elementId===bA;if(bQ){bS(bM.endpoints[0],bE[bH])}else{if(bI){bS(bM.endpoints[1],bE[bH])}}}}};bB("bottom",bC,[bD.left,bD.top],bz.bottom,true,1,[0,1]);bB("top",bC,[bD.left,bD.top],bz.top,true,0,[0,-1]);bB("left",bC,[bD.left,bD.top],bz.left,false,0,[-1,0]);bB("right",bC,[bD.left,bD.top],bz.right,false,1,[1,0])},aG=function(){var bz={},bD={},bA=this,bC={};this.reset=function(){bz={};bD={};bC={}};this.newConnection=function(bH){var bJ=bH.sourceId,bG=bH.targetId,bE=bH.endpoints,bI=true,bF=function(bK,bL,bN,bM,bO){if((bJ==bG)&&bN.isContinuous){n.CurrentLibrary.removeElement(bE[1].canvas);bI=false}W(bD,bM,[bO,bL,bN.constructor==au])};bF(0,bE[0],bE[0].anchor,bG,bH);if(bI){bF(1,bE[1],bE[1].anchor,bJ,bH)}};this.connectionDetached=function(bE){var bF=bE.connection||bE;var bK=bF.sourceId,bL=bF.targetId,bO=bF.endpoints,bJ=function(bP,bQ,bS,bR,bT){if(bS.constructor==a3){}else{A(bD[bR],function(bU){return bU[0].id==bT.id})}};bJ(1,bO[1],bO[1].anchor,bK,bF);bJ(0,bO[0],bO[0].anchor,bL,bF);var bG=bF.sourceId,bH=bF.targetId,bN=bF.endpoints[0].id,bI=bF.endpoints[1].id,bM=function(bR,bP){if(bR){var bQ=function(bS){return bS[4]==bP};A(bR.top,bQ);A(bR.left,bQ);A(bR.bottom,bQ);A(bR.right,bQ)}};bM(bC[bG],bN);bM(bC[bH],bI);bA.redraw(bG);bA.redraw(bH)};this.add=function(bF,bE){W(bz,bE,bF)};this.changeId=function(bF,bE){bD[bE]=bD[bF];bz[bE]=bz[bF];delete bD[bF];delete bz[bF]};this.getConnectionsFor=function(bE){return bD[bE]||[]};this.getEndpointsFor=function(bE){return bz[bE]||[]};this.deleteEndpoint=function(bE){A(bz[bE.elementId],function(bF){return bF.id==bE.id})};this.clearFor=function(bE){delete bz[bE];bz[bE]=[]};var bB=function(bY,bL,bT,bI,bO,bP,bR,bN,b0,bQ,bH,bX){var bV=-1,bG=-1,bJ=bI.endpoints[bR],bS=bJ.id,bM=[1,0][bR],bE=[[bL,bT],bI,bO,bP,bS],bF=bY[b0],bZ=bJ._continuousAnchorEdge?bY[bJ._continuousAnchorEdge]:null;if(bZ){var bW=g(bZ,function(b1){return b1[4]==bS});if(bW!=-1){bZ.splice(bW,1);for(var bU=0;bU<bZ.length;bU++){r(bH,bZ[bU][1],function(b1){return b1.id==bZ[bU][1].id});r(bX,bZ[bU][1].endpoints[bR],function(b1){return b1.id==bZ[bU][1].endpoints[bR].id})}}}for(var bU=0;bU<bF.length;bU++){if(bR==1&&bF[bU][3]===bP&&bG==-1){bG=bU}r(bH,bF[bU][1],function(b1){return b1.id==bF[bU][1].id});r(bX,bF[bU][1].endpoints[bR],function(b1){return b1.id==bF[bU][1].endpoints[bR].id})}if(bV!=-1){bF[bV]=bE}else{var bK=bN?bG!=-1?bG:0:bF.length;bF.splice(bK,0,bE)}bJ._continuousAnchorEdge=b0};this.redraw=function(bT,bV,bG,bJ){if(!a9){var b4=bz[bT]||[],b3=bD[bT]||[],bF=[],b2=[],bH=[];bG=bG||p();bJ=bJ||{left:0,top:0};if(bV){bV={left:bV.left+bJ.left,top:bV.top+bJ.top}}X({elId:bT,offset:bV,recalc:false,timestamp:bG});var bO=aj[bT],bK=ag[bT],bQ={};for(var b0=0;b0<b3.length;b0++){var bL=b3[b0][0],bN=bL.sourceId,bI=bL.targetId,bM=bL.endpoints[0].anchor.isContinuous,bS=bL.endpoints[1].anchor.isContinuous;if(bM||bS){var b1=bN+"_"+bI,bY=bI+"_"+bN,bX=bQ[b1],bR=bL.sourceId==bT?1:0;if(bM&&!bC[bN]){bC[bN]={top:[],right:[],bottom:[],left:[]}}if(bS&&!bC[bI]){bC[bI]={top:[],right:[],bottom:[],left:[]}}if(bT!=bI){X({elId:bI,timestamp:bG})}if(bT!=bN){X({elId:bN,timestamp:bG})}var bP=aQ(bI),bE=aQ(bN);if(bI==bN&&(bM||bS)){bB(bC[bN],-Math.PI/2,0,bL,false,bI,0,false,"top",bN,bF,b2)}else{if(!bX){bX=bp(bN,bI,bE.o,bP.o);bQ[b1]=bX}if(bM){bB(bC[bN],bX.theta,0,bL,false,bI,0,false,bX.a[0],bN,bF,b2)}if(bS){bB(bC[bI],bX.theta2,-1,bL,true,bN,1,true,bX.a[1],bI,bF,b2)}}if(bM){r(bH,bN,function(b5){return b5===bN})}if(bS){r(bH,bI,function(b5){return b5===bI})}r(bF,bL,function(b5){return b5.id==bL.id});if((bM&&bR==0)||(bS&&bR==1)){r(b2,bL.endpoints[bR],function(b5){return b5.id==bL.endpoints[bR].id})}}}for(var b0=0;b0<b4.length;b0++){if(b4[b0].connections.length==0&&b4[b0].anchor.isContinuous){if(!bC[bT]){bC[bT]={top:[],right:[],bottom:[],left:[]}}bB(bC[bT],-Math.PI/2,0,{endpoints:[b4[b0],b4[b0]],paint:function(){}},false,bT,0,false,"top",bT,bF,b2);r(bH,bT,function(b5){return b5===bT})}}for(var b0=0;b0<bH.length;b0++){ao(bH[b0],bC[bH[b0]])}for(var b0=0;b0<b4.length;b0++){b4[b0].paint({timestamp:bG,offset:bO,dimensions:bK})}for(var b0=0;b0<b2.length;b0++){b2[b0].paint({timestamp:bG,offset:bO,dimensions:bK})}for(var b0=0;b0<b3.length;b0++){var bU=b3[b0][1];if(bU.anchor.constructor==au){bU.paint({elementWithPrecedence:bT});r(bF,b3[b0][0],function(b5){return b5.id==b3[b0][0].id});for(var bZ=0;bZ<bU.connections.length;bZ++){if(bU.connections[bZ]!==b3[b0][0]){r(bF,bU.connections[bZ],function(b5){return b5.id==bU.connections[bZ].id})}}}else{if(bU.anchor.constructor==ab){r(bF,b3[b0][0],function(b5){return b5.id==b3[b0][0].id})}}}var bW=bk[bT];if(bW){bW.paint({timestamp:bG,recalc:false,elId:bT})}for(var b0=0;b0<bF.length;b0++){bF[b0].paint({elId:bT,timestamp:bG,recalc:false})}}};this.rehomeEndpoint=function(bE,bI){var bF=bz[bE]||[],bG=br.getId(bI);if(bG!==bE){for(var bH=0;bH<bF.length;bH++){bA.add(bF[bH],bG)}bF.splice(0,bF.length)}}};br.anchorManager=new aG();br.continuousAnchorFactory={get:function(bA){var bz=bn[bA.elementId];if(!bz){bz={type:"Continuous",compute:function(bB){return ak[bB.element.id]||[0,0]},getCurrentLocation:function(bB){return ak[bB.id]||[0,0]},getOrientation:function(bB){return aM[bB.id]||[0,0]},isDynamic:true,isContinuous:true};bn[bA.elementId]=bz}return bz}};if(!jsPlumbAdapter.headless){br.dragManager=jsPlumbAdapter.getDragManager(br)}var az=function(bU){var bK=this,bB=true,bP,bQ;bK.idPrefix="_jsplumb_c_";bK.defaultLabelLocation=0.5;bK.defaultOverlayKeys=["Overlays","ConnectionOverlays"];this.parent=bU.parent;x.apply(this,arguments);this.isVisible=function(){return bB};this.setVisible=function(bW){bB=bW;bK[bW?"showOverlays":"hideOverlays"]();if(bK.connector&&bK.connector.canvas){bK.connector.canvas.style.display=bW?"block":"none"}bK.repaint()};this.getTypeDescriptor=function(){return"connection"};this.getDefaultType=function(){return{parameters:{},scope:null,detachable:bK._jsPlumb.Defaults.ConnectionsDetachable,rettach:bK._jsPlumb.Defaults.ReattachConnections,paintStyle:bK._jsPlumb.Defaults.PaintStyle||n.Defaults.PaintStyle,connector:bK._jsPlumb.Defaults.Connector||n.Defaults.Connector,hoverPaintStyle:bK._jsPlumb.Defaults.HoverPaintStyle||n.Defaults.HoverPaintStyle,overlays:bK._jsPlumb.Defaults.ConnectorOverlays||n.Defaults.ConnectorOverlays}};var bS=this.applyType;this.applyType=function(bW){bS(bW);if(bW.detachable!=null){bK.setDetachable(bW.detachable)}if(bW.reattach!=null){bK.setReattach(bW.reattach)}if(bW.scope){bK.scope=bW.scope}bK.setConnector(bW.connector)};bQ=bK.setHover;bK.setHover=function(bX){var bW=br.ConnectorZIndex||n.Defaults.ConnectorZIndex;if(bW){bK.connector.setZIndex(bW+(bX?1:0))}bK.connector.setHover.apply(bK.connector,arguments);bQ.apply(bK,arguments)};bP=function(bW){if(v==null){bK.setHover(bW,false)}};this.setConnector=function(bW,bY){if(bK.connector!=null){aZ(bK.connector.getDisplayElements(),bK.parent)}var bZ={_jsPlumb:bK._jsPlumb,parent:bU.parent,cssClass:bU.cssClass,container:bU.container,tooltip:bK.tooltip};if(z(bW)){this.connector=new n.Connectors[Y][bW](bZ)}else{if(l(bW)){if(bW.length==1){this.connector=new n.Connectors[Y][bW[0]](bZ)}else{this.connector=new n.Connectors[Y][bW[0]](n.extend(bW[1],bZ))}}}bK.canvas=bK.connector.canvas;D(bK.connector,bK,bP);var bX=br.ConnectorZIndex||n.Defaults.ConnectorZIndex;if(bX){bK.connector.setZIndex(bX)}if(!bY){bK.repaint()}};this.source=C(bU.source);this.target=C(bU.target);if(bU.sourceEndpoint){this.source=bU.sourceEndpoint.endpointWillMoveTo||bU.sourceEndpoint.getElement()}if(bU.targetEndpoint){this.target=bU.targetEndpoint.getElement()}bK.previousConnection=bU.previousConnection;this.sourceId=c(this.source,"id");this.targetId=c(this.target,"id");this.scope=bU.scope;this.endpoints=[];this.endpointStyles=[];var bT=function(bX,bW){return(bX)?br.makeAnchor(bX,bW,br):null},bO=function(bW,b2,bX,bZ,b0,bY,b1){var b3;if(bW){bK.endpoints[b2]=bW;bW.addConnection(bK)}else{if(!bX.endpoints){bX.endpoints=[null,null]}var b8=bX.endpoints[b2]||bX.endpoint||br.Defaults.Endpoints[b2]||n.Defaults.Endpoints[b2]||br.Defaults.Endpoint||n.Defaults.Endpoint;if(!bX.endpointStyles){bX.endpointStyles=[null,null]}if(!bX.endpointHoverStyles){bX.endpointHoverStyles=[null,null]}var b6=bX.endpointStyles[b2]||bX.endpointStyle||br.Defaults.EndpointStyles[b2]||n.Defaults.EndpointStyles[b2]||br.Defaults.EndpointStyle||n.Defaults.EndpointStyle;if(b6.fillStyle==null&&bY!=null){b6.fillStyle=bY.strokeStyle}if(b6.outlineColor==null&&bY!=null){b6.outlineColor=bY.outlineColor}if(b6.outlineWidth==null&&bY!=null){b6.outlineWidth=bY.outlineWidth}var b5=bX.endpointHoverStyles[b2]||bX.endpointHoverStyle||br.Defaults.EndpointHoverStyles[b2]||n.Defaults.EndpointHoverStyles[b2]||br.Defaults.EndpointHoverStyle||n.Defaults.EndpointHoverStyle;if(b1!=null){if(b5==null){b5={}}if(b5.fillStyle==null){b5.fillStyle=b1.strokeStyle}}var b4=bX.anchors?bX.anchors[b2]:bX.anchor?bX.anchor:bT(br.Defaults.Anchors[b2],b0)||bT(n.Defaults.Anchors[b2],b0)||bT(br.Defaults.Anchor,b0)||bT(n.Defaults.Anchor,b0),b7=bX.uuids?bX.uuids[b2]:null;b3=aH({paintStyle:b6,hoverPaintStyle:b5,endpoint:b8,connections:[bK],uuid:b7,anchor:b4,source:bZ,scope:bX.scope,container:bX.container,reattach:bX.reattach||br.Defaults.ReattachConnections,detachable:bX.detachable||br.Defaults.ConnectionsDetachable});bK.endpoints[b2]=b3;if(bX.drawEndpoints===false){b3.setVisible(false,true,true)}}return b3};var bM=bO(bU.sourceEndpoint,0,bU,bK.source,bK.sourceId,bU.paintStyle,bU.hoverPaintStyle);if(bM){W(aV,this.sourceId,bM)}var bL=bO(bU.targetEndpoint,1,bU,bK.target,bK.targetId,bU.paintStyle,bU.hoverPaintStyle);if(bL){W(aV,this.targetId,bL)}if(!this.scope){this.scope=this.endpoints[0].scope}bK.endpointsToDeleteOnDetach=[null,null];if(bU.deleteEndpointsOnDetach){if(bU.sourceIsNew){bK.endpointsToDeleteOnDetach[0]=bK.endpoints[0]}if(bU.targetIsNew){bK.endpointsToDeleteOnDetach[1]=bK.endpoints[1]}}bK.setConnector(this.endpoints[0].connector||this.endpoints[1].connector||bU.connector||br.Defaults.Connector||n.Defaults.Connector,true);this.setPaintStyle(this.endpoints[0].connectorStyle||this.endpoints[1].connectorStyle||bU.paintStyle||br.Defaults.PaintStyle||n.Defaults.PaintStyle,true);this.setHoverPaintStyle(this.endpoints[0].connectorHoverStyle||this.endpoints[1].connectorHoverStyle||bU.hoverPaintStyle||br.Defaults.HoverPaintStyle||n.Defaults.HoverPaintStyle,true);this.paintStyleInUse=this.getPaintStyle();X({elId:this.sourceId,timestamp:bd});X({elId:this.targetId,timestamp:bd});var bD=aj[this.sourceId],bC=ag[this.sourceId],bz=aj[this.targetId],bH=ag[this.targetId],bI=bd||p(),bN=this.endpoints[0].anchor.compute({xy:[bD.left,bD.top],wh:bC,element:this.endpoints[0],elementId:this.endpoints[0].elementId,txy:[bz.left,bz.top],twh:bH,tElement:this.endpoints[1],timestamp:bI});this.endpoints[0].paint({anchorLoc:bN,timestamp:bI});bN=this.endpoints[1].anchor.compute({xy:[bz.left,bz.top],wh:bH,element:this.endpoints[1],elementId:this.endpoints[1].elementId,txy:[bD.left,bD.top],twh:bC,tElement:this.endpoints[0],timestamp:bI});this.endpoints[1].paint({anchorLoc:bN,timestamp:bI});var bA=br.Defaults.ConnectionsDetachable;if(bU.detachable===false){bA=false}if(bK.endpoints[0].connectionsDetachable===false){bA=false}if(bK.endpoints[1].connectionsDetachable===false){bA=false}this.isDetachable=function(){return bA===true};this.setDetachable=function(bW){bA=bW===true};var bG=bU.reattach||bK.endpoints[0].reattachConnections||bK.endpoints[1].reattachConnections||br.Defaults.ReattachConnections;this.isReattach=function(){return bG===true};this.setReattach=function(bW){bG=bW===true};var bF=bU.cost||bK.endpoints[0].getConnectionCost();bK.getCost=function(){return bF};bK.setCost=function(bW){bF=bW};var bE=!(bU.bidirectional===false);if(bU.bidirectional==null){bE=bK.endpoints[0].areConnectionsBidirectional()}bK.isBidirectional=function(){return bE};var bV=n.extend({},this.endpoints[0].getParameters());n.extend(bV,this.endpoints[1].getParameters());n.extend(bV,bK.getParameters());bK.setParameters(bV);this.getAttachedElements=function(){return bK.endpoints};this.moveParent=function(bZ){var bY=n.CurrentLibrary,bX=bY.getParent(bK.connector.canvas);if(bK.connector.bgCanvas){bY.removeElement(bK.connector.bgCanvas,bX);bY.appendElement(bK.connector.bgCanvas,bZ)}bY.removeElement(bK.connector.canvas,bX);bY.appendElement(bK.connector.canvas,bZ);for(var bW=0;bW<bK.overlays.length;bW++){if(bK.overlays[bW].isAppendedAtTopLevel){bY.removeElement(bK.overlays[bW].canvas,bX);bY.appendElement(bK.overlays[bW].canvas,bZ);if(bK.overlays[bW].reattachListeners){bK.overlays[bW].reattachListeners(bK.connector)}}}if(bK.connector.reattachListeners){bK.connector.reattachListeners()}};var bJ=null;this.paint=function(cd){if(bB){cd=cd||{};var b4=cd.elId,b5=cd.ui,b2=cd.recalc,bX=cd.timestamp,b6=false,cc=b6?this.sourceId:this.targetId,b1=b6?this.targetId:this.sourceId,bY=b6?0:1,ce=b6?1:0;if(bX==null||bX!=bJ){var cf=X({elId:b4,offset:b5,recalc:b2,timestamp:bX}),b3=X({elId:cc,timestamp:bX});var b8=this.endpoints[ce],bW=this.endpoints[bY],b0=b8.anchor.getCurrentLocation(b8),cb=bW.anchor.getCurrentLocation(bW);var bZ=0;for(var ca=0;ca<bK.overlays.length;ca++){var b7=bK.overlays[ca];if(b7.isVisible()){bZ=Math.max(bZ,b7.computeMaxSize())}}var b9=this.connector.compute(b0,cb,this.endpoints[ce],this.endpoints[bY],this.endpoints[ce].anchor,this.endpoints[bY].anchor,bK.paintStyleInUse.lineWidth,bZ,cf,b3);bK.connector.paint(b9,bK.paintStyleInUse);for(var ca=0;ca<bK.overlays.length;ca++){var b7=bK.overlays[ca];if(b7.isVisible){bK.overlayPlacements[ca]=b7.draw(bK.connector,bK.paintStyleInUse,b9,bX)}}}bJ=bX}};this.repaint=function(bX){bX=bX||{};var bW=!(bX.recalc===false);this.paint({elId:this.sourceId,recalc:bW,timestamp:bX.timestamp})};var bR=bU.type||bK.endpoints[0].connectionType||bK.endpoints[1].connectionType;if(bR){bK.addType(bR)}};var bh=function(bA){var bz=false;return{drag:function(){if(bz){bz=false;return true}var bB=n.CurrentLibrary.getUIPosition(arguments,br.getZoom()),bC=bA.element;if(bC){n.CurrentLibrary.setOffset(bC,bB);be(C(bC),bB)}},stopDrag:function(){bz=true}}};var av=function(bD,bC,bE,bB,bz){var bA=new a3({reference:bC,referenceCanvas:bB});return aH({paintStyle:bD,endpoint:bE,anchor:bA,source:bz,scope:"__floating"})};var S=function(bB,bz){var bD=document.createElement("div");bD.style.position="absolute";var bA=C(bD);aX(bD,bz);var bC=H(bA);X({elId:bC});bB.id=bC;bB.element=bA};var ah=function(b5){var bS=this;bS.idPrefix="_jsplumb_e_";bS.defaultLabelLocation=[0.5,0.5];bS.defaultOverlayKeys=["Overlays","EndpointOverlays"];this.parent=b5.parent;x.apply(this,arguments);b5=b5||{};this.getTypeDescriptor=function(){return"endpoint"};this.getDefaultType=function(){return{parameters:{},scope:null,maxConnections:bS._jsPlumb.Defaults.MaxConnections,paintStyle:bS._jsPlumb.Defaults.EndpointStyle||n.Defaults.EndpointStyle,endpoint:bS._jsPlumb.Defaults.Endpoint||n.Defaults.Endpoint,hoverPaintStyle:bS._jsPlumb.Defaults.EndpointHoverStyle||n.Defaults.EndpointHoverStyle,overlays:bS._jsPlumb.Defaults.EndpointOverlays||n.Defaults.EndpointOverlays,connectorStyle:b5.connectorStyle,connectorHoverStyle:b5.connectorHoverStyle,connectorClass:b5.connectorClass,connectorHoverClass:b5.connectorHoverClass,connectorOverlays:b5.connectorOverlays,connector:b5.connector,connectorTooltip:b5.connectorTooltip}};var b3=this.applyType;this.applyType=function(b7){b3(b7);if(b7.maxConnections!=null){bY=b7.maxConnections}if(b7.scope){bS.scope=b7.scope}bS.connectorStyle=b7.connectorStyle;bS.connectorHoverStyle=b7.connectorHoverStyle;bS.connectorOverlays=b7.connectorOverlays;bS.connector=b7.connector;bS.connectorTooltip=b7.connectorTooltip;bS.connectionType=b7.connectionType;bS.connectorClass=b7.connectorClass;bS.connectorHoverClass=b7.connectorHoverClass};var bE=true,bC=!(b5.enabled===false);this.isVisible=function(){return bE};this.setVisible=function(b8,cb,b7){bE=b8;if(bS.canvas){bS.canvas.style.display=b8?"block":"none"}bS[b8?"showOverlays":"hideOverlays"]();if(!cb){for(var ca=0;ca<bS.connections.length;ca++){bS.connections[ca].setVisible(b8);if(!b7){var b9=bS===bS.connections[ca].endpoints[0]?1:0;if(bS.connections[ca].endpoints[b9].connections.length==1){bS.connections[ca].endpoints[b9].setVisible(b8,true,true)}}}}};this.isEnabled=function(){return bC};this.setEnabled=function(b7){bC=b7};var bR=b5.source,bL=b5.uuid,b2=null,bG=null;if(bL){aW[bL]=bS}var bJ=c(bR,"id");this.elementId=bJ;this.element=bR;var bB=b5.connectionCost;this.getConnectionCost=function(){return bB};this.setConnectionCost=function(b7){bB=b7};var b1=b5.connectionsBidirectional===false?false:true;this.areConnectionsBidirectional=function(){return b1};this.setConnectionsBidirectional=function(b7){b1=b7};bS.anchor=b5.anchor?br.makeAnchor(b5.anchor,bJ,br):b5.anchors?br.makeAnchor(b5.anchors,bJ,br):br.makeAnchor(br.Defaults.Anchor||"TopCenter",bJ,br);if(!b5._transient){br.anchorManager.add(bS,bJ)}var bP=null,bU=null;this.setEndpoint=function(b7){var b8={_jsPlumb:bS._jsPlumb,parent:b5.parent,container:b5.container,tooltip:b5.tooltip,connectorTooltip:b5.connectorTooltip,endpoint:bS};if(z(b7)){bP=new n.Endpoints[Y][b7](b8)}else{if(l(b7)){b8=n.extend(b7[1],b8);bP=new n.Endpoints[Y][b7[0]](b8)}else{bP=b7.clone()}}var b9=n.extend({},b8);bP.clone=function(){var ca=new Object();bP.constructor.apply(ca,[b9]);return ca};bS.endpoint=bP;bS.type=bS.endpoint.type};this.setEndpoint(b5.endpoint||br.Defaults.Endpoint||n.Defaults.Endpoint||"Dot");bU=bP;var bQ=bS.setHover;bS.setHover=function(){bS.endpoint.setHover.apply(bS.endpoint,arguments);bQ.apply(bS,arguments)};var b6=function(b7){if(bS.connections.length>0){bS.connections[0].setHover(b7,false)}else{bS.setHover(b7)}};D(bS.endpoint,bS,b6);this.setPaintStyle(b5.paintStyle||b5.style||br.Defaults.EndpointStyle||n.Defaults.EndpointStyle,true);this.setHoverPaintStyle(b5.hoverPaintStyle||br.Defaults.EndpointHoverStyle||n.Defaults.EndpointHoverStyle,true);this.paintStyleInUse=this.getPaintStyle();var bN=this.getPaintStyle();this.connectorStyle=b5.connectorStyle;this.connectorHoverStyle=b5.connectorHoverStyle;this.connectorOverlays=b5.connectorOverlays;this.connector=b5.connector;this.connectorTooltip=b5.connectorTooltip;this.connectorClass=b5.connectorClass;this.connectorHoverClass=b5.connectorHoverClass;this.isSource=b5.isSource||false;this.isTarget=b5.isTarget||false;var bY=b5.maxConnections||br.Defaults.MaxConnections;this.getAttachedElements=function(){return bS.connections};this.canvas=this.endpoint.canvas;this.connections=b5.connections||[];this.scope=b5.scope||R;this.connectionType=b5.connectionType;this.timestamp=null;bS.reattachConnections=b5.reattach||br.Defaults.ReattachConnections;bS.connectionsDetachable=br.Defaults.ConnectionsDetachable;if(b5.connectionsDetachable===false||b5.detachable===false){bS.connectionsDetachable=false}var bM=b5.dragAllowedWhenFull||true;if(b5.onMaxConnections){bS.bind("maxConnections",b5.onMaxConnections)}this.computeAnchor=function(b7){return bS.anchor.compute(b7)};this.addConnection=function(b7){bS.connections.push(b7)};this.detach=function(b8,cd,b9,cg,b7){var cf=g(bS.connections,function(ci){return ci.id==b8.id}),ce=false;cg=(cg!==false);if(cf>=0){if(b9||b8._forceDetach||b8.isDetachable()||b8.isDetachAllowed(b8)){var ch=b8.endpoints[0]==bS?b8.endpoints[1]:b8.endpoints[0];if(b9||b8._forceDetach||(bS.isDetachAllowed(b8))){bS.connections.splice(cf,1);if(!cd){ch.detach(b8,true,b9);if(b8.endpointsToDeleteOnDetach){for(var cc=0;cc<b8.endpointsToDeleteOnDetach.length;cc++){var ca=b8.endpointsToDeleteOnDetach[cc];if(ca&&ca.connections.length==0){br.deleteEndpoint(ca)}}}}aZ(b8.connector.getDisplayElements(),b8.parent);A(a0[b8.scope],function(ci){return ci.id==b8.id});ce=true;var cb=(!cd&&cg);ba(b8,cb,b7)}}}return ce};this.detachAll=function(b8,b7){while(bS.connections.length>0){bS.detach(bS.connections[0],false,true,b8,b7)}};this.detachFrom=function(ca,b9,b7){var cb=[];for(var b8=0;b8<bS.connections.length;b8++){if(bS.connections[b8].endpoints[1]==ca||bS.connections[b8].endpoints[0]==ca){cb.push(bS.connections[b8])}}for(var b8=0;b8<cb.length;b8++){if(bS.detach(cb[b8],false,true,b9,b7)){cb[b8].setHover(false,false)}}};this.detachFromConnection=function(b8){var b7=g(bS.connections,function(b9){return b9.id==b8.id});if(b7>=0){bS.connections.splice(b7,1)}};this.getElement=function(){return bR};this.setElement=function(ca,b7){var cc=H(ca);A(aV[bS.elementId],function(cd){return cd.id==bS.id});bR=C(ca);bJ=H(bR);bS.elementId=bJ;var cb=ay({source:cc,container:b7}),b9=bD.getParent(bS.canvas);bD.removeElement(bS.canvas,b9);bD.appendElement(bS.canvas,cb);for(var b8=0;b8<bS.connections.length;b8++){bS.connections[b8].moveParent(cb);bS.connections[b8].sourceId=bJ;bS.connections[b8].source=bR}W(aV,cc,bS)};this.getUuid=function(){return bL};this.makeInPlaceCopy=function(){var b9=bS.anchor.getCurrentLocation(bS),b8=bS.anchor.getOrientation(bS),b7={compute:function(){return[b9[0],b9[1]]},getCurrentLocation:function(){return[b9[0],b9[1]]},getOrientation:function(){return b8}};return aH({anchor:b7,source:bR,paintStyle:this.getPaintStyle(),endpoint:bP,_transient:true,scope:bS.scope})};this.isConnectedTo=function(b9){var b8=false;if(b9){for(var b7=0;b7<bS.connections.length;b7++){if(bS.connections[b7].endpoints[1]==b9){b8=true;break}}}return b8};this.isFloating=function(){return b2!=null};this.connectorSelector=function(){var b7=bS.connections[0];if(bS.isTarget&&b7){return b7}else{return(bS.connections.length<bY)||bY==-1?null:b7}};this.isFull=function(){return !(bS.isFloating()||bY<1||bS.connections.length<bY)};this.setDragAllowedWhenFull=function(b7){bM=b7};this.setStyle=bS.setPaintStyle;this.equals=function(b7){return this.anchor.equals(b7.anchor)};var bO=function(b8){var b7=0;if(b8!=null){for(var b9=0;b9<bS.connections.length;b9++){if(bS.connections[b9].sourceId==b8||bS.connections[b9].targetId==b8){b7=b9;break}}}return bS.connections[b7]};this.paint=function(ca){ca=ca||{};var cg=ca.timestamp,cf=!(ca.recalc===false);if(!cg||bS.timestamp!==cg){X({elId:bJ,timestamp:cg,recalc:cf});var cm=ca.offset||aj[bJ];if(cm){var cd=ca.anchorPoint,cb=ca.connectorPaintStyle;if(cd==null){var b7=ca.dimensions||ag[bJ];if(cm==null||b7==null){X({elId:bJ,timestamp:cg});cm=aj[bJ];b7=ag[bJ]}var b9={xy:[cm.left,cm.top],wh:b7,element:bS,timestamp:cg};if(cf&&bS.anchor.isDynamic&&bS.connections.length>0){var cj=bO(ca.elementWithPrecedence),cl=cj.endpoints[0]==bS?1:0,cc=cl==0?cj.sourceId:cj.targetId,ci=aj[cc],ck=ag[cc];b9.txy=[ci.left,ci.top];b9.twh=ck;b9.tElement=cj.endpoints[cl]}cd=bS.anchor.compute(b9)}var ch=bP.compute(cd,bS.anchor.getOrientation(bS),bS.paintStyleInUse,cb||bS.paintStyleInUse);bP.paint(ch,bS.paintStyleInUse,bS.anchor);bS.timestamp=cg;for(var ce=0;ce<bS.overlays.length;ce++){var b8=bS.overlays[ce];if(b8.isVisible){bS.overlayPlacements[ce]=b8.draw(bS.endpoint,bS.paintStyleInUse,ch)}}}}};this.repaint=this.paint;this.removeConnection=this.detach;if(n.CurrentLibrary.isDragSupported(bR)){var bX={id:null,element:null},bW=null,bA=false,bF=null,bz=bh(bX);var bH=function(){bW=bS.connectorSelector();var b7=true;if(!bS.isEnabled()){b7=false}if(bW==null&&!b5.isSource){b7=false}if(b5.isSource&&bS.isFull()&&!bM){b7=false}if(bW!=null&&!bW.isDetachable()){b7=false}if(b7===false){if(n.CurrentLibrary.stopDrag){n.CurrentLibrary.stopDrag()}bz.stopDrag();return false}if(bW&&!bS.isFull()&&b5.isSource){bW=null}X({elId:bJ});bG=bS.makeInPlaceCopy();bG.referenceEndpoint=bS;bG.paint();S(bX,bS.parent);var cd=C(bG.canvas),cb=s(cd,br),b8=bs([cb.left,cb.top],bG.canvas);n.CurrentLibrary.setOffset(bX.element,{left:b8[0],top:b8[1]});if(bS.parentAnchor){bS.anchor=br.makeAnchor(bS.parentAnchor,bS.elementId,br)}d(C(bS.canvas),"dragId",bX.id);d(C(bS.canvas),"elId",bJ);if(b5.proxy){bS.setPaintStyle(b5.proxy.paintStyle)}b2=av(bS.getPaintStyle(),bS.anchor,bP,bS.canvas,bX.element);if(bW==null){bS.anchor.locked=true;bS.setHover(false,false);bW=af({sourceEndpoint:bS,targetEndpoint:b2,source:bS.endpointWillMoveTo||C(bR),target:bX.element,anchors:[bS.anchor,b2.anchor],paintStyle:b5.connectorStyle,hoverPaintStyle:b5.connectorHoverStyle,connector:b5.connector,overlays:b5.connectorOverlays,type:bS.connectionType,cssClass:bS.connectorClass,hoverClass:bS.connectorHoverClass})}else{bA=true;bW.connector.setHover(false,false);bI(C(bG.canvas),false,true);var ca=bW.endpoints[0].id==bS.id?0:1;bW.floatingAnchorIndex=ca;bS.detachFromConnection(bW);var ce=C(bS.canvas),cc=n.CurrentLibrary.getDragScope(ce);d(ce,"originalScope",cc);var b9=n.CurrentLibrary.getDropScope(ce);n.CurrentLibrary.setDragScope(ce,b9);if(ca==0){bF=[bW.source,bW.sourceId,b0,cc];bW.source=bX.element;bW.sourceId=bX.id}else{bF=[bW.target,bW.targetId,b0,cc];bW.target=bX.element;bW.targetId=bX.id}bW.endpoints[ca==0?1:0].anchor.locked=true;bW.suspendedEndpoint=bW.endpoints[ca];bW.suspendedEndpoint.setHover(false);b2.referenceEndpoint=bW.suspendedEndpoint;bW.endpoints[ca]=b2;a8(bW)}bk[bX.id]=bW;b2.addConnection(bW);W(aV,bX.id,b2);br.currentlyDragging=true};var bD=n.CurrentLibrary,bZ=b5.dragOptions||{},bT=n.extend({},bD.defaultDragOptions),bV=bD.dragEvents.start,b4=bD.dragEvents.stop,bK=bD.dragEvents.drag;bZ=n.extend(bT,bZ);bZ.scope=bZ.scope||bS.scope;bZ[bV]=ap(bZ[bV],bH);bZ[bK]=ap(bZ[bK],bz.drag);bZ[b4]=ap(bZ[b4],function(){var b8=bD.getDropEvent(arguments);br.currentlyDragging=false;A(aV[bX.id],function(b9){return b9.id==b2.id});aZ([bX.element[0],b2.canvas],bR);aw(bG.canvas,bR);br.anchorManager.clearFor(bX.id);var b7=bW.floatingAnchorIndex==null?1:bW.floatingAnchorIndex;bW.endpoints[b7==0?1:0].anchor.locked=false;bS.setPaintStyle(bN);if(bW.endpoints[b7]==b2){if(bA&&bW.suspendedEndpoint){if(b7==0){bW.source=bF[0];bW.sourceId=bF[1]}else{bW.target=bF[0];bW.targetId=bF[1]}n.CurrentLibrary.setDragScope(bF[2],bF[3]);bW.endpoints[b7]=bW.suspendedEndpoint;if(bW.isReattach()||bW._forceReattach||bW._forceDetach||!bW.endpoints[b7==0?1:0].detach(bW,false,false,true,b8)){bW.setHover(false);bW.floatingAnchorIndex=null;bW.suspendedEndpoint.addConnection(bW);br.repaint(bF[1])}bW._forceDetach=null;bW._forceReattach=null}else{aZ(bW.connector.getDisplayElements(),bS.parent);bS.detachFromConnection(bW)}}bS.anchor.locked=false;bS.paint({recalc:false});bW.setHover(false,false);aT(bW);bW=null;bG=null;delete aV[b2.elementId];b2.anchor=null;b2=null;br.currentlyDragging=false});var b0=C(bS.canvas);n.CurrentLibrary.initDraggable(b0,bZ,true)}var bI=function(b9,ce,cc,cf){if((b5.isTarget||ce)&&n.CurrentLibrary.isDropSupported(bR)){var ca=b5.dropOptions||br.Defaults.DropOptions||n.Defaults.DropOptions;ca=n.extend({},ca);ca.scope=ca.scope||bS.scope;var b8=n.CurrentLibrary.dragEvents.drop,cd=n.CurrentLibrary.dragEvents.over,b7=n.CurrentLibrary.dragEvents.out,cb=function(){var cg=n.CurrentLibrary.getDropEvent(arguments),cu=C(n.CurrentLibrary.getDragObject(arguments)),ch=c(cu,"dragId"),ck=c(cu,"elId"),ct=c(cu,"originalScope"),co=bk[ch];var cl=co.suspendedEndpoint&&(co.suspendedEndpoint.id==bS.id||bS.referenceEndpoint&&co.suspendedEndpoint.id==bS.referenceEndpoint.id);if(cl){co._forceReattach=true;return}if(co!=null){var cq=co.floatingAnchorIndex==null?1:co.floatingAnchorIndex,cr=cq==0?1:0;if(ct){n.CurrentLibrary.setDragScope(cu,ct)}var cs=cf!=null?cf.isEnabled():true;if(bS.isFull()){bS.fire("maxConnections",{endpoint:bS,connection:co,maxConnections:bY},cg)}if(!bS.isFull()&&!(cq==0&&!bS.isSource)&&!(cq==1&&!bS.isTarget)&&cs){var cm=true;if(co.suspendedEndpoint&&co.suspendedEndpoint.id!=bS.id){if(cq==0){co.source=co.suspendedEndpoint.element;co.sourceId=co.suspendedEndpoint.elementId}else{co.target=co.suspendedEndpoint.element;co.targetId=co.suspendedEndpoint.elementId}if(!co.isDetachAllowed(co)||!co.endpoints[cq].isDetachAllowed(co)||!co.suspendedEndpoint.isDetachAllowed(co)||!br.checkCondition("beforeDetach",co)){cm=false}}if(cq==0){co.source=bS.element;co.sourceId=bS.elementId}else{co.target=bS.element;co.targetId=bS.elementId}cm=cm&&bS.isDropAllowed(co.sourceId,co.targetId,co.scope,co,bS);if(cm){co.endpoints[cq].detachFromConnection(co);if(co.suspendedEndpoint){co.suspendedEndpoint.detachFromConnection(co)}co.endpoints[cq]=bS;bS.addConnection(co);var cj=bS.getParameters();for(var cp in cj){co.setParameter(cp,cj[cp])}if(!co.suspendedEndpoint){if(cj.draggable){n.CurrentLibrary.initDraggable(bS.element,bZ,true)}}else{var cn=co.suspendedEndpoint.getElement(),ci=co.suspendedEndpoint.elementId;ba({source:cq==0?cn:co.source,target:cq==1?cn:co.target,sourceId:cq==0?ci:co.sourceId,targetId:cq==1?ci:co.targetId,sourceEndpoint:cq==0?co.suspendedEndpoint:co.endpoints[0],targetEndpoint:cq==1?co.suspendedEndpoint:co.endpoints[1],connection:co},true,cg)}bx(co,null,cg)}else{if(co.suspendedEndpoint){co.endpoints[cq]=co.suspendedEndpoint;co.setHover(false);co._forceDetach=true;if(cq==0){co.source=co.suspendedEndpoint.element;co.sourceId=co.suspendedEndpoint.elementId}else{co.target=co.suspendedEndpoint.element;co.targetId=co.suspendedEndpoint.elementId}co.suspendedEndpoint.addConnection(co);co.endpoints[0].repaint();co.repaint();br.repaint(co.source.elementId);co._forceDetach=false}}co.floatingAnchorIndex=null}br.currentlyDragging=false;delete bk[ch];co.suspendedEndpoint=null}};ca[b8]=ap(ca[b8],cb);ca[cd]=ap(ca[cd],function(){var ch=n.CurrentLibrary.getDragObject(arguments),ck=c(C(ch),"dragId"),cj=bk[ck];if(cj!=null){var cg=cj.floatingAnchorIndex==null?1:cj.floatingAnchorIndex;var ci=(bS.isTarget&&cj.floatingAnchorIndex!=0)||(cj.suspendedEndpoint&&bS.referenceEndpoint&&bS.referenceEndpoint.id==cj.suspendedEndpoint.id);if(ci){cj.endpoints[cg].anchor.over(bS.anchor)}}});ca[b7]=ap(ca[b7],function(){var ch=n.CurrentLibrary.getDragObject(arguments),ck=c(C(ch),"dragId"),cj=bk[ck];if(cj!=null){var cg=cj.floatingAnchorIndex==null?1:cj.floatingAnchorIndex;var ci=(bS.isTarget&&cj.floatingAnchorIndex!=0)||(cj.suspendedEndpoint&&bS.referenceEndpoint&&bS.referenceEndpoint.id==cj.suspendedEndpoint.id);if(ci){cj.endpoints[cg].anchor.out()}}});n.CurrentLibrary.initDroppable(b9,ca,true,cc)}};bI(C(bS.canvas),true,!(b5._transient||bS.anchor.isFloating),bS);if(b5.type){bS.addType(b5.type)}return bS}};var n=new w();if(typeof window!="undefined"){window.jsPlumb=n}n.getInstance=function(I){var H=new w(I);H.init();return H};var q=function(H,M,J,I,L,K){return function(O){O=O||{};var N=O.jsPlumbInstance.makeAnchor([H,M,J,I,0,0],O.elementId,O.jsPlumbInstance);N.type=L;if(K){K(N,O)}return N}};n.Anchors.TopCenter=q(0.5,0,0,-1,"TopCenter");n.Anchors.BottomCenter=q(0.5,1,0,1,"BottomCenter");n.Anchors.LeftMiddle=q(0,0.5,-1,0,"LeftMiddle");n.Anchors.RightMiddle=q(1,0.5,1,0,"RightMiddle");n.Anchors.Center=q(0.5,0.5,0,0,"Center");n.Anchors.TopRight=q(1,0,0,-1,"TopRight");n.Anchors.BottomRight=q(1,1,0,1,"BottomRight");n.Anchors.TopLeft=q(0,0,0,-1,"TopLeft");n.Anchors.BottomLeft=q(0,1,0,1,"BottomLeft");n.Defaults.DynamicAnchors=function(H){return H.jsPlumbInstance.makeAnchors(["TopCenter","RightMiddle","BottomCenter","LeftMiddle"],H.elementId,H.jsPlumbInstance)};n.Anchors.AutoDefault=function(I){var H=I.jsPlumbInstance.makeDynamicAnchor(n.Defaults.DynamicAnchors(I));H.type="AutoDefault";return H};n.Anchors.Assign=q(0,0,0,0,"Assign",function(I,J){var H=J.position||"Fixed";I.positionFinder=H.constructor==String?J.jsPlumbInstance.AnchorPositionFinders[H]:H;I.constructorParams=J});n.Anchors.Continuous=function(H){return H.jsPlumbInstance.continuousAnchorFactory.get(H)};n.AnchorPositionFinders={Fixed:function(K,H,J,I){return[(K.left-H.left)/J[0],(K.top-H.top)/J[1]]},Grid:function(H,Q,L,I){var P=H.left-Q.left,O=H.top-Q.top,N=L[0]/(I.grid[0]),M=L[1]/(I.grid[1]),K=Math.floor(P/N),J=Math.floor(O/M);return[((K*N)+(N/2))/L[0],((J*M)+(M/2))/L[1]]}};n.Anchors.Perimeter=function(H){H=H||{};var I=H.anchorCount||60,L=H.shape;if(!L){throw new Error("no shape supplied to Perimeter Anchor type")}var J=function(){var W=0.5,V=Math.PI*2/I,X=0,T=[];for(var U=0;U<I;U++){var S=W+(W*Math.sin(X)),Y=W+(W*Math.cos(X));T.push([S,Y,0,0]);X+=V}return T},M=function(U){var W=I/U.length,S=[],T=function(aa,ad,Z,ac,ae){W=I*ae;var Y=(Z-aa)/W,X=(ac-ad)/W;for(var ab=0;ab<W;ab++){S.push([aa+(Y*ab),ad+(X*ab),0,0])}};for(var V=0;V<U.length;V++){T.apply(null,U[V])}return S},P=function(S){var U=[];for(var T=0;T<S.length;T++){U.push([S[T][0],S[T][1],S[T][2],S[T][3],1/S.length])}return M(U)},N=function(){return P([[0,0,1,0],[1,0,1,1],[1,1,0,1],[0,1,0,0]])};var K={circle:J,ellipse:J,diamond:function(){return P([[0.5,0,1,0.5],[1,0.5,0.5,1],[0.5,1,0,0.5],[0,0.5,0.5,0]])},rectangle:N,square:N,triangle:function(){return P([[0.5,0,1,1],[1,1,0,1],[0,1,0.5,0]])},path:function(X){var V=X.points;var W=[],T=0;for(var U=0;U<V.length-1;U++){var S=Math.sqrt(Math.pow(V[U][2]-V[U][0])+Math.pow(V[U][3]-V[U][1]));T+=S;W.push([V[U][0],V[U][1],V[U+1][0],V[U+1][1],S])}for(var U=0;U<W.length;U++){W[U][4]=W[U][4]/T}return M(W)}},Q=function(X,W){var Y=[],V=W/180*Math.PI;for(var U=0;U<X.length;U++){var T=X[U][0]-0.5,S=X[U][1]-0.5;Y.push([0.5+((T*Math.cos(V))-(S*Math.sin(V))),0.5+((T*Math.sin(V))+(S*Math.cos(V))),X[U][2],X[U][3]])}return Y};if(!K[L]){throw new Error("Shape ["+L+"] is unknown by Perimeter Anchor type")}var R=K[L](H);if(H.rotation){R=Q(R,H.rotation)}var O=H.jsPlumbInstance.makeDynamicAnchor(R);O.type="Perimeter";return O}})();(function(){jsPlumb.DOMElementComponent=function(d){jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.mousemove=this.dblclick=this.click=this.mousedown=this.mouseup=function(f){}};jsPlumb.Connectors.Straight=function(){this.type="Straight";var s=this,k=null,f,l,q,o,m,g,r,i,h,e,d,p,n;this.compute=function(B,K,t,A,G,u,E,z){var J=Math.abs(B[0]-K[0]),D=Math.abs(B[1]-K[1]),C=0.45*J,v=0.45*D;J*=1.9;D*=1.9;var H=Math.min(B[0],K[0])-C;var F=Math.min(B[1],K[1])-v;var I=Math.max(2*E,z);if(J<I){J=I;H=B[0]+((K[0]-B[0])/2)-(I/2);C=(J-Math.abs(B[0]-K[0]))/2}if(D<I){D=I;F=B[1]+((K[1]-B[1])/2)-(I/2);v=(D-Math.abs(B[1]-K[1]))/2}i=B[0]<K[0]?C:J-C;h=B[1]<K[1]?v:D-v;e=B[0]<K[0]?J-C:C;d=B[1]<K[1]?D-v:v;k=[H,F,J,D,i,h,e,d];o=e-i,m=d-h;f=jsPlumbUtil.gradient({x:i,y:h},{x:e,y:d}),l=-1/f;q=-1*((f*i)-h);g=Math.atan(f);r=Math.atan(l);n=Math.sqrt((o*o)+(m*m));return k};this.pointOnPath=function(u,v){if(u==0&&!v){return{x:i,y:h}}else{if(u==1&&!v){return{x:e,y:d}}else{var t=v?u>0?u:n+u:u*n;return jsPlumbUtil.pointOnLine({x:i,y:h},{x:e,y:d},t)}}};this.gradientAtPoint=function(t){return f};this.pointAlongPathFrom=function(t,x,w){var v=s.pointOnPath(t,w),u=t==1?{x:i+((e-i)*10),y:h+((h-d)*10)}:{x:e,y:d};return jsPlumbUtil.pointOnLine(v,u,x)}};jsPlumb.Connectors.Bezier=function(w){var q=this;w=w||{};this.majorAnchor=w.curviness||150;this.minorAnchor=10;var u=null;this.type="Bezier";this._findControlPoint=function(I,x,D,y,B,G,z){var F=G.getOrientation(y),H=z.getOrientation(B),C=F[0]!=H[0]||F[1]==H[1],A=[],J=q.majorAnchor,E=q.minorAnchor;if(!C){if(F[0]==0){A.push(x[0]<D[0]?I[0]+E:I[0]-E)}else{A.push(I[0]-(J*F[0]))}if(F[1]==0){A.push(x[1]<D[1]?I[1]+E:I[1]-E)}else{A.push(I[1]+(J*H[1]))}}else{if(H[0]==0){A.push(D[0]<x[0]?I[0]+E:I[0]-E)}else{A.push(I[0]+(J*H[0]))}if(H[1]==0){A.push(D[1]<x[1]?I[1]+E:I[1]-E)}else{A.push(I[1]+(J*F[1]))}}return A};var r,m,g,p,o,g,f,t,s,v,e,i,h,l,k;this.compute=function(T,A,N,B,R,y,x,M){x=x||0;v=Math.abs(T[0]-A[0])+x;e=Math.abs(T[1]-A[1])+x;t=Math.min(T[0],A[0])-(x/2);s=Math.min(T[1],A[1])-(x/2);g=T[0]<A[0]?v-(x/2):(x/2);f=T[1]<A[1]?e-(x/2):(x/2);p=T[0]<A[0]?(x/2):v-(x/2);o=T[1]<A[1]?(x/2):e-(x/2);r=q._findControlPoint([g,f],T,A,N,B,R,y);m=q._findControlPoint([p,o],A,T,B,N,y,R);var L=Math.min(g,p),K=Math.min(r[0],m[0]),G=Math.min(L,K),S=Math.max(g,p),P=Math.max(r[0],m[0]),D=Math.max(S,P);if(D>v){v=D}if(G<0){t+=G;var I=Math.abs(G);v+=I;r[0]+=I;g+=I;p+=I;m[0]+=I}var Q=Math.min(f,o),O=Math.min(r[1],m[1]),C=Math.min(Q,O),H=Math.max(f,o),F=Math.max(r[1],m[1]),z=Math.max(H,F);if(z>e){e=z}if(C<0){s+=C;var E=Math.abs(C);e+=E;r[1]+=E;f+=E;o+=E;m[1]+=E}if(M&&v<M){var J=(M-v)/2;v=M;t-=J;g=g+J;p=p+J;r[0]=r[0]+J;m[0]=m[0]+J}if(M&&e<M){var J=(M-e)/2;e=M;s-=J;f=f+J;o=o+J;r[1]=r[1]+J;m[1]=m[1]+J}u=[t,s,v,e,g,f,p,o,r[0],r[1],m[0],m[1]];return u};var d=function(){return[{x:g,y:f},{x:r[0],y:r[1]},{x:m[0],y:m[1]},{x:p,y:o}]};var n=function(y,x,z){if(z){x=jsBezier.locationAlongCurveFrom(y,x>0?0:1,x)}return x};this.pointOnPath=function(x,z){var y=d();x=n(y,x,z);return jsBezier.pointOnCurve(y,x)};this.gradientAtPoint=function(x,z){var y=d();x=n(y,x,z);return jsBezier.gradientAtPoint(y,x)};this.pointAlongPathFrom=function(x,A,z){var y=d();x=n(y,x,z);return jsBezier.pointAlongCurveFrom(y,x,A)}};jsPlumb.Connectors.Flowchart=function(z){this.type="Flowchart";z=z||{};var r=this,e=z.stub||z.minStubLength||30,i=jsPlumbUtil.isArray(e)?e[0]:e,o=jsPlumbUtil.isArray(e)?e[1]:e,t=z.gap||0,u=[],m=0,g=[],q=[],v=[],s,p,y=-Infinity,w=-Infinity,A=Infinity,x=Infinity,d=z.grid,f=function(G,C){var F=G%C,D=Math.floor(G/C),E=F>(C/2)?1:0;return(D+E)*C},n=function(C,F,E,D){return[E||d==null?C:f(C,d[0]),D||d==null?F:f(F,d[1])]},B=function(D,C,H,G){var F=0;for(var E=0;E<u.length;E++){q[E]=u[E][5]/m;g[E]=[F,(F+=(u[E][5]/m))]}},l=function(){v.push(u.length);for(var C=0;C<u.length;C++){v.push(u[C][0]);v.push(u[C][1])}},k=function(L,I,K,J,H,G){var D=u.length==0?K:u[u.length-1][0],C=u.length==0?J:u[u.length-1][1],E=L==D?Infinity:0;var F=Math.abs(L==D?I-C:L-D);u.push([L,I,D,C,E,F]);m+=F;y=Math.max(y,L);w=Math.max(w,I);A=Math.min(A,L);x=Math.min(x,I)},h=function(E,G){if(G){E=E>0?E/m:(m+E)/m}var C=g.length-1,D=1;for(var F=0;F<g.length;F++){if(g[F][1]>=E){C=F;D=(E-g[F][0])/q[F];break}}return{segment:u[C],proportion:D,index:C}};this.compute=function(Z,an,C,T,ay,N,X,S,at,ap){u=[];g=[];m=0;q=[];y=w=-Infinity;A=x=Infinity;r.lineWidth=X;s=an[0]<Z[0];p=an[1]<Z[1];var ad=X||1,H=(ad/2)+(i+o),E=(ad/2)+(o+i),G=(ad/2)+(i+o),D=(ad/2)+(o+i),Q=ay.orientation||ay.getOrientation(C),az=N.orientation||N.getOrientation(T),am=s?an[0]:Z[0],al=p?an[1]:Z[1],ao=Math.abs(an[0]-Z[0])+H+E,ax=Math.abs(an[1]-Z[1])+G+D;if(Q[0]==0&&Q[1]==0||az[0]==0&&az[1]==0){var af=ao>ax?0:1,ah=[1,0][af];Q=[];az=[];Q[af]=Z[af]>an[af]?-1:1;az[af]=Z[af]>an[af]?1:-1;Q[ah]=0;az[ah]=0}var L=s?(ao-E)+(t*Q[0]):H+(t*Q[0]),K=p?(ax-D)+(t*Q[1]):G+(t*Q[1]),av=s?H+(t*az[0]):(ao-E)+(t*az[0]),au=p?G+(t*az[1]):(ax-D)+(t*az[1]),ac=L+(Q[0]*i),ab=K+(Q[1]*i),O=av+(az[0]*o),M=au+(az[1]*o),Y=Math.abs(L-av)>(i+o),aa=Math.abs(K-au)>(i+o),ak=ac+((O-ac)/2),ai=ab+((M-ab)/2),R=((Q[0]*az[0])+(Q[1]*az[1])),ae=R==-1,ag=R==0,F=R==1;am-=H;al-=G;v=[am,al,ao,ax,L,K,av,au];var ar=[];var V=Q[0]==0?"y":"x",P=ae?"opposite":F?"orthogonal":"perpendicular",I=jsPlumbUtil.segment([L,K],[av,au]),aj=Q[V=="x"?0:1]==-1,U={x:[null,4,3,2,1],y:[null,2,1,4,3]};if(aj){I=U[V][I]}k(ac,ab,L,K,av,au);var W=function(aD,aC,aA,aB){return aD+(aC*((1-aA)*aB)+Math.max(i,o))},J={oppositex:function(){if(C.elementId==T.elementId){var aA=ab+((1-ay.y)*at.height)+Math.max(i,o);return[[ac,aA],[O,aA]]}else{if(Y&&(I==1||I==2)){return[[ak,K],[ak,au]]}else{return[[ac,ai],[O,ai]]}}},orthogonalx:function(){if(I==1||I==2){return[[O,ab]]}else{return[[ac,M]]}},perpendicularx:function(){var aA=(au+K)/2;if((I==1&&az[1]==1)||(I==2&&az[1]==-1)){if(Math.abs(av-L)>Math.max(i,o)){return[[O,ab]]}else{return[[ac,ab],[ac,aA],[O,aA]]}}else{if((I==3&&az[1]==-1)||(I==4&&az[1]==1)){return[[ac,aA],[O,aA]]}else{if((I==3&&az[1]==1)||(I==4&&az[1]==-1)){return[[ac,M]]}else{if((I==1&&az[1]==-1)||(I==2&&az[1]==1)){if(Math.abs(av-L)>Math.max(i,o)){return[[ak,ab],[ak,M]]}else{return[[ac,M]]}}}}}},oppositey:function(){if(C.elementId==T.elementId){var aA=ac+((1-ay.x)*at.width)+Math.max(i,o);return[[aA,ab],[aA,M]]}else{if(aa&&(I==2||I==3)){return[[L,ai],[av,ai]]}else{return[[ak,ab],[ak,M]]}}},orthogonaly:function(){if(I==2||I==3){return[[ac,M]]}else{return[[O,ab]]}},perpendiculary:function(){var aA=(av+L)/2;if((I==2&&az[0]==-1)||(I==3&&az[0]==1)){if(Math.abs(av-L)>Math.max(i,o)){return[[ac,M]]}else{return[[ac,ai],[O,ai]]}}else{if((I==1&&az[0]==-1)||(I==4&&az[0]==1)){var aA=(av+L)/2;return[[aA,ab],[aA,M]]}else{if((I==1&&az[0]==1)||(I==4&&az[0]==-1)){return[[O,ab]]}else{if((I==2&&az[0]==1)||(I==3&&az[0]==-1)){if(Math.abs(au-K)>Math.max(i,o)){return[[ac,ai],[O,ai]]}else{return[[O,ab]]}}}}}}};var aq=J[P+V]();if(aq){for(var aw=0;aw<aq.length;aw++){k(aq[aw][0],aq[aw][1],L,K,av,au)}}k(O,M,L,K,av,au);k(av,au,L,K,av,au);l();B(L,K,av,au);if(w>v[3]){v[3]=w+(X*2)}if(y>v[2]){v[2]=y+(X*2)}return v};this.pointOnPath=function(C,D){return r.pointAlongPathFrom(C,0,D)};this.gradientAtPoint=function(C,D){return u[h(C,D)["index"]][4]};this.pointAlongPathFrom=function(J,C,I){var K=h(J,I),G=K.segment,D=K.proportion,F=u[K.index][5],E=u[K.index][4];var H={x:E==Infinity?G[2]:G[2]>G[0]?G[0]+((1-D)*F)-C:G[2]+(D*F)+C,y:E==0?G[3]:G[3]>G[1]?G[1]+((1-D)*F)-C:G[3]+(D*F)+C,segmentInfo:K};return H}};jsPlumb.Endpoints.Dot=function(e){this.type="Dot";var d=this;e=e||{};this.radius=e.radius||10;this.defaultOffset=0.5*this.radius;this.defaultInnerRadius=this.radius/3;this.compute=function(k,g,m,i){var h=m.radius||d.radius,f=k[0]-h,l=k[1]-h;return[f,l,h*2,h*2,h]}};jsPlumb.Endpoints.Rectangle=function(e){this.type="Rectangle";var d=this;e=e||{};this.width=e.width||20;this.height=e.height||20;this.compute=function(l,h,n,k){var i=n.width||d.width,g=n.height||d.height,f=l[0]-(i/2),m=l[1]-(g/2);return[f,m,i,g]}};var b=function(f){jsPlumb.DOMElementComponent.apply(this,arguments);var d=this;var e=[];this.getDisplayElements=function(){return e};this.appendDisplayElement=function(g){e.push(g)}};jsPlumb.Endpoints.Image=function(i){this.type="Image";b.apply(this,arguments);var n=this,h=false,g=false,f=i.width,e=i.height,l=null,d=i.endpoint;this.img=new Image();n.ready=false;this.img.onload=function(){n.ready=true;f=f||n.img.width;e=e||n.img.height;if(l){l(n)}};d.setImage=function(o,q){var p=o.constructor==String?o:o.src;l=q;n.img.src=o;if(n.canvas!=null){n.canvas.setAttribute("src",o)}};d.setImage(i.src||i.url,i.onload);this.compute=function(q,o,r,p){n.anchorPoint=q;if(n.ready){return[q[0]-f/2,q[1]-e/2,f,e]}else{return[0,0,0,0]}};n.canvas=document.createElement("img"),h=false;n.canvas.style.margin=0;n.canvas.style.padding=0;n.canvas.style.outline=0;n.canvas.style.position="absolute";var k=i.cssClass?" "+i.cssClass:"";n.canvas.className=jsPlumb.endpointClass+k;if(f){n.canvas.setAttribute("width",f)}if(e){n.canvas.setAttribute("height",e)}jsPlumb.appendElement(n.canvas,i.parent);n.attachListeners(n.canvas,n);n.cleanup=function(){g=true};var m=function(r,q,p){if(!g){if(!h){n.canvas.setAttribute("src",n.img.src);n.appendDisplayElement(n.canvas);h=true}var o=n.anchorPoint[0]-(f/2),s=n.anchorPoint[1]-(e/2);jsPlumb.sizeCanvas(n.canvas,o,s,f,e)}};this.paint=function(q,p,o){if(n.ready){m(q,p,o)}else{window.setTimeout(function(){n.paint(q,p,o)},200)}}};jsPlumb.Endpoints.Blank=function(e){var d=this;this.type="Blank";b.apply(this,arguments);this.compute=function(h,f,i,g){return[h[0],h[1],10,0]};d.canvas=document.createElement("div");d.canvas.style.display="block";d.canvas.style.width="1px";d.canvas.style.height="1px";d.canvas.style.background="transparent";d.canvas.style.position="absolute";d.canvas.className=d._jsPlumb.endpointClass;jsPlumb.appendElement(d.canvas,e.parent);this.paint=function(h,g,f){jsPlumb.sizeCanvas(d.canvas,h[0],h[1],h[2],h[3])}};jsPlumb.Endpoints.Triangle=function(d){this.type="Triangle";d=d||{};d.width=d.width||55;d.height=d.height||55;this.width=d.width;this.height=d.height;this.compute=function(k,g,m,i){var h=m.width||self.width,f=m.height||self.height,e=k[0]-(h/2),l=k[1]-(f/2);return[e,l,h,f]}};var c=function(f){var e=true,d=this;this.isAppendedAtTopLevel=true;this.component=f.component;this.loc=f.location==null?0.5:f.location;this.endpointLoc=f.endpointLocation==null?[0.5,0.5]:f.endpointLocation;this.setVisible=function(g){e=g;d.component.repaint()};this.isVisible=function(){return e};this.hide=function(){d.setVisible(false)};this.show=function(){d.setVisible(true)};this.incrementLocation=function(g){d.loc+=g;d.component.repaint()};this.setLocation=function(g){d.loc=g;d.component.repaint()};this.getLocation=function(){return d.loc}};jsPlumb.Overlays.Arrow=function(h){this.type="Arrow";c.apply(this,arguments);this.isAppendedAtTopLevel=false;h=h||{};var e=this;this.length=h.length||20;this.width=h.width||20;this.id=h.id;var g=(h.direction||1)<0?-1:1,f=h.paintStyle||{lineWidth:1},d=h.foldback||0.623;this.computeMaxSize=function(){return e.width*1.5};this.cleanup=function(){};this.draw=function(m,A,v){var p,w,i,q,o;if(m.pointAlongPathFrom){if(jsPlumbUtil.isString(e.loc)||e.loc>1||e.loc<0){var k=parseInt(e.loc);p=m.pointAlongPathFrom(k,g*e.length/2,true),w=m.pointOnPath(k,true),i=jsPlumbUtil.pointOnLine(p,w,e.length)}else{if(e.loc==1){p=m.pointOnPath(e.loc);w=m.pointAlongPathFrom(e.loc,-1);i=jsPlumbUtil.pointOnLine(p,w,e.length)}else{if(e.loc==0){i=m.pointOnPath(e.loc);w=m.pointAlongPathFrom(e.loc,1);p=jsPlumbUtil.pointOnLine(i,w,e.length)}else{p=m.pointAlongPathFrom(e.loc,g*e.length/2),w=m.pointOnPath(e.loc),i=jsPlumbUtil.pointOnLine(p,w,e.length)}}}q=jsPlumbUtil.perpendicularLineTo(p,i,e.width);o=jsPlumbUtil.pointOnLine(p,i,d*e.length);var z=Math.min(p.x,q[0].x,q[1].x),t=Math.max(p.x,q[0].x,q[1].x),y=Math.min(p.y,q[0].y,q[1].y),s=Math.max(p.y,q[0].y,q[1].y);var r={hxy:p,tail:q,cxy:o},u=f.strokeStyle||A.strokeStyle,x=f.fillStyle||A.strokeStyle,n=f.lineWidth||A.lineWidth;e.paint(m,r,n,u,x,v);return[z,t,y,s]}else{return[0,0,0,0]}}};jsPlumb.Overlays.PlainArrow=function(e){e=e||{};var d=jsPlumb.extend(e,{foldback:1});jsPlumb.Overlays.Arrow.call(this,d);this.type="PlainArrow"};jsPlumb.Overlays.Diamond=function(f){f=f||{};var d=f.length||40,e=jsPlumb.extend(f,{length:d/2,foldback:2});jsPlumb.Overlays.Arrow.call(this,e);this.type="Diamond"};var a=function(i){jsPlumb.DOMElementComponent.apply(this,arguments);c.apply(this,arguments);var d=this,e=false;i=i||{};this.id=i.id;var l;var h=function(){l=i.create(i.component);l=jsPlumb.CurrentLibrary.getDOMElement(l);l.style.position="absolute";var m=i._jsPlumb.overlayClass+" "+(d.cssClass?d.cssClass:i.cssClass?i.cssClass:"");l.className=m;jsPlumb.appendElement(l,i.component.parent);i._jsPlumb.getId(l);d.attachListeners(l,d);d.canvas=l};this.getElement=function(){if(l==null){h()}return l};this.getDimensions=function(){return jsPlumb.CurrentLibrary.getSize(jsPlumb.CurrentLibrary.getElementObject(d.getElement()))};var f=null,k=function(m){if(f==null){f=d.getDimensions()}return f};this.clearCachedDimensions=function(){f=null};this.computeMaxSize=function(){var m=k();return Math.max(m[0],m[1])};var g=d.setVisible;d.setVisible=function(m){g(m);l.style.display=m?"block":"none"};this.cleanup=function(){if(l!=null){jsPlumb.CurrentLibrary.removeElement(l)}};this.paint=function(m,o,n){if(!e){d.getElement();m.appendDisplayElement(l);d.attachListeners(l,m);e=true}l.style.left=(n[0]+o.minx)+"px";l.style.top=(n[1]+o.miny)+"px"};this.draw=function(n,o,p){var t=k();if(t!=null&&t.length==2){var q={x:0,y:0};if(n.pointOnPath){var r=d.loc,s=false;if(jsPlumbUtil.isString(d.loc)||d.loc<0||d.loc>1){r=parseInt(d.loc);s=true}q=n.pointOnPath(r,s)}else{var m=d.loc.constructor==Array?d.loc:d.endpointLoc;q={x:m[0]*p[2],y:m[1]*p[3]}}minx=q.x-(t[0]/2),miny=q.y-(t[1]/2);d.paint(n,{minx:minx,miny:miny,td:t,cxy:q},p);return[minx,minx+t[0],miny,miny+t[1]]}else{return[0,0,0,0]}};this.reattachListeners=function(m){if(l){d.reattachListenersForElement(l,d,m)}}};jsPlumb.Overlays.Custom=function(d){this.type="Custom";a.apply(this,arguments)};jsPlumb.Overlays.Label=function(h){var d=this;this.labelStyle=h.labelStyle||jsPlumb.Defaults.LabelStyle;this.cssClass=this.labelStyle!=null?this.labelStyle.cssClass:null;h.create=function(){return document.createElement("div")};jsPlumb.Overlays.Custom.apply(this,arguments);this.type="Label";var f=h.label||"",d=this,g=null;this.setLabel=function(k){f=k;g=null;d.clearCachedDimensions();e();d.component.repaint()};var e=function(){if(typeof f=="function"){var k=f(d);d.getElement().innerHTML=k.replace(/\r\n/g,"<br/>")}else{if(g==null){g=f;d.getElement().innerHTML=g.replace(/\r\n/g,"<br/>")}}};this.getLabel=function(){return f};var i=this.getDimensions;this.getDimensions=function(){e();return i()}}})();(function(){var c=function(e,g,d,f){this.m=(f-g)/(d-e);this.b=-1*((this.m*e)-g);this.rectIntersect=function(q,p,s,o){var n=[];var k=(p-this.b)/this.m;if(k>=q&&k<=(q+s)){n.push([k,(this.m*k)+this.b])}var t=(this.m*(q+s))+this.b;if(t>=p&&t<=(p+o)){n.push([(t-this.b)/this.m,t])}var k=((p+o)-this.b)/this.m;if(k>=q&&k<=(q+s)){n.push([k,(this.m*k)+this.b])}var t=(this.m*q)+this.b;if(t>=p&&t<=(p+o)){n.push([(t-this.b)/this.m,t])}if(n.length==2){var m=(n[0][0]+n[1][0])/2,l=(n[0][1]+n[1][1])/2;n.push([m,l]);var i=m<=q+(s/2)?-1:1,r=l<=p+(o/2)?-1:1;n.push([i,r]);return n}return null}},a=function(e,g,d,f){if(e<=d&&f<=g){return 1}else{if(e<=d&&g<=f){return 2}else{if(d<=e&&f>=g){return 3}}}return 4},b=function(g,f,i,e,h,m,l,d,k){if(d<=k){return[g,f]}if(i==1){if(e[3]<=0&&h[3]>=1){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]>=1&&h[2]<=0){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(-1*m),f+(-1*l)]}}}else{if(i==2){if(e[3]>=1&&h[3]<=0){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]>=1&&h[2]<=0){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(1*m),f+(-1*l)]}}}else{if(i==3){if(e[3]>=1&&h[3]<=0){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]<=0&&h[2]>=1){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(-1*m),f+(-1*l)]}}}else{if(i==4){if(e[3]<=0&&h[3]>=1){return[g+(e[2]<0.5?-1*m:m),f]}else{if(e[2]<=0&&h[2]>=1){return[g,f+(e[3]<0.5?-1*l:l)]}else{return[g+(1*m),f+(-1*l)]}}}}}}};jsPlumb.Connectors.StateMachine=function(l){var u=this,n=null,o,m,g,e,p=[],d=l.curviness||10,k=l.margin||5,q=l.proximityLimit||80,f=l.orientation&&l.orientation=="clockwise",i=l.loopbackRadius||25,h=false,t=l.showLoopback!==false;this.type="StateMachine";l=l||{};this.compute=function(ad,H,W,I,ac,z,v,U){var Q=Math.abs(ad[0]-H[0]),Y=Math.abs(ad[1]-H[1]),S=0.45*Q,ab=0.45*Y;Q*=1.9;Y*=1.9;v=v||1;var O=Math.min(ad[0],H[0])-S,M=Math.min(ad[1],H[1])-ab;if(!t||(W.elementId!=I.elementId)){h=false;o=ad[0]<H[0]?S:Q-S;m=ad[1]<H[1]?ab:Y-ab;g=ad[0]<H[0]?Q-S:S;e=ad[1]<H[1]?Y-ab:ab;if(ad[2]==0){o-=k}if(ad[2]==1){o+=k}if(ad[3]==0){m-=k}if(ad[3]==1){m+=k}if(H[2]==0){g-=k}if(H[2]==1){g+=k}if(H[3]==0){e-=k}if(H[3]==1){e+=k}var N=(o+g)/2,L=(m+e)/2,A=(-1*N)/L,V=Math.atan(A),P=(A==Infinity||A==-Infinity)?0:Math.abs(d/2*Math.sin(V)),R=(A==Infinity||A==-Infinity)?0:Math.abs(d/2*Math.cos(V)),B=a(o,m,g,e),J=Math.sqrt(Math.pow(g-o,2)+Math.pow(e-m,2));p=b(N,L,B,ad,H,d,d,J,q);var G=Math.max(Math.abs(p[0]-o)*3,Math.abs(p[0]-g)*3,Math.abs(g-o),2*v,U),K=Math.max(Math.abs(p[1]-m)*3,Math.abs(p[1]-e)*3,Math.abs(e-m),2*v,U);if(Q<G){var T=G-Q;O-=(T/2);o+=(T/2);g+=(T/2);Q=G;p[0]+=(T/2)}if(Y<K){var aa=K-Y;M-=(aa/2);m+=(aa/2);e+=(aa/2);Y=K;p[1]+=(aa/2)}n=[O,M,Q,Y,o,m,g,e,p[0],p[1]]}else{h=true;var Z=ad[0],X=ad[0],F=ad[1]-k,D=ad[1]-k,E=Z,C=F-i;Q=((2*v)+(4*i)),Y=((2*v)+(4*i));O=E-i-v-i,M=C-i-v-i;n=[O,M,Q,Y,E-O,C-M,i,f,Z-O,F-M,X-O,D-M]}return n};var r=function(){return[{x:g,y:e},{x:p[0],y:p[1]},{x:p[0]+1,y:p[1]+1},{x:o,y:m}]};var s=function(w,v,x){if(x){v=jsBezier.locationAlongCurveFrom(w,v>0?0:1,v)}return v};this.pointOnPath=function(x,B){if(h){if(B){var y=Math.PI*2*i;x=x/y}if(x>0&&x<1){x=1-x}var z=(x*2*Math.PI)+(Math.PI/2),w=n[4]+(n[6]*Math.cos(z)),v=n[5]+(n[6]*Math.sin(z));return{x:w,y:v}}else{var A=r();x=s(A,x,B);return jsBezier.pointOnCurve(A,x)}};this.gradientAtPoint=function(v,y){if(h){if(y){var w=Math.PI*2*i;v=v/w}return Math.atan(v*2*Math.PI)}else{var x=r();v=s(x,v,y);return jsBezier.gradientAtPoint(x,v)}};this.pointAlongPathFrom=function(D,v,C){if(h){if(C){var B=Math.PI*2*i;D=D/B}if(D>0&&D<1){D=1-D}var B=2*Math.PI*n[6],w=v/B*2*Math.PI,z=(D*2*Math.PI)-w+(Math.PI/2),y=n[4]+(n[6]*Math.cos(z)),x=n[5]+(n[6]*Math.sin(z));return{x:y,y:x}}else{var A=r();D=s(A,D,C);return jsBezier.pointAlongCurveFrom(A,D,v)}}};jsPlumb.Connectors.canvas.StateMachine=function(f){f=f||{};var d=this,g=f.drawGuideline||true,e=f.avoidSelector;jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.CanvasConnector.apply(this,arguments);this._paint=function(l){if(l.length==10){d.ctx.beginPath();d.ctx.moveTo(l[4],l[5]);d.ctx.bezierCurveTo(l[8],l[9],l[8],l[9],l[6],l[7]);d.ctx.stroke()}else{d.ctx.save();d.ctx.beginPath();var k=0,i=2*Math.PI,h=l[7];d.ctx.arc(l[4],l[5],l[6],0,i,h);d.ctx.stroke();d.ctx.closePath();d.ctx.restore()}};this.createGradient=function(i,h){return h.createLinearGradient(i[4],i[5],i[6],i[7])}};jsPlumb.Connectors.svg.StateMachine=function(){var d=this;jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.SvgConnector.apply(this,arguments);this.getPath=function(e){if(e.length==10){return"M "+e[4]+" "+e[5]+" C "+e[8]+" "+e[9]+" "+e[8]+" "+e[9]+" "+e[6]+" "+e[7]}else{return"M"+(e[8]+4)+" "+e[9]+" A "+e[6]+" "+e[6]+" 0 1,0 "+(e[8]-4)+" "+e[9]}}};jsPlumb.Connectors.vml.StateMachine=function(){jsPlumb.Connectors.StateMachine.apply(this,arguments);jsPlumb.VmlConnector.apply(this,arguments);var d=jsPlumb.vml.convertValue;this.getPath=function(k){if(k.length==10){return"m"+d(k[4])+","+d(k[5])+" c"+d(k[8])+","+d(k[9])+","+d(k[8])+","+d(k[9])+","+d(k[6])+","+d(k[7])+" e"}else{var h=d(k[8]-k[6]),g=d(k[9]-(2*k[6])),f=h+d(2*k[6]),e=g+d(2*k[6]),l=h+","+g+","+f+","+e;var i="ar "+l+","+d(k[8])+","+d(k[9])+","+d(k[8])+","+d(k[9])+" e";return i}}}})();(function(){var h={"stroke-linejoin":"joinstyle",joinstyle:"joinstyle",endcap:"endcap",miterlimit:"miterlimit"},c=null;if(document.createStyleSheet&&document.namespaces){var m=[".jsplumb_vml","jsplumb\\:textbox","jsplumb\\:oval","jsplumb\\:rect","jsplumb\\:stroke","jsplumb\\:shape","jsplumb\\:group"],g="behavior:url(#default#VML);position:absolute;";c=document.createStyleSheet();for(var r=0;r<m.length;r++){c.addRule(m[r],g)}document.namespaces.add("jsplumb","urn:schemas-microsoft-com:vml")}jsPlumb.vml={};var t=1000,s={},a=function(u,i){var w=jsPlumb.getId(u),v=s[w];if(!v){v=f("group",[0,0,t,t],{"class":i});v.style.backgroundColor="red";s[w]=v;jsPlumb.appendElement(v,u)}return v},e=function(v,w){for(var u in w){v[u]=w[u]}},f=function(u,y,z,w,i,v){z=z||{};var x=document.createElement("jsplumb:"+u);if(v){i.appendElement(x,w)}else{jsPlumb.CurrentLibrary.appendElement(x,w)}x.className=(z["class"]?z["class"]+" ":"")+"jsplumb_vml";k(x,y);e(x,z);return x},k=function(u,i,v){u.style.left=i[0]+"px";u.style.top=i[1]+"px";u.style.width=i[2]+"px";u.style.height=i[3]+"px";u.style.position="absolute";if(v){u.style.zIndex=v}},p=jsPlumb.vml.convertValue=function(i){return Math.floor(i*t)},b=function(w,u,v,i){if("transparent"===u){i.setOpacity(v,"0.0")}else{i.setOpacity(v,"1.0")}},q=function(y,u,B,C){var x={};if(u.strokeStyle){x.stroked="true";var D=jsPlumbUtil.convertStyle(u.strokeStyle,true);x.strokecolor=D;b(x,D,"stroke",B);x.strokeweight=u.lineWidth+"px"}else{x.stroked="false"}if(u.fillStyle){x.filled="true";var v=jsPlumbUtil.convertStyle(u.fillStyle,true);x.fillcolor=v;b(x,v,"fill",B)}else{x.filled="false"}if(u.dashstyle){if(B.strokeNode==null){B.strokeNode=f("stroke",[0,0,0,0],{dashstyle:u.dashstyle},y,C)}else{B.strokeNode.dashstyle=u.dashstyle}}else{if(u["stroke-dasharray"]&&u.lineWidth){var E=u["stroke-dasharray"].indexOf(",")==-1?" ":",",z=u["stroke-dasharray"].split(E),w="";for(var A=0;A<z.length;A++){w+=(Math.floor(z[A]/u.lineWidth)+E)}if(B.strokeNode==null){B.strokeNode=f("stroke",[0,0,0,0],{dashstyle:w},y,C)}else{B.strokeNode.dashstyle=w}}}e(y,x)},n=function(){var i=this;jsPlumb.jsPlumbUIComponent.apply(this,arguments);this.opacityNodes={stroke:null,fill:null};this.initOpacityNodes=function(v){i.opacityNodes.stroke=f("stroke",[0,0,1,1],{opacity:"0.0"},v,i._jsPlumb);i.opacityNodes.fill=f("fill",[0,0,1,1],{opacity:"0.0"},v,i._jsPlumb)};this.setOpacity=function(v,x){var w=i.opacityNodes[v];if(w){w.opacity=""+x}};var u=[];this.getDisplayElements=function(){return u};this.appendDisplayElement=function(w,v){if(!v){i.canvas.parentNode.appendChild(w)}u.push(w)}},d=jsPlumb.VmlConnector=function(v){var i=this;i.strokeNode=null;i.canvas=null;n.apply(this,arguments);var u=i._jsPlumb.connectorClass+(v.cssClass?(" "+v.cssClass):"");this.paint=function(A,x,z){if(x!=null){var E=i.getPath(A),y={path:E};if(x.outlineColor){var C=x.outlineWidth||1,D=x.lineWidth+(2*C),B={strokeStyle:jsPlumbUtil.convertStyle(x.outlineColor),lineWidth:D};for(var w in h){B[w]=x[w]}if(i.bgCanvas==null){y["class"]=u;y.coordsize=(A[2]*t)+","+(A[3]*t);i.bgCanvas=f("shape",A,y,v.parent,i._jsPlumb,true);k(i.bgCanvas,A,i.getZIndex());i.appendDisplayElement(i.bgCanvas,true);i.attachListeners(i.bgCanvas,i);i.initOpacityNodes(i.bgCanvas,["stroke"])}else{y.coordsize=(A[2]*t)+","+(A[3]*t);k(i.bgCanvas,A,i.getZIndex());e(i.bgCanvas,y)}q(i.bgCanvas,B,i)}if(i.canvas==null){y["class"]=u;y.coordsize=(A[2]*t)+","+(A[3]*t);if(i.tooltip){y.label=i.tooltip}i.canvas=f("shape",A,y,v.parent,i._jsPlumb,true);i.appendDisplayElement(i.canvas,true);i.attachListeners(i.canvas,i);i.initOpacityNodes(i.canvas,["stroke"])}else{y.coordsize=(A[2]*t)+","+(A[3]*t);k(i.canvas,A,i.getZIndex());e(i.canvas,y)}q(i.canvas,x,i,i._jsPlumb)}};this.reattachListeners=function(){if(i.canvas){i.reattachListenersForElement(i.canvas,i)}}},l=window.VmlEndpoint=function(y){n.apply(this,arguments);var i=null,v=this,u=null,x=null;v.canvas=document.createElement("div");v.canvas.style.position="absolute";var w=v._jsPlumb.endpointClass+(y.cssClass?(" "+y.cssClass):"");y._jsPlumb.appendElement(v.canvas,y.parent);if(v.tooltip){v.canvas.setAttribute("label",v.tooltip)}this.paint=function(C,A,z){var B={};jsPlumb.sizeCanvas(v.canvas,C[0],C[1],C[2],C[3]);if(i==null){B["class"]=w;i=v.getVml([0,0,C[2],C[3]],B,z,v.canvas,v._jsPlumb);v.attachListeners(i,v);v.appendDisplayElement(i,true);v.appendDisplayElement(v.canvas,true);v.initOpacityNodes(i,["fill"])}else{k(i,[0,0,C[2],C[3]]);e(i,B)}q(i,A,v)};this.reattachListeners=function(){if(i){v.reattachListenersForElement(i,v)}}};jsPlumb.Connectors.vml.Bezier=function(){jsPlumb.Connectors.Bezier.apply(this,arguments);d.apply(this,arguments);this.getPath=function(i){return"m"+p(i[4])+","+p(i[5])+" c"+p(i[8])+","+p(i[9])+","+p(i[10])+","+p(i[11])+","+p(i[6])+","+p(i[7])+" e"}};jsPlumb.Connectors.vml.Straight=function(){jsPlumb.Connectors.Straight.apply(this,arguments);d.apply(this,arguments);this.getPath=function(i){return"m"+p(i[4])+","+p(i[5])+" l"+p(i[6])+","+p(i[7])+" e"}};jsPlumb.Connectors.vml.Flowchart=function(){jsPlumb.Connectors.Flowchart.apply(this,arguments);d.apply(this,arguments);this.getPath=function(v){var w="m "+p(v[4])+","+p(v[5])+" l";for(var u=0;u<v[8];u++){w=w+" "+p(v[9+(u*2)])+","+p(v[10+(u*2)])}w=w+" "+p(v[6])+","+p(v[7])+" e";return w}};jsPlumb.Endpoints.vml.Dot=function(){jsPlumb.Endpoints.Dot.apply(this,arguments);l.apply(this,arguments);this.getVml=function(w,x,u,v,i){return f("oval",w,x,v,i)}};jsPlumb.Endpoints.vml.Rectangle=function(){jsPlumb.Endpoints.Rectangle.apply(this,arguments);l.apply(this,arguments);this.getVml=function(w,x,u,v,i){return f("rect",w,x,v,i)}};jsPlumb.Endpoints.vml.Image=jsPlumb.Endpoints.Image;jsPlumb.Endpoints.vml.Blank=jsPlumb.Endpoints.Blank;jsPlumb.Overlays.vml.Label=jsPlumb.Overlays.Label;jsPlumb.Overlays.vml.Custom=jsPlumb.Overlays.Custom;var o=function(x,v){x.apply(this,v);n.apply(this,v);var u=this,w=null;u.canvas=null;u.isAppendedAtTopLevel=true;var i=function(z,y){return"m "+p(z.hxy.x)+","+p(z.hxy.y)+" l "+p(z.tail[0].x)+","+p(z.tail[0].y)+" "+p(z.cxy.x)+","+p(z.cxy.y)+" "+p(z.tail[1].x)+","+p(z.tail[1].y)+" x e"};this.paint=function(B,G,F,H,L,K){var z={};if(H){z.stroked="true";z.strokecolor=jsPlumbUtil.convertStyle(H,true)}if(F){z.strokeweight=F+"px"}if(L){z.filled="true";z.fillcolor=L}var y=Math.min(G.hxy.x,G.tail[0].x,G.tail[1].x,G.cxy.x),J=Math.min(G.hxy.y,G.tail[0].y,G.tail[1].y,G.cxy.y),C=Math.max(G.hxy.x,G.tail[0].x,G.tail[1].x,G.cxy.x),A=Math.max(G.hxy.y,G.tail[0].y,G.tail[1].y,G.cxy.y),I=Math.abs(C-y),E=Math.abs(A-J),D=[y,J,I,E];z.path=i(G,K);z.coordsize=(K[2]*t)+","+(K[3]*t);D[0]=K[0];D[1]=K[1];D[2]=K[2];D[3]=K[3];if(u.canvas==null){u.canvas=f("shape",D,z,B.canvas.parentNode,B._jsPlumb,true);B.appendDisplayElement(u.canvas,true);u.attachListeners(u.canvas,B);u.attachListeners(u.canvas,u)}else{k(u.canvas,D);e(u.canvas,z)}};this.reattachListeners=function(){if(u.canvas){u.reattachListenersForElement(u.canvas,u)}};this.cleanup=function(){if(u.canvas!=null){jsPlumb.CurrentLibrary.removeElement(u.canvas)}}};jsPlumb.Overlays.vml.Arrow=function(){o.apply(this,[jsPlumb.Overlays.Arrow,arguments])};jsPlumb.Overlays.vml.PlainArrow=function(){o.apply(this,[jsPlumb.Overlays.PlainArrow,arguments])};jsPlumb.Overlays.vml.Diamond=function(){o.apply(this,[jsPlumb.Overlays.Diamond,arguments])}})();(function(){var l={joinstyle:"stroke-linejoin","stroke-linejoin":"stroke-linejoin","stroke-dashoffset":"stroke-dashoffset","stroke-linecap":"stroke-linecap"},w="stroke-dasharray",A="dashstyle",e="linearGradient",b="radialGradient",c="fill",a="stop",z="stroke",q="stroke-width",h="style",m="none",t="jsplumb_gradient_",o="lineWidth",C={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml"},g=function(F,D){for(var E in D){F.setAttribute(E,""+D[E])}},f=function(E,D){var F=document.createElementNS(C.svg,E);D=D||{};D.version="1.1";D.xmlns=C.xhtml;g(F,D);return F},n=function(D){return"position:absolute;left:"+D[0]+"px;top:"+D[1]+"px"},i=function(E){for(var D=0;D<E.childNodes.length;D++){if(E.childNodes[D].tagName==e||E.childNodes[D].tagName==b){E.removeChild(E.childNodes[D])}}},v=function(N,I,F,D,J){var G=t+J._jsPlumb.idstamp();i(N);if(!F.gradient.offset){var L=f(e,{id:G,gradientUnits:"userSpaceOnUse"});N.appendChild(L)}else{var L=f(b,{id:G});N.appendChild(L)}for(var K=0;K<F.gradient.stops.length;K++){var H=K;if(D.length==8){H=D[4]<D[6]?K:F.gradient.stops.length-1-K}else{H=D[4]<D[6]?F.gradient.stops.length-1-K:K}var M=jsPlumbUtil.convertStyle(F.gradient.stops[H][1],true);var O=f(a,{offset:Math.floor(F.gradient.stops[K][0]*100)+"%","stop-color":M});L.appendChild(O)}var E=F.strokeStyle?z:c;I.setAttribute(h,E+":url(#"+G+")")},x=function(K,G,E,D,H){if(E.gradient){v(K,G,E,D,H)}else{i(K);G.setAttribute(h,"")}G.setAttribute(c,E.fillStyle?jsPlumbUtil.convertStyle(E.fillStyle,true):m);G.setAttribute(z,E.strokeStyle?jsPlumbUtil.convertStyle(E.strokeStyle,true):m);if(E.lineWidth){G.setAttribute(q,E.lineWidth)}if(E[A]&&E[o]&&!E[w]){var L=E[A].indexOf(",")==-1?" ":",",I=E[A].split(L),F="";I.forEach(function(M){F+=(Math.floor(M*E.lineWidth)+L)});G.setAttribute(w,F)}else{if(E[w]){G.setAttribute(w,E[w])}}for(var J in l){if(E[J]){G.setAttribute(l[J],E[J])}}},B=function(F){var D=/([0-9].)(p[xt])\s(.*)/;var E=F.match(D);return{size:E[1]+E[2],font:E[3]}},r=function(I,J,E){var K=E.split(" "),H=I.className,G=H.baseVal.split(" ");for(var F=0;F<K.length;F++){if(J){if(G.indexOf(K[F])==-1){G.push(K[F])}}else{var D=G.indexOf(K[F]);if(D!=-1){G.splice(D,1)}}}I.className.baseVal=G.join(" ")},u=function(E,D){r(E,true,D)},k=function(E,D){r(E,false,D)};jsPlumbUtil.svg={addClass:u,removeClass:k,node:f,attr:g,pos:n};var s=function(H){var D=this,G=H.pointerEventsSpec||"all";jsPlumb.jsPlumbUIComponent.apply(this,H.originalArgs);D.canvas=null,D.path=null,D.svg=null;var F=H.cssClass+" "+(H.originalArgs[0].cssClass||""),I={style:"",width:0,height:0,"pointer-events":G,position:"absolute"};if(D.tooltip){I.title=D.tooltip}D.svg=f("svg",I);if(H.useDivWrapper){D.canvas=document.createElement("div");D.canvas.style.position="absolute";jsPlumb.sizeCanvas(D.canvas,0,0,1,1);D.canvas.className=F;if(D.tooltip){D.canvas.setAttribute("title",D.tooltip)}}else{g(D.svg,{"class":F});D.canvas=D.svg}H._jsPlumb.appendElement(D.canvas,H.originalArgs[0]["parent"]);if(H.useDivWrapper){D.canvas.appendChild(D.svg)}var E=[D.canvas];this.getDisplayElements=function(){return E};this.appendDisplayElement=function(J){E.push(J)};this.paint=function(N,L,K){if(L!=null){var J=N[0],O=N[1];if(H.useDivWrapper){jsPlumb.sizeCanvas(D.canvas,N[0],N[1],N[2],N[3]);J=0,O=0}var M=n([J,O,N[2],N[3]]);if(D.getZIndex()){M+=";z-index:"+D.getZIndex()+";"}g(D.svg,{style:M,width:N[2],height:N[3]});D._paint.apply(this,arguments)}}};var d=jsPlumb.SvgConnector=function(E){var D=this;s.apply(this,[{cssClass:E._jsPlumb.connectorClass,originalArgs:arguments,pointerEventsSpec:"none",tooltip:E.tooltip,_jsPlumb:E._jsPlumb}]);this._paint=function(L,H){var K=D.getPath(L),F={d:K},J=null;F["pointer-events"]="all";if(H.outlineColor){var I=H.outlineWidth||1,G=H.lineWidth+(2*I),J=jsPlumb.CurrentLibrary.extend({},H);J.strokeStyle=jsPlumbUtil.convertStyle(H.outlineColor);J.lineWidth=G;if(D.bgPath==null){D.bgPath=f("path",F);D.svg.appendChild(D.bgPath);D.attachListeners(D.bgPath,D)}else{g(D.bgPath,F)}x(D.svg,D.bgPath,J,L,D)}if(D.path==null){D.path=f("path",F);D.svg.appendChild(D.path);D.attachListeners(D.path,D)}else{g(D.path,F)}x(D.svg,D.path,H,L,D)};this.reattachListeners=function(){if(D.bgPath){D.reattachListenersForElement(D.bgPath,D)}if(D.path){D.reattachListenersForElement(D.path,D)}}};jsPlumb.Connectors.svg.Bezier=function(D){jsPlumb.Connectors.Bezier.apply(this,arguments);d.apply(this,arguments);this.getPath=function(F){var E="M "+F[4]+" "+F[5];E+=(" C "+F[8]+" "+F[9]+" "+F[10]+" "+F[11]+" "+F[6]+" "+F[7]);return E}};jsPlumb.Connectors.svg.Straight=function(D){jsPlumb.Connectors.Straight.apply(this,arguments);d.apply(this,arguments);this.getPath=function(E){return"M "+E[4]+" "+E[5]+" L "+E[6]+" "+E[7]}};jsPlumb.Connectors.svg.Flowchart=function(){var D=this;jsPlumb.Connectors.Flowchart.apply(this,arguments);d.apply(this,arguments);this.getPath=function(E){var G="M "+E[4]+","+E[5],J=E[4],I=E[5];for(var M=0;M<E[8];M++){var H=E[9+(M*2)],Q=E[10+(M*2)],F=E[9+((M+1)*2)],P=E[10+((M+1)*2)],R=(H!=J)&&(Q==I),N=(H==J)&&(Q!=I),L=R?H>F?1:-1:0,K=N?Q>P?1:-1:0,O=D.lineWidth/2;G=G+" L "+H+" "+Q;G=G+" L "+(H+(L*O))+" "+(Q+(K*O));J=H;I=Q;G=G+" M "+H+" "+Q}G=G+" L "+E[6]+","+E[7];return G}};var y=window.SvgEndpoint=function(E){var D=this;s.apply(this,[{cssClass:E._jsPlumb.endpointClass,originalArgs:arguments,pointerEventsSpec:"all",useDivWrapper:true,_jsPlumb:E._jsPlumb}]);this._paint=function(H,G){var F=jsPlumb.extend({},G);if(F.outlineColor){F.strokeWidth=F.outlineWidth;F.strokeStyle=jsPlumbUtil.convertStyle(F.outlineColor,true)}if(D.node==null){D.node=D.makeNode(H,F);D.svg.appendChild(D.node);D.attachListeners(D.node,D)}x(D.svg,D.node,F,H,D);n(D.node,H)};this.reattachListeners=function(){if(D.node){D.reattachListenersForElement(D.node,D)}}};jsPlumb.Endpoints.svg.Dot=function(){jsPlumb.Endpoints.Dot.apply(this,arguments);y.apply(this,arguments);this.makeNode=function(E,D){return f("circle",{cx:E[2]/2,cy:E[3]/2,r:E[2]/2})}};jsPlumb.Endpoints.svg.Rectangle=function(){jsPlumb.Endpoints.Rectangle.apply(this,arguments);y.apply(this,arguments);this.makeNode=function(E,D){return f("rect",{width:E[2],height:E[3]})}};jsPlumb.Endpoints.svg.Image=jsPlumb.Endpoints.Image;jsPlumb.Endpoints.svg.Blank=jsPlumb.Endpoints.Blank;jsPlumb.Overlays.svg.Label=jsPlumb.Overlays.Label;jsPlumb.Overlays.svg.Custom=jsPlumb.Overlays.Custom;var p=function(H,F){H.apply(this,F);jsPlumb.jsPlumbUIComponent.apply(this,F);this.isAppendedAtTopLevel=false;var D=this,G=null;this.paint=function(J,M,I,N,K){if(G==null){G=f("path",{"pointer-events":"all"});J.svg.appendChild(G);D.attachListeners(G,J);D.attachListeners(G,D)}var L=F&&(F.length==1)?(F[0].cssClass||""):"";g(G,{d:E(M),"class":L,stroke:N?N:null,fill:K?K:null})};var E=function(I){return"M"+I.hxy.x+","+I.hxy.y+" L"+I.tail[0].x+","+I.tail[0].y+" L"+I.cxy.x+","+I.cxy.y+" L"+I.tail[1].x+","+I.tail[1].y+" L"+I.hxy.x+","+I.hxy.y};this.reattachListeners=function(){if(G){D.reattachListenersForElement(G,D)}};this.cleanup=function(){if(G!=null){jsPlumb.CurrentLibrary.removeElement(G)}}};jsPlumb.Overlays.svg.Arrow=function(){p.apply(this,[jsPlumb.Overlays.Arrow,arguments])};jsPlumb.Overlays.svg.PlainArrow=function(){p.apply(this,[jsPlumb.Overlays.PlainArrow,arguments])};jsPlumb.Overlays.svg.Diamond=function(){p.apply(this,[jsPlumb.Overlays.Diamond,arguments])};jsPlumb.Overlays.svg.GuideLines=function(){var I=null,D=this,H=null,G,F;jsPlumb.Overlays.GuideLines.apply(this,arguments);this.paint=function(K,M,J,N,L){if(I==null){I=f("path");K.svg.appendChild(I);D.attachListeners(I,K);D.attachListeners(I,D);G=f("path");K.svg.appendChild(G);D.attachListeners(G,K);D.attachListeners(G,D);F=f("path");K.svg.appendChild(F);D.attachListeners(F,K);D.attachListeners(F,D)}g(I,{d:E(M[0],M[1]),stroke:"red",fill:null});g(G,{d:E(M[2][0],M[2][1]),stroke:"blue",fill:null});g(F,{d:E(M[3][0],M[3][1]),stroke:"green",fill:null})};var E=function(K,J){return"M "+K.x+","+K.y+" L"+J.x+","+J.y}}})();(function(){var d=null,i=function(p,o){return jsPlumb.CurrentLibrary.hasClass(a(p),o)},a=function(o){return jsPlumb.CurrentLibrary.getElementObject(o)},m=function(o){return jsPlumb.CurrentLibrary.getOffset(a(o))},n=function(o){return jsPlumb.CurrentLibrary.getPageXY(o)},f=function(o){return jsPlumb.CurrentLibrary.getClientXY(o)};var k=function(){var q=this;q.overlayPlacements=[];jsPlumb.jsPlumbUIComponent.apply(this,arguments);jsPlumbUtil.EventGenerator.apply(this,arguments);this._over=function(z){var B=m(a(q.canvas)),D=n(z),u=D[0]-B.left,C=D[1]-B.top;if(u>0&&C>0&&u<q.canvas.width&&C<q.canvas.height){for(var v=0;v<q.overlayPlacements.length;v++){var w=q.overlayPlacements[v];if(w&&(w[0]<=u&&w[1]>=u&&w[2]<=C&&w[3]>=C)){return true}}var A=q.canvas.getContext("2d").getImageData(parseInt(u),parseInt(C),1,1);return A.data[0]!=0||A.data[1]!=0||A.data[2]!=0||A.data[3]!=0}return false};var p=false,o=false,t=null,s=false,r=function(v,u){return v!=null&&i(v,u)};this.mousemove=function(x){var z=n(x),w=f(x),v=document.elementFromPoint(w[0],w[1]),y=r(v,"_jsPlumb_overlay");var u=d==null&&(r(v,"_jsPlumb_endpoint")||r(v,"_jsPlumb_connector"));if(!p&&u&&q._over(x)){p=true;q.fire("mouseenter",q,x);return true}else{if(p&&(!q._over(x)||!u)&&!y){p=false;q.fire("mouseexit",q,x)}}q.fire("mousemove",q,x)};this.click=function(u){if(p&&q._over(u)&&!s){q.fire("click",q,u)}s=false};this.dblclick=function(u){if(p&&q._over(u)&&!s){q.fire("dblclick",q,u)}s=false};this.mousedown=function(u){if(q._over(u)&&!o){o=true;t=m(a(q.canvas));q.fire("mousedown",q,u)}};this.mouseup=function(u){o=false;q.fire("mouseup",q,u)};this.contextmenu=function(u){if(p&&q._over(u)&&!s){q.fire("contextmenu",q,u)}s=false}};var c=function(p){var o=document.createElement("canvas");p._jsPlumb.appendElement(o,p.parent);o.style.position="absolute";if(p["class"]){o.className=p["class"]}p._jsPlumb.getId(o,p.uuid);if(p.tooltip){o.setAttribute("title",p.tooltip)}return o};var l=function(p){k.apply(this,arguments);var o=[];this.getDisplayElements=function(){return o};this.appendDisplayElement=function(q){o.push(q)}};var h=jsPlumb.CanvasConnector=function(r){l.apply(this,arguments);var o=function(v,t){p.ctx.save();jsPlumb.extend(p.ctx,t);if(t.gradient){var u=p.createGradient(v,p.ctx);for(var s=0;s<t.gradient.stops.length;s++){u.addColorStop(t.gradient.stops[s][0],t.gradient.stops[s][1])}p.ctx.strokeStyle=u}p._paint(v,t);p.ctx.restore()};var p=this,q=p._jsPlumb.connectorClass+" "+(r.cssClass||"");p.canvas=c({"class":q,_jsPlumb:p._jsPlumb,parent:r.parent,tooltip:r.tooltip});p.ctx=p.canvas.getContext("2d");p.appendDisplayElement(p.canvas);p.paint=function(w,t){if(t!=null){jsPlumb.sizeCanvas(p.canvas,w[0],w[1],w[2],w[3]);if(p.getZIndex()){p.canvas.style.zIndex=p.getZIndex()}if(t.outlineColor!=null){var v=t.outlineWidth||1,s=t.lineWidth+(2*v),u={strokeStyle:t.outlineColor,lineWidth:s};o(w,u)}o(w,t)}}};var b=function(r){var p=this;l.apply(this,arguments);var q=p._jsPlumb.endpointClass+" "+(r.cssClass||""),o={"class":q,_jsPlumb:p._jsPlumb,parent:r.parent,tooltip:p.tooltip};p.canvas=c(o);p.ctx=p.canvas.getContext("2d");p.appendDisplayElement(p.canvas);this.paint=function(x,u,s){jsPlumb.sizeCanvas(p.canvas,x[0],x[1],x[2],x[3]);if(u.outlineColor!=null){var w=u.outlineWidth||1,t=u.lineWidth+(2*w);var v={strokeStyle:u.outlineColor,lineWidth:t}}p._paint.apply(this,arguments)}};jsPlumb.Endpoints.canvas.Dot=function(r){jsPlumb.Endpoints.Dot.apply(this,arguments);b.apply(this,arguments);var q=this,p=function(s){try{return parseInt(s)}catch(t){if(s.substring(s.length-1)=="%"){return parseInt(s.substring(0,s-1))}}},o=function(u){var s=q.defaultOffset,t=q.defaultInnerRadius;u.offset&&(s=p(u.offset));u.innerRadius&&(t=p(u.innerRadius));return[s,t]};this._paint=function(A,t,x){if(t!=null){var B=q.canvas.getContext("2d"),u=x.getOrientation(q);jsPlumb.extend(B,t);if(t.gradient){var v=o(t.gradient),y=u[1]==1?v[0]*-1:v[0],s=u[0]==1?v[0]*-1:v[0],z=B.createRadialGradient(A[4],A[4],A[4],A[4]+s,A[4]+y,v[1]);for(var w=0;w<t.gradient.stops.length;w++){z.addColorStop(t.gradient.stops[w][0],t.gradient.stops[w][1])}B.fillStyle=z}B.beginPath();B.arc(A[4],A[4],A[4],0,Math.PI*2,true);B.closePath();if(t.fillStyle||t.gradient){B.fill()}if(t.strokeStyle){B.stroke()}}}};jsPlumb.Endpoints.canvas.Rectangle=function(p){var o=this;jsPlumb.Endpoints.Rectangle.apply(this,arguments);b.apply(this,arguments);this._paint=function(x,r,v){var A=o.canvas.getContext("2d"),t=v.getOrientation(o);jsPlumb.extend(A,r);if(r.gradient){var z=t[1]==1?x[3]:t[1]==0?x[3]/2:0;var y=t[1]==-1?x[3]:t[1]==0?x[3]/2:0;var s=t[0]==1?x[2]:t[0]==0?x[2]/2:0;var q=t[0]==-1?x[2]:t[0]==0?x[2]/2:0;var w=A.createLinearGradient(s,z,q,y);for(var u=0;u<r.gradient.stops.length;u++){w.addColorStop(r.gradient.stops[u][0],r.gradient.stops[u][1])}A.fillStyle=w}A.beginPath();A.rect(0,0,x[2],x[3]);A.closePath();if(r.fillStyle||r.gradient){A.fill()}if(r.strokeStyle){A.stroke()}}};jsPlumb.Endpoints.canvas.Triangle=function(p){var o=this;jsPlumb.Endpoints.Triangle.apply(this,arguments);b.apply(this,arguments);this._paint=function(z,q,v){var s=z[2],C=z[3],B=z[0],A=z[1],D=o.canvas.getContext("2d"),w=0,u=0,t=0,r=v.getOrientation(o);if(r[0]==1){w=s;u=C;t=180}if(r[1]==-1){w=s;t=90}if(r[1]==1){u=C;t=-90}D.fillStyle=q.fillStyle;D.translate(w,u);D.rotate(t*Math.PI/180);D.beginPath();D.moveTo(0,0);D.lineTo(s/2,C/2);D.lineTo(0,C);D.closePath();if(q.fillStyle||q.gradient){D.fill()}if(q.strokeStyle){D.stroke()}}};jsPlumb.Endpoints.canvas.Image=jsPlumb.Endpoints.Image;jsPlumb.Endpoints.canvas.Blank=jsPlumb.Endpoints.Blank;jsPlumb.Connectors.canvas.Bezier=function(){var o=this;jsPlumb.Connectors.Bezier.apply(this,arguments);h.apply(this,arguments);this._paint=function(q,p){o.ctx.beginPath();o.ctx.moveTo(q[4],q[5]);o.ctx.bezierCurveTo(q[8],q[9],q[10],q[11],q[6],q[7]);o.ctx.stroke()};this.createGradient=function(r,p,q){return o.ctx.createLinearGradient(r[6],r[7],r[4],r[5])}};jsPlumb.Connectors.canvas.Straight=function(){var p=this,o=[null,[1,-1],[1,1],[-1,1],[-1,-1]];jsPlumb.Connectors.Straight.apply(this,arguments);h.apply(this,arguments);this._paint=function(r,t){p.ctx.beginPath();if(t.dashstyle&&t.dashstyle.split(" ").length==2){var v=t.dashstyle.split(" ");if(v.length!=2){v=[2,2]}var C=[v[0]*t.lineWidth,v[1]*t.lineWidth],y=(r[6]-r[4])/(r[7]-r[5]),G=jsPlumbUtil.segment([r[4],r[5]],[r[6],r[7]]),x=o[G],u=Math.atan(y),z=Math.sqrt(Math.pow(r[6]-r[4],2)+Math.pow(r[7]-r[5],2)),B=Math.floor(z/(C[0]+C[1])),w=[r[4],r[5]];for(var A=0;A<B;A++){p.ctx.moveTo(w[0],w[1]);var q=w[0]+(Math.abs(Math.sin(u)*C[0])*x[0]),F=w[1]+(Math.abs(Math.cos(u)*C[0])*x[1]),E=w[0]+(Math.abs(Math.sin(u)*(C[0]+C[1]))*x[0]),D=w[1]+(Math.abs(Math.cos(u)*(C[0]+C[1]))*x[1]);p.ctx.lineTo(q,F);w=[E,D]}p.ctx.moveTo(w[0],w[1]);p.ctx.lineTo(r[6],r[7])}else{p.ctx.moveTo(r[4],r[5]);p.ctx.lineTo(r[6],r[7])}p.ctx.stroke()};this.createGradient=function(r,q){return q.createLinearGradient(r[4],r[5],r[6],r[7])}};jsPlumb.Connectors.canvas.Flowchart=function(){var o=this;jsPlumb.Connectors.Flowchart.apply(this,arguments);h.apply(this,arguments);this._paint=function(r,q){o.ctx.beginPath();o.ctx.moveTo(r[4],r[5]);for(var p=0;p<r[8];p++){o.ctx.lineTo(r[9+(p*2)],r[10+(p*2)])}o.ctx.lineTo(r[6],r[7]);o.ctx.stroke()};this.createGradient=function(q,p){return p.createLinearGradient(q[4],q[5],q[6],q[7])}};jsPlumb.Overlays.canvas.Label=jsPlumb.Overlays.Label;jsPlumb.Overlays.canvas.Custom=jsPlumb.Overlays.Custom;var g=function(){jsPlumb.jsPlumbUIComponent.apply(this,arguments)};var e=function(p,o){p.apply(this,o);g.apply(this,o);this.paint=function(s,u,q,v,t){var r=s.ctx;r.lineWidth=q;r.beginPath();r.moveTo(u.hxy.x,u.hxy.y);r.lineTo(u.tail[0].x,u.tail[0].y);r.lineTo(u.cxy.x,u.cxy.y);r.lineTo(u.tail[1].x,u.tail[1].y);r.lineTo(u.hxy.x,u.hxy.y);r.closePath();if(v){r.strokeStyle=v;r.stroke()}if(t){r.fillStyle=t;r.fill()}}};jsPlumb.Overlays.canvas.Arrow=function(){e.apply(this,[jsPlumb.Overlays.Arrow,arguments])};jsPlumb.Overlays.canvas.PlainArrow=function(){e.apply(this,[jsPlumb.Overlays.PlainArrow,arguments])};jsPlumb.Overlays.canvas.Diamond=function(){e.apply(this,[jsPlumb.Overlays.Diamond,arguments])}})();(function(a){jsPlumb.CurrentLibrary={addClass:function(c,b){c=jsPlumb.CurrentLibrary.getElementObject(c);try{if(c[0].className.constructor==SVGAnimatedString){jsPlumbUtil.svg.addClass(c[0],b)}}catch(d){}c.addClass(b)},animate:function(d,c,b){d.animate(c,b)},appendElement:function(c,b){jsPlumb.CurrentLibrary.getElementObject(b).append(c)},ajax:function(b){b=b||{};b.type=b.type||"get";a.ajax(b)},bind:function(b,c,d){b=jsPlumb.CurrentLibrary.getElementObject(b);b.bind(c,d)},dragEvents:{start:"start",stop:"stop",drag:"drag",step:"step",over:"over",out:"out",drop:"drop",complete:"complete"},extend:function(c,b){return a.extend(c,b)},getAttribute:function(b,c){return b.attr(c)},getClientXY:function(b){return[b.clientX,b.clientY]},getDragObject:function(b){return b[1].draggable},getDragScope:function(b){return b.draggable("option","scope")},getDropEvent:function(b){return b[0]},getDropScope:function(b){return b.droppable("option","scope")},getDOMElement:function(b){if(typeof(b)=="string"){return document.getElementById(b)}else{if(b.context||b.length!=null){return b[0]}else{return b}}},getElementObject:function(b){return typeof(b)=="string"?a("#"+b):a(b)},getOffset:function(b){return b.offset()},getOriginalEvent:function(b){return b.originalEvent},getPageXY:function(b){return[b.pageX,b.pageY]},getParent:function(b){return jsPlumb.CurrentLibrary.getElementObject(b).parent()},getScrollLeft:function(b){return b.scrollLeft()},getScrollTop:function(b){return b.scrollTop()},getSelector:function(b){return a(b)},getSize:function(b){return[b.outerWidth(),b.outerHeight()]},getTagName:function(b){var c=jsPlumb.CurrentLibrary.getElementObject(b);return c.length>0?c[0].tagName:null},getUIPosition:function(c,d){d=d||1;if(c.length==1){ret={left:c[0].pageX,top:c[0].pageY}}else{var e=c[1],b=e.offset;ret=b||e.absolutePosition;e.position.left/=d;e.position.top/=d}return{left:ret.left/d,top:ret.top/d}},hasClass:function(c,b){return c.hasClass(b)},initDraggable:function(c,b,d){b=b||{};b.helper=null;if(d){b.scope=b.scope||jsPlumb.Defaults.Scope}c.draggable(b)},initDroppable:function(c,b){b.scope=b.scope||jsPlumb.Defaults.Scope;c.droppable(b)},isAlreadyDraggable:function(b){b=jsPlumb.CurrentLibrary.getElementObject(b);return b.hasClass("ui-draggable")},isDragSupported:function(c,b){return c.draggable},isDropSupported:function(c,b){return c.droppable},removeClass:function(c,b){c=jsPlumb.CurrentLibrary.getElementObject(c);try{if(c[0].className.constructor==SVGAnimatedString){jsPlumbUtil.svg.removeClass(c[0],b)}}catch(d){}c.removeClass(b)},removeElement:function(b,c){jsPlumb.CurrentLibrary.getElementObject(b).remove()},setAttribute:function(c,d,b){c.attr(d,b)},setDraggable:function(c,b){c.draggable("option","disabled",!b)},setDragScope:function(c,b){c.draggable("option","scope",b)},setOffset:function(b,c){jsPlumb.CurrentLibrary.getElementObject(b).offset(c)},trigger:function(d,e,b){var c=jQuery._data(jsPlumb.CurrentLibrary.getElementObject(d)[0],"handle");c(b)},unbind:function(b,c,d){b=jsPlumb.CurrentLibrary.getElementObject(b);b.unbind(c,d)}};a(document).ready(jsPlumb.init)})(jQuery);(function(){"undefined"==typeof Math.sgn&&(Math.sgn=function(l){return 0==l?0:0<l?1:-1});var d={subtract:function(m,l){return{x:m.x-l.x,y:m.y-l.y}},dotProduct:function(m,l){return m.x*l.x+m.y*l.y},square:function(l){return Math.sqrt(l.x*l.x+l.y*l.y)},scale:function(m,l){return{x:m.x*l,y:m.y*l}}},f=Math.pow(2,-65),h=function(y,x){for(var t=[],v=x.length-1,r=2*v-1,s=[],w=[],p=[],q=[],o=[[1,0.6,0.3,0.1],[0.4,0.6,0.6,0.4],[0.1,0.3,0.6,1]],u=0;u<=v;u++){s[u]=d.subtract(x[u],y)}for(u=0;u<=v-1;u++){w[u]=d.subtract(x[u+1],x[u]);w[u]=d.scale(w[u],3)}for(u=0;u<=v-1;u++){for(var m=0;m<=v;m++){p[u]||(p[u]=[]);p[u][m]=d.dotProduct(w[u],s[m])}}for(u=0;u<=r;u++){q[u]||(q[u]=[]);q[u].y=0;q[u].x=parseFloat(u)/r}r=v-1;for(s=0;s<=v+r;s++){u=Math.max(0,s-r);for(w=Math.min(s,v);u<=w;u++){j=s-u;q[u+j].y=q[u+j].y+p[j][u]*o[j][u]}}v=x.length-1;q=a(q,2*v-1,t,0);r=d.subtract(y,x[0]);p=d.square(r);for(u=o=0;u<q;u++){r=d.subtract(y,k(x,v,t[u],null,null));r=d.square(r);if(r<p){p=r;o=t[u]}}r=d.subtract(y,x[v]);r=d.square(r);if(r<p){p=r;o=1}return{location:o,distance:p}},a=function(C,B,x,z){var v=[],w=[],A=[],t=[],u=0,s,y;y=Math.sgn(C[0].y);for(var q=1;q<=B;q++){s=Math.sgn(C[q].y);s!=y&&u++;y=s}switch(u){case 0:return 0;case 1:if(z>=64){x[0]=(C[0].x+C[B].x)/2;return 1}var p,u=C[0].y-C[B].y;y=C[B].x-C[0].x;q=C[0].x*C[B].y-C[B].x*C[0].y;s=max_distance_below=0;for(p=1;p<B;p++){var r=u*C[p].x+y*C[p].y+q;r>s?s=r:r<max_distance_below&&(max_distance_below=r)}p=y;s=(1*(q-s)-p*0)*(1/(0*p-u*1));p=y;y=q-max_distance_below;u=(1*y-p*0)*(1/(0*p-u*1));y=Math.min(s,u);if(Math.max(s,u)-y<f){A=C[B].x-C[0].x;t=C[B].y-C[0].y;x[0]=0+1*(A*(C[0].y-0)-t*(C[0].x-0))*(1/(A*0-t*1));return 1}}k(C,B,0.5,v,w);C=a(v,B,A,z+1);B=a(w,B,t,z+1);for(z=0;z<C;z++){x[z]=A[z]}for(z=0;z<B;z++){x[z+C]=t[z]}return C+B},k=function(m,l,p,q,n){for(var o=[[]],r=0;r<=l;r++){o[0][r]=m[r]}for(m=1;m<=l;m++){for(r=0;r<=l-m;r++){o[m]||(o[m]=[]);o[m][r]||(o[m][r]={});o[m][r].x=(1-p)*o[m-1][r].x+p*o[m-1][r+1].x;o[m][r].y=(1-p)*o[m-1][r].y+p*o[m-1][r+1].y}}if(q!=null){for(r=0;r<=l;r++){q[r]=o[r][0]}}if(n!=null){for(r=0;r<=l;r++){n[r]=o[l-r][r]}}return o[l][0]},g={},e=function(t){var s=g[t];if(!s){var s=[],p=function(u){return function(){return u}},q=function(){return function(u){return u}},n=function(){return function(u){return 1-u}},o=function(u){return function(v){for(var x=1,w=0;w<u.length;w++){x=x*u[w](v)}return x}};s.push(new function(){return function(u){return Math.pow(u,t)}});for(var r=1;r<t;r++){for(var l=[new p(t)],m=0;m<t-r;m++){l.push(new q)}for(m=0;m<r;m++){l.push(new n)}s.push(new o(l))}s.push(new function(){return function(u){return Math.pow(1-u,t)}});g[t]=s}return s},c=function(m,l){for(var p=e(m.length-1),q=0,n=0,o=0;o<m.length;o++){q=q+m[o].x*p[o](l);n=n+m[o].y*p[o](l)}return{x:q,y:n}},b=function(m,l,p){for(var q=c(m,l),n=0,o=p>0?1:-1,r=null;n<Math.abs(p);){l=l+0.005*o;r=c(m,l);n=n+Math.sqrt(Math.pow(r.x-q.x,2)+Math.pow(r.y-q.y,2));q=r}return{point:r,location:l}},i=function(m,l){var o=c(m,l),p=c(m.slice(0,m.length-1),l),n=p.y-o.y,o=p.x-o.x;return n==0?Infinity:Math.atan(n/o)};window.jsBezier={distanceFromCurve:h,gradientAtPoint:i,gradientAtPointAlongCurveFrom:function(m,l,n){l=b(m,l,n);if(l.location>1){l.location=1}if(l.location<0){l.location=0}return i(m,l.location)},nearestPointOnCurve:function(m,l){var n=h(m,l);return{point:k(l,l.length-1,n.location,null,null),location:n.location}},pointOnCurve:c,pointAlongCurveFrom:function(m,l,n){return b(m,l,n).point},perpendicularToCurveAt:function(m,l,n,o){l=b(m,l,o==null?0:o);m=i(m,l.location);o=Math.atan(-1/m);m=n/2*Math.sin(o);n=n/2*Math.cos(o);return[{x:l.point.x+n,y:l.point.y+m},{x:l.point.x-n,y:l.point.y-m}]},locationAlongCurveFrom:function(m,l,n){return b(m,l,n).location}}})();
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/1.3.15/jsPlumb-1.3.15-RC1.js	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,6356 @@
+/*
+ * jsPlumb
+ * 
+ * Title:jsPlumb 1.3.15
+ * 
+ * Provides a way to visually connect elements on an HTML page, using either SVG, Canvas
+ * elements, or VML.  
+ * 
+ * This file contains the jsPlumb core code.
+ *
+ * Copyright (c) 2010 - 2012 Simon Porritt (simon.porritt@gmail.com)
+ * 
+ * http://jsplumb.org
+ * http://github.com/sporritt/jsplumb
+ * http://code.google.com/p/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+
+;(function() {
+	
+	/**
+	 * Class:jsPlumb
+	 * The jsPlumb engine, registered as a static object in the window.  This object contains all of the methods you will use to
+	 * create and maintain Connections and Endpoints.
+	 */	
+	
+    var _findWithFunction = jsPlumbUtil.findWithFunction,
+	_indexOf = jsPlumbUtil.indexOf,
+    _removeWithFunction = jsPlumbUtil.removeWithFunction,
+    _remove = jsPlumbUtil.remove,
+    // TODO support insert index
+    _addWithFunction = jsPlumbUtil.addWithFunction,
+    _addToList = jsPlumbUtil.addToList,
+	/**
+		an isArray function that even works across iframes...see here:
+		
+		http://tobyho.com/2011/01/28/checking-types-in-javascript/
+
+		i was originally using "a.constructor == Array" as a test.
+	*/
+	_isArray = jsPlumbUtil.isArray,
+	_isString = jsPlumbUtil.isString,
+	_isObject = jsPlumbUtil.isObject;
+		
+	var _connectionBeingDragged = null,
+		_getAttribute = function(el, attName) { return jsPlumb.CurrentLibrary.getAttribute(_getElementObject(el), attName); },
+		_setAttribute = function(el, attName, attValue) { jsPlumb.CurrentLibrary.setAttribute(_getElementObject(el), attName, attValue); },
+		_addClass = function(el, clazz) { jsPlumb.CurrentLibrary.addClass(_getElementObject(el), clazz); },
+		_hasClass = function(el, clazz) { return jsPlumb.CurrentLibrary.hasClass(_getElementObject(el), clazz); },
+		_removeClass = function(el, clazz) { jsPlumb.CurrentLibrary.removeClass(_getElementObject(el), clazz); },
+		_getElementObject = function(el) { return jsPlumb.CurrentLibrary.getElementObject(el); },
+		_getOffset = function(el, _instance) {
+            var o = jsPlumb.CurrentLibrary.getOffset(_getElementObject(el));
+            if (_instance != null) {
+                var z = _instance.getZoom();
+                return {left:o.left / z, top:o.top / z };    
+            }
+            else
+                return o;
+        },		
+		_getSize = function(el) {
+            return jsPlumb.CurrentLibrary.getSize(_getElementObject(el));
+        },
+		_log = jsPlumbUtil.log,
+		_group = jsPlumbUtil.group,
+		_groupEnd = jsPlumbUtil.groupEnd,
+		_time = jsPlumbUtil.time,
+		_timeEnd = jsPlumbUtil.timeEnd,
+		
+		/**
+		 * creates a timestamp, using milliseconds since 1970, but as a string.
+		 */
+		_timestamp = function() { return "" + (new Date()).getTime(); },
+		
+		/*
+		 * Class:jsPlumbUIComponent
+		 * Abstract superclass for UI components Endpoint and Connection.  Provides the abstraction of paintStyle/hoverPaintStyle,
+		 * and also extends jsPlumbUtil.EventGenerator to provide the bind and fire methods.
+		 */
+		jsPlumbUIComponent = function(params) {
+			var self = this, 
+				a = arguments, 
+				_hover = false, 
+				parameters = params.parameters || {}, 
+				idPrefix = self.idPrefix,
+				id = idPrefix + (new Date()).getTime(),
+				paintStyle = null,
+				hoverPaintStyle = null;
+
+			self._jsPlumb = params["_jsPlumb"];			
+			self.getId = function() { return id; };
+			self.tooltip = params.tooltip;
+			self.hoverClass = params.hoverClass || self._jsPlumb.Defaults.HoverClass || jsPlumb.Defaults.HoverClass;				
+			
+			// all components can generate events
+			jsPlumbUtil.EventGenerator.apply(this);
+			// all components get this clone function.
+			// TODO issue 116 showed a problem with this - it seems 'a' that is in
+			// the clone function's scope is shared by all invocations of it, the classic
+			// JS closure problem.  for now, jsPlumb does a version of this inline where 
+			// it used to call clone.  but it would be nice to find some time to look
+			// further at this.
+			this.clone = function() {
+				var o = new Object();
+				self.constructor.apply(o, a);
+				return o;
+			};
+			
+			this.getParameter = function(name) { return parameters[name]; },
+			this.getParameters = function() { 
+				return parameters; 
+			},
+			this.setParameter = function(name, value) { parameters[name] = value; },
+			this.setParameters = function(p) { parameters = p; },			
+			this.overlayPlacements = [];			
+			
+			// user can supply a beforeDetach callback, which will be executed before a detach
+			// is performed; returning false prevents the detach.
+			var beforeDetach = params.beforeDetach;
+			this.isDetachAllowed = function(connection) {
+				var r = self._jsPlumb.checkCondition("beforeDetach", connection );
+				if (beforeDetach) {
+					try { 
+						r = beforeDetach(connection); 
+					}
+					catch (e) { _log("jsPlumb: beforeDetach callback failed", e); }
+				}
+				return r;
+			};
+			
+			// user can supply a beforeDrop callback, which will be executed before a dropped
+			// connection is confirmed. user can return false to reject connection.
+			var beforeDrop = params.beforeDrop;
+			this.isDropAllowed = function(sourceId, targetId, scope, connection, dropEndpoint) {
+				var r = self._jsPlumb.checkCondition("beforeDrop", { 
+					sourceId:sourceId, 
+					targetId:targetId, 
+					scope:scope,
+					connection:connection,
+					dropEndpoint:dropEndpoint 
+				});
+				if (beforeDrop) {
+					try { 
+						r = beforeDrop({ 
+							sourceId:sourceId, 
+							targetId:targetId, 
+							scope:scope, 
+							connection:connection,
+							dropEndpoint:dropEndpoint
+						}); 
+					}
+					catch (e) { _log("jsPlumb: beforeDrop callback failed", e); }
+				}
+				return r;
+			};
+			
+			// helper method to update the hover style whenever it, or paintStyle, changes.
+			// we use paintStyle as the foundation and merge hoverPaintStyle over the
+			// top.
+			var _updateHoverStyle = function() {
+				if (paintStyle && hoverPaintStyle) {
+					var mergedHoverStyle = {};
+					jsPlumb.extend(mergedHoverStyle, paintStyle);
+					jsPlumb.extend(mergedHoverStyle, hoverPaintStyle);
+					delete self["hoverPaintStyle"];
+					// we want the fillStyle of paintStyle to override a gradient, if possible.
+					if (mergedHoverStyle.gradient && paintStyle.fillStyle)
+						delete mergedHoverStyle["gradient"];
+					hoverPaintStyle = mergedHoverStyle;
+				}
+			};
+			
+			/*
+		     * Sets the paint style and then repaints the element.
+		     * 
+		     * Parameters:
+		     * 	style - Style to use.
+		     */
+		    this.setPaintStyle = function(style, doNotRepaint) {
+		    	paintStyle = style;
+		    	self.paintStyleInUse = paintStyle;
+		    	_updateHoverStyle();
+		    	if (!doNotRepaint) self.repaint();
+		    };
+
+		    /**
+		    * Gets the component's paint style.
+		    *
+		    * Returns:
+		    * the component's paint style. if there is no hoverPaintStyle set then this will be the paint style used all the time, otherwise this is the style used when the mouse is not hovering.
+		    */
+		    this.getPaintStyle = function() {
+		    	return paintStyle;
+		    };
+		    
+		    /*
+		     * Sets the paint style to use when the mouse is hovering over the element. This is null by default.
+		     * The hover paint style is applied as extensions to the paintStyle; it does not entirely replace
+		     * it.  This is because people will most likely want to change just one thing when hovering, say the
+		     * color for example, but leave the rest of the appearance the same.
+		     * 
+		     * Parameters:
+		     * 	style - Style to use when the mouse is hovering.
+		     *  doNotRepaint - if true, the component will not be repainted.  useful when setting things up initially.
+		     */
+		    this.setHoverPaintStyle = function(style, doNotRepaint) {		    	
+		    	hoverPaintStyle = style;
+		    	_updateHoverStyle();
+		    	if (!doNotRepaint) self.repaint();
+		    };
+
+		    /**
+		    * Gets the component's hover paint style.
+		    *
+		    * Returns:
+		    * the component's hover paint style. may be null.
+		    */
+		    this.getHoverPaintStyle = function() {
+		    	return hoverPaintStyle;
+		    };
+		    
+		    /*
+		     * sets/unsets the hover state of this element.
+		     * 
+		     * Parameters:
+		     * 	hover - hover state boolean
+		     * 	ignoreAttachedElements - if true, does not notify any attached elements of the change in hover state.  used mostly to avoid infinite loops.
+		     */
+		    this.setHover = function(hover, ignoreAttachedElements, timestamp) {
+		    	// while dragging, we ignore these events.  this keeps the UI from flashing and
+		    	// swishing and whatevering.
+				if (!self._jsPlumb.currentlyDragging && !self._jsPlumb.isHoverSuspended()) {
+		    
+			    	_hover = hover;
+					if (self.hoverClass != null && self.canvas != null) {
+						if (hover) 
+							jpcl.addClass(self.canvas, self.hoverClass);						
+						else
+							jpcl.removeClass(self.canvas, self.hoverClass);
+					}
+		   		 	if (hoverPaintStyle != null) {
+						self.paintStyleInUse = hover ? hoverPaintStyle : paintStyle;
+						timestamp = timestamp || _timestamp();
+						self.repaint({timestamp:timestamp, recalc:false});
+					}
+					// get the list of other affected elements, if supported by this component.
+					// for a connection, its the endpoints.  for an endpoint, its the connections! surprise.
+					if (self.getAttachedElements && !ignoreAttachedElements)
+						_updateAttachedElements(hover, _timestamp(), self);
+				}
+		    };
+		    
+		    this.isHover = function() { return _hover; };
+			
+			var zIndex = null;
+			this.setZIndex = function(v) { zIndex = v; };
+			this.getZIndex = function() { return zIndex; };
+
+			var jpcl = jsPlumb.CurrentLibrary,
+				events = [ "click", "dblclick", "mouseenter", "mouseout", "mousemove", "mousedown", "mouseup", "contextmenu" ],
+				eventFilters = { "mouseout":"mouseexit" },
+				bindOne = function(o, c, evt) {
+					var filteredEvent = eventFilters[evt] || evt;
+					jpcl.bind(o, evt, function(ee) {
+						c.fire(filteredEvent, c, ee);
+					});
+				},
+				unbindOne = function(o, evt) {
+					var filteredEvent = eventFilters[evt] || evt;
+					jpcl.unbind(o, evt);
+				};
+		    
+		    this.attachListeners = function(o, c) {
+				for (var i = 0; i < events.length; i++) {
+					bindOne(o, c, events[i]); 			
+				}
+			};
+		    
+		    var _updateAttachedElements = function(state, timestamp, sourceElement) {
+		    	var affectedElements = self.getAttachedElements();		// implemented in subclasses
+		    	if (affectedElements) {
+		    		for (var i = 0; i < affectedElements.length; i++) {
+		    			if (!sourceElement || sourceElement != affectedElements[i])
+		    				affectedElements[i].setHover(state, true, timestamp);			// tell the attached elements not to inform their own attached elements.
+		    		}
+		    	}
+		    };
+		    
+		    this.reattachListenersForElement = function(o) {
+			    if (arguments.length > 1) {
+		    		for (var i = 0; i < events.length; i++)
+		    			unbindOne(o, events[i]);
+			    	for (var i = 1; i < arguments.length; i++)
+		    			self.attachListeners(o, arguments[i]);
+		    	}
+		    };
+			
+			/*
+			 * TYPES
+			 */
+			var _types = [],
+				_splitType = function(t) { return t == null ? null : t.split(" ")},				
+				_applyTypes = function(doNotRepaint) {
+					if (self.getDefaultType) {
+						var td = self.getTypeDescriptor();
+							
+						var o = jsPlumbUtil.merge({}, self.getDefaultType());
+						for (var i = 0; i < _types.length; i++)
+							o = jsPlumbUtil.merge(o, self._jsPlumb.getType(_types[i], td));						
+					
+						self.applyType(o);					
+						if (!doNotRepaint) self.repaint();
+					}
+				};
+				
+			self.setType = function(typeId, doNotRepaint) {				
+				_types = _splitType(typeId) || [];
+				_applyTypes(doNotRepaint);									
+			};
+			
+			/*
+			 * Function : getType
+			 * Gets the 'types' of this component.
+			 */
+			self.getType = function() {
+				return _types;
+			};
+			
+			self.hasType = function(typeId) {
+				return jsPlumbUtil.indexOf(_types, typeId) != -1;
+			};
+			
+			self.addType = function(typeId, doNotRepaint) {
+				var t = _splitType(typeId), _cont = false;
+				if (t != null) {
+					for (var i = 0; i < t.length; i++) {
+						if (!self.hasType(t[i])) {
+							_types.push(t[i]);
+							_cont = true;						
+						}
+					}
+					if (_cont) _applyTypes(doNotRepaint);
+				}
+			};
+			
+			self.removeType = function(typeId, doNotRepaint) {
+				var t = _splitType(typeId), _cont = false, _one = function(tt) {
+					var idx = jsPlumbUtil.indexOf(_types, tt);
+					if (idx != -1) {
+						_types.splice(idx, 1);
+						return true;
+					}
+					return false;
+				};
+				
+				if (t != null) {
+					for (var i = 0; i < t.length; i++) {
+						_cont = _one(t[i]) || _cont;
+					}
+					if (_cont) _applyTypes(doNotRepaint);
+				}
+			};
+			
+			self.toggleType = function(typeId, doNotRepaint) {
+				var t = _splitType(typeId);
+				if (t != null) {
+					for (var i = 0; i < t.length; i++) {
+						var idx = jsPlumbUtil.indexOf(_types, t[i]);
+						if (idx != -1)
+							_types.splice(idx, 1);
+						else
+							_types.push(t[i]);
+					}
+						
+					_applyTypes(doNotRepaint);
+				}
+			};
+			
+			this.applyType = function(t) {
+				self.setPaintStyle(t.paintStyle);				
+				self.setHoverPaintStyle(t.hoverPaintStyle);
+				if (t.parameters){
+					for (var i in t.parameters)
+						self.setParameter(i, t.parameters[i]);
+				}
+			};
+			
+		},
+
+		overlayCapableJsPlumbUIComponent = function(params) {
+			jsPlumbUIComponent.apply(this, arguments);
+			var self = this;			
+			this.overlays = [];
+
+			var processOverlay = function(o) {
+				var _newOverlay = null;
+				if (_isArray(o)) {	// this is for the shorthand ["Arrow", { width:50 }] syntax
+					// there's also a three arg version:
+					// ["Arrow", { width:50 }, {location:0.7}] 
+					// which merges the 3rd arg into the 2nd.
+					var type = o[0],
+						// make a copy of the object so as not to mess up anyone else's reference...
+						p = jsPlumb.extend({component:self, _jsPlumb:self._jsPlumb}, o[1]);
+					if (o.length == 3) jsPlumb.extend(p, o[2]);
+					_newOverlay = new jsPlumb.Overlays[self._jsPlumb.getRenderMode()][type](p);
+					if (p.events) {
+						for (var evt in p.events) {
+							_newOverlay.bind(evt, p.events[evt]);
+						}
+					}
+				} else if (o.constructor == String) {
+					_newOverlay = new jsPlumb.Overlays[self._jsPlumb.getRenderMode()][o]({component:self, _jsPlumb:self._jsPlumb});
+				} else {
+					_newOverlay = o;
+				}										
+					
+				self.overlays.push(_newOverlay);
+			},
+			calculateOverlaysToAdd = function(params) {
+				var defaultKeys = self.defaultOverlayKeys || [],
+					o = params.overlays,
+					checkKey = function(k) {
+						return self._jsPlumb.Defaults[k] || jsPlumb.Defaults[k] || [];
+					};
+				
+				if (!o) o = [];
+
+				for (var i = 0; i < defaultKeys.length; i++)
+					o.unshift.apply(o, checkKey(defaultKeys[i]));
+				
+				return o;
+			}
+
+			var _overlays = calculateOverlaysToAdd(params);//params.overlays || self._jsPlumb.Defaults.Overlays;
+			if (_overlays) {
+				for (var i = 0; i < _overlays.length; i++) {
+					processOverlay(_overlays[i]);
+				}
+			}
+
+		    // overlay finder helper method
+			var _getOverlayIndex = function(id) {
+				var idx = -1;
+				for (var i = 0; i < self.overlays.length; i++) {
+					if (id === self.overlays[i].id) {
+						idx = i;
+						break;
+					}
+				}
+				return idx;
+			};
+						
+			this.addOverlay = function(overlay, doNotRepaint) { 
+				processOverlay(overlay); 
+				if (!doNotRepaint) self.repaint();
+			};
+						
+			this.getOverlay = function(id) {
+				var idx = _getOverlayIndex(id);
+				return idx >= 0 ? self.overlays[idx] : null;
+			};
+			
+			this.getOverlays = function() {
+				return self.overlays;
+			};			
+			
+			this.hideOverlay = function(id) {
+				var o = self.getOverlay(id);
+				if (o) o.hide();
+			};
+
+			this.hideOverlays = function() {
+				for (var i = 0; i < self.overlays.length; i++)
+					self.overlays[i].hide();
+			};
+						
+			this.showOverlay = function(id) {
+				var o = self.getOverlay(id);
+				if (o) o.show();
+			};
+
+			this.showOverlays = function() {
+				for (var i = 0; i < self.overlays.length; i++)
+					self.overlays[i].show();
+			};
+			
+			this.removeAllOverlays = function() {
+				for (var i = 0; i < self.overlays.length; i++) {
+					if (self.overlays[i].cleanup) self.overlays[i].cleanup();
+				}
+
+				self.overlays.splice(0, self.overlays.length);
+				self.repaint();
+			};
+						
+			this.removeOverlay = function(overlayId) {
+				var idx = _getOverlayIndex(overlayId);
+				if (idx != -1) {
+					var o = self.overlays[idx];
+					if (o.cleanup) o.cleanup();
+					self.overlays.splice(idx, 1);
+				}
+			};
+						
+			this.removeOverlays = function() {
+				for (var i = 0; i < arguments.length; i++)
+					self.removeOverlay(arguments[i]);
+			};
+
+			// this is a shortcut helper method to let people add a label as
+			// overlay.			
+			var _internalLabelOverlayId = "__label",
+			_makeLabelOverlay = function(params) {
+
+				var _params = {
+					cssClass:params.cssClass,
+					labelStyle : this.labelStyle,					
+					id:_internalLabelOverlayId,
+					component:self,
+					_jsPlumb:self._jsPlumb
+				},
+				mergedParams = jsPlumb.extend(_params, params);
+
+				return new jsPlumb.Overlays[self._jsPlumb.getRenderMode()].Label( mergedParams );
+			};
+			if (params.label) {
+				var loc = params.labelLocation || self.defaultLabelLocation || 0.5,
+					labelStyle = params.labelStyle || self._jsPlumb.Defaults.LabelStyle || jsPlumb.Defaults.LabelStyle;			
+				this.overlays.push(_makeLabelOverlay({
+					label:params.label,
+					location:loc,
+					labelStyle:labelStyle
+				}));
+			}
+
+			
+			this.setLabel = function(l) {
+				var lo = self.getOverlay(_internalLabelOverlayId);
+				if (!lo) {
+					var params = l.constructor == String || l.constructor == Function ? { label:l } : l;
+					lo = _makeLabelOverlay(params);	
+					this.overlays.push(lo);
+				}
+				else {
+					if (l.constructor == String || l.constructor == Function) lo.setLabel(l);
+					else {
+						if (l.label) lo.setLabel(l.label);
+						if (l.location) lo.setLocation(l.location);
+					}
+				}
+				
+				if (!self._jsPlumb.isSuspendDrawing()) 
+					self.repaint();
+			};
+
+			
+			this.getLabel = function() {
+				var lo = self.getOverlay(_internalLabelOverlayId);
+				return lo != null ? lo.getLabel() : null;
+			};
+
+			
+			this.getLabelOverlay = function() {
+				return self.getOverlay(_internalLabelOverlayId);
+			};
+			
+			var superAt = this.applyType;
+			this.applyType = function(t) {
+				superAt(t);
+				self.removeAllOverlays();
+				if (t.overlays) {
+					for (var i = 0; i < t.overlays.length; i++)
+						self.addOverlay(t.overlays[i], true);
+				}
+			};
+		},
+		
+		_bindListeners = function(obj, _self, _hoverFunction) {
+        	obj.bind("click", function(ep, e) { _self.fire("click", _self, e); });
+			obj.bind("dblclick", function(ep, e) { _self.fire("dblclick", _self, e); });
+	        obj.bind("contextmenu", function(ep, e) { _self.fire("contextmenu", _self, e); });
+			obj.bind("mouseenter", function(ep, e) {
+				if (!_self.isHover()) {
+	                _hoverFunction(true);
+					_self.fire("mouseenter", _self, e);
+				}
+			});
+			obj.bind("mouseexit", function(ep, e) {
+				if (_self.isHover()) {
+	                _hoverFunction(false);
+					_self.fire("mouseexit", _self, e);
+				}
+			});	
+        };	
+		
+		var _jsPlumbInstanceIndex = 0,
+			getInstanceIndex = function() {
+				var i = _jsPlumbInstanceIndex + 1;
+				_jsPlumbInstanceIndex++;
+				return i;
+			};
+
+		var jsPlumbInstance = function(_defaults) {
+		
+		/*
+		 * Property: Defaults 
+		 * 
+		 * These are the default settings for jsPlumb.  They are what will be used if you do not supply specific pieces of information 
+		 * to the various API calls. A convenient way to implement your own look and feel can be to override these defaults 
+		 * by including a script somewhere after the jsPlumb include, but before you make any calls to jsPlumb.
+		 * 
+		 * Properties:
+		 * 	-	*Anchor*				    The default anchor to use for all connections (both source and target). Default is "BottomCenter".
+		 * 	-	*Anchors*				    The default anchors to use ([source, target]) for all connections. Defaults are ["BottomCenter", "BottomCenter"].
+		 *  -   *ConnectionsDetachable*		Whether or not connections are detachable by default (using the mouse). Defaults to true.
+		 *  -   *ConnectionOverlays*		The default overlay definitions for Connections. Defaults to an empty list.
+		 * 	-	*Connector*				The default connector definition to use for all connections.  Default is "Bezier".
+		 * 	-   *ConnectorZIndex*       Optional value for the z-index of Connections that are not in the hover state. If you set this, jsPlumb will set the z-index of all created Connections to be this value, and the z-index of any Connections in the hover state to be this value plus one. This brings hovered connections up on top of others, which is a nice effect in busy UIs.
+		 *  -   *Container*				Optional selector or element id that instructs jsPlumb to append elements it creates to a specific element.
+		 * 	-	*DragOptions*			The default drag options to pass in to connect, makeTarget and addEndpoint calls. Default is empty.
+		 * 	-	*DropOptions*			The default drop options to pass in to connect, makeTarget and addEndpoint calls. Default is empty.
+		 * 	-	*Endpoint*				The default endpoint definition to use for all connections (both source and target).  Default is "Dot".
+		 *  -   *EndpointOverlays*		The default overlay definitions for Endpoints. Defaults to an empty list.
+		 * 	-	*Endpoints*				The default endpoint definitions ([ source, target ]) to use for all connections.  Defaults are ["Dot", "Dot"].
+		 * 	-	*EndpointStyle*			The default style definition to use for all endpoints. Default is fillStyle:"#456".
+		 * 	-	*EndpointStyles*		The default style definitions ([ source, target ]) to use for all endpoints.  Defaults are empty.
+		 * 	-	*EndpointHoverStyle*	The default hover style definition to use for all endpoints. Default is null.
+		 * 	-	*EndpointHoverStyles*	The default hover style definitions ([ source, target ]) to use for all endpoints. Defaults are null.
+		 * 	-	*HoverPaintStyle*		The default hover style definition to use for all connections. Defaults are null.
+		 * 	-	*LabelStyle*			The default style to use for label overlays on connections.
+		 * 	-	*LogEnabled*			Whether or not the jsPlumb log is enabled. defaults to false.
+		 * 	-	*Overlays*				The default overlay definitions (for both Connections and Endpoint). Defaults to an empty list.
+		 * 	-	*MaxConnections*		The default maximum number of connections for an Endpoint.  Defaults to 1.		 
+		 * 	-	*PaintStyle*			The default paint style for a connection. Default is line width of 8 pixels, with color "#456".
+		 * 	-	*ReattachConnections*	Whether or not to reattach Connections that a user has detached with the mouse and then dropped. Default is false.
+		 * 	-	*RenderMode*			What mode to use to paint with.  If you're on IE<9, you don't really get to choose this.  You'll just get VML.  Otherwise, the jsPlumb default is to use SVG.
+		 * 	-	*Scope*				The default "scope" to use for connections. Scope lets you assign connections to different categories. 
+		 */
+		this.Defaults = {
+			Anchor : "BottomCenter",
+			Anchors : [ null, null ],
+            ConnectionsDetachable : true,
+            ConnectionOverlays : [ ],
+            Connector : "Bezier",
+			ConnectorZIndex : null,
+			Container : null,
+			DragOptions : { },
+			DropOptions : { },
+			Endpoint : "Dot",
+			EndpointOverlays : [ ],
+			Endpoints : [ null, null ],
+			EndpointStyle : { fillStyle : "#456" },
+			EndpointStyles : [ null, null ],
+			EndpointHoverStyle : null,
+			EndpointHoverStyles : [ null, null ],
+			HoverPaintStyle : null,
+			LabelStyle : { color : "black" },
+			LogEnabled : false,
+			Overlays : [ ],
+			MaxConnections : 1, 
+			PaintStyle : { lineWidth : 8, strokeStyle : "#456" },            
+			ReattachConnections:false,
+			RenderMode : "svg",
+			Scope : "jsPlumb_DefaultScope"
+		};
+		if (_defaults) jsPlumb.extend(this.Defaults, _defaults);
+		
+		this.logEnabled = this.Defaults.LogEnabled;
+		
+		var _connectionTypes = { }, _endpointTypes = {};
+		this.registerConnectionType = function(id, type) {
+			_connectionTypes[id] = jsPlumb.extend({}, type);
+		};
+		this.registerConnectionTypes = function(types) {
+			for (var i in types)
+				_connectionTypes[i] = jsPlumb.extend({}, types[i]);
+		};
+		this.registerEndpointType = function(id, type) {
+			_endpointTypes[id] = jsPlumb.extend({}, type);
+		};
+		this.registerEndpointTypes = function(types) {
+			for (var i in types)
+				_endpointTypes[i] = jsPlumb.extend({}, types[i]);
+		};
+		this.getType = function(id, typeDescriptor) {
+			return typeDescriptor ===  "connection" ? _connectionTypes[id] : _endpointTypes[id];
+		};
+
+		jsPlumbUtil.EventGenerator.apply(this);
+		var _currentInstance = this,
+			_instanceIndex = getInstanceIndex(),
+			_bb = _currentInstance.bind,
+			_initialDefaults = {},
+            _zoom = 1;
+            
+        this.setZoom = function(z, repaintEverything) {
+            _zoom = z;
+            if (repaintEverything) _currentInstance.repaintEverything();
+        };
+        this.getZoom = function() { return _zoom; };
+
+		for (var i in this.Defaults)
+			_initialDefaults[i] = this.Defaults[i];
+
+		this.bind = function(event, fn) {		
+			if ("ready" === event && initialized) fn();
+			else _bb.apply(_currentInstance,[event, fn]);
+		};
+  
+		_currentInstance.importDefaults = function(d) {
+			for (var i in d) {
+				_currentInstance.Defaults[i] = d[i];
+			}	
+		};
+		
+		_currentInstance.restoreDefaults = function() {
+			_currentInstance.Defaults = jsPlumb.extend({}, _initialDefaults);
+		};
+		
+    var log = null,
+        resizeTimer = null,
+        initialized = false,
+        connectionsByScope = {},
+        /**
+         * map of element id -> endpoint lists. an element can have an arbitrary
+         * number of endpoints on it, and not all of them have to be connected
+         * to anything.
+         */
+        endpointsByElement = {},
+        endpointsByUUID = {},
+        offsets = {},
+        offsetTimestamps = {},
+        floatingConnections = {},
+        draggableStates = {},		
+        canvasList = [],
+        sizes = [],
+        //listeners = {}, // a map: keys are event types, values are lists of listeners.
+        DEFAULT_SCOPE = this.Defaults.Scope,
+        renderMode = null,  // will be set in init()							
+
+		/**
+		 * helper method to add an item to a list, creating the list if it does
+		 * not yet exist.
+		 */
+		_addToList = function(map, key, value) {
+			var l = map[key];
+			if (l == null) {
+				l = [];
+				map[key] = l;
+			}
+			l.push(value);
+			return l;
+		},
+
+		/**
+		 * appends an element to some other element, which is calculated as follows:
+		 * 
+		 * 1. if _currentInstance.Defaults.Container exists, use that element.
+		 * 2. if the 'parent' parameter exists, use that.
+		 * 3. otherwise just use the root element (for DOM usage, the document body).
+		 * 
+		 */
+		_appendElement = function(el, parent) {
+			if (_currentInstance.Defaults.Container)
+				jsPlumb.CurrentLibrary.appendElement(el, _currentInstance.Defaults.Container);
+			else if (!parent)
+				//document.body.appendChild(el);
+				jsPlumbAdapter.appendToRoot(el);
+			else
+				jsPlumb.CurrentLibrary.appendElement(el, parent);
+		},
+
+		_curIdStamp = 1,
+		_idstamp = function() { return "" + _curIdStamp++; },		
+		
+		/**
+		 * YUI, for some reason, put the result of a Y.all call into an object that contains
+		 * a '_nodes' array, instead of handing back an array-like object like the other
+		 * libraries do.
+		 */
+		_convertYUICollection = function(c) {
+			return c._nodes ? c._nodes : c;
+		},                
+
+		/**
+		 * Draws an endpoint and its connections. this is the main entry point into drawing connections as well
+		 * as endpoints, since jsPlumb is endpoint-centric under the hood.
+		 * 
+		 * @param element element to draw (of type library specific element object)
+		 * @param ui UI object from current library's event system. optional.
+		 * @param timestamp timestamp for this paint cycle. used to speed things up a little by cutting down the amount of offset calculations we do.
+		 */
+		_draw = function(element, ui, timestamp) {
+			
+			// TOD is it correct to filter by headless at this top level? how would a headless adapter ever repaint?
+            if (!jsPlumbAdapter.headless && !_suspendDrawing) {
+			    var id = _getAttribute(element, "id"),
+			    	repaintEls = _currentInstance.dragManager.getElementsForDraggable(id);			    
+
+			    if (timestamp == null) timestamp = _timestamp();
+
+			    _currentInstance.anchorManager.redraw(id, ui, timestamp);
+
+			    if (repaintEls) {
+				    for (var i in repaintEls) {
+						_currentInstance.anchorManager.redraw(repaintEls[i].id, ui, timestamp, repaintEls[i].offset);			    	
+				    }
+				}
+            }
+		},
+
+		/**
+		 * executes the given function against the given element if the first
+		 * argument is an object, or the list of elements, if the first argument
+		 * is a list. the function passed in takes (element, elementId) as
+		 * arguments.
+		 */
+		_elementProxy = function(element, fn) {
+			var retVal = null;
+			if (_isArray(element)) {
+				retVal = [];
+				for ( var i = 0; i < element.length; i++) {
+					var el = _getElementObject(element[i]), id = _getAttribute(el, "id");
+					retVal.push(fn(el, id)); // append return values to what we will return
+				}
+			} else {
+				var el = _getElementObject(element), id = _getAttribute(el, "id");
+				retVal = fn(el, id);
+			}
+			return retVal;
+		},				
+
+		/**
+		 * gets an Endpoint by uuid.
+		 */
+		_getEndpoint = function(uuid) { return endpointsByUUID[uuid]; },
+
+		/**
+		 * inits a draggable if it's not already initialised.
+		 */
+		_initDraggableIfNecessary = function(element, isDraggable, dragOptions) {
+			// TODO move to DragManager?
+			if (!jsPlumbAdapter.headless) {
+				var draggable = isDraggable == null ? false : isDraggable,
+					jpcl = jsPlumb.CurrentLibrary;
+				if (draggable) {
+					if (jpcl.isDragSupported(element) && !jpcl.isAlreadyDraggable(element)) {
+						var options = dragOptions || _currentInstance.Defaults.DragOptions || jsPlumb.Defaults.DragOptions;
+						options = jsPlumb.extend( {}, options); // make a copy.
+						var dragEvent = jpcl.dragEvents["drag"],
+							stopEvent = jpcl.dragEvents["stop"],
+							startEvent = jpcl.dragEvents["start"];
+	
+						options[startEvent] = _wrap(options[startEvent], function() {
+							_currentInstance.setHoverSuspended(true);
+						});
+	
+						options[dragEvent] = _wrap(options[dragEvent], function() {                            
+							var ui = jpcl.getUIPosition(arguments, _currentInstance.getZoom());
+							_draw(element, ui);
+							_addClass(element, "jsPlumb_dragged");
+						});
+						options[stopEvent] = _wrap(options[stopEvent], function() {
+							var ui = jpcl.getUIPosition(arguments, _currentInstance.getZoom());
+							_draw(element, ui);
+							_removeClass(element, "jsPlumb_dragged");
+							_currentInstance.setHoverSuspended(false);
+						});
+						var elId = _getId(element); // need ID
+						draggableStates[elId] = true;  
+						var draggable = draggableStates[elId];
+						options.disabled = draggable == null ? false : !draggable;
+						jpcl.initDraggable(element, options, false);
+						_currentInstance.dragManager.register(element);
+					}
+				}
+			}
+		},
+		
+		/*
+		* prepares a final params object that can be passed to _newConnection, taking into account defaults, events, etc.
+		*/
+		_prepareConnectionParams = function(params, referenceParams) {
+			var _p = jsPlumb.extend( {
+				sourceIsNew:true,
+				targetIsNew:true
+			}, params);
+			if (referenceParams) jsPlumb.extend(_p, referenceParams);
+			
+			// hotwire endpoints passed as source or target to sourceEndpoint/targetEndpoint, respectively.
+			if (_p.source && _p.source.endpoint) _p.sourceEndpoint = _p.source;
+			if (_p.source && _p.target.endpoint) _p.targetEndpoint = _p.target;
+			
+			// test for endpoint uuids to connect
+			if (params.uuids) {
+				_p.sourceEndpoint = _getEndpoint(params.uuids[0]);
+				_p.targetEndpoint = _getEndpoint(params.uuids[1]);
+			}						
+
+			// now ensure that if we do have Endpoints already, they're not full.
+			// source:
+			if (_p.sourceEndpoint && _p.sourceEndpoint.isFull()) {
+				_log(_currentInstance, "could not add connection; source endpoint is full");
+				return;
+			}
+
+			// target:
+			if (_p.targetEndpoint && _p.targetEndpoint.isFull()) {
+				_log(_currentInstance, "could not add connection; target endpoint is full");
+				return;
+			}
+			
+			// at this point, if we have source or target Endpoints, they were not new and we should mark the
+			// flag to reflect that.  this is for use later with the deleteEndpointsOnDetach flag.
+			if (_p.sourceEndpoint) _p.sourceIsNew = false;
+			if (_p.targetEndpoint) _p.targetIsNew = false;
+			
+			// if source endpoint mandates connection type and nothing specified in our params, use it.
+			if (!_p.type && _p.sourceEndpoint)
+				_p.type = _p.sourceEndpoint.connectionType;
+			
+			// copy in any connectorOverlays that were specified on the source endpoint.
+			// it doesnt copy target endpoint overlays.  i'm not sure if we want it to or not.
+			if (_p.sourceEndpoint && _p.sourceEndpoint.connectorOverlays) {
+				_p.overlays = _p.overlays || [];
+				for (var i = 0; i < _p.sourceEndpoint.connectorOverlays.length; i++) {
+					_p.overlays.push(_p.sourceEndpoint.connectorOverlays[i]);
+				}
+			}			
+			
+			// tooltip.  params.tooltip takes precedence, then sourceEndpoint.connectorTooltip.
+			_p.tooltip = params.tooltip;
+			if (!_p.tooltip && _p.sourceEndpoint && _p.sourceEndpoint.connectorTooltip)
+				_p.tooltip = _p.sourceEndpoint.connectorTooltip;
+			
+			// if there's a target specified (which of course there should be), and there is no
+			// target endpoint specified, and 'newConnection' was not set to true, then we check to
+			// see if a prior call to makeTarget has provided us with the specs for the target endpoint, and
+			// we use those if so.  additionally, if the makeTarget call was specified with 'uniqueEndpoint' set
+			// to true, then if that target endpoint has already been created, we re-use it.
+			if (_p.target && !_p.target.endpoint && !_p.targetEndpoint && !_p.newConnection) {				
+				var tid = _getId(_p.target),
+					tep =_targetEndpointDefinitions[tid],
+					existingUniqueEndpoint = _targetEndpoints[tid];				
+
+				if (tep) {			
+					// if target not enabled, return.
+					if (!_targetsEnabled[tid]) return;
+
+					// check for max connections??						
+					var newEndpoint = existingUniqueEndpoint != null ? existingUniqueEndpoint : _currentInstance.addEndpoint(_p.target, tep);
+					if (_targetEndpointsUnique[tid]) _targetEndpoints[tid] = newEndpoint;
+					 _p.targetEndpoint = newEndpoint;
+					 newEndpoint._makeTargetCreator = true;
+					 _p.targetIsNew = true;
+				}
+			}
+
+			// same thing, but for source.
+			if (_p.source && !_p.source.endpoint && !_p.sourceEndpoint && !_p.newConnection) {
+				var tid = _getId(_p.source),
+					tep = _sourceEndpointDefinitions[tid],
+					existingUniqueEndpoint = _sourceEndpoints[tid];				
+
+				if (tep) {
+					// if source not enabled, return.					
+					if (!_sourcesEnabled[tid]) return;
+				
+					var newEndpoint = existingUniqueEndpoint != null ? existingUniqueEndpoint : _currentInstance.addEndpoint(_p.source, tep);
+					if (_sourceEndpointsUnique[tid]) _sourceEndpoints[tid] = newEndpoint;
+					 _p.sourceEndpoint = newEndpoint;
+					 _p.sourceIsNew = true;
+				}
+			}
+			
+			return _p;
+		},
+		
+		_newConnection = function(params) {
+			var connectionFunc = _currentInstance.Defaults.ConnectionType || _currentInstance.getDefaultConnectionType(),
+			    endpointFunc = _currentInstance.Defaults.EndpointType || Endpoint,
+			    parent = jsPlumb.CurrentLibrary.getParent;
+			
+			if (params.container)
+				params["parent"] = params.container;
+			else {
+				if (params.sourceEndpoint)
+					params["parent"] = params.sourceEndpoint.parent;
+				else if (params.source.constructor == endpointFunc)
+					params["parent"] = params.source.parent;
+				else params["parent"] = parent(params.source);
+			}
+			
+			params["_jsPlumb"] = _currentInstance;
+			var con = new connectionFunc(params);
+			con.id = "con_" + _idstamp();
+			_eventFireProxy("click", "click", con);
+			_eventFireProxy("dblclick", "dblclick", con);
+            _eventFireProxy("contextmenu", "contextmenu", con);
+			return con;
+		},
+		
+		/**
+		* adds the connection to the backing model, fires an event if necessary and then redraws
+		*/
+		_finaliseConnection = function(jpc, params, originalEvent) {
+            params = params || {};
+			// add to list of connections (by scope).
+            if (!jpc.suspendedEndpoint)
+			    _addToList(connectionsByScope, jpc.scope, jpc);
+			// fire an event
+			if (!params.doNotFireConnectionEvent && params.fireEvent !== false) {
+			
+				var eventArgs = {
+					connection:jpc,
+					source : jpc.source, target : jpc.target,
+					sourceId : jpc.sourceId, targetId : jpc.targetId,
+					sourceEndpoint : jpc.endpoints[0], targetEndpoint : jpc.endpoints[1]
+				};
+			
+				_currentInstance.fire("jsPlumbConnection", eventArgs, originalEvent);
+				// this is from 1.3.11 onwards. "jsPlumbConnection" always felt so unnecessary, so
+				// I've added this alias in 1.3.11, with a view to removing "jsPlumbConnection" completely in a future version. be aware, of course, you should only register listeners for one or the other of these events.
+				_currentInstance.fire("connection", eventArgs, originalEvent);
+			}		
+			
+            // always inform the anchor manager
+            // except that if jpc has a suspended endpoint it's not true to say the
+            // connection is new; it has just (possibly) moved. the question is whether
+            // to make that call here or in the anchor manager.  i think perhaps here.
+            _currentInstance.anchorManager.newConnection(jpc);
+			// force a paint
+			_draw(jpc.source);
+		},
+		
+		_eventFireProxy = function(event, proxyEvent, obj) {
+			obj.bind(event, function(originalObject, originalEvent) {
+				_currentInstance.fire(proxyEvent, obj, originalEvent);
+			});
+		},
+		
+		/**
+		 * for the given endpoint params, returns an appropriate parent element for the UI elements that will be added.
+		 * this function is used by _newEndpoint (directly below), and also in the makeSource function in jsPlumb.
+		 * 
+		 *   the logic is to first look for a "container" member of params, and pass that back if found.  otherwise we
+		 *   handoff to the 'getParent' function in the current library.
+		 */
+		_getParentFromParams = function(params) {
+			if (params.container)
+				return params.container;
+			else {
+                var tag = jsPlumb.CurrentLibrary.getTagName(params.source),
+                    p = jsPlumb.CurrentLibrary.getParent(params.source);
+                if (tag && tag.toLowerCase() === "td")
+                    return jsPlumb.CurrentLibrary.getParent(p);
+                else return p;
+            }
+		},
+		
+		/**
+			factory method to prepare a new endpoint.  this should always be used instead of creating Endpoints
+			manually, since this method attaches event listeners and an id.
+		*/
+		_newEndpoint = function(params) {
+				var endpointFunc = _currentInstance.Defaults.EndpointType || Endpoint;
+				params.parent = _getParentFromParams(params);
+				params["_jsPlumb"] = _currentInstance;
+				var ep = new endpointFunc(params);
+				ep.id = "ep_" + _idstamp();
+				_eventFireProxy("click", "endpointClick", ep);
+				_eventFireProxy("dblclick", "endpointDblClick", ep);
+				_eventFireProxy("contextmenu", "contextmenu", ep);
+				if (!jsPlumbAdapter.headless)
+					_currentInstance.dragManager.endpointAdded(params.source);
+			return ep;
+		},
+		
+		/**
+		 * performs the given function operation on all the connections found
+		 * for the given element id; this means we find all the endpoints for
+		 * the given element, and then for each endpoint find the connectors
+		 * connected to it. then we pass each connection in to the given
+		 * function.
+		 */
+		_operation = function(elId, func, endpointFunc) {
+			var endpoints = endpointsByElement[elId];
+			if (endpoints && endpoints.length) {
+				for ( var i = 0; i < endpoints.length; i++) {
+					for ( var j = 0; j < endpoints[i].connections.length; j++) {
+						var retVal = func(endpoints[i].connections[j]);
+						// if the function passed in returns true, we exit.
+						// most functions return false.
+						if (retVal) return;
+					}
+					if (endpointFunc) endpointFunc(endpoints[i]);
+				}
+			}
+		},
+		/**
+		 * perform an operation on all elements.
+		 */
+		_operationOnAll = function(func) {
+			for ( var elId in endpointsByElement) {
+				_operation(elId, func);
+			}
+		},		
+		
+		/**
+		 * helper to remove an element from the DOM.
+		 */
+		_removeElement = function(element, parent) {
+			if (element != null && element.parentNode != null) {
+				element.parentNode.removeChild(element);
+			}
+		},
+		/**
+		 * helper to remove a list of elements from the DOM.
+		 */
+		_removeElements = function(elements, parent) {
+			for ( var i = 0; i < elements.length; i++)
+				_removeElement(elements[i], parent);
+		},
+		/**
+		 * Sets whether or not the given element(s) should be draggable,
+		 * regardless of what a particular plumb command may request.
+		 * 
+		 * @param element
+		 *            May be a string, a element objects, or a list of
+		 *            strings/elements.
+		 * @param draggable
+		 *            Whether or not the given element(s) should be draggable.
+		 */
+		_setDraggable = function(element, draggable) {
+			return _elementProxy(element, function(el, id) {
+				draggableStates[id] = draggable;
+				if (jsPlumb.CurrentLibrary.isDragSupported(el)) {
+					jsPlumb.CurrentLibrary.setDraggable(el, draggable);
+				}
+			});
+		},
+		/**
+		 * private method to do the business of hiding/showing.
+		 * 
+		 * @param el
+		 *            either Id of the element in question or a library specific
+		 *            object for the element.
+		 * @param state
+		 *            String specifying a value for the css 'display' property
+		 *            ('block' or 'none').
+		 */
+		_setVisible = function(el, state, alsoChangeEndpoints) {
+			state = state === "block";
+			var endpointFunc = null;
+			if (alsoChangeEndpoints) {
+				if (state) endpointFunc = function(ep) {
+					ep.setVisible(true, true, true);
+				};
+				else endpointFunc = function(ep) {
+					ep.setVisible(false, true, true);
+				};
+			}
+			var id = _getAttribute(el, "id");
+			_operation(id, function(jpc) {
+				if (state && alsoChangeEndpoints) {		
+					// this test is necessary because this functionality is new, and i wanted to maintain backwards compatibility.
+					// this block will only set a connection to be visible if the other endpoint in the connection is also visible.
+					var oidx = jpc.sourceId === id ? 1 : 0;
+					if (jpc.endpoints[oidx].isVisible()) jpc.setVisible(true);
+				}
+				else  // the default behaviour for show, and what always happens for hide, is to just set the visibility without getting clever.
+					jpc.setVisible(state);
+			}, endpointFunc);
+		},
+		/**
+		 * toggles the draggable state of the given element(s).
+		 * 
+		 * @param el
+		 *            either an id, or an element object, or a list of
+		 *            ids/element objects.
+		 */
+		_toggleDraggable = function(el) {
+			return _elementProxy(el, function(el, elId) {
+				var state = draggableStates[elId] == null ? false : draggableStates[elId];
+				state = !state;
+				draggableStates[elId] = state;
+				jsPlumb.CurrentLibrary.setDraggable(el, state);
+				return state;
+			});
+		},
+		/**
+		 * private method to do the business of toggling hiding/showing.
+		 * 
+		 * @param elId
+		 *            Id of the element in question
+		 */
+		_toggleVisible = function(elId, changeEndpoints) {
+			var endpointFunc = null;
+			if (changeEndpoints) {
+				endpointFunc = function(ep) {
+					var state = ep.isVisible();
+					ep.setVisible(!state);
+				};
+			}
+			_operation(elId, function(jpc) {
+				var state = jpc.isVisible();
+				jpc.setVisible(!state);				
+			}, endpointFunc);
+			// todo this should call _elementProxy, and pass in the
+			// _operation(elId, f) call as a function. cos _toggleDraggable does
+			// that.
+		},
+		/**
+		 * updates the offset and size for a given element, and stores the
+		 * values. if 'offset' is not null we use that (it would have been
+		 * passed in from a drag call) because it's faster; but if it is null,
+		 * or if 'recalc' is true in order to force a recalculation, we get the current values.
+		 */
+		_updateOffset = function(params) {
+			var timestamp = params.timestamp, recalc = params.recalc, offset = params.offset, elId = params.elId;
+			if (_suspendDrawing && !timestamp) timestamp = _suspendedAt;
+			if (!recalc) {
+				if (timestamp && timestamp === offsetTimestamps[elId])
+					return offsets[elId];
+			}
+			if (recalc || !offset) { // if forced repaint or no offset available, we recalculate.
+				// get the current size and offset, and store them
+				var s = _getElementObject(elId);
+				if (s != null) {						
+					sizes[elId] = _getSize(s);
+					offsets[elId] = _getOffset(s, _currentInstance);
+					offsetTimestamps[elId] = timestamp;
+				}
+			} else {
+				offsets[elId] = offset;
+        if (sizes[elId] == null) {
+            var s = _getElementObject(elId);
+				    if (s != null) sizes[elId] = _getSize(s);
+        }
+		}
+			
+			if(offsets[elId] && !offsets[elId].right) {
+				offsets[elId].right = offsets[elId].left + sizes[elId][0];
+				offsets[elId].bottom = offsets[elId].top + sizes[elId][1];	
+				offsets[elId].width = sizes[elId][0];
+				offsets[elId].height = sizes[elId][1];	
+				offsets[elId].centerx = offsets[elId].left + (offsets[elId].width / 2);
+				offsets[elId].centery = offsets[elId].top + (offsets[elId].height / 2);				
+			}
+			return offsets[elId];
+		},
+
+		// TODO comparison performance
+		_getCachedData = function(elId) {
+			var o = offsets[elId];
+			if (!o) o = _updateOffset({elId:elId});
+			return {o:o, s:sizes[elId]};
+		},
+
+		/**
+		 * gets an id for the given element, creating and setting one if
+		 * necessary.  the id is of the form
+		 *
+		 *	jsPlumb_<instance index>_<index in instance>
+		 *
+		 * where "index in instance" is a monotonically increasing integer that starts at 0,
+		 * for each instance.  this method is used not only to assign ids to elements that do not
+		 * have them but also to connections and endpoints.
+		 */
+		_getId = function(element, uuid, doNotCreateIfNotFound) {
+			var ele = _getElementObject(element);
+			var id = _getAttribute(ele, "id");
+			if (!id || id == "undefined") {
+				// check if fixed uuid parameter is given
+				if (arguments.length == 2 && arguments[1] != undefined)
+					id = uuid;
+				else if (arguments.length == 1 || (arguments.length == 3 && !arguments[2]))
+					id = "jsPlumb_" + _instanceIndex + "_" + _idstamp();
+				
+                if (!doNotCreateIfNotFound) _setAttribute(ele, "id", id);
+			}
+			return id;
+		},		
+
+		/**
+		 * wraps one function with another, creating a placeholder for the
+		 * wrapped function if it was null. this is used to wrap the various
+		 * drag/drop event functions - to allow jsPlumb to be notified of
+		 * important lifecycle events without imposing itself on the user's
+		 * drag/drop functionality. TODO: determine whether or not we should
+		 * support an error handler concept, if one of the functions fails.
+		 * 
+		 * @param wrappedFunction original function to wrap; may be null.
+		 * @param newFunction function to wrap the original with.
+		 * @param returnOnThisValue Optional. Indicates that the wrappedFunction should 
+		 * not be executed if the newFunction returns a value matching 'returnOnThisValue'.
+		 * note that this is a simple comparison and only works for primitives right now.
+		 */
+		_wrap = function(wrappedFunction, newFunction, returnOnThisValue) {
+			wrappedFunction = wrappedFunction || function() { };
+			newFunction = newFunction || function() { };
+			return function() {
+				var r = null;
+				try {
+					r = newFunction.apply(this, arguments);
+				} catch (e) {
+					_log(_currentInstance, "jsPlumb function failed : " + e);
+				}
+				if (returnOnThisValue == null || (r !== returnOnThisValue)) {
+					try {
+						wrappedFunction.apply(this, arguments);
+					} catch (e) {
+						_log(_currentInstance, "wrapped function failed : " + e);
+					}
+				}
+				return r;
+			};
+		};	
+
+		/*
+		 * Property: connectorClass 
+		 *   The CSS class to set on Connection elements. This value is a String and can have multiple classes; the entire String is appended as-is.
+		 */
+		this.connectorClass = "_jsPlumb_connector";
+
+		/*
+		 * Property: endpointClass 
+		 *   The CSS class to set on Endpoint elements. This value is a String and can have multiple classes; the entire String is appended as-is.
+		 */
+		this.endpointClass = "_jsPlumb_endpoint";
+
+		/*
+		 * Property: overlayClass 
+		 * The CSS class to set on an Overlay that is an HTML element. This value is a String and can have multiple classes; the entire String is appended as-is.
+		 */
+		this.overlayClass = "_jsPlumb_overlay";
+		
+		this.Anchors = {};
+		
+		this.Connectors = { 
+			"canvas":{},
+			"svg":{},
+			"vml":{}
+		};
+
+		this.Endpoints = {
+			"canvas":{},
+			"svg":{},
+			"vml":{}
+		};
+
+		this.Overlays = {
+			"canvas":{},
+			"svg":{},
+			"vml":{}
+		};
+		
+// ************************ PLACEHOLDER DOC ENTRIES FOR NATURAL DOCS *****************************************
+
+		/*
+		* Function: importDefaults
+		* Imports all the given defaults into this instance of jsPlumb.		
+		*/
+		
+		/*
+		* Function: restoreDefaults
+		* Restores the default settings to "factory" values.
+		*/
+		
+		/*
+		 * Function: bind
+		 * Bind to an event on jsPlumb.  
+		 * 
+		 * Parameters:
+		 * 	event - the event to bind.  Available events on jsPlumb are:
+		 *         - *jsPlumbConnection* 			: 	notification that a new Connection was established.  jsPlumb passes the new Connection to the callback.
+		 *         - *jsPlumbConnectionDetached* 	: 	notification that a Connection was detached.  jsPlumb passes the detached Connection to the callback.
+		 *         - *click*						:	notification that a Connection was clicked.  jsPlumb passes the Connection that was clicked to the callback.
+		 *         - *dblclick*						:	notification that a Connection was double clicked.  jsPlumb passes the Connection that was double clicked to the callback.
+		 *         - *endpointClick*				:	notification that an Endpoint was clicked.  jsPlumb passes the Endpoint that was clicked to the callback.
+		 *         - *endpointDblClick*				:	notification that an Endpoint was double clicked.  jsPlumb passes the Endpoint that was double clicked to the callback.
+		 *         - *beforeDrop*					: 	notification that a Connection is about to be dropped. Returning false from this method cancels the drop. jsPlumb passes { sourceId, targetId, scope, connection, dropEndpoint } to your callback. For more information, refer to the jsPlumb documentation.
+		 *         - *beforeDetach*					: 	notification that a Connection is about to be detached. Returning false from this method cancels the detach. jsPlumb passes the Connection to your callback. For more information, refer to the jsPlumb documentation.
+		 *		   - *connectionDrag* 				:   notification that an existing Connection is being dragged. jsPlumb passes the Connection to your callback function.
+		 *         - *connectionDragEnd*            :   notification that the drag of an existing Connection has ended.  jsPlumb passes the Connection to your callback function.
+		 *         
+		 *  callback - function to callback. This function will be passed the Connection/Endpoint that caused the event, and also the original event.    
+		 */
+		
+		/*
+		 * Function: unbind
+		 * Clears either all listeners, or listeners for some specific event.
+		 * 
+		 * Parameters:
+		 * 	event	-	optional. constrains the clear to just listeners for this event.
+		 */
+		
+		/*
+		* Function: addClass
+		* Add class(es) to some element(s).
+		*
+		* Parameters:
+		* 	el			-	element id, dom element, or selector representing the element(s) to add class(es) to.
+		* 	clazz		-	string representing the class(es) to add. may contain multiple classes separated by spaces.
+		*/
+		
+		/*
+		* Function: removeClass
+		* Remove class from some selement(s).
+		*
+		* Parameters:
+		* 	el			-	element id, dom element, or selector representing the element(s) to remove a class from.
+		* 	clazz		-	string representing the class to remove. 
+		*/
+		
+		/*
+		* Function: hasClass
+		* Checks if an element has some class.
+		*
+		* Parameters:
+		* 	el			-	element id, dom element, or selector representing the element to test. If the selector matches multiple elements, we return the test for the first element in the selector only.
+		* 	clazz		-	string representing the class to test for. 
+		*/
+		
+// *************** END OF PLACEHOLDER DOC ENTRIES FOR NATURAL DOCS ***********************************************************		
+		
+
+// --------------------------- jsPLumbInstance public API ---------------------------------------------------------
+		
+		this.addClass = function(el, clazz) { return jsPlumb.CurrentLibrary.addClass(el, clazz); };		
+		this.removeClass = function(el, clazz) { return jsPlumb.CurrentLibrary.removeClass(el, clazz); };		
+		this.hasClass = function(el, clazz) { return jsPlumb.CurrentLibrary.hasClass(el, clazz); };
+		
+		/*
+		  Function: addEndpoint 
+		  	
+		  Adds an <Endpoint> to a given element or elements.
+		  			  
+		  Parameters:
+		   
+		  	el - Element to add the endpoint to. Either an element id, a selector representing some element(s), or an array of either of these. 
+		  	params - Object containing Endpoint constructor arguments.  For more information, see <Endpoint>.
+		  	referenceParams - Object containing more Endpoint constructor arguments; it will be merged with params by jsPlumb.  You would use this if you had some 
+		  					  shared parameters that you wanted to reuse when you added Endpoints to a number of elements. The allowed values in
+		  					  this object are anything that 'params' can contain.  See <Endpoint>.
+		  	 
+		  Returns: 
+		  	The newly created <Endpoint>, if el referred to a single element.  Otherwise, an array of newly created <Endpoint>s. 
+		  	
+		  See Also: 
+		  	<addEndpoints>
+		 */
+		this.addEndpoint = function(el, params, referenceParams) {
+			referenceParams = referenceParams || {};
+			var p = jsPlumb.extend({}, referenceParams);
+			jsPlumb.extend(p, params);
+			p.endpoint = p.endpoint || _currentInstance.Defaults.Endpoint || jsPlumb.Defaults.Endpoint;
+			p.paintStyle = p.paintStyle || _currentInstance.Defaults.EndpointStyle || jsPlumb.Defaults.EndpointStyle;
+            // YUI wrapper
+			el = _convertYUICollection(el);			
+			
+			var results = [], inputs = el.length && el.constructor != String ? el : [ el ];
+						
+			for (var i = 0; i < inputs.length; i++) {
+				var _el = _getElementObject(inputs[i]), id = _getId(_el);
+				p.source = _el;
+                _updateOffset({ elId : id, timestamp:_suspendedAt });
+				var e = _newEndpoint(p);
+				if (p.parentAnchor) e.parentAnchor = p.parentAnchor;
+				_addToList(endpointsByElement, id, e);
+				var myOffset = offsets[id], myWH = sizes[id];
+				var anchorLoc = e.anchor.compute( { xy : [ myOffset.left, myOffset.top ], wh : myWH, element : e, timestamp:_suspendedAt });
+				var endpointPaintParams = { anchorLoc : anchorLoc, timestamp:_suspendedAt };
+				if (_suspendDrawing) endpointPaintParams.recalc = false;
+				e.paint(endpointPaintParams);
+				results.push(e);
+				//if (!jsPlumbAdapter.headless)
+					//_currentInstance.dragManager.endpointAdded(_el);
+			}
+			
+			return results.length == 1 ? results[0] : results;
+		};
+		
+		/*
+		  Function: addEndpoints 
+		  Adds a list of <Endpoint>s to a given element or elements.
+		  
+		  Parameters: 
+		  	target - element to add the Endpoint to. Either an element id, a selector representing some element(s), or an array of either of these. 
+		  	endpoints - List of objects containing Endpoint constructor arguments. one Endpoint is created for each entry in this list.  See <Endpoint>'s constructor documentation. 
+			referenceParams - Object containing more Endpoint constructor arguments; it will be merged with params by jsPlumb.  You would use this if you had some shared parameters that you wanted to reuse when you added Endpoints to a number of elements.		  	 
+
+		  Returns: 
+		  	List of newly created <Endpoint>s, one for each entry in the 'endpoints' argument. 
+		  	
+		  See Also:
+		  	<addEndpoint>
+		 */
+		this.addEndpoints = function(el, endpoints, referenceParams) {
+			var results = [];
+			for ( var i = 0; i < endpoints.length; i++) {
+				var e = _currentInstance.addEndpoint(el, endpoints[i], referenceParams);
+				if (_isArray(e))
+					Array.prototype.push.apply(results, e);
+				else results.push(e);
+			}
+			return results;
+		};
+
+		/*
+		  Function: animate 
+		  This is a wrapper around the supporting library's animate function; it injects a call to jsPlumb in the 'step' function (creating
+		  the 'step' function if necessary). This only supports the two-arg version of the animate call in jQuery, the one that takes an 'options' object as
+		  the second arg. MooTools has only one method, a two arg one. Which is handy.  YUI has a one-arg method, so jsPlumb merges 'properties' and 'options' together for YUI.
+		   
+		  Parameters: 
+		  	el - Element to animate. Either an id, or a selector representing the element. 
+		  	properties - The 'properties' argument you want passed to the library's animate call. 
+		   	options - The 'options' argument you want passed to the library's animate call.
+		    
+		  Returns: 
+		  	void
+		 */
+		this.animate = function(el, properties, options) {
+			var ele = _getElementObject(el), id = _getAttribute(el, "id");
+			options = options || {};
+			var stepFunction = jsPlumb.CurrentLibrary.dragEvents['step'];
+			var completeFunction = jsPlumb.CurrentLibrary.dragEvents['complete'];
+			options[stepFunction] = _wrap(options[stepFunction], function() {
+				_currentInstance.repaint(id);
+			});
+
+			// onComplete repaints, just to make sure everything looks good at the end of the animation.
+			options[completeFunction] = _wrap(options[completeFunction],
+					function() {
+						_currentInstance.repaint(id);
+					});
+
+			jsPlumb.CurrentLibrary.animate(ele, properties, options);
+		};		
+		
+		/**
+		* checks for a listener for the given condition, executing it if found, passing in the given value.
+		* condition listeners would have been attached using "bind" (which is, you could argue, now overloaded, since
+		* firing click events etc is a bit different to what this does).  i thought about adding a "bindCondition"
+		* or something, but decided against it, for the sake of simplicity. jsPlumb will never fire one of these
+		* condition events anyway.
+		*/
+		this.checkCondition = function(conditionName, value) {
+			var l = _currentInstance.getListener(conditionName);
+			var r = true;
+			if (l && l.length > 0) {
+				try {
+					for (var i = 0 ; i < l.length; i++) {
+						r = r && l[i](value); 
+					}
+				}
+				catch (e) { 
+					_log(_currentInstance, "cannot check condition [" + conditionName + "]" + e); 
+				}
+			}
+			return r;
+		};
+
+		/*
+		  Function: connect 
+		  Establishes a <Connection> between two elements (or <Endpoint>s, which are themselves registered to elements).
+		  
+		  Parameters: 
+		    params - Object containing constructor arguments for the Connection. See <Connection>'s constructor documentation.
+		    referenceParams - Optional object containing more constructor arguments for the Connection. Typically you would pass in data that a lot of 
+		    Connections are sharing here, such as connector style etc, and then use the main params for data specific to this Connection.
+		     
+		  Returns: 
+		  	The newly created <Connection>.
+		 */
+		this.connect = function(params, referenceParams) {
+			// prepare a final set of parameters to create connection with
+			var _p = _prepareConnectionParams(params, referenceParams), jpc;
+			// TODO probably a nicer return value if the connection was not made.  _prepareConnectionParams
+			// will return null (and log something) if either endpoint was full.  what would be nicer is to 
+			// create a dedicated 'error' object.
+			if (_p) {
+				// a connect call will delete its created endpoints on detach, unless otherwise specified.
+				// this is because the endpoints belong to this connection only, and are no use to
+				// anyone else, so they hang around like a bad smell.
+				if (_p.deleteEndpointsOnDetach == null)
+					_p.deleteEndpointsOnDetach = true;
+
+				// create the connection.  it is not yet registered 
+				jpc = _newConnection(_p);
+				// now add it the model, fire an event, and redraw
+				_finaliseConnection(jpc, _p);										
+			}
+			return jpc;
+		};
+		
+		/*
+		 Function: deleteEndpoint		 
+		 Deletes an Endpoint and removes all Connections it has (which removes the Connections from the other Endpoints involved too)
+		 
+		 Parameters:
+		 	object - either an <Endpoint> object (such as from an addEndpoint call), or a String UUID.
+		 	
+		 Returns:
+		 	void		  
+		 */
+		this.deleteEndpoint = function(object) {
+			var endpoint = (typeof object == "string") ? endpointsByUUID[object] : object;			
+			if (endpoint) {					
+				var uuid = endpoint.getUuid();
+				if (uuid) endpointsByUUID[uuid] = null;				
+				endpoint.detachAll();
+				if (endpoint.endpoint.cleanup) endpoint.endpoint.cleanup();
+				_removeElements(endpoint.endpoint.getDisplayElements());
+				_currentInstance.anchorManager.deleteEndpoint(endpoint);
+				for (var e in endpointsByElement) {
+					var endpoints = endpointsByElement[e];
+					if (endpoints) {
+						var newEndpoints = [];
+						for (var i = 0; i < endpoints.length; i++)
+							if (endpoints[i] != endpoint) newEndpoints.push(endpoints[i]);
+						
+						endpointsByElement[e] = newEndpoints;
+					}
+				}
+				if (!jsPlumbAdapter.headless)
+					_currentInstance.dragManager.endpointDeleted(endpoint);								
+			}									
+		};
+		
+		/*
+		 Function: deleteEveryEndpoint
+		  Deletes every <Endpoint>, and their associated <Connection>s, in this instance of jsPlumb. Does not unregister any event listeners (this is the only difference
+between this method and jsPlumb.reset).  
+		  
+		 Returns: 
+		 	void 
+		 */
+		this.deleteEveryEndpoint = function() {
+			_currentInstance.setSuspendDrawing(true);
+			for ( var id in endpointsByElement) {
+				var endpoints = endpointsByElement[id];
+				if (endpoints && endpoints.length) {
+					for ( var i = 0; i < endpoints.length; i++) {
+						_currentInstance.deleteEndpoint(endpoints[i]);
+					}
+				}
+			}			
+			endpointsByElement = {};			
+			endpointsByUUID = {};
+			
+			_currentInstance.setSuspendDrawing(false, true);
+		};
+
+		var fireDetachEvent = function(jpc, doFireEvent, originalEvent) {
+            // may have been given a connection, or in special cases, an object
+            var connType =  _currentInstance.Defaults.ConnectionType || _currentInstance.getDefaultConnectionType(),
+                argIsConnection = jpc.constructor == connType,
+                params = argIsConnection ? {
+                    connection:jpc,
+				    source : jpc.source, target : jpc.target,
+				    sourceId : jpc.sourceId, targetId : jpc.targetId,
+				    sourceEndpoint : jpc.endpoints[0], targetEndpoint : jpc.endpoints[1]
+                } : jpc;
+
+			if (doFireEvent) {
+				_currentInstance.fire("jsPlumbConnectionDetached", params, originalEvent);
+				// introduced in 1.3.11..an alias because the original event name is unwieldy.  in future versions this will be the only event and the other will no longer be fired.
+				_currentInstance.fire("connectionDetached", params, originalEvent);
+			}
+            _currentInstance.anchorManager.connectionDetached(params);
+		},
+		/**
+			fires an event to indicate an existing connection is being dragged.
+		*/
+		fireConnectionDraggingEvent = function(jpc) {
+			_currentInstance.fire("connectionDrag", jpc);	
+		},
+		fireConnectionDragStopEvent = function(jpc) {
+			_currentInstance.fire("connectionDragStop", jpc);
+		};
+
+		/*
+		  Function: detach 
+		  Detaches and then removes a <Connection>.  
+		  		   
+		  Parameters: 
+		    connection  -   the <Connection> to detach
+		    params      -   optional parameters to the detach call.  valid values here are
+		                    fireEvent   :   defaults to false; indicates you want jsPlumb to fire a connection
+		                                    detached event. The thinking behind this is that if you made a programmatic
+		                                    call to detach an event, you probably don't need the callback.
+		                    forceDetach :   defaults to false. allows you to override any beforeDetach listeners that may be registered.
+
+		    Returns: 
+		    	true if successful, false if not.
+		 */
+		this.detach = function() {
+
+            if (arguments.length == 0) return;
+            var connType =  _currentInstance.Defaults.ConnectionType || _currentInstance.getDefaultConnectionType(),
+                firstArgIsConnection = arguments[0].constructor == connType,
+                params = arguments.length == 2 ? firstArgIsConnection ? (arguments[1] || {}) : arguments[0] : arguments[0],
+                fireEvent = (params.fireEvent !== false),
+                forceDetach = params.forceDetach,
+                connection = firstArgIsConnection ? arguments[0] : params.connection;
+
+				if (connection) {
+                    if (forceDetach || (connection.isDetachAllowed(connection)
+                                        && connection.endpoints[0].isDetachAllowed(connection)
+                                        && connection.endpoints[1].isDetachAllowed(connection))) {
+                        if (forceDetach || _currentInstance.checkCondition("beforeDetach", connection))
+						    connection.endpoints[0].detach(connection, false, true, fireEvent); // TODO check this param iscorrect for endpoint's detach method
+                    }
+                }
+                else {
+					var _p = jsPlumb.extend( {}, params); // a backwards compatibility hack: source should be thought of as 'params' in this case.
+					// test for endpoint uuids to detach
+					if (_p.uuids) {
+						_getEndpoint(_p.uuids[0]).detachFrom(_getEndpoint(_p.uuids[1]), fireEvent);
+					} else if (_p.sourceEndpoint && _p.targetEndpoint) {
+						_p.sourceEndpoint.detachFrom(_p.targetEndpoint);
+					} else {
+						var sourceId = _getId(_p.source),
+						    targetId = _getId(_p.target);
+						_operation(sourceId, function(jpc) {
+						    if ((jpc.sourceId == sourceId && jpc.targetId == targetId) || (jpc.targetId == sourceId && jpc.sourceId == targetId)) {
+							    if (_currentInstance.checkCondition("beforeDetach", jpc)) {
+                                    jpc.endpoints[0].detach(jpc, false, true, fireEvent);
+								}
+							}
+						});
+					}
+				}
+		};
+
+		/*
+		  Function: detachAllConnections
+		  Removes all an element's Connections.
+		   
+		  Parameters:
+		  	el - either the id of the element, or a selector for the element.
+		  	params - optional parameters.  alowed values:
+		  	        fireEvent : defaults to true, whether or not to fire the detach event.
+		  	
+		  Returns: 
+		  	void
+		 */
+		this.detachAllConnections = function(el, params) {
+            params = params || {};
+            el = _getElementObject(el);
+			var id = _getAttribute(el, "id"),
+                endpoints = endpointsByElement[id];
+			if (endpoints && endpoints.length) {
+				for ( var i = 0; i < endpoints.length; i++) {
+					endpoints[i].detachAll(params.fireEvent);
+				}
+			}
+		};
+
+		/*
+		  Function: detachEveryConnection 
+		  Remove all Connections from all elements, but leaves Endpoints in place.
+
+		  Parameters:
+		    params  - optional params object containing:
+		            fireEvent : whether or not to fire detach events. defaults to true.
+
+		   
+		  Returns: 
+		  	void
+		  	 
+		  See Also:
+		  	<removeEveryEndpoint>
+		 */
+		this.detachEveryConnection = function(params) {
+            params = params || {};
+			for ( var id in endpointsByElement) {
+				var endpoints = endpointsByElement[id];
+				if (endpoints && endpoints.length) {
+					for ( var i = 0; i < endpoints.length; i++) {
+						endpoints[i].detachAll(params.fireEvent);
+					}
+				}
+			}
+			connectionsByScope = {};
+		};
+
+
+		/*
+		  Function: draggable 
+		  Initialises the draggability of some element or elements.  You should use this instead of your 
+		  library's draggable method so that jsPlumb can setup the appropriate callbacks.  Your 
+		  underlying library's drag method is always called from this method.
+		  
+		  Parameters: 
+		  	el - either an element id, a list of element ids, or a selector. 
+		  	options - options to pass through to the underlying library
+		  	 
+		  Returns: 
+		  	void
+		 */		 
+		this.draggable = function(el, options) {
+			if (typeof el == 'object' && el.length) {
+				for ( var i = 0; i < el.length; i++) {
+					var ele = _getElementObject(el[i]);
+					if (ele) _initDraggableIfNecessary(ele, true, options);
+				}
+			} 
+			else if (el._nodes) { 	// TODO this is YUI specific; really the logic should be forced
+				// into the library adapters (for jquery and mootools aswell)
+				for ( var i = 0; i < el._nodes.length; i++) {
+					var ele = _getElementObject(el._nodes[i]);
+					if (ele) _initDraggableIfNecessary(ele, true, options);
+				}
+			}
+			else {
+				var ele = _getElementObject(el);
+				if (ele) _initDraggableIfNecessary(ele, true, options);
+			}
+		};
+
+		/*
+		  Function: extend 
+		  Wraps the underlying library's extend functionality.
+		  
+		  Parameters: 
+		  	o1 - object to extend 
+		  	o2 - object to extend o1 with
+		  	
+		  Returns: 
+		  	o1, extended with all properties from o2.
+		 */
+		this.extend = function(o1, o2) {
+			return jsPlumb.CurrentLibrary.extend(o1, o2);
+		};
+		
+		/*
+		 * Function: getDefaultEndpointType
+		 * 	Returns the default Endpoint type. Used when someone wants to subclass Endpoint and have jsPlumb return instances of their subclass.
+		 *  you would make a call like this in your class's constructor:
+		 *  
+		 *  : jsPlumb.getDefaultEndpointType().apply(this, arguments);
+		 *  
+		 * 
+		 * Returns:
+		 * 	the default Endpoint function used by jsPlumb.
+		 */
+		this.getDefaultEndpointType = function() {
+			return Endpoint;
+		};
+		
+		/*
+		 * Function: getDefaultConnectionType
+		 * 	Returns the default Connection type. Used when someone wants to subclass Connection and have jsPlumb return instances of their subclass.
+		 *  you would make a call like this in your class's constructor:
+		 *  
+		 *  : jsPlumb.getDefaultConnectionType().apply(this, arguments);
+		 * 
+		 * Returns:
+		 * 	the default Connection function used by jsPlumb.
+		 */
+		this.getDefaultConnectionType = function() {
+			return Connection;
+		};
+
+		// helpers for select/selectEndpoints
+		var _setOperation = function(list, func, args, selector) {
+				for (var i = 0; i < list.length; i++) {
+					list[i][func].apply(list[i], args);
+				}	
+				return selector(list);
+			},
+			_getOperation = function(list, func, args) {
+				var out = [];
+				for (var i = 0; i < list.length; i++) {					
+					out.push([ list[i][func].apply(list[i], args), list[i] ]);
+				}	
+				return out;
+			},
+			setter = function(list, func, selector) {
+				return function() {
+					return _setOperation(list, func, arguments, selector);
+				};
+			},
+			getter = function(list, func) {
+				return function() {
+					return _getOperation(list, func, arguments);
+				};	
+			},
+			prepareList = function(input, doNotGetIds) {
+				var r = [];
+				if (input) {
+					if (typeof input == 'string') {
+						if (input === "*") return input;
+						r.push(input);
+					}
+					else {
+						if (doNotGetIds) r = input;
+						else { 
+							for (var i = 0; i < input.length; i++) 
+								r.push(_getId(_getElementObject(input[i])));
+						}	
+					}
+				}
+				return r;
+			},
+			filterList = function(list, value, missingIsFalse) {
+				if (list === "*") return true;
+				return list.length > 0 ? _indexOf(list, value) != -1 : !missingIsFalse;
+			};
+
+		/*
+		 * Function: getConnections 
+		 * Gets all or a subset of connections currently managed by this jsPlumb instance.  If only one scope is passed in to this method,
+		 * the result will be a list of connections having that scope (passing in no scope at all will result in jsPlumb assuming you want the
+		 * default scope).
+		 *
+		 * If multiple scopes are passed in, the return value will be a map of
+		 *
+		 * : { scope -> [ connection... ] }
+		 * 
+		 *  Parameters:
+		 *  	scope	-	if the only argument to getConnections is a string, jsPlumb will treat that string as a scope filter, and return a list
+		 *                  of connections that are in the given scope. use '*' for all scopes.
+		 *      options	-	if the argument is a JS object, you can specify a finer-grained filter:
+		 *      
+		 *      		-	*scope* may be a string specifying a single scope, or an array of strings, specifying multiple scopes. Also may have the value '*', indicating any scope.
+		 *      		-	*source* either a string representing an element id, a selector, or an array of ids. Also may have the value '*', indicating any source.  Constrains the result to connections having this/these element(s) as source.
+		 *      		-	*target* either a string representing an element id, a selector, or an array of ids. Also may have the value '*', indicating any target.  Constrains the result to connections having this/these element(s) as target.		 
+		 *		flat    -	return results in a flat array (don't return an object whose keys are scopes and whose values are lists per scope).
+		 * 
+		 */
+		this.getConnections = function(options, flat) {
+			if (!options) {
+				options = {};
+			} else if (options.constructor == String) {
+				options = { "scope": options };
+			}
+			var
+			scope = options.scope || _currentInstance.getDefaultScope(),
+			scopes = prepareList(scope, true),
+			sources = prepareList(options.source),
+			targets = prepareList(options.target),			
+			results = (!flat && scopes.length > 1) ? {} : [],
+			_addOne = function(scope, obj) {
+				if (!flat && scopes.length > 1) {
+					var ss = results[scope];
+					if (ss == null) {
+						ss = []; results[scope] = ss;
+					}
+					ss.push(obj);
+				} else results.push(obj);
+			};
+			for ( var i in connectionsByScope) {
+				if (filterList(scopes, i)) {
+					for ( var j = 0; j < connectionsByScope[i].length; j++) {
+						var c = connectionsByScope[i][j];
+						if (filterList(sources, c.sourceId) && filterList(targets, c.targetId))
+							_addOne(i, c);
+					}
+				}
+			}
+			return results;
+		};
+		
+		var _curryEach = function(list, executor) {
+				return function(f) {
+					for (var i = 0; i < list.length; i++) {
+						f(list[i]);
+					}
+					return executor(list);
+				};		
+			},
+			_curryGet = function(list) {
+				return function(idx) {
+					return list[idx];
+				};
+			};
+			
+		var _makeCommonSelectHandler = function(list, executor) {
+			return {
+				// setters
+				setHover:setter(list, "setHover", executor),								
+				removeAllOverlays:setter(list, "removeAllOverlays", executor),
+				setLabel:setter(list, "setLabel", executor),
+				addOverlay:setter(list, "addOverlay", executor),
+				removeOverlay:setter(list, "removeOverlay", executor),
+				removeOverlays:setter(list, "removeOverlays", executor),
+				showOverlay:setter(list, "showOverlay", executor),
+				hideOverlay:setter(list, "hideOverlay", executor),
+				showOverlays:setter(list, "showOverlays", executor),
+				hideOverlays:setter(list, "hideOverlays", executor),
+				setPaintStyle:setter(list, "setPaintStyle", executor),
+				setHoverPaintStyle:setter(list, "setHoverPaintStyle", executor),									
+				setParameter:setter(list, "setParameter", executor),		
+				setParameters:setter(list, "setParameters", executor),
+				setVisible:setter(list, "setVisible", executor),
+				setZIndex:setter(list, "setZIndex", executor),
+				repaint:setter(list, "repaint", executor),
+				addType:setter(list, "addType", executor),
+				toggleType:setter(list, "toggleType", executor),
+				removeType:setter(list, "removeType", executor),
+
+				// getters
+				getLabel:getter(list, "getLabel"),
+				getOverlay:getter(list, "getOverlay"),
+				isHover:getter(list, "isHover"),
+				getParameter:getter(list, "getParameter"),		
+				getParameters:getter(list, "getParameters"),
+				getPaintStyle:getter(list, "getPaintStyle"),		
+				getHoverPaintStyle:getter(list, "getHoverPaintStyle"),
+				isVisible:getter(list, "isVisible"),
+				getZIndex:getter(list, "getZIndex"),
+				hasType:getter(list, "hasType"),
+				getType:getter(list, "getType"),
+
+				// util
+				length:list.length,
+				each:_curryEach(list, executor),
+				get:_curryGet(list)
+			};
+		
+		};
+		
+		var	_makeConnectionSelectHandler = function(list) {
+			var common = _makeCommonSelectHandler(list, _makeConnectionSelectHandler);
+			return jsPlumb.CurrentLibrary.extend(common, {
+				// setters									
+				setDetachable:setter(list, "setDetachable", _makeConnectionSelectHandler),
+				setReattach:setter(list, "setReattach", _makeConnectionSelectHandler),
+				setConnector:setter(list, "setConnector", _makeConnectionSelectHandler),			
+				detach:function() {
+					for (var i = 0; i < list.length; i++)
+						_currentInstance.detach(list[i]);
+				},				
+				// getters
+				isDetachable:getter(list, "isDetachable"),
+				isReattach:getter(list, "isReattach")
+			});
+		};
+		
+		var	_makeEndpointSelectHandler = function(list) {
+			var common = _makeCommonSelectHandler(list, _makeEndpointSelectHandler);
+			return jsPlumb.CurrentLibrary.extend(common, {
+				setEnabled:setter(list, "setEnabled", _makeEndpointSelectHandler),
+				isEnabled:getter(list, "isEnabled"),
+				detachAll:function() {
+					for (var i = 0; i < list.length; i++)
+						list[i].detachAll();
+				},
+				"delete":function() {
+					for (var i = 0; i < list.length; i++)
+						_currentInstance.deleteEndpoint(list[i]);
+				}
+			});
+		};
+			
+		/*
+		* Function: select
+		* Selects a set of Connections, using the filter options from the getConnections method, and returns an object
+		* that allows you to perform an operation on all of the Connections at once.
+		*
+		* The return value from any of these operations is the original list of Connections, allowing operations to be
+		* chained (for 'setter' type operations). 'getter' type operations return an array of values, where each entry is
+		* of the form:
+		*
+		* : [ Connection, return value ]
+		* 
+		* Parameters:
+		*	scope - see getConnections
+		* 	source - see getConnections
+		*	target - see getConnections
+		*
+		* Returns:
+		* A list of Connections on which operations may be executed. 'Setter' type operations can be chained; 'getter' type operations
+		* return an array of [Connection, value] pairs, one entry for each Connection in the list returned. The full list of operations 
+		* is as follows (where not specified, the operation's effect or return value is the same as the corresponding method on Connection) :
+		* 
+		*	-	setHover								
+		*	-	removeAllOverlays
+		*	-	setLabel
+		*	-	addOverlay
+		*	-	removeOverlay
+		*	-	removeOverlays
+		*	-	showOverlay
+		*	-	hideOverlay
+		*	-	showOverlays
+		*	-	hideOverlays
+		*	-	setPaintStyle
+		*	-	setHoverPaintStyle
+		*	-	setDetachable
+		*	- 	setReattach
+		*	-	setConnector
+		*	-	setParameter
+		*	-	setParameters
+		*   - 	getLabel
+		*	-	getOverlay
+		*	-	isHover
+		*	-	isDetachable
+		*	-	isReattach
+		*	-	getParameter
+		*	-	getParameters
+		*	-	getPaintStyle
+		*	-	getHoverPaintStyle
+		*	-	detach : detaches all the connections in the list. not chainable and does not return anything.
+		*	-	length : returns the length of the list.
+		*	-	get(index) : returns the Connection at 'index' in the list.
+		*	-	each(function(connection)...) : allows you to specify your own function to execute; this function is chainable.
+		*/
+		this.select = function(params) {
+			params = params || {};
+			params.scope = params.scope || "*";
+			var c = _currentInstance.getConnections(params, true);
+			return _makeConnectionSelectHandler(c);							
+		};
+		
+		/*
+		* Function: selectEndpoints
+		* Selects a set of Endpoints and returns an object that allows you to execute various different methods on them at once. The return 
+		* value from any of these operations is the original list of Endpoints, allowing operations to be chained (for 'setter' type 
+		* operations). 'getter' type operations return an array of values, where each entry is of the form:
+		*
+		* : [ Endpoint, return value ]
+		* 
+		* Parameters:
+		*	scope - either a string or an array of strings.
+		* 	source - either a string, a dom element, or a selector, or an array of any mix of these. limits returned endpoints to those that are declared as a source endpoint on any elements identified.
+		*	target - either a string, a dom element, or a selector, or an array of any mix of these. limits returned endpoints to those that are declared as a target endpoint on any elements identified.
+		*	element - either a string, a dom element, or a selector, or an array of any mix of these. limits returned endpoints to those that are declared as either a source OR a target endpoint on any elements identified.		
+		*
+		* Returns:
+		* A list of Endpoints on which operations may be executed. 'Setter' type operations can be chained; 'getter' type operations
+		* return an array of [Endpoint, value] pairs, one entry for each Endpoint in the list returned. 
+		*
+		* The full list of operations is as follows (where not specified, the operation's effect or return value is the
+		* same as the corresponding method on Endpoint) :
+		* 
+		*	-	setHover								
+		*	-	removeAllOverlays
+		*	-	setLabel
+		*	-	addOverlay
+		*	-	removeOverlay
+		*	-	removeOverlays
+		*	-	showOverlay
+		*	-	hideOverlay
+		*	-	showOverlays
+		*	-	hideOverlays
+		*	-	setPaintStyle
+		*	-	setHoverPaintStyle
+		*	-	setParameter
+		*	-	setParameters
+		*   - 	getLabel
+		*	-	getOverlay
+		*	-	isHover
+		*	-	isDetachable
+		*	-	getParameter
+		*	-	getParameters
+		*	-	getPaintStyle
+		*	-	getHoverPaintStyle
+		*	-	detachAll : Detaches all the Connections from every Endpoint in the list. not chainable and does not return anything.
+		*	-	delete : Deletes every Endpoint in the list. not chainable and does not return anything.		
+		*	-	length : returns the length of the list.
+		*	-	get(index) : returns the Endpoint at 'index' in the list.
+		*	-	each(function(endpoint)...) : allows you to specify your own function to execute; this function is chainable.
+		*/
+		this.selectEndpoints = function(params) {
+			params = params || {};
+			params.scope = params.scope || "*";
+			var noElementFilters = !params.element && !params.source && !params.target,			
+				elements = noElementFilters ? "*" : prepareList(params.element),
+				sources = noElementFilters ? "*" : prepareList(params.source),
+				targets = noElementFilters ? "*" : prepareList(params.target),
+				scopes = prepareList(params.scope, true);
+			
+			var ep = [];
+			
+			for (var el in endpointsByElement) {
+				var either = filterList(elements, el, true),
+					source = filterList(sources, el, true),
+					sourceMatchExact = sources != "*",
+					target = filterList(targets, el, true),
+					targetMatchExact = targets != "*"; 
+					
+				// if they requested 'either' then just match scope. otherwise if they requested 'source' (not as a wildcard) then we have to match only endpoints that have isSource set to to true, and the same thing with isTarget.  
+				if ( either || source  || target ) {
+					inner:
+					for (var i = 0; i < endpointsByElement[el].length; i++) {
+						var _ep = endpointsByElement[el][i];
+						if (filterList(scopes, _ep.scope, true)) {
+						
+							var noMatchSource = (sourceMatchExact && sources.length > 0 && !_ep.isSource),
+								noMatchTarget = (targetMatchExact && targets.length > 0 && !_ep.isTarget);
+						
+							if (noMatchSource || noMatchTarget)								  
+								  continue inner; 
+							 							
+							ep.push(_ep);		
+						}
+					}
+				}					
+			}
+			
+			return _makeEndpointSelectHandler(ep);
+		};
+
+		/*
+		 * Function: getAllConnections
+		 * Gets all connections, as a map of the form:
+		 *
+		 * : { scope -> [ connection... ] } 
+		 */
+		this.getAllConnections = function() {
+			return connectionsByScope;
+		};
+
+		/*
+		 * Function: getDefaultScope 
+		 * Gets the default scope for connections and  endpoints.
+		 *
+		 * A scope defines a type of endpoint/connection; supplying a
+		 * scope to an Endpoint or Connection allows you to support different
+		 * types of connections in the same UI. but if you're only interested in
+		 * one type of connection, you don't need to supply a scope. this method
+		 * will probably be used by very few people; it's good for testing
+		 * though.
+		 */
+		this.getDefaultScope = function() {
+			return DEFAULT_SCOPE;
+		};
+
+		/*
+		  Function: getEndpoint 
+		  Gets an Endpoint by UUID
+		   
+		  Parameters: 
+		  	uuid - the UUID for the Endpoint
+		  	 
+		  Returns: 
+		  	Endpoint with the given UUID, null if nothing found.
+		 */
+		this.getEndpoint = _getEndpoint;
+				
+		/**
+		 * Function: getEndpoints
+		 * Gets the list of Endpoints for a given element.
+		 *
+		 * Parameters:
+		 * 	el - element id, dom element, or selector.
+		 *
+		 * Returns:
+		 * 	An array of Endpoints for the specified element.
+		 */
+		this.getEndpoints = function(el) {
+			return endpointsByElement[_getId(el)];
+		};		
+
+		/*
+		 * Gets an element's id, creating one if necessary. really only exposed
+		 * for the lib-specific functionality to access; would be better to pass
+		 * the current instance into the lib-specific code (even though this is
+		 * a static call. i just don't want to expose it to the public API).
+		 */
+		this.getId = _getId;
+		this.getOffset = function(id) { 
+			var o = offsets[id]; 
+			return _updateOffset({elId:id});
+		};
+		
+		/*
+		 * Function: getSelector
+		 * This method takes the given selector spec and, using the current underlying library, turns it into
+		 * a selector from that library.  This method exists really as a helper function for those applications
+		 * where you're writing jsPlumb code that will target more than one library (such as in the case of the
+		 * jsPlumb demo pages).
+		 *
+		 * Parameters:
+		 * 	spec 	-	a valid selector string.
+		 */ 	
+		this.getSelector = function(spec) {
+			return jsPlumb.CurrentLibrary.getSelector(spec);
+		};
+		
+		// get the size of the element with the given id, perhaps from cache.
+		this.getSize = function(id) { 
+			var s = sizes[id]; 
+			if (!s) _updateOffset({elId:id});
+			return sizes[id];
+		};		
+		
+		this.appendElement = _appendElement;
+		
+		var _hoverSuspended = false;
+		this.isHoverSuspended = function() { return _hoverSuspended; };
+		this.setHoverSuspended = function(s) { _hoverSuspended = s; };
+
+		var _isAvailable = function(m) {
+			return function() {
+				return jsPlumbAdapter.isRenderModeAvailable(m);
+			};
+		}
+		this.isCanvasAvailable = _isAvailable("canvas");
+		this.isSVGAvailable = _isAvailable("svg");
+		this.isVMLAvailable = _isAvailable("vml");
+
+		/*
+		  Function: hide 
+		  Sets an element's connections to be hidden.
+		  
+		  Parameters: 
+		  	el - either the id of the element, or a selector for the element.
+		  	changeEndpoints - whether not to also hide endpoints on the element. by default this is false.  
+		  	 
+		  Returns: 
+		  	void
+		 */
+		this.hide = function(el, changeEndpoints) {
+			_setVisible(el, "none", changeEndpoints);
+		};
+		
+		// exposed for other objects to use to get a unique id.
+		this.idstamp = _idstamp;
+		
+		/**
+		 * callback from the current library to tell us to prepare ourselves (attach
+		 * mouse listeners etc; can't do that until the library has provided a bind method)		 
+		 */
+		this.init = function() {
+			if (!initialized) {
+				_currentInstance.setRenderMode(_currentInstance.Defaults.RenderMode);  // calling the method forces the capability logic to be run.
+				
+				var bindOne = function(event) {
+						jsPlumb.CurrentLibrary.bind(document, event, function(e) {
+							if (!_currentInstance.currentlyDragging && renderMode == jsPlumb.CANVAS) {
+								// try connections first
+								for (var scope in connectionsByScope) {
+					    			var c = connectionsByScope[scope];
+					    			for (var i = 0; i < c.length; i++) {
+					    				var t = c[i].connector[event](e);
+					    				if (t) return;	
+					    			}
+					    		}
+								for (var el in endpointsByElement) {
+									var ee = endpointsByElement[el];
+									for (var i = 0; i < ee.length; i++) {
+										if (ee[i].endpoint[event](e)) return;
+									}
+								}
+							}
+						});					
+				};
+				bindOne("click");bindOne("dblclick");bindOne("mousemove");bindOne("mousedown");bindOne("mouseup");bindOne("contextmenu");
+			
+				initialized = true;
+				_currentInstance.fire("ready");
+			}
+		};
+		
+		this.log = log;
+		this.jsPlumbUIComponent = jsPlumbUIComponent;		
+
+		/*
+		 * Creates an anchor with the given params.
+		 * 
+		 * 
+		 * Returns: The newly created Anchor.
+		 */
+		this.makeAnchor = function() {
+			if (arguments.length == 0) return null;
+			var specimen = arguments[0], elementId = arguments[1], jsPlumbInstance = arguments[2], newAnchor = null;			
+			// if it appears to be an anchor already...
+			if (specimen.compute && specimen.getOrientation) return specimen;  //TODO hazy here about whether it should be added or is already added somehow.
+			// is it the name of an anchor type?
+			else if (typeof specimen == "string") {
+				newAnchor = jsPlumb.Anchors[arguments[0]]({elementId:elementId, jsPlumbInstance:_currentInstance});
+			}
+			// is it an array? it will be one of:
+			// 		an array of [name, params] - this defines a single anchor
+			//		an array of arrays - this defines some dynamic anchors
+			//		an array of numbers - this defines a single anchor.				
+			else if (_isArray(specimen)) {
+				if (_isArray(specimen[0]) || _isString(specimen[0])) {
+					if (specimen.length == 2 && _isString(specimen[0]) && _isObject(specimen[1])) {
+						var pp = jsPlumb.extend({elementId:elementId, jsPlumbInstance:_currentInstance}, specimen[1]);
+						newAnchor = jsPlumb.Anchors[specimen[0]](pp);
+					}
+					else
+						newAnchor = new DynamicAnchor(specimen, null, elementId);
+				}
+				else {
+					var anchorParams = {
+						x:specimen[0], y:specimen[1],
+						orientation : (specimen.length >= 4) ? [ specimen[2], specimen[3] ] : [0,0],
+						offsets : (specimen.length == 6) ? [ specimen[4], specimen[5] ] : [ 0, 0 ],
+						elementId:elementId
+					};						
+					newAnchor = new Anchor(anchorParams);
+					newAnchor.clone = function() { return new Anchor(anchorParams); };						 					
+				}
+			}
+			
+			if (!newAnchor.id) newAnchor.id = "anchor_" + _idstamp();
+			return newAnchor;
+		};
+
+		/**
+		 * makes a list of anchors from the given list of types or coords, eg
+		 * ["TopCenter", "RightMiddle", "BottomCenter", [0, 1, -1, -1] ]
+		 */
+		this.makeAnchors = function(types, elementId, jsPlumbInstance) {
+			var r = [];
+			for ( var i = 0; i < types.length; i++) {
+				if (typeof types[i] == "string")
+					r.push(jsPlumb.Anchors[types[i]]({elementId:elementId, jsPlumbInstance:jsPlumbInstance}));
+				else if (_isArray(types[i]))
+					r.push(_currentInstance.makeAnchor(types[i], elementId, jsPlumbInstance));
+			}
+			return r;
+		};
+
+		/**
+		 * Makes a dynamic anchor from the given list of anchors (which may be in shorthand notation as strings or dimension arrays, or Anchor
+		 * objects themselves) and the given, optional, anchorSelector function (jsPlumb uses a default if this is not provided; most people will
+		 * not need to provide this - i think). 
+		 */
+		this.makeDynamicAnchor = function(anchors, anchorSelector) {
+			return new DynamicAnchor(anchors, anchorSelector);
+		};
+		
+		/**
+		 * Function: makeTarget
+		 * Makes some DOM element a Connection target, allowing you to drag connections to it
+		 * without having to register any Endpoints on it first.  When a Connection is established,
+		 * the endpoint spec that was passed in to this method is used to create a suitable 
+		 * Endpoint (the default will be used if you do not provide one).
+		 * 
+		 * Parameters:
+		 *  el		-	string id or element selector for the element to make a target.
+		 * 	params	-	JS object containing parameters:
+		 * 	  - *endpoint*	optional.	specification of an Endpoint to create when a Connection is established.
+		 * 	  - *scope*		optional.   scope for the drop zone.
+		 * 	  - *dropOptions* optional. same stuff as you would pass to dropOptions of an Endpoint definition.
+		 * 	  - *deleteEndpointsOnDetach*  optional, defaults to true. whether or not to delete
+		 *                             any Endpoints created by a connection to this target if
+		 *                             the connection is subsequently detached. this will not 
+		 *                             remove Endpoints that have had more Connections attached
+		 *                             to them after they were created.
+		 *   - *maxConnections*  optional. Specifies the maximum number of Connections that can be made to this element as a target. Default is no limit.
+		 *   - *onMaxConnections* optional. Function to call when user attempts to drop a connection but the limit has been reached.
+		 *   		The callback is passed two arguments: a JS object with:
+		 *   		: { element, connection, maxConnection }
+		 *   		...and the original event.		 
+		 */
+		var _targetEndpointDefinitions = {},
+			_targetEndpoints = {},
+			_targetEndpointsUnique = {},
+			_targetMaxConnections = {},
+			_setEndpointPaintStylesAndAnchor = function(ep, epIndex) {
+				ep.paintStyle = ep.paintStyle ||
+				 				_currentInstance.Defaults.EndpointStyles[epIndex] ||
+	                            _currentInstance.Defaults.EndpointStyle ||
+	                            jsPlumb.Defaults.EndpointStyles[epIndex] ||
+	                            jsPlumb.Defaults.EndpointStyle;
+				ep.hoverPaintStyle = ep.hoverPaintStyle ||
+	                           _currentInstance.Defaults.EndpointHoverStyles[epIndex] ||
+	                           _currentInstance.Defaults.EndpointHoverStyle ||
+	                           jsPlumb.Defaults.EndpointHoverStyles[epIndex] ||
+	                           jsPlumb.Defaults.EndpointHoverStyle;                            
+
+				ep.anchor = ep.anchor ||
+	                      	_currentInstance.Defaults.Anchors[epIndex] ||
+	                      	_currentInstance.Defaults.Anchor ||
+	                      	jsPlumb.Defaults.Anchors[epIndex] ||
+	                      	jsPlumb.Defaults.Anchor;                           
+					
+				ep.endpoint = ep.endpoint ||
+							  _currentInstance.Defaults.Endpoints[epIndex] ||
+							  _currentInstance.Defaults.Endpoint ||
+							  jsPlumb.Defaults.Endpoints[epIndex] ||
+							  jsPlumb.Defaults.Endpoint;
+			};
+
+		this.makeTarget = function(el, params, referenceParams) {						
+			
+			var p = jsPlumb.extend({_jsPlumb:_currentInstance}, referenceParams);
+			jsPlumb.extend(p, params);
+			_setEndpointPaintStylesAndAnchor(p, 1);                                                    
+			var jpcl = jsPlumb.CurrentLibrary,
+			    targetScope = p.scope || _currentInstance.Defaults.Scope,
+			    deleteEndpointsOnDetach = !(p.deleteEndpointsOnDetach === false),
+			    maxConnections = p.maxConnections || -1,
+				onMaxConnections = p.onMaxConnections;
+			_doOne = function(_el) {
+				
+				// get the element's id and store the endpoint definition for it.  jsPlumb.connect calls will look for one of these,
+				// and use the endpoint definition if found.
+				var elid = _getId(_el);
+				_targetEndpointDefinitions[elid] = p;
+				_targetEndpointsUnique[elid] = p.uniqueEndpoint,
+				_targetMaxConnections[elid] = maxConnections,
+				_targetsEnabled[elid] = true,
+				proxyComponent = new jsPlumbUIComponent(p);								
+				
+				var dropOptions = jsPlumb.extend({}, p.dropOptions || {}),
+				_drop = function() {
+
+					var originalEvent = jsPlumb.CurrentLibrary.getDropEvent(arguments),
+						targetCount = _currentInstance.select({target:elid}).length;																							
+
+					_currentInstance.currentlyDragging = false;
+					var draggable = _getElementObject(jpcl.getDragObject(arguments)),
+						id = _getAttribute(draggable, "dragId"),				
+						// restore the original scope if necessary (issue 57)
+						scope = _getAttribute(draggable, "originalScope"),
+						jpc = floatingConnections[id],
+						source = jpc.endpoints[0],
+						_endpoint = p.endpoint ? jsPlumb.extend({}, p.endpoint) : {};
+						
+					if (!_targetsEnabled[elid] || _targetMaxConnections[elid] > 0 && targetCount >= _targetMaxConnections[elid]){
+						if (onMaxConnections) {
+							onMaxConnections({
+								element:_el,
+								connection:jpc
+							}, originalEvent);
+						}
+						return false;
+					}
+
+					// unlock the source anchor to allow it to refresh its position if necessary
+					source.anchor.locked = false;					
+										
+					if (scope) jpcl.setDragScope(draggable, scope);				
+					
+					// check if drop is allowed here.					
+					//var _continue = jpc.isDropAllowed(jpc.sourceId, _getId(_el), jpc.scope);		
+					var _continue = proxyComponent.isDropAllowed(jpc.sourceId, _getId(_el), jpc.scope, jpc, null);		
+					
+					// regardless of whether the connection is ok, reconfigure the existing connection to 
+					// point at the current info. we need this to be correct for the detach event that will follow.
+					// clear the source endpoint from the list to detach. we will detach this connection at this
+					// point, but we want to keep the source endpoint.  the target is a floating endpoint and should
+					// be removed.  TODO need to figure out whether this code can result in endpoints kicking around
+					// when they shouldnt be.  like is this a full detach of a connection?  can it be?
+					if (jpc.endpointsToDeleteOnDetach) {
+						if (source === jpc.endpointsToDeleteOnDetach[0])
+							jpc.endpointsToDeleteOnDetach[0] = null;
+						else if (source === jpc.endpointsToDeleteOnDetach[1])
+							jpc.endpointsToDeleteOnDetach[1] = null;
+					}
+					// reinstate any suspended endpoint; this just puts the connection back into
+					// a state in which it will report sensible values if someone asks it about
+					// its target.  we're going to throw this connection away shortly so it doesnt matter
+					// if we manipulate it a bit.
+					if (jpc.suspendedEndpoint) {
+						jpc.targetId = jpc.suspendedEndpoint.elementId;
+						jpc.target = jpcl.getElementObject(jpc.suspendedEndpoint.elementId);
+						jpc.endpoints[1] = jpc.suspendedEndpoint;
+					}																										
+					
+					if (_continue) {
+					
+						// detach this connection from the source.						
+						source.detach(jpc, false, true, false);
+					
+						// make a new Endpoint for the target												
+						var newEndpoint = _targetEndpoints[elid] || _currentInstance.addEndpoint(_el, p);
+						if (p.uniqueEndpoint) _targetEndpoints[elid] = newEndpoint;  // may of course just store what it just pulled out. that's ok.
+						newEndpoint._makeTargetCreator = true;
+																
+						// if the anchor has a 'positionFinder' set, then delegate to that function to find
+						// out where to locate the anchor.
+						if (newEndpoint.anchor.positionFinder != null) {
+							var dropPosition = jpcl.getUIPosition(arguments, _currentInstance.getZoom()),
+							elPosition = _getOffset(_el, _currentInstance),
+							elSize = _getSize(_el),
+							ap = newEndpoint.anchor.positionFinder(dropPosition, elPosition, elSize, newEndpoint.anchor.constructorParams);
+							newEndpoint.anchor.x = ap[0];
+							newEndpoint.anchor.y = ap[1];
+							// now figure an orientation for it..kind of hard to know what to do actually. probably the best thing i can do is to
+							// support specifying an orientation in the anchor's spec. if one is not supplied then i will make the orientation 
+							// be what will cause the most natural link to the source: it will be pointing at the source, but it needs to be
+							// specified in one axis only, and so how to make that choice? i think i will use whichever axis is the one in which
+							// the target is furthest away from the source.
+						}
+						var c = _currentInstance.connect({
+							source:source,
+							target:newEndpoint,
+							scope:scope,
+							previousConnection:jpc,
+							container:jpc.parent,
+							deleteEndpointsOnDetach:deleteEndpointsOnDetach,
+							// 'endpointWillMoveAfterConnection' is set by the makeSource function, and it indicates that the
+							// given endpoint will actually transfer from the element it is currently attached to to some other
+							// element after a connection has been established.  in that case, we do not want to fire the
+							// connection event, since it will have the wrong data in it; makeSource will do it for us.
+							// this is controlled by the 'parent' parameter on a makeSource call.
+							doNotFireConnectionEvent:source.endpointWillMoveAfterConnection
+						});
+
+						// delete the original target endpoint.  but only want to do this if the endpoint was created
+						// automatically and has no other connections.
+						if (jpc.endpoints[1]._makeTargetCreator && jpc.endpoints[1].connections.length < 2)
+							_currentInstance.deleteEndpoint(jpc.endpoints[1]);
+
+						if (deleteEndpointsOnDetach) 
+							c.endpointsToDeleteOnDetach = [ source, newEndpoint ];
+
+						c.repaint();
+					}				
+					// if not allowed to drop...
+					else {
+						// TODO this code is identical (pretty much) to what happens when a connection
+						// dragged from a normal endpoint is in this situation. refactor.
+						// is this an existing connection, and will we reattach?
+						if (jpc.suspendedEndpoint) {
+							//if (source.isReattach) {
+							if (jpc.isReattach()) {
+								jpc.setHover(false);
+								jpc.floatingAnchorIndex = null;
+								jpc.suspendedEndpoint.addConnection(jpc);
+								_currentInstance.repaint(source.elementId);
+							}
+							else
+								source.detach(jpc, false, true, true, originalEvent);  // otherwise, detach the connection and tell everyone about it.
+						}
+						
+					}														
+				};
+				
+				var dropEvent = jpcl.dragEvents['drop'];
+				dropOptions["scope"] = dropOptions["scope"] || targetScope;
+				dropOptions[dropEvent] = _wrap(dropOptions[dropEvent], _drop);
+				
+				jpcl.initDroppable(_el, dropOptions, true);
+			};
+			
+			el = _convertYUICollection(el);			
+			
+			var inputs = el.length && el.constructor != String ? el : [ el ];
+						
+			for (var i = 0; i < inputs.length; i++) {			
+				_doOne(_getElementObject(inputs[i]));
+			}
+
+			return _currentInstance;
+		};
+
+		/*
+		*	Function: unmakeTarget
+		*	Sets the given element to no longer be a connection target.
+		*	
+		*	Parameters:
+		*		el - a string id, a dom element, or a selector representing the element.
+		*		
+		*	Returns:
+		*	The current jsPlumb instance.
+		*/
+		this.unmakeTarget = function(el, doNotClearArrays) {
+			el = jsPlumb.CurrentLibrary.getElementObject(el);
+			var elid = _getId(el);			
+
+			// TODO this is not an exhaustive unmake of a target, since it does not remove the droppable stuff from
+			// the element.  the effect will be to prevent it form behaving as a target, but it's not completely purged.
+			if (!doNotClearArrays) {
+				delete _targetEndpointDefinitions[elid];
+				delete _targetEndpointsUnique[elid];
+				delete _targetMaxConnections[elid];
+				delete _targetsEnabled[elid];
+			}
+
+			return _currentInstance;
+		};
+		
+		/*
+		 * Function: makeTargets
+		 * Makes all elements in some array or a selector connection targets.
+		 * 
+		 * Parameters:
+		 * 	els 	- 	either an array of ids or a selector
+		 *  params  -   parameters to configure each element as a target with
+		 *  referenceParams - extra parameters to configure each element as a taretsource with.
+		 *
+		 * Returns:
+		 * The current jsPlumb instance.
+		 */
+		this.makeTargets = function(els, params, referenceParams) {
+			for ( var i = 0; i < els.length; i++) {
+				_currentInstance.makeTarget(els[i], params, referenceParams);				
+			}
+		};
+		
+		/**
+		 * Function: makeSource
+		 * Makes some DOM element a Connection source, allowing you to drag connections from it
+		 * without having to register any Endpoints on it first.  When a Connection is established,
+		 * the endpoint spec that was passed in to this method is used to create a suitable 
+		 * Endpoint (the default will be used if you do not provide one).
+		 * 
+		 * Parameters:
+		 *  el		-	string id or element selector for the element to make a source.
+		 * 	params	-	JS object containing parameters:
+		 * 	  - *endpoint*	optional.	specification of an endpoint to create when a connection is created.
+		 * 	  - *parent*	optional.   the element to add Endpoints to when a Connection is established.  if you omit this, 
+		 *                          Endpoints will be added to 'el'.
+		 * 	  - *scope*		optional.   scope for the connections dragged from this element.
+		 * 	  - *dragOptions* optional. same stuff as you would pass to dragOptions of an Endpoint definition.
+		 * 	  - *deleteEndpointsOnDetach*  optional, defaults to false. whether or not to delete
+		 *                             any Endpoints created by a connection from this source if
+		 *                             the connection is subsequently detached. this will not 
+		 *                             remove Endpoints that have had more Connections attached
+		 *                             to them after they were created.
+		 * 	  - *filter* - optional function to call when the user presses the mouse button to start a drag. This function is passed the original 
+		 * event and the element on which the associated makeSource call was made.  If it returns anything other than false,
+		 * the drag begins as usual. But if it returns false (the boolean false, not just something falsey), the drag is aborted.
+		 *                   	
+		 * 
+		 */
+		var _sourceEndpointDefinitions = {},
+			_sourceEndpoints = {},
+			_sourceEndpointsUnique = {},
+			_sourcesEnabled = {},
+			_sourceTriggers = {},
+			_sourceMaxConnections = {},
+			_targetsEnabled = {};
+
+		this.makeSource = function(el, params, referenceParams) {
+			var p = jsPlumb.extend({}, referenceParams);
+			jsPlumb.extend(p, params);
+			_setEndpointPaintStylesAndAnchor(p, 0);   
+			var jpcl = jsPlumb.CurrentLibrary,
+				maxConnections = p.maxConnections || -1,
+				onMaxConnections = p.onMaxConnections,
+			_doOne = function(_el) {
+				// get the element's id and store the endpoint definition for it.  jsPlumb.connect calls will look for one of these,
+				// and use the endpoint definition if found.
+				var elid = _getId(_el),
+					parent = p.parent,
+					idToRegisterAgainst = parent != null ? _currentInstance.getId(jpcl.getElementObject(parent)) : elid;
+				
+				_sourceEndpointDefinitions[idToRegisterAgainst] = p;
+				_sourceEndpointsUnique[idToRegisterAgainst] = p.uniqueEndpoint;
+				_sourcesEnabled[idToRegisterAgainst] = true;
+
+				var stopEvent = jpcl.dragEvents["stop"],
+					dragEvent = jpcl.dragEvents["drag"],
+					dragOptions = jsPlumb.extend({ }, p.dragOptions || {}),
+					existingDrag = dragOptions.drag,
+					existingStop = dragOptions.stop,
+					ep = null,
+					endpointAddedButNoDragYet = false;
+				
+				_sourceMaxConnections[idToRegisterAgainst] = maxConnections;	
+
+				// set scope if its not set in dragOptions but was passed in in params
+				dragOptions["scope"] = dragOptions["scope"] || p.scope;
+
+				dragOptions[dragEvent] = _wrap(dragOptions[dragEvent], function() {
+					if (existingDrag) existingDrag.apply(this, arguments);
+					endpointAddedButNoDragYet = false;
+				});
+					
+				dragOptions[stopEvent] = _wrap(dragOptions[stopEvent], function() { 							
+					if (existingStop) existingStop.apply(this, arguments);								
+
+                    //_currentlyDown = false;
+					_currentInstance.currentlyDragging = false;
+					
+					if (ep.connections.length == 0)
+						_currentInstance.deleteEndpoint(ep);
+					else {
+						
+						jpcl.unbind(ep.canvas, "mousedown"); 
+								
+						// reset the anchor to the anchor that was initially provided. the one we were using to drag
+						// the connection was just a placeholder that was located at the place the user pressed the
+						// mouse button to initiate the drag.
+						var anchorDef = p.anchor || _currentInstance.Defaults.Anchor,
+							oldAnchor = ep.anchor,
+							oldConnection = ep.connections[0];
+
+						ep.anchor = _currentInstance.makeAnchor(anchorDef, elid, _currentInstance);																							
+						
+						if (p.parent) {						
+							var parent = jpcl.getElementObject(p.parent);
+							if (parent) {	
+								var currentId = ep.elementId;
+											
+								var potentialParent = p.container || _currentInstance.Defaults.Container || jsPlumb.Defaults.Container;			
+																
+								ep.setElement(parent, potentialParent);
+								ep.endpointWillMoveAfterConnection = false;														
+								_currentInstance.anchorManager.rehomeEndpoint(currentId, parent);													
+								oldConnection.previousConnection = null;
+								// remove from connectionsByScope
+								_removeWithFunction(connectionsByScope[oldConnection.scope], function(c) {
+									return c.id === oldConnection.id;
+								});										
+								_currentInstance.anchorManager.connectionDetached({
+									sourceId:oldConnection.sourceId,
+									targetId:oldConnection.targetId,
+									connection:oldConnection
+								});											
+								_finaliseConnection(oldConnection);					
+							}
+						}						
+						
+						ep.repaint();			
+						_currentInstance.repaint(ep.elementId);																		
+						_currentInstance.repaint(oldConnection.targetId);
+
+					}				
+				});
+				// when the user presses the mouse, add an Endpoint, if we are enabled.
+				var mouseDownListener = function(e) {
+
+					// if disabled, return.
+					if (!_sourcesEnabled[idToRegisterAgainst]) return;
+					
+					// if maxConnections reached
+					var sourceCount = _currentInstance.select({source:idToRegisterAgainst}).length
+					if (_sourceMaxConnections[idToRegisterAgainst] >= 0 && sourceCount >= _sourceMaxConnections[idToRegisterAgainst]) {
+						if (onMaxConnections) {
+							onMaxConnections({
+								element:_el,
+								maxConnections:maxConnections
+							}, e);
+						}
+						return false;
+					}
+
+					// if a filter was given, run it, and return if it says no.
+					if (params.filter) {
+						// pass the original event to the user: 
+						var r = params.filter(jpcl.getOriginalEvent(e), _el);
+						if (r === false) return;
+					}
+
+					// make sure we have the latest offset for this div 
+					var myOffsetInfo = _updateOffset({elId:elid});		
+
+					var x = ((e.pageX || e.page.x) - myOffsetInfo.left) / myOffsetInfo.width, 
+					    y = ((e.pageY || e.page.y) - myOffsetInfo.top) / myOffsetInfo.height,
+					    parentX = x, 
+					    parentY = y;					
+							
+					// if there is a parent, the endpoint will actually be added to it now, rather than the div
+					// that was the source.  in that case, we have to adjust the anchor position so it refers to
+					// the parent.
+					if (p.parent) {
+						var pEl = jpcl.getElementObject(p.parent),
+							pId = _getId(pEl);
+						myOffsetInfo = _updateOffset({elId:pId});
+						parentX = ((e.pageX || e.page.x) - myOffsetInfo.left) / myOffsetInfo.width, 
+					    parentY = ((e.pageY || e.page.y) - myOffsetInfo.top) / myOffsetInfo.height;
+					}											
+					
+					// we need to override the anchor in here, and force 'isSource', but we don't want to mess with
+					// the params passed in, because after a connection is established we're going to reset the endpoint
+					// to have the anchor we were given.
+					var tempEndpointParams = {};
+					jsPlumb.extend(tempEndpointParams, p);
+					tempEndpointParams.isSource = true;
+					tempEndpointParams.anchor = [x,y,0,0];
+					tempEndpointParams.parentAnchor = [ parentX, parentY, 0, 0 ];
+					tempEndpointParams.dragOptions = dragOptions;
+					// if a parent was given we need to turn that into a "container" argument.  this is, by default,
+					// the parent of the element we will move to, so parent of p.parent in this case.  however, if
+					// the user has specified a 'container' on the endpoint definition or on 
+					// the defaults, we should use that.
+					if (p.parent) {
+						var potentialParent = tempEndpointParams.container || _currentInstance.Defaults.Container || jsPlumb.Defaults.Container;
+						if (potentialParent)
+							tempEndpointParams.container = potentialParent;
+						else
+							tempEndpointParams.container = jsPlumb.CurrentLibrary.getParent(p.parent);
+					}
+					
+					ep = _currentInstance.addEndpoint(elid, tempEndpointParams);
+
+					endpointAddedButNoDragYet = true;
+					// we set this to prevent connections from firing attach events before this function has had a chance
+					// to move the endpoint.
+					ep.endpointWillMoveAfterConnection = p.parent != null;
+					ep.endpointWillMoveTo = p.parent ? jpcl.getElementObject(p.parent) : null;
+
+                    var _delTempEndpoint = function() {
+						// this mouseup event is fired only if no dragging occurred, by jquery and yui, but for mootools
+						// it is fired even if dragging has occurred, in which case we would blow away a perfectly
+						// legitimate endpoint, were it not for this check.  the flag is set after adding an
+						// endpoint and cleared in a drag listener we set in the dragOptions above.
+						if(endpointAddedButNoDragYet) {
+							_currentInstance.deleteEndpoint(ep);
+                        }
+					};
+
+					_currentInstance.registerListener(ep.canvas, "mouseup", _delTempEndpoint);
+                    _currentInstance.registerListener(_el, "mouseup", _delTempEndpoint);
+					
+					// and then trigger its mousedown event, which will kick off a drag, which will start dragging
+					// a new connection from this endpoint.
+					jpcl.trigger(ep.canvas, "mousedown", e);
+				};
+               
+                // register this on jsPlumb so that it can be cleared by a reset.
+                _currentInstance.registerListener(_el, "mousedown", mouseDownListener);
+                _sourceTriggers[elid] = mouseDownListener;
+			};
+			
+			el = _convertYUICollection(el);			
+			
+			var inputs = el.length && el.constructor != String ? el : [ el ];
+						
+			for (var i = 0; i < inputs.length; i++) {			
+				_doOne(_getElementObject(inputs[i]));
+			}
+
+			return _currentInstance;
+		};
+
+		/**
+		*	Function: unmakeSource
+		*	Sets the given element to no longer be a connection source.
+		*	
+		*	Parameters:
+		*		el - a string id, a dom element, or a selector representing the element.
+		*		
+		*	Returns:
+		*	The current jsPlumb instance.
+		*/
+		this.unmakeSource = function(el, doNotClearArrays) {
+			el = jsPlumb.CurrentLibrary.getElementObject(el);
+			var id = _getId(el),
+				mouseDownListener = _sourceTriggers[id];
+			
+			if (mouseDownListener) 
+				_currentInstance.unregisterListener(_el, "mousedown", mouseDownListener);
+
+			if (!doNotClearArrays) {
+				delete _sourceEndpointDefinitions[id];
+				delete _sourceEndpointsUnique[id];
+				delete _sourcesEnabled[id];
+				delete _sourceTriggers[id];
+				delete _sourceMaxConnections[id];
+			}
+
+			return _currentInstance;
+		};
+
+		/*
+		*	Function: unmakeEverySource
+		*	Resets all elements in this instance of jsPlumb so that none of them are connection sources.
+		*	
+		*	Returns:
+		*	The current jsPlumb instance.
+		*/
+		this.unmakeEverySource = function() {
+			for (var i in _sourcesEnabled)
+				_currentInstance.unmakeSource(i, true);
+
+			_sourceEndpointDefinitions = {};
+			_sourceEndpointsUnique = {};
+			_sourcesEnabled = {};
+			_sourceTriggers = {};
+		};
+
+		/*
+		*	Function: unmakeEveryTarget
+		*	Resets all elements in this instance of jsPlumb so that none of them are connection targets.
+		*	
+		*	Returns:
+		*	The current jsPlumb instance.
+		*/
+		this.unmakeEveryTarget = function() {
+			for (var i in _targetsEnabled)
+				_currentInstance.unmakeTarget(i, true);
+			
+			_targetEndpointDefinitions = {};
+			_targetEndpointsUnique = {};
+			_targetMaxConnections = {};
+			_targetsEnabled = {};
+
+			return _currentInstance;
+		};
+		
+		/*
+		 * Function: makeSources
+		 * Makes all elements in some array or a selector connection sources.
+		 * 
+		 * Parameters:
+		 * 	els 	- 	either an array of ids or a selector
+		 *  params  -   parameters to configure each element as a source with
+		 *  referenceParams - extra parameters to configure each element as a source with.
+		 *
+		 * Returns:
+		 * The current jsPlumb instance.
+		 */
+		this.makeSources = function(els, params, referenceParams) {
+			for ( var i = 0; i < els.length; i++) {
+				_currentInstance.makeSource(els[i], params, referenceParams);				
+			}
+
+			return _currentInstance;
+		};
+
+		// does the work of setting a source enabled or disabled.
+		var _setEnabled = function(type, el, state, toggle) {
+			var a = type == "source" ? _sourcesEnabled : _targetsEnabled;									
+
+			if (_isString(el)) a[el] = toggle ? !a[el] : state;
+			else if (el.length) {
+				el = _convertYUICollection(el);
+				for (var i = 0; i < el.length; i++) {
+					var id = _el = jsPlumb.CurrentLibrary.getElementObject(el[i]), id = _getId(_el);
+					a[id] = toggle ? !a[id] : state;
+				}
+			}	
+			return _currentInstance;
+		};
+
+		/*
+		* Function: setSourceEnabled
+		* Sets the enabled state of one or more elements that were previously made a connection source with the makeSource
+		* method.
+		*
+		* Parameters:
+		*	el 	- 	either a string representing some element's id, or an array of ids, or a selector.
+		*	state - true to enable the element(s), false to disable it.
+		*
+		* Returns:
+		*	The current jsPlumb instance.
+		*/
+		this.setSourceEnabled = function(el, state) {
+			return _setEnabled("source", el, state);
+		};
+
+		/*
+		*	Function: toggleSourceEnabled
+		*	Toggles the source enabled state of the given element or elements.
+		*
+		* 	Parameters:
+		*		el 	- 	either a string representing some element's id, or an array of ids, or a selector.
+		*		state - true to enable the element(s), false to disable it.
+		*
+		*	Returns:
+		*	The current enabled state of the source.
+		*/	
+		this.toggleSourceEnabled = function(el) {
+			_setEnabled("source", el, null, true);	
+			return _currentInstance.isSourceEnabled(el);
+		};
+
+		/*
+		*	Function: isSource
+		*	Returns whether or not the given element is registered as a connection source.
+		*
+		*	Parameters:
+		*		el 	- 	a string id, a dom element, or a selector representing a single element.
+		*
+		*	Returns:
+		*	True if source, false if not.
+		*/
+		this.isSource = function(el) {
+			el = jsPlumb.CurrentLibrary.getElementObject(el);
+			return _sourcesEnabled[_getId(el)] != null;
+		};
+
+		/*
+		*	Function: isSourceEnabled
+		*	Returns whether or not the given connection source is enabled.
+		*
+		*	Parameters:
+		*	el 	- 	a string id, a dom element, or a selector representing a single element.
+		*
+		*	Returns:
+		*	True if enabled, false if not.
+		*/
+		this.isSourceEnabled = function(el) {
+			el = jsPlumb.CurrentLibrary.getElementObject(el);
+			return _sourcesEnabled[_getId(el)] === true;
+		};
+
+		/*
+		*	Function: setTargetEnabled
+		*	Sets the enabled state of one or more elements that were previously made a connection target with the makeTarget method.
+		*	method.
+		*
+		*	Parameters:
+		*		el 	- 	either a string representing some element's id, or an array of ids, or a selector.
+		*		state - true to enable the element(s), false to disable it.
+		*
+		*	Returns:
+		*	The current jsPlumb instance.
+		*/
+		this.setTargetEnabled = function(el, state) {
+			return _setEnabled("target", el, state);
+		};
+
+		/*
+		*	Function: toggleTargetEnabled
+		*	Toggles the target enabled state of the given element or elements.
+		*
+		*	Parameters:
+		*		el 	- 	either a string representing some element's id, or an array of ids, or a selector.
+		*		state - true to enable the element(s), false to disable it.
+		*
+		*	Returns:
+		*	The current enabled state of the target.
+		*/	
+		this.toggleTargetEnabled = function(el) {
+			return _setEnabled("target", el, null, true);	
+			return _currentInstance.isTargetEnabled(el);
+		};
+
+		/*
+			Function: isTarget
+			Returns whether or not the given element is registered as a connection target.
+
+			Parameters:
+				el 	- 	a string id, a dom element, or a selector representing a single element.
+
+			Returns:
+			True if source, false if not.
+		*/
+		this.isTarget = function(el) {
+			el = jsPlumb.CurrentLibrary.getElementObject(el);
+			return _targetsEnabled[_getId(el)] != null;
+		};
+
+		/*
+			Function: isTargetEnabled
+			Returns whether or not the given connection target is enabled.
+
+			Parameters:
+				el 	- 	a string id, a dom element, or a selector representing a single element.
+
+			Returns:
+			True if enabled, false if not.
+		*/
+		this.isTargetEnabled = function(el) {
+			el = jsPlumb.CurrentLibrary.getElementObject(el);
+			return _targetsEnabled[_getId(el)] === true;
+		};
+		
+		/*
+		* Function: ready
+		* Helper method to bind a function to jsPlumb's ready event. You should use this method instead of your
+		* library's equivalent, to ensure that jsPlumb has loaded properly before you start to use it. This is
+		* particularly true in the case of YUI, because of the asynchronous nature of the module loading process.
+		 */
+		this.ready = function(fn) {
+			_currentInstance.bind("ready", fn);
+		};
+
+		/*
+		* Function: repaint 
+		* Repaints an element and its connections. This method gets new sizes for the elements before painting anything.
+		*  
+		* Parameters: 
+		*	el - id of the element, a dom element, or a selector representing the element.
+		*  	 
+		* Returns: 
+		*	The current jsPlumb instance.
+		*  	 
+		* See Also: 
+		*	<repaintEverything>
+		*/
+		this.repaint = function(el, ui, timestamp) {
+			// support both lists...
+			if (typeof el == 'object')
+				for ( var i = 0; i < el.length; i++) {			
+					_draw(_getElementObject(el[i]), ui, timestamp);
+				}
+			else // ...and single strings.				
+				_draw(_getElementObject(el), ui, timestamp);
+				
+			return _currentInstance;
+		};
+
+		/*
+		* Function: repaintEverything 
+		* Repaints all connections.
+		*  
+		* Returns: 
+		*	The current jsPlumb instance.
+		* 	
+		* See Also: 
+		*	<repaint>
+		*/
+		this.repaintEverything = function() {				
+			for ( var elId in endpointsByElement) {
+				_draw(_getElementObject(elId));
+			}
+			return _currentInstance;
+		};
+
+		/*
+		* Function: removeAllEndpoints 
+		* Removes all Endpoints associated with a given element. Also removes all Connections associated with each Endpoint it removes.
+		* 
+		* Parameters: 
+		*	el - either an element id, or a selector for an element.
+		*  	 
+		* Returns: 
+		* The current jsPlumb instance.
+		*  	 
+		* See Also: 
+		* <removeEndpoint>
+		*/
+		this.removeAllEndpoints = function(el) {
+			var elId = _getAttribute(el, "id"),
+			    ebe = endpointsByElement[elId];
+			if (ebe) {
+				for ( var i = 0; i < ebe.length; i++) 
+					_currentInstance.deleteEndpoint(ebe[i]);
+			}
+			endpointsByElement[elId] = [];
+			delete endpointsByElement[elId];//API_FATAL_BUG_FIX hogehogehogehoge
+			return _currentInstance;
+		};
+		
+
+		var _registeredListeners = {},
+			_unbindRegisteredListeners = function() {
+				for (var i in _registeredListeners) {
+					for (var j = 0; j < _registeredListeners[i].length; j++) {
+						var info = _registeredListeners[i][j];
+						jsPlumb.CurrentLibrary.unbind(info.el, info.event, info.listener);
+					}
+				}
+				_registeredListeners = {};
+			};
+
+        // internal register listener method.  gives us a hook to clean things up
+        // with if the user calls jsPlumb.reset.
+        this.registerListener = function(el, type, listener) {
+            jsPlumb.CurrentLibrary.bind(el, type, listener);
+            _addToList(_registeredListeners, type, {el:el, event:type, listener:listener});
+        };
+
+        this.unregisterListener = function(el, type, listener) {
+        	jsPlumb.CurrentLibrary.unbind(el, type, listener);
+        	_removeWithFunction(_registeredListeners, function(rl) {
+        		return rl.type == type && rl.listener == listener;
+        	});
+        };
+
+		/*
+		* Function:reset 
+		* Removes all endpoints and connections and clears the listener list. To keep listeners call
+		* : jsPlumb.deleteEveryEndpoint()
+		* instead of this.
+		*/
+		this.reset = function() {			
+			_currentInstance.deleteEveryEndpoint();
+			_currentInstance.unbind();
+			_targetEndpointDefinitions = {};
+			_targetEndpoints = {};
+			_targetEndpointsUnique = {};
+			_targetMaxConnections = {};
+			_sourceEndpointDefinitions = {};
+			_sourceEndpoints = {};
+			_sourceEndpointsUnique = {};
+			_sourceMaxConnections = {};
+			_unbindRegisteredListeners();
+			_currentInstance.anchorManager.reset();
+			if (!jsPlumbAdapter.headless)
+				_currentInstance.dragManager.reset();
+		};
+		
+		/*
+		 * Function: setDefaultScope 
+		 * Sets the default scope for Connections and Endpoints. A scope defines a type of Endpoint/Connection; supplying a
+		 * scope to an Endpoint or Connection allows you to support different
+		 * types of Connections in the same UI.  If you're only interested in
+		 * one type of Connection, you don't need to supply a scope. This method
+		 * will probably be used by very few people; it just instructs jsPlumb
+		 * to use a different key for the default scope.
+		 * 
+		 * Parameters:
+		 * 	scope - scope to set as default.
+		 *
+		 * Returns:
+		 * The current jsPlumb instance.
+		 */
+		this.setDefaultScope = function(scope) {
+			DEFAULT_SCOPE = scope;
+			return _currentInstance;
+		};
+
+		/*
+		 * Function: setDraggable 
+		 * Sets whether or not a given element is
+		 * draggable, regardless of what any jsPlumb command may request.
+		 * 
+		 * Parameters: 
+		 * 	el - either the id for the element, or a selector representing the element.
+		 * 	draggable - whether or not the element should be draggable.
+		 *  
+		 * Returns: 
+		 * 	void
+		 */
+		this.setDraggable = _setDraggable;
+
+		/*
+		* Function: setId
+		* Changes the id of some element, adjusting all connections and endpoints
+		*
+		* Parameters:
+		* 	el - a selector, a DOM element, or a string. 
+		* 	newId - string.
+		*/
+		this.setId = function(el, newId, doNotSetAttribute) {
+		
+			var id = el.constructor == String ? el : _currentInstance.getId(el),
+				sConns = _currentInstance.getConnections({source:id, scope:'*'}, true),
+				tConns = _currentInstance.getConnections({target:id, scope:'*'}, true);
+
+			newId = "" + newId;
+							
+			if (!doNotSetAttribute) {
+				el = jsPlumb.CurrentLibrary.getElementObject(id);
+				jsPlumb.CurrentLibrary.setAttribute(el, "id", newId);
+			}
+			
+			el = jsPlumb.CurrentLibrary.getElementObject(newId);
+			
+
+			endpointsByElement[newId] = endpointsByElement[id] || [];
+			for (var i = 0; i < endpointsByElement[newId].length; i++) {
+				endpointsByElement[newId][i].elementId = newId;
+				endpointsByElement[newId][i].element = el;
+				endpointsByElement[newId][i].anchor.elementId = newId;
+			}
+			delete endpointsByElement[id];
+
+			_currentInstance.anchorManager.changeId(id, newId);
+
+			var _conns = function(list, epIdx, type) {
+				for (var i = 0; i < list.length; i++) {
+					list[i].endpoints[epIdx].elementId = newId;
+					list[i].endpoints[epIdx].element = el;
+					list[i][type + "Id"] = newId;
+					list[i][type] = el;
+				}
+			};
+			_conns(sConns, 0, "source");
+			_conns(tConns, 1, "target");
+		};
+
+		/*
+		* Function: setIdChanged
+		* Notify jsPlumb that the element with oldId has had its id changed to newId.
+		*
+		* This method is equivalent to what jsPlumb does itself in the second step of the setId method above.
+		*
+		* Parameters:
+		* 	oldId	- 	previous element id
+		* 	newId	-	element's new id
+		*
+		* See Also:
+		* 	<setId>
+		*/
+		this.setIdChanged = function(oldId, newId) {
+			_currentInstance.setId(oldId, newId, true);
+		};
+
+		this.setDebugLog = function(debugLog) {
+			log = debugLog;
+		};
+
+		
+		var _suspendDrawing = false,
+				_suspendedAt = null;
+		/*
+		 * Function: setSuspendDrawing
+		 * Suspends drawing operations.  This can (and should!) be used when you have a lot of connections to make or endpoints to register;
+		 * it will save you a lot of time.
+		 *
+		 * Parameters:
+		 * 	val	-	boolean indicating whether to suspend or not
+		 * 	repaintAfterwards	-	optional boolean instructing jsPlumb to do a full repaint after changing the suspension
+		 * 	state. defaults to false.
+		 */
+		this.setSuspendDrawing = function(val, repaintAfterwards) {
+		    _suspendDrawing = val;
+				if (val) _suspendedAt = new Date().getTime(); else _suspendedAt = null;
+		    if (repaintAfterwards) _currentInstance.repaintEverything();
+		};
+        
+		/*
+		* Function: isSuspendDrawing
+		* Returns whether or not drawing is currently suspended.
+		*/
+		this.isSuspendDrawing = function() {
+			return _suspendDrawing;
+		};
+		
+		/*
+		 * Property: CANVAS
+		 * Constant for use with the setRenderMode method
+		 */
+		this.CANVAS = "canvas";
+		
+		/*
+		 * Property: SVG
+		 * Constant for use with the setRenderMode method
+		 */
+		this.SVG = "svg";
+		
+		/*
+		 * Property: VML
+		 * Constant for use with the setRenderMode method
+		 */
+		this.VML = "vml";
+		
+		/*
+		 * Function: setRenderMode
+		 * Sets render mode: jsPlumb.CANVAS, jsPlumb.SVG or jsPlumb.VML.  jsPlumb will fall back to VML if it determines that
+		 * what you asked for is not supported (and that VML is).  If you asked for VML but the browser does
+		 * not support it, jsPlumb uses SVG.
+		 *
+		 * Parameters:
+		 * mode	-	a string representing the mode. Use one of the jsPlumb render mode constants as discussed above.
+		 * 
+		 * Returns:
+		 * The render mode that jsPlumb set, which of course may be different from that requested.
+		 */
+		this.setRenderMode = function(mode) {			
+			renderMode = jsPlumbAdapter.setRenderMode(mode);
+			return renderMode;
+		};
+		
+		/*
+		 * Function: getRenderMode
+		 *
+		 * Returns:
+		 * The current render mode.
+		 */
+		this.getRenderMode = function() { return renderMode; };
+
+		/*
+		 * Function: show 
+		 * Sets an element's connections to be visible.
+		 * 
+		 * Parameters: 
+		 * 	el - either the id of the element, or a selector for the element.
+		 *  changeEndpoints - whether or not to also change the visible state of the endpoints on the element.  this also has a bearing on
+		 *  other connections on those endpoints: if their other endpoint is also visible, the connections are made visible.  
+		 *  
+		 * Returns: 
+		 * 	The current jsPlumb instance.
+		 */
+		this.show = function(el, changeEndpoints) {
+			_setVisible(el, "block", changeEndpoints);
+			return _currentInstance;
+		};
+
+		/*
+		 * Function: sizeCanvas 
+		 * Helper to size a canvas. You would typically use
+		 * this when writing your own Connector or Endpoint implementation.
+		 * 
+		 * Parameters: 
+		 * 	x - [int] x position for the Canvas origin 
+		 * 	y - [int] y position for the Canvas origin 
+		 * 	w - [int] width of the canvas 
+		 * 	h - [int] height of the canvas
+		 *  
+		 * Returns: 
+		 * 	The current jsPlumb instance
+		 */
+		this.sizeCanvas = function(canvas, x, y, w, h) {
+			if (canvas) {
+				canvas.style.height = h + "px";
+				canvas.height = h;
+				canvas.style.width = w + "px";
+				canvas.width = w;
+				canvas.style.left = x + "px";
+				canvas.style.top = y + "px";
+			}
+			return _currentInstance;
+		};
+
+		/**
+		 * gets some test hooks. nothing writable.
+		 */
+		this.getTestHarness = function() {
+			return {
+				endpointsByElement : endpointsByElement,  
+				endpointCount : function(elId) {
+					var e = endpointsByElement[elId];
+					return e ? e.length : 0;
+				},
+				connectionCount : function(scope) {
+					scope = scope || DEFAULT_SCOPE;
+					var c = connectionsByScope[scope];
+					return c ? c.length : 0;
+				},
+				//findIndex : _findIndex,
+				getId : _getId,
+				makeAnchor:self.makeAnchor,
+				makeDynamicAnchor:self.makeDynamicAnchor
+			};
+		};
+
+		/**
+		 * Toggles visibility of an element's connections. kept for backwards
+		 * compatibility
+		 */
+		this.toggle = _toggleVisible;
+
+		/*
+		 * Function: toggleVisible 
+		 * Toggles visibility of an element's Connections.
+		 *  
+		 * Parameters: 
+		 * 	el - either the element's id, or a selector representing the element.
+		 *  changeEndpoints - whether or not to also toggle the endpoints on the element.
+		 *  
+		 * Returns: 
+		 * 	void, but should be updated to return the current state
+		 */
+		// TODO: update this method to return the current state.
+		this.toggleVisible = _toggleVisible;
+
+		/*
+		 * Function: toggleDraggable 
+		 * Toggles draggability (sic?) of an element's Connections.
+		 *  
+		 * Parameters: 
+		 * 	el - either the element's id, or a selector representing the element.
+		 *  
+		 * Returns: 
+		 * 	The current draggable state.
+		 */
+		this.toggleDraggable = _toggleDraggable;		
+
+		/*
+		 * Helper method to wrap an existing function with one of
+		 * your own. This is used by the various implementations to wrap event
+		 * callbacks for drag/drop etc; it allows jsPlumb to be transparent in
+		 * its handling of these things. If a user supplies their own event
+		 * callback, for anything, it will always be called. 
+		 */
+		this.wrap = _wrap;			
+		this.addListener = this.bind;
+		
+		var adjustForParentOffsetAndScroll = function(xy, el) {
+
+			var offsetParent = null, result = xy;
+			if (el.tagName.toLowerCase() === "svg" && el.parentNode) {
+				offsetParent = el.parentNode;
+			}
+			else if (el.offsetParent) {
+				offsetParent = el.offsetParent;					
+			}
+			if (offsetParent != null) {
+				var po = offsetParent.tagName.toLowerCase() === "body" ? {left:0,top:0} : _getOffset(offsetParent, _currentInstance),
+					so = offsetParent.tagName.toLowerCase() === "body" ? {left:0,top:0} : {left:offsetParent.scrollLeft, top:offsetParent.scrollTop};					
+
+
+				// i thought it might be cool to do this:
+				//	lastReturnValue[0] = lastReturnValue[0] - offsetParent.offsetLeft + offsetParent.scrollLeft;
+				//	lastReturnValue[1] = lastReturnValue[1] - offsetParent.offsetTop + offsetParent.scrollTop;					
+				// but i think it ignores margins.  my reasoning was that it's quicker to not hand off to some underlying					
+				// library.
+				
+				result[0] = xy[0] - po.left + so.left;
+				result[1] = xy[1] - po.top + so.top;
+			}
+		
+			return result;
+			
+		};
+
+		/**
+		 * Anchors model a position on some element at which an Endpoint may be located.  They began as a first class citizen of jsPlumb, ie. a user
+		 * was required to create these themselves, but over time this has been replaced by the concept of referring to them either by name (eg. "TopMiddle"),
+		 * or by an array describing their coordinates (eg. [ 0, 0.5, 0, -1 ], which is the same as "TopMiddle").  jsPlumb now handles all of the
+		 * creation of Anchors without user intervention.
+		 */
+		var Anchor = function(params) {
+			var self = this;
+			this.x = params.x || 0;
+			this.y = params.y || 0;
+			this.elementId = params.elementId;
+			var orientation = params.orientation || [ 0, 0 ];
+			var lastTimestamp = null, lastReturnValue = null;
+			this.offsets = params.offsets || [ 0, 0 ];
+			self.timestamp = null;
+			this.compute = function(params) {
+				var xy = params.xy, wh = params.wh, element = params.element, timestamp = params.timestamp;
+				
+				if (timestamp && timestamp === self.timestamp)
+					return lastReturnValue;
+	
+				lastReturnValue = [ xy[0] + (self.x * wh[0]) + self.offsets[0], xy[1] + (self.y * wh[1]) + self.offsets[1] ];
+				
+				// adjust loc if there is an offsetParent
+				lastReturnValue = adjustForParentOffsetAndScroll(lastReturnValue, element.canvas);
+				
+				self.timestamp = timestamp;
+				return lastReturnValue;
+			};
+
+			this.getOrientation = function(_endpoint) { return orientation; };
+
+			this.equals = function(anchor) {
+				if (!anchor) return false;
+				var ao = anchor.getOrientation();
+				var o = this.getOrientation();
+				return this.x == anchor.x && this.y == anchor.y
+						&& this.offsets[0] == anchor.offsets[0]
+						&& this.offsets[1] == anchor.offsets[1]
+						&& o[0] == ao[0] && o[1] == ao[1];
+			};
+
+			this.getCurrentLocation = function() { return lastReturnValue; };
+		};
+
+		/**
+		 * An Anchor that floats. its orientation is computed dynamically from
+		 * its position relative to the anchor it is floating relative to.  It is used when creating 
+		 * a connection through drag and drop.
+		 * 
+		 * TODO FloatingAnchor could totally be refactored to extend Anchor just slightly.
+		 */
+		var FloatingAnchor = function(params) {
+
+			// this is the anchor that this floating anchor is referenced to for
+			// purposes of calculating the orientation.
+			var ref = params.reference,
+			// the canvas this refers to.
+			refCanvas = params.referenceCanvas,
+			size = _getSize(_getElementObject(refCanvas)),
+
+			// these are used to store the current relative position of our
+			// anchor wrt the reference anchor. they only indicate
+			// direction, so have a value of 1 or -1 (or, very rarely, 0). these
+			// values are written by the compute method, and read
+			// by the getOrientation method.
+			xDir = 0, yDir = 0,
+			// temporary member used to store an orientation when the floating
+			// anchor is hovering over another anchor.
+			orientation = null,
+			_lastResult = null;
+
+			// set these to 0 each; they are used by certain types of connectors in the loopback case,
+			// when the connector is trying to clear the element it is on. but for floating anchor it's not
+			// very important.
+			this.x = 0; this.y = 0;
+
+			this.isFloating = true;
+
+			this.compute = function(params) {
+				var xy = params.xy, element = params.element,
+				result = [ xy[0] + (size[0] / 2), xy[1] + (size[1] / 2) ]; // return origin of the element. we may wish to improve this so that any object can be the drag proxy.
+							
+				// adjust loc if there is an offsetParent
+				result = adjustForParentOffsetAndScroll(result, element.canvas);
+				
+				_lastResult = result;
+				return result;
+			};
+
+			this.getOrientation = function(_endpoint) {
+				if (orientation) return orientation;
+				else {
+					var o = ref.getOrientation(_endpoint);
+					// here we take into account the orientation of the other
+					// anchor: if it declares zero for some direction, we declare zero too. this might not be the most awesome. perhaps we can come
+					// up with a better way. it's just so that the line we draw looks like it makes sense. maybe this wont make sense.
+					return [ Math.abs(o[0]) * xDir * -1,
+							Math.abs(o[1]) * yDir * -1 ];
+				}
+			};
+
+			/**
+			 * notification the endpoint associated with this anchor is hovering
+			 * over another anchor; we want to assume that anchor's orientation
+			 * for the duration of the hover.
+			 */
+			this.over = function(anchor) { 
+				orientation = anchor.getOrientation(); 
+			};
+
+			/**
+			 * notification the endpoint associated with this anchor is no
+			 * longer hovering over another anchor; we should resume calculating
+			 * orientation as we normally do.
+			 */
+			this.out = function() { orientation = null; };
+
+			this.getCurrentLocation = function() { return _lastResult; };
+		};
+
+		/* 
+		 * A DynamicAnchor is an Anchor that contains a list of other Anchors, which it cycles
+		 * through at compute time to find the one that is located closest to
+		 * the center of the target element, and returns that Anchor's compute
+		 * method result. this causes endpoints to follow each other with
+		 * respect to the orientation of their target elements, which is a useful
+		 * feature for some applications.
+		 * 
+		 */
+		var DynamicAnchor = function(anchors, anchorSelector, elementId) {
+			this.isSelective = true;
+			this.isDynamic = true;			
+			var _anchors = [], self = this,
+			_convert = function(anchor) { 
+				return anchor.constructor == Anchor ? anchor: _currentInstance.makeAnchor(anchor, elementId, _currentInstance); 
+			};
+			for (var i = 0; i < anchors.length; i++) 
+				_anchors[i] = _convert(anchors[i]);			
+			this.addAnchor = function(anchor) { _anchors.push(_convert(anchor)); };
+			this.getAnchors = function() { return _anchors; };
+			this.locked = false;
+			var _curAnchor = _anchors.length > 0 ? _anchors[0] : null,
+				_curIndex = _anchors.length > 0 ? 0 : -1,
+				self = this,
+			
+				// helper method to calculate the distance between the centers of the two elements.
+				_distance = function(anchor, cx, cy, xy, wh) {
+					var ax = xy[0] + (anchor.x * wh[0]), ay = xy[1] + (anchor.y * wh[1]);
+					return Math.sqrt(Math.pow(cx - ax, 2) + Math.pow(cy - ay, 2));
+				},
+			
+			// default method uses distance between element centers.  you can provide your own method in the dynamic anchor
+			// constructor (and also to jsPlumb.makeDynamicAnchor). the arguments to it are four arrays: 
+			// xy - xy loc of the anchor's element
+			// wh - anchor's element's dimensions
+			// txy - xy loc of the element of the other anchor in the connection
+			// twh - dimensions of the element of the other anchor in the connection.
+			// anchors - the list of selectable anchors
+			_anchorSelector = anchorSelector || function(xy, wh, txy, twh, anchors) {
+				var cx = txy[0] + (twh[0] / 2), cy = txy[1] + (twh[1] / 2);
+				var minIdx = -1, minDist = Infinity;
+				for ( var i = 0; i < anchors.length; i++) {
+					var d = _distance(anchors[i], cx, cy, xy, wh);
+					if (d < minDist) {
+						minIdx = i + 0;
+						minDist = d;
+					}
+				}
+				return anchors[minIdx];
+			};
+			
+			this.compute = function(params) {				
+				var xy = params.xy, wh = params.wh, timestamp = params.timestamp, txy = params.txy, twh = params.twh;				
+				// if anchor is locked or an opposite element was not given, we
+				// maintain our state. anchor will be locked
+				// if it is the source of a drag and drop.
+				if (self.locked || txy == null || twh == null)
+					return _curAnchor.compute(params);				
+				else
+					params.timestamp = null; // otherwise clear this, i think. we want the anchor to compute.
+				
+				_curAnchor = _anchorSelector(xy, wh, txy, twh, _anchors);
+				self.x = _curAnchor.x;
+				self.y = _curAnchor.y;
+				
+				return _curAnchor.compute(params);
+			};
+
+			this.getCurrentLocation = function() {
+				return _curAnchor != null ? _curAnchor.getCurrentLocation() : null;
+			};
+
+			this.getOrientation = function(_endpoint) { return _curAnchor != null ? _curAnchor.getOrientation(_endpoint) : [ 0, 0 ]; };
+			this.over = function(anchor) { if (_curAnchor != null) _curAnchor.over(anchor); };
+			this.out = function() { if (_curAnchor != null) _curAnchor.out(); };
+		};
+		
+	/*
+	manages anchors for all elements.
+	*/
+	// "continuous" anchors: anchors that pick their location based on how many connections the given element has.
+	// this requires looking at a lot more elements than normal - anything that has had a Continuous anchor applied has
+	// to be recalculated.  so this manager is used as a reference point.  the first time, with a new timestamp, that
+	// a continuous anchor is asked to compute, it calls this guy.  or maybe, even, this guy gets called somewhere else
+	// and compute only ever returns pre-computed values.  either way, this is the central point, and we want it to
+	// be called as few times as possible.
+	var continuousAnchors = {},
+        continuousAnchorLocations = {},
+	    continuousAnchorOrientations = {},
+	    Orientation = { HORIZONTAL : "horizontal", VERTICAL : "vertical", DIAGONAL : "diagonal", IDENTITY:"identity" },
+    
+	// TODO this functions uses a crude method of determining orientation between two elements.
+	// 'diagonal' should be chosen when the angle of the line between the two centers is around
+	// one of 45, 135, 225 and 315 degrees. maybe +- 15 degrees.
+	calculateOrientation = function(sourceId, targetId, sd, td) {
+
+		if (sourceId === targetId) return {
+			orientation:Orientation.IDENTITY,
+			a:["top", "top"]
+		};
+
+		var theta = Math.atan2((td.centery - sd.centery) , (td.centerx - sd.centerx)),
+		    theta2 = Math.atan2((sd.centery - td.centery) , (sd.centerx - td.centerx)),
+		    h = ((sd.left <= td.left && sd.right >= td.left) || (sd.left <= td.right && sd.right >= td.right) ||
+			    (sd.left <= td.left && sd.right >= td.right) || (td.left <= sd.left && td.right >= sd.right)),
+		    v = ((sd.top <= td.top && sd.bottom >= td.top) || (sd.top <= td.bottom && sd.bottom >= td.bottom) ||
+			    (sd.top <= td.top && sd.bottom >= td.bottom) || (td.top <= sd.top && td.bottom >= sd.bottom));
+
+		if (! (h || v)) {
+			var a = null, rls = false, rrs = false, sortValue = null;
+			if (td.left > sd.left && td.top > sd.top)
+				a = ["right", "top"];
+			else if (td.left > sd.left && sd.top > td.top)
+				a = [ "top", "left"];
+			else if (td.left < sd.left && td.top < sd.top)
+				a = [ "top", "right"];
+			else if (td.left < sd.left && td.top > sd.top)
+				a = ["left", "top" ];
+
+			return { orientation:Orientation.DIAGONAL, a:a, theta:theta, theta2:theta2 };
+		}
+		else if (h) return {
+			orientation:Orientation.HORIZONTAL,
+			a:sd.top < td.top ? ["bottom", "top"] : ["top", "bottom"],
+			theta:theta, theta2:theta2
+		}
+		else return {
+			orientation:Orientation.VERTICAL,
+			a:sd.left < td.left ? ["right", "left"] : ["left", "right"],
+			theta:theta, theta2:theta2
+		}
+	},
+	placeAnchorsOnLine = function(desc, elementDimensions, elementPosition,
+					connections, horizontal, otherMultiplier, reverse) {
+		var a = [], step = elementDimensions[horizontal ? 0 : 1] / (connections.length + 1);
+
+		for (var i = 0; i < connections.length; i++) {
+			var val = (i + 1) * step, other = otherMultiplier * elementDimensions[horizontal ? 1 : 0];
+			if (reverse)
+			  val = elementDimensions[horizontal ? 0 : 1] - val;
+
+			var dx = (horizontal ? val : other), x = elementPosition[0] + dx,  xp = dx / elementDimensions[0],
+			 	dy = (horizontal ? other : val), y = elementPosition[1] + dy, yp = dy / elementDimensions[1];
+
+			a.push([ x, y, xp, yp, connections[i][1], connections[i][2] ]);
+		}
+
+		return a;
+	},
+	standardEdgeSort = function(a, b) { return a[0] > b[0] ? 1 : -1 },
+	currySort = function(reverseAngles) {
+		return function(a,b) {
+            var r = true;
+			if (reverseAngles) {
+				if (a[0][0] < b[0][0])
+					r = true;
+				else
+					r = a[0][1] > b[0][1];
+			}
+			else {
+				if (a[0][0] > b[0][0])
+					r= true;
+				else
+					r =a[0][1] > b[0][1];
+			}
+            return r === false ? -1 : 1;
+		};
+	},
+	leftSort = function(a,b) {
+		// first get adjusted values
+		var p1 = a[0][0] < 0 ? -Math.PI - a[0][0] : Math.PI - a[0][0],
+		p2 = b[0][0] < 0 ? -Math.PI - b[0][0] : Math.PI - b[0][0];
+		if (p1 > p2) return 1;
+		else return a[0][1] > b[0][1] ? 1 : -1;
+	},
+	edgeSortFunctions = {
+		"top":standardEdgeSort,
+		"right":currySort(true),
+		"bottom":currySort(true),
+		"left":leftSort
+	},
+    _sortHelper = function(_array, _fn) {
+      return _array.sort(_fn);
+    },
+	placeAnchors = function(elementId, _anchorLists) {		
+		var sS = sizes[elementId], sO = offsets[elementId],
+		placeSomeAnchors = function(desc, elementDimensions, elementPosition, unsortedConnections, isHorizontal, otherMultiplier, orientation) {
+            if (unsortedConnections.length > 0) {
+			    var sc = _sortHelper(unsortedConnections, edgeSortFunctions[desc]), // puts them in order based on the target element's pos on screen			    
+				    reverse = desc === "right" || desc === "top",
+				    anchors = placeAnchorsOnLine(desc, elementDimensions,
+											 elementPosition, sc,
+											 isHorizontal, otherMultiplier, reverse );
+
+			    // takes a computed anchor position and adjusts it for parent offset and scroll, then stores it.
+			    var _setAnchorLocation = function(endpoint, anchorPos) {
+				    var a = adjustForParentOffsetAndScroll([anchorPos[0], anchorPos[1]], endpoint.canvas);
+				    continuousAnchorLocations[endpoint.id] = [ a[0], a[1], anchorPos[2], anchorPos[3] ];
+				    continuousAnchorOrientations[endpoint.id] = orientation;
+			    };
+
+			    for (var i = 0; i < anchors.length; i++) {
+				    var c = anchors[i][4], weAreSource = c.endpoints[0].elementId === elementId, weAreTarget = c.endpoints[1].elementId === elementId;
+				    if (weAreSource)
+					    _setAnchorLocation(c.endpoints[0], anchors[i]);
+				    else if (weAreTarget)
+					    _setAnchorLocation(c.endpoints[1], anchors[i]);
+			    }
+            }
+		};
+
+		placeSomeAnchors("bottom", sS, [sO.left,sO.top], _anchorLists.bottom, true, 1, [0,1]);
+		placeSomeAnchors("top", sS, [sO.left,sO.top], _anchorLists.top, true, 0, [0,-1]);
+		placeSomeAnchors("left", sS, [sO.left,sO.top], _anchorLists.left, false, 0, [-1,0]);
+		placeSomeAnchors("right", sS, [sO.left,sO.top], _anchorLists.right, false, 1, [1,0]);
+	},
+    AnchorManager = function() {
+		var _amEndpoints = {},
+			connectionsByElementId = {},
+			self = this,
+            anchorLists = {};
+
+        this.reset = function() {
+        	_amEndpoints = {};
+        	connectionsByElementId = {};
+            anchorLists = {};
+        };			
+ 		this.newConnection = function(conn) {
+			var sourceId = conn.sourceId, targetId = conn.targetId,
+				ep = conn.endpoints,
+                doRegisterTarget = true,
+			    registerConnection = function(otherIndex, otherEndpoint, otherAnchor, elId, c) {
+
+					if ((sourceId == targetId) && otherAnchor.isContinuous){
+                       // remove the target endpoint's canvas.  we dont need it.
+                        jsPlumb.CurrentLibrary.removeElement(ep[1].canvas);
+                        doRegisterTarget = false;
+                    }
+					_addToList(connectionsByElementId, elId, [c, otherEndpoint, otherAnchor.constructor == DynamicAnchor]);
+			    };
+
+			registerConnection(0, ep[0], ep[0].anchor, targetId, conn);
+            if (doRegisterTarget)
+            	registerConnection(1, ep[1], ep[1].anchor, sourceId, conn);
+		};
+		this.connectionDetached = function(connInfo) {
+			var connection = connInfo.connection || connInfo;
+			var sourceId = connection.sourceId,
+                targetId = connection.targetId,
+				ep = connection.endpoints,
+				removeConnection = function(otherIndex, otherEndpoint, otherAnchor, elId, c) {
+					if (otherAnchor.constructor == FloatingAnchor) {
+						// no-op
+					}
+					else {
+						_removeWithFunction(connectionsByElementId[elId], function(_c) {
+							return _c[0].id == c.id;
+						});
+					}
+				};
+				
+			removeConnection(1, ep[1], ep[1].anchor, sourceId, connection);
+			removeConnection(0, ep[0], ep[0].anchor, targetId, connection);
+
+            // remove from anchorLists
+            var sEl = connection.sourceId,
+                tEl = connection.targetId,
+                sE =  connection.endpoints[0].id,
+                tE = connection.endpoints[1].id,
+                _remove = function(list, eId) {
+                    if (list) {  // transient anchors dont get entries in this list.
+                        var f = function(e) { return e[4] == eId; };
+                        _removeWithFunction(list["top"], f);
+                        _removeWithFunction(list["left"], f);
+                        _removeWithFunction(list["bottom"], f);
+                        _removeWithFunction(list["right"], f);
+                    }
+                };
+            
+            _remove(anchorLists[sEl], sE);
+            _remove(anchorLists[tEl], tE);
+            self.redraw(sEl);
+            self.redraw(tEl);
+		};
+		this.add = function(endpoint, elementId) {
+			_addToList(_amEndpoints, elementId, endpoint);
+		};
+		this.changeId = function(oldId, newId) {
+			connectionsByElementId[newId] = connectionsByElementId[oldId];
+			_amEndpoints[newId] = _amEndpoints[oldId];
+			delete connectionsByElementId[oldId];
+			delete _amEndpoints[oldId];	
+		};
+		this.getConnectionsFor = function(elementId) {
+			return connectionsByElementId[elementId] || [];
+		};
+		this.getEndpointsFor = function(elementId) {
+			return _amEndpoints[elementId] || [];
+		};
+		this.deleteEndpoint = function(endpoint) {
+			_removeWithFunction(_amEndpoints[endpoint.elementId], function(e) {
+				return e.id == endpoint.id;
+			});
+		};
+		this.clearFor = function(elementId) {
+			delete _amEndpoints[elementId];
+			_amEndpoints[elementId] = [];
+		};
+        // updates the given anchor list by either updating an existing anchor's info, or adding it. this function
+        // also removes the anchor from its previous list, if the edge it is on has changed.
+        // all connections found along the way (those that are connected to one of the faces this function
+        // operates on) are added to the connsToPaint list, as are their endpoints. in this way we know to repaint
+        // them wthout having to calculate anything else about them.
+        var _updateAnchorList = function(lists, theta, order, conn, aBoolean, otherElId, idx, reverse, edgeId, elId, connsToPaint, endpointsToPaint) {
+            // first try to find the exact match, but keep track of the first index of a matching element id along the way.s
+            var exactIdx = -1,
+                firstMatchingElIdx = -1,
+                endpoint = conn.endpoints[idx],
+                endpointId = endpoint.id,
+                oIdx = [1,0][idx],
+                values = [ [ theta, order ], conn, aBoolean, otherElId, endpointId ],
+                listToAddTo = lists[edgeId],
+                listToRemoveFrom = endpoint._continuousAnchorEdge ? lists[endpoint._continuousAnchorEdge] : null;
+
+            if (listToRemoveFrom) {
+                var rIdx = _findWithFunction(listToRemoveFrom, function(e) { return e[4] == endpointId });
+                if (rIdx != -1) {
+                    listToRemoveFrom.splice(rIdx, 1);
+                    // get all connections from this list
+                    for (var i = 0; i < listToRemoveFrom.length; i++) {
+                        _addWithFunction(connsToPaint, listToRemoveFrom[i][1], function(c) { return c.id == listToRemoveFrom[i][1].id });
+                        _addWithFunction(endpointsToPaint, listToRemoveFrom[i][1].endpoints[idx], function(e) { return e.id == listToRemoveFrom[i][1].endpoints[idx].id });
+                    }
+                }
+            }
+
+            for (var i = 0; i < listToAddTo.length; i++) {
+                if (idx == 1 && listToAddTo[i][3] === otherElId && firstMatchingElIdx == -1)
+                    firstMatchingElIdx = i;
+                _addWithFunction(connsToPaint, listToAddTo[i][1], function(c) { return c.id == listToAddTo[i][1].id });                
+                _addWithFunction(endpointsToPaint, listToAddTo[i][1].endpoints[idx], function(e) { return e.id == listToAddTo[i][1].endpoints[idx].id });
+            }
+            if (exactIdx != -1) {
+                listToAddTo[exactIdx] = values;
+            }
+            else {
+                var insertIdx = reverse ? firstMatchingElIdx != -1 ? firstMatchingElIdx : 0 : listToAddTo.length; // of course we will get this from having looked through the array shortly.
+                listToAddTo.splice(insertIdx, 0, values);
+            }
+
+            // store this for next time.
+            endpoint._continuousAnchorEdge = edgeId;
+        };
+		this.redraw = function(elementId, ui, timestamp, offsetToUI) {
+		
+			if (!_suspendDrawing) {
+				// get all the endpoints for this element
+				var ep = _amEndpoints[elementId] || [],
+					endpointConnections = connectionsByElementId[elementId] || [],
+					connectionsToPaint = [],
+					endpointsToPaint = [],
+	                anchorsToUpdate = [];
+	            
+				timestamp = timestamp || _timestamp();
+				// offsetToUI are values that would have been calculated in the dragManager when registering
+				// an endpoint for an element that had a parent (somewhere in the hierarchy) that had been
+				// registered as draggable.
+				offsetToUI = offsetToUI || {left:0, top:0};
+				if (ui) {
+					ui = {
+						left:ui.left + offsetToUI.left,
+						top:ui.top + offsetToUI.top
+					}
+				}
+					
+				_updateOffset( { elId : elementId, offset : ui, recalc : false, timestamp : timestamp }); 
+				// valid for one paint cycle.
+				var myOffset = offsets[elementId],
+	                myWH = sizes[elementId],
+	                orientationCache = {};
+				
+				// actually, first we should compute the orientation of this element to all other elements to which
+				// this element is connected with a continuous anchor (whether both ends of the connection have
+				// a continuous anchor or just one)
+	            //for (var i = 0; i < continuousAnchorConnections.length; i++) {
+	            for (var i = 0; i < endpointConnections.length; i++) {
+	                var conn = endpointConnections[i][0],
+						sourceId = conn.sourceId,
+	                    targetId = conn.targetId,
+	                    sourceContinuous = conn.endpoints[0].anchor.isContinuous,
+	                    targetContinuous = conn.endpoints[1].anchor.isContinuous;
+	
+	                if (sourceContinuous || targetContinuous) {
+		                var oKey = sourceId + "_" + targetId,
+		                    oKey2 = targetId + "_" + sourceId,
+		                    o = orientationCache[oKey],
+		                    oIdx = conn.sourceId == elementId ? 1 : 0;
+	
+		                if (sourceContinuous && !anchorLists[sourceId]) anchorLists[sourceId] = { top:[], right:[], bottom:[], left:[] };
+		                if (targetContinuous && !anchorLists[targetId]) anchorLists[targetId] = { top:[], right:[], bottom:[], left:[] };
+	
+		                if (elementId != targetId) _updateOffset( { elId : targetId, timestamp : timestamp }); 
+		                if (elementId != sourceId) _updateOffset( { elId : sourceId, timestamp : timestamp }); 
+	
+		                var td = _getCachedData(targetId),
+							sd = _getCachedData(sourceId);
+	
+		                if (targetId == sourceId && (sourceContinuous || targetContinuous)) {
+		                    // here we may want to improve this by somehow determining the face we'd like
+						    // to put the connector on.  ideally, when drawing, the face should be calculated
+						    // by determining which face is closest to the point at which the mouse button
+							// was released.  for now, we're putting it on the top face.
+		                    _updateAnchorList(anchorLists[sourceId], -Math.PI / 2, 0, conn, false, targetId, 0, false, "top", sourceId, connectionsToPaint, endpointsToPaint)
+						}
+		                else {
+		                    if (!o) {
+		                        o = calculateOrientation(sourceId, targetId, sd.o, td.o);
+		                        orientationCache[oKey] = o;
+		                        // this would be a performance enhancement, but the computed angles need to be clamped to
+		                        //the (-PI/2 -> PI/2) range in order for the sorting to work properly.
+		                    /*  orientationCache[oKey2] = {
+		                            orientation:o.orientation,
+		                            a:[o.a[1], o.a[0]],
+		                            theta:o.theta + Math.PI,
+		                            theta2:o.theta2 + Math.PI
+		                        };*/
+		                    }
+		                    if (sourceContinuous) _updateAnchorList(anchorLists[sourceId], o.theta, 0, conn, false, targetId, 0, false, o.a[0], sourceId, connectionsToPaint, endpointsToPaint);
+		                    if (targetContinuous) _updateAnchorList(anchorLists[targetId], o.theta2, -1, conn, true, sourceId, 1, true, o.a[1], targetId, connectionsToPaint, endpointsToPaint);
+		                }
+	
+		                if (sourceContinuous) _addWithFunction(anchorsToUpdate, sourceId, function(a) { return a === sourceId; });
+		                if (targetContinuous) _addWithFunction(anchorsToUpdate, targetId, function(a) { return a === targetId; });
+		                _addWithFunction(connectionsToPaint, conn, function(c) { return c.id == conn.id; });
+		                if ((sourceContinuous && oIdx == 0) || (targetContinuous && oIdx == 1))
+		                	_addWithFunction(endpointsToPaint, conn.endpoints[oIdx], function(e) { return e.id == conn.endpoints[oIdx].id; });
+		            }
+	            }
+				
+				// place Endpoints whose anchors are continuous but have no Connections
+				for (var i = 0; i < ep.length; i++) {
+					if (ep[i].connections.length == 0 && ep[i].anchor.isContinuous) {
+						if (!anchorLists[elementId]) anchorLists[elementId] = { top:[], right:[], bottom:[], left:[] };
+						_updateAnchorList(anchorLists[elementId], -Math.PI / 2, 0, {endpoints:[ep[i], ep[i]], paint:function(){}}, false, elementId, 0, false, "top", elementId, connectionsToPaint, endpointsToPaint)
+						_addWithFunction(anchorsToUpdate, elementId, function(a) { return a === elementId; })
+					}
+				}
+	
+	            // now place all the continuous anchors we need to;
+	            for (var i = 0; i < anchorsToUpdate.length; i++) {
+					placeAnchors(anchorsToUpdate[i], anchorLists[anchorsToUpdate[i]]);
+				}
+				
+				// now that continuous anchors have been placed, paint all the endpoints for this element
+	            // TODO performance: add the endpoint ids to a temp array, and then when iterating in the next
+	            // loop, check that we didn't just paint that endpoint. we can probably shave off a few more milliseconds this way.
+				for (var i = 0; i < ep.length; i++) {				
+					ep[i].paint( { timestamp : timestamp, offset : myOffset, dimensions : myWH });
+				}
+	            // ... and any other endpoints we came across as a result of the continuous anchors.
+	            for (var i = 0; i < endpointsToPaint.length; i++) {
+					endpointsToPaint[i].paint( { timestamp : timestamp, offset : myOffset, dimensions : myWH });
+				}
+	
+				// paint all the standard and "dynamic connections", which are connections whose other anchor is
+				// static and therefore does need to be recomputed; we make sure that happens only one time.
+	
+				// TODO we could have compiled a list of these in the first pass through connections; might save some time.
+				for (var i = 0; i < endpointConnections.length; i++) {
+					var otherEndpoint = endpointConnections[i][1];
+					if (otherEndpoint.anchor.constructor == DynamicAnchor) {			 							
+						otherEndpoint.paint({ elementWithPrecedence:elementId });								
+	                    _addWithFunction(connectionsToPaint, endpointConnections[i][0], function(c) { return c.id == endpointConnections[i][0].id; });
+						// all the connections for the other endpoint now need to be repainted
+						for (var k = 0; k < otherEndpoint.connections.length; k++) {
+							if (otherEndpoint.connections[k] !== endpointConnections[i][0])							
+	                            _addWithFunction(connectionsToPaint, otherEndpoint.connections[k], function(c) { return c.id == otherEndpoint.connections[k].id; });
+						}
+					} else if (otherEndpoint.anchor.constructor == Anchor) {					
+	                    _addWithFunction(connectionsToPaint, endpointConnections[i][0], function(c) { return c.id == endpointConnections[i][0].id; });
+					}
+				}
+				// paint current floating connection for this element, if there is one.
+				var fc = floatingConnections[elementId];
+				if (fc) 
+					fc.paint({timestamp:timestamp, recalc:false, elId:elementId});
+					
+				// paint all the connections
+				for (var i = 0; i < connectionsToPaint.length; i++) {
+					connectionsToPaint[i].paint({elId:elementId, timestamp:timestamp, recalc:false});
+				}
+			}
+		};
+		this.rehomeEndpoint = function(currentId, element) {
+			var eps = _amEndpoints[currentId] || [], //, 
+				elementId = _currentInstance.getId(element);
+			if (elementId !== currentId) {
+				for (var i = 0; i < eps.length; i++) {
+					self.add(eps[i], elementId);
+				}
+				eps.splice(0, eps.length);
+			}
+		};
+	};
+	_currentInstance.anchorManager = new AnchorManager();				
+	_currentInstance.continuousAnchorFactory = {
+		get:function(params) {
+			var existing = continuousAnchors[params.elementId];
+			if (!existing) {
+				existing = {
+					type:"Continuous",
+					compute : function(params) {
+						return continuousAnchorLocations[params.element.id] || [0,0];
+					},
+					getCurrentLocation : function(endpoint) {
+						return continuousAnchorLocations[endpoint.id] || [0,0];
+					},
+					getOrientation : function(endpoint) {
+						return continuousAnchorOrientations[endpoint.id] || [0,0];
+					},
+					isDynamic : true,
+					isContinuous : true
+				};
+				continuousAnchors[params.elementId] = existing;
+			}
+			return existing;
+		}
+	};
+
+	if (!jsPlumbAdapter.headless)
+		_currentInstance.dragManager = jsPlumbAdapter.getDragManager(_currentInstance);
+
+		/*
+		 * Class: Connection
+		 * The connecting line between two Endpoints.
+		 */
+		/*
+		 * Function: Connection
+		 * Connection constructor. You should not ever create one of these directly. If you make a call to jsPlumb.connect, all of
+		 * the parameters that you pass in to that function will be passed to the Connection constructor; if your UI
+		 * uses the various Endpoint-centric methods like addEndpoint/makeSource/makeTarget, along with drag and drop,
+		 * then the parameters you set on those functions are translated and passed in to the Connection constructor. So
+		 * you should check the documentation for each of those methods.
+		 * 
+		 * Parameters:
+		 * 	source 	- either an element id, a selector for an element, or an Endpoint.
+		 * 	target	- either an element id, a selector for an element, or an Endpoint
+		 * 	scope	- scope descriptor for this connection. optional.
+		 *  container - optional id or selector instructing jsPlumb where to attach all the elements it creates for this connection.  you should read the documentation for a full discussion of this.
+		 *  detachable - optional, defaults to true. Defines whether or not the connection may be detached using the mouse.
+		 *  reattach	- optional, defaults to false. Defines whether not the connection should be retached if it was dragged off an Endpoint and then dropped in whitespace.
+		 *  endpoint - Optional. Endpoint definition to use for both ends of the connection.
+		 *  endpoints - Optional. Array of two Endpoint definitions, one for each end of the Connection. This and 'endpoint' are mutually exclusive parameters.
+		 *  endpointStyle - Optional. Endpoint style definition to use for both ends of the Connection.
+		 *  endpointStyles - Optional. Array of two Endpoint style definitions, one for each end of the Connection. This and 'endpoint' are mutually exclusive parameters.
+		 *  paintStyle - Parameters defining the appearance of the Connection. Optional; jsPlumb will use the defaults if you supply nothing here.
+		 *  hoverPaintStyle - Parameters defining the appearance of the Connection when the mouse is hovering over it. Optional; jsPlumb will use the defaults if you supply nothing here (note that the default hoverPaintStyle is null).
+		 *  cssClass - optional CSS class to set on the display element associated with this Connection.
+		 *  hoverClass - optional CSS class to set on the display element associated with this Connection when it is in hover state.
+		 *  overlays - Optional array of Overlay definitions to appear on this Connection.
+		 *  drawEndpoints - if false, instructs jsPlumb to not draw the endpoints for this Connection.  Be careful with this: it only really works when you tell jsPlumb to attach elements to the document body. Read the documentation for a full discussion of this. 
+		 *  parameters - Optional JS object containing parameters to set on the Connection. These parameters are then available via the getParameter method.
+		 */
+		var Connection = function(params) {
+			var self = this, visible = true, _internalHover, _superClassHover;
+			self.idPrefix = "_jsplumb_c_";
+			self.defaultLabelLocation = 0.5;
+			self.defaultOverlayKeys = ["Overlays", "ConnectionOverlays"];
+			this.parent = params.parent;
+			overlayCapableJsPlumbUIComponent.apply(this, arguments);
+			// ************** get the source and target and register the connection. *******************
+			
+// VISIBILITY						
+			/*
+			* Function: isVisible
+			* Returns whether or not the Connection is currently visible.
+			*/
+			this.isVisible = function() { return visible; };
+			/*
+			* Function: setVisible
+			* Sets whether or not the Connection should be visible.
+			*
+			* Parameters:
+			*	visible - boolean indicating desired visible state.
+			*/
+			this.setVisible = function(v) {
+				visible = v;
+				self[v ? "showOverlays" : "hideOverlays"]();
+				if (self.connector && self.connector.canvas) self.connector.canvas.style.display = v ? "block" : "none";
+				self.repaint();
+			};
+// END VISIBILITY						
+		
+// TYPE		
+			
+			this.getTypeDescriptor = function() { return "connection"; };
+			this.getDefaultType = function() {
+				return {
+					parameters:{},
+					scope:null,
+					detachable:self._jsPlumb.Defaults.ConnectionsDetachable,
+					rettach:self._jsPlumb.Defaults.ReattachConnections,
+					paintStyle:self._jsPlumb.Defaults.PaintStyle || jsPlumb.Defaults.PaintStyle,
+					connector:self._jsPlumb.Defaults.Connector || jsPlumb.Defaults.Connector,
+					hoverPaintStyle:self._jsPlumb.Defaults.HoverPaintStyle || jsPlumb.Defaults.HoverPaintStyle,				
+					overlays:self._jsPlumb.Defaults.ConnectorOverlays || jsPlumb.Defaults.ConnectorOverlays
+				};
+			};
+			var superAt = this.applyType;
+			this.applyType = function(t) {
+				superAt(t);
+				if (t.detachable != null) self.setDetachable(t.detachable);
+				if (t.reattach != null) self.setReattach(t.reattach);
+				if (t.scope) self.scope = t.scope;
+				self.setConnector(t.connector);
+			};			
+// END TYPE
+
+// HOVER			
+			// override setHover to pass it down to the underlying connector
+			_superClassHover = self.setHover;
+			self.setHover = function(state) {
+				var zi = _currentInstance.ConnectorZIndex || jsPlumb.Defaults.ConnectorZIndex;
+				if (zi)
+					self.connector.setZIndex(zi + (state ? 1 : 0));
+				self.connector.setHover.apply(self.connector, arguments);				
+				_superClassHover.apply(self, arguments);
+			};
+			
+			_internalHover = function(state) {
+				if (_connectionBeingDragged == null) {
+					self.setHover(state, false);
+				}
+			};
+// END HOVER
+
+			/*
+			 * Function: setConnector
+			 * Sets the Connection's connector (eg "Bezier", "Flowchart", etc).  You pass a Connector definition into this method, the same
+			 * thing that you would set as the 'connector' property on a jsPlumb.connect call.
+			 * 
+			 * Parameters:
+			 * 	connector		-	Connector definition
+			 */
+			this.setConnector = function(connector, doNotRepaint) {
+				if (self.connector != null) _removeElements(self.connector.getDisplayElements(), self.parent);
+				var connectorArgs = { _jsPlumb:self._jsPlumb, parent:params.parent, 
+					cssClass:params.cssClass, container:params.container, tooltip:self.tooltip
+				};
+				if (_isString(connector)) 
+					this.connector = new jsPlumb.Connectors[renderMode][connector](connectorArgs); // lets you use a string as shorthand.
+				else if (_isArray(connector)) {
+					if (connector.length == 1)
+						this.connector = new jsPlumb.Connectors[renderMode][connector[0]](connectorArgs);
+					else
+						this.connector = new jsPlumb.Connectors[renderMode][connector[0]](jsPlumb.extend(connector[1], connectorArgs));
+				}
+				self.canvas = self.connector.canvas;
+				// binds mouse listeners to the current connector.
+				_bindListeners(self.connector, self, _internalHover);
+				
+				// set z-index if it was set on Defaults.
+				var zi = _currentInstance.ConnectorZIndex || jsPlumb.Defaults.ConnectorZIndex;
+				if (zi)
+					self.connector.setZIndex(zi);
+					
+				if (!doNotRepaint) self.repaint();
+			};
+			
+// INITIALISATION CODE			
+						
+			this.source = _getElementObject(params.source);
+			this.target = _getElementObject(params.target);
+			// sourceEndpoint and targetEndpoint override source/target, if they are present. but 
+			// source is not overridden if the Endpoint has declared it is not the final target of a connection;
+			// instead we use the source that the Endpoint declares will be the final source element.
+			if (params.sourceEndpoint) this.source = params.sourceEndpoint.endpointWillMoveTo || params.sourceEndpoint.getElement();			
+			if (params.targetEndpoint) this.target = params.targetEndpoint.getElement();
+			
+			// if a new connection is the result of moving some existing connection, params.previousConnection
+			// will have that Connection in it. listeners for the jsPlumbConnection event can look for that
+			// member and take action if they need to.
+			self.previousConnection = params.previousConnection;
+						
+			this.sourceId = _getAttribute(this.source, "id");
+			this.targetId = _getAttribute(this.target, "id");
+			this.scope = params.scope; // scope may have been passed in to the connect call. if it wasn't, we will pull it from the source endpoint, after having initialised the endpoints.			
+			this.endpoints = [];
+			this.endpointStyles = [];
+			// wrapped the main function to return null if no input given. this lets us cascade defaults properly.
+			var _makeAnchor = function(anchorParams, elementId) {
+				return (anchorParams) ? _currentInstance.makeAnchor(anchorParams, elementId, _currentInstance) : null;
+			},
+			prepareEndpoint = function(existing, index, params, element, elementId, connectorPaintStyle, connectorHoverPaintStyle) {
+				var e;
+				if (existing) {
+					self.endpoints[index] = existing;
+					existing.addConnection(self);					
+				} else {
+					if (!params.endpoints) params.endpoints = [ null, null ];
+					var ep = params.endpoints[index] 
+					        || params.endpoint
+							|| _currentInstance.Defaults.Endpoints[index]
+							|| jsPlumb.Defaults.Endpoints[index]
+							|| _currentInstance.Defaults.Endpoint
+							|| jsPlumb.Defaults.Endpoint;
+
+					if (!params.endpointStyles) params.endpointStyles = [ null, null ];
+					if (!params.endpointHoverStyles) params.endpointHoverStyles = [ null, null ];
+					var es = params.endpointStyles[index] || params.endpointStyle || _currentInstance.Defaults.EndpointStyles[index] || jsPlumb.Defaults.EndpointStyles[index] || _currentInstance.Defaults.EndpointStyle || jsPlumb.Defaults.EndpointStyle;
+					// Endpoints derive their fillStyle from the connector's strokeStyle, if no fillStyle was specified.
+					if (es.fillStyle == null && connectorPaintStyle != null)
+						es.fillStyle = connectorPaintStyle.strokeStyle;
+					
+					// TODO: decide if the endpoint should derive the connection's outline width and color.  currently it does:
+					//*
+					if (es.outlineColor == null && connectorPaintStyle != null) 
+						es.outlineColor = connectorPaintStyle.outlineColor;
+					if (es.outlineWidth == null && connectorPaintStyle != null) 
+						es.outlineWidth = connectorPaintStyle.outlineWidth;
+					//*/
+					
+					var ehs = params.endpointHoverStyles[index] || params.endpointHoverStyle || _currentInstance.Defaults.EndpointHoverStyles[index] || jsPlumb.Defaults.EndpointHoverStyles[index] || _currentInstance.Defaults.EndpointHoverStyle || jsPlumb.Defaults.EndpointHoverStyle;
+					// endpoint hover fill style is derived from connector's hover stroke style.  TODO: do we want to do this by default? for sure?
+					if (connectorHoverPaintStyle != null) {
+						if (ehs == null) ehs = {};
+						if (ehs.fillStyle == null) {
+							ehs.fillStyle = connectorHoverPaintStyle.strokeStyle;
+						}
+					}
+					var a = params.anchors ? params.anchors[index] : 
+						params.anchor ? params.anchor :
+						_makeAnchor(_currentInstance.Defaults.Anchors[index], elementId) || 
+						_makeAnchor(jsPlumb.Defaults.Anchors[index], elementId) || 
+						_makeAnchor(_currentInstance.Defaults.Anchor, elementId) || 
+						_makeAnchor(jsPlumb.Defaults.Anchor, elementId),					
+					u = params.uuids ? params.uuids[index] : null;
+					e = _newEndpoint({ 
+						paintStyle : es,  hoverPaintStyle:ehs,  endpoint : ep,  connections : [ self ], 
+						uuid : u,  anchor : a,  source : element, scope  : params.scope, container:params.container,
+						reattach:params.reattach || _currentInstance.Defaults.ReattachConnections,
+						detachable:params.detachable || _currentInstance.Defaults.ConnectionsDetachable
+					});
+					self.endpoints[index] = e;
+					
+					if (params.drawEndpoints === false) e.setVisible(false, true, true);
+										
+				}
+				return e;
+			};					
+
+			var eS = prepareEndpoint(params.sourceEndpoint, 0, params, self.source,
+									 self.sourceId, params.paintStyle, params.hoverPaintStyle);			
+			if (eS) _addToList(endpointsByElement, this.sourceId, eS);						
+			var eT = prepareEndpoint(params.targetEndpoint, 1, params, self.target, 
+									 self.targetId, params.paintStyle, params.hoverPaintStyle);
+			if (eT) _addToList(endpointsByElement, this.targetId, eT);
+			// if scope not set, set it to be the scope for the source endpoint.
+			if (!this.scope) this.scope = this.endpoints[0].scope;		
+			
+			// if delete endpoints on detach, keep a record of just exactly which endpoints they are.
+			self.endpointsToDeleteOnDetach = [null, null];
+			if (params.deleteEndpointsOnDetach) {
+				if (params.sourceIsNew) self.endpointsToDeleteOnDetach[0] = self.endpoints[0];
+				if (params.targetIsNew) self.endpointsToDeleteOnDetach[1] = self.endpoints[1];
+			}
+						
+			self.setConnector(this.endpoints[0].connector || 
+							  this.endpoints[1].connector || 
+							  params.connector || 
+							  _currentInstance.Defaults.Connector || 
+							  jsPlumb.Defaults.Connector, true);							  							  		
+			
+			this.setPaintStyle(this.endpoints[0].connectorStyle || 
+							   this.endpoints[1].connectorStyle || 
+							   params.paintStyle || 
+							   _currentInstance.Defaults.PaintStyle || 
+							   jsPlumb.Defaults.PaintStyle, true);
+						
+			this.setHoverPaintStyle(this.endpoints[0].connectorHoverStyle || 
+									this.endpoints[1].connectorHoverStyle || 
+									params.hoverPaintStyle || 
+									_currentInstance.Defaults.HoverPaintStyle || 
+									jsPlumb.Defaults.HoverPaintStyle, true);
+			
+			this.paintStyleInUse = this.getPaintStyle();
+			
+			_updateOffset( { elId : this.sourceId, timestamp:_suspendedAt });
+			_updateOffset( { elId : this.targetId, timestamp:_suspendedAt });
+			
+			// paint the endpoints
+			var myOffset = offsets[this.sourceId], myWH = sizes[this.sourceId],
+				otherOffset = offsets[this.targetId],
+				otherWH = sizes[this.targetId],
+				initialTimestamp = _suspendedAt || _timestamp(),
+				anchorLoc = this.endpoints[0].anchor.compute( {
+					xy : [ myOffset.left, myOffset.top ], wh : myWH, element : this.endpoints[0],
+					elementId:this.endpoints[0].elementId,
+					txy : [ otherOffset.left, otherOffset.top ], twh : otherWH, tElement : this.endpoints[1],
+					timestamp:initialTimestamp
+				});
+
+			this.endpoints[0].paint( { anchorLoc : anchorLoc, timestamp:initialTimestamp });
+
+			anchorLoc = this.endpoints[1].anchor.compute( {
+				xy : [ otherOffset.left, otherOffset.top ], wh : otherWH, element : this.endpoints[1],
+				elementId:this.endpoints[1].elementId,				
+				txy : [ myOffset.left, myOffset.top ], twh : myWH, tElement : this.endpoints[0],
+				timestamp:initialTimestamp				
+			});
+			this.endpoints[1].paint({ anchorLoc : anchorLoc, timestamp:initialTimestamp });
+									
+// END INITIALISATION CODE			
+			
+// DETACHABLE 				
+            var _detachable = _currentInstance.Defaults.ConnectionsDetachable;
+            if (params.detachable === false) _detachable = false;
+            if(self.endpoints[0].connectionsDetachable === false) _detachable = false;
+            if(self.endpoints[1].connectionsDetachable === false) _detachable = false;
+			/*
+            * Function: isDetachable
+            * Returns whether or not this connection can be detached from its target/source endpoint.  by default this
+            * is false; use it in conjunction with the 'reattach' parameter.
+            */
+            this.isDetachable = function() {
+                return _detachable === true;
+            };
+            /*
+            * Function: setDetachable
+            * Sets whether or not this connection is detachable.
+            *
+            * Parameters:
+            * 	detachable - whether or not to set the Connection to be detachable.
+            */
+            this.setDetachable = function(detachable) {
+              _detachable = detachable === true;
+            };
+// END DETACHABLE
+
+// REATTACH
+			var _reattach = params.reattach ||
+				self.endpoints[0].reattachConnections ||
+				self.endpoints[1].reattachConnections ||
+				_currentInstance.Defaults.ReattachConnections;
+            /*
+            * Function: isReattach
+            * Returns whether or not this connection will be reattached after having been detached via the mouse and dropped.  by default this
+            * is false; use it in conjunction with the 'detachable' parameter.
+            */
+            this.isReattach = function() {
+                return _reattach === true;
+            };
+            /*
+            * Function: setReattach
+            * Sets whether or not this connection will reattach after having been detached via the mouse and dropped.
+            *
+            * Parameters:
+            * 	reattach	-	whether or not to set the Connection to reattach after drop in whitespace.
+            */
+            this.setReattach = function(reattach) {
+              _reattach = reattach === true;
+            };
+
+// END REATTACH
+			
+// COST + DIRECTIONALITY
+			// if cost not supplied, try to inherit from source endpoint
+			var _cost = params.cost || self.endpoints[0].getConnectionCost();			
+			self.getCost = function() { return _cost; };
+			self.setCost = function(c) { _cost = c; };			
+			var _bidirectional = !(params.bidirectional === false);
+			// inherit bidirectional flag if set no source endpoint
+            if (params.bidirectional == null) _bidirectional = self.endpoints[0].areConnectionsBidirectional();
+			self.isBidirectional = function() { return _bidirectional; };
+// END COST + DIRECTIONALITY
+                        
+// PARAMETERS						
+			// merge all the parameters objects into the connection.  parameters set
+			// on the connection take precedence; then target endpoint params, then
+			// finally source endpoint params.
+			// TODO jsPlumb.extend could be made to take more than two args, and it would
+			// apply the second through nth args in order.
+			var _p = jsPlumb.extend({}, this.endpoints[0].getParameters());
+			jsPlumb.extend(_p, this.endpoints[1].getParameters());
+			jsPlumb.extend(_p, self.getParameters());
+			self.setParameters(_p);
+// END PARAMETERS
+						
+// MISCELLANEOUS			
+			/**
+			 * implementation of abstract method in jsPlumbUtil.EventGenerator
+			 * @return list of attached elements. in our case, a list of Endpoints.
+			 */
+			this.getAttachedElements = function() {
+				return self.endpoints;
+			};
+			
+			/**
+			 * changes the parent element of this connection to newParent.  not exposed for the public API.
+			 */
+			this.moveParent = function(newParent) {
+				var jpcl = jsPlumb.CurrentLibrary, curParent = jpcl.getParent(self.connector.canvas);				
+				if (self.connector.bgCanvas) {
+				    jpcl.removeElement(self.connector.bgCanvas, curParent);
+				    jpcl.appendElement(self.connector.bgCanvas, newParent);
+                }
+				jpcl.removeElement(self.connector.canvas, curParent);
+				jpcl.appendElement(self.connector.canvas, newParent);                
+                // this only applies for DOMOverlays
+				for (var i = 0; i < self.overlays.length; i++) {
+                    if (self.overlays[i].isAppendedAtTopLevel) {
+					    jpcl.removeElement(self.overlays[i].canvas, curParent);
+					    jpcl.appendElement(self.overlays[i].canvas, newParent);
+					    if (self.overlays[i].reattachListeners) 
+					    	self.overlays[i].reattachListeners(self.connector);
+                    }
+				}
+				if (self.connector.reattachListeners)		// this is for SVG/VML; change an element's parent and you have to reinit its listeners.
+					self.connector.reattachListeners();     // the Canvas implementation doesn't have to care about this
+			};
+		    
+// END MISCELLANEOUS
+
+// PAINTING
+
+			/*
+			 * Paints the Connection.  Not exposed for public usage. 
+			 * 
+			 * Parameters:
+			 * 	elId - Id of the element that is in motion.
+			 * 	ui - current library's event system ui object (present if we came from a drag to get here).
+			 *  recalc - whether or not to recalculate all anchors etc before painting. 
+			 *  timestamp - timestamp of this paint.  If the Connection was last painted with the same timestamp, it does not paint again.
+			 */
+			var lastPaintedAt = null;			
+			this.paint = function(params) {
+				
+				if (visible) {
+						
+					params = params || {};
+					var elId = params.elId, ui = params.ui, recalc = params.recalc, timestamp = params.timestamp,
+						// if the moving object is not the source we must transpose the two references.
+						swap = false,
+						tId = swap ? this.sourceId : this.targetId, sId = swap ? this.targetId : this.sourceId,
+						tIdx = swap ? 0 : 1, sIdx = swap ? 1 : 0;
+
+					if (timestamp == null || timestamp != lastPaintedAt) {
+						var sourceInfo = _updateOffset( { elId : elId, offset : ui, recalc : recalc, timestamp : timestamp }),
+							targetInfo = _updateOffset( { elId : tId, timestamp : timestamp }); // update the target if this is a forced repaint. otherwise, only the source has been moved.
+						
+						var sE = this.endpoints[sIdx], tE = this.endpoints[tIdx],
+							sAnchorP = sE.anchor.getCurrentLocation(sE),				
+							tAnchorP = tE.anchor.getCurrentLocation(tE);
+									
+						/* paint overlays*/
+						var maxSize = 0;
+						for ( var i = 0; i < self.overlays.length; i++) {
+							var o = self.overlays[i];
+							if (o.isVisible()) maxSize = Math.max(maxSize, o.computeMaxSize());
+						}
+		
+						var dim = this.connector.compute(
+							sAnchorP,
+							tAnchorP, 
+							this.endpoints[sIdx],
+							this.endpoints[tIdx],
+							this.endpoints[sIdx].anchor,
+							this.endpoints[tIdx].anchor, 
+							self.paintStyleInUse.lineWidth,
+							maxSize,
+							sourceInfo,
+							targetInfo );
+												
+						self.connector.paint(dim, self.paintStyleInUse);
+						
+						/* paint overlays*/
+						for ( var i = 0; i < self.overlays.length; i++) {
+							var o = self.overlays[i];
+							if (o.isVisible) self.overlayPlacements[i] = o.draw(self.connector, self.paintStyleInUse, dim, timestamp);
+						}
+					}
+					lastPaintedAt = timestamp;						
+				}		
+			};			
+
+			/*
+			 * Function: repaint
+			 * Repaints the Connection. No parameters exposed to public API.
+			 */
+			this.repaint = function(params) {
+				params = params || {};
+                var recalc = !(params.recalc === false);
+				this.paint({ elId : this.sourceId, recalc : recalc, timestamp:params.timestamp });
+			};
+			
+			// the very last thing we do is check to see if a 'type' was supplied in the params
+			var _type = params.type || self.endpoints[0].connectionType || self.endpoints[1].connectionType;
+			if (_type)
+				self.addType(_type);
+			
+// END PAINTING
+
+// ***************************** PLACEHOLDERS FOR NATURAL DOCS *************************************************
+			/*
+			 * Function: bind
+			 * Bind to an event on the Connection.  
+			 * 
+			 * Parameters:
+			 * 	event - the event to bind.  Available events on a Connection are:
+			 *         - *click*						:	notification that a Connection was clicked.  
+			 *         - *dblclick*						:	notification that a Connection was double clicked.
+			 *         - *mouseenter*					:	notification that the mouse is over a Connection. 
+			 *         - *mouseexit*					:	notification that the mouse exited a Connection.
+			 * 		   - *contextmenu*                  :   notification that the user right-clicked on the Connection.
+			 *         
+			 *  callback - function to callback. This function will be passed the Connection that caused the event, and also the original event.    
+			 */
+			
+			/*
+		     * Function: setPaintStyle
+		     * Sets the Connection's paint style and then repaints the Connection.
+		     * 
+		     * Parameters:
+		     * 	style - Style to use.
+		     */
+
+		     /*
+		     * Function: getPaintStyle
+		     * Gets the Connection's paint style. This is not necessarily the paint style in use at the time;
+		     * this is the paint style for the connection when the mouse it not hovering over it.
+		     */
+			
+			/*
+		     * Function: setHoverPaintStyle
+		     * Sets the paint style to use when the mouse is hovering over the Connection. This is null by default.
+		     * The hover paint style is applied as extensions to the paintStyle; it does not entirely replace
+		     * it.  This is because people will most likely want to change just one thing when hovering, say the
+		     * color for example, but leave the rest of the appearance the same.
+		     * 
+		     * Parameters:
+		     * 	style - Style to use when the mouse is hovering.
+		     *  doNotRepaint - if true, the Connection will not be repainted.  useful when setting things up initially.
+		     */
+			
+			/*
+		     * Function: setHover
+		     * Sets/unsets the hover state of this Connection.
+		     * 
+		     * Parameters:
+		     * 	hover - hover state boolean
+		     * 	ignoreAttachedElements - if true, does not notify any attached elements of the change in hover state.  used mostly to avoid infinite loops.
+		     */
+
+		     /*
+		     * Function: getParameter
+		     * Gets the named parameter; returns null if no parameter with that name is set. Parameter values may have been supplied to a 'connect' or 'addEndpoint' call (connections made with the mouse get a copy of all parameters set on each of their Endpoints), or the parameter value may have been set with setParameter.
+		     *
+		     * Parameters:
+		     *   key - Parameter name.
+		     */
+
+		     /*
+		     * Function: setParameter
+		     * Sets the named parameter to the given value.
+		     *
+		     * Parameters:
+		     *   key - Parameter name.
+		     *   value - Parameter value.
+		     */
+			 
+			 /*
+			 * Property: connector
+			 * The underlying Connector for this Connection (eg. a Bezier connector, straight line connector, flowchart connector etc)
+			 */
+			 
+			 /*
+			 * Property: sourceId
+			 * Id of the source element in the connection.
+			 */
+			/*
+			 * Property: targetId
+			 * Id of the target element in the connection.
+			 */
+			/*
+			 * Property: scope
+			 * Optional scope descriptor for the connection.
+			 */
+			/*
+			 * Property: endpoints
+			 * Array of [source, target] Endpoint objects.
+			 */
+			/*
+			 *	Property: source
+			 *	The source element for this Connection.
+			 */
+			/*
+			 *	Property: target
+			 *	The target element for this Connection.
+			 */
+			/*
+			 * Property: overlays
+			 * List of Overlays for this component.
+			 */
+			/*
+			 * Function: addOverlay
+			 * Adds an Overlay to the Connection.
+			 * 
+			 * Parameters:
+			 * 	overlay - Overlay to add.
+			 */
+			/*
+			 * Function: getOverlay
+			 * Gets an overlay, by ID. Note: by ID.  You would pass an 'id' parameter
+			 * in to the Overlay's constructor arguments, and then use that to retrieve
+			 * it via this method.
+			 *
+			 * Parameters:
+			 * 	overlayId 	-	id of the overlay to retrieve.
+			 */
+			/*
+			* Function: getOverlays
+			* Gets all the overlays for this component.
+			*/
+			/*
+			 * Function: hideOverlay
+			 * Hides the overlay specified by the given id.
+			 *
+			 * Parameters:
+			 * 	overlayId 	-	id of the overlay to hide.
+			 */
+			/*
+			 * Function: hideOverlays
+			 * Hides all Overlays
+			 */
+			/*
+			 * Function: showOverlay
+			 * Shows the overlay specified by the given id.
+			 *
+			 * Parameters:
+			 * 	overlayId 	-	id of the overlay to show. 
+			 */
+			/*
+			 * Function: showOverlays
+			 * Shows all Overlays 
+			 */
+			/**
+			 * Function: removeAllOverlays
+			 * Removes all overlays from the Connection, and then repaints.
+			 */
+			/**
+			 * Function: removeOverlay
+			 * Removes an overlay by ID.  Note: by ID.  this is a string you set in the overlay spec.
+			 * 
+			 * Parameters:
+			 * 	overlayId - id of the overlay to remove.
+			 */
+			/**
+			 * Function: removeOverlays
+			 * Removes a set of overlays by ID.  Note: by ID.  this is a string you set in the overlay spec.
+			 * 
+			 * Parameters:
+			 * 	overlayIds - this function takes an arbitrary number of arguments, each of which is a single overlay id.
+			 */
+			/*
+			 * Function: setLabel
+			 * Sets the Connection's label.  
+			 * 
+			 * Parameters:
+			 * 	l	- label to set. May be a String, a Function that returns a String, or a params object containing { "label", "labelStyle", "location", "cssClass" }.  Note that this uses innerHTML on the label div, so keep
+			 * that in mind if you need escaped HTML.
+			 */
+			/*
+			* Function: getLabel
+			* Returns the label text for this Connection (or a function if you are labelling with a function).
+			* 
+			* This does not return the overlay itself; this is a convenience method which is a pair with
+			* setLabel; together they allow you to add and access a Label Overlay without having to create the
+			* Overlay object itself.  For access to the underlying label overlay that jsPlumb has created,
+			* use getLabelOverlay.
+			*
+			* See Also:
+			* 	<getOverlay>
+			*/
+			/*
+			* Function: getLabelOverlay
+			* Returns the underlying internal label overlay, which will exist if you specified a label on
+			* a connect call, or have called setLabel at any stage.   
+			*/
+			
+// ***************************** END OF PLACEHOLDERS FOR NATURAL DOCS *************************************************												
+
+			
+		}; // END Connection class
+		
+// ENDPOINT HELPER FUNCTIONS
+		var _makeConnectionDragHandler = function(placeholder) {
+            var stopped = false;
+            return {
+                drag : function() {
+                    if (stopped) {
+                        stopped = false;
+                        return true;
+                    }
+                    var _ui = jsPlumb.CurrentLibrary.getUIPosition(arguments, _currentInstance.getZoom()),
+                        el = placeholder.element;
+            
+                    if (el) {
+                        jsPlumb.CurrentLibrary.setOffset(el, _ui);
+                        _draw(_getElementObject(el), _ui);
+                    }
+                },
+                stopDrag : function() {
+                    stopped = true;
+                }
+            };
+		};		
+		
+		var _makeFloatingEndpoint = function(paintStyle, referenceAnchor, endpoint, referenceCanvas, sourceElement) {			
+				var floatingAnchor = new FloatingAnchor( { reference : referenceAnchor, referenceCanvas : referenceCanvas });
+        //setting the scope here should not be the way to fix that mootools issue.  it should be fixed by not
+        // adding the floating endpoint as a droppable.  that makes more sense anyway!
+        return _newEndpoint({ paintStyle : paintStyle, endpoint : endpoint, anchor : floatingAnchor, source : sourceElement, scope:"__floating" });
+		};
+		
+		/**
+		 * creates a placeholder div for dragging purposes, adds it to the DOM, and pre-computes its offset.
+		 */
+		var _makeDraggablePlaceholder = function(placeholder, parent) {
+			var n = document.createElement("div");
+			n.style.position = "absolute";
+			var placeholderDragElement = _getElementObject(n);
+			_appendElement(n, parent);
+			var id = _getId(placeholderDragElement);
+			_updateOffset( { elId : id });
+			// create and assign an id, and initialize the offset.
+			placeholder.id = id;
+			placeholder.element = placeholderDragElement;
+		};
+
+		/*
+		 * Class: Endpoint 
+		 * 
+		 * Models an endpoint. Can have 1 to 'maxConnections' Connections emanating from it (set maxConnections to -1 
+		 * to allow unlimited).  Typically, if you use 'jsPlumb.connect' to programmatically connect two elements, you won't
+		 * actually deal with the underlying Endpoint objects.  But if you wish to support drag and drop Connections, one of the ways you
+		 * do so is by creating and registering Endpoints using 'jsPlumb.addEndpoint', and marking these Endpoints as 'source' and/or
+		 * 'target' Endpoints for Connections.  
+		 * 
+		 * 
+		 */
+
+		/*
+		 * Function: Endpoint 
+		 * 
+		 * Endpoint constructor.
+		 * 
+		 * Parameters: 
+		 * anchor - definition of the Anchor for the endpoint.  You can include one or more Anchor definitions here; if you include more than one, jsPlumb creates a 'dynamic' Anchor, ie. an Anchor which changes position relative to the other elements in a Connection.  Each Anchor definition can be either a string nominating one of the basic Anchors provided by jsPlumb (eg. "TopCenter"), or a four element array that designates the Anchor's location and orientation (eg, and this is equivalent to TopCenter, [ 0.5, 0, 0, -1 ]).  To provide more than one Anchor definition just put them all in an array. You can mix string definitions with array definitions.
+		 * endpoint - optional Endpoint definition. This takes the form of either a string nominating one of the basic Endpoints provided by jsPlumb (eg. "Rectangle"), or an array containing [name,params] for those cases where you don't wish to use the default values, eg. [ "Rectangle", { width:5, height:10 } ].
+		 * enabled - optional, defaults to true. Indicates whether or not the Endpoint should be enabled for mouse events (drag/drop).
+		 * paintStyle - endpoint style, a js object. may be null. 
+		 * hoverPaintStyle - style to use when the mouse is hovering over the Endpoint. A js object. may be null; defaults to null.
+		 * cssClass - optional CSS class to set on the display element associated with this Endpoint.
+		 * hoverClass - optional CSS class to set on the display element associated with this Endpoint when it is in hover state.
+		 * source - element the Endpoint is attached to, of type String (an element id) or element selector. Required.
+		 * canvas - canvas element to use. may be, and most often is, null.
+		 * container - optional id or selector instructing jsPlumb where to attach the element it creates for this endpoint.  you should read the documentation for a full discussion of this.
+		 * connections - optional list of Connections to configure the Endpoint with. 
+		 * isSource - boolean. indicates the endpoint can act as a source of new connections. Optional; defaults to false.
+		 * maxConnections - integer; defaults to 1.  a value of -1 means no upper limit. 
+		 * dragOptions - if isSource is set to true, you can supply arguments for the underlying library's drag method. Optional; defaults to null. 
+		 * connectorStyle - if isSource is set to true, this is the paint style for Connections from this Endpoint. Optional; defaults to null.
+		 * connectorHoverStyle - if isSource is set to true, this is the hover paint style for Connections from this Endpoint. Optional; defaults to null.
+		 * connector - optional Connector type to use.  Like 'endpoint', this may be either a single string nominating a known Connector type (eg. "Bezier", "Straight"), or an array containing [name, params], eg. [ "Bezier", { curviness:160 } ].
+		 * connectorOverlays - optional array of Overlay definitions that will be applied to any Connection from this Endpoint. 
+		 * connectorClass - optional CSS class to set on Connections emanating from this Endpoint.
+		 * connectorHoverClass - optional CSS class to set on to set on Connections emanating from this Endpoint when they are in hover state.		 
+		 * connectionsDetachable - optional, defaults to true. Sets whether connections to/from this Endpoint should be detachable or not.
+		 * isTarget - boolean. indicates the endpoint can act as a target of new connections. Optional; defaults to false.
+		 * dropOptions - if isTarget is set to true, you can supply arguments for the underlying library's drop method with this parameter. Optional; defaults to null. 
+		 * reattach - optional boolean that determines whether or not the Connections reattach after they have been dragged off an Endpoint and left floating. defaults to false: Connections dropped in this way will just be deleted.
+		 * parameters - Optional JS object containing parameters to set on the Endpoint. These parameters are then available via the getParameter method.  When a connection is made involving this Endpoint, the parameters from this Endpoint are copied into that Connection. Source Endpoint parameters override target Endpoint parameters if they both have a parameter with the same name.
+		 */
+		var Endpoint = function(params) {
+			var self = this;
+			self.idPrefix = "_jsplumb_e_";			
+			self.defaultLabelLocation = [ 0.5, 0.5 ];
+			self.defaultOverlayKeys = ["Overlays", "EndpointOverlays"];
+			this.parent = params.parent;
+			overlayCapableJsPlumbUIComponent.apply(this, arguments);
+			params = params || {};
+			
+// TYPE		
+			
+			this.getTypeDescriptor = function() { return "endpoint"; };
+			this.getDefaultType = function() {								
+				return {
+					parameters:{},
+					scope:null,
+					maxConnections:self._jsPlumb.Defaults.MaxConnections,
+					paintStyle:self._jsPlumb.Defaults.EndpointStyle || jsPlumb.Defaults.EndpointStyle,
+					endpoint:self._jsPlumb.Defaults.Endpoint || jsPlumb.Defaults.Endpoint,
+					hoverPaintStyle:self._jsPlumb.Defaults.EndpointHoverStyle || jsPlumb.Defaults.EndpointHoverStyle,				
+					overlays:self._jsPlumb.Defaults.EndpointOverlays || jsPlumb.Defaults.EndpointOverlays,
+					connectorStyle:params.connectorStyle,				
+					connectorHoverStyle:params.connectorHoverStyle,
+					connectorClass:params.connectorClass,
+					connectorHoverClass:params.connectorHoverClass,
+					connectorOverlays:params.connectorOverlays,
+					connector:params.connector,
+					connectorTooltip:params.connectorTooltip
+				};
+			};
+			var superAt = this.applyType;
+			this.applyType = function(t) {
+				superAt(t);
+				if (t.maxConnections != null) _maxConnections = t.maxConnections;
+				if (t.scope) self.scope = t.scope;
+				self.connectorStyle = t.connectorStyle;
+				self.connectorHoverStyle = t.connectorHoverStyle;
+				self.connectorOverlays = t.connectorOverlays;
+				self.connector = t.connector;
+				self.connectorTooltip = t.connectorTooltip;
+				self.connectionType = t.connectionType;
+				self.connectorClass = t.connectorClass;
+				self.connectorHoverClass = t.connectorHoverClass;
+			};			
+// END TYPE
+		
+			var visible = true, __enabled = !(params.enabled === false);
+			/*
+				Function: isVisible
+				Returns whether or not the Endpoint is currently visible.
+			*/
+			this.isVisible = function() { return visible; };
+			/*
+				Function: setVisible
+				Sets whether or not the Endpoint is currently visible.
+
+				Parameters:
+					visible - whether or not the Endpoint should be visible.
+					doNotChangeConnections - Instructs jsPlumb to not pass the visible state on to any attached Connections. defaults to false.
+					doNotNotifyOtherEndpoint - Instructs jsPlumb to not pass the visible state on to Endpoints at the other end of any attached Connections. defaults to false. 
+			*/
+			this.setVisible = function(v, doNotChangeConnections, doNotNotifyOtherEndpoint) {
+				visible = v;
+				if (self.canvas) self.canvas.style.display = v ? "block" : "none";
+				self[v ? "showOverlays" : "hideOverlays"]();
+				if (!doNotChangeConnections) {
+					for (var i = 0; i < self.connections.length; i++) {
+						self.connections[i].setVisible(v);
+						if (!doNotNotifyOtherEndpoint) {
+							var oIdx = self === self.connections[i].endpoints[0] ? 1 : 0;
+							// only change the other endpoint if this is its only connection.
+							if (self.connections[i].endpoints[oIdx].connections.length == 1) self.connections[i].endpoints[oIdx].setVisible(v, true, true);
+						}
+					}
+				}
+			};			
+
+			/*
+				Function: isEnabled
+				Returns whether or not the Endpoint is enabled for drag/drop connections.
+			*/
+			this.isEnabled = function() { return __enabled; };
+
+			/*
+				Function: setEnabled
+				Sets whether or not the Endpoint is enabled for drag/drop connections.
+				
+				Parameters:
+					enabled - whether or not the Endpoint is enabled.			
+			*/
+			this.setEnabled = function(e) { __enabled = e; };
+
+			var _element = params.source,  _uuid = params.uuid, floatingEndpoint = null,  inPlaceCopy = null;
+			if (_uuid) endpointsByUUID[_uuid] = self;
+			var _elementId = _getAttribute(_element, "id");
+			this.elementId = _elementId;
+			this.element = _element;
+			
+			var _connectionCost = params.connectionCost;
+			this.getConnectionCost = function() { return _connectionCost; };
+			this.setConnectionCost = function(c) {
+				_connectionCost = c; 
+			};
+			
+			var _connectionsBidirectional = params.connectionsBidirectional === false ? false : true;
+			this.areConnectionsBidirectional = function() { return _connectionsBidirectional; };
+			this.setConnectionsBidirectional = function(b) { _connectionsBidirectional = b; };
+						
+			self.anchor = params.anchor ? _currentInstance.makeAnchor(params.anchor, _elementId, _currentInstance) : params.anchors ? _currentInstance.makeAnchor(params.anchors, _elementId, _currentInstance) : _currentInstance.makeAnchor(_currentInstance.Defaults.Anchor || "TopCenter", _elementId, _currentInstance);
+				
+			// ANCHOR MANAGER
+			if (!params._transient) // in place copies, for example, are transient.  they will never need to be retrieved during a paint cycle, because they dont move, and then they are deleted.
+				_currentInstance.anchorManager.add(self, _elementId);
+
+			var _endpoint = null, originalEndpoint = null;
+			this.setEndpoint = function(ep) {
+				var endpointArgs = {
+	                _jsPlumb:self._jsPlumb,
+	                parent:params.parent,
+	                container:params.container,
+	                tooltip:params.tooltip,
+	                connectorTooltip:params.connectorTooltip,
+	                endpoint:self
+	            };
+				if (_isString(ep)) 
+					_endpoint = new jsPlumb.Endpoints[renderMode][ep](endpointArgs);
+				else if (_isArray(ep)) {
+					endpointArgs = jsPlumb.extend(ep[1], endpointArgs);
+					_endpoint = new jsPlumb.Endpoints[renderMode][ep[0]](endpointArgs);
+				}
+				else {
+					_endpoint = ep.clone();
+				}
+
+				// assign a clone function using a copy of endpointArgs. this is used when a drag starts: the endpoint that was dragged is cloned,
+				// and the clone is left in its place while the original one goes off on a magical journey. 
+				// the copy is to get around a closure problem, in which endpointArgs ends up getting shared by
+				// the whole world.
+				var argsForClone = jsPlumb.extend({}, endpointArgs);						
+				_endpoint.clone = function() {
+					var o = new Object();
+					_endpoint.constructor.apply(o, [argsForClone]);
+					return o;
+				};
+
+				self.endpoint = _endpoint;
+				self.type = self.endpoint.type;
+			};
+			 
+			this.setEndpoint(params.endpoint || _currentInstance.Defaults.Endpoint || jsPlumb.Defaults.Endpoint || "Dot");							
+			originalEndpoint = _endpoint;
+
+			// override setHover to pass it down to the underlying endpoint
+			var _sh = self.setHover;
+			self.setHover = function() {
+				self.endpoint.setHover.apply(self.endpoint, arguments);
+				_sh.apply(self, arguments);
+			};
+            // endpoint delegates to first connection for hover, if there is one.
+            var internalHover = function(state) {
+              if (self.connections.length > 0)
+                self.connections[0].setHover(state, false);
+              else
+                self.setHover(state);
+            };
+			
+			// bind listeners from endpoint to self, with the internal hover function defined above.
+            _bindListeners(self.endpoint, self, internalHover);
+			
+			this.setPaintStyle(params.paintStyle || 
+							   params.style || 
+							   _currentInstance.Defaults.EndpointStyle || 
+							   jsPlumb.Defaults.EndpointStyle, true);
+			this.setHoverPaintStyle(params.hoverPaintStyle || 
+									_currentInstance.Defaults.EndpointHoverStyle || 
+									jsPlumb.Defaults.EndpointHoverStyle, true);
+			this.paintStyleInUse = this.getPaintStyle();
+			var originalPaintStyle = this.getPaintStyle();
+			this.connectorStyle = params.connectorStyle;
+			this.connectorHoverStyle = params.connectorHoverStyle;
+			this.connectorOverlays = params.connectorOverlays;
+			this.connector = params.connector;
+			this.connectorTooltip = params.connectorTooltip;
+			this.connectorClass = params.connectorClass;
+			this.connectorHoverClass = params.connectorHoverClass;	
+			this.isSource = params.isSource || false;
+			this.isTarget = params.isTarget || false;
+			
+			var _maxConnections = params.maxConnections || _currentInstance.Defaults.MaxConnections; // maximum number of connections this endpoint can be the source of.
+						
+			this.getAttachedElements = function() {
+				return self.connections;
+			};
+						
+			this.canvas = this.endpoint.canvas;			
+			this.connections = params.connections || [];
+			
+			this.scope = params.scope || DEFAULT_SCOPE;
+			this.connectionType = params.connectionType;
+			this.timestamp = null;
+			//self.isReattach = params.reattach || false;
+			self.reattachConnections = params.reattach || _currentInstance.Defaults.ReattachConnections;
+			//self.isReattach = params.reattach || false;
+            self.connectionsDetachable = _currentInstance.Defaults.ConnectionsDetachable;
+            if (params.connectionsDetachable === false || params.detachable === false)
+                self.connectionsDetachable = false;
+			var dragAllowedWhenFull = params.dragAllowedWhenFull || true;
+			
+			if (params.onMaxConnections)
+				self.bind("maxConnections", params.onMaxConnections);
+
+			this.computeAnchor = function(params) {
+				return self.anchor.compute(params);
+			};
+			/*
+			 * Function: addConnection
+			 *   Adds a Connection to this Endpoint.
+			 *   
+			 * Parameters:
+			 *   connection - the Connection to add.
+			 */
+			this.addConnection = function(connection) {
+				self.connections.push(connection);
+			};			
+			/*
+			 * Function: detach
+			 *   Detaches the given Connection from this Endpoint.
+			 *   
+			 * Parameters:
+			 *   connection - the Connection to detach.
+			 *   ignoreTarget - optional; tells the Endpoint to not notify the Connection target that the Connection was detached.  The default behaviour is to notify the target.
+			 */
+			this.detach = function(connection, ignoreTarget, forceDetach, fireEvent, originalEvent) {
+				var idx = _findWithFunction(self.connections, function(c) { return c.id == connection.id}), 
+					actuallyDetached = false;
+                fireEvent = (fireEvent !== false);
+				if (idx >= 0) {		
+					// 1. does the connection have a before detach (note this also checks jsPlumb's bound
+					// detach handlers; but then Endpoint's check will, too, hmm.)
+					if (forceDetach || connection._forceDetach || connection.isDetachable() || connection.isDetachAllowed(connection)) {
+						// get the target endpoint
+						var t = connection.endpoints[0] == self ? connection.endpoints[1] : connection.endpoints[0];
+						// it would be nice to check with both endpoints that it is ok to detach. but 
+						// for this we'll have to get a bit fancier: right now if you use the same beforeDetach
+						// interceptor for two endpoints (which is kind of common, because it's part of the
+						// endpoint definition), then it gets fired twice.  so in fact we need to loop through
+						// each beforeDetach and see if it returns false, at which point we exit.  but if it
+						// returns true, we have to check the next one.  however we need to track which ones
+						// have already been run, and not run them again.
+						if (forceDetach || connection._forceDetach || (self.isDetachAllowed(connection) /*&& t.isDetachAllowed(connection)*/)) {
+					
+							self.connections.splice(idx, 1);										
+					
+							// this avoids a circular loop
+							if (!ignoreTarget) {
+							
+								t.detach(connection, true, forceDetach);
+								// check connection to see if we want to delete the endpoints associated with it.
+								// we only detach those that have just this connection; this scenario is most
+								// likely if we got to this bit of code because it is set by the methods that
+								// create their own endpoints, like .connect or .makeTarget. the user is
+								// not likely to have interacted with those endpoints.
+								if (connection.endpointsToDeleteOnDetach){
+									for (var i = 0; i < connection.endpointsToDeleteOnDetach.length; i++) {
+										var cde = connection.endpointsToDeleteOnDetach[i];
+										if (cde && cde.connections.length == 0) 
+											_currentInstance.deleteEndpoint(cde);							
+									}
+								}
+							}
+							_removeElements(connection.connector.getDisplayElements(), connection.parent);
+							_removeWithFunction(connectionsByScope[connection.scope], function(c) {
+								return c.id == connection.id;
+							});
+							actuallyDetached = true;
+                            var doFireEvent = (!ignoreTarget && fireEvent)
+							fireDetachEvent(connection, doFireEvent, originalEvent);
+						}
+					}
+				}
+				return actuallyDetached;
+			};			
+
+			/*
+			 * Function: detachAll
+			 *   Detaches all Connections this Endpoint has.
+			 *
+			 * Parameters:
+			 *  fireEvent   -   whether or not to fire the detach event.  defaults to false.
+			 */
+			this.detachAll = function(fireEvent, originalEvent) {
+				while (self.connections.length > 0) {
+					self.detach(self.connections[0], false, true, fireEvent, originalEvent);
+				}
+			};
+			/*
+			 * Function: detachFrom
+			 *   Removes any connections from this Endpoint that are connected to the given target endpoint.
+			 *   
+			 * Parameters:
+			 *   targetEndpoint     - Endpoint from which to detach all Connections from this Endpoint.
+			 *   fireEvent          - whether or not to fire the detach event. defaults to false.
+			 */
+			this.detachFrom = function(targetEndpoint, fireEvent, originalEvent) {
+				var c = [];
+				for ( var i = 0; i < self.connections.length; i++) {
+					if (self.connections[i].endpoints[1] == targetEndpoint
+							|| self.connections[i].endpoints[0] == targetEndpoint) {
+						c.push(self.connections[i]);
+					}
+				}
+				for ( var i = 0; i < c.length; i++) {
+					if (self.detach(c[i], false, true, fireEvent, originalEvent))
+						c[i].setHover(false, false);					
+				}
+			};			
+			/*
+			 * Function: detachFromConnection
+			 *   Detach this Endpoint from the Connection, but leave the Connection alive. Used when dragging.
+			 *   
+			 * Parameters:
+			 *   connection - Connection to detach from.
+			 */
+			this.detachFromConnection = function(connection) {
+				var idx =  _findWithFunction(self.connections, function(c) { return c.id == connection.id});
+				if (idx >= 0) {
+					self.connections.splice(idx, 1);
+				}
+			};
+
+			/*
+			 * Function: getElement
+			 *
+			 * Returns:
+			 * 	The DOM element this Endpoint is attached to.
+			 */
+			this.getElement = function() {
+				return _element;
+			};		
+			
+			/*
+			 * Function: setElement
+			 * Sets the DOM element this Endpoint is attached to.
+			 *
+			 * Parameters:
+			 * 	el	-	dom element or selector
+			 * 	container	-	optional, specifies the actual parent element to use as the parent for this Endpoint's visual representation.
+			 * 	See the jsPlumb documentation for a discussion about this.
+			 */
+			this.setElement = function(el, container) {
+
+				// TODO possibly have this object take charge of moving the UI components into the appropriate
+				// parent.  this is used only by makeSource right now, and that function takes care of
+				// moving the UI bits and pieces.  however it would s			
+				var parentId = _getId(el);
+				// remove the endpoint from the list for the current endpoint's element
+				_removeWithFunction(endpointsByElement[self.elementId], function(e) {
+					return e.id == self.id;
+				});
+				_element = _getElementObject(el);
+				_elementId = _getId(_element);
+				self.elementId = _elementId;
+				// need to get the new parent now
+				var newParentElement = _getParentFromParams({source:parentId, container:container}),
+				curParent = jpcl.getParent(self.canvas);
+				jpcl.removeElement(self.canvas, curParent);
+				jpcl.appendElement(self.canvas, newParentElement);								
+				
+				// now move connection(s)...i would expect there to be only one but we will iterate.
+				for (var i = 0; i < self.connections.length; i++) {
+					self.connections[i].moveParent(newParentElement);
+					self.connections[i].sourceId = _elementId;
+					self.connections[i].source = _element;					
+				}	
+				_addToList(endpointsByElement, parentId, self);
+				//_currentInstance.repaint(parentId);			
+			
+			};
+
+			/*
+			 * Function: getUuid
+			 *   Returns the UUID for this Endpoint, if there is one. Otherwise returns null.
+			 */
+			this.getUuid = function() {
+				return _uuid;
+			};
+			/**
+			 * private but must be exposed.
+			 */
+			this.makeInPlaceCopy = function() {
+				var loc = self.anchor.getCurrentLocation(self),
+					o = self.anchor.getOrientation(self),
+					inPlaceAnchor = {
+						compute:function() { return [ loc[0], loc[1] ]},
+						getCurrentLocation : function() { return [ loc[0], loc[1] ]},
+						getOrientation:function() { return o; }
+					};
+
+				return _newEndpoint( { 
+					anchor : inPlaceAnchor, 
+					source : _element, 
+					paintStyle : this.getPaintStyle(), 
+					endpoint : _endpoint,
+					_transient:true,
+                    scope:self.scope
+				});
+			};
+			/*
+			 * Function: isConnectedTo
+			 *   Returns whether or not this endpoint is connected to the given Endpoint.
+			 *   
+			 * Parameters:
+			 *   endpoint - Endpoint to test.
+			 */
+			this.isConnectedTo = function(endpoint) {
+				var found = false;
+				if (endpoint) {
+					for ( var i = 0; i < self.connections.length; i++) {
+						if (self.connections[i].endpoints[1] == endpoint) {
+							found = true;
+							break;
+						}
+					}
+				}
+				return found;
+			};
+
+			/**
+			 * private but needs to be exposed.
+			 */
+			this.isFloating = function() {
+				return floatingEndpoint != null;
+			};
+			
+			/**
+			 * returns a connection from the pool; used when dragging starts.  just gets the head of the array if it can.
+			 */
+			this.connectorSelector = function() {
+				var candidate = self.connections[0];
+				if (self.isTarget && candidate) return candidate;
+				else {
+					return (self.connections.length < _maxConnections) || _maxConnections == -1 ? null : candidate;
+				}
+			};
+
+			/*
+			 * Function: isFull
+			 *   Returns whether or not the Endpoint can accept any more Connections.
+			 */
+			this.isFull = function() {
+				return !(self.isFloating() || _maxConnections < 1 || self.connections.length < _maxConnections);				
+			};
+			/*
+			 * Function: setDragAllowedWhenFull
+			 *   Sets whether or not connections can be dragged from this Endpoint once it is full. You would use this in a UI in 
+			 *   which you're going to provide some other way of breaking connections, if you need to break them at all. This property 
+			 *   is by default true; use it in conjunction with the 'reattach' option on a connect call.
+			 *   
+			 * Parameters:
+			 *   allowed - whether drag is allowed or not when the Endpoint is full.
+			 */
+			this.setDragAllowedWhenFull = function(allowed) {
+				dragAllowedWhenFull = allowed;
+			};
+			/*
+			 * Function: setStyle
+			 *   Sets the paint style of the Endpoint.  This is a JS object of the same form you supply to a jsPlumb.addEndpoint or jsPlumb.connect call.
+			 *   TODO move setStyle into EventGenerator, remove it from here. is Connection's method currently setPaintStyle ? wire that one up to
+			 *   setStyle and deprecate it if so.
+			 *   
+			 * Parameters:
+			 *   style - Style object to set, for example {fillStyle:"blue"}.
+			 *   
+			 *  @deprecated use setPaintStyle instead.
+			 */
+			this.setStyle = self.setPaintStyle;
+
+			/**
+			 * a deep equals check. everything must match, including the anchor,
+			 * styles, everything. TODO: finish Endpoint.equals
+			 */
+			this.equals = function(endpoint) {
+				return this.anchor.equals(endpoint.anchor);
+			};
+			
+			// a helper function that tries to find a connection to the given element, and returns it if so. if elementWithPrecedence is null,
+			// or no connection to it is found, we return the first connection in our list.
+			var findConnectionToUseForDynamicAnchor = function(elementWithPrecedence) {
+				var idx = 0;
+				if (elementWithPrecedence != null) {
+					for (var i = 0; i < self.connections.length; i++) {
+						if (self.connections[i].sourceId == elementWithPrecedence || self.connections[i].targetId == elementWithPrecedence) {
+							idx = i;
+							break;
+						}
+					}
+				}
+				
+				return self.connections[idx];
+			};
+
+			/*
+			 * Function: paint
+			 *   Paints the Endpoint, recalculating offset and anchor positions if necessary. This does NOT paint
+			 *   any of the Endpoint's connections.
+			 *   
+			 * Parameters:
+			 *   timestamp - optional timestamp advising the Endpoint of the current paint time; if it has painted already once for this timestamp, it will not paint again.
+			 *   canvas - optional Canvas to paint on.  Only used internally by jsPlumb in certain obscure situations.
+			 *   connectorPaintStyle - paint style of the Connector attached to this Endpoint. Used to get a fillStyle if nothing else was supplied.
+			 */
+			this.paint = function(params) {
+				params = params || {};
+				var timestamp = params.timestamp, recalc = !(params.recalc === false);
+								//recalc = params.recalc;
+				if (!timestamp || self.timestamp !== timestamp) {						
+					_updateOffset({ elId:_elementId, timestamp:timestamp, recalc:recalc });
+					var xy = params.offset || offsets[_elementId];
+					if(xy) {
+						var ap = params.anchorPoint,connectorPaintStyle = params.connectorPaintStyle;
+						if (ap == null) {
+							var wh = params.dimensions || sizes[_elementId];
+							if (xy == null || wh == null) {
+								_updateOffset( { elId : _elementId, timestamp : timestamp });
+								xy = offsets[_elementId];
+								wh = sizes[_elementId];
+							}
+							var anchorParams = { xy : [ xy.left, xy.top ], wh : wh, element : self, timestamp : timestamp };
+							if (recalc && self.anchor.isDynamic && self.connections.length > 0) {
+								var c = findConnectionToUseForDynamicAnchor(params.elementWithPrecedence),
+								oIdx = c.endpoints[0] == self ? 1 : 0,
+								oId = oIdx == 0 ? c.sourceId : c.targetId,
+								oOffset = offsets[oId], oWH = sizes[oId];
+								anchorParams.txy = [ oOffset.left, oOffset.top ];
+								anchorParams.twh = oWH;
+								anchorParams.tElement = c.endpoints[oIdx];
+							}
+							ap = self.anchor.compute(anchorParams);
+						}
+											
+						// switched _endpoint to self here; continuous anchors, for instance, look for the
+						// endpoint's id, but here "_endpoint" is the renderer, not the actual endpoint.
+						// TODO need to verify this does not break anything.
+						//var d = _endpoint.compute(ap, self.anchor.getOrientation(_endpoint), self.paintStyleInUse, connectorPaintStyle || self.paintStyleInUse);
+						var d = _endpoint.compute(ap, self.anchor.getOrientation(self), self.paintStyleInUse, connectorPaintStyle || self.paintStyleInUse);
+						_endpoint.paint(d, self.paintStyleInUse, self.anchor);					
+						self.timestamp = timestamp;
+
+						/* paint overlays*/
+						for ( var i = 0; i < self.overlays.length; i++) {
+							var o = self.overlays[i];
+							if (o.isVisible) self.overlayPlacements[i] = o.draw(self.endpoint, self.paintStyleInUse, d);
+						}
+					}
+				}
+			};
+
+            this.repaint = this.paint;
+
+			/**
+			 * @deprecated
+			 */
+			this.removeConnection = this.detach; // backwards compatibility
+
+			// is this a connection source? we make it draggable and have the
+			// drag listener maintain a connection with a floating endpoint.
+			if (jsPlumb.CurrentLibrary.isDragSupported(_element)) {
+				var placeholderInfo = { id:null, element:null },
+                    jpc = null,
+                    existingJpc = false,
+                    existingJpcParams = null,
+                    _dragHandler = _makeConnectionDragHandler(placeholderInfo);
+
+				var start = function() {	
+				// drag might have started on an endpoint that is not actually a source, but which has
+				// one or more connections.
+					jpc = self.connectorSelector();
+                    var _continue = true;
+                    // if not enabled, return
+                    if (!self.isEnabled()) _continue = false;
+					// if no connection and we're not a source, return.
+					if (jpc == null && !params.isSource) _continue = false;
+                    // otherwise if we're full and not allowed to drag, also return false.
+                    if (params.isSource && self.isFull() && !dragAllowedWhenFull) _continue = false;
+                    // if the connection was setup as not detachable or one of its endpoints
+                    // was setup as connectionsDetachable = false, or Defaults.ConnectionsDetachable
+                    // is set to false...
+                    if (jpc != null && !jpc.isDetachable()) _continue = false;
+
+                    if (_continue === false) {
+                        // this is for mootools and yui. returning false from this causes jquery to stop drag.
+                        // the events are wrapped in both mootools and yui anyway, but i don't think returning
+                        // false from the start callback would stop a drag.
+                        if (jsPlumb.CurrentLibrary.stopDrag) jsPlumb.CurrentLibrary.stopDrag();
+                        _dragHandler.stopDrag();
+                        return false;
+                    }
+
+					// if we're not full but there was a connection, make it null. we'll create a new one.
+					if (jpc && !self.isFull() && params.isSource) jpc = null;
+
+					_updateOffset( { elId : _elementId });
+					inPlaceCopy = self.makeInPlaceCopy();
+					inPlaceCopy.referenceEndpoint = self;
+					inPlaceCopy.paint();																
+					
+					_makeDraggablePlaceholder(placeholderInfo, self.parent);
+					
+					// set the offset of this div to be where 'inPlaceCopy' is, to start with.
+					// TODO merge this code with the code in both Anchor and FloatingAnchor, because it
+					// does the same stuff.
+					var ipcoel = _getElementObject(inPlaceCopy.canvas),
+					    ipco = _getOffset(ipcoel, _currentInstance),
+					    po = adjustForParentOffsetAndScroll([ipco.left, ipco.top], inPlaceCopy.canvas);
+					jsPlumb.CurrentLibrary.setOffset(placeholderInfo.element, {left:po[0], top:po[1]});															
+					
+					// when using makeSource and a parent, we first draw the source anchor on the source element, then
+					// move it to the parent.  note that this happens after drawing the placeholder for the
+					// first time.
+					if (self.parentAnchor) self.anchor = _currentInstance.makeAnchor(self.parentAnchor, self.elementId, _currentInstance);
+
+					// store the id of the dragging div and the source element. the drop function will pick these up.					
+					_setAttribute(_getElementObject(self.canvas), "dragId", placeholderInfo.id);
+					_setAttribute(_getElementObject(self.canvas), "elId", _elementId);
+
+					// create a floating endpoint.
+					// here we test to see if a dragProxy was specified in this endpoint's constructor params, and
+					// if so, we create that endpoint instead of cloning ourselves.
+					if (params.proxy) {
+				/*		var floatingAnchor = new FloatingAnchor( { reference : self.anchor, referenceCanvas : self.canvas });
+
+						floatingEndpoint = _newEndpoint({ 
+							paintStyle : params.proxy.paintStyle,
+							endpoint : params.proxy.endpoint,
+							anchor : floatingAnchor, 
+							source : placeholderInfo.element, 
+							scope:"__floating" 
+						});		
+						
+						//$(self.canvas).hide();									
+						*/
+						self.setPaintStyle(params.proxy.paintStyle);
+						// if we do this, we have to cleanup the old one. like just remove its display parts												
+						//self.setEndpoint(params.proxy.endpoint);
+
+					}
+				//	else {
+						floatingEndpoint = _makeFloatingEndpoint(self.getPaintStyle(), self.anchor, _endpoint, self.canvas, placeholderInfo.element);
+				//	}
+					
+					if (jpc == null) {                                                                                                                                                         
+						self.anchor.locked = true;
+                        self.setHover(false, false);
+                        // TODO the hover call above does not reset any target endpoint's hover
+                        // states.
+						// create a connection. one end is this endpoint, the other is a floating endpoint.
+						jpc = _newConnection({
+							sourceEndpoint : self,
+							targetEndpoint : floatingEndpoint,
+							source : self.endpointWillMoveTo || _getElementObject(_element),  // for makeSource with parent option.  ensure source element is represented correctly.
+							target : placeholderInfo.element,
+							anchors : [ self.anchor, floatingEndpoint.anchor ],
+							paintStyle : params.connectorStyle, // this can be null. Connection will use the default.
+							hoverPaintStyle:params.connectorHoverStyle,
+							connector : params.connector, // this can also be null. Connection will use the default.
+							overlays : params.connectorOverlays,
+							type:self.connectionType,
+							cssClass:self.connectorClass,
+							hoverClass:self.connectorHoverClass
+						});
+
+					} else {
+						existingJpc = true;
+						jpc.connector.setHover(false, false);
+						// if existing connection, allow to be dropped back on the source endpoint (issue 51).
+						_initDropTarget(_getElementObject(inPlaceCopy.canvas), false, true);
+						// new anchor idx
+						var anchorIdx = jpc.endpoints[0].id == self.id ? 0 : 1;
+						jpc.floatingAnchorIndex = anchorIdx;					// save our anchor index as the connection's floating index.						
+						self.detachFromConnection(jpc);							// detach from the connection while dragging is occurring.
+						
+						// store the original scope (issue 57)
+						var c = _getElementObject(self.canvas),
+						    dragScope = jsPlumb.CurrentLibrary.getDragScope(c);
+						_setAttribute(c, "originalScope", dragScope);
+						// now we want to get this endpoint's DROP scope, and set it for now: we can only be dropped on drop zones
+						// that have our drop scope (issue 57).
+						var dropScope = jsPlumb.CurrentLibrary.getDropScope(c);
+						jsPlumb.CurrentLibrary.setDragScope(c, dropScope);
+				
+						// now we replace ourselves with the temporary div we created above:
+						if (anchorIdx == 0) {
+							existingJpcParams = [ jpc.source, jpc.sourceId, i, dragScope ];
+							jpc.source = placeholderInfo.element;
+							jpc.sourceId = placeholderInfo.id;
+						} else {
+							existingJpcParams = [ jpc.target, jpc.targetId, i, dragScope ];
+							jpc.target = placeholderInfo.element;
+							jpc.targetId = placeholderInfo.id;
+						}
+
+						// lock the other endpoint; if it is dynamic it will not move while the drag is occurring.
+						jpc.endpoints[anchorIdx == 0 ? 1 : 0].anchor.locked = true;
+						// store the original endpoint and assign the new floating endpoint for the drag.
+						jpc.suspendedEndpoint = jpc.endpoints[anchorIdx];
+						jpc.suspendedEndpoint.setHover(false);
+						floatingEndpoint.referenceEndpoint = jpc.suspendedEndpoint;
+						jpc.endpoints[anchorIdx] = floatingEndpoint;
+
+						// fire an event that informs that a connection is being dragged
+						fireConnectionDraggingEvent(jpc);
+
+					}
+					// register it and register connection on it.
+					floatingConnections[placeholderInfo.id] = jpc;
+					floatingEndpoint.addConnection(jpc);
+					// only register for the target endpoint; we will not be dragging the source at any time
+					// before this connection is either discarded or made into a permanent connection.
+					_addToList(endpointsByElement, placeholderInfo.id, floatingEndpoint);
+					// tell jsplumb about it
+					_currentInstance.currentlyDragging = true;
+				};
+
+				var jpcl = jsPlumb.CurrentLibrary,
+				    dragOptions = params.dragOptions || {},
+				    defaultOpts = jsPlumb.extend( {}, jpcl.defaultDragOptions),
+				    startEvent = jpcl.dragEvents["start"],
+				    stopEvent = jpcl.dragEvents["stop"],
+				    dragEvent = jpcl.dragEvents["drag"];
+				
+				dragOptions = jsPlumb.extend(defaultOpts, dragOptions);
+				dragOptions.scope = dragOptions.scope || self.scope;
+				dragOptions[startEvent] = _wrap(dragOptions[startEvent], start);
+				// extracted drag handler function so can be used by makeSource
+				dragOptions[dragEvent] = _wrap(dragOptions[dragEvent], _dragHandler.drag);
+				dragOptions[stopEvent] = _wrap(dragOptions[stopEvent],
+					function() {
+						var originalEvent = jpcl.getDropEvent(arguments);
+						_currentInstance.currentlyDragging = false;						
+						_removeWithFunction(endpointsByElement[placeholderInfo.id], function(e) {
+							return e.id == floatingEndpoint.id;
+						});
+						_removeElements( [ placeholderInfo.element[0], floatingEndpoint.canvas ], _element); // TODO: clean up the connection canvas (if the user aborted)
+						_removeElement(inPlaceCopy.canvas, _element);
+						_currentInstance.anchorManager.clearFor(placeholderInfo.id);						
+						var idx = jpc.floatingAnchorIndex == null ? 1 : jpc.floatingAnchorIndex;
+						jpc.endpoints[idx == 0 ? 1 : 0].anchor.locked = false;
+						self.setPaintStyle(originalPaintStyle); // reset to original; may have been changed by drag proxy.
+						if (jpc.endpoints[idx] == floatingEndpoint) {
+							// if the connection was an existing one:
+							if (existingJpc && jpc.suspendedEndpoint) {
+								// fix for issue35, thanks Sylvain Gizard: when firing the detach event make sure the
+								// floating endpoint has been replaced.
+								if (idx == 0) {
+									jpc.source = existingJpcParams[0];
+									jpc.sourceId = existingJpcParams[1];
+								} else {
+									jpc.target = existingJpcParams[0];
+									jpc.targetId = existingJpcParams[1];
+								}
+								
+								// restore the original scope (issue 57)
+								jsPlumb.CurrentLibrary.setDragScope(existingJpcParams[2], existingJpcParams[3]);
+								jpc.endpoints[idx] = jpc.suspendedEndpoint;
+								//if (self.isReattach || jpc._forceDetach || !jpc.endpoints[idx == 0 ? 1 : 0].detach(jpc, false, false, true, originalEvent)) {
+								if (jpc.isReattach() || jpc._forceReattach || jpc._forceDetach || !jpc.endpoints[idx == 0 ? 1 : 0].detach(jpc, false, false, true, originalEvent)) {									
+									jpc.setHover(false);
+									jpc.floatingAnchorIndex = null;
+									jpc.suspendedEndpoint.addConnection(jpc);
+									_currentInstance.repaint(existingJpcParams[1]);
+								}
+                                jpc._forceDetach = null;
+								jpc._forceReattach = null;
+							} else {
+								// TODO this looks suspiciously kind of like an Endpoint.detach call too.
+								// i wonder if this one should post an event though.  maybe this is good like this.
+								_removeElements(jpc.connector.getDisplayElements(), self.parent);
+								self.detachFromConnection(jpc);								
+							}																
+						}
+						self.anchor.locked = false;												
+						self.paint({recalc:false});
+						jpc.setHover(false, false);
+
+						fireConnectionDragStopEvent(jpc);
+
+						jpc = null;						
+						inPlaceCopy = null;							
+						delete endpointsByElement[floatingEndpoint.elementId];
+						floatingEndpoint.anchor = null;
+                        floatingEndpoint = null;
+						_currentInstance.currentlyDragging = false;
+
+
+					});
+				
+				var i = _getElementObject(self.canvas);				
+				jsPlumb.CurrentLibrary.initDraggable(i, dragOptions, true);
+			}
+
+			// pulled this out into a function so we can reuse it for the inPlaceCopy canvas; you can now drop detached connections
+			// back onto the endpoint you detached it from.
+			var _initDropTarget = function(canvas, forceInit, isTransient, endpoint) {
+				if ((params.isTarget || forceInit) && jsPlumb.CurrentLibrary.isDropSupported(_element)) {
+					var dropOptions = params.dropOptions || _currentInstance.Defaults.DropOptions || jsPlumb.Defaults.DropOptions;
+					dropOptions = jsPlumb.extend( {}, dropOptions);
+					dropOptions.scope = dropOptions.scope || self.scope;
+					var dropEvent = jsPlumb.CurrentLibrary.dragEvents['drop'],
+					    overEvent = jsPlumb.CurrentLibrary.dragEvents['over'],
+					    outEvent = jsPlumb.CurrentLibrary.dragEvents['out'],
+						drop = function() {
+														
+							var originalEvent = jsPlumb.CurrentLibrary.getDropEvent(arguments),
+								draggable = _getElementObject(jsPlumb.CurrentLibrary.getDragObject(arguments)),
+								id = _getAttribute(draggable, "dragId"),
+								elId = _getAttribute(draggable, "elId"),						
+								scope = _getAttribute(draggable, "originalScope"),
+								jpc = floatingConnections[id];
+								
+							// if this is a drop back where the connection came from, mark it force rettach and
+							// return; the stop handler will reattach. without firing an event.
+							var redrop = jpc.suspendedEndpoint && (jpc.suspendedEndpoint.id == self.id ||
+											self.referenceEndpoint && jpc.suspendedEndpoint.id == self.referenceEndpoint.id) ;							
+							if (redrop) {								
+								jpc._forceReattach = true;
+								return;
+							}
+
+							if (jpc != null) {
+								var idx = jpc.floatingAnchorIndex == null ? 1 : jpc.floatingAnchorIndex, oidx = idx == 0 ? 1 : 0;
+								
+								// restore the original scope if necessary (issue 57)						
+								if (scope) jsPlumb.CurrentLibrary.setDragScope(draggable, scope);							
+								
+								var endpointEnabled = endpoint != null ? endpoint.isEnabled() : true;
+								
+								if (self.isFull()) {
+									self.fire("maxConnections", { 
+										endpoint:self, 
+										connection:jpc, 
+										maxConnections:_maxConnections 
+									}, originalEvent);
+								}
+																
+								if (!self.isFull() && !(idx == 0 && !self.isSource) && !(idx == 1 && !self.isTarget) && endpointEnabled) {
+									var _doContinue = true;
+	
+									// the second check here is for the case that the user is dropping it back
+									// where it came from.
+									if (jpc.suspendedEndpoint && jpc.suspendedEndpoint.id != self.id) {
+										if (idx == 0) {
+											jpc.source = jpc.suspendedEndpoint.element;
+											jpc.sourceId = jpc.suspendedEndpoint.elementId;
+										} else {
+											jpc.target = jpc.suspendedEndpoint.element;
+											jpc.targetId = jpc.suspendedEndpoint.elementId;
+										}
+	
+										if (!jpc.isDetachAllowed(jpc) || !jpc.endpoints[idx].isDetachAllowed(jpc) || !jpc.suspendedEndpoint.isDetachAllowed(jpc) || !_currentInstance.checkCondition("beforeDetach", jpc))
+											_doContinue = false;								
+									}
+				
+									// these have to be set before testing for beforeDrop.
+									if (idx == 0) {
+										jpc.source = self.element;
+										jpc.sourceId = self.elementId;
+									} else {
+										jpc.target = self.element;
+										jpc.targetId = self.elementId;
+									}
+																
+									// now check beforeDrop.  this will be available only on Endpoints that are setup to
+									// have a beforeDrop condition (although, secretly, under the hood all Endpoints and 
+									// the Connection have them, because they are on jsPlumbUIComponent.  shhh!), because
+									// it only makes sense to have it on a target endpoint.
+									_doContinue = _doContinue && self.isDropAllowed(jpc.sourceId, jpc.targetId, jpc.scope, jpc, self);
+															
+									if (_doContinue) {
+										// remove this jpc from the current endpoint
+										jpc.endpoints[idx].detachFromConnection(jpc);
+										if (jpc.suspendedEndpoint) jpc.suspendedEndpoint.detachFromConnection(jpc);
+										jpc.endpoints[idx] = self;
+										self.addConnection(jpc);
+										
+										// copy our parameters in to the connection:
+										var params = self.getParameters();
+										for (var aParam in params)
+											jpc.setParameter(aParam, params[aParam]);
+	
+										if (!jpc.suspendedEndpoint) {  
+											if (params.draggable)
+												jsPlumb.CurrentLibrary.initDraggable(self.element, dragOptions, true);
+										}
+										else {
+											var suspendedElement = jpc.suspendedEndpoint.getElement(), suspendedElementId = jpc.suspendedEndpoint.elementId;
+											// fire a detach event
+											fireDetachEvent({
+												source : idx == 0 ? suspendedElement : jpc.source, 
+												target : idx == 1 ? suspendedElement : jpc.target,
+												sourceId : idx == 0 ? suspendedElementId : jpc.sourceId, 
+												targetId : idx == 1 ? suspendedElementId : jpc.targetId,
+												sourceEndpoint : idx == 0 ? jpc.suspendedEndpoint : jpc.endpoints[0], 
+												targetEndpoint : idx == 1 ? jpc.suspendedEndpoint : jpc.endpoints[1],
+												connection : jpc
+											}, true, originalEvent);
+										}
+	
+										// finalise will inform the anchor manager and also add to
+										// connectionsByScope if necessary.
+										_finaliseConnection(jpc, null, originalEvent);
+									}
+									else {
+										// otherwise just put it back on the endpoint it was on before the drag.
+										if (jpc.suspendedEndpoint) {									
+											jpc.endpoints[idx] = jpc.suspendedEndpoint;
+											jpc.setHover(false);
+											jpc._forceDetach = true;
+											if (idx == 0) {
+												jpc.source = jpc.suspendedEndpoint.element;
+												jpc.sourceId = jpc.suspendedEndpoint.elementId;
+											} else {
+												jpc.target = jpc.suspendedEndpoint.element;
+												jpc.targetId = jpc.suspendedEndpoint.elementId;;
+											}
+											jpc.suspendedEndpoint.addConnection(jpc);
+	
+											jpc.endpoints[0].repaint();
+											jpc.repaint();
+											_currentInstance.repaint(jpc.source.elementId);
+											jpc._forceDetach = false;
+										}
+									}
+	
+									jpc.floatingAnchorIndex = null;
+								}
+								_currentInstance.currentlyDragging = false;
+								delete floatingConnections[id];
+								jpc.suspendedEndpoint = null;
+							}
+						};
+					
+					dropOptions[dropEvent] = _wrap(dropOptions[dropEvent], drop);
+					dropOptions[overEvent] = _wrap(dropOptions[overEvent], function() {					
+						var draggable = jsPlumb.CurrentLibrary.getDragObject(arguments),
+							id = _getAttribute( _getElementObject(draggable), "dragId"),
+							_jpc = floatingConnections[id];
+							
+						if (_jpc != null) {								
+							var idx = _jpc.floatingAnchorIndex == null ? 1 : _jpc.floatingAnchorIndex;
+							// here we should fire the 'over' event if we are a target and this is a new connection,
+							// or we are the same as the floating endpoint.								
+							var _cont = (self.isTarget && _jpc.floatingAnchorIndex != 0) || (_jpc.suspendedEndpoint && self.referenceEndpoint && self.referenceEndpoint.id == _jpc.suspendedEndpoint.id);
+							if (_cont)
+								_jpc.endpoints[idx].anchor.over(self.anchor);
+						}						
+					});	
+					dropOptions[outEvent] = _wrap(dropOptions[outEvent], function() {					
+						var draggable = jsPlumb.CurrentLibrary.getDragObject(arguments),
+							id = _getAttribute( _getElementObject(draggable), "dragId"),
+							_jpc = floatingConnections[id];
+							
+						if (_jpc != null) {
+							var idx = _jpc.floatingAnchorIndex == null ? 1 : _jpc.floatingAnchorIndex;
+							var _cont = (self.isTarget && _jpc.floatingAnchorIndex != 0) || (_jpc.suspendedEndpoint && self.referenceEndpoint && self.referenceEndpoint.id == _jpc.suspendedEndpoint.id);
+							if (_cont)
+								_jpc.endpoints[idx].anchor.out();
+						}
+					});
+					jsPlumb.CurrentLibrary.initDroppable(canvas, dropOptions, true, isTransient);
+				}
+			};
+			
+			// initialise the endpoint's canvas as a drop target.  this will be ignored if the endpoint is not a target or drag is not supported.
+			_initDropTarget(_getElementObject(self.canvas), true, !(params._transient || self.anchor.isFloating), self);
+			
+			 // finally, set type if it was provided
+			 if (params.type)
+				self.addType(params.type);
+
+// ***************************** PLACEHOLDERS FOR NATURAL DOCS *************************************************
+			/*
+			 * Function: bind
+			 * Bind to an event on the Endpoint.  
+			 * 
+			 * Parameters:
+			 * 	event - the event to bind.  Available events on an Endpoint are:
+			 *         - *click*						:	notification that a Endpoint was clicked.  
+			 *         - *dblclick*						:	notification that a Endpoint was double clicked.
+			 *         - *mouseenter*					:	notification that the mouse is over a Endpoint. 
+			 *         - *mouseexit*					:	notification that the mouse exited a Endpoint.
+			 * 		   - *contextmenu*                  :   notification that the user right-clicked on the Endpoint.
+			 *         
+			 *  callback - function to callback. This function will be passed the Endpoint that caused the event, and also the original event.    
+			 */
+			
+			/*
+		     * Function: setPaintStyle
+		     * Sets the Endpoint's paint style and then repaints the Endpoint.
+		     * 
+		     * Parameters:
+		     * 	style - Style to use.
+		     */
+
+		     /*
+		     * Function: getPaintStyle
+		     * Gets the Endpoint's paint style. This is not necessarily the paint style in use at the time;
+		     * this is the paint style for the Endpoint when the mouse it not hovering over it.
+		     */
+			
+			/*
+		     * Function: setHoverPaintStyle
+		     * Sets the paint style to use when the mouse is hovering over the Endpoint. This is null by default.
+		     * The hover paint style is applied as extensions to the paintStyle; it does not entirely replace
+		     * it.  This is because people will most likely want to change just one thing when hovering, say the
+		     * color for example, but leave the rest of the appearance the same.
+		     * 
+		     * Parameters:
+		     * 	style - Style to use when the mouse is hovering.
+		     *  doNotRepaint - if true, the Endpoint will not be repainted.  useful when setting things up initially.
+		     */
+			
+			/*
+		     * Function: setHover
+		     * Sets/unsets the hover state of this Endpoint.
+		     * 
+		     * Parameters:
+		     * 	hover - hover state boolean
+		     * 	ignoreAttachedElements - if true, does not notify any attached elements of the change in hover state.  used mostly to avoid infinite loops.
+		     */
+
+		     /*
+		     * Function: getParameter
+		     * Gets the named parameter; returns null if no parameter with that name is set. Parameters may have been set on the Endpoint in the 'addEndpoint' call, or they may have been set with the setParameter function.
+		     *
+		     * Parameters:
+		     *   key - Parameter name.
+		     */
+
+		     /*
+		     * Function: setParameter
+		     * Sets the named parameter to the given value.
+		     *
+		     * Parameters:
+		     *   key - Parameter name.
+		     *   value - Parameter value.
+		     */
+			 
+			 /*
+			 * Property: canvas
+			 * The Endpoint's drawing area.
+			 */
+			/*
+			 * Property: connections
+			 * List of Connections this Endpoint is attached to.
+			 */
+			/*
+			 * Property: scope
+			 * Scope descriptor for this Endpoint.
+			 */
+			
+			/*
+			 * Property: overlays
+			 * List of Overlays for this Endpoint.
+			 */
+			/*
+			 * Function: addOverlay
+			 * Adds an Overlay to the Endpoint.
+			 * 
+			 * Parameters:
+			 * 	overlay - Overlay to add.
+			 */
+			/*
+			 * Function: getOverlay
+			 * Gets an overlay, by ID. Note: by ID.  You would pass an 'id' parameter
+			 * in to the Overlay's constructor arguments, and then use that to retrieve
+			 * it via this method.
+			 */
+			/*
+			* Function: getOverlays
+			* Gets all the overlays for this component.
+			*/
+			/*
+			 * Function: hideOverlay
+			 * Hides the overlay specified by the given id.
+			 */
+			/*
+			 * Function: hideOverlays
+			 * Hides all Overlays
+			 */
+			/*
+			 * Function: showOverlay
+			 * Shows the overlay specified by the given id.
+			 */
+			/*
+			 * Function: showOverlays
+			 * Shows all Overlays 
+			 */
+			/**
+			 * Function: removeAllOverlays
+			 * Removes all overlays from the Endpoint, and then repaints.
+			 */
+			/**
+			 * Function: removeOverlay
+			 * Removes an overlay by ID.  Note: by ID.  this is a string you set in the overlay spec.
+			 * Parameters:
+			 * overlayId - id of the overlay to remove.
+			 */
+			/**
+			 * Function: removeOverlays
+			 * Removes a set of overlays by ID.  Note: by ID.  this is a string you set in the overlay spec.
+			 * Parameters:
+			 * overlayIds - this function takes an arbitrary number of arguments, each of which is a single overlay id.
+			 */
+			/*
+			 * Function: setLabel
+			 * Sets the Endpoint's label.  
+			 * 
+			 * Parameters:
+			 * 	l	- label to set. May be a String, a Function that returns a String, or a params object containing { "label", "labelStyle", "location", "cssClass" }.  Note that this uses innerHTML on the label div, so keep
+         * that in mind if you need escaped HTML.
+			 */
+			/*
+				Function: getLabel
+				Returns the label text for this Endpoint (or a function if you are labelling with a function).
+				This does not return the overlay itself; this is a convenience method which is a pair with
+				setLabel; together they allow you to add and access a Label Overlay without having to create the
+				Overlay object itself.  For access to the underlying label overlay that jsPlumb has created,
+				use getLabelOverlay.
+			*/
+			/*
+				Function: getLabelOverlay
+				Returns the underlying internal label overlay, which will exist if you specified a label on
+				an addEndpoint call, or have called setLabel at any stage.   
+			*/
+			
+// ***************************** END OF PLACEHOLDERS FOR NATURAL DOCS *************************************************
+				
+			
+			return self;
+		};					
+	};		
+
+	var jsPlumb = new jsPlumbInstance();
+	if (typeof window != 'undefined') window.jsPlumb = jsPlumb;
+	jsPlumb.getInstance = function(_defaults) {
+		var j = new jsPlumbInstance(_defaults);
+		j.init();
+		return j;
+	};	
+	
+	var _curryAnchor = function(x, y, ox, oy, type, fnInit) {
+		return function(params) {
+			params = params || {};
+			//var a = jsPlumb.makeAnchor([ x, y, ox, oy, 0, 0 ], params.elementId, params.jsPlumbInstance);
+			var a = params.jsPlumbInstance.makeAnchor([ x, y, ox, oy, 0, 0 ], params.elementId, params.jsPlumbInstance);
+			a.type = type;
+			if (fnInit) fnInit(a, params);
+			return a;
+		};
+	};
+	/*
+	 * Property: Anchors.TopCenter
+	 * An Anchor that is located at the top center of the element.
+	 */
+	jsPlumb.Anchors["TopCenter"] 		= _curryAnchor(0.5, 0, 0,-1, "TopCenter");
+	/*
+	 * Property: Anchors.BottomCenter
+	 * An Anchor that is located at the bottom center of the element.
+	 */
+	jsPlumb.Anchors["BottomCenter"] 	= _curryAnchor(0.5, 1, 0, 1, "BottomCenter");
+	/*
+	 * Property: Anchors.LeftMiddle
+	 * An Anchor that is located at the left middle of the element.
+	 */
+	jsPlumb.Anchors["LeftMiddle"] 		= _curryAnchor(0, 0.5, -1, 0, "LeftMiddle");
+	/*
+	 * Property: Anchors.RightMiddle
+	 * An Anchor that is located at the right middle of the element.
+	 */
+	jsPlumb.Anchors["RightMiddle"] 		= _curryAnchor(1, 0.5, 1, 0, "RightMiddle");
+	/*
+	 * Property: Anchors.Center
+	 * An Anchor that is located at the center of the element.
+	 */
+	jsPlumb.Anchors["Center"] 			= _curryAnchor(0.5, 0.5, 0, 0, "Center");
+	/*
+	 * Property: Anchors.TopRight
+	 * An Anchor that is located at the top right corner of the element.
+	 */
+	jsPlumb.Anchors["TopRight"] 		= _curryAnchor(1, 0, 0,-1, "TopRight");
+	/*
+	 * Property: Anchors.BottomRight
+	 * An Anchor that is located at the bottom right corner of the element.
+	 */
+	jsPlumb.Anchors["BottomRight"] 		= _curryAnchor(1, 1, 0, 1, "BottomRight");
+	/*
+	 * Property: Anchors.TopLeft
+	 * An Anchor that is located at the top left corner of the element.
+	 */
+	jsPlumb.Anchors["TopLeft"] 			= _curryAnchor(0, 0, 0, -1, "TopLeft");
+	/*
+	 * Property: Anchors.BottomLeft
+	 * An Anchor that is located at the bototm left corner of the element.
+	 */
+	jsPlumb.Anchors["BottomLeft"] 		= _curryAnchor(0, 1, 0, 1, "BottomLeft");
+			
+	jsPlumb.Defaults.DynamicAnchors = function(params) {
+		return params.jsPlumbInstance.makeAnchors(["TopCenter", "RightMiddle", "BottomCenter", "LeftMiddle"], params.elementId, params.jsPlumbInstance);
+	};
+	/*
+	 * Property: Anchors.AutoDefault
+	 * Default DynamicAnchors - chooses from TopCenter, RightMiddle, BottomCenter, LeftMiddle.
+	 */
+	jsPlumb.Anchors["AutoDefault"]  = function(params) { 
+		var a = params.jsPlumbInstance.makeDynamicAnchor(jsPlumb.Defaults.DynamicAnchors(params));
+		a.type = "AutoDefault";
+		return a;
+	};
+	
+	/*
+	 * Property: Anchors.Assign
+	 * An Anchor whose location is assigned at connection time, through an AnchorPositionFinder. Used in conjunction
+	 * with the 'makeTarget' function. jsPlumb has two of these - 'Fixed' and 'Grid', and you can also write your own.
+	 */
+	jsPlumb.Anchors["Assign"] = _curryAnchor(0,0,0,0,"Assign", function(anchor, params) {
+		// find what to use as the "position finder". the user may have supplied a String which represents
+		// the id of a position finder in jsPlumb.AnchorPositionFinders, or the user may have supplied the
+		// position finder as a function.  we find out what to use and then set it on the anchor.
+		var pf = params.position || "Fixed";
+		anchor.positionFinder = pf.constructor == String ? params.jsPlumbInstance.AnchorPositionFinders[pf] : pf;
+		// always set the constructor params; the position finder might need them later (the Grid one does,
+		// for example)
+		anchor.constructorParams = params;
+	});
+
+	// Continuous anchor is just curried through to the 'get' method of the continuous anchor
+	// factory.
+	/*
+	 * Property: Anchors.Continuous
+	 * An Anchor that is tracks the other element in the connection, choosing the closest face.
+	 */
+	jsPlumb.Anchors["Continuous"] = function(params) {
+		return params.jsPlumbInstance.continuousAnchorFactory.get(params);
+	};
+
+    // these are the default anchor positions finders, which are used by the makeTarget function.  supply
+    // a position finder argument to that function allows you to specify where the resulting anchor will
+    // be located
+	jsPlumb.AnchorPositionFinders = {
+		"Fixed": function(dp, ep, es, params) {
+			return [ (dp.left - ep.left) / es[0], (dp.top - ep.top) / es[1] ];	
+		},
+		"Grid":function(dp, ep, es, params) {
+			var dx = dp.left - ep.left, dy = dp.top - ep.top,
+				gx = es[0] / (params.grid[0]), gy = es[1] / (params.grid[1]),
+				mx = Math.floor(dx / gx), my = Math.floor(dy / gy);
+			return [ ((mx * gx) + (gx / 2)) / es[0], ((my * gy) + (gy / 2)) / es[1] ];
+		}
+	};
+	
+	/*
+	 * Property: Anchors.Perimeter
+	 * An Anchor that tracks the perimeter of some shape, approximating it with a given number of dynamically
+	 * positioned locations.
+	 *
+	 * Parameters:
+	 *
+	 * anchorCount  -   optional number of anchors to use to approximate the perimeter. default is 60.
+	 * shape        -   required. the name of the shape. valid values are 'rectangle', 'square', 'ellipse', 'circle', 'triangle' and 'diamond'
+	 * rotation     -   optional rotation, in degrees, to apply. 
+	 */
+	jsPlumb.Anchors["Perimeter"] = function(params) {
+		params = params || {};
+		var anchorCount = params.anchorCount || 60,
+			shape = params.shape;
+		
+		if (!shape) throw new Error("no shape supplied to Perimeter Anchor type");		
+		
+		var _circle = function() {
+                var r = 0.5, step = Math.PI * 2 / anchorCount, current = 0, a = [];
+                for (var i = 0; i < anchorCount; i++) {
+                    var x = r + (r * Math.sin(current)),
+                        y = r + (r * Math.cos(current));                                
+                    a.push( [ x, y, 0, 0 ] );
+                    current += step;
+                }
+                return a;	
+            },
+            _path = function(segments) {
+                var anchorsPerFace = anchorCount / segments.length, a = [],
+                    _computeFace = function(x1, y1, x2, y2, fractionalLength) {
+                        anchorsPerFace = anchorCount * fractionalLength;
+                        var dx = (x2 - x1) / anchorsPerFace, dy = (y2 - y1) / anchorsPerFace;
+                        for (var i = 0; i < anchorsPerFace; i++) {
+                            a.push( [
+                                x1 + (dx * i),
+                                y1 + (dy * i),
+                                0,
+                                0
+                            ]);
+                        }
+                    };
+								
+                for (var i = 0; i < segments.length; i++)
+                    _computeFace.apply(null, segments[i]);
+														
+                return a;					
+            },
+			_shape = function(faces) {												
+                var s = [];
+                for (var i = 0; i < faces.length; i++) {
+                    s.push([faces[i][0], faces[i][1], faces[i][2], faces[i][3], 1 / faces.length]);
+                }
+                return _path(s);
+			},
+			_rectangle = function() {
+				return _shape([
+					[ 0, 0, 1, 0 ], [ 1, 0, 1, 1 ], [ 1, 1, 0, 1 ], [ 0, 1, 0, 0 ]
+				]);		
+			};
+		
+		var _shapes = {
+			"circle":_circle,
+			"ellipse":_circle,
+			"diamond":function() {
+				return _shape([
+						[ 0.5, 0, 1, 0.5 ], [ 1, 0.5, 0.5, 1 ], [ 0.5, 1, 0, 0.5 ], [ 0, 0.5, 0.5, 0 ]
+				]);
+			},
+			"rectangle":_rectangle,
+			"square":_rectangle,
+			"triangle":function() {
+				return _shape([
+						[ 0.5, 0, 1, 1 ], [ 1, 1, 0, 1 ], [ 0, 1, 0.5, 0]
+				]);	
+			},
+			"path":function(params) {
+                var points = params.points;
+				var p = [], tl = 0;
+				for (var i = 0; i < points.length - 1; i++) {
+                    var l = Math.sqrt(Math.pow(points[i][2] - points[i][0]) + Math.pow(points[i][3] - points[i][1]));
+                    tl += l;
+					p.push([points[i][0], points[i][1], points[i+1][0], points[i+1][1], l]);						
+				}
+                for (var i = 0; i < p.length; i++) {
+                    p[i][4] = p[i][4] / tl;
+                }
+				return _path(p);
+			}
+		},
+        _rotate = function(points, amountInDegrees) {
+            var o = [], theta = amountInDegrees / 180 * Math.PI ;
+            for (var i = 0; i < points.length; i++) {
+                var _x = points[i][0] - 0.5,
+                    _y = points[i][1] - 0.5;
+                    
+                o.push([
+                    0.5 + ((_x * Math.cos(theta)) - (_y * Math.sin(theta))),
+                    0.5 + ((_x * Math.sin(theta)) + (_y * Math.cos(theta))),
+                    points[i][2],
+                    points[i][3]
+                ]);
+            }
+            return o;
+        };
+		
+		if (!_shapes[shape]) throw new Error("Shape [" + shape + "] is unknown by Perimeter Anchor type");
+		
+		var da = _shapes[shape](params);
+        if (params.rotation) da = _rotate(da, params.rotation);
+        var a = params.jsPlumbInstance.makeDynamicAnchor(da);
+		a.type = "Perimeter";
+		return a;
+	};
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/1.3.15/jsPlumb-defaults-1.3.15-RC1.js	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,1246 @@
+/*
+ * jsPlumb
+ * 
+ * Title:jsPlumb 1.3.15
+ * 
+ * Provides a way to visually connect elements on an HTML page, using either SVG, Canvas
+ * elements, or VML.  
+ * 
+ * This file contains the default Connectors, Endpoint and Overlay definitions.
+ *
+ * Copyright (c) 2010 - 2012 Simon Porritt (http://jsplumb.org)
+ * 
+ * http://jsplumb.org
+ * http://github.com/sporritt/jsplumb
+ * http://code.google.com/p/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+
+(function() {	
+				
+	/**
+	 * 
+	 * Helper class to consume unused mouse events by components that are DOM elements and
+	 * are used by all of the different rendering modes.
+	 * 
+	 */
+	jsPlumb.DOMElementComponent = function(params) {
+		jsPlumb.jsPlumbUIComponent.apply(this, arguments);
+		// when render mode is canvas, these functions may be called by the canvas mouse handler.  
+		// this component is safe to pipe this stuff to /dev/null.
+		this.mousemove = 
+		this.dblclick  = 
+		this.click = 
+		this.mousedown = 
+		this.mouseup = function(e) { };					
+	};
+	                                   
+    /**
+     * Class: Connectors.Straight
+     * The Straight connector draws a simple straight line between the two anchor points.  It does not have any constructor parameters.
+     */
+    jsPlumb.Connectors.Straight = function() {
+    	this.type = "Straight";
+		var self = this,
+		currentPoints = null,
+		_m, _m2, _b, _dx, _dy, _theta, _theta2, _sx, _sy, _tx, _ty, _segment, _length;
+
+        /**
+         * Computes the new size and position of the canvas.         
+         */
+        this.compute = function(sourcePos, targetPos, sourceEndpoint, targetEndpoint, sourceAnchor, targetAnchor, lineWidth, minWidth) {
+        	var w = Math.abs(sourcePos[0] - targetPos[0]),
+            h = Math.abs(sourcePos[1] - targetPos[1]),
+            // these are padding to ensure the whole connector line appears
+            xo = 0.45 * w, yo = 0.45 * h;
+            // these are padding to ensure the whole connector line appears
+            w *= 1.9; h *=1.9;
+            
+            var x = Math.min(sourcePos[0], targetPos[0]) - xo;
+            var y = Math.min(sourcePos[1], targetPos[1]) - yo;
+            
+            // minimum size is 2 * line Width if minWidth was not given.
+            var calculatedMinWidth = Math.max(2 * lineWidth, minWidth);
+            
+            if (w < calculatedMinWidth) { 
+        		w = calculatedMinWidth; 
+        		x = sourcePos[0]  + ((targetPos[0] - sourcePos[0]) / 2) - (calculatedMinWidth / 2);
+        		xo = (w - Math.abs(sourcePos[0]-targetPos[0])) / 2;
+        	}
+            if (h < calculatedMinWidth) {         
+        		h = calculatedMinWidth; 
+        		y = sourcePos[1]  + ((targetPos[1] - sourcePos[1]) / 2) - (calculatedMinWidth / 2);
+        		yo = (h - Math.abs(sourcePos[1]-targetPos[1])) / 2;
+        	}
+                            
+            _sx = sourcePos[0] < targetPos[0] ?  xo : w-xo;
+            _sy = sourcePos[1] < targetPos[1] ? yo:h-yo;
+            _tx = sourcePos[0] < targetPos[0] ? w-xo : xo;
+            _ty = sourcePos[1] < targetPos[1] ? h-yo : yo;
+            currentPoints = [ x, y, w, h, _sx, _sy, _tx, _ty ];                        
+            _dx = _tx - _sx, _dy = _ty - _sy;
+			//_m = _dy / _dx, _m2 = -1 / _m;
+            _m = jsPlumbUtil.gradient({x:_sx, y:_sy}, {x:_tx, y:_ty}), _m2 = -1 / _m;
+			_b = -1 * ((_m * _sx) - _sy);
+			_theta = Math.atan(_m); _theta2 = Math.atan(_m2);
+            //_segment = jsPlumbUtil.segment({x:_sx, y:_sy}, {x:_tx, y:_ty});
+            _length = Math.sqrt((_dx * _dx) + (_dy * _dy));
+                             
+            return currentPoints;
+        };
+        
+        
+        /**
+         * returns the point on the connector's path that is 'location' along the length of the path, where 'location' is a decimal from
+         * 0 to 1 inclusive. for the straight line connector this is simple maths.  for Bezier, not so much.
+         */
+        this.pointOnPath = function(location, absolute) {
+        	if (location == 0 && !absolute)
+                return { x:_sx, y:_sy };
+            else if (location == 1 && !absolute)
+                return { x:_tx, y:_ty };
+            else {
+                var l = absolute ? location > 0 ? location : _length + location : location * _length;
+                return jsPlumbUtil.pointOnLine({x:_sx, y:_sy}, {x:_tx, y:_ty}, l);
+            }
+        };
+        
+        /**
+         * returns the gradient of the connector at the given point - which for us is constant.
+         */
+        this.gradientAtPoint = function(location) {
+            return _m;
+        };
+        
+        /**
+         * returns the point on the connector's path that is 'distance' along the length of the path from 'location', where 
+         * 'location' is a decimal from 0 to 1 inclusive, and 'distance' is a number of pixels.
+         * this hands off to jsPlumbUtil to do the maths, supplying two points and the distance.
+         */
+        this.pointAlongPathFrom = function(location, distance, absolute) {            
+        	var p = self.pointOnPath(location, absolute),
+                farAwayPoint = location == 1 ? {
+                    x:_sx + ((_tx - _sx) * 10),
+                    y:_sy + ((_sy - _ty) * 10)
+                } : {x:_tx, y:_ty };
+
+            return jsPlumbUtil.pointOnLine(p, farAwayPoint, distance);
+        };
+    };
+                
+    
+    /**
+     * Class:Connectors.Bezier
+     * This Connector draws a Bezier curve with two control points.  You can provide a 'curviness' value which gets applied to jsPlumb's
+     * internal voodoo machine and ends up generating locations for the two control points.  See the constructor documentation below.
+     */
+    /**
+     * Function:Constructor
+     * 
+     * Parameters:
+     * 	curviness - How 'curvy' you want the curve to be! This is a directive for the placement of control points, not endpoints of the curve, so your curve does not 
+     * actually touch the given point, but it has the tendency to lean towards it.  The larger this value, the greater the curve is pulled from a straight line.
+     * Optional; defaults to 150.
+     * stub - optional value for a distance to travel from the connector's endpoint before beginning the Bezier curve. defaults to 0.
+     * 
+     */
+    jsPlumb.Connectors.Bezier = function(params) {
+    	var self = this;
+    	params = params || {};
+    	this.majorAnchor = params.curviness || 150;        
+        this.minorAnchor = 10;
+        var currentPoints = null;
+        this.type = "Bezier";
+        
+        this._findControlPoint = function(point, sourceAnchorPosition, targetAnchorPosition, sourceEndpoint, targetEndpoint, sourceAnchor, targetAnchor) {
+        	// determine if the two anchors are perpendicular to each other in their orientation.  we swap the control 
+        	// points around if so (code could be tightened up)
+        	var soo = sourceAnchor.getOrientation(sourceEndpoint), 
+        		too = targetAnchor.getOrientation(targetEndpoint),
+        		perpendicular = soo[0] != too[0] || soo[1] == too[1],
+            	p = [],            
+            	ma = self.majorAnchor, mi = self.minorAnchor;                
+            	
+            if (!perpendicular) {
+                if (soo[0] == 0) // X
+                    p.push(sourceAnchorPosition[0] < targetAnchorPosition[0] ? point[0] + mi : point[0] - mi);
+                else p.push(point[0] - (ma * soo[0]));
+                                 
+                if (soo[1] == 0) // Y
+                	p.push(sourceAnchorPosition[1] < targetAnchorPosition[1] ? point[1] + mi : point[1] - mi);
+                else p.push(point[1] + (ma * too[1]));
+            }
+             else {
+                if (too[0] == 0) // X
+                	p.push(targetAnchorPosition[0] < sourceAnchorPosition[0] ? point[0] + mi : point[0] - mi);
+                else p.push(point[0] + (ma * too[0]));
+                
+                if (too[1] == 0) // Y
+                	p.push(targetAnchorPosition[1] < sourceAnchorPosition[1] ? point[1] + mi : point[1] - mi);
+                else p.push(point[1] + (ma * soo[1]));
+             }
+
+            return p;                
+        };        
+
+        var _CP, _CP2, _sx, _tx, _ty, _sx, _sy, _canvasX, _canvasY, _w, _h, _sStubX, _sStubY, _tStubX, _tStubY;
+
+        this.compute = function(sourcePos, targetPos, sourceEndpoint, targetEndpoint, sourceAnchor, targetAnchor, lineWidth, minWidth) {
+        	lineWidth = lineWidth || 0;
+            _w = Math.abs(sourcePos[0] - targetPos[0]) + lineWidth; 
+            _h = Math.abs(sourcePos[1] - targetPos[1]) + lineWidth;
+            _canvasX = Math.min(sourcePos[0], targetPos[0])-(lineWidth/2);
+            _canvasY = Math.min(sourcePos[1], targetPos[1])-(lineWidth/2);
+            _sx = sourcePos[0] < targetPos[0] ? _w - (lineWidth/2): (lineWidth/2);
+            _sy = sourcePos[1] < targetPos[1] ? _h - (lineWidth/2) : (lineWidth/2);
+            _tx = sourcePos[0] < targetPos[0] ? (lineWidth/2) : _w - (lineWidth/2);
+            _ty = sourcePos[1] < targetPos[1] ? (lineWidth/2) : _h - (lineWidth/2);
+                        
+            _CP = self._findControlPoint([_sx,_sy], sourcePos, targetPos, sourceEndpoint, targetEndpoint, sourceAnchor, targetAnchor);
+            _CP2 = self._findControlPoint([_tx,_ty], targetPos, sourcePos, targetEndpoint, sourceEndpoint, targetAnchor, sourceAnchor);                
+            var minx1 = Math.min(_sx,_tx), minx2 = Math.min(_CP[0], _CP2[0]), minx = Math.min(minx1,minx2),
+            	maxx1 = Math.max(_sx,_tx), maxx2 = Math.max(_CP[0], _CP2[0]), maxx = Math.max(maxx1,maxx2);
+            
+            if (maxx > _w) _w = maxx;
+            if (minx < 0) {
+                _canvasX += minx; var ox = Math.abs(minx);
+                _w += ox; _CP[0] += ox; _sx += ox; _tx +=ox; _CP2[0] += ox;                
+            }                
+
+            var miny1 = Math.min(_sy,_ty), miny2 = Math.min(_CP[1], _CP2[1]), miny = Math.min(miny1,miny2),
+            	maxy1 = Math.max(_sy,_ty), maxy2 = Math.max(_CP[1], _CP2[1]), maxy = Math.max(maxy1,maxy2);
+            	
+            if (maxy > _h) _h = maxy;
+            if (miny < 0) {
+                _canvasY += miny; var oy = Math.abs(miny);
+                _h += oy; _CP[1] += oy; _sy += oy; _ty +=oy; _CP2[1] += oy;                
+            }
+            
+            if (minWidth && _w < minWidth) {
+            	var posAdjust = (minWidth - _w) / 2;
+        		_w = minWidth;        		
+        		_canvasX -= posAdjust; _sx = _sx + posAdjust ; _tx = _tx + posAdjust; _CP[0] =  _CP[0] + posAdjust; _CP2[0] = _CP2[0] + posAdjust;
+        	}
+            
+            if (minWidth && _h < minWidth) {
+            	var posAdjust = (minWidth - _h) / 2;
+        		_h = minWidth;        		
+        		_canvasY -= posAdjust; _sy = _sy + posAdjust ; _ty = _ty + posAdjust; _CP[1] =  _CP[1] + posAdjust; _CP2[1] = _CP2[1] + posAdjust;
+        	}
+
+            currentPoints = [_canvasX, _canvasY, _w, _h,
+                             _sx, _sy, _tx, _ty,
+                             _CP[0], _CP[1], _CP2[0], _CP2[1] ];
+            
+            return currentPoints;            
+        };        
+        
+        var _makeCurve = function() {
+        	return [	
+	        	{ x:_sx, y:_sy },
+	        	{ x:_CP[0], y:_CP[1] },
+	        	{ x:_CP2[0], y:_CP2[1] },
+	        	{ x:_tx, y:_ty }
+         	];
+        };     
+
+        var _translateLocation = function(curve, location, absolute) {
+            if (absolute)
+                location = jsBezier.locationAlongCurveFrom(curve, location > 0 ? 0 : 1, location);
+
+            return location;
+        };
+        
+        /**
+         * returns the point on the connector's path that is 'location' along the length of the path, where 'location' is a decimal from
+         * 0 to 1 inclusive. for the straight line connector this is simple maths.  for Bezier, not so much.
+         */
+        this.pointOnPath = function(location, absolute) {
+            var c = _makeCurve();
+            location = _translateLocation(c, location, absolute);
+            return jsBezier.pointOnCurve(c, location);
+        };
+        
+        /**
+         * returns the gradient of the connector at the given point.
+         */
+        this.gradientAtPoint = function(location, absolute) {
+            var c = _makeCurve();
+            location = _translateLocation(c, location, absolute);
+            return jsBezier.gradientAtPoint(c, location);        	
+        };	              
+        
+        /**
+         * for Bezier curves this method is a little tricky, cos calculating path distance algebraically is notoriously difficult.
+         * this method is iterative, jumping forward .05% of the path at a time and summing the distance between this point and the previous
+         * one, until the sum reaches 'distance'. the method may turn out to be computationally expensive; we'll see.
+         * another drawback of this method is that if the connector gets quite long, .05% of the length of it is not necessarily smaller
+         * than the desired distance, in which case the loop returns immediately and the arrow is mis-shapen. so a better strategy might be to
+         * calculate the step as a function of distance/distance between endpoints.  
+         */
+        this.pointAlongPathFrom = function(location, distance, absolute) {
+            var c = _makeCurve();
+            location = _translateLocation(c, location, absolute);
+            return jsBezier.pointAlongCurveFrom(c, location, distance);
+        };           
+    };        
+    
+    
+    /**
+     * Class: Connectors.Flowchart
+     * Provides 'flowchart' connectors, consisting of vertical and horizontal line segments.
+     */
+    /**
+     * Function: Constructor
+     * 
+     * Parameters:
+     * 	stub - minimum length for the stub at each end of the connector. This can be an integer, giving a value for both ends of the connections, 
+     * or an array of two integers, giving separate values for each end. The default is an integer with value 30 (pixels). 
+     *  gap  - gap to leave between the end of the connector and the element on which the endpoint resides. if you make this larger than stub then you will see some odd looking behaviour.  defaults to 0 pixels.     
+     */
+    jsPlumb.Connectors.Flowchart = function(params) {
+    	this.type = "Flowchart";
+    	params = params || {};
+        var self = this, 
+        	stub = params.stub || params.minStubLength /* bwds compat. */ || 30, 
+            sourceStub = jsPlumbUtil.isArray(stub) ? stub[0] : stub,
+            targetStub = jsPlumbUtil.isArray(stub) ? stub[1] : stub,
+            gap = params.gap || 0,
+        	segments = [],
+            totalLength = 0,
+        	segmentProportions = [],
+        	segmentProportionalLengths = [],
+        	points = [],
+        	swapX, swapY,
+            maxX = -Infinity, maxY = -Infinity,
+            minX = Infinity, minY = Infinity,
+			grid = params.grid,
+			_gridClamp = function(n, g) { var e = n % g, f = Math.floor(n / g), inc = e > (g / 2) ? 1 : 0; return (f + inc) * g; },
+			clampToGrid = function(x, y, dontClampX, dontClampY) {
+				return [
+					dontClampX || grid == null ? x : _gridClamp(x, grid[0]),
+					dontClampY || grid == null ? y : _gridClamp(y, grid[1])
+				];
+			},
+		/**
+		 * recalculates the points at which the segments begin and end, proportional to the total length travelled
+		 * by all the segments that constitute the connector.   we use this to help with pointOnPath calculations.
+		 */
+		updateSegmentProportions = function(startX, startY, endX, endY) {
+			var curLoc = 0;
+			for (var i = 0; i < segments.length; i++) {
+				segmentProportionalLengths[i] = segments[i][5] / totalLength;
+				segmentProportions[i] = [curLoc, (curLoc += (segments[i][5] / totalLength)) ];
+			}
+		},
+		appendSegmentsToPoints = function() {
+			points.push(segments.length);
+			for (var i = 0; i < segments.length; i++) {
+				points.push(segments[i][0]);
+				points.push(segments[i][1]);
+			}
+		},		
+		/**
+		 * helper method to add a segment.
+		 */
+		addSegment = function(x, y, sx, sy, tx, ty/*, doGridX, doGridY*/) {
+			var lx = segments.length == 0 ? sx : segments[segments.length - 1][0],
+			    ly = segments.length == 0 ? sy : segments[segments.length - 1][1],
+                m = x == lx ? Infinity : 0;
+				/*,
+				gridded = clampToGrid(x, y),
+				doGridX = true,
+				doGridY = true;
+				
+			// grid experiment. TODO: have two more params that indicate whether or not to lock to a grid in each
+			// axis. the reason for this is that anchor points wont always be located on the grid, so until a connector
+			// emanating from that anchor has turned a right angle, we can't actually clamp it to a grid for that axis.
+			// so if a line came out horizontally heading left, then it will probably not be clamped in the y axis, but
+			// we can choose to clamp its first corner in the x axis.  the same principle goes for the target anchor.
+			//if (segments.length == 0) {
+			console.log("this is the first segment...if sx == x then do not do grid in X.")
+			doGridX = !(sx == x) && !(tx == x);
+			doGridY = !(sy == y) && !(ty == y);						
+			x = doGridX ? gridded[0] : x;
+			y = doGridY ? gridded[1] : y;
+			*/			
+			
+			var l = Math.abs(x == lx ? y - ly : x - lx);
+			
+			segments.push([x, y, lx, ly, m, l]);
+            totalLength += l;
+			
+            maxX = Math.max(maxX, x);
+            maxY = Math.max(maxY, y);
+            minX = Math.min(minX, x);
+            minY = Math.min(minY, y);
+		},
+		/**
+		 * returns [segment, proportion of travel in segment, segment index] for the segment 
+		 * that contains the point which is 'location' distance along the entire path, where 
+		 * 'location' is a decimal between 0 and 1 inclusive. in this connector type, paths 
+		 * are made up of a list of segments, each of which contributes some fraction to
+		 * the total length. 
+         * From 1.3.10 this also supports the 'absolute' property, which lets us specify a location
+         * as the absolute distance in pixels, rather than a proportion of the total path. 
+		 */
+		findSegmentForLocation = function(location, absolute) {
+            if (absolute) {
+                location = location > 0 ? location / totalLength : (totalLength + location) / totalLength;
+            }
+
+			var idx = segmentProportions.length - 1, inSegmentProportion = 1;
+			for (var i = 0; i < segmentProportions.length; i++) {
+				if (segmentProportions[i][1] >= location) {
+					idx = i;
+					inSegmentProportion = (location - segmentProportions[i][0]) / segmentProportionalLengths[i];                    
+ 					break;
+				}
+			}
+			return { segment:segments[idx], proportion:inSegmentProportion, index:idx };
+		};
+		
+		this.compute = function(sourcePos, targetPos, sourceEndpoint, targetEndpoint, 
+            sourceAnchor, targetAnchor, lineWidth, minWidth, sourceInfo, targetInfo) {
+            segments = [];
+            segmentProportions = [];
+            totalLength = 0;
+            segmentProportionalLengths = [];
+            maxX = maxY = -Infinity;
+            minX = minY = Infinity;
+			
+			self.lineWidth = lineWidth;
+            
+            swapX = targetPos[0] < sourcePos[0]; 
+            swapY = targetPos[1] < sourcePos[1];
+            
+            var lw = lineWidth || 1,                
+                sourceOffx = (lw / 2) + (sourceStub + targetStub), 
+                targetOffx = (lw / 2) + (targetStub + sourceStub),                 
+                sourceOffy = (lw / 2) + (sourceStub + targetStub),
+                targetOffy = (lw / 2) + (targetStub + sourceStub),
+                so = sourceAnchor.orientation || sourceAnchor.getOrientation(sourceEndpoint), 
+                to = targetAnchor.orientation || targetAnchor.getOrientation(targetEndpoint),
+                x = swapX ? targetPos[0] : sourcePos[0], 
+                y = swapY ? targetPos[1] : sourcePos[1],
+                w = Math.abs(targetPos[0] - sourcePos[0]) + sourceOffx + targetOffx, 
+                h = Math.abs(targetPos[1] - sourcePos[1]) + sourceOffy + targetOffy;
+
+            // if either anchor does not have an orientation set, we derive one from their relative
+            // positions.  we fix the axis to be the one in which the two elements are further apart, and
+            // point each anchor at the other element.  this is also used when dragging a new connection.
+            if (so[0] == 0 && so[1] == 0 || to[0] == 0 && to[1] == 0) {
+                var index = w > h ? 0 : 1, oIndex = [1,0][index];
+                so = []; to = [];
+                so[index] = sourcePos[index] > targetPos[index] ? -1 : 1;
+                to[index] = sourcePos[index] > targetPos[index] ? 1 : -1;
+                so[oIndex] = 0;
+                to[oIndex] = 0;
+            }
+            
+			/*
+			 this code is unexplained and causes paint errors with continuous anchors sometimes.
+			 commenting it out until i can get to the bottom of it.
+            if (w < minWidth) {      
+                sourceOffx += (minWidth - w) / 2;
+                w = minWidth;
+            }
+            if (h < minWidth) {             
+                sourceOffy += (minWidth - h) / 2;
+                h = minWidth;
+            }
+            */
+
+            var sx = swapX ? (w - targetOffx) +( gap * so[0])  : sourceOffx + (gap * so[0]), 
+                sy = swapY ? (h - targetOffy) + (gap * so[1])  : sourceOffy + (gap * so[1]), 
+                tx = swapX ? sourceOffx + (gap * to[0]) : (w - targetOffx) + (gap * to[0]),
+                ty = swapY ? sourceOffy + (gap * to[1]) : (h - targetOffy) + (gap * to[1]),
+                startStubX = sx + (so[0] * sourceStub), 
+                startStubY = sy + (so[1] * sourceStub),
+                endStubX = tx + (to[0] * targetStub), 
+                endStubY = ty + (to[1] * targetStub),
+                isXGreaterThanStubTimes2 = Math.abs(sx - tx) > (sourceStub + targetStub),
+                isYGreaterThanStubTimes2 = Math.abs(sy - ty) > (sourceStub + targetStub),
+                midx = startStubX + ((endStubX - startStubX) / 2),
+                midy = startStubY + ((endStubY - startStubY) / 2),
+                oProduct = ((so[0] * to[0]) + (so[1] * to[1])),
+                opposite = oProduct == -1,
+                perpendicular = oProduct == 0,
+                orthogonal = oProduct == 1; 
+            
+            x -= sourceOffx; y -= sourceOffy;
+            points = [x, y, w, h, sx, sy, tx, ty];
+            var extraPoints = [];                                        
+                      
+            var sourceAxis = so[0] == 0 ? "y" : "x",
+                anchorOrientation = opposite ? "opposite" : orthogonal ? "orthogonal" : "perpendicular",
+                segment = jsPlumbUtil.segment([sx, sy], [tx, ty]),
+                flipSourceSegments = so[sourceAxis == "x" ? 0 : 1] == -1,
+                flipSegments = {
+                    "x":[null, 4, 3, 2, 1],
+                    "y":[null, 2, 1, 4, 3]
+                }        
+                
+            if (flipSourceSegments)                
+                segment = flipSegments[sourceAxis][segment];                                    
+            
+			addSegment(startStubX, startStubY, sx, sy, tx, ty);
+
+            var findClearedLine = function(start, mult, anchorPos, dimension) {
+                return start + (mult * (( 1 - anchorPos) * dimension) + Math.max(sourceStub, targetStub));
+                //mx = so[0] == 0 ? startStubX + ((1 - sourceAnchor.x) * sourceInfo.width) + stub : startStubX,
+            },
+
+            lineCalculators = {
+                oppositex : function() {
+                    if (sourceEndpoint.elementId == targetEndpoint.elementId) {
+                        var _y = startStubY + ((1 - sourceAnchor.y) * sourceInfo.height) + Math.max(sourceStub, targetStub);
+                        return [ [ startStubX, _y ], [ endStubX, _y ]];
+                    }
+                    else if (isXGreaterThanStubTimes2 && (segment == 1 || segment == 2)) {
+                        return [[ midx, sy ], [ midx, ty ]];
+                    }    
+                    else {
+                        return [[ startStubX, midy ], [endStubX, midy ]];                
+                    }
+                },
+                orthogonalx : function() {
+                    if (segment == 1 || segment == 2) {
+                        return [ [ endStubX, startStubY  ]];
+                    }
+                    else {
+                        return [ [ startStubX, endStubY ]];
+                    }
+                },
+                perpendicularx : function() {                
+                    var my = (ty + sy) / 2;
+                    if ((segment == 1 && to[1] == 1) || (segment == 2 && to[1] == -1)) {                  
+                        if (Math.abs(tx - sx) > Math.max(sourceStub, targetStub))
+                            return [ [endStubX, startStubY ]];            
+                        else
+                            return [ [startStubX, startStubY ], [ startStubX, my ], [ endStubX, my ]];                                
+                    }  
+                    else if ((segment == 3 && to[1] == -1) || (segment == 4 && to[1] == 1)) {                    
+                        return [ [ startStubX, my ], [ endStubX, my ]];
+                    }
+                    else if ((segment == 3 && to[1] == 1) || (segment == 4 && to[1] == -1)) {                
+                        return [ [ startStubX, endStubY ]];
+                    }
+                    else if ((segment == 1 && to[1] == -1) || (segment == 2 && to[1] == 1)) {                
+                        if (Math.abs(tx - sx) > Math.max(sourceStub, targetStub))                    
+                            return [ [ midx, startStubY ], [ midx, endStubY ]];                    
+                        else
+                            return [ [ startStubX, endStubY ]];                                        
+                    }
+                },
+                oppositey : function() {
+                    if (sourceEndpoint.elementId == targetEndpoint.elementId) {
+                        var _x = startStubX + ((1 - sourceAnchor.x) * sourceInfo.width) + Math.max(sourceStub, targetStub);
+                        return [ [ _x, startStubY ], [ _x, endStubY ]];
+                    }
+                    else if (isYGreaterThanStubTimes2 && (segment == 2 || segment == 3)) {
+                        return [[ sx, midy ], [ tx, midy ]];
+                    }    
+                    else {
+                        return [[ midx, startStubY ], [midx, endStubY ]];                
+                    }
+                },
+                orthogonaly : function() {
+                    if (segment == 2 || segment == 3) {
+                        return [ [ startStubX, endStubY  ]];
+                    }
+                    else {
+                        return [ [ endStubX, startStubY ]];
+                    }
+                },
+                perpendiculary : function() {                
+                    var mx = (tx + sx) / 2;
+                    if ((segment == 2 && to[0] == -1) || (segment == 3 && to[0] == 1)) {                    
+                        if (Math.abs(tx - sx) > Math.max(sourceStub, targetStub))
+                            return [ [startStubX, endStubY ]];                    
+                        else
+                            return [ [startStubX, midy ], [ endStubX, midy ]];                                        
+                    }  
+                    else if ((segment == 1 && to[0] == -1) || (segment == 4 && to[0] == 1)) {
+                        var mx = (tx + sx) / 2;
+                        return [ [ mx, startStubY ], [ mx, endStubY ]];
+                    }
+                    else if ((segment == 1 && to[0] == 1) || (segment == 4 && to[0] == -1)) {                
+                        return [ [ endStubX, startStubY ]];
+                    }
+                    else if ((segment == 2 && to[0] == 1) || (segment == 3 && to[0] == -1)) {                
+                        if (Math.abs(ty - sy) > Math.max(sourceStub, targetStub))                    
+                            return [ [ startStubX, midy ], [ endStubX, midy ]];                  
+                        else
+                            return [ [ endStubX, startStubY ]];                                    
+                    }
+                }
+            };                                                 
+
+            var p = lineCalculators[anchorOrientation + sourceAxis]();
+            if (p) {
+                for (var i = 0; i < p.length; i++) {
+                    addSegment(p[i][0], p[i][1], sx, sy, tx, ty);
+                }
+            }                                                    
+
+            addSegment(endStubX, endStubY, sx, sy, tx, ty);
+            addSegment(tx, ty, sx, sy, tx, ty);
+            
+            appendSegmentsToPoints();
+            updateSegmentProportions(sx, sy, tx, ty);                        
+            
+            // adjust the max values of the canvas if we have a value that is larger than what we previously set.
+            // 
+            if (maxY > points[3]) points[3] = maxY + (lineWidth * 2);            
+            if (maxX > points[2]) points[2] = maxX + (lineWidth * 2);
+            
+            return points;
+        };
+		
+		/**
+         * returns the point on the connector's path that is 'location' along the length of the path, where 'location' is a decimal from
+         * 0 to 1 inclusive. for this connector we must first figure out which segment the given point lies in, and then compute the x,y position
+         * from our knowledge of the segment's start and end points.
+         */
+        this.pointOnPath = function(location, absolute) {            
+        	return self.pointAlongPathFrom(location, 0, absolute);
+        };
+        
+        /**
+         * returns the gradient of the connector at the given point; the gradient will be either 0 or Infinity, depending on the direction of the
+         * segment the point falls in. segment gradients are calculated in the compute method.  
+         */
+        this.gradientAtPoint = function(location, absolute) { 
+        	return segments[findSegmentForLocation(location, absolute)["index"]][4];
+        };
+        
+        /**
+         * returns the point on the connector's path that is 'distance' along the length of the path from 'location', where 
+         * 'location' is a decimal from 0 to 1 inclusive, and 'distance' is a number of pixels.  when you consider this concept from the point of view
+         * of this connector, it starts to become clear that there's a problem with the overlay paint code: given that this connector makes several
+         * 90 degree turns, it's entirely possible that an arrow overlay could be forced to paint itself around a corner, which would look stupid. this is
+         * because jsPlumb uses this method (and pointOnPath) so determine the locations of the various points that go to make up an overlay.  a better
+         * solution would probably be to just use pointOnPath along with gradientAtPoint, and draw the overlay so that its axis ran along
+         * a tangent to the connector.  for straight line connectors this would obviously mean the overlay was painted directly on the connector, since a 
+         * tangent to a straight line is the line itself, which is what we want; for this connector, and for beziers, the results would probably be better.  an additional
+         * advantage is, of course, that there's less computation involved doing it that way. 
+         */
+        this.pointAlongPathFrom = function(location, distance, absolute) {
+        	var s = findSegmentForLocation(location, absolute), seg = s.segment, p = s.proportion, sl = segments[s.index][5], m = segments[s.index][4];
+        	var e = {         		
+        		x 	: m == Infinity ? seg[2] : seg[2] > seg[0] ? seg[0] + ((1 - p) * sl) - distance : seg[2] + (p * sl) + distance,
+        		y 	: m == 0 ? seg[3] : seg[3] > seg[1] ? seg[1] + ((1 - p) * sl) - distance  : seg[3] + (p * sl) + distance,
+        		segmentInfo : s
+        	};
+        	
+        	return e;
+        };
+    };
+
+ // ********************************* END OF CONNECTOR TYPES *******************************************************************
+    
+ // ********************************* ENDPOINT TYPES *******************************************************************
+    
+    /**
+     * Class: Endpoints.Dot
+     * A round endpoint, with default radius 10 pixels.
+     */    	
+    	
+	/**
+	 * Function: Constructor
+	 * 
+	 * Parameters:
+	 * 
+	 * 	radius	-	radius of the endpoint.  defaults to 10 pixels.
+	 */
+	jsPlumb.Endpoints.Dot = function(params) {
+		this.type = "Dot";
+		var self = this;
+		params = params || {};				
+		this.radius = params.radius || 10;
+		this.defaultOffset = 0.5 * this.radius;
+		this.defaultInnerRadius = this.radius / 3;			
+		
+		this.compute = function(anchorPoint, orientation, endpointStyle, connectorPaintStyle) {
+			var r = endpointStyle.radius || self.radius,
+				x = anchorPoint[0] - r,
+				y = anchorPoint[1] - r;
+			return [ x, y, r * 2, r * 2, r ];
+		};
+	};
+	
+	/**
+	 * Class: Endpoints.Rectangle
+	 * A Rectangular Endpoint, with default size 20x20.
+	 */
+	/**
+	 * Function: Constructor
+	 * 
+	 * Parameters:
+	 * 
+	 * 	width	- width of the endpoint. defaults to 20 pixels.
+	 * 	height	- height of the endpoint. defaults to 20 pixels.	
+	 */
+	jsPlumb.Endpoints.Rectangle = function(params) {
+		this.type = "Rectangle";
+		var self = this;
+		params = params || {};
+		this.width = params.width || 20;
+		this.height = params.height || 20;
+		
+		this.compute = function(anchorPoint, orientation, endpointStyle, connectorPaintStyle) {
+			var width = endpointStyle.width || self.width,
+				height = endpointStyle.height || self.height,
+				x = anchorPoint[0] - (width/2),
+				y = anchorPoint[1] - (height/2);
+			return [ x, y, width, height];
+		};
+	};
+	
+
+    var DOMElementEndpoint = function(params) {
+        jsPlumb.DOMElementComponent.apply(this, arguments);
+        var self = this;
+
+        var displayElements = [  ];
+        this.getDisplayElements = function() { 
+            return displayElements; 
+        };
+        
+        this.appendDisplayElement = function(el) {
+            displayElements.push(el);
+        };            
+    };
+	/**
+	 * Class: Endpoints.Image
+	 * Draws an image as the Endpoint.
+	 */
+	/**
+	 * Function: Constructor
+	 * 
+	 * Parameters:
+	 * 
+	 * 	src	-	location of the image to use.
+	 */
+	jsPlumb.Endpoints.Image = function(params) {
+				
+		this.type = "Image";
+		DOMElementEndpoint.apply(this, arguments);
+		
+		var self = this, 
+			initialized = false,
+			deleted = false,
+			widthToUse = params.width,
+			heightToUse = params.height,
+            _onload = null,
+            _endpoint = params.endpoint;
+			
+		this.img = new Image();
+		self.ready = false;
+
+		this.img.onload = function() {
+			self.ready = true;
+			widthToUse = widthToUse || self.img.width;
+			heightToUse = heightToUse || self.img.height;
+            if (_onload) {
+                _onload(self);
+            }
+		};
+
+        /*
+            Function: setImage
+            Sets the Image to use in this Endpoint.  
+
+            Parameters:
+            img         -   may be a URL or an Image object
+            onload      -   optional; a callback to execute once the image has loaded.
+        */
+        _endpoint.setImage = function(img, onload) {
+            var s = img.constructor == String ? img : img.src;
+            _onload = onload;
+            self.img.src = img;
+
+            if (self.canvas != null)
+                self.canvas.setAttribute("src", img);
+        };
+
+        _endpoint.setImage(params.src || params.url, params.onload);
+
+		this.compute = function(anchorPoint, orientation, endpointStyle, connectorPaintStyle) {
+			self.anchorPoint = anchorPoint;
+			if (self.ready) return [anchorPoint[0] - widthToUse / 2, anchorPoint[1] - heightToUse / 2, 
+									widthToUse, heightToUse];
+			else return [0,0,0,0];
+		};
+		
+		self.canvas = document.createElement("img"), initialized = false;
+		self.canvas.style["margin"] = 0;
+		self.canvas.style["padding"] = 0;
+		self.canvas.style["outline"] = 0;
+		self.canvas.style["position"] = "absolute";
+		var clazz = params.cssClass ? " " + params.cssClass : "";
+		self.canvas.className = jsPlumb.endpointClass + clazz;
+		if (widthToUse) self.canvas.setAttribute("width", widthToUse);
+		if (heightToUse) self.canvas.setAttribute("height", heightToUse);		
+		jsPlumb.appendElement(self.canvas, params.parent);
+		self.attachListeners(self.canvas, self);
+		
+		self.cleanup = function() {
+			deleted = true;
+		};
+		
+		var actuallyPaint = function(d, style, anchor) {
+			if (!deleted) {
+				if (!initialized) {
+					self.canvas.setAttribute("src", self.img.src);
+					self.appendDisplayElement(self.canvas);
+					initialized = true;
+				}
+				var x = self.anchorPoint[0] - (widthToUse / 2),
+					y = self.anchorPoint[1] - (heightToUse / 2);
+				jsPlumb.sizeCanvas(self.canvas, x, y, widthToUse, heightToUse);
+			}
+		};
+		
+		this.paint = function(d, style, anchor) {
+			if (self.ready) {
+    			actuallyPaint(d, style, anchor);
+			}
+			else { 
+				window.setTimeout(function() {    					
+					self.paint(d, style, anchor);
+				}, 200);
+			}
+		};				
+	};
+	
+	/**
+	 * Class: Endpoints.Blank
+	 * An Endpoint that paints nothing (visible) on the screen.  Supports cssClass and hoverClass parameters like all Endpoints.
+	 */
+	jsPlumb.Endpoints.Blank = function(params) {
+		var self = this;
+		this.type = "Blank";
+		DOMElementEndpoint.apply(this, arguments);		
+		this.compute = function(anchorPoint, orientation, endpointStyle, connectorPaintStyle) {
+			return [anchorPoint[0], anchorPoint[1],10,0];
+		};
+		
+		self.canvas = document.createElement("div");
+		self.canvas.style.display = "block";
+		self.canvas.style.width = "1px";
+		self.canvas.style.height = "1px";
+		self.canvas.style.background = "transparent";
+		self.canvas.style.position = "absolute";
+		self.canvas.className = self._jsPlumb.endpointClass;
+		jsPlumb.appendElement(self.canvas, params.parent);
+		
+		this.paint = function(d, style, anchor) {
+			jsPlumb.sizeCanvas(self.canvas, d[0], d[1], d[2], d[3]);	
+		};
+	};
+	
+	/**
+	 * Class: Endpoints.Triangle
+	 * A triangular Endpoint.  
+	 */
+	/**
+	 * Function: Constructor
+	 * 
+	 * Parameters:
+	 * 
+	 * 	width	-	width of the triangle's base.  defaults to 55 pixels.
+	 * 	height	-	height of the triangle from base to apex.  defaults to 55 pixels.
+	 */
+	jsPlumb.Endpoints.Triangle = function(params) {
+		this.type = "Triangle";
+		params = params || {  };
+		params.width = params.width || 55;
+		params.height = params.height || 55;
+		this.width = params.width;
+		this.height = params.height;
+		this.compute = function(anchorPoint, orientation, endpointStyle, connectorPaintStyle) {
+			var width = endpointStyle.width || self.width,
+			height = endpointStyle.height || self.height,
+			x = anchorPoint[0] - (width/2),
+			y = anchorPoint[1] - (height/2);
+			return [ x, y, width, height ];
+		};
+	};
+// ********************************* END OF ENDPOINT TYPES *******************************************************************
+	
+
+// ********************************* OVERLAY DEFINITIONS ***********************************************************************    
+
+	var AbstractOverlay = function(params) {
+		var visible = true, self = this;
+        this.isAppendedAtTopLevel = true;
+		this.component = params.component;
+		this.loc = params.location == null ? 0.5 : params.location;
+        this.endpointLoc = params.endpointLocation == null ? [ 0.5, 0.5] : params.endpointLocation;
+		this.setVisible = function(val) { 
+			visible = val;
+			self.component.repaint();
+		};
+    	this.isVisible = function() { return visible; };
+    	this.hide = function() { self.setVisible(false); };
+    	this.show = function() { self.setVisible(true); };
+    	
+    	this.incrementLocation = function(amount) {
+    		self.loc += amount;
+    		self.component.repaint();
+    	};
+    	this.setLocation = function(l) {
+    		self.loc = l;
+    		self.component.repaint();
+    	};
+    	this.getLocation = function() {
+    		return self.loc;
+    	};
+	};
+	
+	
+	/**
+	 * Class: Overlays.Arrow
+	 * 
+	 * An arrow overlay, defined by four points: the head, the two sides of the tail, and a 'foldback' point at some distance along the length
+	 * of the arrow that lines from each tail point converge into.  The foldback point is defined using a decimal that indicates some fraction
+	 * of the length of the arrow and has a default value of 0.623.  A foldback point value of 1 would mean that the arrow had a straight line
+	 * across the tail.  
+	 */
+	/**
+	 * Function: Constructor
+	 * 
+	 * Parameters:
+	 * 
+	 * 	length - distance in pixels from head to tail baseline. default 20.
+	 * 	width - width in pixels of the tail baseline. default 20.
+	 * 	fillStyle - style to use when filling the arrow.  defaults to "black".
+	 * 	strokeStyle - style to use when stroking the arrow. defaults to null, which means the arrow is not stroked.
+	 * 	lineWidth - line width to use when stroking the arrow. defaults to 1, but only used if strokeStyle is not null.
+	 * 	foldback - distance (as a decimal from 0 to 1 inclusive) along the length of the arrow marking the point the tail points should fold back to.  defaults to 0.623.
+	 * 	location - distance (as a decimal from 0 to 1 inclusive) marking where the arrow should sit on the connector. defaults to 0.5.
+	 * 	direction - indicates the direction the arrow points in. valid values are -1 and 1; 1 is default.
+	 */
+	jsPlumb.Overlays.Arrow = function(params) {
+		this.type = "Arrow";
+		AbstractOverlay.apply(this, arguments);
+        this.isAppendedAtTopLevel = false;
+		params = params || {};
+		var self = this;
+		
+    	this.length = params.length || 20;
+    	this.width = params.width || 20;
+    	this.id = params.id;
+    	var direction = (params.direction || 1) < 0 ? -1 : 1,
+    	    paintStyle = params.paintStyle || { lineWidth:1 },
+    	    // how far along the arrow the lines folding back in come to. default is 62.3%.
+    	    foldback = params.foldback || 0.623;
+
+    	    	
+    	this.computeMaxSize = function() { return self.width * 1.5; };
+    	
+    	this.cleanup = function() { };  // nothing to clean up for Arrows
+    	
+    	this.draw = function(connector, currentConnectionPaintStyle, connectorDimensions) {
+
+            var hxy, mid, txy, tail, cxy;
+            if (connector.pointAlongPathFrom) {
+
+                if (jsPlumbUtil.isString(self.loc) || self.loc > 1 || self.loc < 0) {
+                    var l = parseInt(self.loc);
+                    hxy = connector.pointAlongPathFrom(l, direction * self.length / 2, true),
+                    mid = connector.pointOnPath(l, true),
+                    txy = jsPlumbUtil.pointOnLine(hxy, mid, self.length);
+                }
+                else if (self.loc == 1) {
+                    hxy = connector.pointOnPath(self.loc);
+                    mid = connector.pointAlongPathFrom(self.loc, -1);                    
+                    txy = jsPlumbUtil.pointOnLine(hxy, mid, self.length);
+                }
+                else if (self.loc == 0) {
+                    txy = connector.pointOnPath(self.loc);
+                    mid = connector.pointAlongPathFrom(self.loc, 1);
+                    hxy = jsPlumbUtil.pointOnLine(txy, mid, self.length);
+                }
+                else {
+    			    hxy = connector.pointAlongPathFrom(self.loc, direction * self.length / 2),
+                    mid = connector.pointOnPath(self.loc),
+                    txy = jsPlumbUtil.pointOnLine(hxy, mid, self.length);
+                }
+
+                tail = jsPlumbUtil.perpendicularLineTo(hxy, txy, self.width);
+                cxy = jsPlumbUtil.pointOnLine(hxy, txy, foldback * self.length);
+
+    			var minx = Math.min(hxy.x, tail[0].x, tail[1].x),
+    				maxx = Math.max(hxy.x, tail[0].x, tail[1].x),
+    				miny = Math.min(hxy.y, tail[0].y, tail[1].y),
+    				maxy = Math.max(hxy.y, tail[0].y, tail[1].y);
+    			
+    			var d = { hxy:hxy, tail:tail, cxy:cxy },
+    			    strokeStyle = paintStyle.strokeStyle || currentConnectionPaintStyle.strokeStyle,
+    			    fillStyle = paintStyle.fillStyle || currentConnectionPaintStyle.strokeStyle,
+    			    lineWidth = paintStyle.lineWidth || currentConnectionPaintStyle.lineWidth;
+    			
+    			self.paint(connector, d, lineWidth, strokeStyle, fillStyle, connectorDimensions);							
+			
+			    return [ minx, maxx, miny, maxy]; 
+            }
+            else return [0,0,0,0];
+    	};
+    };          
+    
+    /**
+     * Class: Overlays.PlainArrow
+	 * 
+	 * A basic arrow.  This is in fact just one instance of the more generic case in which the tail folds back on itself to some
+	 * point along the length of the arrow: in this case, that foldback point is the full length of the arrow.  so it just does
+	 * a 'call' to Arrow with foldback set appropriately.       
+	 */
+    /**
+     * Function: Constructor
+     * See <Overlays.Arrow> for allowed parameters for this overlay.
+     */
+    jsPlumb.Overlays.PlainArrow = function(params) {
+    	params = params || {};    	
+    	var p = jsPlumb.extend(params, {foldback:1});
+    	jsPlumb.Overlays.Arrow.call(this, p);
+    	this.type = "PlainArrow";
+    };
+        
+    /**
+     * Class: Overlays.Diamond
+     * 
+	 * A diamond. Like PlainArrow, this is a concrete case of the more generic case of the tail points converging on some point...it just
+	 * happens that in this case, that point is greater than the length of the the arrow.    
+	 * 
+	 *      this could probably do with some help with positioning...due to the way it reuses the Arrow paint code, what Arrow thinks is the
+	 *      center is actually 1/4 of the way along for this guy.  but we don't have any knowledge of pixels at this point, so we're kind of
+	 *      stuck when it comes to helping out the Arrow class. possibly we could pass in a 'transpose' parameter or something. the value
+	 *      would be -l/4 in this case - move along one quarter of the total length.
+	 */
+    /**
+     * Function: Constructor
+     * See <Overlays.Arrow> for allowed parameters for this overlay.
+     */
+    jsPlumb.Overlays.Diamond = function(params) {
+    	params = params || {};    	
+    	var l = params.length || 40,
+    	    p = jsPlumb.extend(params, {length:l/2, foldback:2});
+    	jsPlumb.Overlays.Arrow.call(this, p);
+    	this.type = "Diamond";
+    };
+    
+	
+	// abstract superclass for overlays that add an element to the DOM.
+    var AbstractDOMOverlay = function(params) {
+		jsPlumb.DOMElementComponent.apply(this, arguments);
+    	AbstractOverlay.apply(this, arguments);
+		
+		var self = this, initialised = false;
+		params = params || {};
+		this.id = params.id;
+		var div;
+		
+		var makeDiv = function() {
+			div = params.create(params.component);
+			div = jsPlumb.CurrentLibrary.getDOMElement(div);
+			div.style["position"] 	= 	"absolute";    	
+			var clazz = params["_jsPlumb"].overlayClass + " " + 
+				(self.cssClass ? self.cssClass : 
+				params.cssClass ? params.cssClass : "");    	
+			div.className =	clazz;
+			jsPlumb.appendElement(div, params.component.parent);
+			params["_jsPlumb"].getId(div);		
+	    	self.attachListeners(div, self);
+	    	self.canvas = div;
+		};
+		
+		this.getElement = function() {
+			if (div == null) {
+				makeDiv();
+			}
+    		return div;
+    	};
+		
+		this.getDimensions = function() {
+    		return jsPlumb.CurrentLibrary.getSize(jsPlumb.CurrentLibrary.getElementObject(self.getElement()));
+    	};
+		
+		var cachedDimensions = null,
+			_getDimensions = function(component) {
+				if (cachedDimensions == null)
+					cachedDimensions = self.getDimensions();
+				return cachedDimensions;
+			};
+		
+		/*
+		 * Function: clearCachedDimensions
+		 * Clears the cached dimensions for the label. As a performance enhancement, label dimensions are
+		 * cached from 1.3.12 onwards. The cache is cleared when you change the label text, of course, but
+		 * there are other reasons why the text dimensions might change - if you make a change through CSS, for
+		 * example, you might change the font size.  in that case you should explicitly call this method.
+		 */
+		this.clearCachedDimensions = function() {
+			cachedDimensions = null;
+		};
+		
+		this.computeMaxSize = function() {
+    		var td = _getDimensions();
+			return Math.max(td[0], td[1]);
+    	}; 
+		
+		//override setVisible
+    	var osv = self.setVisible;
+    	self.setVisible = function(state) {
+    		osv(state); // call superclass
+    		div.style.display = state ? "block" : "none";
+    	};
+		
+		this.cleanup = function() {
+    		if (div != null) jsPlumb.CurrentLibrary.removeElement(div);
+    	};
+		
+		this.paint = function(component, d, componentDimensions) {
+			if (!initialised) {
+				self.getElement();
+				component.appendDisplayElement(div);
+				self.attachListeners(div, component);
+				initialised = true;
+			}
+			div.style.left = (componentDimensions[0] + d.minx) + "px";
+			div.style.top = (componentDimensions[1] + d.miny) + "px";			
+    	};
+				
+		this.draw = function(component, currentConnectionPaintStyle, componentDimensions) {
+	    	var td = _getDimensions();
+	    	if (td != null && td.length == 2) {
+				var cxy = {x:0,y:0};
+                if (component.pointOnPath) {
+                    var loc = self.loc, absolute = false;
+                    if (jsPlumbUtil.isString(self.loc) || self.loc < 0 || self.loc > 1) {
+                        loc = parseInt(self.loc);
+                        absolute = true;
+                    }
+                    cxy = component.pointOnPath(loc, absolute);  // a connection
+                }
+                else {
+                    var locToUse = self.loc.constructor == Array ? self.loc : self.endpointLoc;
+                    cxy = { x:locToUse[0] * componentDimensions[2],
+                            y:locToUse[1] * componentDimensions[3] };      
+                } 
+                           
+				minx = cxy.x - (td[0] / 2),
+				miny = cxy.y - (td[1] / 2);				
+				self.paint(component, { minx:minx, miny:miny, td:td, cxy:cxy }, componentDimensions);				
+				return [minx, minx + td[0], miny, miny + td[1]];
+        	}
+	    	else return [0,0,0,0];
+	    };
+	    
+	    this.reattachListeners = function(connector) {
+	    	if (div) {
+	    		self.reattachListenersForElement(div, self, connector);
+	    	}
+	    };
+		
+	};
+	
+	/**
+     * Class: Overlays.Custom
+     * A Custom overlay. You supply a 'create' function which returns some DOM element, and jsPlumb positions it.
+     * The 'create' function is passed a Connection or Endpoint.
+     */
+    /**
+     * Function: Constructor
+     * 
+     * Parameters:
+     * 	create - function for jsPlumb to call that returns a DOM element.
+     * 	location - distance (as a decimal from 0 to 1 inclusive) marking where the label should sit on the connector. defaults to 0.5.
+     * 	id - optional id to use for later retrieval of this overlay.
+     * 	
+     */
+    jsPlumb.Overlays.Custom = function(params) {
+    	this.type = "Custom";    	
+    	AbstractDOMOverlay.apply(this, arguments);		    	        		    	    		
+    };
+    
+    /**
+     * Class: Overlays.Label
+     * A Label overlay. For all different renderer types (SVG/Canvas/VML), jsPlumb draws a Label overlay as a styled DIV.  Version 1.3.0 of jsPlumb
+     * introduced the ability to set css classes on the label; this is now the preferred way for you to style a label.  The 'labelStyle' parameter
+     * is still supported in 1.3.0 but its usage is deprecated.  Under the hood, jsPlumb just turns that object into a bunch of CSS directive that it 
+     * puts on the Label's 'style' attribute, so the end result is the same. 
+     */
+    /**
+     * Function: Constructor
+     * 
+     * Parameters:
+     * 	cssClass - optional css class string to append to css class. This string is appended "as-is", so you can of course have multiple classes
+     *             defined.  This parameter is preferred to using labelStyle, borderWidth and borderStyle.
+     * 	label - the label to paint.  May be a string or a function that returns a string.  Nothing will be painted if your label is null or your
+     *         label function returns null.  empty strings _will_ be painted.
+     * 	location - distance (as a decimal from 0 to 1 inclusive) marking where the label should sit on the connector. defaults to 0.5.
+     * 	id - optional id to use for later retrieval of this overlay.
+     * 	
+     */
+    jsPlumb.Overlays.Label = function(params) {
+		var self = this;    	
+		this.labelStyle = params.labelStyle || jsPlumb.Defaults.LabelStyle;
+		this.cssClass = this.labelStyle != null ? this.labelStyle.cssClass : null;
+		params.create = function() {
+			return document.createElement("div");
+		};
+    	jsPlumb.Overlays.Custom.apply(this, arguments);
+		this.type = "Label";
+    	
+        var label = params.label || "",
+            self = this,    	    
+            labelText = null;
+    	
+    	/*
+    	 * Function: setLabel
+    	 * sets the label's, um, label.  you would think i'd call this function
+    	 * 'setText', but you can pass either a Function or a String to this, so
+    	 * it makes more sense as 'setLabel'. This uses innerHTML on the label div, so keep
+         * that in mind if you need escaped HTML.
+    	 */
+    	this.setLabel = function(l) {
+    		label = l;
+    		labelText = null;
+			self.clearCachedDimensions();
+			_update();
+    		self.component.repaint();
+    	};
+    	
+		var _update = function() {
+			if (typeof label == "function") {
+    			var lt = label(self);
+    			self.getElement().innerHTML = lt.replace(/\r\n/g, "<br/>");
+    		}
+    		else {
+    			if (labelText == null) {
+    				labelText = label;
+    				self.getElement().innerHTML = labelText.replace(/\r\n/g, "<br/>");
+    			}
+    		}
+		};
+		
+    	this.getLabel = function() {
+    		return label;
+    	};
+    	
+		var superGD = this.getDimensions;		
+		this.getDimensions = function() {				
+    		_update();
+			return superGD();
+    	};
+		
+    };
+		
+
+ // ********************************* END OF OVERLAY DEFINITIONS ***********************************************************************
+    
+})();
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/1.3.15/jsPlumb-dom-adapter-1.3.15-RC1.js	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,190 @@
+/*
+ * jsPlumb
+ * 
+ * Title:jsPlumb 1.3.15
+ * 
+ * Provides a way to visually connect elements on an HTML page, using either SVG, Canvas
+ * elements, or VML.  
+ * 
+ * This file contains the base functionality for DOM type adapters. 
+ *
+ * Copyright (c) 2010 - 2012 Simon Porritt (http://jsplumb.org)
+ * 
+ * http://jsplumb.org
+ * http://github.com/sporritt/jsplumb
+ * http://code.google.com/p/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+;(function() {
+    
+		var canvasAvailable = !!document.createElement('canvas').getContext,
+		svgAvailable = !!window.SVGAngle || document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"),
+		// http://stackoverflow.com/questions/654112/how-do-you-detect-support-for-vml-or-svg-in-a-browser
+		vmlAvailable = function() {		    
+				if (vmlAvailable.vml == undefined) { 
+						var a = document.body.appendChild(document.createElement('div'));
+		        a.innerHTML = '<v:shape id="vml_flag1" adj="1" />';
+		        var b = a.firstChild;
+		        b.style.behavior = "url(#default#VML)";
+		        vmlAvailable.vml = b ? typeof b.adj == "object": true;
+		        a.parentNode.removeChild(a);
+				}
+				return vmlAvailable.vml;
+		};
+        
+    /**
+		Manages dragging for some instance of jsPlumb.
+	*/
+	var DragManager = function(_currentInstance) {		
+		var _draggables = {}, _dlist = [], _delements = {}, _elementsWithEndpoints = {};
+
+        /**
+            register some element as draggable.  right now the drag init stuff is done elsewhere, and it is
+            possible that will continue to be the case.
+        */
+		this.register = function(el) {
+            var jpcl = jsPlumb.CurrentLibrary;
+            el = jpcl.getElementObject(el);
+            var id = _currentInstance.getId(el),
+                domEl = jpcl.getDOMElement(el),
+                parentOffset = jpcl.getOffset(el);
+                    
+            if (!_draggables[id]) {
+                _draggables[id] = el;
+                _dlist.push(el);
+                _delements[id] = {};
+            }
+				
+			// look for child elements that have endpoints and register them against this draggable.
+			var _oneLevel = function(p, startOffset) {
+                if (p) {											
+                    for (var i = 0; i < p.childNodes.length; i++) {
+                        if (p.childNodes[i].nodeType != 3) {
+                            var cEl = jpcl.getElementObject(p.childNodes[i]),
+                                cid = _currentInstance.getId(cEl, null, true);
+                            if (cid && _elementsWithEndpoints[cid] && _elementsWithEndpoints[cid] > 0) {
+                                var cOff = jpcl.getOffset(cEl);
+                                _delements[id][cid] = {
+                                    id:cid,
+                                    offset:{
+                                        left:cOff.left - parentOffset.left,
+                                        top:cOff.top - parentOffset.top
+                                    }
+                                };
+                            }
+                            _oneLevel(p.childNodes[i]);
+                        }	
+                    }
+                }
+			};
+
+			_oneLevel(domEl);
+		};
+
+		/**
+			notification that an endpoint was added to the given el.  we go up from that el's parent
+			node, looking for a parent that has been registered as a draggable. if we find one, we add this
+			el to that parent's list of elements to update on drag (if it is not there already)
+		*/
+		this.endpointAdded = function(el) {
+			var jpcl = jsPlumb.CurrentLibrary, b = document.body, id = _currentInstance.getId(el), c = jpcl.getDOMElement(el), 
+				p = c.parentNode, done = p == b;
+
+			_elementsWithEndpoints[id] = _elementsWithEndpoints[id] ? _elementsWithEndpoints[id] + 1 : 1;
+
+			while (p != b) {
+				var pid = _currentInstance.getId(p, null, true);
+				if (pid && _draggables[pid]) {
+					var idx = -1, pEl = jpcl.getElementObject(p), pLoc = jpcl.getOffset(pEl);
+					
+					if (_delements[pid][id] == null) {
+						var cLoc = jsPlumb.CurrentLibrary.getOffset(el);
+						_delements[pid][id] = {
+							id:id,
+							offset:{
+								left:cLoc.left - pLoc.left,
+								top:cLoc.top - pLoc.top
+							}
+						};
+					}
+					break;
+				}
+				p = p.parentNode;
+			}	
+		};
+
+		this.endpointDeleted = function(endpoint) {
+			if (_elementsWithEndpoints[endpoint.elementId]) {
+				_elementsWithEndpoints[endpoint.elementId]--;
+				if (_elementsWithEndpoints[endpoint.elementId] <= 0) {
+					for (var i in _delements) {
+						delete _delements[i][endpoint.elementId];
+					}
+				}
+			}		
+		};
+
+		this.getElementsForDraggable = function(id) {
+			return _delements[id];	
+		};
+
+		this.reset = function() {
+			_draggables = {};
+			_dlist = [];
+			_delements = {};
+			_elementsWithEndpoints = {};
+		};
+		
+	};
+        
+    // for those browsers that dont have it.  they still don't have it! but at least they won't crash.
+	if (!window.console)
+		window.console = { time:function(){}, timeEnd:function(){}, group:function(){}, groupEnd:function(){}, log:function(){} };
+            
+    window.jsPlumbAdapter = {
+        
+        headless:false,
+        
+        appendToRoot : function(node) {
+            document.body.appendChild(node);
+        },
+        getRenderModes : function() {
+            return [ "canvas", "svg", "vml" ]
+        },
+        isRenderModeAvailable : function(m) {
+            return {
+                "canvas":canvasAvailable,
+                "svg":svgAvailable,
+                "vml":vmlAvailable()
+            }[m];
+        },
+        getDragManager : function(_jsPlumb) {
+            return new DragManager(_jsPlumb);
+        },
+        setRenderMode : function(mode) {
+            var renderMode;
+            
+            if (mode) {
+				mode = mode.toLowerCase();            
+			            
+                var canvasAvailable = this.isRenderModeAvailable("canvas"),
+                    svgAvailable = this.isRenderModeAvailable("svg"),
+                    vmlAvailable = this.isRenderModeAvailable("vml");
+                
+                //if (mode !== jsPlumb.CANVAS && mode !== jsPlumb.SVG && mode !== jsPlumb.VML) throw new Error("render mode must be one of jsPlumb.CANVAS, jsPlumb.SVG or jsPlumb.VML");
+                // now test we actually have the capability to do this.						
+                if (mode === "svg") {
+                    if (svgAvailable) renderMode = "svg"
+                    else if (canvasAvailable) renderMode = "canvas"
+                    else if (vmlAvailable) renderMode = "vml"
+                }
+                else if (mode === "canvas" && canvasAvailable) renderMode = "canvas";
+                else if (vmlAvailable) renderMode = "vml";
+            }
+
+			return renderMode;
+        }
+    };
+    
+})();
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/1.3.15/jsPlumb-renderers-canvas-1.3.15-RC1.js	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,510 @@
+/*
+ * jsPlumb
+ * 
+ * Title:jsPlumb 1.3.15
+ * 
+ * Provides a way to visually connect elements on an HTML page, using either SVG, Canvas
+ * elements, or VML.  
+ * 
+ * This file contains the HTML5 canvas renderers.
+ *
+ * Copyright (c) 2010 - 2012 Simon Porritt (http://jsplumb.org)
+ * 
+ * http://jsplumb.org
+ * http://github.com/sporritt/jsplumb
+ * http://code.google.com/p/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+
+;(function() {
+	
+// ********************************* CANVAS RENDERERS FOR CONNECTORS AND ENDPOINTS *******************************************************************
+		
+	// TODO refactor to renderer common script.  put a ref to jsPlumb.sizeCanvas in there too.
+	var _connectionBeingDragged = null,
+	    _hasClass = function(el, clazz) { return jsPlumb.CurrentLibrary.hasClass(_getElementObject(el), clazz); },
+	    _getElementObject = function(el) { return jsPlumb.CurrentLibrary.getElementObject(el); },
+	    _getOffset = function(el) { return jsPlumb.CurrentLibrary.getOffset(_getElementObject(el)); },
+	    _pageXY = function(el) { return jsPlumb.CurrentLibrary.getPageXY(el); },
+	    _clientXY = function(el) { return jsPlumb.CurrentLibrary.getClientXY(el); };
+	
+	/*
+	 * Class:CanvasMouseAdapter
+	 * Provides support for mouse events on canvases.  
+	 */
+	var CanvasMouseAdapter = function() {
+		var self = this;
+		self.overlayPlacements = [];
+		jsPlumb.jsPlumbUIComponent.apply(this, arguments);
+		jsPlumbUtil.EventGenerator.apply(this, arguments);
+		/**
+		 * returns whether or not the given event is ojver a painted area of the canvas. 
+		 */
+	    this._over = function(e) {		    			  		    	
+	    	var o = _getOffset(_getElementObject(self.canvas)),
+	    	pageXY = _pageXY(e),
+	    	x = pageXY[0] - o.left, y = pageXY[1] - o.top;
+	    	if (x > 0 && y > 0 && x < self.canvas.width && y < self.canvas.height) {
+		    	// first check overlays
+		    	for ( var i = 0; i < self.overlayPlacements.length; i++) {
+		    		var p = self.overlayPlacements[i];
+		    		if (p && (p[0] <= x && p[1] >= x && p[2] <= y && p[3] >= y))
+		    			return true;
+		    	}
+		    	
+		    	// then the canvas
+		    	var d = self.canvas.getContext("2d").getImageData(parseInt(x), parseInt(y), 1, 1);
+		    	return d.data[0] != 0 || d.data[1] != 0 || d.data[2] != 0 || d.data[3] != 0;		  
+	    	}
+	    	return false;
+	    };
+	    
+	    var _mouseover = false, _mouseDown = false, _posWhenMouseDown = null, _mouseWasDown = false,
+	    _nullSafeHasClass = function(el, clazz) {
+	    	return el != null && _hasClass(el, clazz);
+	    };
+	    this.mousemove = function(e) {		    
+	    	var pageXY = _pageXY(e), clientXY = _clientXY(e),	   
+	    	ee = document.elementFromPoint(clientXY[0], clientXY[1]),
+	    	eventSourceWasOverlay = _nullSafeHasClass(ee, "_jsPlumb_overlay");	    	
+			var _continue = _connectionBeingDragged == null && (_nullSafeHasClass(ee, "_jsPlumb_endpoint") || _nullSafeHasClass(ee, "_jsPlumb_connector"));
+			if (!_mouseover && _continue && self._over(e)) {
+				_mouseover = true;
+				self.fire("mouseenter", self, e);		
+				return true;
+			}
+			// TODO here there is a remote chance that the overlay the mouse moved onto
+			// is actually not an overlay for the current component. a more thorough check would
+			// be to ensure the overlay belonged to the current component.  
+			else if (_mouseover && (!self._over(e) || !_continue) && !eventSourceWasOverlay) {
+				_mouseover = false;
+				self.fire("mouseexit", self, e);				
+			}
+			self.fire("mousemove", self, e);
+	    };
+	    		    		    
+	    this.click = function(e) {	    		
+	    	if (_mouseover && self._over(e) && !_mouseWasDown) 
+	    		self.fire("click", self, e);		    	
+	    	_mouseWasDown = false;
+	    };
+	    
+	    this.dblclick = function(e) {
+	    	if (_mouseover && self._over(e) && !_mouseWasDown) 
+	    		self.fire("dblclick", self, e);		    	
+	    	_mouseWasDown = false;
+	    };
+	    
+	    this.mousedown = function(e) {
+	    	if(self._over(e) && !_mouseDown) {
+	    		_mouseDown = true;	    		
+	    		_posWhenMouseDown = _getOffset(_getElementObject(self.canvas));
+	    		self.fire("mousedown", self, e);
+	    	}
+	    };
+	    
+	    this.mouseup = function(e) {
+	    	_mouseDown = false;
+	    	self.fire("mouseup", self, e);
+	    };
+
+        this.contextmenu = function(e) {
+          if (_mouseover && self._over(e) && !_mouseWasDown)
+            self.fire("contextmenu", self, e);
+          _mouseWasDown = false;
+        };
+	};
+	
+	var _newCanvas = function(params) {
+		var canvas = document.createElement("canvas");
+		params["_jsPlumb"].appendElement(canvas, params.parent);
+		canvas.style.position = "absolute";
+		if (params["class"]) canvas.className = params["class"];
+		// set an id. if no id on the element and if uuid was supplied it
+		// will be used, otherwise we'll create one.
+		params["_jsPlumb"].getId(canvas, params.uuid);
+		if (params.tooltip) canvas.setAttribute("title", params.tooltip);
+
+		return canvas;
+	};	
+
+	var CanvasComponent = function(params) {
+		CanvasMouseAdapter.apply(this, arguments);
+
+		var displayElements = [ ];
+		this.getDisplayElements = function() { return displayElements; };
+		this.appendDisplayElement = function(el) { displayElements.push(el); };
+	};
+	
+	/**
+	 * Class:CanvasConnector
+	 * Superclass for Canvas Connector renderers.
+	 */
+	var CanvasConnector = jsPlumb.CanvasConnector = function(params) {
+		
+		CanvasComponent.apply(this, arguments);
+		
+		var _paintOneStyle = function(dim, aStyle) {
+			self.ctx.save();
+			jsPlumb.extend(self.ctx, aStyle);
+			if (aStyle.gradient) {
+				var g = self.createGradient(dim, self.ctx);
+				for ( var i = 0; i < aStyle.gradient.stops.length; i++)
+					g.addColorStop(aStyle.gradient.stops[i][0], aStyle.gradient.stops[i][1]);
+				self.ctx.strokeStyle = g;
+			}
+			self._paint(dim, aStyle);
+			self.ctx.restore();
+		};
+
+		var self = this,
+		clazz = self._jsPlumb.connectorClass + " " + (params.cssClass || "");
+		self.canvas = _newCanvas({ 
+			"class":clazz, 
+			_jsPlumb:self._jsPlumb,
+			parent:params.parent,
+			tooltip:params.tooltip
+		});	
+		self.ctx = self.canvas.getContext("2d");
+		
+		self.appendDisplayElement(self.canvas);
+		
+		self.paint = function(dim, style) {						
+			if (style != null) {																				
+				jsPlumb.sizeCanvas(self.canvas, dim[0], dim[1], dim[2], dim[3]);
+				if (self.getZIndex())
+					self.canvas.style.zIndex = self.getZIndex();
+				if (style.outlineColor != null) {
+					var outlineWidth = style.outlineWidth || 1,
+					outlineStrokeWidth = style.lineWidth + (2 * outlineWidth),
+					outlineStyle = {
+						strokeStyle:style.outlineColor,
+						lineWidth:outlineStrokeWidth
+					};
+					_paintOneStyle(dim, outlineStyle);
+				}
+				_paintOneStyle(dim, style);
+			}
+		};				
+	};		
+	
+	/**
+	 * Class:CanvasEndpoint
+	 * Superclass for Canvas Endpoint renderers.
+	 */
+	var CanvasEndpoint = function(params) {
+		var self = this;				
+		CanvasComponent.apply(this, arguments);		
+		var clazz = self._jsPlumb.endpointClass + " " + (params.cssClass || ""),
+			canvasParams = { 
+			"class":clazz, 
+			_jsPlumb:self._jsPlumb,
+			parent:params.parent,
+			tooltip:self.tooltip
+		};
+		self.canvas = _newCanvas(canvasParams);	
+		self.ctx = self.canvas.getContext("2d");
+
+		self.appendDisplayElement(self.canvas);
+		
+		this.paint = function(d, style, anchor) {
+			jsPlumb.sizeCanvas(self.canvas, d[0], d[1], d[2], d[3]);			
+			if (style.outlineColor != null) {
+				var outlineWidth = style.outlineWidth || 1,
+				outlineStrokeWidth = style.lineWidth + (2 * outlineWidth);
+				var outlineStyle = {
+					strokeStyle:style.outlineColor,
+					lineWidth:outlineStrokeWidth
+				};
+			}
+			
+			self._paint.apply(this, arguments);
+		};
+	};
+	
+	jsPlumb.Endpoints.canvas.Dot = function(params) {		
+		jsPlumb.Endpoints.Dot.apply(this, arguments);
+		CanvasEndpoint.apply(this, arguments);
+		var self = this,		
+		parseValue = function(value) {
+			try { return parseInt(value); }
+			catch(e) {
+				if (value.substring(value.length - 1) == '%')
+					return parseInt(value.substring(0, value - 1));
+			}
+		},					    	
+		calculateAdjustments = function(gradient) {
+			var offsetAdjustment = self.defaultOffset, innerRadius = self.defaultInnerRadius;
+			gradient.offset && (offsetAdjustment = parseValue(gradient.offset));
+        	gradient.innerRadius && (innerRadius = parseValue(gradient.innerRadius));
+        	return [offsetAdjustment, innerRadius];
+		};
+		this._paint = function(d, style, anchor) {
+			if (style != null) {			
+				var ctx = self.canvas.getContext('2d'), orientation = anchor.getOrientation(self);
+				jsPlumb.extend(ctx, style);							
+	            if (style.gradient) {            	
+	            	var adjustments = calculateAdjustments(style.gradient), 
+	            	yAdjust = orientation[1] == 1 ? adjustments[0] * -1 : adjustments[0],
+	            	xAdjust = orientation[0] == 1 ? adjustments[0] * -1:  adjustments[0],
+	            	g = ctx.createRadialGradient(d[4], d[4], d[4], d[4] + xAdjust, d[4] + yAdjust, adjustments[1]);
+		            for (var i = 0; i < style.gradient.stops.length; i++)
+		            	g.addColorStop(style.gradient.stops[i][0], style.gradient.stops[i][1]);
+		            ctx.fillStyle = g;
+	            }				
+				ctx.beginPath();    		
+				ctx.arc(d[4], d[4], d[4], 0, Math.PI*2, true);
+				ctx.closePath();				
+				if (style.fillStyle || style.gradient) ctx.fill();
+				if (style.strokeStyle) ctx.stroke();
+			}
+    	};
+	};	
+		
+	jsPlumb.Endpoints.canvas.Rectangle = function(params) {
+		
+		var self = this;
+		jsPlumb.Endpoints.Rectangle.apply(this, arguments);
+		CanvasEndpoint.apply(this, arguments);				
+		
+    	this._paint = function(d, style, anchor) {
+				
+			var ctx = self.canvas.getContext("2d"), orientation = anchor.getOrientation(self);
+			jsPlumb.extend(ctx, style);
+			
+			/* canvas gradient */
+		    if (style.gradient) {
+		    	// first figure out which direction to run the gradient in (it depends on the orientation of the anchors)
+		    	var y1 = orientation[1] == 1 ? d[3] : orientation[1] == 0 ? d[3] / 2 : 0;
+				var y2 = orientation[1] == -1 ? d[3] : orientation[1] == 0 ? d[3] / 2 : 0;
+				var x1 = orientation[0] == 1 ? d[2] : orientation[0] == 0 ? d[2] / 2 : 0;
+				var x2 = orientation[0] == -1 ? d[2] : orientation[0] == 0 ? d[2] / 2 : 0;
+			    var g = ctx.createLinearGradient(x1,y1,x2,y2);
+			    for (var i = 0; i < style.gradient.stops.length; i++)
+	            	g.addColorStop(style.gradient.stops[i][0], style.gradient.stops[i][1]);
+	            ctx.fillStyle = g;
+		    }
+			
+			ctx.beginPath();
+			ctx.rect(0, 0, d[2], d[3]);
+			ctx.closePath();				
+			if (style.fillStyle || style.gradient) ctx.fill();
+			if (style.strokeStyle) ctx.stroke();
+    	};
+	};		
+	
+	jsPlumb.Endpoints.canvas.Triangle = function(params) {
+	        			
+		var self = this;
+		jsPlumb.Endpoints.Triangle.apply(this, arguments);
+		CanvasEndpoint.apply(this, arguments);			
+		
+    	this._paint = function(d, style, anchor)
+		{    		
+			var width = d[2], height = d[3], x = d[0], y = d[1],			
+			ctx = self.canvas.getContext('2d'),
+			offsetX = 0, offsetY = 0, angle = 0,
+			orientation = anchor.getOrientation(self);
+			
+			if( orientation[0] == 1 ) {
+				offsetX = width;
+				offsetY = height;
+				angle = 180;
+			}
+			if( orientation[1] == -1 ) {
+				offsetX = width;
+				angle = 90;
+			}
+			if( orientation[1] == 1 ) {
+				offsetY = height;
+				angle = -90;
+			}
+			
+			ctx.fillStyle = style.fillStyle;
+			
+			ctx.translate(offsetX, offsetY);
+			ctx.rotate(angle * Math.PI/180);
+
+			ctx.beginPath();
+			ctx.moveTo(0, 0);
+			ctx.lineTo(width/2, height/2);
+			ctx.lineTo(0, height);
+			ctx.closePath();
+			if (style.fillStyle || style.gradient) ctx.fill();
+			if (style.strokeStyle) ctx.stroke();				
+    	};
+	};	
+	
+	/*
+	 * Canvas Image Endpoint: uses the default version, which creates an <img> tag.
+	 */
+	jsPlumb.Endpoints.canvas.Image = jsPlumb.Endpoints.Image;
+	
+	/*
+	 * Blank endpoint in all renderers is just the default Blank endpoint.
+	 */
+	jsPlumb.Endpoints.canvas.Blank = jsPlumb.Endpoints.Blank;
+	
+	/*
+     * Canvas Bezier Connector. Draws a Bezier curve onto a Canvas element.
+     */
+    jsPlumb.Connectors.canvas.Bezier = function() {
+    	var self = this;
+    	jsPlumb.Connectors.Bezier.apply(this, arguments); 
+    	CanvasConnector.apply(this, arguments);
+    	this._paint = function(dimensions, style) {
+        	self.ctx.beginPath();
+        	self.ctx.moveTo(dimensions[4], dimensions[5]);
+        	self.ctx.bezierCurveTo(dimensions[8], dimensions[9], dimensions[10], dimensions[11], dimensions[6], dimensions[7]);	            
+        	self.ctx.stroke();            
+        };
+        
+        // TODO i doubt this handles the case that source and target are swapped.
+        this.createGradient = function(dim, ctx, swap) {
+        	return /*(swap) ? self.ctx.createLinearGradient(dim[4], dim[5], dim[6], dim[7]) : */self.ctx.createLinearGradient(dim[6], dim[7], dim[4], dim[5]);
+        };
+    };
+    
+    /*
+     * Canvas straight line Connector. Draws a straight line onto a Canvas element.
+     */
+    jsPlumb.Connectors.canvas.Straight = function() {   	 
+		var self = this,
+			segmentMultipliers = [null, [1, -1], [1, 1], [-1, 1], [-1, -1] ];
+
+		jsPlumb.Connectors.Straight.apply(this, arguments);
+		CanvasConnector.apply(this, arguments);
+		this._paint = function(dimensions, style) {
+
+			self.ctx.beginPath();
+
+			if (style.dashstyle && style.dashstyle.split(" ").length == 2) {			
+				// only a very simple dashed style is supported - having two values, which define the stroke length 
+				// (as a multiple of the stroke width) and then the space length (also as a multiple of stroke width). 
+				var ds = style.dashstyle.split(" ");
+				if (ds.length != 2) ds = [2, 2];
+				var dss = [ ds[0] * style.lineWidth, ds[1] * style.lineWidth ],
+					m = (dimensions[6] - dimensions[4]) / (dimensions[7] - dimensions[5]),
+					s = jsPlumbUtil.segment([dimensions[4], dimensions[5]], [ dimensions[6], dimensions[7] ]),
+					sm = segmentMultipliers[s],
+					theta = Math.atan(m),
+					l = Math.sqrt(Math.pow(dimensions[6] - dimensions[4], 2) + Math.pow(dimensions[7] - dimensions[5], 2)),
+					repeats = Math.floor(l / (dss[0] + dss[1])),
+					curPos = [dimensions[4], dimensions[5]];
+
+				
+				// TODO: the question here is why could we not support this in all connector types? it's really
+				// just a case of going along and asking jsPlumb for the next point on the path a few times, until it
+				// reaches the end. every type of connector supports that method, after all.  but right now its only the
+				// bezier connector that gives you back the new location on the path along with the x,y coordinates, which
+				// we would need. we'd start out at loc=0 and ask for the point along the path that is dss[0] pixels away.
+				// we then ask for the point that is (dss[0] + dss[1]) pixels away; and from that one we need not just the
+				// x,y but the location, cos we're gonna plug that location back in in order to find where that dash ends.
+				//
+				// it also strikes me that it should be trivial to support arbitrary dash styles (having more or less than two
+				// entries). you'd just iterate that array using a step size of 2, and generify the (rss[0] + rss[1])
+				// computation to be sum(rss[0]..rss[n]).
+
+				for (var i = 0; i < repeats; i++) {
+					self.ctx.moveTo(curPos[0], curPos[1]);
+
+					var nextEndX = curPos[0] + (Math.abs(Math.sin(theta) * dss[0]) * sm[0]),
+						nextEndY = curPos[1] + (Math.abs(Math.cos(theta) * dss[0]) * sm[1]),
+						nextStartX = curPos[0] + (Math.abs(Math.sin(theta) * (dss[0] + dss[1]))  * sm[0]),
+						nextStartY = curPos[1] + (Math.abs(Math.cos(theta) * (dss[0] + dss[1])) * sm[1])
+
+					self.ctx.lineTo(nextEndX, nextEndY);
+					curPos = [nextStartX, nextStartY];					
+				}
+
+				// now draw the last bit
+				self.ctx.moveTo(curPos[0], curPos[1]);
+				self.ctx.lineTo(dimensions[6], dimensions[7]);		
+
+			}	        
+	        else {
+		        self.ctx.moveTo(dimensions[4], dimensions[5]);
+	        	self.ctx.lineTo(dimensions[6], dimensions[7]);
+	        }
+	        	      
+	        self.ctx.stroke();            
+	    };
+	    
+	    // TODO this does not handle the case that src and target are swapped.
+	    this.createGradient = function(dim, ctx) {
+        	return ctx.createLinearGradient(dim[4], dim[5], dim[6], dim[7]);
+        };
+    };
+    
+    jsPlumb.Connectors.canvas.Flowchart = function() {
+    	var self = this;
+    	jsPlumb.Connectors.Flowchart.apply(this, arguments);
+		CanvasConnector.apply(this, arguments);
+    	this._paint = function(dimensions, style) {
+	        self.ctx.beginPath();
+	        self.ctx.moveTo(dimensions[4], dimensions[5]);
+	        // loop through extra points
+	        for (var i = 0; i < dimensions[8]; i++) {
+	        	self.ctx.lineTo(dimensions[9 + (i*2)], dimensions[10 + (i*2)]);
+	        }
+	        // finally draw a line to the end
+	        self.ctx.lineTo(dimensions[6], dimensions[7]);
+	        self.ctx.stroke();
+    	};
+    	
+    	this.createGradient = function(dim, ctx) {
+        	return ctx.createLinearGradient(dim[4], dim[5], dim[6], dim[7]);
+        };
+    };
+    
+// ********************************* END OF CANVAS RENDERERS *******************************************************************    
+    
+    jsPlumb.Overlays.canvas.Label = jsPlumb.Overlays.Label;
+	jsPlumb.Overlays.canvas.Custom = jsPlumb.Overlays.Custom;
+    
+    /**
+     * a placeholder right now, really just exists to mirror the fact that there are SVG and VML versions of this. 
+     */
+    var CanvasOverlay = function() { 
+    	jsPlumb.jsPlumbUIComponent.apply(this, arguments);
+    };
+    
+    var AbstractCanvasArrowOverlay = function(superclass, originalArgs) {
+    	superclass.apply(this, originalArgs);
+    	CanvasOverlay.apply(this, originalArgs);
+    	this.paint = function(connector, d, lineWidth, strokeStyle, fillStyle) {
+    		var ctx = connector.ctx;
+    		
+			ctx.lineWidth = lineWidth;
+			ctx.beginPath();
+			ctx.moveTo(d.hxy.x, d.hxy.y);
+			ctx.lineTo(d.tail[0].x, d.tail[0].y);
+			ctx.lineTo(d.cxy.x, d.cxy.y);
+			ctx.lineTo(d.tail[1].x, d.tail[1].y);
+			ctx.lineTo(d.hxy.x, d.hxy.y);
+			ctx.closePath();						
+						
+			if (strokeStyle) {
+				ctx.strokeStyle = strokeStyle;
+				ctx.stroke();
+			}
+			if (fillStyle) {
+				ctx.fillStyle = fillStyle;			
+				ctx.fill();
+			}
+    	};
+    }; 
+    
+    jsPlumb.Overlays.canvas.Arrow = function() {
+    	AbstractCanvasArrowOverlay.apply(this, [jsPlumb.Overlays.Arrow, arguments]);    	
+    };
+    
+    jsPlumb.Overlays.canvas.PlainArrow = function() {
+    	AbstractCanvasArrowOverlay.apply(this, [jsPlumb.Overlays.PlainArrow, arguments]);    	
+    };
+    
+    jsPlumb.Overlays.canvas.Diamond = function() {
+    	AbstractCanvasArrowOverlay.apply(this, [jsPlumb.Overlays.Diamond, arguments]);    	
+    };		
+})();
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/1.3.15/jsPlumb-renderers-svg-1.3.15-RC1.js	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,577 @@
+/*
+ * jsPlumb
+ * 
+ * Title:jsPlumb 1.3.15
+ * 
+ * Provides a way to visually connect elements on an HTML page, using either SVG, Canvas
+ * elements, or VML.  
+ * 
+ * This file contains the SVG renderers.
+ *
+ * Copyright (c) 2010 - 2012 Simon Porritt (http://jsplumb.org)
+ * 
+ * http://jsplumb.org
+ * http://github.com/sporritt/jsplumb
+ * http://code.google.com/p/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+
+/**
+ * SVG support for jsPlumb.
+ * 
+ * things to investigate:
+ * 
+ * gradients:  https://developer.mozilla.org/en/svg_in_html_introduction
+ * css:http://tutorials.jenkov.com/svg/svg-and-css.html
+ * text on a path: http://www.w3.org/TR/SVG/text.html#TextOnAPath
+ * pointer events: https://developer.mozilla.org/en/css/pointer-events
+ *
+ * IE9 hover jquery: http://forum.jquery.com/topic/1-6-2-broke-svg-hover-events
+ *
+ */
+;(function() {
+	
+	var svgAttributeMap = {
+		"joinstyle":"stroke-linejoin",
+		"stroke-linejoin":"stroke-linejoin",		
+		"stroke-dashoffset":"stroke-dashoffset",
+		"stroke-linecap":"stroke-linecap"
+	},
+	STROKE_DASHARRAY = "stroke-dasharray",
+	DASHSTYLE = "dashstyle",
+	LINEAR_GRADIENT = "linearGradient",
+	RADIAL_GRADIENT = "radialGradient",
+	FILL = "fill",
+	STOP = "stop",
+	STROKE = "stroke",
+	STROKE_WIDTH = "stroke-width",
+	STYLE = "style",
+	NONE = "none",
+	JSPLUMB_GRADIENT = "jsplumb_gradient_",
+	LINE_WIDTH = "lineWidth",
+	ns = {
+		svg:"http://www.w3.org/2000/svg",
+		xhtml:"http://www.w3.org/1999/xhtml"
+	},
+	_attr = function(node, attributes) {
+		for (var i in attributes)
+			node.setAttribute(i, "" + attributes[i]);
+	},	
+	_node = function(name, attributes) {
+		var n = document.createElementNS(ns.svg, name);
+		attributes = attributes || {};
+		attributes["version"] = "1.1";
+		attributes["xmlns"] = ns.xhtml;
+		_attr(n, attributes);
+		return n;
+	},
+	_pos = function(d) { return "position:absolute;left:" + d[0] + "px;top:" + d[1] + "px"; },	
+	_clearGradient = function(parent) {
+		for (var i = 0; i < parent.childNodes.length; i++) {
+			if (parent.childNodes[i].tagName == LINEAR_GRADIENT || parent.childNodes[i].tagName == RADIAL_GRADIENT)
+				parent.removeChild(parent.childNodes[i]);
+		}
+	},		
+	_updateGradient = function(parent, node, style, dimensions, uiComponent) {
+		var id = JSPLUMB_GRADIENT + uiComponent._jsPlumb.idstamp();
+		// first clear out any existing gradient
+		_clearGradient(parent);
+		// this checks for an 'offset' property in the gradient, and in the absence of it, assumes
+		// we want a linear gradient. if it's there, we create a radial gradient.
+		// it is possible that a more explicit means of defining the gradient type would be
+		// better. relying on 'offset' means that we can never have a radial gradient that uses
+		// some default offset, for instance.
+		// issue 244 suggested the 'gradientUnits' attribute; without this, straight/flowchart connectors with gradients would
+		// not show gradients when the line was perfectly horizontal or vertical.
+		if (!style.gradient.offset) {
+			var g = _node(LINEAR_GRADIENT, {id:id, gradientUnits:"userSpaceOnUse"});
+			parent.appendChild(g);
+		}
+		else {
+			var g = _node(RADIAL_GRADIENT, {
+				id:id
+			});
+			parent.appendChild(g);
+		}
+		
+		// the svg radial gradient seems to treat stops in the reverse 
+		// order to how canvas does it.  so we want to keep all the maths the same, but
+		// iterate the actual style declarations in reverse order, if the x indexes are not in order.
+		for (var i = 0; i < style.gradient.stops.length; i++) {
+			// Straight Connectors and Bezier connectors act slightly differently; this code is a bit of a kludge.  but next version of
+			// jsplumb will be replacing both Straight and Bezier to be generic instances of 'Connector', which has a list of segments.
+			// so, not too concerned about leaving this in for now.
+			var styleToUse = i;
+			if (dimensions.length == 8) 
+				styleToUse = dimensions[4] < dimensions[6] ? i: style.gradient.stops.length - 1 - i;
+			else
+				styleToUse = dimensions[4] < dimensions[6] ? style.gradient.stops.length - 1 - i : i;
+			var stopColor = jsPlumbUtil.convertStyle(style.gradient.stops[styleToUse][1], true);
+			var s = _node(STOP, {"offset":Math.floor(style.gradient.stops[i][0] * 100) + "%", "stop-color":stopColor});
+			g.appendChild(s);
+		}
+		var applyGradientTo = style.strokeStyle ? STROKE : FILL;
+		node.setAttribute(STYLE, applyGradientTo + ":url(#" + id + ")");
+	},
+	_applyStyles = function(parent, node, style, dimensions, uiComponent) {
+		
+		if (style.gradient) {
+			_updateGradient(parent, node, style, dimensions, uiComponent);			
+		}
+		else {
+			// make sure we clear any existing gradient
+			_clearGradient(parent);
+			node.setAttribute(STYLE, "");
+		}
+		
+		node.setAttribute(FILL, style.fillStyle ? jsPlumbUtil.convertStyle(style.fillStyle, true) : NONE);
+		node.setAttribute(STROKE, style.strokeStyle ? jsPlumbUtil.convertStyle(style.strokeStyle, true) : NONE);		
+		if (style.lineWidth) {
+			node.setAttribute(STROKE_WIDTH, style.lineWidth);
+		}
+	
+		// in SVG there is a stroke-dasharray attribute we can set, and its syntax looks like
+		// the syntax in VML but is actually kind of nasty: values are given in the pixel
+		// coordinate space, whereas in VML they are multiples of the width of the stroked
+		// line, which makes a lot more sense.  for that reason, jsPlumb is supporting both
+		// the native svg 'stroke-dasharray' attribute, and also the 'dashstyle' concept from
+		// VML, which will be the preferred method.  the code below this converts a dashstyle
+		// attribute given in terms of stroke width into a pixel representation, by using the
+		// stroke's lineWidth. 
+		if (style[DASHSTYLE] && style[LINE_WIDTH] && !style[STROKE_DASHARRAY]) {
+			var sep = style[DASHSTYLE].indexOf(",") == -1 ? " " : ",",
+			parts = style[DASHSTYLE].split(sep),
+			styleToUse = "";
+			parts.forEach(function(p) {
+				styleToUse += (Math.floor(p * style.lineWidth) + sep);
+			});
+			node.setAttribute(STROKE_DASHARRAY, styleToUse);
+		}		
+		else if(style[STROKE_DASHARRAY]) {
+			node.setAttribute(STROKE_DASHARRAY, style[STROKE_DASHARRAY]);
+		}
+		
+		// extra attributes such as join type, dash offset.
+		for (var i in svgAttributeMap) {
+			if (style[i]) {
+				node.setAttribute(svgAttributeMap[i], style[i]);
+			}
+		}
+	},
+	_decodeFont = function(f) {
+		var r = /([0-9].)(p[xt])\s(.*)/;
+		var bits = f.match(r);
+		return {size:bits[1] + bits[2], font:bits[3]};		
+	},
+	_classManip = function(el, add, clazz) {
+		var classesToAddOrRemove = clazz.split(" "),
+			className = el.className,
+			curClasses = className.baseVal.split(" ");
+			
+		for (var i = 0; i < classesToAddOrRemove.length; i++) {
+			if (add) {
+				if (curClasses.indexOf(classesToAddOrRemove[i]) == -1)
+					curClasses.push(classesToAddOrRemove[i]);
+			}
+			else {
+				var idx = curClasses.indexOf(classesToAddOrRemove[i]);
+				if (idx != -1)
+					curClasses.splice(idx, 1);
+			}
+		}
+		
+		el.className.baseVal = curClasses.join(" ");
+	},
+	_addClass = function(el, clazz) {
+		_classManip(el, true, clazz);
+	},
+	_removeClass = function(el, clazz) {
+		_classManip(el, false, clazz);
+	};
+	
+	/**
+		utility methods for other objects to use.
+	*/
+	jsPlumbUtil.svg = {
+		addClass:_addClass,
+		removeClass:_removeClass,
+		node:_node,
+		attr:_attr,
+		pos:_pos
+	};
+	
+	/*
+	 * Base class for SVG components.
+	 */	
+	var SvgComponent = function(params) {
+		var self = this,
+		pointerEventsSpec = params.pointerEventsSpec || "all";
+		jsPlumb.jsPlumbUIComponent.apply(this, params.originalArgs);
+		self.canvas = null, self.path = null, self.svg = null; 
+	
+		var clazz = params.cssClass + " " + (params.originalArgs[0].cssClass || ""),		
+			svgParams = {
+				"style":"",
+				"width":0,
+				"height":0,
+				"pointer-events":pointerEventsSpec,
+				"position":"absolute"
+			};		
+		if (self.tooltip) svgParams["title"] = self.tooltip;
+		self.svg = _node("svg", svgParams);
+		if (params.useDivWrapper) {
+			self.canvas = document.createElement("div");
+			self.canvas.style["position"] = "absolute";
+			jsPlumb.sizeCanvas(self.canvas,0,0,1,1);
+			self.canvas.className = clazz;
+			if (self.tooltip) self.canvas.setAttribute("title", self.tooltip);
+		}
+		else {
+			_attr(self.svg, { "class":clazz });
+			self.canvas = self.svg;
+		}
+			
+		params._jsPlumb.appendElement(self.canvas, params.originalArgs[0]["parent"]);
+		if (params.useDivWrapper) self.canvas.appendChild(self.svg);
+		
+		// TODO this displayElement stuff is common between all components, across all
+		// renderers.  would be best moved to jsPlumbUIComponent.
+		var displayElements = [ self.canvas ];
+		this.getDisplayElements = function() { 
+			return displayElements; 
+		};
+		
+		this.appendDisplayElement = function(el) {
+			displayElements.push(el);
+		};
+		
+		this.paint = function(d, style, anchor) {	   
+			if (style != null) {
+				var x = d[0], y = d[1];
+				if (params.useDivWrapper) {
+					jsPlumb.sizeCanvas(self.canvas, d[0], d[1], d[2], d[3]);
+					x = 0, y = 0;
+				}
+				var p = _pos([x, y, d[2], d[3]]);
+				if (self.getZIndex()) p += ";z-index:" + self.getZIndex() + ";";
+		    	_attr(self.svg, {
+	    			"style":p,
+	    			"width": d[2],
+	    			"height": d[3]
+	    		});
+		    	self._paint.apply(this, arguments);		    			    	
+			}
+	    };	
+	};
+	
+	/*
+	 * Base class for SVG connectors.
+	 */
+	var SvgConnector = jsPlumb.SvgConnector = function(params) {
+		var self = this;
+		SvgComponent.apply(this, [ { 
+			cssClass:params["_jsPlumb"].connectorClass, 
+			originalArgs:arguments, 
+			pointerEventsSpec:"none", 
+			tooltip:params.tooltip,
+			_jsPlumb:params["_jsPlumb"] 
+		} ]);
+		this._paint = function(d, style) {
+			var p = self.getPath(d), a = { "d":p }, outlineStyle = null;									
+			a["pointer-events"] = "all";
+			
+			// outline style.  actually means drawing an svg object underneath the main one.
+			if (style.outlineColor) {
+				var outlineWidth = style.outlineWidth || 1,
+				outlineStrokeWidth = style.lineWidth + (2 * outlineWidth),
+				outlineStyle = jsPlumb.CurrentLibrary.extend({}, style);
+				outlineStyle.strokeStyle = jsPlumbUtil.convertStyle(style.outlineColor);
+				outlineStyle.lineWidth = outlineStrokeWidth;
+				
+				if (self.bgPath == null) {
+					self.bgPath = _node("path", a);
+			    	self.svg.appendChild(self.bgPath);
+		    		self.attachListeners(self.bgPath, self);
+				}
+				else {
+					_attr(self.bgPath, a);
+				}
+				
+				_applyStyles(self.svg, self.bgPath, outlineStyle, d, self);
+			}
+			
+			
+			// test - see below
+	    	//	a["clip-path"]= "url(#testClip)"; 
+			
+	    	if (self.path == null) {
+		    	self.path = _node("path", a);
+		    	self.svg.appendChild(self.path);
+	    		self.attachListeners(self.path, self);	    	
+	    		
+	    		/*
+	    		this is a test of a clip path.  i'm looking into using one of these to animate a jsplumb connection.
+	    		you could do this by walking along the line, stepping along a little at a time, and setting the clip
+	    		path to extend as far as that point.
+	    		
+	    		self.clip = _node("clipPath", {id:"testClip", clipPathUnits:"objectBoundingBox"});
+	    		self.svg.appendChild(self.clip);
+	    		self.clip.appendChild(_node("rect", {
+	    			x:"0",y:"0",width:"0.5",height:"1" 
+	    		}));
+	    		*/
+	    	}
+	    	else {
+	    		_attr(self.path, a);
+	    	}
+	    		    	
+	    	_applyStyles(self.svg, self.path, style, d, self);
+		};
+		
+		this.reattachListeners = function() {
+			if (self.bgPath) self.reattachListenersForElement(self.bgPath, self);
+			if (self.path) self.reattachListenersForElement(self.path, self);
+		};
+			
+	};		
+
+	/*
+	 * SVG Bezier Connector
+	 */
+	jsPlumb.Connectors.svg.Bezier = function(params) {	
+		jsPlumb.Connectors.Bezier.apply(this, arguments);
+		SvgConnector.apply(this, arguments);	
+		this.getPath = function(d) {
+			var _p = "M " + d[4] + " " + d[5];						
+			_p += (" C " + d[8] + " " + d[9] + " " + d[10] + " " + d[11] + " " + d[6] + " " + d[7]);			
+			return _p;
+		};
+	};
+	
+	/*
+	 * SVG straight line Connector
+	 */
+	jsPlumb.Connectors.svg.Straight = function(params) {			
+		jsPlumb.Connectors.Straight.apply(this, arguments);
+		SvgConnector.apply(this, arguments);	    		    
+	    this.getPath = function(d) { return "M " + d[4] + " " + d[5] + " L " + d[6] + " " + d[7]; };	    
+	};
+	
+	jsPlumb.Connectors.svg.Flowchart = function() {
+    	var self = this;
+    	jsPlumb.Connectors.Flowchart.apply(this, arguments);
+		SvgConnector.apply(this, arguments);
+    	this.getPath = function(dimensions) {
+    		var p = "M " + dimensions[4] + "," + dimensions[5],
+				lx = dimensions[4],
+				ly = dimensions[5];
+				
+	        // loop through extra points
+	        for (var i = 0; i < dimensions[8]; i++) {
+				
+				var x1 = dimensions[9 + (i*2)], y1 = dimensions[10 + (i*2)],
+					x2 =  dimensions[9 + ((i + 1) * 2)], y2 = dimensions[10 + ((i + 1) * 2)],					
+					horiz = (x1 != lx) && (y1 == ly),
+					vert = (x1 == lx) && (y1 != ly),
+					multX = horiz ? x1 > x2 ? 1 : -1 : 0,
+					multY = vert ? y1 > y2 ? 1 : -1 : 0,
+					halfStroke = self.lineWidth / 2;								
+					
+				// previously:
+				//p = p + " L " + x1 + " " + y1;
+				//p = p + " M " + x1 + " " + y1;
+									
+				// now, with support for painting an extra bit at the end each line:
+	        	p = p + " L " + x1 + " " + y1;											
+				p = p + " L " + (x1 + (multX * halfStroke)) + " " + (y1 + (multY * halfStroke));
+					
+				lx = x1;
+				ly = y1;				
+				p = p + " M " + x1 + " " + y1;				
+	        }
+	        // finally draw a line to the end
+	        p = p  + " L " + dimensions[6] + "," +  dimensions[7];
+	        return p;
+    	};
+    };
+    
+    /*
+	 * Base class for SVG endpoints.
+	 */
+	var SvgEndpoint = window.SvgEndpoint = function(params) {
+		var self = this;
+		SvgComponent.apply(this, [ {
+			cssClass:params["_jsPlumb"].endpointClass, 
+			originalArgs:arguments, 
+			pointerEventsSpec:"all",
+			useDivWrapper:true,
+			_jsPlumb:params["_jsPlumb"]
+		} ]);
+		this._paint = function(d, style) {
+			var s = jsPlumb.extend({}, style);
+			if (s.outlineColor) {
+				s.strokeWidth = s.outlineWidth;
+				s.strokeStyle = jsPlumbUtil.convertStyle(s.outlineColor, true);
+			}
+			
+			if (self.node == null) {
+				self.node = self.makeNode(d, s);
+				self.svg.appendChild(self.node);
+				self.attachListeners(self.node, self);
+			}
+			_applyStyles(self.svg, self.node, s, d, self);
+			_pos(self.node, d);
+		};
+		
+		this.reattachListeners = function() {
+			if (self.node) self.reattachListenersForElement(self.node, self);
+		};
+	};
+	
+	/*
+	 * SVG Dot Endpoint
+	 */
+	jsPlumb.Endpoints.svg.Dot = function() {
+		jsPlumb.Endpoints.Dot.apply(this, arguments);
+		SvgEndpoint.apply(this, arguments);		
+		this.makeNode = function(d, style) { 
+			return _node("circle", {
+					"cx"	:	d[2] / 2,
+					"cy"	:	d[3] / 2,
+					"r"		:	d[2] / 2
+				});			
+		};
+	};
+	
+	/*
+	 * SVG Rectangle Endpoint 
+	 */
+	jsPlumb.Endpoints.svg.Rectangle = function() {
+		jsPlumb.Endpoints.Rectangle.apply(this, arguments);
+		SvgEndpoint.apply(this, arguments);		
+		this.makeNode = function(d, style) {
+			return _node("rect", {
+				"width":d[2],
+				"height":d[3]
+			});
+		};			
+	};		
+	
+	/*
+	 * SVG Image Endpoint is the default image endpoint.
+	 */
+	jsPlumb.Endpoints.svg.Image = jsPlumb.Endpoints.Image;
+	/*
+	 * Blank endpoint in svg renderer is the default Blank endpoint.
+	 */
+	jsPlumb.Endpoints.svg.Blank = jsPlumb.Endpoints.Blank;	
+	/*
+	 * Label overlay in svg renderer is the default Label overlay.
+	 */
+	jsPlumb.Overlays.svg.Label = jsPlumb.Overlays.Label;
+	/*
+	 * Custom overlay in svg renderer is the default Custom overlay.
+	 */
+	jsPlumb.Overlays.svg.Custom = jsPlumb.Overlays.Custom;
+		
+	var AbstractSvgArrowOverlay = function(superclass, originalArgs) {
+    	superclass.apply(this, originalArgs);
+    	jsPlumb.jsPlumbUIComponent.apply(this, originalArgs);
+        this.isAppendedAtTopLevel = false;
+    	var self = this, path = null;
+    	this.paint = function(connector, d, lineWidth, strokeStyle, fillStyle) {
+    		if (path == null) {
+    			path = _node("path", {
+    				"pointer-events":"all"	
+    			});
+    			connector.svg.appendChild(path);
+    			
+    			self.attachListeners(path, connector);
+    			self.attachListeners(path, self);
+    		}
+    		var clazz = originalArgs && (originalArgs.length == 1) ? (originalArgs[0].cssClass || "") : "";
+    		
+    		_attr(path, { 
+    			"d"		:	makePath(d),
+    			"class" :	clazz,
+    			stroke 	: 	strokeStyle ? strokeStyle : null,
+    			fill 	: 	fillStyle ? fillStyle : null
+    		});    		
+    	};
+    	var makePath = function(d) {
+    		return "M" + d.hxy.x + "," + d.hxy.y +
+    				" L" + d.tail[0].x + "," + d.tail[0].y + 
+    				" L" + d.cxy.x + "," + d.cxy.y + 
+    				" L" + d.tail[1].x + "," + d.tail[1].y + 
+    				" L" + d.hxy.x + "," + d.hxy.y;
+    	};
+    	this.reattachListeners = function() {
+			if (path) self.reattachListenersForElement(path, self);
+		};
+		this.cleanup = function() {
+    		if (path != null) jsPlumb.CurrentLibrary.removeElement(path);
+    	};
+    };
+    
+    jsPlumb.Overlays.svg.Arrow = function() {
+    	AbstractSvgArrowOverlay.apply(this, [jsPlumb.Overlays.Arrow, arguments]);    	
+    };
+    
+    jsPlumb.Overlays.svg.PlainArrow = function() {
+    	AbstractSvgArrowOverlay.apply(this, [jsPlumb.Overlays.PlainArrow, arguments]);    	
+    };
+    
+    jsPlumb.Overlays.svg.Diamond = function() {
+    	AbstractSvgArrowOverlay.apply(this, [jsPlumb.Overlays.Diamond, arguments]);    	
+    };
+
+    // a test
+    jsPlumb.Overlays.svg.GuideLines = function() {
+        var path = null, self = this, path2 = null, p1_1, p1_2;
+        jsPlumb.Overlays.GuideLines.apply(this, arguments);
+        this.paint = function(connector, d, lineWidth, strokeStyle, fillStyle) {
+    		if (path == null) {
+    			path = _node("path");
+    			connector.svg.appendChild(path);
+    			self.attachListeners(path, connector);
+    			self.attachListeners(path, self);
+
+                p1_1 = _node("path");
+    			connector.svg.appendChild(p1_1);
+    			self.attachListeners(p1_1, connector);
+    			self.attachListeners(p1_1, self);
+
+                p1_2 = _node("path");
+    			connector.svg.appendChild(p1_2);
+    			self.attachListeners(p1_2, connector);
+    			self.attachListeners(p1_2, self);
+
+    		}
+
+    		_attr(path, {
+    			"d"		:	makePath(d[0], d[1]),
+    			stroke 	: 	"red",
+    			fill 	: 	null
+    		});
+
+            _attr(p1_1, {
+    			"d"		:	makePath(d[2][0], d[2][1]),
+    			stroke 	: 	"blue",
+    			fill 	: 	null
+    		});
+
+            _attr(p1_2, {
+    			"d"		:	makePath(d[3][0], d[3][1]),
+    			stroke 	: 	"green",
+    			fill 	: 	null
+    		});
+    	};
+
+        var makePath = function(d1, d2) {
+            return "M " + d1.x + "," + d1.y +
+                   " L" + d2.x + "," + d2.y;
+        };
+
+    };
+})();
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/1.3.15/jsPlumb-renderers-vml-1.3.15-RC1.js	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,454 @@
+/*
+ * jsPlumb
+ * 
+ * Title:jsPlumb 1.3.15
+ * 
+ * Provides a way to visually connect elements on an HTML page, using either SVG, Canvas
+ * elements, or VML.  
+ * 
+ * This file contains the VML renderers.
+ *
+ * Copyright (c) 2010 - 2012 Simon Porritt (http://jsplumb.org)
+ * 
+ * http://jsplumb.org
+ * http://github.com/sporritt/jsplumb
+ * http://code.google.com/p/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+
+;(function() {
+	
+	// http://ajaxian.com/archives/the-vml-changes-in-ie-8
+	// http://www.nczonline.net/blog/2010/01/19/internet-explorer-8-document-and-browser-modes/
+	// http://www.louisremi.com/2009/03/30/changes-in-vml-for-ie8-or-what-feature-can-the-ie-dev-team-break-for-you-today/
+	
+	var vmlAttributeMap = {
+		"stroke-linejoin":"joinstyle",
+		"joinstyle":"joinstyle",		
+		"endcap":"endcap",
+		"miterlimit":"miterlimit"
+	},
+	jsPlumbStylesheet = null;
+	
+	if (document.createStyleSheet && document.namespaces) {			
+		
+		var ruleClasses = [
+				".jsplumb_vml", "jsplumb\\:textbox", "jsplumb\\:oval", "jsplumb\\:rect", 
+				"jsplumb\\:stroke", "jsplumb\\:shape", "jsplumb\\:group"
+			],
+			rule = "behavior:url(#default#VML);position:absolute;";
+
+		jsPlumbStylesheet = document.createStyleSheet();
+
+		for (var i = 0; i < ruleClasses.length; i++)
+			jsPlumbStylesheet.addRule(ruleClasses[i], rule);
+
+		// in this page it is also mentioned that IE requires the extra arg to the namespace
+		// http://www.louisremi.com/2009/03/30/changes-in-vml-for-ie8-or-what-feature-can-the-ie-dev-team-break-for-you-today/
+		// but someone commented saying they didn't need it, and it seems jsPlumb doesnt need it either.
+		// var iev = document.documentMode;
+		//if (!iev || iev < 8)
+			document.namespaces.add("jsplumb", "urn:schemas-microsoft-com:vml");
+		//else
+		//	document.namespaces.add("jsplumb", "urn:schemas-microsoft-com:vml", "#default#VML");
+	}
+	
+	jsPlumb.vml = {};
+	
+	var scale = 1000,
+
+    _groupMap = {},
+    _getGroup = function(container, connectorClass) {
+        var id = jsPlumb.getId(container),
+            g = _groupMap[id];
+        if(!g) {
+            g = _node("group", [0,0,scale, scale], {"class":connectorClass});
+            //g.style.position=absolute;
+            //g["coordsize"] = "1000,1000";
+            g.style.backgroundColor="red";
+            _groupMap[id] = g;
+            jsPlumb.appendElement(g, container);  // todo if this gets reinstated, remember to use the current jsplumb instance.
+            //document.body.appendChild(g);
+        }
+        return g;
+    },
+	_atts = function(o, atts) {
+		for (var i in atts) { 
+			// IE8 fix: setattribute does not work after an element has been added to the dom!
+			// http://www.louisremi.com/2009/03/30/changes-in-vml-for-ie8-or-what-feature-can-the-ie-dev-team-break-for-you-today/
+			//o.setAttribute(i, atts[i]);
+
+			/*There is an additional problem when accessing VML elements by using get/setAttribute. The simple solution is following:
+
+			if (document.documentMode==8) {
+			ele.opacity=1;
+			} else {
+			ele.setAttribute(‘opacity’,1);
+			}
+			*/
+
+			o[i] = atts[i];
+		}
+	},
+	_node = function(name, d, atts, parent, _jsPlumb, deferToJsPlumbContainer) {
+		atts = atts || {};
+		var o = document.createElement("jsplumb:" + name);
+		if (deferToJsPlumbContainer)
+			_jsPlumb.appendElement(o, parent);
+		else
+			jsPlumb.CurrentLibrary.appendElement(o, parent);
+		o.className = (atts["class"] ? atts["class"] + " " : "") + "jsplumb_vml";
+		_pos(o, d);
+		_atts(o, atts);
+		return o;
+	},
+	_pos = function(o,d, zIndex) {
+		o.style.left = d[0] + "px";		
+		o.style.top =  d[1] + "px";
+		o.style.width= d[2] + "px";
+		o.style.height= d[3] + "px";
+		o.style.position = "absolute";
+		if (zIndex)
+			o.style.zIndex = zIndex;
+	},
+	_conv = jsPlumb.vml.convertValue = function(v) {
+		return Math.floor(v * scale);
+	},	
+	// tests if the given style is "transparent" and then sets the appropriate opacity node to 0 if so,
+	// or 1 if not.  TODO in the future, support variable opacity.
+	_maybeSetOpacity = function(styleToWrite, styleToCheck, type, component) {
+		if ("transparent" === styleToCheck)
+			component.setOpacity(type, "0.0");
+		else
+			component.setOpacity(type, "1.0");
+	},
+	_applyStyles = function(node, style, component, _jsPlumb) {
+		var styleToWrite = {};
+		if (style.strokeStyle) {
+			styleToWrite["stroked"] = "true";
+			var strokeColor = jsPlumbUtil.convertStyle(style.strokeStyle, true);
+			styleToWrite["strokecolor"] = strokeColor;
+			_maybeSetOpacity(styleToWrite, strokeColor, "stroke", component);
+			styleToWrite["strokeweight"] = style.lineWidth + "px";
+		}
+		else styleToWrite["stroked"] = "false";
+		
+		if (style.fillStyle) {
+			styleToWrite["filled"] = "true";
+			var fillColor = jsPlumbUtil.convertStyle(style.fillStyle, true);
+			styleToWrite["fillcolor"] = fillColor;
+			_maybeSetOpacity(styleToWrite, fillColor, "fill", component);
+		}
+		else styleToWrite["filled"] = "false";
+		
+		if(style["dashstyle"]) {
+			if (component.strokeNode == null) {
+				component.strokeNode = _node("stroke", [0,0,0,0], { dashstyle:style["dashstyle"] }, node, _jsPlumb);				
+			}
+			else
+				component.strokeNode.dashstyle = style["dashstyle"];
+		}					
+		else if (style["stroke-dasharray"] && style["lineWidth"]) {
+			var sep = style["stroke-dasharray"].indexOf(",") == -1 ? " " : ",",
+			parts = style["stroke-dasharray"].split(sep),
+			styleToUse = "";
+			for(var i = 0; i < parts.length; i++) {
+				styleToUse += (Math.floor(parts[i] / style.lineWidth) + sep);
+			}
+			if (component.strokeNode == null) {
+				component.strokeNode = _node("stroke", [0,0,0,0], { dashstyle:styleToUse }, node, _jsPlumb);				
+			}
+			else
+				component.strokeNode.dashstyle = styleToUse;
+		}
+		
+		_atts(node, styleToWrite);
+	},
+	/*
+	 * Base class for Vml endpoints and connectors. Extends jsPlumbUIComponent. 
+	 */
+	VmlComponent = function() {				
+		var self = this;		
+		jsPlumb.jsPlumbUIComponent.apply(this, arguments);		
+		this.opacityNodes = {
+			"stroke":null,
+			"fill":null
+		};
+		this.initOpacityNodes = function(vml) {
+			self.opacityNodes["stroke"] = _node("stroke", [0,0,1,1], {opacity:"0.0"}, vml, self._jsPlumb);
+			self.opacityNodes["fill"] = _node("fill", [0,0,1,1], {opacity:"0.0"}, vml, self._jsPlumb);							
+		};
+		this.setOpacity = function(type, value) {
+			var node = self.opacityNodes[type];
+			if (node) node["opacity"] = "" + value;
+		};
+		var displayElements = [ ];
+		this.getDisplayElements = function() { 
+			return displayElements; 
+		};
+		
+		this.appendDisplayElement = function(el, doNotAppendToCanvas) {
+			if (!doNotAppendToCanvas) self.canvas.parentNode.appendChild(el);
+			displayElements.push(el);
+		};
+	},	
+	/*
+	 * Base class for Vml connectors. extends VmlComponent.
+	 */
+	VmlConnector = jsPlumb.VmlConnector = function(params) {
+		var self = this;
+		self.strokeNode = null;
+		self.canvas = null;
+		VmlComponent.apply(this, arguments);
+		var clazz = self._jsPlumb.connectorClass + (params.cssClass ? (" " + params.cssClass) : "");
+		this.paint = function(d, style, anchor) {
+			if (style != null) {				
+				var path = self.getPath(d), p = { "path":path };				
+
+                //*
+				if (style.outlineColor) {
+					var outlineWidth = style.outlineWidth || 1,
+					outlineStrokeWidth = style.lineWidth + (2 * outlineWidth),
+					outlineStyle = {
+						strokeStyle : jsPlumbUtil.convertStyle(style.outlineColor),
+						lineWidth : outlineStrokeWidth
+					};
+					for (var aa in vmlAttributeMap) outlineStyle[aa] = style[aa];
+					
+					if (self.bgCanvas == null) {						
+						p["class"] = clazz;
+						p["coordsize"] = (d[2] * scale) + "," + (d[3] * scale);
+						self.bgCanvas = _node("shape", d, p, params.parent, self._jsPlumb, true);						
+						_pos(self.bgCanvas, d, self.getZIndex());
+						self.appendDisplayElement(self.bgCanvas, true);	
+						self.attachListeners(self.bgCanvas, self);					
+						self.initOpacityNodes(self.bgCanvas, ["stroke"]);		
+					}
+					else {
+						p["coordsize"] = (d[2] * scale) + "," + (d[3] * scale);
+						_pos(self.bgCanvas, d, self.getZIndex());
+						_atts(self.bgCanvas, p);
+					}
+					
+					_applyStyles(self.bgCanvas, outlineStyle, self);
+				}
+				//*/
+				
+				if (self.canvas == null) {										
+					p["class"] = clazz;
+					p["coordsize"] = (d[2] * scale) + "," + (d[3] * scale);
+					if (self.tooltip) p["label"] = self.tooltip;
+					self.canvas = _node("shape", d, p, params.parent, self._jsPlumb, true);					                
+                    //var group = _getGroup(params.parent);                   // test of append everything to a group
+                    //group.appendChild(self.canvas);                           // sort of works but not exactly;
+					//params["_jsPlumb"].appendElement(self.canvas, params.parent);    //before introduction of groups
+
+					self.appendDisplayElement(self.canvas, true);										
+					self.attachListeners(self.canvas, self);					
+					self.initOpacityNodes(self.canvas, ["stroke"]);		
+				}
+				else {
+					p["coordsize"] = (d[2] * scale) + "," + (d[3] * scale);
+					_pos(self.canvas, d, self.getZIndex());
+					_atts(self.canvas, p);
+				}
+				
+				_applyStyles(self.canvas, style, self, self._jsPlumb);
+			}
+		};
+		
+		//self.appendDisplayElement(self.canvas);
+		
+		this.reattachListeners = function() {
+			if (self.canvas) self.reattachListenersForElement(self.canvas, self);
+		};
+	},		
+	/*
+	 * 
+	 * Base class for Vml Endpoints. extends VmlComponent.
+	 * 
+	 */
+	VmlEndpoint = window.VmlEndpoint = function(params) {
+		VmlComponent.apply(this, arguments);
+		var vml = null, self = this, opacityStrokeNode = null, opacityFillNode = null;
+		self.canvas = document.createElement("div");
+		self.canvas.style["position"] = "absolute";
+
+		var clazz = self._jsPlumb.endpointClass + (params.cssClass ? (" " + params.cssClass) : "");
+
+		//var group = _getGroup(params.parent);
+        //group.appendChild(self.canvas);
+		params["_jsPlumb"].appendElement(self.canvas, params.parent);
+
+        if (self.tooltip) self.canvas.setAttribute("label", self.tooltip);
+		
+		this.paint = function(d, style, anchor) {
+			var p = { };					
+			
+			jsPlumb.sizeCanvas(self.canvas, d[0], d[1], d[2], d[3]);
+			if (vml == null) {
+				p["class"] = clazz;
+				vml = self.getVml([0,0, d[2], d[3]], p, anchor, self.canvas, self._jsPlumb);				
+				self.attachListeners(vml, self);
+
+				self.appendDisplayElement(vml, true);
+				self.appendDisplayElement(self.canvas, true);
+				
+				self.initOpacityNodes(vml, ["fill"]);			
+			}
+			else {				
+				_pos(vml, [0,0, d[2], d[3]]);
+				_atts(vml, p);
+			}
+			
+			_applyStyles(vml, style, self);
+		};
+		
+		this.reattachListeners = function() {
+			if (vml) self.reattachListenersForElement(vml, self);
+		};
+	};
+	
+	jsPlumb.Connectors.vml.Bezier = function() {
+		jsPlumb.Connectors.Bezier.apply(this, arguments);	
+		VmlConnector.apply(this, arguments);
+		this.getPath = function(d) {			
+			return "m" + _conv(d[4]) + "," + _conv(d[5]) + 
+				   " c" + _conv(d[8]) + "," + _conv(d[9]) + "," + _conv(d[10]) + "," + _conv(d[11]) + "," + _conv(d[6]) + "," + _conv(d[7]) + " e";
+		};
+	};
+	
+	jsPlumb.Connectors.vml.Straight = function() {
+		jsPlumb.Connectors.Straight.apply(this, arguments);	
+		VmlConnector.apply(this, arguments);
+		this.getPath = function(d) {
+			return "m" + _conv(d[4]) + "," + _conv(d[5]) + " l" + _conv(d[6]) + "," + _conv(d[7]) + " e";
+		};
+	};
+	
+	jsPlumb.Connectors.vml.Flowchart = function() {
+    	jsPlumb.Connectors.Flowchart.apply(this, arguments);
+		VmlConnector.apply(this, arguments);
+    	this.getPath = function(dimensions) {
+    		var p = "m " + _conv(dimensions[4]) + "," + _conv(dimensions[5]) + " l";
+	        // loop through extra points
+	        for (var i = 0; i < dimensions[8]; i++) {
+	        	p = p + " " + _conv(dimensions[9 + (i*2)]) + "," + _conv(dimensions[10 + (i*2)]);
+	        }
+	        // finally draw a line to the end
+	        p = p  + " " + _conv(dimensions[6]) + "," +  _conv(dimensions[7]) + " e";
+	        return p;
+    	};
+    };
+	
+	jsPlumb.Endpoints.vml.Dot = function() {
+		jsPlumb.Endpoints.Dot.apply(this, arguments);
+		VmlEndpoint.apply(this, arguments);
+		this.getVml = function(d, atts, anchor, parent, _jsPlumb) { return _node("oval", d, atts, parent, _jsPlumb); };
+	};
+	
+	jsPlumb.Endpoints.vml.Rectangle = function() {
+		jsPlumb.Endpoints.Rectangle.apply(this, arguments);
+		VmlEndpoint.apply(this, arguments);
+		this.getVml = function(d, atts, anchor, parent, _jsPlumb) { return _node("rect", d, atts, parent, _jsPlumb); };
+	};
+	
+	/*
+	 * VML Image Endpoint is the same as the default image endpoint.
+	 */
+	jsPlumb.Endpoints.vml.Image = jsPlumb.Endpoints.Image;
+	
+	/**
+	 * placeholder for Blank endpoint in vml renderer.
+	 */
+	jsPlumb.Endpoints.vml.Blank = jsPlumb.Endpoints.Blank;
+	
+	/**
+	 * VML Label renderer. uses the default label renderer (which adds an element to the DOM)
+	 */
+	jsPlumb.Overlays.vml.Label  = jsPlumb.Overlays.Label;
+	
+	/**
+	 * VML Custom renderer. uses the default Custom renderer (which adds an element to the DOM)
+	 */
+	jsPlumb.Overlays.vml.Custom = jsPlumb.Overlays.Custom;
+	
+	var AbstractVmlArrowOverlay = function(superclass, originalArgs) {
+    	superclass.apply(this, originalArgs);
+    	VmlComponent.apply(this, originalArgs);
+    	var self = this, path = null;
+    	self.canvas = null; 
+    	self.isAppendedAtTopLevel = true;
+    	var getPath = function(d, connectorDimensions) {    		
+    		return "m " + _conv(d.hxy.x) + "," + _conv(d.hxy.y) +
+    		       " l " + _conv(d.tail[0].x) + "," + _conv(d.tail[0].y) + 
+    		       " " + _conv(d.cxy.x) + "," + _conv(d.cxy.y) + 
+    		       " " + _conv(d.tail[1].x) + "," + _conv(d.tail[1].y) + 
+    		       " x e";
+    	};
+    	this.paint = function(connector, d, lineWidth, strokeStyle, fillStyle, connectorDimensions) {
+    		var p = {};
+			if (strokeStyle) {
+				p["stroked"] = "true";
+				p["strokecolor"] = jsPlumbUtil.convertStyle(strokeStyle, true);    				
+			}
+			if (lineWidth) p["strokeweight"] = lineWidth + "px";
+			if (fillStyle) {
+				p["filled"] = "true";
+				p["fillcolor"] = fillStyle;
+			}
+			var xmin = Math.min(d.hxy.x, d.tail[0].x, d.tail[1].x, d.cxy.x),
+			ymin = Math.min(d.hxy.y, d.tail[0].y, d.tail[1].y, d.cxy.y),
+			xmax = Math.max(d.hxy.x, d.tail[0].x, d.tail[1].x, d.cxy.x),
+			ymax = Math.max(d.hxy.y, d.tail[0].y, d.tail[1].y, d.cxy.y),
+			w = Math.abs(xmax - xmin),
+			h = Math.abs(ymax - ymin),
+			dim = [xmin, ymin, w, h];
+			
+			// for VML, we create overlays using shapes that have the same dimensions and
+			// coordsize as their connector - overlays calculate themselves relative to the
+			// connector (it's how it's been done since the original canvas implementation, because
+			// for canvas that makes sense).
+			p["path"] = getPath(d, connectorDimensions);
+			p["coordsize"] = (connectorDimensions[2] * scale) + "," + (connectorDimensions[3] * scale);
+			
+			dim[0] = connectorDimensions[0];
+			dim[1] = connectorDimensions[1];
+			dim[2] = connectorDimensions[2];
+			dim[3] = connectorDimensions[3];
+			
+    		if (self.canvas == null) {
+    			//p["class"] = jsPlumb.overlayClass; // TODO currentInstance?
+				self.canvas = _node("shape", dim, p, connector.canvas.parentNode, connector._jsPlumb, true);								
+				connector.appendDisplayElement(self.canvas, true);
+				self.attachListeners(self.canvas, connector);
+				self.attachListeners(self.canvas, self);
+			}
+			else {				
+				_pos(self.canvas, dim);
+				_atts(self.canvas, p);
+			}    		
+    	};
+    	
+    	this.reattachListeners = function() {
+			if (self.canvas) self.reattachListenersForElement(self.canvas, self);
+		};
+
+		this.cleanup = function() {
+    		if (self.canvas != null) jsPlumb.CurrentLibrary.removeElement(self.canvas);
+    	};
+    };
+	
+	jsPlumb.Overlays.vml.Arrow = function() {
+    	AbstractVmlArrowOverlay.apply(this, [jsPlumb.Overlays.Arrow, arguments]);    	
+    };
+    
+    jsPlumb.Overlays.vml.PlainArrow = function() {
+    	AbstractVmlArrowOverlay.apply(this, [jsPlumb.Overlays.PlainArrow, arguments]);    	
+    };
+    
+    jsPlumb.Overlays.vml.Diamond = function() {
+    	AbstractVmlArrowOverlay.apply(this, [jsPlumb.Overlays.Diamond, arguments]);    	
+    };
+})();
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/1.3.15/jsPlumb-util-1.3.15-RC1.js	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,268 @@
+/*
+ * jsPlumb
+ * 
+ * Title:jsPlumb 1.3.15
+ * 
+ * Provides a way to visually connect elements on an HTML page, using either SVG, Canvas
+ * elements, or VML.  
+ * 
+ * This file contains the util functions
+ *
+ * Copyright (c) 2010 - 2012 Simon Porritt (http://jsplumb.org)
+ * 
+ * http://jsplumb.org
+ * http://github.com/sporritt/jsplumb
+ * http://code.google.com/p/jsplumb
+ * 
+ * Dual licensed under the MIT and GPL2 licenses.
+ */
+jsPlumbUtil = {
+	isArray : function(a) {
+		return Object.prototype.toString.call(a) === "[object Array]";	
+	},
+	isString : function(s) {
+		return typeof s === "string";
+	},
+	isBoolean: function(s) {
+		return typeof s === "boolean";
+	},
+	isObject : function(o) {
+		return Object.prototype.toString.call(o) === "[object Object]";	
+	},
+	isDate : function(o) {
+		return Object.prototype.toString.call(o) === "[object Date]";
+	},
+	isFunction: function(o) {
+		return Object.prototype.toString.call(o) === "[object Function]";
+	},
+	clone : function(a) {
+		if (this.isString(a)) return new String(a);
+		else if (this.isBoolean(a)) return new Boolean(a);
+		else if (this.isDate(a)) return new Date(a.getTime());
+		else if (this.isFunction(a)) return a;
+		else if (this.isArray(a)) {
+			var b = [];
+			for (var i = 0; i < a.length; i++)
+				b.push(this.clone(a[i]));
+			return b;
+		}
+		else if (this.isObject(a)) {
+			var b = {};
+			for (var i in a)
+				b[i] = this.clone(a[i]);
+			return b;		
+		}
+		else return a;
+	},
+	merge : function(a, b) {		
+		var c = this.clone(a);		
+		for (var i in b) {
+			if (c[i] == null || this.isString(b[i]) || this.isBoolean(b[i]))
+				c[i] = b[i];
+			else {
+				if (this.isArray(b[i]) && this.isArray(c[i])) {
+					var ar = [];
+					ar.push.apply(ar, c[i]);
+					ar.push.apply(ar, b[i]);
+					c[i] = ar;
+				}
+				else if(this.isObject(c[i]) && this.isObject(b[i])) {												
+					for (var j in b[i])
+						c[i][j] = b[i][j];
+				}
+			}
+		}
+		return c;
+	},
+	convertStyle : function(s, ignoreAlpha) {
+		// TODO: jsPlumb should support a separate 'opacity' style member.
+		if ("transparent" === s) return s;
+		var o = s,
+		    pad = function(n) { return n.length == 1 ? "0" + n : n; },
+		    hex = function(k) { return pad(Number(k).toString(16)); },
+		    pattern = /(rgb[a]?\()(.*)(\))/;
+		if (s.match(pattern)) {
+			var parts = s.match(pattern)[2].split(",");
+			o = "#" + hex(parts[0]) + hex(parts[1]) + hex(parts[2]);
+			if (!ignoreAlpha && parts.length == 4) 
+				o = o + hex(parts[3]);
+		}
+		return o;
+	},
+	gradient : function(p1, p2) {
+		p1 = jsPlumbUtil.isArray(p1) ? p1 : [p1.x, p1.y];
+		p2 = jsPlumbUtil.isArray(p2) ? p2 : [p2.x, p2.y];			
+		return (p2[1] - p1[1]) / (p2[0] - p1[0]);		
+	},
+	normal : function(p1, p2) {
+		return -1 / jsPlumbUtil.gradient(p1,p2);
+	},
+	lineLength : function(p1, p2) {
+		p1 = jsPlumbUtil.isArray(p1) ? p1 : [p1.x, p1.y];
+		p2 = jsPlumbUtil.isArray(p2) ? p2 : [p2.x, p2.y];			
+		return Math.sqrt(Math.pow(p2[1] - p1[1], 2) + Math.pow(p2[0] - p1[0], 2));			
+	},
+    segment : function(p1, p2) {
+        p1 = jsPlumbUtil.isArray(p1) ? p1 : [p1.x, p1.y];
+        p2 = jsPlumbUtil.isArray(p2) ? p2 : [p2.x, p2.y];
+        if (p2[0] > p1[0]) {
+            return (p2[1] > p1[1]) ? 2 : 1;
+        }
+        else {
+            return (p2[1] > p1[1]) ? 3 : 4;
+        }
+    },
+    intersects : function(r1, r2) {
+    	var x1 = r1.x, x2 = r1.x + r1.w, y1 = r1.y, y2 = r1.y + r1.h,
+    		a1 = r2.x, a2 = r2.x + r2.w, b1 = r2.y, b2 = r2.y + r2.h;
+    		
+    	return  ( (x1 <= a1 && a1 <= x2) && (y1 <= b1 && b1 <= y2) ) ||
+    			( (x1 <= a2 && a2 <= x2) && (y1 <= b1 && b1 <= y2) ) ||
+    			( (x1 <= a1 && a1 <= x2) && (y1 <= b2 && b2 <= y2) ) ||
+    			( (x1 <= a2 && a1 <= x2) && (y1 <= b2 && b2 <= y2) ) ||
+    			
+    			( (a1 <= x1 && x1 <= a2) && (b1 <= y1 && y1 <= b2) ) ||
+    			( (a1 <= x2 && x2 <= a2) && (b1 <= y1 && y1 <= b2) ) ||
+    			( (a1 <= x1 && x1 <= a2) && (b1 <= y2 && y2 <= b2) ) ||
+    			( (a1 <= x2 && x1 <= a2) && (b1 <= y2 && y2 <= b2) );
+    },
+    segmentMultipliers : [null, [1, -1], [1, 1], [-1, 1], [-1, -1] ],
+    inverseSegmentMultipliers : [null, [-1, -1], [-1, 1], [1, 1], [1, -1] ],
+	pointOnLine : function(fromPoint, toPoint, distance) {
+        var m = jsPlumbUtil.gradient(fromPoint, toPoint),
+            s = jsPlumbUtil.segment(fromPoint, toPoint),
+		    segmentMultiplier = distance > 0 ? jsPlumbUtil.segmentMultipliers[s] : jsPlumbUtil.inverseSegmentMultipliers[s],
+			theta = Math.atan(m),
+    		y = Math.abs(distance * Math.sin(theta)) * segmentMultiplier[1],
+			x =  Math.abs(distance * Math.cos(theta)) * segmentMultiplier[0];
+		return { x:fromPoint.x + x, y:fromPoint.y + y };
+	},
+    /**
+     * calculates a perpendicular to the line fromPoint->toPoint, that passes through toPoint and is 'length' long.
+     * @param fromPoint
+     * @param toPoint
+     * @param length
+     */
+	perpendicularLineTo : function(fromPoint, toPoint, length) {
+		var m = jsPlumbUtil.gradient(fromPoint, toPoint),
+            theta2 = Math.atan(-1 / m),
+    		y =  length / 2 * Math.sin(theta2),
+			x =  length / 2 * Math.cos(theta2);
+		return [{x:toPoint.x + x, y:toPoint.y + y}, {x:toPoint.x - x, y:toPoint.y - y}];
+	},
+	findWithFunction : function(a, f) {
+    	if (a)
+  			for (var i = 0; i < a.length; i++) if (f(a[i])) return i;
+		return -1;
+	},
+	indexOf : function(l, v) {
+		return jsPlumbUtil.findWithFunction(l, function(_v) { return _v == v; });	
+	},
+    removeWithFunction : function(a, f) {
+        var idx = jsPlumbUtil.findWithFunction(a, f);
+        if (idx > -1) a.splice(idx, 1);
+        return idx != -1;
+    },
+    remove : function(l, v) {
+    	var idx = jsPlumbUtil.indexOf(l, v);	
+    	if (idx > -1) l.splice(idx, 1);
+        return idx != -1;
+    },
+    // TODO support insert index
+    addWithFunction : function(list, item, hashFunction) {
+        if (jsPlumbUtil.findWithFunction(list, hashFunction) == -1) list.push(item);
+    },
+	addToList : function(map, key, value) {
+		var l = map[key];
+		if (l == null) {
+			l = [], map[key] = l;
+		}
+		l.push(value);
+		return l;
+	},
+	/**
+	 * EventGenerator
+	 * Superclass for objects that generate events - jsPlumb extends this, as does jsPlumbUIComponent, which all the UI elements extend.
+	 */
+	EventGenerator : function() {
+		var _listeners = {}, self = this;
+		
+		// this is a list of events that should re-throw any errors that occur during their dispatch. as of 1.3.0 this is private to
+		// jsPlumb, but it seems feasible that people might want to manipulate this list.  the thinking is that we don't want event
+		// listeners to bring down jsPlumb - or do we.  i can't make up my mind about this, but i know i want to hear about it if the "ready"
+		// event fails, because then my page has most likely not initialised.  so i have this halfway-house solution.  it will be interesting
+		// to hear what other people think.
+		var eventsToDieOn = [ "ready" ];
+							    
+		/*
+		 * Binds a listener to an event.  
+		 * 
+		 * Parameters:
+		 * 	event		-	name of the event to bind to.
+		 * 	listener	-	function to execute.
+		 */
+		this.bind = function(event, listener) {
+			jsPlumbUtil.addToList(_listeners, event, listener);		
+			return self;		
+		};
+		/*
+		 * Fires an update for the given event.
+		 * 
+		 * Parameters:
+		 * 	event				-	event to fire
+		 * 	value				-	value to pass to the event listener(s).
+		 *  originalEvent	 	- 	the original event from the browser
+		 */			
+		this.fire = function(event, value, originalEvent) {
+			if (_listeners[event]) {
+				for ( var i = 0; i < _listeners[event].length; i++) {
+					// doing it this way rather than catching and then possibly re-throwing means that an error propagated by this
+					// method will have the whole call stack available in the debugger.
+					if (jsPlumbUtil.findWithFunction(eventsToDieOn, function(e) { return e === event}) != -1)
+						_listeners[event][i](value, originalEvent);
+					else {
+						// for events we don't want to die on, catch and log.
+						try {
+							_listeners[event][i](value, originalEvent);
+						} catch (e) {
+							jsPlumbUtil.log("jsPlumb: fire failed for event " + event + " : " + e);
+						}
+					}
+				}
+			}
+			return self;
+		};
+		/*
+		 * Clears either all listeners, or listeners for some specific event.
+		 * 
+		 * Parameters:
+		 * 	event	-	optional. constrains the clear to just listeners for this event.
+		 */
+		this.unbind = function(event) {
+			if (event)
+				delete _listeners[event];
+			else {
+				_listeners = {};
+			}
+			return self;
+		};
+		
+		this.getListener = function(forEvent) {
+			return _listeners[forEvent];
+		};		
+	},
+	logEnabled : true,
+	log : function() {
+	    if (jsPlumbUtil.logEnabled && typeof console != "undefined") {
+            try {
+                var msg = arguments[arguments.length - 1];
+			    console.log(msg);
+            }
+            catch (e) {} 
+        }
+	},
+	group : function(g) { if (jsPlumbUtil.logEnabled && typeof console != "undefined") console.group(g); },
+	groupEnd : function(g) { if (jsPlumbUtil.logEnabled && typeof console != "undefined") console.groupEnd(g); },
+	time : function(t) { if (jsPlumbUtil.logEnabled && typeof console != "undefined") console.time(t); },
+	timeEnd : function(t) { if (jsPlumbUtil.logEnabled && typeof console != "undefined") console.timeEnd(t); }
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/lib/jquery-1.8.1-min.js	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,2 @@
+/*! jQuery v@1.8.1 jquery.com | jquery.org/license */
+(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(I,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:+d+""===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b==="data"&&p.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c==="object"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c==="input"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c==="option"?b.selected=a.defaultSelected:c==="input"||c==="textarea"?b.defaultValue=a.defaultValue:c==="script"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bY(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bW.length;while(e--){b=bW[e]+c;if(b in a)return b}return d}function bZ(a,b){return a=b||a,p.css(a,"display")==="none"||!p.contains(a.ownerDocument,a)}function b$(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,"olddisplay"),b?(!e[f]&&c.style.display==="none"&&(c.style.display=""),c.style.display===""&&bZ(c)&&(e[f]=p._data(c,"olddisplay",cc(c.nodeName)))):(d=bH(c,"display"),!e[f]&&d!=="none"&&p._data(c,"olddisplay",d))}for(f=0;f<g;f++){c=a[f];if(!c.style)continue;if(!b||c.style.display==="none"||c.style.display==="")c.style.display=b?e[f]||"":"none"}return a}function b_(a,b,c){var d=bP.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function ca(a,b,c,d){var e=c===(d?"border":"content")?4:b==="width"?1:0,f=0;for(;e<4;e+=2)c==="margin"&&(f+=p.css(a,c+bV[e],!0)),d?(c==="content"&&(f-=parseFloat(bH(a,"padding"+bV[e]))||0),c!=="margin"&&(f-=parseFloat(bH(a,"border"+bV[e]+"Width"))||0)):(f+=parseFloat(bH(a,"padding"+bV[e]))||0,c!=="padding"&&(f+=parseFloat(bH(a,"border"+bV[e]+"Width"))||0));return f}function cb(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=!0,f=p.support.boxSizing&&p.css(a,"boxSizing")==="border-box";if(d<=0||d==null){d=bH(a,b);if(d<0||d==null)d=a.style[b];if(bQ.test(d))return d;e=f&&(p.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+ca(a,b,c||(f?"border":"content"),e)+"px"}function cc(a){if(bS[a])return bS[a];var b=p("<"+a+">").appendTo(e.body),c=b.css("display");b.remove();if(c==="none"||c===""){bI=e.body.appendChild(bI||p.extend(e.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!bJ||!bI.createElement)bJ=(bI.contentWindow||bI.contentDocument).document,bJ.write("<!doctype html><html><body>"),bJ.close();b=bJ.body.appendChild(bJ.createElement(a)),c=bH(b,"display"),e.body.removeChild(bI)}return bS[a]=c,c}function ci(a,b,c,d){var e;if(p.isArray(b))p.each(b,function(b,e){c||ce.test(a)?d(a,e):ci(a+"["+(typeof e=="object"?b:"")+"]",e,c,d)});else if(!c&&p.type(b)==="object")for(e in b)ci(a+"["+e+"]",b[e],c,d);else d(a,b)}function cz(a){return function(b,c){typeof b!="string"&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(s),h=0,i=g.length;if(p.isFunction(c))for(;h<i;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function cA(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h,i=a[f],j=0,k=i?i.length:0,l=a===cv;for(;j<k&&(l||!h);j++)h=i[j](c,d,e),typeof h=="string"&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=cA(a,c,d,e,h,g)));return(l||!h)&&!g["*"]&&(h=cA(a,c,d,e,"*",g)),h}function cB(a,c){var d,e,f=p.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&p.extend(!0,a,e)}function cC(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);while(j[0]==="*")j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}if(g)return g!==j[0]&&j.unshift(g),d[g]}function cD(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;a.dataFilter&&(b=a.dataFilter(b,a.dataType));if(g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if(e!=="*"){if(h!=="*"&&h!==e){c=i[h+" "+e]||i["* "+e];if(!c)for(d in i){f=d.split(" ");if(f[1]===e){c=i[h+" "+f[0]]||i["* "+f[0]];if(c){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}}}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{state:"success",data:b}}function cL(){try{return new a.XMLHttpRequest}catch(b){}}function cM(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cU(){return setTimeout(function(){cN=b},0),cN=p.now()}function cV(a,b){p.each(b,function(b,c){var d=(cT[b]||[]).concat(cT["*"]),e=0,f=d.length;for(;e<f;e++)if(d[e].call(a,b,c))return})}function cW(a,b,c){var d,e=0,f=0,g=cS.length,h=p.Deferred().always(function(){delete i.elem}),i=function(){var b=cN||cU(),c=Math.max(0,j.startTime+j.duration-b),d=1-(c/j.duration||0),e=0,f=j.tweens.length;for(;e<f;e++)j.tweens[e].run(d);return h.notifyWith(a,[j,d,c]),d<1&&f?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:p.extend({},b),opts:p.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:cN||cU(),duration:c.duration,tweens:[],createTween:function(b,c,d){var e=p.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(e),e},stop:function(b){var c=0,d=b?j.tweens.length:0;for(;c<d;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;cX(k,j.opts.specialEasing);for(;e<g;e++){d=cS[e].call(j,a,k,j.opts);if(d)return d}return cV(j,k),p.isFunction(j.opts.start)&&j.opts.start.call(a,j),p.fx.timer(p.extend(i,{anim:j,queue:j.opts.queue,elem:a})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function cX(a,b){var c,d,e,f,g;for(c in a){d=p.camelCase(c),e=b[d],f=a[c],p.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=p.cssHooks[d];if(g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}}function cY(a,b,c){var d,e,f,g,h,i,j,k,l=this,m=a.style,n={},o=[],q=a.nodeType&&bZ(a);c.queue||(j=p._queueHooks(a,"fx"),j.unqueued==null&&(j.unqueued=0,k=j.empty.fire,j.empty.fire=function(){j.unqueued||k()}),j.unqueued++,l.always(function(){l.always(function(){j.unqueued--,p.queue(a,"fx").length||j.empty.fire()})})),a.nodeType===1&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],p.css(a,"display")==="inline"&&p.css(a,"float")==="none"&&(!p.support.inlineBlockNeedsLayout||cc(a.nodeName)==="inline"?m.display="inline-block":m.zoom=1)),c.overflow&&(m.overflow="hidden",p.support.shrinkWrapBlocks||l.done(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b){f=b[d];if(cP.exec(f)){delete b[d];if(f===(q?"hide":"show"))continue;o.push(d)}}g=o.length;if(g){h=p._data(a,"fxshow")||p._data(a,"fxshow",{}),q?p(a).show():l.done(function(){p(a).hide()}),l.done(function(){var b;p.removeData(a,"fxshow",!0);for(b in n)p.style(a,b,n[b])});for(d=0;d<g;d++)e=o[d],i=l.createTween(e,q?h[e]:0),n[e]=h[e]||p.style(a,e),e in h||(h[e]=i.start,q&&(i.end=i.start,i.start=e==="width"||e==="height"?1:0))}}function cZ(a,b,c,d,e){return new cZ.prototype.init(a,b,c,d,e)}function c$(a,b){var c,d={height:a},e=0;b=b?1:0;for(;e<4;e+=2-b)c=bV[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function da(a){return p.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var c,d,e=a.document,f=a.location,g=a.navigator,h=a.jQuery,i=a.$,j=Array.prototype.push,k=Array.prototype.slice,l=Array.prototype.indexOf,m=Object.prototype.toString,n=Object.prototype.hasOwnProperty,o=String.prototype.trim,p=function(a,b){return new p.fn.init(a,b,c)},q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,r=/\S/,s=/\s+/,t=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,u=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,y=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,z=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,A=/^-ms-/,B=/-([\da-z])/gi,C=function(a,b){return(b+"").toUpperCase()},D=function(){e.addEventListener?(e.removeEventListener("DOMContentLoaded",D,!1),p.ready()):e.readyState==="complete"&&(e.detachEvent("onreadystatechange",D),p.ready())},E={};p.fn=p.prototype={constructor:p,init:function(a,c,d){var f,g,h,i;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?f=[null,a,null]:f=u.exec(a);if(f&&(f[1]||!c)){if(f[1])return c=c instanceof p?c[0]:c,i=c&&c.nodeType?c.ownerDocument||c:e,a=p.parseHTML(f[1],i,!0),v.test(f[1])&&p.isPlainObject(c)&&this.attr.call(a,c,!0),p.merge(this,a);g=e.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return d.find(a);this.length=1,this[0]=g}return this.context=e,this.selector=a,this}return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a)}return p.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),p.makeArray(a,this))},selector:"",jquery:"1.8.1",length:0,size:function(){return this.length},toArray:function(){return k.call(this)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=p.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return p.each(this,a,b)},ready:function(a){return p.ready.promise().done(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(k.apply(this,arguments),"slice",k.call(arguments).join(","))},map:function(a){return this.pushStack(p.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:j,sort:[].sort,splice:[].splice},p.fn.init.prototype=p.fn,p.extend=p.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;typeof h=="boolean"&&(k=h,h=arguments[1]||{},i=2),typeof h!="object"&&!p.isFunction(h)&&(h={}),j===i&&(h=this,--i);for(;i<j;i++)if((a=arguments[i])!=null)for(c in a){d=h[c],e=a[c];if(h===e)continue;k&&e&&(p.isPlainObject(e)||(f=p.isArray(e)))?(f?(f=!1,g=d&&p.isArray(d)?d:[]):g=d&&p.isPlainObject(d)?d:{},h[c]=p.extend(k,g,e)):e!==b&&(h[c]=e)}return h},p.extend({noConflict:function(b){return a.$===p&&(a.$=i),b&&a.jQuery===p&&(a.jQuery=h),p},isReady:!1,readyWait:1,holdReady:function(a){a?p.readyWait++:p.ready(!0)},ready:function(a){if(a===!0?--p.readyWait:p.isReady)return;if(!e.body)return setTimeout(p.ready,1);p.isReady=!0;if(a!==!0&&--p.readyWait>0)return;d.resolveWith(e,[p]),p.fn.trigger&&p(e).trigger("ready").off("ready")},isFunction:function(a){return p.type(a)==="function"},isArray:Array.isArray||function(a){return p.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):E[m.call(a)]||"object"},isPlainObject:function(a){if(!a||p.type(a)!=="object"||a.nodeType||p.isWindow(a))return!1;try{if(a.constructor&&!n.call(a,"constructor")&&!n.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||n.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return!a||typeof a!="string"?null:(typeof b=="boolean"&&(c=b,b=0),b=b||e,(d=v.exec(a))?[b.createElement(d[1])]:(d=p.buildFragment([a],b,c?null:[]),p.merge([],(d.cacheable?p.clone(d.fragment):d.fragment).childNodes)))},parseJSON:function(b){if(!b||typeof b!="string")return null;b=p.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(w.test(b.replace(y,"@").replace(z,"]").replace(x,"")))return(new Function("return "+b))();p.error("Invalid JSON: "+b)},parseXML:function(c){var d,e;if(!c||typeof c!="string")return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&p.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&r.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(A,"ms-").replace(B,C)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||p.isFunction(a);if(d){if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;f<g;)if(c.apply(a[f++],d)===!1)break}else if(h){for(e in a)if(c.call(a[e],e,a[e])===!1)break}else for(;f<g;)if(c.call(a[f],f,a[f++])===!1)break;return a},trim:o&&!o.call(" ")?function(a){return a==null?"":o.call(a)}:function(a){return a==null?"":a.toString().replace(t,"")},makeArray:function(a,b){var c,d=b||[];return a!=null&&(c=p.type(a),a.length==null||c==="string"||c==="function"||c==="regexp"||p.isWindow(a)?j.call(d,a):p.merge(d,a)),d},inArray:function(a,b,c){var d;if(b){if(l)return l.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if(typeof d=="number")for(;f<d;f++)a[e++]=c[f];else while(c[f]!==b)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;c=!!c;for(;f<g;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,c,d){var e,f,g=[],h=0,i=a.length,j=a instanceof p||i!==b&&typeof i=="number"&&(i>0&&a[0]&&a[i-1]||i===0||p.isArray(a));if(j)for(;h<i;h++)e=c(a[h],h,d),e!=null&&(g[g.length]=e);else for(f in a)e=c(a[f],f,d),e!=null&&(g[g.length]=e);return g.concat.apply([],g)},guid:1,proxy:function(a,c){var d,e,f;return typeof c=="string"&&(d=a[c],c=a,a=d),p.isFunction(a)?(e=k.call(arguments,2),f=function(){return a.apply(c,e.concat(k.call(arguments)))},f.guid=a.guid=a.guid||f.guid||p.guid++,f):b},access:function(a,c,d,e,f,g,h){var i,j=d==null,k=0,l=a.length;if(d&&typeof d=="object"){for(k in d)p.access(a,c,k,d[k],1,g,e);f=1}else if(e!==b){i=h===b&&p.isFunction(e),j&&(i?(i=c,c=function(a,b,c){return i.call(p(a),c)}):(c.call(a,e),c=null));if(c)for(;k<l;k++)c(a[k],d,i?e.call(a[k],k,c(a[k],d)):e,h);f=1}return f?a:j?c.call(a):l?c(a[0],d):g},now:function(){return(new Date).getTime()}}),p.ready.promise=function(b){if(!d){d=p.Deferred();if(e.readyState==="complete")setTimeout(p.ready,1);else if(e.addEventListener)e.addEventListener("DOMContentLoaded",D,!1),a.addEventListener("load",p.ready,!1);else{e.attachEvent("onreadystatechange",D),a.attachEvent("onload",p.ready);var c=!1;try{c=a.frameElement==null&&e.documentElement}catch(f){}c&&c.doScroll&&function g(){if(!p.isReady){try{c.doScroll("left")}catch(a){return setTimeout(g,50)}p.ready()}}()}}return d.promise(b)},p.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){E["[object "+b+"]"]=b.toLowerCase()}),c=p(e);var F={};p.Callbacks=function(a){a=typeof a=="string"?F[a]||G(a):p.extend({},a);var c,d,e,f,g,h,i=[],j=!a.once&&[],k=function(b){c=a.memory&&b,d=!0,h=f||0,f=0,g=i.length,e=!0;for(;i&&h<g;h++)if(i[h].apply(b[0],b[1])===!1&&a.stopOnFalse){c=!1;break}e=!1,i&&(j?j.length&&k(j.shift()):c?i=[]:l.disable())},l={add:function(){if(i){var b=i.length;(function d(b){p.each(b,function(b,c){var e=p.type(c);e==="function"&&(!a.unique||!l.has(c))?i.push(c):c&&c.length&&e!=="string"&&d(c)})})(arguments),e?g=i.length:c&&(f=b,k(c))}return this},remove:function(){return i&&p.each(arguments,function(a,b){var c;while((c=p.inArray(b,i,c))>-1)i.splice(c,1),e&&(c<=g&&g--,c<=h&&h--)}),this},has:function(a){return p.inArray(a,i)>-1},empty:function(){return i=[],this},disable:function(){return i=j=c=b,this},disabled:function(){return!i},lock:function(){return j=b,c||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],i&&(!d||j)&&(e?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!d}};return l},p.extend({Deferred:function(a){var b=[["resolve","done",p.Callbacks("once memory"),"resolved"],["reject","fail",p.Callbacks("once memory"),"rejected"],["notify","progress",p.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return p.Deferred(function(c){p.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]](p.isFunction(g)?function(){var a=g.apply(this,arguments);a&&p.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return typeof a=="object"?p.extend(a,d):d}},e={};return d.pipe=d.then,p.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[a^1][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=k.call(arguments),d=c.length,e=d!==1||a&&p.isFunction(a.promise)?d:0,f=e===1?a:p.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?k.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1){h=new Array(d),i=new Array(d),j=new Array(d);for(;b<d;b++)c[b]&&p.isFunction(c[b].promise)?c[b].promise().done(g(b,j,c)).fail(f.reject).progress(g(b,i,h)):--e}return e||f.resolveWith(j,c),f.promise()}}),p.support=function(){var b,c,d,f,g,h,i,j,k,l,m,n=e.createElement("div");n.setAttribute("className","t"),n.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5";if(!c||!c.length||!d)return{};f=e.createElement("select"),g=f.appendChild(e.createElement("option")),h=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:n.className!=="t",enctype:!!e.createElement("form").enctype,html5Clone:e.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:e.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},h.checked=!0,b.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,b.optDisabled=!g.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",m=function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick"),n.detachEvent("onclick",m)),h=e.createElement("input"),h.value="t",h.setAttribute("type","radio"),b.radioValue=h.value==="t",h.setAttribute("checked","checked"),h.setAttribute("name","t"),n.appendChild(h),i=e.createDocumentFragment(),i.appendChild(n.lastChild),b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=h.checked,i.removeChild(h),i.appendChild(n);if(n.attachEvent)for(k in{submit:!0,change:!0,focusin:!0})j="on"+k,l=j in n,l||(n.setAttribute(j,"return;"),l=typeof n[j]=="function"),b[k+"Bubbles"]=l;return p(function(){var c,d,f,g,h="padding:0;margin:0;border:0;display:block;overflow:hidden;",i=e.getElementsByTagName("body")[0];if(!i)return;c=e.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",i.insertBefore(c,i.firstChild),d=e.createElement("div"),c.appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",f=d.getElementsByTagName("td"),f[0].style.cssText="padding:0;margin:0;border:0;display:none",l=f[0].offsetHeight===0,f[0].style.display="",f[1].style.display="none",b.reliableHiddenOffsets=l&&f[0].offsetHeight===0,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=d.offsetWidth===4,b.doesNotIncludeMarginInBodyOffset=i.offsetTop!==1,a.getComputedStyle&&(b.pixelPosition=(a.getComputedStyle(d,null)||{}).top!=="1%",b.boxSizingReliable=(a.getComputedStyle(d,null)||{width:"4px"}).width==="4px",g=e.createElement("div"),g.style.cssText=d.style.cssText=h,g.style.marginRight=g.style.width="0",d.style.width="1px",d.appendChild(g),b.reliableMarginRight=!parseFloat((a.getComputedStyle(g,null)||{}).marginRight)),typeof d.style.zoom!="undefined"&&(d.innerHTML="",d.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=d.offsetWidth===3,d.style.display="block",d.style.overflow="visible",d.innerHTML="<div></div>",d.firstChild.style.width="5px",b.shrinkWrapBlocks=d.offsetWidth!==3,c.style.zoom=1),i.removeChild(c),c=d=f=g=null}),i.removeChild(n),c=d=f=g=h=i=n=null,b}();var H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,I=/([A-Z])/g;p.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(p.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?p.cache[a[p.expando]]:a[p.expando],!!a&&!K(a)},data:function(a,c,d,e){if(!p.acceptData(a))return;var f,g,h=p.expando,i=typeof c=="string",j=a.nodeType,k=j?p.cache:a,l=j?a[h]:a[h]&&h;if((!l||!k[l]||!e&&!k[l].data)&&i&&d===b)return;l||(j?a[h]=l=p.deletedIds.pop()||++p.uuid:l=h),k[l]||(k[l]={},j||(k[l].toJSON=p.noop));if(typeof c=="object"||typeof c=="function")e?k[l]=p.extend(k[l],c):k[l].data=p.extend(k[l].data,c);return f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[p.camelCase(c)]=d),i?(g=f[c],g==null&&(g=f[p.camelCase(c)])):g=f,g},removeData:function(a,b,c){if(!p.acceptData(a))return;var d,e,f,g=a.nodeType,h=g?p.cache:a,i=g?a[p.expando]:p.expando;if(!h[i])return;if(b){d=c?h[i]:h[i].data;if(d){p.isArray(b)||(b in d?b=[b]:(b=p.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e<f;e++)delete d[b[e]];if(!(c?K:p.isEmptyObject)(d))return}}if(!c){delete h[i].data;if(!K(h[i]))return}g?p.cleanData([a],!0):p.support.deleteExpando||h!=h.window?delete h[i]:h[i]=null},_data:function(a,b,c){return p.data(a,b,c,!0)},acceptData:function(a){var b=a.nodeName&&p.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),p.fn.extend({data:function(a,c){var d,e,f,g,h,i=this[0],j=0,k=null;if(a===b){if(this.length){k=p.data(i);if(i.nodeType===1&&!p._data(i,"parsedAttrs")){f=i.attributes;for(h=f.length;j<h;j++)g=f[j].name,g.indexOf("data-")===0&&(g=p.camelCase(g.substring(5)),J(i,g,k[g]));p._data(i,"parsedAttrs",!0)}}return k}return typeof a=="object"?this.each(function(){p.data(this,a)}):(d=a.split(".",2),d[1]=d[1]?"."+d[1]:"",e=d[1]+"!",p.access(this,function(c){if(c===b)return k=this.triggerHandler("getData"+e,[d[0]]),k===b&&i&&(k=p.data(i,a),k=J(i,a,k)),k===b&&d[1]?this.data(d[0]):k;d[1]=c,this.each(function(){var b=p(this);b.triggerHandler("setData"+e,d),p.data(this,a,c),b.triggerHandler("changeData"+e,d)})},null,c,arguments.length>1,null,!1))},removeData:function(a){return this.each(function(){p.removeData(this,a)})}}),p.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=p._data(a,b),c&&(!d||p.isArray(c)?d=p._data(a,b,p.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=p.queue(a,b),d=c.length,e=c.shift(),f=p._queueHooks(a,b),g=function(){p.dequeue(a,b)};e==="inprogress"&&(e=c.shift(),d--),e&&(b==="fx"&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return p._data(a,c)||p._data(a,c,{empty:p.Callbacks("once memory").add(function(){p.removeData(a,b+"queue",!0),p.removeData(a,c,!0)})})}}),p.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length<d?p.queue(this[0],a):c===b?this:this.each(function(){var b=p.queue(this,a,c);p._queueHooks(this,a),a==="fx"&&b[0]!=="inprogress"&&p.dequeue(this,a)})},dequeue:function(a){return this.each(function(){p.dequeue(this,a)})},delay:function(a,b){return a=p.fx?p.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=p.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};typeof a!="string"&&(c=a,a=b),a=a||"fx";while(h--)d=p._data(g[h],a+"queueHooks"),d&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var L,M,N,O=/[\t\r\n]/g,P=/\r/g,Q=/^(?:button|input)$/i,R=/^(?:button|input|object|select|textarea)$/i,S=/^a(?:rea|)$/i,T=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,U=p.support.getSetAttribute;p.fn.extend({attr:function(a,b){return p.access(this,p.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){p.removeAttr(this,a)})},prop:function(a,b){return p.access(this,p.prop,a,b,arguments.length>1)},removeProp:function(a){return a=p.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(p.isFunction(a))return this.each(function(b){p(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(s);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{f=" "+e.className+" ";for(g=0,h=b.length;g<h;g++)~f.indexOf(" "+b[g]+" ")||(f+=b[g]+" ");e.className=p.trim(f)}}}return this},removeClass:function(a){var c,d,e,f,g,h,i;if(p.isFunction(a))return this.each(function(b){p(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(s);for(h=0,i=this.length;h<i;h++){e=this[h];if(e.nodeType===1&&e.className){d=(" "+e.className+" ").replace(O," ");for(f=0,g=c.length;f<g;f++)while(d.indexOf(" "+c[f]+" ")>-1)d=d.replace(" "+c[f]+" "," ");e.className=a?p.trim(d):""}}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";return p.isFunction(a)?this.each(function(c){p(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if(c==="string"){var e,f=0,g=p(this),h=b,i=a.split(s);while(e=i[f++])h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&p._data(this,"__className__",this.className),this.className=this.className||a===!1?"":p._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(O," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!arguments.length){if(f)return c=p.valHooks[f.type]||p.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(P,""):d==null?"":d);return}return e=p.isFunction(a),this.each(function(d){var f,g=p(this);if(this.nodeType!==1)return;e?f=a.call(this,d,g.val()):f=a,f==null?f="":typeof f=="number"?f+="":p.isArray(f)&&(f=p.map(f,function(a){return a==null?"":a+""})),c=p.valHooks[this.type]||p.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,f,"value")===b)this.value=f})}}),p.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c<d;c++){e=h[c];if(e.selected&&(p.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!p.nodeName(e.parentNode,"optgroup"))){b=p(e).val();if(i)return b;g.push(b)}}return i&&!g.length&&h.length?p(h[f]).val():g},set:function(a,b){var c=p.makeArray(b);return p(a).find("option").each(function(){this.selected=p.inArray(p(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return;if(e&&p.isFunction(p.fn[c]))return p(a)[c](d);if(typeof a.getAttribute=="undefined")return p.prop(a,c,d);h=i!==1||!p.isXMLDoc(a),h&&(c=c.toLowerCase(),g=p.attrHooks[c]||(T.test(c)?M:L));if(d!==b){if(d===null){p.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,""+d),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&a.nodeType===1){d=b.split(s);for(;g<d.length;g++)e=d[g],e&&(c=p.propFix[e]||e,f=T.test(e),f||p.attr(a,e,""),a.removeAttribute(U?e:c),f&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(Q.test(a.nodeName)&&a.parentNode)p.error("type property can't be changed");else if(!p.support.radioValue&&b==="radio"&&p.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}},value:{get:function(a,b){return L&&p.nodeName(a,"button")?L.get(a,b):b in a?a.value:null},set:function(a,b,c){if(L&&p.nodeName(a,"button"))return L.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(!a||h===3||h===8||h===2)return;return g=h!==1||!p.isXMLDoc(a),g&&(c=p.propFix[c]||c,f=p.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&(e=f.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):R.test(a.nodeName)||S.test(a.nodeName)&&a.href?0:b}}}}),M={get:function(a,c){var d,e=p.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;return b===!1?p.removeAttr(a,c):(d=p.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase())),c}},U||(N={name:!0,id:!0,coords:!0},L=p.valHooks.button={get:function(a,c){var d;return d=a.getAttributeNode(c),d&&(N[c]?d.value!=="":d.specified)?d.value:b},set:function(a,b,c){var d=a.getAttributeNode(c);return d||(d=e.createAttribute(c),a.setAttributeNode(d)),d.value=b+""}},p.each(["width","height"],function(a,b){p.attrHooks[b]=p.extend(p.attrHooks[b],{set:function(a,c){if(c==="")return a.setAttribute(b,"auto"),c}})}),p.attrHooks.contenteditable={get:L.get,set:function(a,b,c){b===""&&(b="false"),L.set(a,b,c)}}),p.support.hrefNormalized||p.each(["href","src","width","height"],function(a,c){p.attrHooks[c]=p.extend(p.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),p.support.style||(p.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),p.support.optSelected||(p.propHooks.selected=p.extend(p.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),p.support.enctype||(p.propFix.enctype="encoding"),p.support.checkOn||p.each(["radio","checkbox"],function(){p.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),p.each(["radio","checkbox"],function(){p.valHooks[this]=p.extend(p.valHooks[this],{set:function(a,b){if(p.isArray(b))return a.checked=p.inArray(p(a).val(),b)>=0}})});var V=/^(?:textarea|input|select)$/i,W=/^([^\.]*|)(?:\.(.+)|)$/,X=/(?:^|\s)hover(\.\S+|)\b/,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=function(a){return p.event.special.hover?a:a.replace(X,"mouseenter$1 mouseleave$1")};p.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,q,r;if(a.nodeType===3||a.nodeType===8||!c||!d||!(g=p._data(a)))return;d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=p.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof p!="undefined"&&(!a||p.event.triggered!==a.type)?p.event.dispatch.apply(h.elem,arguments):b},h.elem=a),c=p.trim(_(c)).split(" ");for(j=0;j<c.length;j++){k=W.exec(c[j])||[],l=k[1],m=(k[2]||"").split(".").sort(),r=p.event.special[l]||{},l=(f?r.delegateType:r.bindType)||l,r=p.event.special[l]||{},n=p.extend({type:l,origType:k[1],data:e,handler:d,guid:d.guid,selector:f,namespace:m.join(".")},o),q=i[l];if(!q){q=i[l]=[],q.delegateCount=0;if(!r.setup||r.setup.call(a,e,m,h)===!1)a.addEventListener?a.addEventListener(l,h,!1):a.attachEvent&&a.attachEvent("on"+l,h)}r.add&&(r.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,n):q.push(n),p.event.global[l]=!0}a=null},global:{},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,q,r=p.hasData(a)&&p._data(a);if(!r||!(m=r.events))return;b=p.trim(_(b||"")).split(" ");for(f=0;f<b.length;f++){g=W.exec(b[f])||[],h=i=g[1],j=g[2];if(!h){for(h in m)p.event.remove(a,h+b[f],c,d,!0);continue}n=p.event.special[h]||{},h=(d?n.delegateType:n.bindType)||h,o=m[h]||[],k=o.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(l=0;l<o.length;l++)q=o[l],(e||i===q.origType)&&(!c||c.guid===q.guid)&&(!j||j.test(q.namespace))&&(!d||d===q.selector||d==="**"&&q.selector)&&(o.splice(l--,1),q.selector&&o.delegateCount--,n.remove&&n.remove.call(a,q));o.length===0&&k!==o.length&&((!n.teardown||n.teardown.call(a,j,r.handle)===!1)&&p.removeEvent(a,h,r.handle),delete m[h])}p.isEmptyObject(m)&&(delete r.handle,p.removeData(a,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,f,g){if(!f||f.nodeType!==3&&f.nodeType!==8){var h,i,j,k,l,m,n,o,q,r,s=c.type||c,t=[];if($.test(s+p.event.triggered))return;s.indexOf("!")>=0&&(s=s.slice(0,-1),i=!0),s.indexOf(".")>=0&&(t=s.split("."),s=t.shift(),t.sort());if((!f||p.event.customEvent[s])&&!p.event.global[s])return;c=typeof c=="object"?c[p.expando]?c:new p.Event(s,c):new p.Event(s),c.type=s,c.isTrigger=!0,c.exclusive=i,c.namespace=t.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+t.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,m=s.indexOf(":")<0?"on"+s:"";if(!f){h=p.cache;for(j in h)h[j].events&&h[j].events[s]&&p.event.trigger(c,d,h[j].handle.elem,!0);return}c.result=b,c.target||(c.target=f),d=d!=null?p.makeArray(d):[],d.unshift(c),n=p.event.special[s]||{};if(n.trigger&&n.trigger.apply(f,d)===!1)return;q=[[f,n.bindType||s]];if(!g&&!n.noBubble&&!p.isWindow(f)){r=n.delegateType||s,k=$.test(r+s)?f:f.parentNode;for(l=f;k;k=k.parentNode)q.push([k,r]),l=k;l===(f.ownerDocument||e)&&q.push([l.defaultView||l.parentWindow||a,r])}for(j=0;j<q.length&&!c.isPropagationStopped();j++)k=q[j][0],c.type=q[j][1],o=(p._data(k,"events")||{})[c.type]&&p._data(k,"handle"),o&&o.apply(k,d),o=m&&k[m],o&&p.acceptData(k)&&o.apply(k,d)===!1&&c.preventDefault();return c.type=s,!g&&!c.isDefaultPrevented()&&(!n._default||n._default.apply(f.ownerDocument,d)===!1)&&(s!=="click"||!p.nodeName(f,"a"))&&p.acceptData(f)&&m&&f[s]&&(s!=="focus"&&s!=="blur"||c.target.offsetWidth!==0)&&!p.isWindow(f)&&(l=f[m],l&&(f[m]=null),p.event.triggered=s,f[s](),p.event.triggered=b,l&&(f[m]=l)),c.result}return},dispatch:function(c){c=p.event.fix(c||a.event);var d,e,f,g,h,i,j,k,l,m,n=(p._data(this,"events")||{})[c.type]||[],o=n.delegateCount,q=[].slice.call(arguments),r=!c.exclusive&&!c.namespace,s=p.event.special[c.type]||{},t=[];q[0]=c,c.delegateTarget=this;if(s.preDispatch&&s.preDispatch.call(this,c)===!1)return;if(o&&(!c.button||c.type!=="click"))for(f=c.target;f!=this;f=f.parentNode||this)if(f.disabled!==!0||c.type!=="click"){h={},j=[];for(d=0;d<o;d++)k=n[d],l=k.selector,h[l]===b&&(h[l]=p(l,this).index(f)>=0),h[l]&&j.push(k);j.length&&t.push({elem:f,matches:j})}n.length>o&&t.push({elem:this,matches:n.slice(o)});for(d=0;d<t.length&&!c.isPropagationStopped();d++){i=t[d],c.currentTarget=i.elem;for(e=0;e<i.matches.length&&!c.isImmediatePropagationStopped();e++){k=i.matches[e];if(r||!c.namespace&&!k.namespace||c.namespace_re&&c.namespace_re.test(k.namespace))c.data=k.data,c.handleObj=k,g=((p.event.special[k.origType]||{}).handle||k.handler).apply(i.elem,q),g!==b&&(c.result=g,g===!1&&(c.preventDefault(),c.stopPropagation()))}}return s.postDispatch&&s.postDispatch.call(this,c),c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,f,g,h=c.button,i=c.fromElement;return a.pageX==null&&c.clientX!=null&&(d=a.target.ownerDocument||e,f=d.documentElement,g=d.body,a.pageX=c.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=c.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?c.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0),a}},fix:function(a){if(a[p.expando])return a;var b,c,d=a,f=p.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=p.Event(d);for(b=g.length;b;)c=g[--b],a[c]=d[c];return a.target||(a.target=d.srcElement||e),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,f.filter?f.filter(a,d):a},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){p.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=p.extend(new p.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?p.event.trigger(e,null,b):p.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},p.event.handle=p.event.dispatch,p.removeEvent=e.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]=="undefined"&&(a[d]=null),a.detachEvent(d,c))},p.Event=function(a,b){if(this instanceof p.Event)a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?bb:ba):this.type=a,b&&p.extend(this,b),this.timeStamp=a&&a.timeStamp||p.now(),this[p.expando]=!0;else return new p.Event(a,b)},p.Event.prototype={preventDefault:function(){this.isDefaultPrevented=bb;var a=this.originalEvent;if(!a)return;a.preventDefault?a.preventDefault():a.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=bb;var a=this.originalEvent;if(!a)return;a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=bb,this.stopPropagation()},isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba},p.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){p.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj,g=f.selector;if(!e||e!==d&&!p.contains(d,e))a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b;return c}}}),p.support.submitBubbles||(p.event.special.submit={setup:function(){if(p.nodeName(this,"form"))return!1;p.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=p.nodeName(c,"input")||p.nodeName(c,"button")?c.form:b;d&&!p._data(d,"_submit_attached")&&(p.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),p._data(d,"_submit_attached",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&p.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(p.nodeName(this,"form"))return!1;p.event.remove(this,"._submit")}}),p.support.changeBubbles||(p.event.special.change={setup:function(){if(V.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")p.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),p.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),p.event.simulate("change",this,a,!0)});return!1}p.event.add(this,"beforeactivate._change",function(a){var b=a.target;V.test(b.nodeName)&&!p._data(b,"_change_attached")&&(p.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&p.event.simulate("change",this.parentNode,a,!0)}),p._data(b,"_change_attached",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){return p.event.remove(this,"._change"),!V.test(this.nodeName)}}),p.support.focusinBubbles||p.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){p.event.simulate(b,a.target,p.event.fix(a),!0)};p.event.special[b]={setup:function(){c++===0&&e.addEventListener(a,d,!0)},teardown:function(){--c===0&&e.removeEventListener(a,d,!0)}}}),p.fn.extend({on:function(a,c,d,e,f){var g,h;if(typeof a=="object"){typeof c!="string"&&(d=d||c,c=b);for(h in a)this.on(h,c,d,a[h],f);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=ba;else if(!e)return this;return f===1&&(g=e,e=function(a){return p().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=p.guid++)),this.each(function(){p.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,p(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if(typeof a=="object"){for(f in a)this.off(f,c,a[f]);return this}if(c===!1||typeof c=="function")d=c,c=b;return d===!1&&(d=ba),this.each(function(){p.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){return p(this.context).on(a,this.selector,b,c),this},die:function(a,b){return p(this.context).off(a,this.selector||"**",b),this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){p.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return p.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||p.guid++,d=0,e=function(c){var e=(p._data(this,"lastToggle"+a.guid)||0)%d;return p._data(this,"lastToggle"+a.guid,e+1),c.preventDefault(),b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),p.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){p.fn[b]=function(a,c){return c==null&&(c=a,a=null),arguments.length>0?this.on(b,null,a,c):this.trigger(b)},Y.test(b)&&(p.event.fixHooks[b]=p.event.keyHooks),Z.test(b)&&(p.event.fixHooks[b]=p.event.mouseHooks)}),function(a,b){function $(a,b,c,d){c=c||[],b=b||q;var e,f,g,j,k=b.nodeType;if(k!==1&&k!==9)return[];if(!a||typeof a!="string")return c;g=h(b);if(!g&&!d)if(e=L.exec(a))if(j=e[1]){if(k===9){f=b.getElementById(j);if(!f||!f.parentNode)return c;if(f.id===j)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(j))&&i(b,f)&&f.id===j)return c.push(f),c}else{if(e[2])return u.apply(c,t.call(b.getElementsByTagName(a),0)),c;if((j=e[3])&&X&&b.getElementsByClassName)return u.apply(c,t.call(b.getElementsByClassName(j),0)),c}return bk(a,b,c,d,g)}function _(a){return function(b){var c=b.nodeName.toLowerCase();return c==="input"&&b.type===a}}function ba(a){return function(b){var c=b.nodeName.toLowerCase();return(c==="input"||c==="button")&&b.type===a}}function bb(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}function bc(a,b,c,d){var e,g,h,i,j,k,l,m,n,p,r=!c&&b!==q,s=(r?"<s>":"")+a.replace(H,"$1<s>"),u=y[o][s];if(u)return d?0:t.call(u,0);j=a,k=[],m=0,n=f.preFilter,p=f.filter;while(j){if(!e||(g=I.exec(j)))g&&(j=j.slice(g[0].length),h.selector=l),k.push(h=[]),l="",r&&(j=" "+j);e=!1;if(g=J.exec(j))l+=g[0],j=j.slice(g[0].length),e=h.push({part:g.pop().replace(H," "),string:g[0],captures:g});for(i in p)(g=S[i].exec(j))&&(!n[i]||(g=n[i](g,b,c)))&&(l+=g[0],j=j.slice(g[0].length),e=h.push({part:i,string:g.shift(),captures:g}));if(!e)break}return l&&(h.selector=l),d?j.length:j?$.error(a):t.call(y(s,k),0)}function bd(a,b,e,f){var g=b.dir,h=s++;return a||(a=function(a){return a===e}),b.first?function(b){while(b=b[g])if(b.nodeType===1)return a(b)&&b}:f?function(b){while(b=b[g])if(b.nodeType===1&&a(b))return b}:function(b){var e,f=h+"."+c,i=f+"."+d;while(b=b[g])if(b.nodeType===1){if((e=b[o])===i)return b.sizset;if(typeof e=="string"&&e.indexOf(f)===0){if(b.sizset)return b}else{b[o]=i;if(a(b))return b.sizset=!0,b;b.sizset=!1}}}}function be(a,b){return a?function(c){var d=b(c);return d&&a(d===!0?c:d)}:b}function bf(a,b,c){var d,e,g=0;for(;d=a[g];g++)f.relative[d.part]?e=bd(e,f.relative[d.part],b,c):e=be(e,f.filter[d.part].apply(null,d.captures.concat(b,c)));return e}function bg(a){return function(b){var c,d=0;for(;c=a[d];d++)if(c(b))return!0;return!1}}function bh(a,b,c,d){var e=0,f=b.length;for(;e<f;e++)$(a,b[e],c,d)}function bi(a,b,c,d,e,g){var h,i=f.setFilters[b.toLowerCase()];return i||$.error(b),(a||!(h=e))&&bh(a||"*",d,h=[],e),h.length>0?i(h,c,g):[]}function bj(a,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s=0,t=a.length,v=S.POS,w=new RegExp("^"+v.source+"(?!"+A+")","i"),x=function(){var a=1,c=arguments.length-2;for(;a<c;a++)arguments[a]===b&&(n[a]=b)};for(;s<t;s++){f=a[s],g="",m=e;for(h=0,i=f.length;h<i;h++){j=f[h],k=j.string;if(j.part==="PSEUDO"){v.exec(""),l=0;while(n=v.exec(k)){o=!0,p=v.lastIndex=n.index+n[0].length;if(p>l){g+=k.slice(l,n.index),l=p,q=[c],J.test(g)&&(m&&(q=m),m=e);if(r=O.test(g))g=g.slice(0,-5).replace(J,"$&*"),l++;n.length>1&&n[0].replace(w,x),m=bi(g,n[1],n[2],q,m,r)}g=""}}o||(g+=k),o=!1}g?J.test(g)?bh(g,m||[c],d,e):$(g,c,d,e?e.concat(m):m):u.apply(d,m)}return t===1?d:$.uniqueSort(d)}function bk(a,b,e,g,h){a=a.replace(H,"$1");var i,k,l,m,n,o,p,q,r,s,v=bc(a,b,h),w=b.nodeType;if(S.POS.test(a))return bj(v,b,e,g);if(g)i=t.call(g,0);else if(v.length===1){if((o=t.call(v[0],0)).length>2&&(p=o[0]).part==="ID"&&w===9&&!h&&f.relative[o[1].part]){b=f.find.ID(p.captures[0].replace(R,""),b,h)[0];if(!b)return e;a=a.slice(o.shift().string.length)}r=(v=N.exec(o[0].string))&&!v.index&&b.parentNode||b,q="";for(n=o.length-1;n>=0;n--){p=o[n],s=p.part,q=p.string+q;if(f.relative[s])break;if(f.order.test(s)){i=f.find[s](p.captures[0].replace(R,""),r,h);if(i==null)continue;a=a.slice(0,a.length-q.length)+q.replace(S[s],""),a||u.apply(e,t.call(i,0));break}}}if(a){k=j(a,b,h),c=k.dirruns++,i==null&&(i=f.find.TAG("*",N.test(a)&&b.parentNode||b));for(n=0;m=i[n];n++)d=k.runs++,k(m)&&e.push(m)}return e}var c,d,e,f,g,h,i,j,k,l,m=!0,n="undefined",o=("sizcache"+Math.random()).replace(".",""),q=a.document,r=q.documentElement,s=0,t=[].slice,u=[].push,v=function(a,b){return a[o]=b||!0,a},w=function(){var a={},b=[];return v(function(c,d){return b.push(c)>f.cacheLength&&delete a[b.shift()],a[c]=d},a)},x=w(),y=w(),z=w(),A="[\\x20\\t\\r\\n\\f]",B="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",C=B.replace("w","w#"),D="([*^$|!~]?=)",E="\\["+A+"*("+B+")"+A+"*(?:"+D+A+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+C+")|)|)"+A+"*\\]",F=":("+B+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+E+")|[^:]|\\\\.)*|.*))\\)|)",G=":(nth|eq|gt|lt|first|last|even|odd)(?:\\(((?:-\\d)?\\d*)\\)|)(?=[^-]|$)",H=new RegExp("^"+A+"+|((?:^|[^\\\\])(?:\\\\.)*)"+A+"+$","g"),I=new RegExp("^"+A+"*,"+A+"*"),J=new RegExp("^"+A+"*([\\x20\\t\\r\\n\\f>+~])"+A+"*"),K=new RegExp(F),L=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,M=/^:not/,N=/[\x20\t\r\n\f]*[+~]/,O=/:not\($/,P=/h\d/i,Q=/input|select|textarea|button/i,R=/\\(?!\\)/g,S={ID:new RegExp("^#("+B+")"),CLASS:new RegExp("^\\.("+B+")"),NAME:new RegExp("^\\[name=['\"]?("+B+")['\"]?\\]"),TAG:new RegExp("^("+B.replace("w","w*")+")"),ATTR:new RegExp("^"+E),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+A+"*(even|odd|(([+-]|)(\\d*)n|)"+A+"*(?:([+-]|)"+A+"*(\\d+)|))"+A+"*\\)|)","i"),POS:new RegExp(G,"ig"),needsContext:new RegExp("^"+A+"*[>+~]|"+G,"i")},T=function(a){var b=q.createElement("div");try{return a(b)}catch(c){return!1}finally{b=null}},U=T(function(a){return a.appendChild(q.createComment("")),!a.getElementsByTagName("*").length}),V=T(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==n&&a.firstChild.getAttribute("href")==="#"}),W=T(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return b!=="boolean"&&b!=="string"}),X=T(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!a.getElementsByClassName||!a.getElementsByClassName("e").length?!1:(a.lastChild.className="e",a.getElementsByClassName("e").length===2)}),Y=T(function(a){a.id=o+0,a.innerHTML="<a name='"+o+"'></a><div name='"+o+"'></div>",r.insertBefore(a,r.firstChild);var b=q.getElementsByName&&q.getElementsByName(o).length===2+q.getElementsByName(o+0).length;return e=!q.getElementById(o),r.removeChild(a),b});try{t.call(r.childNodes,0)[0].nodeType}catch(Z){t=function(a){var b,c=[];for(;b=this[a];a++)c.push(b);return c}}$.matches=function(a,b){return $(a,null,null,b)},$.matchesSelector=function(a,b){return $(b,null,null,[a]).length>0},g=$.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(e===1||e===9||e===11){if(typeof a.textContent=="string")return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=g(a)}else if(e===3||e===4)return a.nodeValue}else for(;b=a[d];d++)c+=g(b);return c},h=$.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?b.nodeName!=="HTML":!1},i=$.contains=r.contains?function(a,b){var c=a.nodeType===9?a.documentElement:a,d=b&&b.parentNode;return a===d||!!(d&&d.nodeType===1&&c.contains&&c.contains(d))}:r.compareDocumentPosition?function(a,b){return b&&!!(a.compareDocumentPosition(b)&16)}:function(a,b){while(b=b.parentNode)if(b===a)return!0;return!1},$.attr=function(a,b){var c,d=h(a);return d||(b=b.toLowerCase()),f.attrHandle[b]?f.attrHandle[b](a):W||d?a.getAttribute(b):(c=a.getAttributeNode(b),c?typeof a[b]=="boolean"?a[b]?b:null:c.specified?c.value:null:null)},f=$.selectors={cacheLength:50,createPseudo:v,match:S,order:new RegExp("ID|TAG"+(Y?"|NAME":"")+(X?"|CLASS":"")),attrHandle:V?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},find:{ID:e?function(a,b,c){if(typeof b.getElementById!==n&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==n&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==n&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:U?function(a,b){if(typeof b.getElementsByTagName!==n)return b.getElementsByTagName(a)}:function(a,b){var c=b.getElementsByTagName(a);if(a==="*"){var d,e=[],f=0;for(;d=c[f];f++)d.nodeType===1&&e.push(d);return e}return c},NAME:function(a,b){if(typeof b.getElementsByName!==n)return b.getElementsByName(name)},CLASS:function(a,b,c){if(typeof b.getElementsByClassName!==n&&!c)return b.getElementsByClassName(a)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(R,""),a[3]=(a[4]||a[5]||"").replace(R,""),a[2]==="~="&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),a[1]==="nth"?(a[2]||$.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*(a[2]==="even"||a[2]==="odd")),a[4]=+(a[6]+a[7]||a[2]==="odd")):a[2]&&$.error(a[0]),a},PSEUDO:function(a,b,c){var d,e;if(S.CHILD.test(a[0]))return null;if(a[3])a[2]=a[3];else if(d=a[4])K.test(d)&&(e=bc(d,b,c,!0))&&(e=d.indexOf(")",d.length-e)-d.length)&&(d=d.slice(0,e),a[0]=a[0].slice(0,e)),a[2]=d;return a.slice(0,3)}},filter:{ID:e?function(a){return a=a.replace(R,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(R,""),function(b){var c=typeof b.getAttributeNode!==n&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return a==="*"?function(){return!0}:(a=a.replace(R,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=x[o][a];return b||(b=x(a,new RegExp("(^|"+A+")"+a+"("+A+"|$)"))),function(a){return b.test(a.className||typeof a.getAttribute!==n&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return b?function(d){var e=$.attr(d,a),f=e+"";if(e==null)return b==="!=";switch(b){case"=":return f===c;case"!=":return f!==c;case"^=":return c&&f.indexOf(c)===0;case"*=":return c&&f.indexOf(c)>-1;case"$=":return c&&f.substr(f.length-c.length)===c;case"~=":return(" "+f+" ").indexOf(c)>-1;case"|=":return f===c||f.substr(0,c.length+1)===c+"-"}}:function(b){return $.attr(b,a)!=null}},CHILD:function(a,b,c,d){if(a==="nth"){var e=s++;return function(a){var b,f,g=0,h=a;if(c===1&&d===0)return!0;b=a.parentNode;if(b&&(b[o]!==e||!a.sizset)){for(h=b.firstChild;h;h=h.nextSibling)if(h.nodeType===1){h.sizset=++g;if(h===a)break}b[o]=e}return f=a.sizset-d,c===0?f===0:f%c===0&&f/c>=0}}return function(b){var c=b;switch(a){case"only":case"first":while(c=c.previousSibling)if(c.nodeType===1)return!1;if(a==="first")return!0;c=b;case"last":while(c=c.nextSibling)if(c.nodeType===1)return!1;return!0}}},PSEUDO:function(a,b,c,d){var e,g=f.pseudos[a]||f.pseudos[a.toLowerCase()];return g||$.error("unsupported pseudo: "+a),g[o]?g(b,c,d):g.length>1?(e=[a,a,"",b],function(a){return g(a,0,e)}):g}},pseudos:{not:v(function(a,b,c){var d=j(a.replace(H,"$1"),b,c);return function(a){return!d(a)}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&!!a.checked||b==="option"&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!f.pseudos.empty(a)},empty:function(a){var b;a=a.firstChild;while(a){if(a.nodeName>"@"||(b=a.nodeType)===3||b===4)return!1;a=a.nextSibling}return!0},contains:v(function(a){return function(b){return(b.textContent||b.innerText||g(b)).indexOf(a)>-1}}),has:v(function(a){return function(b){return $(a,b).length>0}}),header:function(a){return P.test(a.nodeName)},text:function(a){var b,c;return a.nodeName.toLowerCase()==="input"&&(b=a.type)==="text"&&((c=a.getAttribute("type"))==null||c.toLowerCase()===b)},radio:_("radio"),checkbox:_("checkbox"),file:_("file"),password:_("password"),image:_("image"),submit:ba("submit"),reset:ba("reset"),button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&a.type==="button"||b==="button"},input:function(a){return Q.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&(!!a.type||!!a.href)},active:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b,c){return c?a.slice(1):[a[0]]},last:function(a,b,c){var d=a.pop();return c?a:[d]},even:function(a,b,c){var d=[],e=c?1:0,f=a.length;for(;e<f;e=e+2)d.push(a[e]);return d},odd:function(a,b,c){var d=[],e=c?0:1,f=a.length;for(;e<f;e=e+2)d.push(a[e]);return d},lt:function(a,b,c){return c?a.slice(+b):a.slice(0,+b)},gt:function(a,b,c){return c?a.slice(0,+b+1):a.slice(+b+1)},eq:function(a,b,c){var d=a.splice(+b,1);return c?a:d}}},k=r.compareDocumentPosition?function(a,b){return a===b?(l=!0,0):(!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition:a.compareDocumentPosition(b)&4)?-1:1}:function(a,b){if(a===b)return l=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,h=b.parentNode,i=g;if(g===h)return bb(a,b);if(!g)return-1;if(!h)return 1;while(i)e.unshift(i),i=i.parentNode;i=h;while(i)f.unshift(i),i=i.parentNode;c=e.length,d=f.length;for(var j=0;j<c&&j<d;j++)if(e[j]!==f[j])return bb(e[j],f[j]);return j===c?bb(a,f[j],-1):bb(e[j],b,1)},[0,0].sort(k),m=!l,$.uniqueSort=function(a){var b,c=1;l=m,a.sort(k);if(l)for(;b=a[c];c++)b===a[c-1]&&a.splice(c--,1);return a},$.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},j=$.compile=function(a,b,c){var d,e,f,g=z[o][a];if(g&&g.context===b)return g;d=bc(a,b,c);for(e=0,f=d.length;e<f;e++)d[e]=bf(d[e],b,c);return g=z(a,bg(d)),g.context=b,g.runs=g.dirruns=0,g},q.querySelectorAll&&function(){var a,b=bk,c=/'|\\/g,d=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,e=[],f=[":active"],g=r.matchesSelector||r.mozMatchesSelector||r.webkitMatchesSelector||r.oMatchesSelector||r.msMatchesSelector;T(function(a){a.innerHTML="<select><option selected=''></option></select>",a.querySelectorAll("[selected]").length||e.push("\\["+A+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),T(function(a){a.innerHTML="<p test=''></p>",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+A+"*(?:\"\"|'')"),a.innerHTML="<input type='hidden'/>",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=e.length&&new RegExp(e.join("|")),bk=function(a,d,f,g,h){if(!g&&!h&&(!e||!e.test(a)))if(d.nodeType===9)try{return u.apply(f,t.call(d.querySelectorAll(a),0)),f}catch(i){}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j,k,l,m=d.getAttribute("id"),n=m||o,p=N.test(a)&&d.parentNode||d;m?n=n.replace(c,"\\$&"):d.setAttribute("id",n),j=bc(a,d,h),n="[id='"+n+"']";for(k=0,l=j.length;k<l;k++)j[k]=n+j[k].selector;try{return u.apply(f,t.call(p.querySelectorAll(j.join(",")),0)),f}catch(i){}finally{m||d.removeAttribute("id")}}return b(a,d,f,g,h)},g&&(T(function(b){a=g.call(b,"div");try{g.call(b,"[test!='']:sizzle"),f.push(S.PSEUDO.source,S.POS.source,"!=")}catch(c){}}),f=new RegExp(f.join("|")),$.matchesSelector=function(b,c){c=c.replace(d,"='$1']");if(!h(b)&&!f.test(c)&&(!e||!e.test(c)))try{var i=g.call(b,c);if(i||a||b.document&&b.document.nodeType!==11)return i}catch(j){}return $(c,null,null,[b]).length>0})}(),f.setFilters.nth=f.setFilters.eq,f.filters=f.pseudos,$.attr=p.attr,p.find=$,p.expr=$.selectors,p.expr[":"]=p.expr.pseudos,p.unique=$.uniqueSort,p.text=$.getText,p.isXMLDoc=$.isXML,p.contains=$.contains}(a);var bc=/Until$/,bd=/^(?:parents|prev(?:Until|All))/,be=/^.[^:#\[\.,]*$/,bf=p.expr.match.needsContext,bg={children:!0,contents:!0,next:!0,prev:!0};p.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if(typeof a!="string")return p(a).filter(function(){for(b=0,c=h.length;b<c;b++)if(p.contains(h[b],this))return!0});g=this.pushStack("","find",a);for(b=0,c=this.length;b<c;b++){d=g.length,p.find(a,this[b],g);if(b>0)for(e=d;e<g.length;e++)for(f=0;f<d;f++)if(g[f]===g[e]){g.splice(e--,1);break}}return g},has:function(a){var b,c=p(a,this),d=c.length;return this.filter(function(){for(b=0;b<d;b++)if(p.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(bj(this,a,!1),"not",a)},filter:function(a){return this.pushStack(bj(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?bf.test(a)?p(a,this.context).index(this[0])>=0:p.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=bf.test(a)||typeof a!="string"?p(a,b||this.context):0;for(;d<e;d++){c=this[d];while(c&&c.ownerDocument&&c!==b&&c.nodeType!==11){if(g?g.index(c)>-1:p.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return f=f.length>1?p.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?typeof a=="string"?p.inArray(this[0],p(a)):p.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?p(a,b):p.makeArray(a&&a.nodeType?[a]:a),d=p.merge(this.get(),c);return this.pushStack(bh(c[0])||bh(d[0])?d:p.unique(d))},addBack:function(a){return this.add(a==null?this.prevObject:this.prevObject.filter(a))}}),p.fn.andSelf=p.fn.addBack,p.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return p.dir(a,"parentNode")},parentsUntil:function(a,b,c){return p.dir(a,"parentNode",c)},next:function(a){return bi(a,"nextSibling")},prev:function(a){return bi(a,"previousSibling")},nextAll:function(a){return p.dir(a,"nextSibling")},prevAll:function(a){return p.dir(a,"previousSibling")},nextUntil:function(a,b,c){return p.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return p.dir(a,"previousSibling",c)},siblings:function(a){return p.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return p.sibling(a.firstChild)},contents:function(a){return p.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:p.merge([],a.childNodes)}},function(a,b){p.fn[a]=function(c,d){var e=p.map(this,b,c);return bc.test(a)||(d=c),d&&typeof d=="string"&&(e=p.filter(d,e)),e=this.length>1&&!bg[a]?p.unique(e):e,this.length>1&&bd.test(a)&&(e=e.reverse()),this.pushStack(e,a,k.call(arguments).join(","))}}),p.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?p.find.matchesSelector(b[0],a)?[b[0]]:[]:p.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!p(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bl="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bm=/ jQuery\d+="(?:null|\d+)"/g,bn=/^\s+/,bo=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bp=/<([\w:]+)/,bq=/<tbody/i,br=/<|&#?\w+;/,bs=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,bu=new RegExp("<(?:"+bl+")[\\s/>]","i"),bv=/^(?:checkbox|radio)$/,bw=/checked\s*(?:[^=]|=\s*.checked.)/i,bx=/\/(java|ecma)script/i,by=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,bz={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bA=bk(e),bB=bA.appendChild(e.createElement("div"));bz.optgroup=bz.option,bz.tbody=bz.tfoot=bz.colgroup=bz.caption=bz.thead,bz.th=bz.td,p.support.htmlSerialize||(bz._default=[1,"X<div>","</div>"]),p.fn.extend({text:function(a){return p.access(this,function(a){return a===b?p.text(this):this.empty().append((this[0]&&this[0].ownerDocument||e).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(p.isFunction(a))return this.each(function(b){p(this).wrapAll(a.call(this,b))});if(this[0]){var b=p(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return p.isFunction(a)?this.each(function(b){p(this).wrapInner(a.call(this,b))}):this.each(function(){var b=p(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=p.isFunction(a);return this.each(function(c){p(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){p.nodeName(this,"body")||p(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(a,this),"before",this.selector)}},after:function(){if(!bh(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=p.clean(arguments);return this.pushStack(p.merge(this,a),"after",this.selector)}},remove:function(a,b){var c,d=0;for(;(c=this[d])!=null;d++)if(!a||p.filter(a,[c]).length)!b&&c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),p.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c);return this},empty:function(){var a,b=0;for(;(a=this[b])!=null;b++){a.nodeType===1&&p.cleanData(a.getElementsByTagName("*"));while(a.firstChild)a.removeChild(a.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return p.clone(this,a,b)})},html:function(a){return p.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bm,""):b;if(typeof a=="string"&&!bs.test(a)&&(p.support.htmlSerialize||!bu.test(a))&&(p.support.leadingWhitespace||!bn.test(a))&&!bz[(bp.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bo,"<$1></$2>");try{for(;d<e;d++)c=this[d]||{},c.nodeType===1&&(p.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return bh(this[0])?this.length?this.pushStack(p(p.isFunction(a)?a():a),"replaceWith",a):this:p.isFunction(a)?this.each(function(b){var c=p(this),d=c.html();c.replaceWith(a.call(this,b,d))}):(typeof a!="string"&&(a=p(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;p(this).remove(),b?p(b).before(a):p(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],l=this.length;if(!p.support.checkClone&&l>1&&typeof j=="string"&&bw.test(j))return this.each(function(){p(this).domManip(a,c,d)});if(p.isFunction(j))return this.each(function(e){var f=p(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){e=p.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,g.childNodes.length===1&&(g=f);if(f){c=c&&p.nodeName(f,"tr");for(h=e.cacheable||l-1;i<l;i++)d.call(c&&p.nodeName(this[i],"table")?bC(this[i],"tbody"):this[i],i===h?g:p.clone(g,!0,!0))}g=f=null,k.length&&p.each(k,function(a,b){b.src?p.ajax?p.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):p.error("no ajax"):p.globalEval((b.text||b.textContent||b.innerHTML||"").replace(by,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),p.buildFragment=function(a,c,d){var f,g,h,i=a[0];return c=c||e,c=!c.nodeType&&c[0]||c,c=c.ownerDocument||c,a.length===1&&typeof i=="string"&&i.length<512&&c===e&&i.charAt(0)==="<"&&!bt.test(i)&&(p.support.checkClone||!bw.test(i))&&(p.support.html5Clone||!bu.test(i))&&(g=!0,f=p.fragments[i],h=f!==b),f||(f=c.createDocumentFragment(),p.clean(a,c,f,d),g&&(p.fragments[i]=h&&f)),{fragment:f,cacheable:g}},p.fragments={},p.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){p.fn[a]=function(c){var d,e=0,f=[],g=p(c),h=g.length,i=this.length===1&&this[0].parentNode;if((i==null||i&&i.nodeType===11&&i.childNodes.length===1)&&h===1)return g[b](this[0]),this;for(;e<h;e++)d=(e>0?this.clone(!0):this).get(),p(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),p.extend({clone:function(a,b,c){var d,e,f,g;p.support.html5Clone||p.isXMLDoc(a)||!bu.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bB.innerHTML=a.outerHTML,bB.removeChild(g=bB.firstChild));if((!p.support.noCloneEvent||!p.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!p.isXMLDoc(a)){bE(a,g),d=bF(a),e=bF(g);for(f=0;d[f];++f)e[f]&&bE(d[f],e[f])}if(b){bD(a,g);if(c){d=bF(a),e=bF(g);for(f=0;d[f];++f)bD(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var f,g,h,i,j,k,l,m,n,o,q,r,s=b===e&&bA,t=[];if(!b||typeof b.createDocumentFragment=="undefined")b=e;for(f=0;(h=a[f])!=null;f++){typeof h=="number"&&(h+="");if(!h)continue;if(typeof h=="string")if(!br.test(h))h=b.createTextNode(h);else{s=s||bk(b),l=b.createElement("div"),s.appendChild(l),h=h.replace(bo,"<$1></$2>"),i=(bp.exec(h)||["",""])[1].toLowerCase(),j=bz[i]||bz._default,k=j[0],l.innerHTML=j[1]+h+j[2];while(k--)l=l.lastChild;if(!p.support.tbody){m=bq.test(h),n=i==="table"&&!m?l.firstChild&&l.firstChild.childNodes:j[1]==="<table>"&&!m?l.childNodes:[];for(g=n.length-1;g>=0;--g)p.nodeName(n[g],"tbody")&&!n[g].childNodes.length&&n[g].parentNode.removeChild(n[g])}!p.support.leadingWhitespace&&bn.test(h)&&l.insertBefore(b.createTextNode(bn.exec(h)[0]),l.firstChild),h=l.childNodes,l.parentNode.removeChild(l)}h.nodeType?t.push(h):p.merge(t,h)}l&&(h=l=s=null);if(!p.support.appendChecked)for(f=0;(h=t[f])!=null;f++)p.nodeName(h,"input")?bG(h):typeof h.getElementsByTagName!="undefined"&&p.grep(h.getElementsByTagName("input"),bG);if(c){q=function(a){if(!a.type||bx.test(a.type))return d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a)};for(f=0;(h=t[f])!=null;f++)if(!p.nodeName(h,"script")||!q(h))c.appendChild(h),typeof h.getElementsByTagName!="undefined"&&(r=p.grep(p.merge([],h.getElementsByTagName("script")),q),t.splice.apply(t,[f+1,0].concat(r)),f+=r.length)}return t},cleanData:function(a,b){var c,d,e,f,g=0,h=p.expando,i=p.cache,j=p.support.deleteExpando,k=p.event.special;for(;(e=a[g])!=null;g++)if(b||p.acceptData(e)){d=e[h],c=d&&i[d];if(c){if(c.events)for(f in c.events)k[f]?p.event.remove(e,f):p.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,p.deletedIds.push(d))}}}}),function(){var a,b;p.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=p.uaMatch(g.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.chrome?b.webkit=!0:b.webkit&&(b.safari=!0),p.browser=b,p.sub=function(){function a(b,c){return new a.fn.init(b,c)}p.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function c(c,d){return d&&d instanceof p&&!(d instanceof a)&&(d=a(d)),p.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(e);return a}}();var bH,bI,bJ,bK=/alpha\([^)]*\)/i,bL=/opacity=([^)]*)/,bM=/^(top|right|bottom|left)$/,bN=/^(none|table(?!-c[ea]).+)/,bO=/^margin/,bP=new RegExp("^("+q+")(.*)$","i"),bQ=new RegExp("^("+q+")(?!px)[a-z%]+$","i"),bR=new RegExp("^([-+])=("+q+")","i"),bS={},bT={position:"absolute",visibility:"hidden",display:"block"},bU={letterSpacing:0,fontWeight:400},bV=["Top","Right","Bottom","Left"],bW=["Webkit","O","Moz","ms"],bX=p.fn.toggle;p.fn.extend({css:function(a,c){return p.access(this,function(a,c,d){return d!==b?p.style(a,c,d):p.css(a,c)},a,c,arguments.length>1)},show:function(){return b$(this,!0)},hide:function(){return b$(this)},toggle:function(a,b){var c=typeof a=="boolean";return p.isFunction(a)&&p.isFunction(b)?bX.apply(this,arguments):this.each(function(){(c?a:bZ(this))?p(this).show():p(this).hide()})}}),p.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bH(a,"opacity");return c===""?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":p.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!a||a.nodeType===3||a.nodeType===8||!a.style)return;var f,g,h,i=p.camelCase(c),j=a.style;c=p.cssProps[i]||(p.cssProps[i]=bY(j,i)),h=p.cssHooks[c]||p.cssHooks[i];if(d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];g=typeof d,g==="string"&&(f=bR.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(p.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!p.cssNumber[i]&&(d+="px");if(!h||!("set"in h)||(d=h.set(a,d,e))!==b)try{j[c]=d}catch(k){}},css:function(a,c,d,e){var f,g,h,i=p.camelCase(c);return c=p.cssProps[i]||(p.cssProps[i]=bY(a.style,i)),h=p.cssHooks[c]||p.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=bH(a,c)),f==="normal"&&c in bU&&(f=bU[c]),d||e!==b?(g=parseFloat(f),d||p.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?bH=function(b,c){var d,e,f,g,h=a.getComputedStyle(b,null),i=b.style;return h&&(d=h[c],d===""&&!p.contains(b.ownerDocument,b)&&(d=p.style(b,c)),bQ.test(d)&&bO.test(c)&&(e=i.width,f=i.minWidth,g=i.maxWidth,i.minWidth=i.maxWidth=i.width=d,d=h.width,i.width=e,i.minWidth=f,i.maxWidth=g)),d}:e.documentElement.currentStyle&&(bH=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return e==null&&f&&f[b]&&(e=f[b]),bQ.test(e)&&!bM.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),e===""?"auto":e}),p.each(["height","width"],function(a,b){p.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth===0&&bN.test(bH(a,"display"))?p.swap(a,bT,function(){return cb(a,b,d)}):cb(a,b,d)},set:function(a,c,d){return b_(a,c,d?ca(a,b,d,p.support.boxSizing&&p.css(a,"boxSizing")==="border-box"):0)}}}),p.support.opacity||(p.cssHooks.opacity={get:function(a,b){return bL.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=p.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&p.trim(f.replace(bK,""))===""&&c.removeAttribute){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bK.test(f)?f.replace(bK,e):f+" "+e}}),p(function(){p.support.reliableMarginRight||(p.cssHooks.marginRight={get:function(a,b){return p.swap(a,{display:"inline-block"},function(){if(b)return bH(a,"marginRight")})}}),!p.support.pixelPosition&&p.fn.position&&p.each(["top","left"],function(a,b){p.cssHooks[b]={get:function(a,c){if(c){var d=bH(a,b);return bQ.test(d)?p(a).position()[b]+"px":d}}}})}),p.expr&&p.expr.filters&&(p.expr.filters.hidden=function(a){return a.offsetWidth===0&&a.offsetHeight===0||!p.support.reliableHiddenOffsets&&(a.style&&a.style.display||bH(a,"display"))==="none"},p.expr.filters.visible=function(a){return!p.expr.filters.hidden(a)}),p.each({margin:"",padding:"",border:"Width"},function(a,b){p.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bV[d]+b]=e[d]||e[d-2]||e[0];return f}},bO.test(a)||(p.cssHooks[a+b].set=b_)});var cd=/%20/g,ce=/\[\]$/,cf=/\r?\n/g,cg=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ch=/^(?:select|textarea)/i;p.fn.extend({serialize:function(){return p.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?p.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ch.test(this.nodeName)||cg.test(this.type))}).map(function(a,b){var c=p(this).val();return c==null?null:p.isArray(c)?p.map(c,function(a,c){return{name:b.name,value:a.replace(cf,"\r\n")}}):{name:b.name,value:c.replace(cf,"\r\n")}}).get()}}),p.param=function(a,c){var d,e=[],f=function(a,b){b=p.isFunction(b)?b():b==null?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=p.ajaxSettings&&p.ajaxSettings.traditional);if(p.isArray(a)||a.jquery&&!p.isPlainObject(a))p.each(a,function(){f(this.name,this.value)});else for(d in a)ci(d,a[d],c,f);return e.join("&").replace(cd,"+")};var cj,ck,cl=/#.*$/,cm=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,cn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,co=/^(?:GET|HEAD)$/,cp=/^\/\//,cq=/\?/,cr=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,cs=/([?&])_=[^&]*/,ct=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,cu=p.fn.load,cv={},cw={},cx=["*/"]+["*"];try{cj=f.href}catch(cy){cj=e.createElement("a"),cj.href="",cj=cj.href}ck=ct.exec(cj.toLowerCase())||[],p.fn.load=function(a,c,d){if(typeof a!="string"&&cu)return cu.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),p.isFunction(c)?(d=c,c=b):c&&typeof c=="object"&&(f="POST"),p.ajax({url:a,type:f,dataType:"html",data:c,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments,h.html(e?p("<div>").append(a.replace(cr,"")).find(e):a)}),this},p.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){p.fn[b]=function(a){return this.on(b,a)}}),p.each(["get","post"],function(a,c){p[c]=function(a,d,e,f){return p.isFunction(d)&&(f=f||e,e=d,d=b),p.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),p.extend({getScript:function(a,c){return p.get(a,b,c,"script")},getJSON:function(a,b,c){return p.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?cB(a,p.ajaxSettings):(b=a,a=p.ajaxSettings),cB(a,b),a},ajaxSettings:{url:cj,isLocal:cn.test(ck[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":cx},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":p.parseJSON,"text xml":p.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:cz(cv),ajaxTransport:cz(cw),ajax:function(a,c){function y(a,c,f,i){var k,s,t,u,w,y=c;if(v===2)return;v=2,h&&clearTimeout(h),g=b,e=i||"",x.readyState=a>0?4:0,f&&(u=cC(l,x,f));if(a>=200&&a<300||a===304)l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(p.lastModified[d]=w),w=x.getResponseHeader("Etag"),w&&(p.etag[d]=w)),a===304?(y="notmodified",k=!0):(k=cD(l,u),y=k.state,s=k.data,t=k.error,k=!t);else{t=y;if(!y||a)y="error",a<0&&(a=0)}x.status=a,x.statusText=""+(c||y),k?o.resolveWith(m,[s,y,x]):o.rejectWith(m,[x,y,t]),x.statusCode(r),r=b,j&&n.trigger("ajax"+(k?"Success":"Error"),[x,l,k?s:t]),q.fireWith(m,[x,y]),j&&(n.trigger("ajaxComplete",[x,l]),--p.active||p.event.trigger("ajaxStop"))}typeof a=="object"&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=p.ajaxSetup({},c),m=l.context||l,n=m!==l&&(m.nodeType||m instanceof p)?p(m):p.event,o=p.Deferred(),q=p.Callbacks("once memory"),r=l.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=u[c]=u[c]||a,t[a]=b}return this},getAllResponseHeaders:function(){return v===2?e:null},getResponseHeader:function(a){var c;if(v===2){if(!f){f={};while(c=cm.exec(e))f[c[1].toLowerCase()]=c[2]}c=f[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(l.mimeType=a),this},abort:function(a){return a=a||w,g&&g.abort(a),y(0,a),this}};o.promise(x),x.success=x.done,x.error=x.fail,x.complete=q.add,x.statusCode=function(a){if(a){var b;if(v<2)for(b in a)r[b]=[r[b],a[b]];else b=a[x.status],x.always(b)}return this},l.url=((a||l.url)+"").replace(cl,"").replace(cp,ck[1]+"//"),l.dataTypes=p.trim(l.dataType||"*").toLowerCase().split(s),l.crossDomain==null&&(i=ct.exec(l.url.toLowerCase()),l.crossDomain=!(!i||i[1]==ck[1]&&i[2]==ck[2]&&(i[3]||(i[1]==="http:"?80:443))==(ck[3]||(ck[1]==="http:"?80:443)))),l.data&&l.processData&&typeof l.data!="string"&&(l.data=p.param(l.data,l.traditional)),cA(cv,l,c,x);if(v===2)return x;j=l.global,l.type=l.type.toUpperCase(),l.hasContent=!co.test(l.type),j&&p.active++===0&&p.event.trigger("ajaxStart");if(!l.hasContent){l.data&&(l.url+=(cq.test(l.url)?"&":"?")+l.data,delete l.data),d=l.url;if(l.cache===!1){var z=p.now(),A=l.url.replace(cs,"$1_="+z);l.url=A+(A===l.url?(cq.test(l.url)?"&":"?")+"_="+z:"")}}(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),l.ifModified&&(d=d||l.url,p.lastModified[d]&&x.setRequestHeader("If-Modified-Since",p.lastModified[d]),p.etag[d]&&x.setRequestHeader("If-None-Match",p.etag[d])),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+cx+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)x.setRequestHeader(k,l.headers[k]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&v!==2){w="abort";for(k in{success:1,error:1,complete:1})x[k](l[k]);g=cA(cw,l,c,x);if(!g)y(-1,"No Transport");else{x.readyState=1,j&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{v=1,g.send(t,y)}catch(B){if(v<2)y(-1,B);else throw B}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var cE=[],cF=/\?/,cG=/(=)\?(?=&|$)|\?\?/,cH=p.now();p.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=cE.pop()||p.expando+"_"+cH++;return this[a]=!0,a}}),p.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.data,j=c.url,k=c.jsonp!==!1,l=k&&cG.test(j),m=k&&!l&&typeof i=="string"&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&cG.test(i);if(c.dataTypes[0]==="jsonp"||l||m)return f=c.jsonpCallback=p.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,g=a[f],l?c.url=j.replace(cG,"$1"+f):m?c.data=i.replace(cG,"$1"+f):k&&(c.url+=(cF.test(j)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||p.error(f+" was not called"),h[0]},c.dataTypes[0]="json",a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,cE.push(f)),h&&p.isFunction(g)&&g(h[0]),h=g=b}),"script"}),p.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return p.globalEval(a),a}}}),p.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),p.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=e.head||e.getElementsByTagName("head")[0]||e.documentElement;return{send:function(f,g){c=e.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||g(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cI,cJ=a.ActiveXObject?function(){for(var a in cI)cI[a](0,1)}:!1,cK=0;p.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cL()||cM()}:cL,function(a){p.extend(p.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(p.ajaxSettings.xhr()),p.support.ajax&&p.ajaxTransport(function(c){if(!c.crossDomain||p.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async);if(c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l,m;try{if(d&&(e||i.readyState===4)){d=b,g&&(i.onreadystatechange=p.noop,cJ&&delete cI[g]);if(e)i.readyState!==4&&i.abort();else{h=i.status,k=i.getAllResponseHeaders(),l={},m=i.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=i.responseText}catch(a){}try{j=i.statusText}catch(n){j=""}!h&&c.isLocal&&!c.crossDomain?h=l.text?200:404:h===1223&&(h=204)}}}catch(o){e||f(-1,o)}l&&f(h,j,l,k)},c.async?i.readyState===4?setTimeout(d,0):(g=++cK,cJ&&(cI||(cI={},p(a).unload(cJ)),cI[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(0,1)}}}});var cN,cO,cP=/^(?:toggle|show|hide)$/,cQ=new RegExp("^(?:([-+])=|)("+q+")([a-z%]*)$","i"),cR=/queueHooks$/,cS=[cY],cT={"*":[function(a,b){var c,d,e,f=this.createTween(a,b),g=cQ.exec(b),h=f.cur(),i=+h||0,j=1;if(g){c=+g[2],d=g[3]||(p.cssNumber[a]?"":"px");if(d!=="px"&&i){i=p.css(f.elem,a,!0)||c||1;do e=j=j||".5",i=i/j,p.style(f.elem,a,i+d),j=f.cur()/h;while(j!==1&&j!==e)}f.unit=d,f.start=i,f.end=g[1]?i+(g[1]+1)*c:c}return f}]};p.Animation=p.extend(cW,{tweener:function(a,b){p.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;d<e;d++)c=a[d],cT[c]=cT[c]||[],cT[c].unshift(b)},prefilter:function(a,b){b?cS.unshift(a):cS.push(a)}}),p.Tween=cZ,cZ.prototype={constructor:cZ,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(p.cssNumber[c]?"":"px")},cur:function(){var a=cZ.propHooks[this.prop];return a&&a.get?a.get(this):cZ.propHooks._default.get(this)},run:function(a){var b,c=cZ.propHooks[this.prop];return this.options.duration?this.pos=b=p.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):cZ.propHooks._default.set(this),this}},cZ.prototype.init.prototype=cZ.prototype,cZ.propHooks={_default:{get:function(a){var b;return a.elem[a.prop]==null||!!a.elem.style&&a.elem.style[a.prop]!=null?(b=p.css(a.elem,a.prop,!1,""),!b||b==="auto"?0:b):a.elem[a.prop]},set:function(a){p.fx.step[a.prop]?p.fx.step[a.prop](a):a.elem.style&&(a.elem.style[p.cssProps[a.prop]]!=null||p.cssHooks[a.prop])?p.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},cZ.propHooks.scrollTop=cZ.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},p.each(["toggle","show","hide"],function(a,b){var c=p.fn[b];p.fn[b]=function(d,e,f){return d==null||typeof d=="boolean"||!a&&p.isFunction(d)&&p.isFunction(e)?c.apply(this,arguments):this.animate(c$(b,!0),d,e,f)}}),p.fn.extend({fadeTo:function(a,b,c,d){return this.filter(bZ).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=p.isEmptyObject(a),f=p.speed(b,c,d),g=function(){var b=cW(this,p.extend({},a),f);e&&b.stop(!0)};return e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=a!=null&&a+"queueHooks",f=p.timers,g=p._data(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&cR.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem===this&&(a==null||f[c].queue===a)&&(f[c].anim.stop(d),b=!1,f.splice(c,1));(b||!d)&&p.dequeue(this,a)})}}),p.each({slideDown:c$("show"),slideUp:c$("hide"),slideToggle:c$("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){p.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),p.speed=function(a,b,c){var d=a&&typeof a=="object"?p.extend({},a):{complete:c||!c&&b||p.isFunction(a)&&a,duration:a,easing:c&&b||b&&!p.isFunction(b)&&b};d.duration=p.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in p.fx.speeds?p.fx.speeds[d.duration]:p.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";return d.old=d.complete,d.complete=function(){p.isFunction(d.old)&&d.old.call(this),d.queue&&p.dequeue(this,d.queue)},d},p.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},p.timers=[],p.fx=cZ.prototype.init,p.fx.tick=function(){var a,b=p.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||p.fx.stop()},p.fx.timer=function(a){a()&&p.timers.push(a)&&!cO&&(cO=setInterval(p.fx.tick,p.fx.interval))},p.fx.interval=13,p.fx.stop=function(){clearInterval(cO),cO=null},p.fx.speeds={slow:600,fast:200,_default:400},p.fx.step={},p.expr&&p.expr.filters&&(p.expr.filters.animated=function(a){return p.grep(p.timers,function(b){return a===b.elem}).length});var c_=/^(?:body|html)$/i;p.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){p.offset.setOffset(this,a,b)});var c,d,e,f,g,h,i,j,k,l,m=this[0],n=m&&m.ownerDocument;if(!n)return;return(e=n.body)===m?p.offset.bodyOffset(m):(d=n.documentElement,p.contains(d,m)?(c=m.getBoundingClientRect(),f=da(n),g=d.clientTop||e.clientTop||0,h=d.clientLeft||e.clientLeft||0,i=f.pageYOffset||d.scrollTop,j=f.pageXOffset||d.scrollLeft,k=c.top+i-g,l=c.left+j-h,{top:k,left:l}):{top:0,left:0})},p.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;return p.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(p.css(a,"marginTop"))||0,c+=parseFloat(p.css(a,"marginLeft"))||0),{top:b,left:c}},setOffset:function(a,b,c){var d=p.css(a,"position");d==="static"&&(a.style.position="relative");var e=p(a),f=e.offset(),g=p.css(a,"top"),h=p.css(a,"left"),i=(d==="absolute"||d==="fixed")&&p.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),p.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},p.fn.extend({position:function(){if(!this[0])return;var a=this[0],b=this.offsetParent(),c=this.offset(),d=c_.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(p.css(a,"marginTop"))||0,c.left-=parseFloat(p.css(a,"marginLeft"))||0,d.top+=parseFloat(p.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(p.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||e.body;while(a&&!c_.test(a.nodeName)&&p.css(a,"position")==="static")a=a.offsetParent;return a||e.body})}}),p.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);p.fn[a]=function(e){return p.access(this,function(a,e,f){var g=da(a);if(f===b)return g?c in g?g[c]:g.document.documentElement[e]:a[e];g?g.scrollTo(d?p(g).scrollLeft():f,d?f:p(g).scrollTop()):a[e]=f},a,e,arguments.length,null)}}),p.each({Height:"height",Width:"width"},function(a,c){p.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){p.fn[e]=function(e,f){var g=arguments.length&&(d||typeof e!="boolean"),h=d||(e===!0||f===!0?"margin":"border");return p.access(this,function(c,d,e){var f;return p.isWindow(c)?c.document.documentElement["client"+a]:c.nodeType===9?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?p.css(c,d,e,h):p.style(c,d,e,h)},c,g?e:b,g,null)}})}),a.jQuery=a.$=p,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return p})})(window);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/lib/jquery-ui-1.8.23-min.js	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,5 @@
+/*! jQuery UI - v1.8.23 - 2012-08-15
+* https://github.com/jquery/jquery-ui
+* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js, jquery.effects.blind.js, jquery.effects.bounce.js, jquery.effects.clip.js, jquery.effects.drop.js, jquery.effects.explode.js, jquery.effects.fade.js, jquery.effects.fold.js, jquery.effects.highlight.js, jquery.effects.pulsate.js, jquery.effects.scale.js, jquery.effects.shake.js, jquery.effects.slide.js, jquery.effects.transfer.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.tabs.js
+* Copyright (c) 2012 AUTHORS.txt; Licensed MIT, GPL */
+(function(a,b){function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;return!b.href||!g||f.nodeName.toLowerCase()!=="map"?!1:(h=a("img[usemap=#"+g+"]")[0],!!h&&d(h))}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.ui=a.ui||{};if(a.ui.version)return;a.extend(a.ui,{version:"1.8.23",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;return a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0),/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a("<a>").outerWidth(1).jquery||a.each(["Width","Height"],function(c,d){function h(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)}),c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){return c===b?g["inner"+d].call(this):this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){return typeof b!="number"?g["outer"+d].call(this,b):this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:a.expr.createPseudo?a.expr.createPseudo(function(b){return function(c){return!!a.data(c,b)}}):function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));c.offsetHeight,a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.curCSS||(a.curCSS=a.css),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!d||!a.element[0].parentNode)return;for(var e=0;e<d.length;e++)a.options[d[e][0]]&&d[e][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if(a(b).css("overflow")==="hidden")return!1;var d=c&&c==="left"?"scrollLeft":"scrollTop",e=!1;return b[d]>0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,d,e,f,g){return a.ui.isOverAxis(b,d,f)&&a.ui.isOverAxis(c,e,g)}})})(jQuery),function(a,b){if(a.cleanData){var c=a.cleanData;a.cleanData=function(b){for(var d=0,e;(e=b[d])!=null;d++)try{a(e).triggerHandler("remove")}catch(f){}c(b)}}else{var d=a.fn.remove;a.fn.remove=function(b,c){return this.each(function(){return c||(!b||a.filter(b,[this]).length)&&a("*",this).add([this]).each(function(){try{a(this).triggerHandler("remove")}catch(b){}}),d.call(a(this),b,c)})}}a.widget=function(b,c,d){var e=b.split(".")[0],f;b=b.split(".")[1],f=e+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][f]=function(c){return!!a.data(c,b)},a[e]=a[e]||{},a[e][b]=function(a,b){arguments.length&&this._createWidget(a,b)};var g=new c;g.options=a.extend(!0,{},g.options),a[e][b].prototype=a.extend(!0,g,{namespace:e,widgetName:b,widgetEventPrefix:a[e][b].prototype.widgetEventPrefix||b,widgetBaseClass:f},d),a.widget.bridge(b,a[e][b])},a.widget.bridge=function(c,d){a.fn[c]=function(e){var f=typeof e=="string",g=Array.prototype.slice.call(arguments,1),h=this;return e=!f&&g.length?a.extend.apply(null,[!0,e].concat(g)):e,f&&e.charAt(0)==="_"?h:(f?this.each(function(){var d=a.data(this,c),f=d&&a.isFunction(d[e])?d[e].apply(d,g):d;if(f!==d&&f!==b)return h=f,!1}):this.each(function(){var b=a.data(this,c);b?b.option(e||{})._init():a.data(this,c,new d(e,this))}),h)}},a.Widget=function(a,b){arguments.length&&this._createWidget(a,b)},a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(b,c){a.data(c,this.widgetName,this),this.element=a(c),this.options=a.extend(!0,{},this.options,this._getCreateOptions(),b);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return a.metadata&&a.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled")},widget:function(){return this.element},option:function(c,d){var e=c;if(arguments.length===0)return a.extend({},this.options);if(typeof c=="string"){if(d===b)return this.options[c];e={},e[c]=d}return this._setOptions(e),this},_setOptions:function(b){var c=this;return a.each(b,function(a,b){c._setOption(a,b)}),this},_setOption:function(a,b){return this.options[a]=b,a==="disabled"&&this.widget()[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",b),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(b,c,d){var e,f,g=this.options[b];d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent;if(f)for(e in f)e in c||(c[e]=f[e]);return this.element.trigger(c,d),!(a.isFunction(g)&&g.call(this.element[0],c,d)===!1||c.isDefaultPrevented())}}}(jQuery),function(a,b){var c=!1;a(document).mouseup(function(a){c=!1}),a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(a){return b._mouseDown(a)}).bind("click."+this.widgetName,function(c){if(!0===a.data(c.target,b.widgetName+".preventClickEvent"))return a.removeData(c.target,b.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(b){if(c)return;this._mouseStarted&&this._mouseUp(b),this._mouseDownEvent=b;var d=this,e=b.which==1,f=typeof this.options.cancel=="string"&&b.target.nodeName?a(b.target).closest(this.options.cancel).length:!1;if(!e||f||!this._mouseCapture(b))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){d.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=this._mouseStart(b)!==!1;if(!this._mouseStarted)return b.preventDefault(),!0}return!0===a.data(b.target,this.widgetName+".preventClickEvent")&&a.removeData(b.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(a){return d._mouseMove(a)},this._mouseUpDelegate=function(a){return d._mouseUp(a)},a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),b.preventDefault(),c=!0,!0},_mouseMove:function(b){return!a.browser.msie||document.documentMode>=9||!!b.button?this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted):this._mouseUp(b)},_mouseUp:function(b){return a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target==this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(a){return this.mouseDelayMet},_mouseStart:function(a){},_mouseDrag:function(a){},_mouseStop:function(a){},_mouseCapture:function(a){return!0}})}(jQuery),function(a,b){a.widget("ui.draggable",a.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},destroy:function(){if(!this.element.data("draggable"))return;return this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options;return this.helper||c.disabled||a(b.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(b),this.handle?(c.iframeFix&&a(c.iframeFix===!0?"iframe":c.iframeFix).each(function(){a('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(a(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(b){var c=this.options;return this.helper=this._createHelper(b),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),c.containment&&this._setContainment(),this._trigger("start",b)===!1?(this._clear(),!1):(this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b),!0)},_mouseDrag:function(b,c){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute");if(!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1)return this._mouseUp({}),!1;this.position=d.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),!1},_mouseStop:function(b){var c=!1;a.ui.ddmanager&&!this.options.dropBehaviour&&(c=a.ui.ddmanager.drop(this,b)),this.dropped&&(c=this.dropped,this.dropped=!1);var d=this.element[0],e=!1;while(d&&(d=d.parentNode))d==document&&(e=!0);if(!e&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!c||this.options.revert=="valid"&&c||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,c)){var f=this;a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){f._trigger("stop",b)!==!1&&f._clear()})}else this._trigger("stop",b)!==!1&&this._clear();return!1},_mouseUp:function(b){return this.options.iframeFix===!0&&a("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b),a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(b){var c=!this.options.handle||!a(this.options.handle,this.element).length?!0:!1;return a(this.options.handle,this.element).find("*").andSelf().each(function(){this==b.target&&(c=!0)}),c},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b])):c.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return d.parents("body").length||d.appendTo(c.appendTo=="parent"?this.element[0].parentNode:c.appendTo),d[0]!=this.element[0]&&!/(fixed|absolute)/.test(d.css("position"))&&d.css("position","absolute"),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[b.containment=="document"?0:a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,b.containment=="document"?0:a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(b.containment=="document"?0:a(window).scrollLeft())+a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(b.containment=="document"?0:a(window).scrollTop())+(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)&&b.containment.constructor!=Array){var c=a(b.containment),d=c[0];if(!d)return;var e=c.offset(),f=a(d).css("overflow")!="hidden";this.containment=[(parseInt(a(d).css("borderLeftWidth"),10)||0)+(parseInt(a(d).css("paddingLeft"),10)||0),(parseInt(a(d).css("borderTopWidth"),10)||0)+(parseInt(a(d).css("paddingTop"),10)||0),(f?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(a(d).css("borderLeftWidth"),10)||0)-(parseInt(a(d).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(f?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(a(d).css("borderTopWidth"),10)||0)-(parseInt(a(d).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=c}else b.containment.constructor==Array&&(this.containment=b.containment)},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName),f=b.pageX,g=b.pageY;if(this.originalPosition){var h;if(this.containment){if(this.relative_container){var i=this.relative_container.offset();h=[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]}else h=this.containment;b.pageX-this.offset.click.left<h[0]&&(f=h[0]+this.offset.click.left),b.pageY-this.offset.click.top<h[1]&&(g=h[1]+this.offset.click.top),b.pageX-this.offset.click.left>h[2]&&(f=h[2]+this.offset.click.left),b.pageY-this.offset.click.top>h[3]&&(g=h[3]+this.offset.click.top)}if(c.grid){var j=c.grid[1]?this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1]:this.originalPageY;g=h?j-this.offset.click.top<h[1]||j-this.offset.click.top>h[3]?j-this.offset.click.top<h[1]?j+c.grid[1]:j-c.grid[1]:j:j;var k=c.grid[0]?this.originalPageX+Math.round((f-this.originalPageX)/c.grid[0])*c.grid[0]:this.originalPageX;f=h?k-this.offset.click.left<h[0]||k-this.offset.click.left>h[2]?k-this.offset.click.left<h[0]?k+c.grid[0]:k-c.grid[0]:k:k}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:d.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&a.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(b,c,d){return d=d||this._uiHash(),a.ui.plugin.call(this,b,[c,d]),b=="drag"&&(this.positionAbs=this._convertPositionTo("absolute")),a.Widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(a){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),a.extend(a.ui.draggable,{version:"1.8.23"}),a.ui.plugin.add("draggable","connectToSortable",{start:function(b,c){var d=a(this).data("draggable"),e=d.options,f=a.extend({},c,{item:d.element});d.sortables=[],a(e.connectToSortable).each(function(){var c=a.data(this,"sortable");c&&!c.options.disabled&&(d.sortables.push({instance:c,shouldRevert:c.options.revert}),c.refreshPositions(),c._trigger("activate",b,f))})},stop:function(b,c){var d=a(this).data("draggable"),e=a.extend({},c,{item:d.element});a.each(d.sortables,function(){this.instance.isOver?(this.instance.isOver=0,d.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(b),this.instance.options.helper=this.instance.options._helper,d.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",b,e))})},drag:function(b,c){var d=a(this).data("draggable"),e=this,f=function(b){var c=this.offset.click.top,d=this.offset.click.left,e=this.positionAbs.top,f=this.positionAbs.left,g=b.height,h=b.width,i=b.top,j=b.left;return a.ui.isOver(e+c,f+d,i,j,g,h)};a.each(d.sortables,function(f){this.instance.positionAbs=d.positionAbs,this.instance.helperProportions=d.helperProportions,this.instance.offset.click=d.offset.click,this.instance._intersectsWith(this.instance.containerCache)?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=a(e).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return c.helper[0]},b.target=this.instance.currentItem[0],this.instance._mouseCapture(b,!0),this.instance._mouseStart(b,!0,!0),this.instance.offset.click.top=d.offset.click.top,this.instance.offset.click.left=d.offset.click.left,this.instance.offset.parent.left-=d.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=d.offset.parent.top-this.instance.offset.parent.top,d._trigger("toSortable",b),d.dropped=this.instance.element,d.currentItem=d.element,this.instance.fromOutside=d),this.instance.currentItem&&this.instance._mouseDrag(b)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",b,this.instance._uiHash(this.instance)),this.instance._mouseStop(b,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),d._trigger("fromSortable",b),d.dropped=!1)})}}),a.ui.plugin.add("draggable","cursor",{start:function(b,c){var d=a("body"),e=a(this).data("draggable").options;d.css("cursor")&&(e._cursor=d.css("cursor")),d.css("cursor",e.cursor)},stop:function(b,c){var d=a(this).data("draggable").options;d._cursor&&a("body").css("cursor",d._cursor)}}),a.ui.plugin.add("draggable","opacity",{start:function(b,c){var d=a(c.helper),e=a(this).data("draggable").options;d.css("opacity")&&(e._opacity=d.css("opacity")),d.css("opacity",e.opacity)},stop:function(b,c){var d=a(this).data("draggable").options;d._opacity&&a(c.helper).css("opacity",d._opacity)}}),a.ui.plugin.add("draggable","scroll",{start:function(b,c){var d=a(this).data("draggable");d.scrollParent[0]!=document&&d.scrollParent[0].tagName!="HTML"&&(d.overflowOffset=d.scrollParent.offset())},drag:function(b,c){var d=a(this).data("draggable"),e=d.options,f=!1;if(d.scrollParent[0]!=document&&d.scrollParent[0].tagName!="HTML"){if(!e.axis||e.axis!="x")d.overflowOffset.top+d.scrollParent[0].offsetHeight-b.pageY<e.scrollSensitivity?d.scrollParent[0].scrollTop=f=d.scrollParent[0].scrollTop+e.scrollSpeed:b.pageY-d.overflowOffset.top<e.scrollSensitivity&&(d.scrollParent[0].scrollTop=f=d.scrollParent[0].scrollTop-e.scrollSpeed);if(!e.axis||e.axis!="y")d.overflowOffset.left+d.scrollParent[0].offsetWidth-b.pageX<e.scrollSensitivity?d.scrollParent[0].scrollLeft=f=d.scrollParent[0].scrollLeft+e.scrollSpeed:b.pageX-d.overflowOffset.left<e.scrollSensitivity&&(d.scrollParent[0].scrollLeft=f=d.scrollParent[0].scrollLeft-e.scrollSpeed)}else{if(!e.axis||e.axis!="x")b.pageY-a(document).scrollTop()<e.scrollSensitivity?f=a(document).scrollTop(a(document).scrollTop()-e.scrollSpeed):a(window).height()-(b.pageY-a(document).scrollTop())<e.scrollSensitivity&&(f=a(document).scrollTop(a(document).scrollTop()+e.scrollSpeed));if(!e.axis||e.axis!="y")b.pageX-a(document).scrollLeft()<e.scrollSensitivity?f=a(document).scrollLeft(a(document).scrollLeft()-e.scrollSpeed):a(window).width()-(b.pageX-a(document).scrollLeft())<e.scrollSensitivity&&(f=a(document).scrollLeft(a(document).scrollLeft()+e.scrollSpeed))}f!==!1&&a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(d,b)}}),a.ui.plugin.add("draggable","snap",{start:function(b,c){var d=a(this).data("draggable"),e=d.options;d.snapElements=[],a(e.snap.constructor!=String?e.snap.items||":data(draggable)":e.snap).each(function(){var b=a(this),c=b.offset();this!=d.element[0]&&d.snapElements.push({item:this,width:b.outerWidth(),height:b.outerHeight(),top:c.top,left:c.left})})},drag:function(b,c){var d=a(this).data("draggable"),e=d.options,f=e.snapTolerance,g=c.offset.left,h=g+d.helperProportions.width,i=c.offset.top,j=i+d.helperProportions.height;for(var k=d.snapElements.length-1;k>=0;k--){var l=d.snapElements[k].left,m=l+d.snapElements[k].width,n=d.snapElements[k].top,o=n+d.snapElements[k].height;if(!(l-f<g&&g<m+f&&n-f<i&&i<o+f||l-f<g&&g<m+f&&n-f<j&&j<o+f||l-f<h&&h<m+f&&n-f<i&&i<o+f||l-f<h&&h<m+f&&n-f<j&&j<o+f)){d.snapElements[k].snapping&&d.options.snap.release&&d.options.snap.release.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[k].item})),d.snapElements[k].snapping=!1;continue}if(e.snapMode!="inner"){var p=Math.abs(n-j)<=f,q=Math.abs(o-i)<=f,r=Math.abs(l-h)<=f,s=Math.abs(m-g)<=f;p&&(c.position.top=d._convertPositionTo("relative",{top:n-d.helperProportions.height,left:0}).top-d.margins.top),q&&(c.position.top=d._convertPositionTo("relative",{top:o,left:0}).top-d.margins.top),r&&(c.position.left=d._convertPositionTo("relative",{top:0,left:l-d.helperProportions.width}).left-d.margins.left),s&&(c.position.left=d._convertPositionTo("relative",{top:0,left:m}).left-d.margins.left)}var t=p||q||r||s;if(e.snapMode!="outer"){var p=Math.abs(n-i)<=f,q=Math.abs(o-j)<=f,r=Math.abs(l-g)<=f,s=Math.abs(m-h)<=f;p&&(c.position.top=d._convertPositionTo("relative",{top:n,left:0}).top-d.margins.top),q&&(c.position.top=d._convertPositionTo("relative",{top:o-d.helperProportions.height,left:0}).top-d.margins.top),r&&(c.position.left=d._convertPositionTo("relative",{top:0,left:l}).left-d.margins.left),s&&(c.position.left=d._convertPositionTo("relative",{top:0,left:m-d.helperProportions.width}).left-d.margins.left)}!d.snapElements[k].snapping&&(p||q||r||s||t)&&d.options.snap.snap&&d.options.snap.snap.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[k].item})),d.snapElements[k].snapping=p||q||r||s||t}}}),a.ui.plugin.add("draggable","stack",{start:function(b,c){var d=a(this).data("draggable").options,e=a.makeArray(a(d.stack)).sort(function(b,c){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(c).css("zIndex"),10)||0)});if(!e.length)return;var f=parseInt(e[0].style.zIndex)||0;a(e).each(function(a){this.style.zIndex=f+a}),this[0].style.zIndex=f+e.length}}),a.ui.plugin.add("draggable","zIndex",{start:function(b,c){var d=a(c.helper),e=a(this).data("draggable").options;d.css("zIndex")&&(e._zIndex=d.css("zIndex")),d.css("zIndex",e.zIndex)},stop:function(b,c){var d=a(this).data("draggable").options;d._zIndex&&a(c.helper).css("zIndex",d._zIndex)}})}(jQuery),function(a,b){a.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var b=this.options,c=b.accept;this.isover=0,this.isout=1,this.accept=a.isFunction(c)?c:function(a){return a.is(c)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},a.ui.ddmanager.droppables[b.scope]=a.ui.ddmanager.droppables[b.scope]||[],a.ui.ddmanager.droppables[b.scope].push(this),b.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){var b=a.ui.ddmanager.droppables[this.options.scope];for(var c=0;c<b.length;c++)b[c]==this&&b.splice(c,1);return this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable"),this},_setOption:function(b,c){b=="accept"&&(this.accept=a.isFunction(c)?c:function(a){return a.is(c)}),a.Widget.prototype._setOption.apply(this,arguments)},_activate:function(b){var c=a.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),c&&this._trigger("activate",b,this.ui(c))},_deactivate:function(b){var c=a.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),c&&this._trigger("deactivate",b,this.ui(c))},_over:function(b){var c=a.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return;this.accept.call(this.element[0],c.currentItem||c.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",b,this.ui(c)))},_out:function(b){var c=a.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return;this.accept.call(this.element[0],c.currentItem||c.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",b,this.ui(c)))},_drop:function(b,c){var d=c||a.ui.ddmanager.current;if(!d||(d.currentItem||d.element)[0]==this.element[0])return!1;var e=!1;return this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var b=a.data(this,"droppable");if(b.options.greedy&&!b.options.disabled&&b.options.scope==d.options.scope&&b.accept.call(b.element[0],d.currentItem||d.element)&&a.ui.intersect(d,a.extend(b,{offset:b.element.offset()}),b.options.tolerance))return e=!0,!1}),e?!1:this.accept.call(this.element[0],d.currentItem||d.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",b,this.ui(d)),this.element):!1},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}}),a.extend(a.ui.droppable,{version:"1.8.23"}),a.ui.intersect=function(b,c,d){if(!c.offset)return!1;var e=(b.positionAbs||b.position.absolute).left,f=e+b.helperProportions.width,g=(b.positionAbs||b.position.absolute).top,h=g+b.helperProportions.height,i=c.offset.left,j=i+c.proportions.width,k=c.offset.top,l=k+c.proportions.height;switch(d){case"fit":return i<=e&&f<=j&&k<=g&&h<=l;case"intersect":return i<e+b.helperProportions.width/2&&f-b.helperProportions.width/2<j&&k<g+b.helperProportions.height/2&&h-b.helperProportions.height/2<l;case"pointer":var m=(b.positionAbs||b.position.absolute).left+(b.clickOffset||b.offset.click).left,n=(b.positionAbs||b.position.absolute).top+(b.clickOffset||b.offset.click).top,o=a.ui.isOver(n,m,k,i,c.proportions.height,c.proportions.width);return o;case"touch":return(g>=k&&g<=l||h>=k&&h<=l||g<k&&h>l)&&(e>=i&&e<=j||f>=i&&f<=j||e<i&&f>j);default:return!1}},a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(b,c){var d=a.ui.ddmanager.droppables[b.options.scope]||[],e=c?c.type:null,f=(b.currentItem||b.element).find(":data(droppable)").andSelf();g:for(var h=0;h<d.length;h++){if(d[h].options.disabled||b&&!d[h].accept.call(d[h].element[0],b.currentItem||b.element))continue;for(var i=0;i<f.length;i++)if(f[i]==d[h].element[0]){d[h].proportions.height=0;continue g}d[h].visible=d[h].element.css("display")!="none";if(!d[h].visible)continue;e=="mousedown"&&d[h]._activate.call(d[h],c),d[h].offset=d[h].element.offset(),d[h].proportions={width:d[h].element[0].offsetWidth,height:d[h].element[0].offsetHeight}}},drop:function(b,c){var d=!1;return a.each(a.ui.ddmanager.droppables[b.options.scope]||[],function(){if(!this.options)return;!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance)&&(d=this._drop.call(this,c)||d),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],b.currentItem||b.element)&&(this.isout=1,this.isover=0,this._deactivate.call(this,c))}),d},dragStart:function(b,c){b.element.parents(":not(body,html)").bind("scroll.droppable",function(){b.options.refreshPositions||a.ui.ddmanager.prepareOffsets(b,c)})},drag:function(b,c){b.options.refreshPositions&&a.ui.ddmanager.prepareOffsets(b,c),a.each(a.ui.ddmanager.droppables[b.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible)return;var d=a.ui.intersect(b,this,this.options.tolerance),e=!d&&this.isover==1?"isout":d&&this.isover==0?"isover":null;if(!e)return;var f;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");g.length&&(f=a.data(g[0],"droppable"),f.greedyChild=e=="isover"?1:0)}f&&e=="isover"&&(f.isover=0,f.isout=1,f._out.call(f,c)),this[e]=1,this[e=="isout"?"isover":"isout"]=0,this[e=="isover"?"_over":"_out"].call(this,c),f&&e=="isout"&&(f.isout=0,f.isover=1,f._over.call(f,c))})},dragStop:function(b,c){b.element.parents(":not(body,html)").unbind("scroll.droppable"),b.options.refreshPositions||a.ui.ddmanager.prepareOffsets(b,c)}}}(jQuery),function(a,b){a.widget("ui.resizable",a.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1e3},_create:function(){var b=this,c=this.options;this.element.addClass("ui-resizable"),a.extend(this,{_aspectRatio:!!c.aspectRatio,aspectRatio:c.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:c.helper||c.ghost||c.animate?c.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(a('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("resizable",this.element.data("resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=c.handles||(a(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se");if(this.handles.constructor==String){this.handles=="all"&&(this.handles="n,e,s,w,se,sw,ne,nw");var d=this.handles.split(",");this.handles={};for(var e=0;e<d.length;e++){var f=a.trim(d[e]),g="ui-resizable-"+f,h=a('<div class="ui-resizable-handle '+g+'"></div>');h.css({zIndex:c.zIndex}),"se"==f&&h.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[f]=".ui-resizable-"+f,this.element.append(h)}}this._renderAxis=function(b){b=b||this.element;for(var c in this.handles){this.handles[c].constructor==String&&(this.handles[c]=a(this.handles[c],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var d=a(this.handles[c],this.element),e=0;e=/sw|ne|nw|se|n|s/.test(c)?d.outerHeight():d.outerWidth();var f=["padding",/ne|nw|n/.test(c)?"Top":/se|sw|s/.test(c)?"Bottom":/^e$/.test(c)?"Right":"Left"].join("");b.css(f,e),this._proportionallyResize()}if(!a(this.handles[c]).length)continue}},this._renderAxis(this.element),this._handles=a(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){if(!b.resizing){if(this.className)var a=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=a&&a[1]?a[1]:"se"}}),c.autoHide&&(this._handles.hide(),a(this.element).addClass("ui-resizable-autohide").hover(function(){if(c.disabled)return;a(this).removeClass("ui-resizable-autohide"),b._handles.show()},function(){if(c.disabled)return;b.resizing||(a(this).addClass("ui-resizable-autohide"),b._handles.hide())})),this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(b){a(b).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var c=this.element;c.after(this.originalElement.css({position:c.css("position"),width:c.outerWidth(),height:c.outerHeight(),top:c.css("top"),left:c.css("left")})).remove()}return this.originalElement.css("resize",this.originalResizeStyle),b(this.originalElement),this},_mouseCapture:function(b){var c=!1;for(var d in this.handles)a(this.handles[d])[0]==b.target&&(c=!0);return!this.options.disabled&&c},_mouseStart:function(b){var d=this.options,e=this.element.position(),f=this.element;this.resizing=!0,this.documentScroll={top:a(document).scrollTop(),left:a(document).scrollLeft()},(f.is(".ui-draggable")||/absolute/.test(f.css("position")))&&f.css({position:"absolute",top:e.top,left:e.left}),this._renderProxy();var g=c(this.helper.css("left")),h=c(this.helper.css("top"));d.containment&&(g+=a(d.containment).scrollLeft()||0,h+=a(d.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:g,top:h},this.size=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalSize=this._helper?{width:f.outerWidth(),height:f.outerHeight()}:{width:f.width(),height:f.height()},this.originalPosition={left:g,top:h},this.sizeDiff={width:f.outerWidth()-f.width(),height:f.outerHeight()-f.height()},this.originalMousePosition={left:b.pageX,top:b.pageY},this.aspectRatio=typeof d.aspectRatio=="number"?d.aspectRatio:this.originalSize.width/this.originalSize.height||1;var i=a(".ui-resizable-"+this.axis).css("cursor");return a("body").css("cursor",i=="auto"?this.axis+"-resize":i),f.addClass("ui-resizable-resizing"),this._propagate("start",b),!0},_mouseDrag:function(b){var c=this.helper,d=this.options,e={},f=this,g=this.originalMousePosition,h=this.axis,i=b.pageX-g.left||0,j=b.pageY-g.top||0,k=this._change[h];if(!k)return!1;var l=k.apply(this,[b,i,j]),m=a.browser.msie&&a.browser.version<7,n=this.sizeDiff;this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)l=this._updateRatio(l,b);return l=this._respectSize(l,b),this._propagate("resize",b),c.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"}),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),this._updateCache(l),this._trigger("resize",b,this.ui()),!1},_mouseStop:function(b){this.resizing=!1;var c=this.options,d=this;if(this._helper){var e=this._proportionallyResizeElements,f=e.length&&/textarea/i.test(e[0].nodeName),g=f&&a.ui.hasScroll(e[0],"left")?0:d.sizeDiff.height,h=f?0:d.sizeDiff.width,i={width:d.helper.width()-h,height:d.helper.height()-g},j=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,k=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;c.animate||this.element.css(a.extend(i,{top:k,left:j})),d.helper.height(d.size.height),d.helper.width(d.size.width),this._helper&&!c.animate&&this._proportionallyResize()}return a("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",b),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(a){var b=this.options,c,e,f,g,h;h={minWidth:d(b.minWidth)?b.minWidth:0,maxWidth:d(b.maxWidth)?b.maxWidth:Infinity,minHeight:d(b.minHeight)?b.minHeight:0,maxHeight:d(b.maxHeight)?b.maxHeight:Infinity};if(this._aspectRatio||a)c=h.minHeight*this.aspectRatio,f=h.minWidth/this.aspectRatio,e=h.maxHeight*this.aspectRatio,g=h.maxWidth/this.aspectRatio,c>h.minWidth&&(h.minWidth=c),f>h.minHeight&&(h.minHeight=f),e<h.maxWidth&&(h.maxWidth=e),g<h.maxHeight&&(h.maxHeight=g);this._vBoundaries=h},_updateCache:function(a){var b=this.options;this.offset=this.helper.offset(),d(a.left)&&(this.position.left=a.left),d(a.top)&&(this.position.top=a.top),d(a.height)&&(this.size.height=a.height),d(a.width)&&(this.size.width=a.width)},_updateRatio:function(a,b){var c=this.options,e=this.position,f=this.size,g=this.axis;return d(a.height)?a.width=a.height*this.aspectRatio:d(a.width)&&(a.height=a.width/this.aspectRatio),g=="sw"&&(a.left=e.left+(f.width-a.width),a.top=null),g=="nw"&&(a.top=e.top+(f.height-a.height),a.left=e.left+(f.width-a.width)),a},_respectSize:function(a,b){var c=this.helper,e=this._vBoundaries,f=this._aspectRatio||b.shiftKey,g=this.axis,h=d(a.width)&&e.maxWidth&&e.maxWidth<a.width,i=d(a.height)&&e.maxHeight&&e.maxHeight<a.height,j=d(a.width)&&e.minWidth&&e.minWidth>a.width,k=d(a.height)&&e.minHeight&&e.minHeight>a.height;j&&(a.width=e.minWidth),k&&(a.height=e.minHeight),h&&(a.width=e.maxWidth),i&&(a.height=e.maxHeight);var l=this.originalPosition.left+this.originalSize.width,m=this.position.top+this.size.height,n=/sw|nw|w/.test(g),o=/nw|ne|n/.test(g);j&&n&&(a.left=l-e.minWidth),h&&n&&(a.left=l-e.maxWidth),k&&o&&(a.top=m-e.minHeight),i&&o&&(a.top=m-e.maxHeight);var p=!a.width&&!a.height;return p&&!a.left&&a.top?a.top=null:p&&!a.top&&a.left&&(a.left=null),a},_proportionallyResize:function(){var b=this.options;if(!this._proportionallyResizeElements.length)return;var c=this.helper||this.element;for(var d=0;d<this._proportionallyResizeElements.length;d++){var e=this._proportionallyResizeElements[d];if(!this.borderDif){var f=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],g=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];this.borderDif=a.map(f,function(a,b){var c=parseInt(a,10)||0,d=parseInt(g[b],10)||0;return c+d})}if(!a.browser.msie||!a(c).is(":hidden")&&!a(c).parents(":hidden").length)e.css({height:c.height()-this.borderDif[0]-this.borderDif[2]||0,width:c.width()-this.borderDif[1]-this.borderDif[3]||0});else continue}},_renderProxy:function(){var b=this.element,c=this.options;this.elementOffset=b.offset();if(this._helper){this.helper=this.helper||a('<div style="overflow:hidden;"></div>');var d=a.browser.msie&&a.browser.version<7,e=d?1:0,f=d?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+f,height:this.element.outerHeight()+f,position:"absolute",left:this.elementOffset.left-e+"px",top:this.elementOffset.top-e+"px",zIndex:++c.zIndex}),this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(a,b,c){return{width:this.originalSize.width+b}},w:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{left:f.left+b,width:e.width-b}},n:function(a,b,c){var d=this.options,e=this.originalSize,f=this.originalPosition;return{top:f.top+c,height:e.height-c}},s:function(a,b,c){return{height:this.originalSize.height+c}},se:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},sw:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,d]))},ne:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},nw:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,d]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]),b!="resize"&&this._trigger(b,c,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),a.extend(a.ui.resizable,{version:"1.8.23"}),a.ui.plugin.add("resizable","alsoResize",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=function(b){a(b).each(function(){var b=a(this);b.data("resizable-alsoresize",{width:parseInt(b.width(),10),height:parseInt(b.height(),10),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10)})})};typeof e.alsoResize=="object"&&!e.alsoResize.parentNode?e.alsoResize.length?(e.alsoResize=e.alsoResize[0],f(e.alsoResize)):a.each(e.alsoResize,function(a){f(a)}):f(e.alsoResize)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.originalSize,g=d.originalPosition,h={height:d.size.height-f.height||0,width:d.size.width-f.width||0,top:d.position.top-g.top||0,left:d.position.left-g.left||0},i=function(b,d){a(b).each(function(){var b=a(this),e=a(this).data("resizable-alsoresize"),f={},g=d&&d.length?d:b.parents(c.originalElement[0]).length?["width","height"]:["width","height","top","left"];a.each(g,function(a,b){var c=(e[b]||0)+(h[b]||0);c&&c>=0&&(f[b]=c||null)}),b.css(f)})};typeof e.alsoResize=="object"&&!e.alsoResize.nodeType?a.each(e.alsoResize,function(a,b){i(a,b)}):i(e.alsoResize)},stop:function(b,c){a(this).removeData("resizable-alsoresize")}}),a.ui.plugin.add("resizable","animate",{stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d._proportionallyResizeElements,g=f.length&&/textarea/i.test(f[0].nodeName),h=g&&a.ui.hasScroll(f[0],"left")?0:d.sizeDiff.height,i=g?0:d.sizeDiff.width,j={width:d.size.width-i,height:d.size.height-h},k=parseInt(d.element.css("left"),10)+(d.position.left-d.originalPosition.left)||null,l=parseInt(d.element.css("top"),10)+(d.position.top-d.originalPosition.top)||null;d.element.animate(a.extend(j,l&&k?{top:l,left:k}:{}),{duration:e.animateDuration,easing:e.animateEasing,step:function(){var c={width:parseInt(d.element.css("width"),10),height:parseInt(d.element.css("height"),10),top:parseInt(d.element.css("top"),10),left:parseInt(d.element.css("left"),10)};f&&f.length&&a(f[0]).css({width:c.width,height:c.height}),d._updateCache(c),d._propagate("resize",b)}})}}),a.ui.plugin.add("resizable","containment",{start:function(b,d){var e=a(this).data("resizable"),f=e.options,g=e.element,h=f.containment,i=h instanceof a?h.get(0):/parent/.test(h)?g.parent().get(0):h;if(!i)return;e.containerElement=a(i);if(/document/.test(h)||h==document)e.containerOffset={left:0,top:0},e.containerPosition={left:0,top:0},e.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight};else{var j=a(i),k=[];a(["Top","Right","Left","Bottom"]).each(function(a,b){k[a]=c(j.css("padding"+b))}),e.containerOffset=j.offset(),e.containerPosition=j.position(),e.containerSize={height:j.innerHeight()-k[3],width:j.innerWidth()-k[1]};var l=e.containerOffset,m=e.containerSize.height,n=e.containerSize.width,o=a.ui.hasScroll(i,"left")?i.scrollWidth:n,p=a.ui.hasScroll(i)?i.scrollHeight:m;e.parentData={element:i,left:l.left,top:l.top,width:o,height:p}}},resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.containerSize,g=d.containerOffset,h=d.size,i=d.position,j=d._aspectRatio||b.shiftKey,k={top:0,left:0},l=d.containerElement;l[0]!=document&&/static/.test(l.css("position"))&&(k=g),i.left<(d._helper?g.left:0)&&(d.size.width=d.size.width+(d._helper?d.position.left-g.left:d.position.left-k.left),j&&(d.size.height=d.size.width/d.aspectRatio),d.position.left=e.helper?g.left:0),i.top<(d._helper?g.top:0)&&(d.size.height=d.size.height+(d._helper?d.position.top-g.top:d.position.top),j&&(d.size.width=d.size.height*d.aspectRatio),d.position.top=d._helper?g.top:0),d.offset.left=d.parentData.left+d.position.left,d.offset.top=d.parentData.top+d.position.top;var m=Math.abs((d._helper?d.offset.left-k.left:d.offset.left-k.left)+d.sizeDiff.width),n=Math.abs((d._helper?d.offset.top-k.top:d.offset.top-g.top)+d.sizeDiff.height),o=d.containerElement.get(0)==d.element.parent().get(0),p=/relative|absolute/.test(d.containerElement.css("position"));o&&p&&(m-=d.parentData.left),m+d.size.width>=d.parentData.width&&(d.size.width=d.parentData.width-m,j&&(d.size.height=d.size.width/d.aspectRatio)),n+d.size.height>=d.parentData.height&&(d.size.height=d.parentData.height-n,j&&(d.size.width=d.size.height*d.aspectRatio))},stop:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.position,g=d.containerOffset,h=d.containerPosition,i=d.containerElement,j=a(d.helper),k=j.offset(),l=j.outerWidth()-d.sizeDiff.width,m=j.outerHeight()-d.sizeDiff.height;d._helper&&!e.animate&&/relative/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m}),d._helper&&!e.animate&&/static/.test(i.css("position"))&&a(this).css({left:k.left-h.left-g.left,width:l,height:m})}}),a.ui.plugin.add("resizable","ghost",{start:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size;d.ghost=d.originalElement.clone(),d.ghost.css({opacity:.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof e.ghost=="string"?e.ghost:""),d.ghost.appendTo(d.helper)},resize:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})},stop:function(b,c){var d=a(this).data("resizable"),e=d.options;d.ghost&&d.helper&&d.helper.get(0).removeChild(d.ghost.get(0))}}),a.ui.plugin.add("resizable","grid",{resize:function(b,c){var d=a(this).data("resizable"),e=d.options,f=d.size,g=d.originalSize,h=d.originalPosition,i=d.axis,j=e._aspectRatio||b.shiftKey;e.grid=typeof e.grid=="number"?[e.grid,e.grid]:e.grid;var k=Math.round((f.width-g.width)/(e.grid[0]||1))*(e.grid[0]||1),l=Math.round((f.height-g.height)/(e.grid[1]||1))*(e.grid[1]||1);/^(se|s|e)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l):/^(ne)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l):/^(sw)$/.test(i)?(d.size.width=g.width+k,d.size.height=g.height+l,d.position.left=h.left-k):(d.size.width=g.width+k,d.size.height=g.height+l,d.position.top=h.top-l,d.position.left=h.left-k)}});var c=function(a){return parseInt(a,10)||0},d=function(a){return!isNaN(parseInt(a,10))}}(jQuery),function(a,b){a.widget("ui.selectable",a.ui.mouse,{options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var b=this;this.element.addClass("ui-selectable"),this.dragged=!1;var c;this.refresh=function(){c=a(b.options.filter,b.element[0]),c.addClass("ui-selectee"),c.each(function(){var b=a(this),c=b.offset();a.data(this,"selectable-item",{element:this,$element:b,left:c.left,top:c.top,right:c.left+b.outerWidth(),bottom:c.top+b.outerHeight(),startselected:!1,selected:b.hasClass("ui-selected"),selecting:b.hasClass("ui-selecting"),unselecting:b.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=c.addClass("ui-selectee"),this._mouseInit(),this.helper=a("<div class='ui-selectable-helper'></div>")},destroy:function(){return this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable"),this._mouseDestroy(),this},_mouseStart:function(b){var c=this;this.opos=[b.pageX,b.pageY];if(this.options.disabled)return;var d=this.options;this.selectees=a(d.filter,this.element[0]),this._trigger("start",b),a(d.appendTo).append(this.helper),this.helper.css({left:b.clientX,top:b.clientY,width:0,height:0}),d.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var d=a.data(this,"selectable-item");d.startselected=!0,!b.metaKey&&!b.ctrlKey&&(d.$element.removeClass("ui-selected"),d.selected=!1,d.$element.addClass("ui-unselecting"),d.unselecting=!0,c._trigger("unselecting",b,{unselecting:d.element}))}),a(b.target).parents().andSelf().each(function(){var d=a.data(this,"selectable-item");if(d){var e=!b.metaKey&&!b.ctrlKey||!d.$element.hasClass("ui-selected");return d.$element.removeClass(e?"ui-unselecting":"ui-selected").addClass(e?"ui-selecting":"ui-unselecting"),d.unselecting=!e,d.selecting=e,d.selected=e,e?c._trigger("selecting",b,{selecting:d.element}):c._trigger("unselecting",b,{unselecting:d.element}),!1}})},_mouseDrag:function(b){var c=this;this.dragged=!0;if(this.options.disabled)return;var d=this.options,e=this.opos[0],f=this.opos[1],g=b.pageX,h=b.pageY;if(e>g){var i=g;g=e,e=i}if(f>h){var i=h;h=f,f=i}return this.helper.css({left:e,top:f,width:g-e,height:h-f}),this.selectees.each(function(){var i=a.data(this,"selectable-item");if(!i||i.element==c.element[0])return;var j=!1;d.tolerance=="touch"?j=!(i.left>g||i.right<e||i.top>h||i.bottom<f):d.tolerance=="fit"&&(j=i.left>e&&i.right<g&&i.top>f&&i.bottom<h),j?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,c._trigger("selecting",b,{selecting:i.element}))):(i.selecting&&((b.metaKey||b.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),c._trigger("unselecting",b,{unselecting:i.element}))),i.selected&&!b.metaKey&&!b.ctrlKey&&!i.startselected&&(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,c._trigger("unselecting",b,{unselecting:i.element})))}),!1},_mouseStop:function(b){var c=this;this.dragged=!1;var d=this.options;return a(".ui-unselecting",this.element[0]).each(function(){var d=a.data(this,"selectable-item");d.$element.removeClass("ui-unselecting"),d.unselecting=!1,d.startselected=!1,c._trigger("unselected",b,{unselected:d.element})}),a(".ui-selecting",this.element[0]).each(function(){var d=a.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("ui-selected"),d.selecting=!1,d.selected=!0,d.startselected=!0,c._trigger("selected",b,{selected:d.element})}),this._trigger("stop",b),this.helper.remove(),!1}}),a.extend(a.ui.selectable,{version:"1.8.23"})}(jQuery),function(a,b){a.widget("ui.sortable",a.ui.mouse,{widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var a=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},destroy:function(){a.Widget.prototype.destroy.call(this),this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var b=this.items.length-1;b>=0;b--)this.items[b].item.removeData(this.widgetName+"-item");return this},_setOption:function(b,c){b==="disabled"?(this.options[b]=c,this.widget()[c?"addClass":"removeClass"]("ui-sortable-disabled")):a.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(b,c){var d=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(b);var e=null,f=this,g=a(b.target).parents().each(function(){if(a.data(this,d.widgetName+"-item")==f)return e=a(this),!1});a.data(b.target,d.widgetName+"-item")==f&&(e=a(b.target));if(!e)return!1;if(this.options.handle&&!c){var h=!1;a(this.options.handle,e).find("*").andSelf().each(function(){this==b.target&&(h=!0)});if(!h)return!1}return this.currentItem=e,this._removeCurrentsFromItems(),!0},_mouseStart:function(b,c,d){var e=this.options,f=this;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(b),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),e.containment&&this._setContainment(),e.cursor&&(a("body").css("cursor")&&(this._storedCursor=a("body").css("cursor")),a("body").css("cursor",e.cursor)),e.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",e.opacity)),e.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",e.zIndex)),this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",b,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!d)for(var g=this.containers.length-1;g>=0;g--)this.containers[g]._trigger("activate",b,f._uiHash(this));return a.ui.ddmanager&&(a.ui.ddmanager.current=this),a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(b),!0},_mouseDrag:function(b){this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var c=this.options,d=!1;this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY<c.scrollSensitivity?this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop+c.scrollSpeed:b.pageY-this.overflowOffset.top<c.scrollSensitivity&&(this.scrollParent[0].scrollTop=d=this.scrollParent[0].scrollTop-c.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-b.pageX<c.scrollSensitivity?this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft+c.scrollSpeed:b.pageX-this.overflowOffset.left<c.scrollSensitivity&&(this.scrollParent[0].scrollLeft=d=this.scrollParent[0].scrollLeft-c.scrollSpeed)):(b.pageY-a(document).scrollTop()<c.scrollSensitivity?d=a(document).scrollTop(a(document).scrollTop()-c.scrollSpeed):a(window).height()-(b.pageY-a(document).scrollTop())<c.scrollSensitivity&&(d=a(document).scrollTop(a(document).scrollTop()+c.scrollSpeed)),b.pageX-a(document).scrollLeft()<c.scrollSensitivity?d=a(document).scrollLeft(a(document).scrollLeft()-c.scrollSpeed):a(window).width()-(b.pageX-a(document).scrollLeft())<c.scrollSensitivity&&(d=a(document).scrollLeft(a(document).scrollLeft()+c.scrollSpeed))),d!==!1&&a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(var e=this.items.length-1;e>=0;e--){var f=this.items[e],g=f.item[0],h=this._intersectsWithPointer(f);if(!h)continue;if(g!=this.currentItem[0]&&this.placeholder[h==1?"next":"prev"]()[0]!=g&&!a.ui.contains(this.placeholder[0],g)&&(this.options.type=="semi-dynamic"?!a.ui.contains(this.element[0],g):!0)){this.direction=h==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(f))this._rearrange(b,f);else break;this._trigger("change",b,this._uiHash());break}}return this._contactContainers(b),a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),this._trigger("sort",b,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(b,c){if(!b)return;a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b);if(this.options.revert){var d=this,e=d.placeholder.offset();d.reverting=!0,a(this.helper).animate({left:e.left-this.offset.parent.left-d.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:e.top-this.offset.parent.top-d.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,c);return!1},cancel:function(){var b=this;if(this.dragging){this._mouseUp({target:null}),this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("deactivate",null,b._uiHash(this)),this.containers[c].containerCache.over&&(this.containers[c]._trigger("out",null,b._uiHash(this)),this.containers[c].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):a(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[-=_](.+)/);c&&d.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))}),!d.length&&b.key&&d.push(b.key+"="),d.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},c.each(function(){d.push(a(b.item||this).attr(b.attribute||"id")||"")}),d},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,d=this.positionAbs.top,e=d+this.helperProportions.height,f=a.left,g=f+a.width,h=a.top,i=h+a.height,j=this.offset.click.top,k=this.offset.click.left,l=d+j>h&&d+j<i&&b+k>f&&b+k<g;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?l:f<b+this.helperProportions.width/2&&c-this.helperProportions.width/2<g&&h<d+this.helperProportions.height/2&&e-this.helperProportions.height/2<i},_intersectsWithPointer:function(b){var c=this.options.axis==="x"||a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top,b.height),d=this.options.axis==="y"||a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left,b.width),e=c&&d,f=this._getDragVerticalDirection(),g=this._getDragHorizontalDirection();return e?this.floating?g&&g=="right"||f=="down"?2:1:f&&(f=="down"?2:1):!1},_intersectsWithSides:function(b){var c=a.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,b.top+b.height/2,b.height),d=a.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,b.left+b.width/2,b.width),e=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();return this.floating&&f?f=="right"&&d||f=="left"&&!d:e&&(e=="down"&&c||e=="up"&&!c)},_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return a!=0&&(a>0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){return this._refreshItems(a),this.refreshPositions(),this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){var c=this,d=[],e=[],f=this._connectWith();if(f&&b)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&e.push([a.isFunction(j.options.items)?j.options.items.call(j.element):a(j.options.items,j.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),j])}}e.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var g=e.length-1;g>=0;g--)e[g][0].each(function(){d.push(this)});return a(d)},_removeCurrentsFromItems:function(){var a=this.currentItem.find(":data("+this.widgetName+"-item)");for(var b=0;b<this.items.length;b++)for(var c=0;c<a.length;c++)a[c]==this.items[b].item[0]&&this.items.splice(b,1)},_refreshItems:function(b){this.items=[],this.containers=[this];var c=this.items,d=this,e=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]],f=this._connectWith();if(f&&this.ready)for(var g=f.length-1;g>=0;g--){var h=a(f[g]);for(var i=h.length-1;i>=0;i--){var j=a.data(h[i],this.widgetName);j&&j!=this&&!j.options.disabled&&(e.push([a.isFunction(j.options.items)?j.options.items.call(j.element[0],b,{item:this.currentItem}):a(j.options.items,j.element),j]),this.containers.push(j))}}for(var g=e.length-1;g>=0;g--){var k=e[g][1],l=e[g][0];for(var i=0,m=l.length;i<m;i++){var n=a(l[i]);n.data(this.widgetName+"-item",k),c.push({item:n,instance:k,width:0,height:0,left:0,top:0})}}},refreshPositions:function(b){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());for(var c=this.items.length-1;c>=0;c--){var d=this.items[c];if(d.instance!=this.currentContainer&&this.currentContainer&&d.item[0]!=this.currentItem[0])continue;var e=this.options.toleranceElement?a(this.options.toleranceElement,d.item):d.item;b||(d.width=e.outerWidth(),d.height=e.outerHeight());var f=e.offset();d.left=f.left,d.top=f.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var c=this.containers.length-1;c>=0;c--){var f=this.containers[c].element.offset();this.containers[c].containerCache.left=f.left,this.containers[c].containerCache.top=f.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=this.containers[c].element.outerHeight()}return this},_createPlaceholder:function(b){var c=b||this,d=c.options;if(!d.placeholder||d.placeholder.constructor==String){var e=d.placeholder;d.placeholder={element:function(){var b=a(document.createElement(c.currentItem[0].nodeName)).addClass(e||c.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return e||(b.style.visibility="hidden"),b},update:function(a,b){if(e&&!d.forcePlaceholderSize)return;b.height()||b.height(c.currentItem.innerHeight()-parseInt(c.currentItem.css("paddingTop")||0,10)-parseInt(c.currentItem.css("paddingBottom")||0,10)),b.width()||b.width(c.currentItem.innerWidth()-parseInt(c.currentItem.css("paddingLeft")||0,10)-parseInt(c.currentItem.css("paddingRight")||0,10))}}}c.placeholder=a(d.placeholder.element.call(c.element,c.currentItem)),c.currentItem.after(c.placeholder),d.placeholder.update(c,c.placeholder)},_contactContainers:function(b){var c=null,d=null;for(var e=this.containers.length-1;e>=0;e--){if(a.ui.contains(this.currentItem[0],this.containers[e].element[0]))continue;if(this._intersectsWith(this.containers[e].containerCache)){if(c&&a.ui.contains(this.containers[e].element[0],c.element[0]))continue;c=this.containers[e],d=e}else this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",b,this._uiHash(this)),this.containers[e].containerCache.over=0)}if(!c)return;if(this.containers.length===1)this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1;else if(this.currentContainer!=this.containers[d]){var f=1e4,g=null,h=this.positionAbs[this.containers[d].floating?"left":"top"];for(var i=this.items.length-1;i>=0;i--){if(!a.ui.contains(this.containers[d].element[0],this.items[i].item[0]))continue;var j=this.containers[d].floating?this.items[i].item.offset().left:this.items[i].item.offset().top;Math.abs(j-h)<f&&(f=Math.abs(j-h),g=this.items[i],this.direction=j-h>0?"down":"up")}if(!g&&!this.options.dropOnEmpty)return;this.currentContainer=this.containers[d],g?this._rearrange(b,g,null,!0):this._rearrange(b,null,this.containers[d].element,!0),this._trigger("change",b,this._uiHash()),this.containers[d]._trigger("change",b,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[d]._trigger("over",b,this._uiHash(this)),this.containers[d].containerCache.over=1}},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b,this.currentItem])):c.helper=="clone"?this.currentItem.clone():this.currentItem;return d.parents("body").length||a(c.appendTo!="parent"?c.appendTo:this.currentItem[0].parentNode)[0].appendChild(d[0]),d[0]==this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(d[0].style.width==""||c.forceHelperSize)&&d.width(this.currentItem.width()),(d[0].style.height==""||c.forceHelperSize)&&d.height(this.currentItem.height()),d},_adjustOffsetFromHelper:function(b){typeof b=="string"&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&a.ui.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&a.browser.msie)b={top:0,left:0};return{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b=this.options;b.containment=="parent"&&(b.containment=this.helper[0].parentNode);if(b.containment=="document"||b.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,a(b.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a(b.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(b.containment)){var c=a(b.containment)[0],d=a(b.containment).offset(),e=a(c).css("overflow")!="hidden";this.containment=[d.left+(parseInt(a(c).css("borderLeftWidth"),10)||0)+(parseInt(a(c).css("paddingLeft"),10)||0)-this.margins.left,d.top+(parseInt(a(c).css("borderTopWidth"),10)||0)+(parseInt(a(c).css("paddingTop"),10)||0)-this.margins.top,d.left+(e?Math.max(c.scrollWidth,c.offsetWidth):c.offsetWidth)-(parseInt(a(c).css("borderLeftWidth"),10)||0)-(parseInt(a(c).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,d.top+(e?Math.max(c.scrollHeight,c.offsetHeight):c.offsetHeight)-(parseInt(a(c).css("borderTopWidth"),10)||0)-(parseInt(a(c).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(b,c){c||(c=this.position);var d=b=="absolute"?1:-1,e=this.options,f=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,g=/(html|body)/i.test(f[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():g?0:f.scrollTop())*d),left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-(a.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():g?0:f.scrollLeft())*d)}},_generatePosition:function(b){var c=this.options,d=this.cssPosition=="absolute"&&(this.scrollParent[0]==document||!a.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(d[0].tagName);this.cssPosition=="relative"&&(this.scrollParent[0]==document||this.scrollParent[0]==this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset());var f=b.pageX,g=b.pageY;if(this.originalPosition){this.containment&&(b.pageX-this.offset.click.left<this.containment[0]&&(f=this.containment[0]+this.offset.click.left),b.pageY-this.offset.click.top<this.containment[1]&&(g=this.containment[1]+this.offset.click.top),b.pageX-this.offset.click.left>this.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top));if(c.grid){var h=this.originalPageY+Math.round((g-this.originalPageY)/c.grid[1])*c.grid[1];g=this.containment?h-this.offset.click.top<this.containment[1]||h-this.offset.click.top>this.containment[3]?h-this.offset.click.top<this.containment[1]?h+c.grid[1]:h-c.grid[1]:h:h;var i=this.originalPageX+Math.round((f-this.originalPageX)/c.grid[0])*c.grid[0];f=this.containment?i-this.offset.click.left<this.containment[0]||i-this.offset.click.left>this.containment[2]?i-this.offset.click.left<this.containment[0]?i+c.grid[0]:i-c.grid[0]:i:i}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(a.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:d.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(a.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:d.scrollLeft())}},_rearrange:function(a,b,c,d){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],this.direction=="down"?b.item[0]:b.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var e=this,f=this.counter;window.setTimeout(function(){f==e.counter&&e.refreshPositions(!d)},0)},_clear:function(b,c){this.reverting=!1;var d=[],e=this;!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var f in this._storedCSS)if(this._storedCSS[f]=="auto"||this._storedCSS[f]=="static")this._storedCSS[f]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!c&&d.push(function(a){this._trigger("receive",a,this._uiHash(this.fromOutside))}),(this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!c&&d.push(function(a){this._trigger("update",a,this._uiHash())});if(!a.ui.contains(this.element[0],this.currentItem[0])){c||d.push(function(a){this._trigger("remove",a,this._uiHash())});for(var f=this.containers.length-1;f>=0;f--)a.ui.contains(this.containers[f].element[0],this.currentItem[0])&&!c&&(d.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.containers[f])),d.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.containers[f])))}for(var f=this.containers.length-1;f>=0;f--)c||d.push(function(a){return function(b){a._trigger("deactivate",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over&&(d.push(function(a){return function(b){a._trigger("out",b,this._uiHash(this))}}.call(this,this.containers[f])),this.containers[f].containerCache.over=0);this._storedCursor&&a("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!c){this._trigger("beforeStop",b,this._uiHash());for(var f=0;f<d.length;f++)d[f].call(this,b);this._trigger("stop",b,this._uiHash())}return this.fromOutside=!1,!1}c||this._trigger("beforeStop",b,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!=this.currentItem[0]&&this.helper.remove(),this.helper=null;if(!c){for(var f=0;f<d.length;f++)d[f].call(this,b);this._trigger("stop",b,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){a.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(b){var c=b||this;return{helper:c.helper,placeholder:c.placeholder||a([]),position:c.position,originalPosition:c.originalPosition,offset:c.positionAbs,item:c.currentItem,sender:b?b.element:null}}}),a.extend(a.ui.sortable,{version:"1.8.23"})}(jQuery),jQuery.effects||function(a,b){function c(b){var c;return b&&b.constructor==Array&&b.length==3?b:(c=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(b))?[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)]:(c=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(b))?[parseFloat(c[1])*2.55,parseFloat(c[2])*2.55,parseFloat(c[3])*2.55]:(c=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(b))?[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)]:(c=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(b))?[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)]:(c=/rgba\(0, 0, 0, 0\)/.exec(b))?e.transparent:e[a.trim(b).toLowerCase()]}function d(b,d){var e;do{e=(a.curCSS||a.css)(b,d);if(e!=""&&e!="transparent"||a.nodeName(b,"body"))break;d="backgroundColor"}while(b=b.parentNode);return c(e)}function h(){var a=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,b={},c,d;if(a&&a.length&&a[0]&&a[a[0]]){var e=a.length;while(e--)c=a[e],typeof a[c]=="string"&&(d=c.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),b[d]=a[c])}else for(c in a)typeof a[c]=="string"&&(b[c]=a[c]);return b}function i(b){var c,d;for(c in b)d=b[c],(d==null||a.isFunction(d)||c in g||/scrollbar/.test(c)||!/color/i.test(c)&&isNaN(parseFloat(d)))&&delete b[c];return b}function j(a,b){var c={_:0},d;for(d in b)a[d]!=b[d]&&(c[d]=b[d]);return c}function k(b,c,d,e){typeof b=="object"&&(e=c,d=null,c=b,b=c.effect),a.isFunction(c)&&(e=c,d=null,c={});if(typeof c=="number"||a.fx.speeds[c])e=d,d=c,c={};return a.isFunction(d)&&(e=d,d=null),c=c||{},d=d||c.duration,d=a.fx.off?0:typeof d=="number"?d:d in a.fx.speeds?a.fx.speeds[d]:a.fx.speeds._default,e=e||c.complete,[b,c,d,e]}function l(b){return!b||typeof b=="number"||a.fx.speeds[b]?!0:typeof b=="string"&&!a.effects[b]?!0:!1}a.effects={},a.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(b,e){a.fx.step[e]=function(a){a.colorInit||(a.start=d(a.elem,e),a.end=c(a.end),a.colorInit=!0),a.elem.style[e]="rgb("+Math.max(Math.min(parseInt(a.pos*(a.end[0]-a.start[0])+a.start[0],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[1]-a.start[1])+a.start[1],10),255),0)+","+Math.max(Math.min(parseInt(a.pos*(a.end[2]-a.start[2])+a.start[2],10),255),0)+")"}});var e={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},f=["add","remove","toggle"],g={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};a.effects.animateClass=function(b,c,d,e){return a.isFunction(d)&&(e=d,d=null),this.queue(function(){var g=a(this),k=g.attr("style")||" ",l=i(h.call(this)),m,n=g.attr("class")||"";a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),m=i(h.call(this)),g.attr("class",n),g.animate(j(l,m),{queue:!1,duration:c,easing:d,complete:function(){a.each(f,function(a,c){b[c]&&g[c+"Class"](b[c])}),typeof g.attr("style")=="object"?(g.attr("style").cssText="",g.attr("style").cssText=k):g.attr("style",k),e&&e.apply(this,arguments),a.dequeue(this)}})})},a.fn.extend({_addClass:a.fn.addClass,addClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{add:b},c,d,e]):this._addClass(b)},_removeClass:a.fn.removeClass,removeClass:function(b,c,d,e){return c?a.effects.animateClass.apply(this,[{remove:b},c,d,e]):this._removeClass(b)},_toggleClass:a.fn.toggleClass,toggleClass:function(c,d,e,f,g){return typeof d=="boolean"||d===b?e?a.effects.animateClass.apply(this,[d?{add:c}:{remove:c},e,f,g]):this._toggleClass(c,d):a.effects.animateClass.apply(this,[{toggle:c},d,e,f])},switchClass:function(b,c,d,e,f){return a.effects.animateClass.apply(this,[{add:c,remove:b},d,e,f])}}),a.extend(a.effects,{version:"1.8.23",save:function(a,b){for(var c=0;c<b.length;c++)b[c]!==null&&a.data("ec.storage."+b[c],a[0].style[b[c]])},restore:function(a,b){for(var c=0;c<b.length;c++)b[c]!==null&&a.css(b[c],a.data("ec.storage."+b[c]))},setMode:function(a,b){return b=="toggle"&&(b=a.is(":hidden")?"show":"hide"),b},getBaseline:function(a,b){var c,d;switch(a[0]){case"top":c=0;break;case"middle":c=.5;break;case"bottom":c=1;break;default:c=a[0]/b.height}switch(a[1]){case"left":d=0;break;case"center":d=.5;break;case"right":d=1;break;default:d=a[1]/b.width}return{x:d,y:c}},createWrapper:function(b){if(b.parent().is(".ui-effects-wrapper"))return b.parent();var c={width:b.outerWidth(!0),height:b.outerHeight(!0),"float":b.css("float")},d=a("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e=document.activeElement;try{e.id}catch(f){e=document.body}return b.wrap(d),(b[0]===e||a.contains(b[0],e))&&a(e).focus(),d=b.parent(),b.css("position")=="static"?(d.css({position:"relative"}),b.css({position:"relative"})):(a.extend(c,{position:b.css("position"),zIndex:b.css("z-index")}),a.each(["top","left","bottom","right"],function(a,d){c[d]=b.css(d),isNaN(parseInt(c[d],10))&&(c[d]="auto")}),b.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),d.css(c).show()},removeWrapper:function(b){var c,d=document.activeElement;return b.parent().is(".ui-effects-wrapper")?(c=b.parent().replaceWith(b),(b[0]===d||a.contains(b[0],d))&&a(d).focus(),c):b},setTransition:function(b,c,d,e){return e=e||{},a.each(c,function(a,c){var f=b.cssUnit(c);f[0]>0&&(e[c]=f[0]*d+f[1])}),e}}),a.fn.extend({effect:function(b,c,d,e){var f=k.apply(this,arguments),g={options:f[1],duration:f[2],callback:f[3]},h=g.options.mode,i=a.effects[b];return a.fx.off||!i?h?this[h](g.duration,g.callback):this.each(function(){g.callback&&g.callback.call(this)}):i.call(this,g)},_show:a.fn.show,show:function(a){if(l(a))return this._show.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="show",this.effect.apply(this,b)},_hide:a.fn.hide,hide:function(a){if(l(a))return this._hide.apply(this,arguments);var b=k.apply(this,arguments);return b[1].mode="hide",this.effect.apply(this,b)},__toggle:a.fn.toggle,toggle:function(b){if(l(b)||typeof b=="boolean"||a.isFunction(b))return this.__toggle.apply(this,arguments);var c=k.apply(this,arguments);return c[1].mode="toggle",this.effect.apply(this,c)},cssUnit:function(b){var c=this.css(b),d=[];return a.each(["em","px","%","pt"],function(a,b){c.indexOf(b)>0&&(d=[parseFloat(c),b])}),d}});var m={};a.each(["Quad","Cubic","Quart","Quint","Expo"],function(a,b){m[b]=function(b){return Math.pow(b,a+2)}}),a.extend(m,{Sine:function(a){return 1-Math.cos(a*Math.PI/2)},Circ:function(a){return 1-Math.sqrt(1-a*a)},Elastic:function(a){return a===0||a===1?a:-Math.pow(2,8*(a-1))*Math.sin(((a-1)*80-7.5)*Math.PI/15)},Back:function(a){return a*a*(3*a-2)},Bounce:function(a){var b,c=4;while(a<((b=Math.pow(2,--c))-1)/11);return 1/Math.pow(4,3-c)-7.5625*Math.pow((b*3-2)/22-a,2)}}),a.each(m,function(b,c){a.easing["easeIn"+b]=c,a.easing["easeOut"+b]=function(a){return 1-c(1-a)},a.easing["easeInOut"+b]=function(a){return a<.5?c(a*2)/2:c(a*-2+2)/-2+1}})}(jQuery),function(a,b){a.effects.blind=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.direction||"vertical";a.effects.save(c,d),c.show();var g=a.effects.createWrapper(c).css({overflow:"hidden"}),h=f=="vertical"?"height":"width",i=f=="vertical"?g.height():g.width();e=="show"&&g.css(h,0);var j={};j[h]=e=="show"?i:0,g.animate(j,b.duration,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}}(jQuery),function(a,b){a.effects.bounce=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"effect"),f=b.options.direction||"up",g=b.options.distance||20,h=b.options.times||5,i=b.duration||250;/show|hide/.test(e)&&d.push("opacity"),a.effects.save(c,d),c.show(),a.effects.createWrapper(c);var j=f=="up"||f=="down"?"top":"left",k=f=="up"||f=="left"?"pos":"neg",g=b.options.distance||(j=="top"?c.outerHeight(!0)/3:c.outerWidth(!0)/3);e=="show"&&c.css("opacity",0).css(j,k=="pos"?-g:g),e=="hide"&&(g=g/(h*2)),e!="hide"&&h--;if(e=="show"){var l={opacity:1};l[j]=(k=="pos"?"+=":"-=")+g,c.animate(l,i/2,b.options.easing),g=g/2,h--}for(var m=0;m<h;m++){var n={},p={};n[j]=(k=="pos"?"-=":"+=")+g,p[j]=(k=="pos"?"+=":"-=")+g,c.animate(n,i/2,b.options.easing).animate(p,i/2,b.options.easing),g=e=="hide"?g*2:g/2}if(e=="hide"){var l={opacity:0};l[j]=(k=="pos"?"-=":"+=")+g,c.animate(l,i/2,b.options.easing,function(){c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments)})}else{var n={},p={};n[j]=(k=="pos"?"-=":"+=")+g,p[j]=(k=="pos"?"+=":"-=")+g,c.animate(n,i/2,b.options.easing).animate(p,i/2,b.options.easing,function(){a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments)})}c.queue("fx",function(){c.dequeue()}),c.dequeue()})}}(jQuery),function(a,b){a.effects.clip=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right","height","width"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.direction||"vertical";a.effects.save(c,d),c.show();var g=a.effects.createWrapper(c).css({overflow:"hidden"}),h=c[0].tagName=="IMG"?g:c,i={size:f=="vertical"?"height":"width",position:f=="vertical"?"top":"left"},j=f=="vertical"?h.height():h.width();e=="show"&&(h.css(i.size,0),h.css(i.position,j/2));var k={};k[i.size]=e=="show"?j:0,k[i.position]=e=="show"?0:j/2,h.animate(k,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()}})})}}(jQuery),function(a,b){a.effects.drop=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right","opacity"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.direction||"left";a.effects.save(c,d),c.show(),a.effects.createWrapper(c);var g=f=="up"||f=="down"?"top":"left",h=f=="up"||f=="left"?"pos":"neg",i=b.options.distance||(g=="top"?c.outerHeight(!0)/2:c.outerWidth(!0)/2);e=="show"&&c.css("opacity",0).css(g,h=="pos"?-i:i);var j={opacity:e=="show"?1:0};j[g]=(e=="show"?h=="pos"?"+=":"-=":h=="pos"?"-=":"+=")+i,c.animate(j,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}}(jQuery),function(a,b){a.effects.explode=function(b){return this.queue(function(){var c=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3,d=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;b.options.mode=b.options.mode=="toggle"?a(this).is(":visible")?"hide":"show":b.options.mode;var e=a(this).show().css("visibility","hidden"),f=e.offset();f.top-=parseInt(e.css("marginTop"),10)||0,f.left-=parseInt(e.css("marginLeft"),10)||0;var g=e.outerWidth(!0),h=e.outerHeight(!0);for(var i=0;i<c;i++)for(var j=0;j<d;j++)e.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-j*(g/d),top:-i*(h/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/d,height:h/c,left:f.left+j*(g/d)+(b.options.mode=="show"?(j-Math.floor(d/2))*(g/d):0),top:f.top+i*(h/c)+(b.options.mode=="show"?(i-Math.floor(c/2))*(h/c):0),opacity:b.options.mode=="show"?0:1}).animate({left:f.left+j*(g/d)+(b.options.mode=="show"?0:(j-Math.floor(d/2))*(g/d)),top:f.top+i*(h/c)+(b.options.mode=="show"?0:(i-Math.floor(c/2))*(h/c)),opacity:b.options.mode=="show"?1:0},b.duration||500);setTimeout(function(){b.options.mode=="show"?e.css({visibility:"visible"}):e.css({visibility:"visible"}).hide(),b.callback&&b.callback.apply(e[0]),e.dequeue(),a("div.ui-effects-explode").remove()},b.duration||500)})}}(jQuery),function(a,b){a.effects.fade=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide");c.animate({opacity:d},{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}}(jQuery),function(a,b){a.effects.fold=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"hide"),f=b.options.size||15,g=!!b.options.horizFirst,h=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(c,d),c.show();var i=a.effects.createWrapper(c).css({overflow:"hidden"}),j=e=="show"!=g,k=j?["width","height"]:["height","width"],l=j?[i.width(),i.height()]:[i.height(),i.width()],m=/([0-9]+)%/.exec(f);m&&(f=parseInt(m[1],10)/100*l[e=="hide"?0:1]),e=="show"&&i.css(g?{height:0,width:f}:{height:f,width:0});var n={},p={};n[k[0]]=e=="show"?l[0]:f,p[k[1]]=e=="show"?l[1]:0,i.animate(n,h,b.options.easing).animate(p,h,b.options.easing,function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}}(jQuery),function(a,b){a.effects.highlight=function(b){return this.queue(function(){var c=a(this),d=["backgroundImage","backgroundColor","opacity"],e=a.effects.setMode(c,b.options.mode||"show"),f={backgroundColor:c.css("backgroundColor")};e=="hide"&&(f.opacity=0),a.effects.save(c,d),c.show().css({backgroundImage:"none",backgroundColor:b.options.color||"#ffff99"}).animate(f,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),e=="show"&&!a.support.opacity&&this.style.removeAttribute("filter"),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}}(jQuery),function(a,b){a.effects.pulsate=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"show"),e=(b.options.times||5)*2-1,f=b.duration?b.duration/2:a.fx.speeds._default/2,g=c.is(":visible"),h=0;g||(c.css("opacity",0).show(),h=1),(d=="hide"&&g||d=="show"&&!g)&&e--;for(var i=0;i<e;i++)c.animate({opacity:h},f,b.options.easing),h=(h+1)%2;c.animate({opacity:h},f,b.options.easing,function(){h==0&&c.hide(),b.callback&&b.callback.apply(this,arguments)}),c.queue("fx",function(){c.dequeue()}).dequeue()})}}(jQuery),function(a,b){a.effects.puff=function(b){return this.queue(function(){var c=a(this),d=a.effects.setMode(c,b.options.mode||"hide"),e=parseInt(b.options.percent,10)||150,f=e/100,g={height:c.height(),width:c.width()};a.extend(b.options,{fade:!0,mode:d,percent:d=="hide"?e:100,from:d=="hide"?g:{height:g.height*f,width:g.width*f}}),c.effect("scale",b.options,b.duration,b.callback),c.dequeue()})},a.effects.scale=function(b){return this.queue(function(){var c=a(this),d=a.extend(!0,{},b.options),e=a.effects.setMode(c,b.options.mode||"effect"),f=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:e=="hide"?0:100),g=b.options.direction||"both",h=b.options.origin;e!="effect"&&(d.origin=h||["middle","center"],d.restore=!0);var i={height:c.height(),width:c.width()};c.from=b.options.from||(e=="show"?{height:0,width:0}:i);var j={y:g!="horizontal"?f/100:1,x:g!="vertical"?f/100:1};c.to={height:i.height*j.y,width:i.width*j.x},b.options.fade&&(e=="show"&&(c.from.opacity=0,c.to.opacity=1),e=="hide"&&(c.from.opacity=1,c.to.opacity=0)),d.from=c.from,d.to=c.to,d.mode=e,c.effect("size",d,b.duration,b.callback),c.dequeue()})},a.effects.size=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right","width","height","overflow","opacity"],e=["position","top","bottom","left","right","overflow","opacity"],f=["width","height","overflow"],g=["fontSize"],h=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],i=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],j=a.effects.setMode(c,b.options.mode||"effect"),k=b.options.restore||!1,l=b.options.scale||"both",m=b.options.origin,n={height:c.height(),width:c.width()};c.from=b.options.from||n,c.to=b.options.to||n;if(m){var p=a.effects.getBaseline(m,n);c.from.top=(n.height-c.from.height)*p.y,c.from.left=(n.width-c.from.width)*p.x,c.to.top=(n.height-c.to.height)*p.y,c.to.left=(n.width-c.to.width)*p.x}var q={from:{y:c.from.height/n.height,x:c.from.width/n.width},to:{y:c.to.height/n.height,x:c.to.width/n.width}};if(l=="box"||l=="both")q.from.y!=q.to.y&&(d=d.concat(h),c.from=a.effects.setTransition(c,h,q.from.y,c.from),c.to=a.effects.setTransition(c,h,q.to.y,c.to)),q.from.x!=q.to.x&&(d=d.concat(i),c.from=a.effects.setTransition(c,i,q.from.x,c.from),c.to=a.effects.setTransition(c,i,q.to.x,c.to));(l=="content"||l=="both")&&q.from.y!=q.to.y&&(d=d.concat(g),c.from=a.effects.setTransition(c,g,q.from.y,c.from),c.to=a.effects.setTransition(c,g,q.to.y,c.to)),a.effects.save(c,k?d:e),c.show(),a.effects.createWrapper(c),c.css("overflow","hidden").css(c.from);if(l=="content"||l=="both")h=h.concat(["marginTop","marginBottom"]).concat(g),i=i.concat(["marginLeft","marginRight"]),f=d.concat(h).concat(i),c.find("*[width]").each(function(){var c=a(this);k&&a.effects.save(c,f);var d={height:c.height(),width:c.width()};c.from={height:d.height*q.from.y,width:d.width*q.from.x},c.to={height:d.height*q.to.y,width:d.width*q.to.x},q.from.y!=q.to.y&&(c.from=a.effects.setTransition(c,h,q.from.y,c.from),c.to=a.effects.setTransition(c,h,q.to.y,c.to)),q.from.x!=q.to.x&&(c.from=a.effects.setTransition(c,i,q.from.x,c.from),c.to=a.effects.setTransition(c,i,q.to.x,c.to)),c.css(c.from),c.animate(c.to,b.duration,b.options.easing,function(){k&&a.effects.restore(c,f)})});c.animate(c.to,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){c.to.opacity===0&&c.css("opacity",c.from.opacity),j=="hide"&&c.hide(),a.effects.restore(c,k?d:e),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}}(jQuery),function(a,b){a.effects.shake=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"effect"),f=b.options.direction||"left",g=b.options.distance||20,h=b.options.times||3,i=b.duration||b.options.duration||140;a.effects.save(c,d),c.show(),a.effects.createWrapper(c);var j=f=="up"||f=="down"?"top":"left",k=f=="up"||f=="left"?"pos":"neg",l={},m={},n={};l[j]=(k=="pos"?"-=":"+=")+g,m[j]=(k=="pos"?"+=":"-=")+g*2,n[j]=(k=="pos"?"-=":"+=")+g*2,c.animate(l,i,b.options.easing);for(var p=1;p<h;p++)c.animate(m,i,b.options.easing).animate(n,i,b.options.easing);c.animate(m,i,b.options.easing).animate(l,i/2,b.options.easing,function(){a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments)}),c.queue("fx",function(){c.dequeue()}),c.dequeue()})}}(jQuery),function(a,b){a.effects.slide=function(b){return this.queue(function(){var c=a(this),d=["position","top","bottom","left","right"],e=a.effects.setMode(c,b.options.mode||"show"),f=b.options.direction||"left";a.effects.save(c,d),c.show(),a.effects.createWrapper(c).css({overflow:"hidden"});var g=f=="up"||f=="down"?"top":"left",h=f=="up"||f=="left"?"pos":"neg",i=b.options.distance||(g=="top"?c.outerHeight(!0):c.outerWidth(!0));e=="show"&&c.css(g,h=="pos"?isNaN(i)?"-"+i:-i:i);var j={};j[g]=(e=="show"?h=="pos"?"+=":"-=":h=="pos"?"-=":"+=")+i,c.animate(j,{queue:!1,duration:b.duration,easing:b.options.easing,complete:function(){e=="hide"&&c.hide(),a.effects.restore(c,d),a.effects.removeWrapper(c),b.callback&&b.callback.apply(this,arguments),c.dequeue()}})})}}(jQuery),function(a,b){a.effects.transfer=function(b){return this.queue(function(){var c=a(this),d=a(b.options.to),e=d.offset(),f={top:e.top,left:e.left,height:d.innerHeight(),width:d.innerWidth()},g=c.offset(),h=a('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(b.options.className).css({top:g.top,left:g.left,height:c.innerHeight(),width:c.innerWidth(),position:"absolute"}).animate(f,b.duration,b.options.easing,function(){h.remove(),b.callback&&b.callback.apply(c[0],arguments),c.dequeue()})})}}(jQuery),function(a,b){a.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:!0,clearStyle:!1,collapsible:!1,event:"click",fillSpace:!1,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var b=this,c=b.options;b.running=0,b.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"),b.headers=b.element.find(c.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){if(c.disabled)return;a(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){if(c.disabled)return;a(this).removeClass("ui-state-focus")}),b.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");if(c.navigation){var d=b.element.find("a").filter(c.navigationFilter).eq(0);if(d.length){var e=d.closest(".ui-accordion-header");e.length?b.active=e:b.active=d.closest(".ui-accordion-content").prev()}}b.active=b._findActive(b.active||c.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"),b.active.next().addClass("ui-accordion-content-active"),b._createIcons(),b.resize(),b.element.attr("role","tablist"),b.headers.attr("role","tab").bind("keydown.accordion",function(a){return b._keydown(a)}).next().attr("role","tabpanel"),b.headers.not(b.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide(),b.active.length?b.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):b.headers.eq(0).attr("tabIndex",0),a.browser.safari||b.headers.find("a").attr("tabIndex",-1),c.event&&b.headers.bind(c.event.split(" ").join(".accordion ")+".accordion",function(a){b._clickHandler.call(b,a,this),a.preventDefault()})},_createIcons:function(){var b=this.options;b.icons&&(a("<span></span>").addClass("ui-icon "+b.icons.header).prependTo(this.headers),this.active.children(".ui-icon").toggleClass(b.icons.header).toggleClass(b.icons.headerSelected),this.element.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.children(".ui-icon").remove(),this.element.removeClass("ui-accordion-icons")},destroy:function(){var b=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"),this.headers.find("a").removeAttr("tabIndex"),this._destroyIcons();var c=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");return(b.autoHeight||b.fillHeight)&&c.css("height",""),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b=="active"&&this.activate(c),b=="icons"&&(this._destroyIcons(),c&&this._createIcons()),b=="disabled"&&this.headers.add(this.headers.next())[c?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(b){if(this.options.disabled||b.altKey||b.ctrlKey)return;var c=a.ui.keyCode,d=this.headers.length,e=this.headers.index(b.target),f=!1;switch(b.keyCode){case c.RIGHT:case c.DOWN:f=this.headers[(e+1)%d];break;case c.LEFT:case c.UP:f=this.headers[(e-1+d)%d];break;case c.SPACE:case c.ENTER:this._clickHandler({target:b.target},b.target),b.preventDefault()}return f?(a(b.target).attr("tabIndex",-1),a(f).attr("tabIndex",0),f.focus(),!1):!0},resize:function(){var b=this.options,c;if(b.fillSpace){if(a.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}c=this.element.parent().height(),a.browser.msie&&this.element.parent().css("overflow",d),this.headers.each(function(){c-=a(this).outerHeight(!0)}),this.headers.next().each(function(){a(this).height(Math.max(0,c-a(this).innerHeight()+a(this).height()))}).css("overflow","auto")}else b.autoHeight&&(c=0,this.headers.next().each(function(){c=Math.max(c,a(this).height("").height())}).height(c));return this},activate:function(a){this.options.active=a;var b=this._findActive(a)[0];return this._clickHandler({target:b},b),this},_findActive:function(b){return b?typeof b=="number"?this.headers.filter(":eq("+b+")"):this.headers.not(this.headers.not(b)):b===!1?a([]):this.headers.filter(":eq(0)")},_clickHandler:function(b,c){var d=this.options;if(d.disabled)return;if(!b.target){if(!d.collapsible)return;this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),this.active.next().addClass("ui-accordion-content-active");var e=this.active.next(),f={options:d,newHeader:a([]),oldHeader:d.active,newContent:a([]),oldContent:e},g=this.active=a([]);this._toggle(g,e,f);return}var h=a(b.currentTarget||c),i=h[0]===this.active[0];d.active=d.collapsible&&i?!1:this.headers.index(h);if(this.running||!d.collapsible&&i)return;var j=this.active,g=h.next(),e=this.active.next(),f={options:d,newHeader:i&&d.collapsible?a([]):h,oldHeader:this.active,newContent:i&&d.collapsible?a([]):g,oldContent:e},k=this.headers.index(this.active[0])>this.headers.index(h[0]);this.active=i?a([]):h,this._toggle(g,e,f,i,k),j.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header),i||(h.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected),h.next().addClass("ui-accordion-content-active"));return},_toggle:function(b,c,d,e,f){var g=this,h=g.options;g.toShow=b,g.toHide=c,g.data=d;var i=function(){if(!g)return;return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data),g.running=c.size()===0?b.size():c.size();if(h.animated){var j={};h.collapsible&&e?j={toShow:a([]),toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace}:j={toShow:b,toHide:c,complete:i,down:f,autoHeight:h.autoHeight||h.fillSpace},h.proxied||(h.proxied=h.animated),h.proxiedDuration||(h.proxiedDuration=h.duration),h.animated=a.isFunction(h.proxied)?h.proxied(j):h.proxied,h.duration=a.isFunction(h.proxiedDuration)?h.proxiedDuration(j):h.proxiedDuration;var k=a.ui.accordion.animations,l=h.duration,m=h.animated;m&&!k[m]&&!a.easing[m]&&(m="slide"),k[m]||(k[m]=function(a){this.slide(a,{easing:m,duration:l||700})}),k[m](j)}else h.collapsible&&e?b.toggle():(c.hide(),b.show()),i(!0);c.prev().attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).blur(),b.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(this.running)return;this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""}),this.toHide.removeClass("ui-accordion-content-active"),this.toHide.length&&(this.toHide.parent()[0].className=this.toHide.parent()[0].className),this._trigger("change",null,this.data)}}),a.extend(a.ui.accordion,{version:"1.8.23",animations:{slide:function(b,c){b=a.extend({easing:"swing",duration:300},b,c);if(!b.toHide.size()){b.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},b);return}if(!b.toShow.size()){b.toHide.animate({height:"hide",paddingTop:"hide",paddingBottom:"hide"},b);return}var d=b.toShow.css("overflow"),e=0,f={},g={},h=["height","paddingTop","paddingBottom"],i,j=b.toShow;i=j[0].style.width,j.width(j.parent().width()-parseFloat(j.css("paddingLeft"))-parseFloat(j.css("paddingRight"))-(parseFloat(j.css("borderLeftWidth"))||0)-(parseFloat(j.css("borderRightWidth"))||0)),a.each(h,function(c,d){g[d]="hide";var e=(""+a.css(b.toShow[0],d)).match(/^([\d+-.]+)(.*)$/);f[d]={value:e[1],unit:e[2]||"px"}}),b.toShow.css({height:0,overflow:"hidden"}).show(),b.toHide.filter(":hidden").each(b.complete).end().filter(":visible").animate(g,{step:function(a,c){c.prop=="height"&&(e=c.end-c.start===0?0:(c.now-c.start)/(c.end-c.start)),b.toShow[0].style[c.prop]=e*f[c.prop].value+f[c.prop].unit},duration:b.duration,easing:b.easing,complete:function(){b.autoHeight||b.toShow.css("height",""),b.toShow.css({width:i,overflow:d}),b.complete()}})},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1e3:200})}}})}(jQuery),function(a,b){var c=0;a.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var b=this,c=this.element[0].ownerDocument,d;this.isMultiLine=this.element.is("textarea"),this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(b.options.disabled||b.element.propAttr("readOnly"))return;d=!1;var e=a.ui.keyCode;switch(c.keyCode){case e.PAGE_UP:b._move("previousPage",c);break;case e.PAGE_DOWN:b._move("nextPage",c);break;case e.UP:b._keyEvent("previous",c);break;case e.DOWN:b._keyEvent("next",c);break;case e.ENTER:case e.NUMPAD_ENTER:b.menu.active&&(d=!0,c.preventDefault());case e.TAB:if(!b.menu.active)return;b.menu.select(c);break;case e.ESCAPE:b.element.val(b.term),b.close(c);break;default:clearTimeout(b.searching),b.searching=setTimeout(function(){b.term!=b.element.val()&&(b.selectedItem=null,b.search(null,c))},b.options.delay)}}).bind("keypress.autocomplete",function(a){d&&(d=!1,a.preventDefault())}).bind("focus.autocomplete",function(){if(b.options.disabled)return;b.selectedItem=null,b.previous=b.element.val()}).bind("blur.autocomplete",function(a){if(b.options.disabled)return;clearTimeout(b.searching),b.closing=setTimeout(function(){b.close(a),b._change(a)},150)}),this._initSource(),this.menu=a("<ul></ul>").addClass("ui-autocomplete").appendTo(a(this.options.appendTo||"body",c)[0]).mousedown(function(c){var d=b.menu.element[0];a(c.target).closest(".ui-menu-item").length||setTimeout(function(){a(document).one("mousedown",function(c){c.target!==b.element[0]&&c.target!==d&&!a.ui.contains(d,c.target)&&b.close()})},1),setTimeout(function(){clearTimeout(b.closing)},13)}).menu({focus:function(a,c){var d=c.item.data("item.autocomplete");!1!==b._trigger("focus",a,{item:d})&&/^key/.test(a.originalEvent.type)&&b.element.val(d.value)},selected:function(a,d){var e=d.item.data("item.autocomplete"),f=b.previous;b.element[0]!==c.activeElement&&(b.element.focus(),b.previous=f,setTimeout(function(){b.previous=f,b.selectedItem=e},1)),!1!==b._trigger("select",a,{item:e})&&b.element.val(e.value),b.term=b.element.val(),b.close(a),b.selectedItem=e},blur:function(a,c){b.menu.element.is(":visible")&&b.element.val()!==b.term&&b.element.val(b.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"),a.fn.bgiframe&&this.menu.element.bgiframe(),b.beforeunloadHandler=function(){b.element.removeAttr("autocomplete")},a(window).bind("beforeunload",b.beforeunloadHandler)},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),this.menu.element.remove(),a(window).unbind("beforeunload",this.beforeunloadHandler),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments),b==="source"&&this._initSource(),b==="appendTo"&&this.menu.element.appendTo(a(c||"body",this.element[0].ownerDocument)[0]),b==="disabled"&&c&&this.xhr&&this.xhr.abort()},_initSource:function(){var b=this,c,d;a.isArray(this.options.source)?(c=this.options.source,this.source=function(b,d){d(a.ui.autocomplete.filter(c,b.term))}):typeof this.options.source=="string"?(d=this.options.source,this.source=function(c,e){b.xhr&&b.xhr.abort(),b.xhr=a.ajax({url:d,data:c,dataType:"json",success:function(a,b){e(a)},error:function(){e([])}})}):this.source=this.options.source},search:function(a,b){a=a!=null?a:this.element.val(),this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)===!1)return;return this._search(a)},_search:function(a){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.source({term:a},this._response())},_response:function(){var a=this,b=++c;return function(d){b===c&&a.__response(d),a.pending--,a.pending||a.element.removeClass("ui-autocomplete-loading")}},__response:function(a){!this.options.disabled&&a&&a.length?(a=this._normalize(a),this._suggest(a),this._trigger("open")):this.close()},close:function(a){clearTimeout(this.closing),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.deactivate(),this._trigger("close",a))},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(b){return b.length&&b[0].label&&b[0].value?b:a.map(b,function(b){return typeof b=="string"?{label:b,value:b}:a.extend({label:b.label||b.value,value:b.value||b.label},b)})},_suggest:function(b){var c=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(c,b),this.menu.deactivate(),this.menu.refresh(),c.show(),this._resizeMenu(),c.position(a.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(new a.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(b,c){var d=this;a.each(c,function(a,c){d._renderItem(b,c)})},_renderItem:function(b,c){return a("<li></li>").data("item.autocomplete",c).append(a("<a></a>").text(c.label)).appendTo(b)},_move:function(a,b){if(!this.menu.element.is(":visible")){this.search(null,b);return}if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term),this.menu.deactivate();return}this.menu[a](b)},widget:function(){return this.menu.element},_keyEvent:function(a,b){if(!this.isMultiLine||this.menu.element.is(":visible"))this._move(a,b),b.preventDefault()}}),a.extend(a.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},filter:function(b,c){var d=new RegExp(a.ui.autocomplete.escapeRegex(c),"i");return a.grep(b,function(a){return d.test(a.label||a.value||a)})}})}(jQuery),function(a){a.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){if(!a(c.target).closest(".ui-menu-item a").length)return;c.preventDefault(),b.select(c)}),this.refresh()},refresh:function(){var b=this,c=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");c.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(c){b.activate(c,a(this).parent())}).mouseleave(function(){b.deactivate()})},activate:function(a,b){this.deactivate();if(this.hasScroll()){var c=b.offset().top-this.element.offset().top,d=this.element.scrollTop(),e=this.element.height();c<0?this.element.scrollTop(d+c):c>=e&&this.element.scrollTop(d+c-e+b.height())}this.active=b.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end(),this._trigger("focus",a,{item:b})},deactivate:function(){if(!this.active)return;this.active.children("a").removeClass("ui-state-hover").removeAttr("id"),this._trigger("blur"),this.active=null},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(a,b,c){if(!this.active){this.activate(c,this.element.children(b));return}var d=this.active[a+"All"](".ui-menu-item").eq(0);d.length?this.activate(c,d):this.activate(c,this.element.children(b))},nextPage:function(b){if(this.hasScroll()){if(!this.active||this.last()){this.activate(b,this.element.children(".ui-menu-item:first"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c-d+a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:last")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(b){if(this.hasScroll()){if(!this.active||this.first()){this.activate(b,this.element.children(".ui-menu-item:last"));return}var c=this.active.offset().top,d=this.element.height(),e=this.element.children(".ui-menu-item").filter(function(){var b=a(this).offset().top-c+d-a(this).height();return b<10&&b>-10});e.length||(e=this.element.children(".ui-menu-item:first")),this.activate(b,e)}else this.activate(b,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element[a.fn.prop?"prop":"attr"]("scrollHeight")},select:function(a){this._trigger("selected",a,{item:this.active})}})}(jQuery),function(a,b){var c,d,e,f,g="ui-button ui-widget ui-state-default ui-corner-all",h="ui-state-hover ui-state-active ",i="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",j=function(){var b=a(this).find(":ui-button");setTimeout(function(){b.button("refresh")},1)},k=function(b){var c=b.name,d=b.form,e=a([]);return c&&(d?e=a(d).find("[name='"+c+"']"):e=a("[name='"+c+"']",b.ownerDocument).filter(function(){return!this.form})),e};a.widget("ui.button",{options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",j),typeof this.options.disabled!="boolean"?this.options.disabled=!!this.element.propAttr("disabled"):this.element.propAttr("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var b=this,h=this.options,i=this.type==="checkbox"||this.type==="radio",l="ui-state-hover"+(i?"":" ui-state-active"),m="ui-state-focus";h.label===null&&(h.label=this.buttonElement.html()),this.buttonElement.addClass(g).attr("role","button").bind("mouseenter.button",function(){if(h.disabled)return;a(this).addClass("ui-state-hover"),this===c&&a(this).addClass("ui-state-active")}).bind("mouseleave.button",function(){if(h.disabled)return;a(this).removeClass(l)}).bind("click.button",function(a){h.disabled&&(a.preventDefault(),a.stopImmediatePropagation())}),this.element.bind("focus.button",function(){b.buttonElement.addClass(m)}).bind("blur.button",function(){b.buttonElement.removeClass(m)}),i&&(this.element.bind("change.button",function(){if(f)return;b.refresh()}),this.buttonElement.bind("mousedown.button",function(a){if(h.disabled)return;f=!1,d=a.pageX,e=a.pageY}).bind("mouseup.button",function(a){if(h.disabled)return;if(d!==a.pageX||e!==a.pageY)f=!0})),this.type==="checkbox"?this.buttonElement.bind("click.button",function(){if(h.disabled||f)return!1;a(this).toggleClass("ui-state-active"),b.buttonElement.attr("aria-pressed",b.element[0].checked)}):this.type==="radio"?this.buttonElement.bind("click.button",function(){if(h.disabled||f)return!1;a(this).addClass("ui-state-active"),b.buttonElement.attr("aria-pressed","true");var c=b.element[0];k(c).not(c).map(function(){return a(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown.button",function(){if(h.disabled)return!1;a(this).addClass("ui-state-active"),c=this,a(document).one("mouseup",function(){c=null})}).bind("mouseup.button",function(){if(h.disabled)return!1;a(this).removeClass("ui-state-active")}).bind("keydown.button",function(b){if(h.disabled)return!1;(b.keyCode==a.ui.keyCode.SPACE||b.keyCode==a.ui.keyCode.ENTER)&&a(this).addClass("ui-state-active")}).bind("keyup.button",function(){a(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(b){b.keyCode===a.ui.keyCode.SPACE&&a(this).click()})),this._setOption("disabled",h.disabled),this._resetButton()},_determineButtonType:function(){this.element.is(":checkbox")?this.type="checkbox":this.element.is(":radio")?this.type="radio":this.element.is("input")?this.type="input":this.type="button";if(this.type==="checkbox"||this.type==="radio"){var a=this.element.parents().filter(":last"),b="label[for='"+this.element.attr("id")+"']";this.buttonElement=a.find(b),this.buttonElement.length||(a=a.length?a.siblings():this.element.siblings(),this.buttonElement=a.filter(b),this.buttonElement.length||(this.buttonElement=a.find(b))),this.element.addClass("ui-helper-hidden-accessible");var c=this.element.is(":checked");c&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.attr("aria-pressed",c)}else this.buttonElement=this.element},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(g+" "+h+" "+i).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title"),a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);if(b==="disabled"){c?this.element.propAttr("disabled",!0):this.element.propAttr("disabled",!1);return}this._resetButton()},refresh:function(){var b=this.element.is(":disabled");b!==this.options.disabled&&this._setOption("disabled",b),this.type==="radio"?k(this.element[0]).each(function(){a(this).is(":checked")?a(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):a(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):this.type==="checkbox"&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if(this.type==="input"){this.options.label&&this.element.val(this.options.label);return}var b=this.buttonElement.removeClass(i),c=a("<span></span>",this.element[0].ownerDocument).addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,e=d.primary&&d.secondary,f=[];d.primary||d.secondary?(this.options.text&&f.push("ui-button-text-icon"+(e?"s":d.primary?"-primary":"-secondary")),d.primary&&b.prepend("<span class='ui-button-icon-primary ui-icon "+d.primary+"'></span>"),d.secondary&&b.append("<span class='ui-button-icon-secondary ui-icon "+d.secondary+"'></span>"),this.options.text||(f.push(e?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||b.attr("title",c))):f.push("ui-button-text-only"),b.addClass(f.join(" "))}}),a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c),a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var b=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(b?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(b?"ui-corner-left":"ui-corner-right").end().end()},destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"),a.Widget.prototype.destroy.call(this)}})}(jQuery),function($,undefined){function Datepicker(){this.debug=!1,this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$.extend(this._defaults,this.regional[""]),this.dpDiv=bindHover($('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function bindHover(a){var b="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return a.bind("mouseout",function(a){var c=$(a.target).closest(b);if(!c.length)return;c.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(c){var d=$(c.target).closest(b);if($.datepicker._isDisabledDatepicker(instActive.inline?a.parent()[0]:instActive.input[0])||!d.length)return;d.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),d.addClass("ui-state-hover"),d.hasClass("ui-datepicker-prev")&&d.addClass("ui-datepicker-prev-hover"),d.hasClass("ui-datepicker-next")&&d.addClass("ui-datepicker-next-hover")})}function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a}function isArray(a){return a&&($.browser.safari&&typeof a=="object"&&a.length||a.constructor&&a.constructor.toString().match(/\Array\(\)/))}$.extend($.ui,{datepicker:{version:"1.8.23"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){return extendRemove(this._defaults,a||{}),this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:function(a,b){var c=a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:b?bindHover($('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')):this.dpDiv}},_connectDatepicker:function(a,b){var c=$(a);b.append=$([]),b.trigger=$([]);if(c.hasClass(this.markerClassName))return;this._attachments(c,b),c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),this._autoSize(b),$.data(a,PROP_NAME,b),b.settings.disabled&&this._disableDatepicker(a)},_attachments:function(a,b){var c=this._get(b,"appendText"),d=this._get(b,"isRTL");b.append&&b.append.remove(),c&&(b.append=$('<span class="'+this._appendClass+'">'+c+"</span>"),a[d?"before":"after"](b.append)),a.unbind("focus",this._showDatepicker),b.trigger&&b.trigger.remove();var e=this._get(b,"showOn");(e=="focus"||e=="both")&&a.focus(this._showDatepicker);if(e=="button"||e=="both"){var f=this._get(b,"buttonText"),g=this._get(b,"buttonImage");b.trigger=$(this._get(b,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:g,alt:f,title:f}):$('<button type="button"></button>').addClass(this._triggerClass).html(g==""?f:$("<img/>").attr({src:g,alt:f,title:f}))),a[d?"before":"after"](b.trigger),b.trigger.click(function(){return $.datepicker._datepickerShowing&&$.datepicker._lastInput==a[0]?$.datepicker._hideDatepicker():$.datepicker._datepickerShowing&&$.datepicker._lastInput!=a[0]?($.datepicker._hideDatepicker(),$.datepicker._showDatepicker(a[0])):$.datepicker._showDatepicker(a[0]),!1})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var d=function(a){var b=0,c=0;for(var d=0;d<a.length;d++)a[d].length>b&&(b=a[d].length,c=d);return c};b.setMonth(d(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort"))),b.setDate(d(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=$(a);if(c.hasClass(this.markerClassName))return;c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(a,c,d){b.settings[c]=d}).bind("getData.datepicker",function(a,c){return this._get(b,c)}),$.data(a,PROP_NAME,b),this._setDate(b,this._getDefaultDate(b),!0),this._updateDatepicker(b),this._updateAlternate(b),b.settings.disabled&&this._disableDatepicker(a),b.dpDiv.css("display","block")},_dialogDatepicker:function(a,b,c,d,e){var f=this._dialogInst;if(!f){this.uuid+=1;var g="dp"+this.uuid;this._dialogInput=$('<input type="text" id="'+g+'" style="position: absolute; top: -100px; width: 0px;"/>'),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),f=this._dialogInst=this._newInst(this._dialogInput,!1),f.settings={},$.data(this._dialogInput[0],PROP_NAME,f)}extendRemove(f.settings,d||{}),b=b&&b.constructor==Date?this._formatDate(f,b):b,this._dialogInput.val(b),this._pos=e?e.length?e:[e.pageX,e.pageY]:null;if(!this._pos){var h=document.documentElement.clientWidth,i=document.documentElement.clientHeight,j=document.documentElement.scrollLeft||document.body.scrollLeft,k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[h/2-100+j,i/2-150+k]}return this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),f.settings.onSelect=c,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,f),this},_destroyDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();$.removeData(a,PROP_NAME),d=="input"?(c.append.remove(),c.trigger.remove(),b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(d=="div"||d=="span")&&b.removeClass(this.markerClassName).empty()},_enableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!1,c.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().removeClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b})},_disableDatepicker:function(a){var b=$(a),c=$.data(a,PROP_NAME);if(!b.hasClass(this.markerClassName))return;var d=a.nodeName.toLowerCase();if(d=="input")a.disabled=!0,c.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(d=="div"||d=="span"){var e=b.children("."+this._inlineClass);e.children().addClass("ui-state-disabled"),e.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=$.map(this._disabledInputs,function(b){return b==a?null:b}),this._disabledInputs[this._disabledInputs.length]=a},_isDisabledDatepicker:function(a){if(!a)return!1;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return!0;return!1},_getInst:function(a){try{return $.data(a,PROP_NAME)}catch(b){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(a,b,c){var d=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?$.extend({},$.datepicker._defaults):d?b=="all"?$.extend({},d.settings):this._get(d,b):null;var e=b||{};typeof b=="string"&&(e={},e[b]=c);if(d){this._curInst==d&&this._hideDatepicker();var f=this._getDateDatepicker(a,!0),g=this._getMinMaxDate(d,"min"),h=this._getMinMaxDate(d,"max");extendRemove(d.settings,e),g!==null&&e.dateFormat!==undefined&&e.minDate===undefined&&(d.settings.minDate=this._formatDate(d,g)),h!==null&&e.dateFormat!==undefined&&e.maxDate===undefined&&(d.settings.maxDate=this._formatDate(d,h)),this._attachments($(a),d),this._autoSize(d),this._setDate(d,f),this._updateAlternate(d),this._updateDatepicker(d)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){var b=this._getInst(a);b&&this._updateDatepicker(b)},_setDateDatepicker:function(a,b){var c=this._getInst(a);c&&(this._setDate(c,b),this._updateDatepicker(c),this._updateAlternate(c))},_getDateDatepicker:function(a,b){var c=this._getInst(a);return c&&!c.inline&&this._setDateFromField(c,b),c?this._getDate(c):null},_doKeyDown:function(a){var b=$.datepicker._getInst(a.target),c=!0,d=b.dpDiv.is(".ui-datepicker-rtl");b._keyEvent=!0;if($.datepicker._datepickerShowing)switch(a.keyCode){case 9:$.datepicker._hideDatepicker(),c=!1;break;case 13:var e=$("td."+$.datepicker._dayOverClass+":not(."+$.datepicker._currentClass+")",b.dpDiv);e[0]&&$.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,e[0]);var f=$.datepicker._get(b,"onSelect");if(f){var g=$.datepicker._formatDate(b);f.apply(b.input?b.input[0]:null,[g,b])}else $.datepicker._hideDatepicker();return!1;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(a.target,a.ctrlKey?-$.datepicker._get(b,"stepBigMonths"):-$.datepicker._get(b,"stepMonths"),"M");break;case 34:$.datepicker._adjustDate(a.target,a.ctrlKey?+$.datepicker._get(b,"stepBigMonths"):+$.datepicker._get(b,"stepMonths"),"M");break;case 35:(a.ctrlKey||a.metaKey)&&$.datepicker._clearDate(a.target),c=a.ctrlKey||a.metaKey;break;case 36:(a.ctrlKey||a.metaKey)&&$.datepicker._gotoToday(a.target),c=a.ctrlKey||a.metaKey;break;case 37:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,d?1:-1,"D"),c=a.ctrlKey||a.metaKey,a.originalEvent.altKey&&$.datepicker._adjustDate(a.target,a.ctrlKey?-$.datepicker._get(b,"stepBigMonths"):-$.datepicker._get(b,"stepMonths"),"M");break;case 38:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,-7,"D"),c=a.ctrlKey||a.metaKey;break;case 39:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,d?-1:1,"D"),c=a.ctrlKey||a.metaKey,a.originalEvent.altKey&&$.datepicker._adjustDate(a.target,a.ctrlKey?+$.datepicker._get(b,"stepBigMonths"):+$.datepicker._get(b,"stepMonths"),"M");break;case 40:(a.ctrlKey||a.metaKey)&&$.datepicker._adjustDate(a.target,7,"D"),c=a.ctrlKey||a.metaKey;break;default:c=!1}else a.keyCode==36&&a.ctrlKey?$.datepicker._showDatepicker(this):c=!1;c&&(a.preventDefault(),a.stopPropagation())},_doKeyPress:function(a){var b=$.datepicker._getInst(a.target);if($.datepicker._get(b,"constrainInput")){var c=$.datepicker._possibleChars($.datepicker._get(b,"dateFormat")),d=String.fromCharCode(a.charCode==undefined?a.keyCode:a.charCode);return a.ctrlKey||a.metaKey||d<" "||!c||c.indexOf(d)>-1}},_doKeyUp:function(a){var b=$.datepicker._getInst(a.target);if(b.input.val()!=b.lastVal)try{var c=$.datepicker.parseDate($.datepicker._get(b,"dateFormat"),b.input?b.input.val():null,$.datepicker._getFormatConfig(b));c&&($.datepicker._setDateFromField(b),$.datepicker._updateAlternate(b),$.datepicker._updateDatepicker(b))}catch(d){$.datepicker.log(d)}return!0},_showDatepicker:function(a){a=a.target||a,a.nodeName.toLowerCase()!="input"&&(a=$("input",a.parentNode)[0]);if($.datepicker._isDisabledDatepicker(a)||$.datepicker._lastInput==a)return;var b=$.datepicker._getInst(a);$.datepicker._curInst&&$.datepicker._curInst!=b&&($.datepicker._curInst.dpDiv.stop(!0,!0),b&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var c=$.datepicker._get(b,"beforeShow"),d=c?c.apply(a,[a,b]):{};if(d===!1)return;extendRemove(b.settings,d),b.lastVal=null,$.datepicker._lastInput=a,$.datepicker._setDateFromField(b),$.datepicker._inDialog&&(a.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(a),$.datepicker._pos[1]+=a.offsetHeight);var e=!1;$(a).parents().each(function(){return e|=$(this).css("position")=="fixed",!e}),e&&$.browser.opera&&($.datepicker._pos[0]-=document.documentElement.scrollLeft,$.datepicker._pos[1]-=document.documentElement.scrollTop);var f={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,b.dpDiv.empty(),b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(b),f=$.datepicker._checkOffset(b,f,e),b.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":e?"fixed":"absolute",display:"none",left:f.left+"px",top:f.top+"px"});if(!b.inline){var g=$.datepicker._get(b,"showAnim"),h=$.datepicker._get(b,"duration"),i=function(){var a=b.dpDiv.find("iframe.ui-datepicker-cover");if(!!a.length){var c=$.datepicker._getBorders(b.dpDiv);a.css({left:-c[0],top:-c[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex($(a).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&$.effects[g]?b.dpDiv.show(g,$.datepicker._get(b,"showOptions"),h,i):b.dpDiv[g||"show"](g?h:null,i),(!g||!h)&&i(),b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus(),$.datepicker._curInst=b}},_updateDatepicker:function(a){var b=this;b.maxRows=4;var c=$.datepicker._getBorders(a.dpDiv);instActive=a,a.dpDiv.empty().append(this._generateHTML(a)),this._attachHandlers(a);var d=a.dpDiv.find("iframe.ui-datepicker-cover");!d.length||d.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}),a.dpDiv.find("."+this._dayOverClass+" a").mouseover();var e=this._getNumberOfMonths(a),f=e[1],g=17;a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),f>1&&a.dpDiv.addClass("ui-datepicker-multi-"+f).css("width",g*f+"em"),a.dpDiv[(e[0]!=1||e[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),a==$.datepicker._curInst&&$.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var h=a.yearshtml;setTimeout(function(){h===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml),h=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var d=a.dpDiv.outerWidth(),e=a.dpDiv.outerHeight(),f=a.input?a.input.outerWidth():0,g=a.input?a.input.outerHeight():0,h=document.documentElement.clientWidth+(c?0:$(document).scrollLeft()),i=document.documentElement.clientHeight+(c?0:$(document).scrollTop());return b.left-=this._get(a,"isRTL")?d-f:0,b.left-=c&&b.left==a.input.offset().left?$(document).scrollLeft():0,b.top-=c&&b.top==a.input.offset().top+g?$(document).scrollTop():0,b.left-=Math.min(b.left,b.left+d>h&&h>d?Math.abs(b.left+d-h):0),b.top-=Math.min(b.top,b.top+e>i&&i>e?Math.abs(e+g):0),b},_findPos:function(a){var b=this._getInst(a),c=this._get(b,"isRTL");while(a&&(a.type=="hidden"||a.nodeType!=1||$.expr.filters.hidden(a)))a=a[c?"previousSibling":"nextSibling"];var d=$(a).offset();return[d.left,d.top]},_hideDatepicker:function(a){var b=this._curInst;if(!b||a&&b!=$.data(a,PROP_NAME))return;if(this._datepickerShowing){var c=this._get(b,"showAnim"),d=this._get(b,"duration"),e=function(){$.datepicker._tidyDialog(b)};$.effects&&$.effects[c]?b.dpDiv.hide(c,$.datepicker._get(b,"showOptions"),d,e):b.dpDiv[c=="slideDown"?"slideUp":c=="fadeIn"?"fadeOut":"hide"](c?d:null,e),c||e(),this._datepickerShowing=!1;var f=this._get(b,"onClose");f&&f.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(!$.datepicker._curInst)return;var b=$(a.target),c=$.datepicker._getInst(b[0]);(b[0].id!=$.datepicker._mainDivId&&b.parents("#"+$.datepicker._mainDivId).length==0&&!b.hasClass($.datepicker.markerClassName)&&!b.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||b.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=c)&&$.datepicker._hideDatepicker()},_adjustDate:function(a,b,c){var d=$(a),e=this._getInst(d[0]);if(this._isDisabledDatepicker(d[0]))return;this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c),this._updateDatepicker(e)},_gotoToday:function(a){var b=$(a),c=this._getInst(b[0]);if(this._get(c,"gotoCurrent")&&c.currentDay)c.selectedDay=c.currentDay,c.drawMonth=c.selectedMonth=c.currentMonth,c.drawYear=c.selectedYear=c.currentYear;else{var d=new Date;c.selectedDay=d.getDate(),c.drawMonth=c.selectedMonth=d.getMonth(),c.drawYear=c.selectedYear=d.getFullYear()}this._notifyChange(c),this._adjustDate(b)},_selectMonthYear:function(a,b,c){var d=$(a),e=this._getInst(d[0]);e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10),this._notifyChange(e),this._adjustDate(d)},_selectDay:function(a,b,c,d){var e=$(a);if($(d).hasClass(this._unselectableClass)||this._isDisabledDatepicker(e[0]))return;var f=this._getInst(e[0]);f.selectedDay=f.currentDay=$("a",d).html(),f.selectedMonth=f.currentMonth=b,f.selectedYear=f.currentYear=c,this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))},_clearDate:function(a){var b=$(a),c=this._getInst(b[0]);this._selectDate(b,"")},_selectDate:function(a,b){var c=$(a),d=this._getInst(c[0]);b=b!=null?b:this._formatDate(d),d.input&&d.input.val(b),this._updateAlternate(d);var e=this._get(d,"onSelect");e?e.apply(d.input?d.input[0]:null,[b,d]):d.input&&d.input.trigger("change"),d.inline?this._updateDatepicker(d):(this._hideDatepicker(),this._lastInput=d.input[0],typeof d.input[0]!="object"&&d.input.focus(),this._lastInput=null)},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),d=this._getDate(a),e=this.formatDate(c,d,this._getFormatConfig(a));$(b).each(function(){$(this).val(e)})}},noWeekends:function(a){var b=a.getDay();return[b>0&&b<6,""]},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();return b.setMonth(0),b.setDate(1),Math.floor(Math.round((c-b)/864e5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var d=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;d=typeof d!="string"?d:(new Date).getFullYear()%100+parseInt(d,10);var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,g=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,h=(c?c.monthNames:null)||this._defaults.monthNames,i=-1,j=-1,k=-1,l=-1,m=!1,n=function(b){var c=s+1<a.length&&a.charAt(s+1)==b;return c&&s++,c},o=function(a){var c=n(a),d=a=="@"?14:a=="!"?20:a=="y"&&c?4:a=="o"?3:2,e=new RegExp("^\\d{1,"+d+"}"),f=b.substring(r).match(e);if(!f)throw"Missing number at position "+r;return r+=f[0].length,parseInt(f[0],10)},p=function(a,c,d){var e=$.map(n(a)?d:c,function(a,b){return[[b,a]]}).sort(function(a,b){return-(a[1].length-b[1].length)}),f=-1;$.each(e,function(a,c){var d=c[1];if(b.substr(r,d.length).toLowerCase()==d.toLowerCase())return f=c[0],r+=d.length,!1});if(f!=-1)return f+1;throw"Unknown name at position "+r},q=function(){if(b.charAt(r)!=a.charAt(s))throw"Unexpected literal at position "+r;r++},r=0;for(var s=0;s<a.length;s++)if(m)a.charAt(s)=="'"&&!n("'")?m=!1:q();else switch(a.charAt(s)){case"d":k=o("d");break;case"D":p("D",e,f);break;case"o":l=o("o");break;case"m":j=o("m");break;case"M":j=p("M",g,h);break;case"y":i=o("y");break;case"@":var t=new Date(o("@"));i=t.getFullYear(),j=t.getMonth()+1,k=t.getDate();break;case"!":var t=new Date((o("!")-this._ticksTo1970)/1e4);i=t.getFullYear(),j=t.getMonth()+1,k=t.getDate();break;case"'":n("'")?q():m=!0;break;default:q()}if(r<b.length)throw"Extra/unparsed characters found in date: "+b.substring(r);i==-1?i=(new Date).getFullYear():i<100&&(i+=(new Date).getFullYear()-(new Date).getFullYear()%100+(i<=d?0:-100));if(l>-1){j=1,k=l;do{var u=this._getDaysInMonth(i,j-1);if(k<=u)break;j++,k-=u}while(!0)}var t=this._daylightSavingAdjust(new Date(i,j-1,k));if(t.getFullYear()!=i||t.getMonth()+1!=j||t.getDate()!=k)throw"Invalid date";return t},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(a,b,c){if(!b)return"";var d=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,e=(c?c.dayNames:null)||this._defaults.dayNames,f=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,h=function(b){var c=m+1<a.length&&a.charAt(m+1)==b;return c&&m++,c},i=function(a,b,c){var d=""+b;if(h(a))while(d.length<c)d="0"+d;return d},j=function(a,b,c,d){return h(a)?d[b]:c[b]},k="",l=!1;if(b)for(var m=0;m<a.length;m++)if(l)a.charAt(m)=="'"&&!h("'")?l=!1:k+=a.charAt(m);else switch(a.charAt(m)){case"d":k+=i("d",b.getDate(),2);break;case"D":k+=j("D",b.getDay(),d,e);break;case"o":k+=i("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864e5),3);break;case"m":k+=i("m",b.getMonth()+1,2);break;case"M":k+=j("M",b.getMonth(),f,g);break;case"y":k+=h("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case"@":k+=b.getTime();break;case"!":k+=b.getTime()*1e4+this._ticksTo1970;break;case"'":h("'")?k+="'":l=!0;break;default:k+=a.charAt(m)}return k},_possibleChars:function(a){var b="",c=!1,d=function(b){var c=e+1<a.length&&a.charAt(e+1)==b;return c&&e++,c};for(var e=0;e<a.length;e++)if(c)a.charAt(e)=="'"&&!d("'")?c=!1:b+=a.charAt(e);else switch(a.charAt(e)){case"d":case"m":case"y":case"@":b+="0123456789";break;case"D":case"M":return null;case"'":d("'")?b+="'":c=!0;break;default:b+=a.charAt(e)}return b},_get:function(a,b){return a.settings[b]!==undefined?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()==a.lastVal)return;var c=this._get(a,"dateFormat"),d=a.lastVal=a.input?a.input.val():null,e,f;e=f=this._getDefaultDate(a);var g=this._getFormatConfig(a);try{e=this.parseDate(c,d,g)||f}catch(h){this.log(h),d=b?"":d}a.selectedDay=e.getDate(),a.drawMonth=a.selectedMonth=e.getMonth(),a.drawYear=a.selectedYear=e.getFullYear(),a.currentDay=d?e.getDate():0,a.currentMonth=d?e.getMonth():0,a.currentYear=d?e.getFullYear():0,this._adjustInstDate(a)},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var d=function(a){var b=new Date;return b.setDate(b.getDate()+a),b},e=function(b){try{return $.datepicker.parseDate($.datepicker._get(a,"dateFormat"),b,$.datepicker._getFormatConfig(a))}catch(c){}var d=(b.toLowerCase().match(/^c/)?$.datepicker._getDate(a):null)||new Date,e=d.getFullYear(),f=d.getMonth(),g=d.getDate(),h=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,i=h.exec(b);while(i){switch(i[2]||"d"){case"d":case"D":g+=parseInt(i[1],10);break;case"w":case"W":g+=parseInt(i[1],10)*7;break;case"m":case"M":f+=parseInt(i[1],10),g=Math.min(g,$.datepicker._getDaysInMonth(e,f));break;case"y":case"Y":e+=parseInt(i[1],10),g=Math.min(g,$.datepicker._getDaysInMonth(e,f))}i=h.exec(b)}return new Date(e,f,g)},f=b==null||b===""?c:typeof b=="string"?e(b):typeof b=="number"?isNaN(b)?c:d(b):new Date(b.getTime());return f=f&&f.toString()=="Invalid Date"?c:f,f&&(f.setHours(0),f.setMinutes(0),f.setSeconds(0),f.setMilliseconds(0)),this._daylightSavingAdjust(f)},_daylightSavingAdjust:function(a){return a?(a.setHours(a.getHours()>12?a.getHours()+2:0),a):null},_setDate:function(a,b,c){var d=!b,e=a.selectedMonth,f=a.selectedYear,g=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=g.getDate(),a.drawMonth=a.selectedMonth=a.currentMonth=g.getMonth(),a.drawYear=a.selectedYear=a.currentYear=g.getFullYear(),(e!=a.selectedMonth||f!=a.selectedYear)&&!c&&this._notifyChange(a),this._adjustInstDate(a),a.input&&a.input.val(d?"":this._formatDate(a))},_getDate:function(a){var b=!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return b},_attachHandlers:function(a){var b=this._get(a,"stepMonths"),c="#"+a.id.replace(/\\\\/g,"\\");a.dpDiv.find("[data-handler]").map(function(){var a={prev:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(c,-b,"M")},next:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(c,+b,"M")},hide:function(){window["DP_jQuery_"+dpuuid].datepicker._hideDatepicker()},today:function(){window["DP_jQuery_"+dpuuid].datepicker._gotoToday(c)},selectDay:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectDay(c,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(c,this,"M"),!1},selectYear:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(c,this,"Y"),!1}};$(this).bind(this.getAttribute("data-event"),a[this.getAttribute("data-handler")])})},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),d=this._get(a,"showButtonPanel"),e=this._get(a,"hideIfNoPrevNext"),f=this._get(a,"navigationAsDateFormat"),g=this._getNumberOfMonths(a),h=this._get(a,"showCurrentAtPos"),i=this._get(a,"stepMonths"),j=g[0]!=1||g[1]!=1,k=this._daylightSavingAdjust(a.currentDay?new Date(a.currentYear,a.currentMonth,a.currentDay):new Date(9999,9,9)),l=this._getMinMaxDate(a,"min"),m=this._getMinMaxDate(a,"max"),n=a.drawMonth-h,o=a.drawYear;n<0&&(n+=12,o--);if(m){var p=this._daylightSavingAdjust(new Date(m.getFullYear(),m.getMonth()-g[0]*g[1]+1,m.getDate()));p=l&&p<l?l:p;while(this._daylightSavingAdjust(new Date(o,n,1))>p)n--,n<0&&(n=11,o--)}a.drawMonth=n,a.drawYear=o;var q=this._get(a,"prevText");q=f?this.formatDate(q,this._daylightSavingAdjust(new Date(o,n-i,1)),this._getFormatConfig(a)):q;var r=this._canAdjustMonth(a,-1,o,n)?'<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click" title="'+q+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+q+"</span></a>":e?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+q+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+q+"</span></a>",s=this._get(a,"nextText");s=f?this.formatDate(s,this._daylightSavingAdjust(new Date(o,n+i,1)),this._getFormatConfig(a)):s;var t=this._canAdjustMonth(a,1,o,n)?'<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>":e?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>",u=this._get(a,"currentText"),v=this._get(a,"gotoCurrent")&&a.currentDay?k:b;u=f?this.formatDate(u,v,this._getFormatConfig(a)):u;var w=a.inline?"":'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">'+this._get(a,"closeText")+"</button>",x=d?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?w:"")+(this._isInRange(a,v)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click">'+u+"</button>":"")+(c?"":w)+"</div>":"",y=parseInt(this._get(a,"firstDay"),10);y=isNaN(y)?0:y;var z=this._get(a,"showWeek"),A=this._get(a,"dayNames"),B=this._get(a,"dayNamesShort"),C=this._get(a,"dayNamesMin"),D=this._get(a,"monthNames"),E=this._get(a,"monthNamesShort"),F=this._get(a,"beforeShowDay"),G=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths"),I=this._get(a,"calculateWeek")||this.iso8601Week,J=this._getDefaultDate(a),K="";for(var L=0;L<g[0];L++){var M="";this.maxRows=4;for(var N=0;N<g[1];N++){var O=this._daylightSavingAdjust(new Date(o,n,a.selectedDay)),P=" ui-corner-all",Q="";if(j){Q+='<div class="ui-datepicker-group';if(g[1]>1)switch(N){case 0:Q+=" ui-datepicker-group-first",P=" ui-corner-"+(c?"right":"left");break;case g[1]-1:Q+=" ui-datepicker-group-last",P=" ui-corner-"+(c?"left":"right");break;default:Q+=" ui-datepicker-group-middle",P=""}Q+='">'}Q+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+P+'">'+(/all|left/.test(P)&&L==0?c?t:r:"")+(/all|right/.test(P)&&L==0?c?r:t:"")+this._generateMonthYearHeader(a,n,o,l,m,L>0||N>0,D,E)+'</div><table class="ui-datepicker-calendar"><thead>'+"<tr>";var R=z?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(var S=0;S<7;S++){var T=(S+y)%7;R+="<th"+((S+y+6)%7>=5?' class="ui-datepicker-week-end"':"")+">"+'<span title="'+A[T]+'">'+C[T]+"</span></th>"}Q+=R+"</tr></thead><tbody>";var U=this._getDaysInMonth(o,n);o==a.selectedYear&&n==a.selectedMonth&&(a.selectedDay=Math.min(a.selectedDay,U));var V=(this._getFirstDayOfMonth(o,n)-y+7)%7,W=Math.ceil((V+U)/7),X=j?this.maxRows>W?this.maxRows:W:W;this.maxRows=X;var Y=this._daylightSavingAdjust(new Date(o,n,1-V));for(var Z=0;Z<X;Z++){Q+="<tr>";var _=z?'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(Y)+"</td>":"";for(var S=0;S<7;S++){var ba=F?F.apply(a.input?a.input[0]:null,[Y]):[!0,""],bb=Y.getMonth()!=n,bc=bb&&!H||!ba[0]||l&&Y<l||m&&Y>m;_+='<td class="'+((S+y+6)%7>=5?" ui-datepicker-week-end":"")+(bb?" ui-datepicker-other-month":"")+(Y.getTime()==O.getTime()&&n==a.selectedMonth&&a._keyEvent||J.getTime()==Y.getTime()&&J.getTime()==O.getTime()?" "+this._dayOverClass:"")+(bc?" "+this._unselectableClass+" ui-state-disabled":"")+(bb&&!G?"":" "+ba[1]+(Y.getTime()==k.getTime()?" "+this._currentClass:"")+(Y.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!bb||G)&&ba[2]?' title="'+ba[2]+'"':"")+(bc?"":' data-handler="selectDay" data-event="click" data-month="'+Y.getMonth()+'" data-year="'+Y.getFullYear()+'"')+">"+(bb&&!G?"&#xa0;":bc?'<span class="ui-state-default">'+Y.getDate()+"</span>":'<a class="ui-state-default'+(Y.getTime()==b.getTime()?" ui-state-highlight":"")+(Y.getTime()==k.getTime()?" ui-state-active":"")+(bb?" ui-priority-secondary":"")+'" href="#">'+Y.getDate()+"</a>")+"</td>",Y.setDate(Y.getDate()+1),Y=this._daylightSavingAdjust(Y)}Q+=_+"</tr>"}n++,n>11&&(n=0,o++),Q+="</tbody></table>"+(j?"</div>"+(g[0]>0&&N==g[1]-1?'<div class="ui-datepicker-row-break"></div>':""):""),M+=Q}K+=M}return K+=x+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':""),a._keyEvent=!1,K},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h){var i=this._get(a,"changeMonth"),j=this._get(a,"changeYear"),k=this._get(a,"showMonthAfterYear"),l='<div class="ui-datepicker-title">',m="";if(f||!i)m+='<span class="ui-datepicker-month">'+g[b]+"</span>";else{var n=d&&d.getFullYear()==c,o=e&&e.getFullYear()==c;m+='<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">';for(var p=0;p<12;p++)(!n||p>=d.getMonth())&&(!o||p<=e.getMonth())&&(m+='<option value="'+p+'"'+(p==b?' selected="selected"':"")+">"+h[p]+"</option>");m+="</select>"}k||(l+=m+(f||!i||!j?"&#xa0;":""));if(!a.yearshtml){a.yearshtml="";if(f||!j)l+='<span class="ui-datepicker-year">'+c+"</span>";else{var q=this._get(a,"yearRange").split(":"),r=(new Date).getFullYear(),s=function(a){var b=a.match(/c[+-].*/)?c+parseInt(a.substring(1),10):a.match(/[+-].*/)?r+parseInt(a,10):parseInt(a,10);return isNaN(b)?r:b},t=s(q[0]),u=Math.max(t,s(q[1]||""));t=d?Math.max(t,d.getFullYear()):t,u=e?Math.min(u,e.getFullYear()):u,a.yearshtml+='<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">';for(;t<=u;t++)a.yearshtml+='<option value="'+t+'"'+(t==c?' selected="selected"':"")+">"+t+"</option>";a.yearshtml+="</select>",l+=a.yearshtml,a.yearshtml=null}}return l+=this._get(a,"yearSuffix"),k&&(l+=(f||!i||!j?"&#xa0;":"")+m),l+="</div>",l},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=="Y"?b:0),e=a.drawMonth+(c=="M"?b:0),f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=="D"?b:0),g=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(d,e,f)));a.selectedDay=g.getDate(),a.drawMonth=a.selectedMonth=g.getMonth(),a.drawYear=a.selectedYear=g.getFullYear(),(c=="M"||c=="Y")&&this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max"),e=c&&b<c?c:b;return e=d&&e>d?d:e,e},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");b&&b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){var b=this._get(a,"numberOfMonths");return b==null?[1,1]:typeof b=="number"?[1,b]:b},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a),f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[0]*e[1]),1));return b<0&&f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth())),this._isInRange(a,f)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min"),d=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!d||b.getTime()<=d.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");return b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10),{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,d){b||(a.currentDay=a.selectedDay,a.currentMonth=a.selectedMonth,a.currentYear=a.selectedYear);var e=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(d,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),e,this._getFormatConfig(a))}}),$.fn.datepicker=function(a){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv),$.datepicker.initialized=!0);var b=Array.prototype.slice.call(arguments,1);return typeof a!="string"||a!="isDisabled"&&a!="getDate"&&a!="widget"?a=="option"&&arguments.length==2&&typeof arguments[1]=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b)):this.each(function(){typeof a=="string"?$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this].concat(b)):$.datepicker._attachDatepicker(this,a)}):$.datepicker["_"+a+"Datepicker"].apply($.datepicker,[this[0]].concat(b))},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.8.23",window["DP_jQuery_"+dpuuid]=$}(jQuery),function(a,b){var c="ui-dialog ui-widget ui-widget-content ui-corner-all ",d={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},e={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};a.widget("ui.dialog",{options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",collision:"fit",using:function(b){var c=a(this).css(b).offset().top;c<0&&a(this).css("top",b.top-c)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),typeof this.originalTitle!="string"&&(this.originalTitle=""),this.options.title=this.options.title||this.originalTitle;var b=this,d=b.options,e=d.title||"&#160;",f=a.ui.dialog.getTitleId(b.element),g=(b.uiDialog=a("<div></div>")).appendTo(document.body).hide().addClass(c+d.dialogClass).css({zIndex:d.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(c){d.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}).attr({role:"dialog","aria-labelledby":f}).mousedown(function(a){b.moveToTop(!1,a)}),h=b.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g),i=(b.uiDialogTitlebar=a("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),j=a('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){j.addClass("ui-state-hover")},function(){j.removeClass("ui-state-hover")}).focus(function(){j.addClass("ui-state-focus")}).blur(function(){j.removeClass("ui-state-focus")}).click(function(a){return b.close(a),!1}).appendTo(i),k=(b.uiDialogTitlebarCloseText=a("<span></span>")).addClass("ui-icon ui-icon-closethick").text(d.closeText).appendTo(j),l=a("<span></span>").addClass("ui-dialog-title").attr("id",f).html(e).prependTo(i);a.isFunction(d.beforeclose)&&!a.isFunction(d.beforeClose)&&(d.beforeClose=d.beforeclose),i.find("*").add(i).disableSelection(),d.draggable&&a.fn.draggable&&b._makeDraggable(),d.resizable&&a.fn.resizable&&b._makeResizable(),b._createButtons(d.buttons),b._isOpen=!1,a.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;return a.overlay&&a.overlay.destroy(),a.uiDialog.hide(),a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),a.uiDialog.remove(),a.originalTitle&&a.element.attr("title",a.originalTitle),a},widget:function(){return this.uiDialog},close:function(b){var c=this,d,e;if(!1===c._trigger("beforeClose",b))return;return c.overlay&&c.overlay.destroy(),c.uiDialog.unbind("keypress.ui-dialog"),c._isOpen=!1,c.options.hide?c.uiDialog.hide(c.options.hide,function(){c._trigger("close",b)}):(c.uiDialog.hide(),c._trigger("close",b)),a.ui.dialog.overlay.resize(),c.options.modal&&(d=0,a(".ui-dialog").each(function(){this!==c.uiDialog[0]&&(e=a(this).css("z-index"),isNaN(e)||(d=Math.max(d,e)))}),a.ui.dialog.maxZ=d),c},isOpen:function(){return this._isOpen},moveToTop:function(b,c){var d=this,e=d.options,f;return e.modal&&!b||!e.stack&&!e.modal?d._trigger("focus",c):(e.zIndex>a.ui.dialog.maxZ&&(a.ui.dialog.maxZ=e.zIndex),d.overlay&&(a.ui.dialog.maxZ+=1,d.overlay.$el.css("z-index",a.ui.dialog.overlay.maxZ=a.ui.dialog.maxZ)),f={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()},a.ui.dialog.maxZ+=1,d.uiDialog.css("z-index",a.ui.dialog.maxZ),d.element.attr(f),d._trigger("focus",c),d)},open:function(){if(this._isOpen)return;var b=this,c=b.options,d=b.uiDialog;return b.overlay=c.modal?new a.ui.dialog.overlay(b):null,b._size(),b._position(c.position),d.show(c.show),b.moveToTop(!0),c.modal&&d.bind("keydown.ui-dialog",function(b){if(b.keyCode!==a.ui.keyCode.TAB)return;var c=a(":tabbable",this),d=c.filter(":first"),e=c.filter(":last");if(b.target===e[0]&&!b.shiftKey)return d.focus(1),!1;if(b.target===d[0]&&b.shiftKey)return e.focus(1),!1}),a(b.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus(),b._isOpen=!0,b._trigger("open"),b},_createButtons:function(b){var c=this,d=!1,e=a("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),f=a("<div></div>").addClass("ui-dialog-buttonset").appendTo(e);c.uiDialog.find(".ui-dialog-buttonpane").remove(),typeof b=="object"&&b!==null&&a.each(b,function(){return!(d=!0)}),d&&(a.each(b,function(b,d){d=a.isFunction(d)?{click:d,text:b}:d;var e=a('<button type="button"></button>').click(function(){d.click.apply(c.element[0],arguments)}).appendTo(f);a.each(d,function(a,b){if(a==="click")return;a in e?e[a](b):e.attr(a,b)}),a.fn.button&&e.button()}),e.appendTo(c.uiDialog))},_makeDraggable:function(){function f(a){return{position:a.position,offset:a.offset}}var b=this,c=b.options,d=a(document),e;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(d,g){e=c.height==="auto"?"auto":a(this).height(),a(this).height(a(this).height()).addClass("ui-dialog-dragging"),b._trigger("dragStart",d,f(g))},drag:function(a,c){b._trigger("drag",a,f(c))},stop:function(g,h){c.position=[h.position.left-d.scrollLeft(),h.position.top-d.scrollTop()],a(this).removeClass("ui-dialog-dragging").height(e),b._trigger("dragStop",g,f(h)),a.ui.dialog.overlay.resize()}})},_makeResizable:function(c){function h(a){return{originalPosition:a.originalPosition,originalSize:a.originalSize,position:a.position,size:a.size}}c=c===b?this.options.resizable:c;var d=this,e=d.options,f=d.uiDialog.css("position"),g=typeof c=="string"?c:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:g,start:function(b,c){a(this).addClass("ui-dialog-resizing"),d._trigger("resizeStart",b,h(c))},resize:function(a,b){d._trigger("resize",a,h(b))},stop:function(b,c){a(this).removeClass("ui-dialog-resizing"),e.height=a(this).height(),e.width=a(this).width(),d._trigger("resizeStop",b,h(c)),a.ui.dialog.overlay.resize()}}).css("position",f).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(b){var c=[],d=[0,0],e;if(b){if(typeof b=="string"||typeof b=="object"&&"0"in b)c=b.split?b.split(" "):[b[0],b[1]],c.length===1&&(c[1]=c[0]),a.each(["left","top"],function(a,b){+c[a]===c[a]&&(d[a]=c[a],c[a]=b)}),b={my:c.join(" "),at:c.join(" "),offset:d.join(" ")};b=a.extend({},a.ui.dialog.prototype.options.position,b)}else b=a.ui.dialog.prototype.options.position;e=this.uiDialog.is(":visible"),e||this.uiDialog.show(),this.uiDialog.css({top:0,left:0}).position(a.extend({of:window},b)),e||this.uiDialog.hide()},_setOptions:function(b){var c=this,f={},g=!1;a.each(b,function(a,b){c._setOption(a,b),a in d&&(g=!0),a in e&&(f[a]=b)}),g&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",f)},_setOption:function(b,d){var e=this,f=e.uiDialog;switch(b){case"beforeclose":b="beforeClose";break;case"buttons":e._createButtons(d);break;case"closeText":e.uiDialogTitlebarCloseText.text(""+d);break;case"dialogClass":f.removeClass(e.options.dialogClass).addClass(c+d);break;case"disabled":d?f.addClass("ui-dialog-disabled"):f.removeClass("ui-dialog-disabled");break;case"draggable":var g=f.is(":data(draggable)");g&&!d&&f.draggable("destroy"),!g&&d&&e._makeDraggable();break;case"position":e._position(d);break;case"resizable":var h=f.is(":data(resizable)");h&&!d&&f.resizable("destroy"),h&&typeof d=="string"&&f.resizable("option","handles",d),!h&&d!==!1&&e._makeResizable(d);break;case"title":a(".ui-dialog-title",e.uiDialogTitlebar).html(""+(d||"&#160;"))}a.Widget.prototype._setOption.apply(e,arguments)},_size:function(){var b=this.options,c,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),b.minWidth>b.width&&(b.width=b.minWidth),c=this.uiDialog.css({height:"auto",width:b.width}).height(),d=Math.max(0,b.minHeight-c);if(b.height==="auto")if(a.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();var f=this.element.css("height","auto").height();e||this.uiDialog.hide(),this.element.height(Math.max(f,d))}else this.element.height(Math.max(b.height-c,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}}),a.extend(a.ui.dialog,{version:"1.8.23",uuid:0,maxZ:0,getTitleId:function(a){var b=a.attr("id");return b||(this.uuid+=1,b=this.uuid),"ui-dialog-title-"+b},overlay:function(b){this.$el=a.ui.dialog.overlay.create(b)}}),a.extend(a.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:a.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(b){this.instances.length===0&&(setTimeout(function(){a.ui.dialog.overlay.instances.length&&a(document).bind(a.ui.dialog.overlay.events,function(b){if(a(b.target).zIndex()<a.ui.dialog.overlay.maxZ)return!1})},1),a(document).bind("keydown.dialog-overlay",function(c){b.options.closeOnEscape&&!c.isDefaultPrevented()&&c.keyCode&&c.keyCode===a.ui.keyCode.ESCAPE&&(b.close(c),c.preventDefault())}),a(window).bind("resize.dialog-overlay",a.ui.dialog.overlay.resize));var c=(this.oldInstances.pop()||a("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});return a.fn.bgiframe&&c.bgiframe(),this.instances.push(c),c},destroy:function(b){var c=a.inArray(b,this.instances);c!=-1&&this.oldInstances.push(this.instances.splice(c,1)[0]),this.instances.length===0&&a([document,window]).unbind(".dialog-overlay"),b.remove();var d=0;a.each(this.instances,function(){d=Math.max(d,this.css("z-index"))}),this.maxZ=d},height:function(){var b,c;return a.browser.msie&&a.browser.version<7?(b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),c=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),b<c?a(window).height()+"px":b+"px"):a(document).height()+"px"},width:function(){var b,c;return a.browser.msie?(b=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),c=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth),b<c?a(window).width()+"px":b+"px"):a(document).width()+"px"},resize:function(){var b=a([]);a.each(a.ui.dialog.overlay.instances,function(){b=b.add(this)}),b.css({width:0,height:0}).css({width:a.ui.dialog.overlay.width(),height:a.ui.dialog.overlay.height()})}}),a.extend(a.ui.dialog.overlay.prototype,{destroy:function(){a.ui.dialog.overlay.destroy(this.$el)}})}(jQuery),function(a,b){a.ui=a.ui||{};var c=/left|center|right/,d=/top|center|bottom/,e="center",f={},g=a.fn.position,h=a.fn.offset;a.fn.position=function(b){if(!b||!b.of)return g.apply(this,arguments);b=a.extend({},b);var h=a(b.of),i=h[0],j=(b.collision||"flip").split(" "),k=b.offset?b.offset.split(" "):[0,0],l,m,n;return i.nodeType===9?(l=h.width(),m=h.height(),n={top:0,left:0}):i.setTimeout?(l=h.width(),m=h.height(),n={top:h.scrollTop(),left:h.scrollLeft()}):i.preventDefault?(b.at="left top",l=m=0,n={top:b.of.pageY,left:b.of.pageX}):(l=h.outerWidth(),m=h.outerHeight(),n=h.offset()),a.each(["my","at"],function(){var a=(b[this]||"").split(" ");a.length===1&&(a=c.test(a[0])?a.concat([e]):d.test(a[0])?[e].concat(a):[e,e]),a[0]=c.test(a[0])?a[0]:e,a[1]=d.test(a[1])?a[1]:e,b[this]=a}),j.length===1&&(j[1]=j[0]),k[0]=parseInt(k[0],10)||0,k.length===1&&(k[1]=k[0]),k[1]=parseInt(k[1],10)||0,b.at[0]==="right"?n.left+=l:b.at[0]===e&&(n.left+=l/2),b.at[1]==="bottom"?n.top+=m:b.at[1]===e&&(n.top+=m/2),n.left+=k[0],n.top+=k[1],this.each(function(){var c=a(this),d=c.outerWidth(),g=c.outerHeight(),h=parseInt(a.curCSS(this,"marginLeft",!0))||0,i=parseInt(a.curCSS(this,"marginTop",!0))||0,o=d+h+(parseInt(a.curCSS(this,"marginRight",!0))||0),p=g+i+(parseInt(a.curCSS(this,"marginBottom",!0))||0),q=a.extend({},n),r;b.my[0]==="right"?q.left-=d:b.my[0]===e&&(q.left-=d/2),b.my[1]==="bottom"?q.top-=g:b.my[1]===e&&(q.top-=g/2),f.fractions||(q.left=Math.round(q.left),q.top=Math.round(q.top)),r={left:q.left-h,top:q.top-i},a.each(["left","top"],function(c,e){a.ui.position[j[c]]&&a.ui.position[j[c]][e](q,{targetWidth:l,targetHeight:m,elemWidth:d,elemHeight:g,collisionPosition:r,collisionWidth:o,collisionHeight:p,offset:k,my:b.my,at:b.at})}),a.fn.bgiframe&&c.bgiframe(),c.offset(a.extend(q,{using:b.using}))})},a.ui.position={fit:{left:function(b,c){var d=a(window),e=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft();b.left=e>0?b.left-e:Math.max(b.left-c.collisionPosition.left,b.left)},top:function(b,c){var d=a(window),e=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop();b.top=e>0?b.top-e:Math.max(b.top-c.collisionPosition.top,b.top)}},flip:{left:function(b,c){if(c.at[0]===e)return;var d=a(window),f=c.collisionPosition.left+c.collisionWidth-d.width()-d.scrollLeft(),g=c.my[0]==="left"?-c.elemWidth:c.my[0]==="right"?c.elemWidth:0,h=c.at[0]==="left"?c.targetWidth:-c.targetWidth,i=-2*c.offset[0];b.left+=c.collisionPosition.left<0?g+h+i:f>0?g+h+i:0},top:function(b,c){if(c.at[1]===e)return;var d=a(window),f=c.collisionPosition.top+c.collisionHeight-d.height()-d.scrollTop(),g=c.my[1]==="top"?-c.elemHeight:c.my[1]==="bottom"?c.elemHeight:0,h=c.at[1]==="top"?c.targetHeight:-c.targetHeight,i=-2*c.offset[1];b.top+=c.collisionPosition.top<0?g+h+i:f>0?g+h+i:0}}},a.offset.setOffset||(a.offset.setOffset=function(b,c){/static/.test(a.curCSS(b,"position"))&&(b.style.position="relative");var d=a(b),e=d.offset(),f=parseInt(a.curCSS(b,"top",!0),10)||0,g=parseInt(a.curCSS(b,"left",!0),10)||0,h={top:c.top-e.top+f,left:c.left-e.left+g};"using"in c?c.using.call(b,h):d.css(h)},a.fn.offset=function(b){var c=this[0];return!c||!c.ownerDocument?null:b?a.isFunction(b)?this.each(function(c){a(this).offset(b.call(this,c,a(this).offset()))}):this.each(function(){a.offset.setOffset(this,b)}):h.call(this)}),a.curCSS||(a.curCSS=a.css),function(){var b=document.getElementsByTagName("body")[0],c=document.createElement("div"),d,e,g,h,i;d=document.createElement(b?"div":"body"),g={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},b&&a.extend(g,{position:"absolute",left:"-1000px",top:"-1000px"});for(var j in g)d.style[j]=g[j];d.appendChild(c),e=b||document.documentElement,e.insertBefore(d,e.firstChild),c.style.cssText="position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",h=a(c).offset(function(a,b){return b}).offset(),d.innerHTML="",e.removeChild(d),i=h.top+h.left+(b?2e3:0),f.fractions=i>21&&i<22}()}(jQuery),function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments)},value:function(a){return a===b?this._value():(this._setOption("value",a),this)},_setOption:function(b,c){b==="value"&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;return typeof a!="number"&&(a=0),Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a)}}),a.extend(a.ui.progressbar,{version:"1.8.23"})}(jQuery),function(a,b){var c=5;a.widget("ui.slider",a.ui.mouse,{widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var b=this,d=this.options,e=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),f="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",g=d.values&&d.values.length||1,h=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(d.disabled?" ui-slider-disabled ui-disabled":"")),this.range=a([]),d.range&&(d.range===!0&&(d.values||(d.values=[this._valueMin(),this._valueMin()]),d.values.length&&d.values.length!==2&&(d.values=[d.values[0],d.values[0]])),this.range=a("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(d.range==="min"||d.range==="max"?" ui-slider-range-"+d.range:"")));for(var i=e.length;i<g;i+=1)h.push(f);this.handles=e.add(a(h.join("")).appendTo(b.element)),this.handle=this.handles.eq(0),this.handles.add(this.range).filter("a").click(function(a){a.preventDefault()}).hover(function(){d.disabled||a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).focus(function(){d.disabled?a(this).blur():(a(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),a(this).addClass("ui-state-focus"))}).blur(function(){a(this).removeClass("ui-state-focus")}),this.handles.each(function(b){a(this).data("index.ui-slider-handle",b)}),this.handles.keydown(function(d){var e=a(this).data("index.ui-slider-handle"),f,g,h,i;if(b.options.disabled)return;switch(d.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.PAGE_UP:case a.ui.keyCode.PAGE_DOWN:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:d.preventDefault();if(!b._keySliding){b._keySliding=!0,a(this).addClass("ui-state-active"),f=b._start(d,e);if(f===!1)return}}i=b.options.step,b.options.values&&b.options.values.length?g=h=b.values(e):g=h=b.value();switch(d.keyCode){case a.ui.keyCode.HOME:h=b._valueMin();break;case a.ui.keyCode.END:h=b._valueMax();break;case a.ui.keyCode.PAGE_UP:h=b._trimAlignValue(g+(b._valueMax()-b._valueMin())/c);break;case a.ui.keyCode.PAGE_DOWN:h=b._trimAlignValue(g-(b._valueMax()-b._valueMin())/c);break;case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(g===b._valueMax())return;h=b._trimAlignValue(g+i);break;case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(g===b._valueMin())return;h=b._trimAlignValue(g-i)}b._slide(d,e,h)}).keyup(function(c){var d=a(this).data("index.ui-slider-handle");b._keySliding&&(b._keySliding=!1,b._stop(c,d),b._change(c,d),a(this).removeClass("ui-state-active"))}),this._refreshValue(),this._animateOff=!1},destroy:function(){return this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"),this._mouseDestroy(),this},_mouseCapture:function(b){var c=this.options,d,e,f,g,h,i,j,k,l;return c.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),d={x:b.pageX,y:b.pageY},e=this._normValueFromMouse(d),f=this._valueMax()-this._valueMin()+1,h=this,this.handles.each(function(b){var c=Math.abs(e-h.values(b));f>c&&(f=c,g=a(this),i=b)}),c.range===!0&&this.values(1)===c.min&&(i+=1,g=a(this.handles[i])),j=this._start(b,i),j===!1?!1:(this._mouseSliding=!0,h._handleIndex=i,g.addClass("ui-state-active").focus(),k=g.offset(),l=!a(b.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:b.pageX-k.left-g.width()/2,top:b.pageY-k.top-g.height()/2-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(b,i,e),this._animateOff=!0,!0))},_mouseStart:function(a){return!0},_mouseDrag:function(a){var b={x:a.pageX,y:a.pageY},c=this._normValueFromMouse(b);return this._slide(a,this._handleIndex,c),!1},_mouseStop:function(a){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(a,this._handleIndex),this._change(a,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b,c,d,e,f;return this.orientation==="horizontal"?(b=this.elementSize.width,c=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(b=this.elementSize.height,c=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),d=c/b,d>1&&(d=1),d<0&&(d=0),this.orientation==="vertical"&&(d=1-d),e=this._valueMax()-this._valueMin(),f=this._valueMin()+d*e,this._trimAlignValue(f)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};return this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("start",a,c)},_slide:function(a,b,c){var d,e,f;this.options.values&&this.options.values.length?(d=this.values(b?0:1),this.options.values.length===2&&this.options.range===!0&&(b===0&&c>d||b===1&&c<d)&&(c=d),c!==this.values(b)&&(e=this.values(),e[b]=c,f=this._trigger("slide",a,{handle:this.handles[b],value:c,values:e}),d=this.values(b?0:1),f!==!1&&this.values(b,c,!0))):c!==this.value()&&(f=this._trigger("slide",a,{handle:this.handles[b],value:c}),f!==!1&&this.value(c))},_stop:function(a,b){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("stop",a,c)},_change:function(a,b){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[b],value:this.value()};this.options.values&&this.options.values.length&&(c.value=this.values(b),c.values=this.values()),this._trigger("change",a,c)}},value:function(a){if(arguments.length){this.options.value=this._trimAlignValue(a),this._refreshValue(),this._change(null,0);return}return this._value()},values:function(b,c){var d,e,f;if(arguments.length>1){this.options.values[b]=this._trimAlignValue(c),this._refreshValue(),this._change(null,b);return}if(!arguments.length)return this._values();if(!a.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(b):this.value();d=this.options.values,e=arguments[0];for(f=0;f<d.length;f+=1)d[f]=this._trimAlignValue(e[f]),this._change(null,f);this._refreshValue()},_setOption:function(b,c){var d,e=0;a.isArray(this.options.values)&&(e=this.options.values.length),a.Widget.prototype._setOption.apply(this,arguments);switch(b){case"disabled":c?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.propAttr("disabled",!0),this.element.addClass("ui-disabled")):(this.handles.propAttr("disabled",!1),this.element.removeClass("ui-disabled"));break;case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":this._animateOff=!0,this._refreshValue();for(d=0;d<e;d+=1)this._change(null,d);this._animateOff=!1}},_value:function(){var a=this.options.value;return a=this._trimAlignValue(a),a},_values:function(a){var b,c,d;if(arguments.length)return b=this.options.values[a],b=this._trimAlignValue(b),b;c=this.options.values.slice();for(d=0;d<c.length;d+=1)c[d]=this._trimAlignValue(c[d]);return c},_trimAlignValue:function(a){if(a<=this._valueMin())return this._valueMin();if(a>=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b,d=a-c;return Math.abs(c)*2>=b&&(d+=c>0?b:-b),parseFloat(d.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var b=this.options.range,c=this.options,d=this,e=this._animateOff?!1:c.animate,f,g={},h,i,j,k;this.options.values&&this.options.values.length?this.handles.each(function(b,i){f=(d.values(b)-d._valueMin())/(d._valueMax()-d._valueMin())*100,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",a(this).stop(1,1)[e?"animate":"css"](g,c.animate),d.options.range===!0&&(d.orientation==="horizontal"?(b===0&&d.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({width:f-h+"%"},{queue:!1,duration:c.animate})):(b===0&&d.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},c.animate),b===1&&d.range[e?"animate":"css"]({height:f-h+"%"},{queue:!1,duration:c.animate}))),h=f}):(i=this.value(),j=this._valueMin(),k=this._valueMax(),f=k!==j?(i-j)/(k-j)*100:0,g[d.orientation==="horizontal"?"left":"bottom"]=f+"%",this.handle.stop(1,1)[e?"animate":"css"](g,c.animate),b==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[e?"animate":"css"]({width:f+"%"},c.animate),b==="max"&&this.orientation==="horizontal"&&this.range[e?"animate":"css"]({width:100-f+"%"},{queue:!1,duration:c.animate}),b==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},c.animate),b==="max"&&this.orientation==="vertical"&&this.range[e?"animate":"css"]({height:100-f+"%"},{queue:!1,duration:c.animate}))}}),a.extend(a.ui.slider,{version:"1.8.23"})}(jQuery),function(a,b){function e(){return++c}function f(){return++d}var c=0,d=0;a.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:!1,cookie:null,collapsible:!1,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(!0)},_setOption:function(a,b){if(a=="selected"){if(this.options.collapsible&&b==this.options.selected)return;this.select(b)}else this.options[a]=b,this._tabify()},_tabId:function(a){return a.title&&a.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+e()},_sanitizeSelector:function(a){return a.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+f());return a.cookie.apply(null,[b].concat(a.makeArray(arguments)))},_ui:function(a,b){return{tab:a,panel:b,index:this.anchors.index(a)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=a(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(c){function m(b,c){b.css("display",""),!a.support.opacity&&c.opacity&&b[0].style.removeAttribute("filter")}var d=this,e=this.options,f=/^#.+/;this.list=this.element.find("ol,ul").eq(0),this.lis=a(" > li:has(a[href])",this.list),this.anchors=this.lis.map(function(){return a("a",this)[0]}),this.panels=a([]),this.anchors.each(function(b,c){var g=a(c).attr("href"),h=g.split("#")[0],i;h&&(h===location.toString().split("#")[0]||(i=a("base")[0])&&h===i.href)&&(g=c.hash,c.href=g);if(f.test(g))d.panels=d.panels.add(d.element.find(d._sanitizeSelector(g)));else if(g&&g!=="#"){a.data(c,"href.tabs",g),a.data(c,"load.tabs",g.replace(/#.*$/,""));var j=d._tabId(c);c.href="#"+j;var k=d.element.find("#"+j);k.length||(k=a(e.panelTemplate).attr("id",j).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(d.panels[b-1]||d.list),k.data("destroy.tabs",!0)),d.panels=d.panels.add(k)}else e.disabled.push(b)}),c?(this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"),this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.lis.addClass("ui-state-default ui-corner-top"),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom"),e.selected===b?(location.hash&&this.anchors.each(function(a,b){if(b.hash==location.hash)return e.selected=a,!1}),typeof e.selected!="number"&&e.cookie&&(e.selected=parseInt(d._cookie(),10)),typeof e.selected!="number"&&this.lis.filter(".ui-tabs-selected").length&&(e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"))),e.selected=e.selected||(this.lis.length?0:-1)):e.selected===null&&(e.selected=-1),e.selected=e.selected>=0&&this.anchors[e.selected]||e.selected<0?e.selected:0,e.disabled=a.unique(e.disabled.concat(a.map(this.lis.filter(".ui-state-disabled"),function(a,b){return d.lis.index(a)}))).sort(),a.inArray(e.selected,e.disabled)!=-1&&e.disabled.splice(a.inArray(e.selected,e.disabled),1),this.panels.addClass("ui-tabs-hide"),this.lis.removeClass("ui-tabs-selected ui-state-active"),e.selected>=0&&this.anchors.length&&(d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash)).removeClass("ui-tabs-hide"),this.lis.eq(e.selected).addClass("ui-tabs-selected ui-state-active"),d.element.queue("tabs",function(){d._trigger("show",null,d._ui(d.anchors[e.selected],d.element.find(d._sanitizeSelector(d.anchors[e.selected].hash))[0]))}),this.load(e.selected)),a(window).bind("unload",function(){d.lis.add(d.anchors).unbind(".tabs"),d.lis=d.anchors=d.panels=null})):e.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")),this.element[e.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible"),e.cookie&&this._cookie(e.selected,e.cookie);for(var g=0,h;h=this.lis[g];g++)a(h)[a.inArray(g,e.disabled)!=-1&&!a(h).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");e.cache===!1&&this.anchors.removeData("cache.tabs"),this.lis.add(this.anchors).unbind(".tabs");if(e.event!=="mouseover"){var i=function(a,b){b.is(":not(.ui-state-disabled)")&&b.addClass("ui-state-"+a)},j=function(a,b){b.removeClass("ui-state-"+a)};this.lis.bind("mouseover.tabs",function(){i("hover",a(this))}),this.lis.bind("mouseout.tabs",function(){j("hover",a(this))}),this.anchors.bind("focus.tabs",function(){i("focus",a(this).closest("li"))}),this.anchors.bind("blur.tabs",function(){j("focus",a(this).closest("li"))})}var k,l;e.fx&&(a.isArray(e.fx)?(k=e.fx[0],l=e.fx[1]):k=l=e.fx);var n=l?function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.hide().removeClass("ui-tabs-hide").animate(l,l.duration||"normal",function(){m(c,l),d._trigger("show",null,d._ui(b,c[0]))})}:function(b,c){a(b).closest("li").addClass("ui-tabs-selected ui-state-active"),c.removeClass("ui-tabs-hide"),d._trigger("show",null,d._ui(b,c[0]))},o=k?function(a,b){b.animate(k,k.duration||"normal",function(){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),m(b,k),d.element.dequeue("tabs")})}:function(a,b,c){d.lis.removeClass("ui-tabs-selected ui-state-active"),b.addClass("ui-tabs-hide"),d.element.dequeue("tabs")};this.anchors.bind(e.event+".tabs",function(){var b=this,c=a(b).closest("li"),f=d.panels.filter(":not(.ui-tabs-hide)"),g=d.element.find(d._sanitizeSelector(b.hash));if(c.hasClass("ui-tabs-selected")&&!e.collapsible||c.hasClass("ui-state-disabled")||c.hasClass("ui-state-processing")||d.panels.filter(":animated").length||d._trigger("select",null,d._ui(this,g[0]))===!1)return this.blur(),!1;e.selected=d.anchors.index(this),d.abort();if(e.collapsible){if(c.hasClass("ui-tabs-selected"))return e.selected=-1,e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){o(b,f)}).dequeue("tabs"),this.blur(),!1;if(!f.length)return e.cookie&&d._cookie(e.selected,e.cookie),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this)),this.blur(),!1}e.cookie&&d._cookie(e.selected,e.cookie);if(g.length)f.length&&d.element.queue("tabs",function(){o(b,f)}),d.element.queue("tabs",function(){n(b,g)}),d.load(d.anchors.index(this));else throw"jQuery UI Tabs: Mismatching fragment identifier.";a.browser.msie&&this.blur()}),this.anchors.bind("click.tabs",function(){return!1})},_getIndex:function(a){return typeof a=="string"&&(a=this.anchors.index(this.anchors.filter("[href$='"+a+"']"))),a},destroy:function(){var b=this.options;return this.abort(),this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs"),this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"),this.anchors.each(function(){var b=a.data(this,"href.tabs");b&&(this.href=b);var c=a(this).unbind(".tabs");a.each(["href","load","cache"],function(a,b){c.removeData(b+".tabs")})}),this.lis.unbind(".tabs").add(this.panels).each(function(){a.data(this,"destroy.tabs")?a(this).remove():a(this).removeClass(["ui-state-default","ui-corner-top","ui-tabs-selected","ui-state-active","ui-state-hover","ui-state-focus","ui-state-disabled","ui-tabs-panel","ui-widget-content","ui-corner-bottom","ui-tabs-hide"].join(" "))}),b.cookie&&this._cookie(null,b.cookie),this},add:function(c,d,e){e===b&&(e=this.anchors.length);var f=this,g=this.options,h=a(g.tabTemplate.replace(/#\{href\}/g,c).replace(/#\{label\}/g,d)),i=c.indexOf("#")?this._tabId(a("a",h)[0]):c.replace("#","");h.addClass("ui-state-default ui-corner-top").data("destroy.tabs",!0);var j=f.element.find("#"+i);return j.length||(j=a(g.panelTemplate).attr("id",i).data("destroy.tabs",!0)),j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide"),e>=this.lis.length?(h.appendTo(this.list),j.appendTo(this.list[0].parentNode)):(h.insertBefore(this.lis[e]),j.insertBefore(this.panels[e])),g.disabled=a.map(g.disabled,function(a,b){return a>=e?++a:a}),this._tabify(),this.anchors.length==1&&(g.selected=0,h.addClass("ui-tabs-selected ui-state-active"),j.removeClass("ui-tabs-hide"),this.element.queue("tabs",function(){f._trigger("show",null,f._ui(f.anchors[0],f.panels[0]))}),this.load(0)),this._trigger("add",null,this._ui(this.anchors[e],this.panels[e])),this},remove:function(b){b=this._getIndex(b);var c=this.options,d=this.lis.eq(b).remove(),e=this.panels.eq(b).remove();return d.hasClass("ui-tabs-selected")&&this.anchors.length>1&&this.select(b+(b+1<this.anchors.length?1:-1)),c.disabled=a.map(a.grep(c.disabled,function(a,c){return a!=b}),function(a,c){return a>=b?--a:a}),this._tabify(),this._trigger("remove",null,this._ui(d.find("a")[0],e[0])),this},enable:function(b){b=this._getIndex(b);var c=this.options;if(a.inArray(b,c.disabled)==-1)return;return this.lis.eq(b).removeClass("ui-state-disabled"),c.disabled=a.grep(c.disabled,function(a,c){return a!=b}),this._trigger("enable",null,this._ui(this.anchors[b],this.panels[b])),this},disable:function(a){a=this._getIndex(a);var b=this,c=this.options;return a!=c.selected&&(this.lis.eq(a).addClass("ui-state-disabled"),c.disabled.push(a),c.disabled.sort(),this._trigger("disable",null,this._ui(this.anchors[a],this.panels[a]))),this},select:function(a){a=this._getIndex(a);if(a==-1)if(this.options.collapsible&&this.options.selected!=-1)a=this.options.selected;else return this;return this.anchors.eq(a).trigger(this.options.event+".tabs"),this},load:function(b){b=this._getIndex(b);var c=this,d=this.options,e=this.anchors.eq(b)[0],f=a.data(e,"load.tabs");this.abort();if(!f||this.element.queue("tabs").length!==0&&a.data(e,"cache.tabs")){this.element.dequeue("tabs");return}this.lis.eq(b).addClass("ui-state-processing");if(d.spinner){var g=a("span",e);g.data("label.tabs",g.html()).html(d.spinner)}return this.xhr=a.ajax(a.extend({},d.ajaxOptions,{url:f,success:function(f,g){c.element.find(c._sanitizeSelector(e.hash)).html(f),c._cleanup(),d.cache&&a.data(e,"cache.tabs",!0),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.success(f,g)}catch(h){}},error:function(a,f,g){c._cleanup(),c._trigger("load",null,c._ui(c.anchors[b],c.panels[b]));try{d.ajaxOptions.error(a,f,b,e)}catch(g){}}})),c.element.dequeue("tabs"),this},abort:function(){return this.element.queue([]),this.panels.stop(!1,!0),this.element.queue("tabs",this.element.queue("tabs").splice(-2,2)),this.xhr&&(this.xhr.abort(),delete this.xhr),this._cleanup(),this},url:function(a,b){return this.anchors.eq(a).removeData("cache.tabs").data("load.tabs",b),this},length:function(){return this.anchors.length}}),a.extend(a.ui.tabs,{version:"1.8.23"}),a.extend(a.ui.tabs.prototype,{rotation:null,rotate:function(a,b){var c=this,d=this.options,e=c._rotate||(c._rotate=function(b){clearTimeout(c.rotation),c.rotation=setTimeout(function(){var a=d.selected;c.select(++a<c.anchors.length?a:0)},a),b&&b.stopPropagation()}),f=c._unrotate||(c._unrotate=b?function(a){e()}:function(a){a.clientX&&c.rotate(null)});return a?(this.element.bind("tabsshow",e),this.anchors.bind(d.event+".tabs",f),e()):(clearTimeout(c.rotation),this.element.unbind("tabsshow",e),this.anchors.unbind(d.event+".tabs",f),delete this._rotate,delete this._unrotate),this}})}(jQuery);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/lib/jquery.ui.touch-punch.min.js	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,11 @@
+/*
+ * jQuery UI Touch Punch 0.2.2
+ *
+ * Copyright 2011, Dave Furfero
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ *
+ * Depends:
+ *  jquery.ui.widget.js
+ *  jquery.ui.mouse.js
+ */
+(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return;}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return;}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f);}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return;}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown");};c._touchMove=function(f){if(!a){return;}this._touchMoved=true;d(f,"mousemove");};c._touchEnd=function(f){if(!a){return;}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click");}a=false;};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f);};})(jQuery);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/js/lib/jsBezier-0.4-min.js	Tue Mar 19 23:50:07 2013 +0900
@@ -0,0 +1,8 @@
+(function(){"undefined"==typeof Math.sgn&&(Math.sgn=function(a){return 0==a?0:0<a?1:-1});var m={subtract:function(a,b){return{x:a.x-b.x,y:a.y-b.y}},dotProduct:function(a,b){return a.x*b.x+a.y*b.y},square:function(a){return Math.sqrt(a.x*a.x+a.y*a.y)},scale:function(a,b){return{x:a.x*b,y:a.y*b}}},w=Math.pow(2,-65),u=function(a,b){for(var f=[],d=b.length-1,h=2*d-1,g=[],c=[],k=[],i=[],l=[[1,0.6,0.3,0.1],[0.4,0.6,0.6,0.4],[0.1,0.3,0.6,1]],e=0;e<=d;e++)g[e]=m.subtract(b[e],a);for(e=0;e<=d-1;e++){c[e]=
+m.subtract(b[e+1],b[e]);c[e]=m.scale(c[e],3)}for(e=0;e<=d-1;e++)for(var n=0;n<=d;n++){k[e]||(k[e]=[]);k[e][n]=m.dotProduct(c[e],g[n])}for(e=0;e<=h;e++){i[e]||(i[e]=[]);i[e].y=0;i[e].x=parseFloat(e)/h}h=d-1;for(g=0;g<=d+h;g++){e=Math.max(0,g-h);for(c=Math.min(g,d);e<=c;e++){j=g-e;i[e+j].y=i[e+j].y+k[j][e]*l[j][e]}}d=b.length-1;i=r(i,2*d-1,f,0);h=m.subtract(a,b[0]);k=m.square(h);for(e=l=0;e<i;e++){h=m.subtract(a,s(b,d,f[e],null,null));h=m.square(h);if(h<k){k=h;l=f[e]}}h=m.subtract(a,b[d]);h=m.square(h);
+if(h<k){k=h;l=1}return{location:l,distance:k}},r=function(a,b,f,d){var h=[],g=[],c=[],k=[],i=0,l,e;e=Math.sgn(a[0].y);for(var n=1;n<=b;n++){l=Math.sgn(a[n].y);l!=e&&i++;e=l}switch(i){case 0:return 0;case 1:if(d>=64){f[0]=(a[0].x+a[b].x)/2;return 1}var o,i=a[0].y-a[b].y;e=a[b].x-a[0].x;n=a[0].x*a[b].y-a[b].x*a[0].y;l=max_distance_below=0;for(o=1;o<b;o++){var m=i*a[o].x+e*a[o].y+n;m>l?l=m:m<max_distance_below&&(max_distance_below=m)}o=e;l=(1*(n-l)-o*0)*(1/(0*o-i*1));o=e;e=n-max_distance_below;i=(1*
+e-o*0)*(1/(0*o-i*1));e=Math.min(l,i);if(Math.max(l,i)-e<w){c=a[b].x-a[0].x;k=a[b].y-a[0].y;f[0]=0+1*(c*(a[0].y-0)-k*(a[0].x-0))*(1/(c*0-k*1));return 1}}s(a,b,0.5,h,g);a=r(h,b,c,d+1);b=r(g,b,k,d+1);for(d=0;d<a;d++)f[d]=c[d];for(d=0;d<b;d++)f[d+a]=k[d];return a+b},s=function(a,b,f,d,h){for(var g=[[]],c=0;c<=b;c++)g[0][c]=a[c];for(a=1;a<=b;a++)for(c=0;c<=b-a;c++){g[a]||(g[a]=[]);g[a][c]||(g[a][c]={});g[a][c].x=(1-f)*g[a-1][c].x+f*g[a-1][c+1].x;g[a][c].y=(1-f)*g[a-1][c].y+f*g[a-1][c+1].y}if(d!=null)for(c=
+0;c<=b;c++)d[c]=g[c][0];if(h!=null)for(c=0;c<=b;c++)h[c]=g[b-c][c];return g[b][0]},v={},x=function(a){var b=v[a];if(!b){var b=[],f=function(a){return function(){return a}},d=function(){return function(a){return a}},h=function(){return function(a){return 1-a}},g=function(a){return function(b){for(var c=1,d=0;d<a.length;d++)c=c*a[d](b);return c}};b.push(new function(){return function(b){return Math.pow(b,a)}});for(var c=1;c<a;c++){for(var k=[new f(a)],i=0;i<a-c;i++)k.push(new d);for(i=0;i<c;i++)k.push(new h);
+b.push(new g(k))}b.push(new function(){return function(b){return Math.pow(1-b,a)}});v[a]=b}return b},p=function(a,b){for(var f=x(a.length-1),d=0,h=0,g=0;g<a.length;g++){d=d+a[g].x*f[g](b);h=h+a[g].y*f[g](b)}return{x:d,y:h}},q=function(a,b,f){for(var d=p(a,b),h=0,g=f>0?1:-1,c=null;h<Math.abs(f);){b=b+0.005*g;c=p(a,b);h=h+Math.sqrt(Math.pow(c.x-d.x,2)+Math.pow(c.y-d.y,2));d=c}return{point:c,location:b}},t=function(a,b){var f=p(a,b),d=p(a.slice(0,a.length-1),b),h=d.y-f.y,f=d.x-f.x;return h==0?Infinity:
+Math.atan(h/f)};window.jsBezier={distanceFromCurve:u,gradientAtPoint:t,gradientAtPointAlongCurveFrom:function(a,b,f){b=q(a,b,f);if(b.location>1)b.location=1;if(b.location<0)b.location=0;return t(a,b.location)},nearestPointOnCurve:function(a,b){var f=u(a,b);return{point:s(b,b.length-1,f.location,null,null),location:f.location}},pointOnCurve:p,pointAlongCurveFrom:function(a,b,f){return q(a,b,f).point},perpendicularToCurveAt:function(a,b,f,d){b=q(a,b,d==null?0:d);a=t(a,b.location);d=Math.atan(-1/a);
+a=f/2*Math.sin(d);f=f/2*Math.cos(d);return[{x:b.point.x+f,y:b.point.y+a},{x:b.point.x-f,y:b.point.y-a}]},locationAlongCurveFrom:function(a,b,f){return q(a,b,f).location}}})();
\ No newline at end of file