15 February 2012
put this line wherever u needed to do this.
var string = (new XMLSerializer()).serializeToString(xmlDoc);
//------------- load a string into dom --------
//@param: string to be loaded
//@return: xml dom document
function dom_load(string)
{
//alert("dom_load");
if (window.DOMParser)
{
parser=new DOMParser();
xmlDoc=parser.parseFromString(string,"text/xml");
}
else // Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(string);
}
}
//--------- to get angle between two points ---------
//---param---
//@x1,x2,y1,y2 : cordinates of 2 points
//@return: theta(value in degrees)
function getTanTheta(x1,y1,x2,y2)
{
var y = eval(y2)-eval(y1);
var x = eval(x2)-eval(x1);
if(y < 0) { y = -y;}
if(x < 0) { x = -x;}
//alert(y+' '+x);
var tanTheta = y/x;
if(tanTheta < 0) { tanTheta = -x;}
tanTheta = roundNumber(tanTheta,3);
//alert(tanTheta);
return tanTheta;
}