 


// function for dynamic prototypal Inheritance
function object(o) {
			
			function F() {}
			F.prototype = o;
			return new F();
			
			}




// gets an XMLHTTP request object
function HTTPRequestObject() {
    this._conn=null;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        this._conn = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        this._conn = new XMLHttpRequest();
    }
 
    
   
     
    return this;
}





var SOAPHandler = Class.create();


SOAPHandler.prototype = Object.extend(new WS.Handler(),{
  on_request : function(envelope) {
     // pre-request processing
  },
  on_response : function(call,envelope) {
     // post-response, pre-callback processing
  },
  on_error : function(call,envelope,transport) {

       alert("SOAPAction "+call.soapAction+": No data found for the criteria specified");
       

    

  }
});

 


function AjaxObject(id) 
{


 return {
         
                  
         
         //Methods
		sndGetReq: function(url,callback,auth) {
                         var http= null;


	                 function checkstatus()
                         {
		          var out;
		          if(http._conn.readyState == 4)
			  {
			 
			      if(http._conn.responseXML && http._conn.responseXML.documentElement)
			      {       
			        
                                out = http._conn.responseXML;
                               
			       }
			        else
			          out = http._conn.responseText;
                                  
	 
			          callback(null,out);
			  }
	                };

                        
			http= new HTTPRequestObject();
                        http._conn.open("GET", url);                      
                        if(auth)
                           http._conn.setRequestHeader("Authorization", auth);
                        
                        http._conn.setRequestHeader("accept","text/html,application/xhtml+xml,application/xhtml+xml;q=0.9,*/*;q=0.8;charset=UTF-8");
                        http._conn.onreadystatechange = checkstatus;
                        

			http._conn.send(null);

	                },

                
         
		sendSOAPPost: function(uri,envelope, func,soapaction) {
		var call = new WS.Call(escape(uri)); 
		
	
		call.add_handler(new SOAPHandler());		
		call.invoke(envelope,func,soapaction);
		}
};
}

