function _CreateXMLHttpRequest()
{
	if(window.XMLHttpRequest)
	{
		return new XMLHttpRequest();
	}
	else
	{
		if(window.ActiveXObject)
		{
        	return new ActiveXObject("Microsoft.XMLHTTP");
		}
		else
		{
			return null;
		}
	}
}

function _RequestFile(method,URL,asyncFlag,sendContent,container,alterText)
{
	var objHttp = _CreateXMLHttpRequest();
	if(objHttp == null) return false;

	objHttp.onreadystatechange = function()
    {
		if(objHttp.readyState == 4)
		{
			if(objHttp.status == 200)
			{
				_OnFileLoaded(objHttp,container,true,alterText);
			}
			else
			{
				_OnFileLoaded(objHttp,container,false,alterText);
			}
		}
	}

	objHttp.open(method,URL,asyncFlag);

	switch(method)
	{
		case "GET":
			objHttp.setRequestHeader("If-Modified-Since", "Thu, 01 Jun 1970 00:00:00 GMT");
			break;

		case "POST":
			objHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			break;
	}

	objHttp.send(sendContent);

}


function _OnFileLoaded(httpObject,container,rflag,alterText)
{
	if(rflag)
	{
		document.getElementById(container).innerHTML = httpObject.responseText;
	}
	else
	{
		document.getElementById(container).innerHTML = "<img src=\"" + alterText + "\" alt=\"" + httpObject.status + httpObject.statusText + "\" />";
	}
}

//

function _ProxyCall(asyncURL,asyncBlock,asyncAltImg)
{
	if(_RequestFile('GET',asyncURL,true,null,asyncBlock,asyncAltImg) == false)
	{
		document.getElementById(asyncBlock).innerHTML = "<img src=\"" + asyncAltImg + "\" />";
	}
	else
	{

	}
}

//

function _EmbedSwfFile(swfFile,swfWidth,swfHeight,swfId,swfLoop,swfQuqlity,swfBgColor)
{
	var txtSwfText = '';

	txtSwfText += '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	txtSwfText += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
	txtSwfText += 'WIDTH="' + swfWidth + '" HEIGHT="' + swfHeight + '" id="' + swfId + '" ALIGN="">';
	txtSwfText += '<PARAM NAME=movie VALUE="' + swfFile +'">';
	txtSwfText += '<PARAM NAME=loop VALUE=' + swfLoop +'>';
	txtSwfText += '<PARAM NAME=quality VALUE=' + swfQuqlity +'>';
	txtSwfText += '<PARAM NAME=bgcolor VALUE=' + swfBgColor +'>';

	txtSwfText += '<EMBED src="' + swfFile + '" ';
	txtSwfText += 'loop=' + swfLoop + ' quality=' + swfQuqlity +' bgcolor=' + swfBgColor;
	txtSwfText += ' WIDTH="' + swfWidth + '" HEIGHT="' + swfHeight + '" NAME="' + swfId + '" ALIGN="" ';
	txtSwfText += 'TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">';
	txtSwfText += '</EMBED></OBJECT>';

	document.write(txtSwfText);
}


