function LSGetData()
{
	var _parm="",_method="",_ErrMethod="",_ReqSec="",_optflg="";
	var _ClsId="", _webMethod="", _ResultTag, rValue="";
	var _showDiv=true;
	var srch_WServiceUrl ="";
	this.SetParam=SetParam;
	this.SetAsycMethod=SetAsycMethod;
	this.SetErrMethod=SetErrMethod;
	this.ReqSecuredServer=ReqSecuredServer;
	this.SetOptionFlag=SetOptionFlag;
	this.SetClassId=SetClassId;
	this.GetData= GetData;
	this.BaseDiv=BaseDiv;
	this.HideDiv=HideDiv;
	this.WebMethod=function(val){
	                    _webMethod=val;
	                }
	this.ResultTag=function(val){
	                    _ResultTag=val;
	                }
	
	this.OutPut=function(){return rValue;}
	this.ShowDiv=function(val){_showDiv=val;}
	function GetData()
	{
		var srch_objXML
		if(_showDiv)
		BaseDiv();
		//return false;
		if (_ReqSec.toUpperCase() =="YES")
			srch_WServiceUrl = "https://"+ window.location.host +"/Eventsv2/HBRCService.asmx";
		else if ((_ReqSec=="") || (_ReqSec.toUpperCase()=="NO"))
			srch_WServiceUrl = "http://"+ window.location.host +"/Eventsv2/HBRCService.asmx";
		
		if (window.ActiveXObject)
		{
		  srch_objXML = new ActiveXObject("Microsoft.XMLHTTP");
		}
		else
		{
		  srch_objXML = new XMLHttpRequest();
		}

		if(srch_objXML)
		{
		
		var pstxml="";
		pstxml = pstxml + "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
        pstxml = pstxml + "<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/\">";
        pstxml = pstxml + "<soap:Body>";
        pstxml = pstxml + "<BHRCData xmlns=\"http://tempuri.org/\">";
        pstxml = pstxml + "<sXml>"+_parm+"</sXml>";
        pstxml = pstxml + "<Option>"+_ClsId+"</Option>";
        pstxml = pstxml + "</BHRCData>";
        pstxml = pstxml + "</soap:Body>";
        pstxml = pstxml + "</soap:Envelope>";

			try
			{
				srch_objXML.open("POST", srch_WServiceUrl, true);
				srch_objXML.setRequestHeader("Man", "POST /Eventsv1/HBRCService.asmx HTTP/1.1")
				srch_objXML.setRequestHeader("Content-Type", "text/xml")
				srch_objXML.setRequestHeader("Content-Length", pstxml.length);
				srch_objXML.onreadystatechange = function()
				{
					if ((srch_objXML.readyState == 4 )&& (srch_objXML.status == 200))
						{
							srchObj = FnXMLObject(srch_objXML.responseText);
							var nodobj = srchObj.getElementsByTagName("BHRCDataResult")[0];
							if (nodobj !=null)
							{
							    
								if (window.ActiveXObject)
								    rValue=nodobj.text;
								else
								    rValue=nodobj.textContent;
								//rValue=rValue.replace(/\"/g, "'");
								//rValue=rValue.replace(/&/g,"&amp;");
								//var local= _method +"(\""+rValue+"\",\""+_optflg +"\")";
								if(_showDiv)
								HideDiv();
								eval(_method+"("+_optflg+")");
								//eval(_method+"()");
							}
						}
				    else if((srch_objXML.readyState == 4 )&& (srch_objXML.status != 200))
				    {
				        var eResponse=srch_objXML.responseText;
				            //eResponse=eResponse.replace(/\"/g, "");
						    //eResponse=eResponse=rValue.replace(/&/g,"&amp;");
				        var Errlocal= _ErrMethod +"(\""+"Error NO:"+srch_objXML.status+" Error:"+ srch_objXML.statusText+"\",\""+_optflg +"\")";
						if(_showDiv)
						HideDiv();
						eval(Errlocal);
				    }
					else if ((srch_objXML.readyState == 301 ) || (srch_objXML.readyState == 302) ||
						(srch_objXML.readyState == 403 ) || (srch_objXML.readyState == 404 ))
					{
						var Errlocal= _ErrMethod +"(\""+srch_objXML.status+"\",\""+_optflg +"\")";
						if(_showDiv)
						HideDiv();
						eval(Errlocal);
					}
				}
				srch_objXML.send(pstxml);
			}
			catch(e)
			{
				alert(e.message);
			}
		}
	
	}
	function SetOptionFlag(InpOptFlg)
	{
		_optflg = InpOptFlg;
	}
	function SetClassId(clsnam)
	{
		_ClsId = clsnam;
	}
	function ReqSecuredServer(InpValue)
	{
		_ReqSec = InpValue;
	}
	function SetErrMethod(InpErrMethod)
	{
		_ErrMethod = InpErrMethod;
	}
	function SetAsycMethod(InpMethod)
	{
		_method = InpMethod
	}
	function SetParam(InpXml)
	{
		_parm = InpXml;
	}
	function BaseDiv()
    {
        var js_dvhight;
        try
        {
            js_dvhight = JF_gettop('dv_ftr', '');
        }catch(ex){
            js_dvhight = 500;
        }
        
        var js_loadimg_ht;
        try
        {
        js_loadimg_ht = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;            
        }catch(ex){
            try{
            js_loadimg_ht = window.scrollY;
            }catch(exe){
                js_loadimg_ht = 500;
            }
        }
        js_loadimg_ht = js_loadimg_ht + 100;
        
        if(document.getElementById('dv_transp'))
        {   
            document.getElementById('dv_transp').style.height = (js_dvhight) + 'px';
            document.getElementById('td_img').innerHTML = '<img src=\"images/loading.gif\" style=\"margin-top:'+js_loadimg_ht+'px\"/>';
            document.getElementById('dv_transp').style.display = '';
        }
    }
    function HideDiv()
    {
        if(document.getElementById('dv_transp'))
        setTimeout("document.getElementById('dv_transp').style.display = 'none';",500);
    }
}

