'-- ---------------------------------------------------------------------
'//
'//  File:         XmlClient.vbs
'//
'//  Description:  This script allows web authors to load Xml From ASP page 
'//                and get error by the standart Err Object	
'//
'//  Version 1.0
'//----------------------------------------------------------------------


    

sub loadXml (url, dom)

	dom.async=false
	dom.load url

	if dom.documentElement.nodename="error" then
		raiseError(dom)
	end if
end sub

function xmlHttp (url,dom)
on error resume next
dim objXmlhttp

set objXmlhttp = createobject("Msxml2.XMLHTTP")
    objXmlhttp.Open "POST", url,false
		if not dom is nothing then
			objXmlhttp.Send dom
		else
			objXmlhttp.Send
		end if	
		
		if objXmlhttp.responseXML.documentelement.nodename="error" then
			raiseError(objXmlhttp.responseXML)
		end if
    xmlHttp=objXmlhttp.responseText
end function

private sub raiseError (errDom)
	on error resume next
	dim num,source,des

	num=errDom.documentelement.childnodes(0).text
	source=errDom.documentelement.childnodes(1).text
	des=errDom.documentelement.childnodes(2).text
	Err.Raise num,source,des
end sub
