function JSONscriptRequest(fullUrl) {
   this.headLoc = document.getElementsByTagName("head").item(0);

var cells = this.headLoc.getElementsByTagName("script"); 
for (var i = 0; i < cells.length; i++) { 
if (cells[i].getAttribute("id")=="tmpscript") cells[i].parentNode.removeChild(cells[i]);
}
 
    this.scriptObj = document.createElement("script");
    this.scriptObj.setAttribute("type", "text/javascript");
    this.scriptObj.setAttribute("id", "tmpscript");
    this.scriptObj.setAttribute("charset", "utf-8");
    this.scriptObj.setAttribute("src", fullUrl + '&noCacheIE=' + (new Date()).getTime());
    this.headLoc.appendChild(this.scriptObj);

}


JSONscriptRequest.prototype={

}


function BodyMapMarkerType(name,icon)
{
this.name=name;
this.icon=icon;
}
BodyMapMarkerType.prototype={}


function BodyMapMarker(id,name,description,x,y,zoom,maptype,drawid,icon,parent,gender,position,parentname,childrentype,video)
{
this.id=id;
this.name=name;
this.gender=gender
this.position=position
this.description=description;
this.x=x;
this.y=y;
this.objecttype="Marker";
this.zoom=zoom;
this.parent=parent;
this.parentname=parentname;
this.childrentype=childrentype;
this.maptype=maptype;
this.drawid=drawid;
this.icon=icon;
this.event="";
this.video=video;
}
BodyMapMarker.prototype={}





function BodyMapXML(name){
this.name=name;
this.pagesize=10;
this.spage=0;
this.xmlDoc = "";      
this.searchstring="";
this.maparray=Array();
this.searcharray=Array();
this.iconarray=Array();
this.hilight=Array();
this.path="http://www.bodymaps.org/";
}

BodyMapXML.prototype={

GetMapInfoFromMapCode: function(mapimg,func)
{
if (func==undefined) func="";
this.XML=new JSONscriptRequest(this.path+"apimapconverter.php?func=5&map="+mapimg+"&varname="+this.name+"&funcs="+func); 
},
GetMarkerTypeIcons: function(func)
{
if (func==undefined) func="";
this.XML=new JSONscriptRequest(this.path+"apimapconverter.php?func=3&varname="+this.name+"&funcs="+func);
},
HiLighter: function (text,start,end,func)
{
if (func==undefined) func="";
this.XML=new JSONscriptRequest(this.path+"apimapconverter.php?func=4&varname="+this.name+"&funcs="+func+"&first="+escape(start)+"&last="+escape(end)+"&text="+text);
},
GetMapArray: function (gender,position,func) {
if (func==undefined) func="";
this.XML=new JSONscriptRequest(this.path+"apimapconverter.php?func=2&Gender="+gender+"&Position="+position+"&varname="+this.name+"&funcs="+func);
},

MapCodeConvert: function (mapimg,gender,position,func) {
if (func==undefined) func="";
this.XML=new JSONscriptRequest(this.path+"apimapconverter.php?func=1&map="+mapimg+"&Gender="+gender+"&Position="+position+"&varname="+this.name+"&funcs="+func); 
},

Search: function(position,gender,maptype,searchtype,func) {
var searchpath="apisearch.php?searchtype="+searchtype+"&i="+this.searchstring+"&pagesize="+this.pagesize+"&page="+this.spage+"&Gender="+gender+"&Position="+position+"&Maptype="+maptype+"&varname="+this.name+"&funcs="+func;
this.searcharray=Array();
this.XML=new JSONscriptRequest(this.path+searchpath); 
}




}