function LSCreateXML()
{
    var _xmlroot="";
	var _xmlstring="";
	this.StartTag = StartTag;
	this.AddParam = AddParam;
	this.EndTag = EndTag;
	this.GetXml = GetXml;
	function StartTag(sroot)
	{
	    if(sroot !=undefined && sroot !="")
	    {	     
		  _xmlstring = "<"+sroot+">";
		  _xmlroot="</"+sroot+">";
	    }
	    else
	    {
	      _xmlstring = "<root>";
		  _xmlroot="</root>";	      
	    }	   
	}
	function AddParam(nName, nValue)
	{
		_xmlstring = _xmlstring + "<" + nName + ">" + JF_XmlReplace(nValue) + "</" + nName + ">"
	}
	function EndTag()
	{
		_xmlstring = _xmlstring + _xmlroot;
	}
	function GetXml()
	{
		return _xmlstring;
	}	
    function JF_XmlReplace(data)
    {  
      data=data.replace(/&/gi, "&amp;");
      data=data.replace(/</gi, "&lt;");
      data=data.replace(/>/gi, "&gt;");
      data=data.replace(/'/gi, "&apos;");
      data=data.replace(/\"/gi,"&quot;");  
      return data;
    }
}

function FnXMLObject(XmlString)
{
    var srch_XMLObj;
    if (window.ActiveXObject)
    {
       srch_XMLObj = new ActiveXObject("Microsoft.XMLDOM");
       srch_XMLObj.async = false;
       srch_XMLObj.loadXML(XmlString);
    }
    else 
    {
       var srch_objDom = new DOMParser();
       srch_XMLObj = srch_objDom.parseFromString(XmlString, "text/xml");
    }
    
    return(srch_XMLObj);
}
function ReplaceLtGt(sVal)
{
    
}
function ReplaceAll(sValue)
{
	return sValue.replace(/\"/g, "")
}
