/**
*	Constructor 
*	Creates Flash Object and start downloading resource file from @url
*	
*	@param {String} id - id for flash object's div container
*	@param {String} url - url of the resource file that will be doanloaded
*
*/
function ImageLoader(id, url){
	
	this.htmlStr = '<div id="divFlashImageLoader_' + id + '">';
	this.htmlStr += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="125" height="40" id="imgloader_' + id + '">';
	this.htmlStr += '  <param name="movie" value="swf/imageLoader.swf?id=' + id + '&img=' + url + '" />';
	this.htmlStr += '  <param name="quality" value="high" />';
	this.htmlStr += '  <param name="allowScriptAccess" value="always" />';
	this.htmlStr += '  <param name="wmode" value="transparent" />';
	this.htmlStr += '  <embed src="swf/imageLoader.swf?id=' + id + '&img=' + url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="always" wmode="transparent" width="125" height="40" name="imgloader_' + id + '"></embed>';
	this.htmlStr += '</object>';
	this.htmlStr += '</div>';
	this.htmlStr += '<div id="divImageLoader_' + id + '"></div>';
	
	
	document.write(this.htmlStr);
}

/**
*	Replace Flash Object with the resource file downloaded
*	
*	@param {String} id - id of the flash object's container (in case there are more imageLoaders in the same HTML page)
*	@param {String} url - url of the downloaded resource file (this time the file is get from the browser's cache)
*/
function setimage(id_url) {
	paramsArr = id_url.split("###");
	id = paramsArr[0];
	url = paramsArr[1];
	document.getElementById("divFlashImageLoader_" + id).style.display = "none";
	document.getElementById("divImageLoader_" + id).innerHTML = "<img id='img_" + id + "' src='" + url + "' />";
}
