var allowFlashRemoting = false;
function startFlashRemoting(){
	if(document.getElementById && document.createElement){
		allowFlashRemoting = true;
	}else{
		alert("Flash Remoting cannot be initialized");
	}
}
function callFlashRemoting(gateway,path,func,arg){
	if(allowFlashRemoting == true){
		if(typeof(eval(func)) == "function"){
			var returnval = eval(func)(arg);
			returnFlashRemoting(gateway,path,func,returnval);
		}else{
			alert("Flash Remoting Error: Cannot locate javascript method '"+func+"()'");
		}
	}else{
		setTimeout("callFlashRemoting("+gateway+","+path+","+func+","+arg+")", 50);
	}
}
function returnFlashRemoting(gateway,path,func,returnval){
	if(!document.getElementById(gateway)){
		var divholder = document.createElement("div");
		divholder.id = gateway;
		document.body.appendChild(divholder);
	}
	document.getElementById(gateway).innerHTML = "";
	var gatewaydata = path+"|||"+func+"|||"+returnval;
	var divinfo = "<embed src='gateway.swf' FlashVars='lc="+gateway+"&rq="+escape(gatewaydata)+"' width='0' height='0' type='application/x-shockwave-flash'></embed>";
	document.getElementById(gateway).innerHTML = divinfo;
}
function initLargeFlashValue(jsvar){
	this[jsvar] = "";
}
function streamLargeFlashValue(jsvar, val){
	this[jsvar] += val;
}
function endLargeFlashValue(jsvar){
	this[jsvar] = this[jsvar].split("#singlequote#").join("'").split("#return#").join("\r").split("#newline#").join("\n");
	if(typeof(this[jsvar+"_Result"]) == "function") this[jsvar+"_Result"](this[jsvar]);
}
