//
//  This script was developed
//  by Creato Ltd.
//  http://creato.biz
//
//	:: feel free to use it BUT
//	:: if you want to use this code PLEASE send a note
//	:: and please keep this disclaimer intact
//

cRemoteLoader = function()
{
	this.bWorking = false
}

cRemoteLoader.createContext = function( hLoader, hHandler )
{
	return function()
	{
		if( hLoader.hXMLHttp.readyState == 4 )
		{
			hHandler.call( hLoader )
			this.bWorking = false
		}
	}
}

cRemoteLoader.prototype.loadContent = function( sUrl, hHandler ) 
{
	if( sUrl )
	{
		this.bWorking = true
		this.hXMLHttp = XmlHttp.create()
		this.hXMLHttp.onreadystatechange = cRemoteLoader.createContext( this, hHandler )
		this.hXMLHttp.open( 'GET', sUrl )
		this.hXMLHttp.send( null ) 
	}
}

cRemoteLoader.prototype.abortLoading = function() 
{
	
	if( this.bWorking )
	{
		this.hXMLHttp.abort()
	}
	
}
