﻿// SpicyNodes Standard Calls
// -------------------------
//
// Called when animation starts after pressing on a node.
// @node - object serialized to string separated with @@:
//         "id:XX@@[attribute1_name]:[attribute1_value]@@[attribute2_name]:[attribute2_value]@@..."
//         where id: is the node's ID number
//               and attributes is the list of XML attributes of this node
//
// The lenght and naming of node's attributes depend no their definition is the XML nodemap file
//
// EXAMPLE of @node:
// [XML]: <node label="About us" htmlText="Read more about us..." color="0xff0000"/>
// @node: "id:192@@label:About us@@label:About us@@htmlText:Read more about us...@@color:0xff0000"
function onSNAnimationStart(node)
{	
	//alert("onStart")
	// unrem parsing if function is going to be used...
	// var parsedNode = parseNode(node);	
	//
	//
	// Additional custom action goes here...
}
function onSNAnimationEnd(node)
{
	//alert("onEnd")
	// unrem parsing if function is going to be used...
	//var parsedNode = parseNode(node);
	//
	//
	// Additional custom action goes here...
}
function onSNZoomIn()
{
	//alert("onZoomIn")
	// Additional custom action goes here...
}
function onSNZoomOut()
{
	//alert("onZoomOut")
	// Additional custom action goes here...
}
function onSNNodeOver(node)
{
	//alert("onNodeOver")
	// unrem parsing if function is going to be used...
	//var parsedNode = parseNode(node);
	//
	//
	// Additional custom action goes here...
}
function onSNNodeOut(node)
{
	//alert("onNodeOut")
	// unrem parsing if function is going to be used...
	//var parsedNode = parseNode(node);
	//
	//
	// Additional custom action goes here...
}
//
// parses a @node argument "id:xyx@@att1:123@@att2:abcs..." and returns an object:
// obj.id = xyz
// obj.att1 = 123
// obj.att2 = abc
// ...
function parseNode(node)
{
	var NodeArray = node.split("@@");	
	var splitArr;
	var obj = new Object()
	
	for(i=0;i<NodeArray.length;i++)
	{
		splitArr = NodeArray[i].split(":");
		obj[splitArr[0]]=splitArr[1]		
	}		
	return obj
}
//
//
//
//
//
//
// SpicyNodes Custom Calls
// -----------------------
//
//
//
//
// Following JS functions are called if a selected node has a javascript protocol
// function added to the nodemap's "loc" attributes, like:
//
//      <node label="My Label" loc="javascript:loadPost(10);"/>
//
// These are example functions. They can be removed or changed, and an unlimited number of additional functions
// can be added to this file below...
//
//
function loadPost(id)
{
	//alert("Loading post id: "+id);
}
function function1(arg1, arg2, arg3)
{
	//alert("Called function1 with args: "+arg1+","+arg2+","+arg3);
}
function function2(x,y)
{
	//alert("Called function2 with x: "+x+" y: "+y);
}
//
//
// ... and so on...