var SH = new Object();
SH.oT = '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>';
SH.cT = '</soap:Body></soap:Envelope>';
SH.xmlnsM = 'xmlns="http://tempuri.org/"'; 
SH.xmlnsP = 'xmlns="http://www.hotmap.ru/"';

SH.SO = function(sourceIds, objectIds) {var r='<SelectedObjects '+this.xmlnsP+'>';for (var i = 0; i < sourceIds.length; i++) r+='<SelectedObjectIdentifier><SourceId>'+sourceIds[i]+'</SourceId><ObjectId>'+objectIds[i]+'</ObjectId></SelectedObjectIdentifier>';r+='</SelectedObjects>';return r;}
SH.P = function(params) {return '<p><ThematicMapId '+this.xmlnsP+'>'+params.tmId+'</ThematicMapId><Width '+this.xmlnsP+'>'+params.width+'</Width><Height '+this.xmlnsP+'>'+params.height+'</Height><X '+this.xmlnsP+'>'+params.x+'</X><Y '+this.xmlnsP+'>'+params.y+'</Y><Scale '+this.xmlnsP+'>'+params.scale+'</Scale>'+this.SO(params.sourceIds, params.objectIds)+'<DrawScaleBar '+this.xmlnsP+'>'+params.drawScaleBar+'</DrawScaleBar></p>';}

SH.GM = function() {return this.oT+'<GetMaps '+this.xmlnsM+' />'+this.cT;}
SH.GPOI = function() {return this.oT+'<GetPointsOfInterestInJson '+this.xmlnsM+' />'+this.cT;}
SH.GTM = function(mId) {return this.oT+'<GetThematicMaps '+this.xmlnsM+' /><mID>'+mId+'</mID></GetThematicMaps>'+ this.cT;}
SH.GCMP = function(params, rect_x, rect_y, rect_width, rect_height) {return this.oT+'<GetCorrectMapParameters '+this.xmlnsM+'>'+this.P(params)+'<rect><Location '+this.xmlnsP+'><X>'+rect_x+'</X><Y>'+rect_y+'</Y></Location><Size '+this.xmlnsP+'><Width>'+rect_width+'</Width><Height>'+rect_height+'</Height></Size><X '+this.xmlnsP+'>'+rect_x+'</X><Y '+this.xmlnsP+'>'+rect_y+'</Y><Width '+this.xmlnsP+'>'+rect_width+'</Width><Height '+this.xmlnsP+'>'+rect_height+'</Height></rect></GetCorrectMapParameters>'+this.cT;}
SH.GMEMP = function(tmId, width, height) {return this.oT+'<GetMaxExtentMapParameters '+this.xmlnsM+'><tmID>'+tmId+'</tmID><width>'+width+'</width><height>'+height+'</height></GetMaxExtentMapParameters>'+ this.cT;}
SH.VSID = function(params, type, id) {return this.oT+'<VerifySemanticID '+this.xmlnsM+'>'+ this.P(params)+'<type>'+type+'</type><id>'+id+'</id></VerifySemanticID>'+this.cT;}
SH.GTT = function(params, x, y) { return this.oT+'<GetTooltip '+this.xmlnsM+'>'+this.P(params)+'<x>'+x+'</x><y>'+y+'</y></GetTooltip>'+this.cT;}
SH.GTT2 = function(params, x, y, layers) {var r=this.oT+'<GetTooltip2 '+this.xmlnsM+'>'+this.P(params)+'<x>'+x+'</x><y>'+y +'</y><layers>';for(var l=0;l<layers.length;l++) r+='<int>'+layers[l]+'</int>';r+= '</layers></GetTooltip2>' + this.cT;return r;}
SH.GSID = function(params, x, y, type) {return this.oT+'<GetSemanticID '+this.xmlnsM+'>'+this.P(params)+'<x>'+x+'</x><y>'+y+'</y><type>'+type+'</type></GetSemanticID>'+this.cT;}
SH.GMPA = function(params, regionName, areaName, moName, townName, streetName, addressName) {return this.oT+'<GetMapParametersByAddress '+this.xmlnsM+'>'+this.P(params)+'<regionName>'+regionName+'</regionName><areaName>'+areaName+'</areaName><moName>'+moName+'</moName><townName>'+townName+'</townName><streetName>'+streetName+'</streetName><addressName>'+addressName+'</addressName></GetMapParametersByAddress>'+this.cT;}
SH.GMPYA = function(width, height, streetName, addressName) {return this.oT+'<GetMapParametersByYarAddress '+this.xmlnsM+'><width>'+width+'</width><height>'+height+'</height><streetName>'+streetName+'</streetName><addressName>'+addressName+'</addressName></GetMapParametersByYarAddress>'+this.cT;}
SH.GMPTA = function(width, height, townName, streetName, addressName) {return this.oT + '<GetMapParametersByTownAddress '+this.xmlnsM+'><width>'+width+'</width><height>'+height+'</height><townName>'+townName+'</townName><streetName>'+streetName+'</streetName><addressName>'+addressName+'</addressName></GetMapParametersByTownAddress>'+this.cT;}
SH.GME = function(tmID) {return this.oT+'<GetManagedElements '+this.xmlnsM+'><tmID>'+tmID+'</tmID></GetManagedElements>'+this.cT;}
SH.LAD = function(type, mask, parentType, parentId) {return this.oT+'<LoadAddresserData '+this.xmlnsM+'><type>'+type+'</type><mask>'+mask+'</mask><parentType>'+parentType+'</parentType><parentId>'+parentId+'</parentId></LoadAddresserData>'+this.cT;}
