// JavaScript Document
// exibe o erro na página em um alert
function error(msg, url, line){
	//return true;
	alert(
		"Erro na página \n\n"	+
		"Error:	" + msg + "\n"	+
		"URL:	" + url + "\n"	+
		"Line:	" + line
	);
}
window.onerror = error;

//atacha o flash em uma div
//                   1obr 2obr   3obr    4opc	 5opc	6opc   7opc   	8opc
function attachFlash(url, width, height, target, wmode, scale, quality, vars){
	var content; identity = url.split("."); identity = identity[0]; 
	if(!target) { document.write("<div id=\"id_"+ identity +"\"></div>"); target = "id_"+ identity;}
	if(!quality)quality	= "best";
	target = document.getElementById(target);
	content =  "<object id=\"" + identity + "\" width=\"" + width + "\" height=\"" + height + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\">";
    content += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
	content +=  "<param name=\"movie\" value=\"" + url + "?" + vars +"\">";
    content +=  "<param name=\"quality\" value=\"" + quality + "\">";
	content +=  "<param name=\"wmode\" value=\"" + wmode + "\" /> ";
	content +=  "<param name=\"bgcolor\" value=\"#F2B775\" /> ";
    content +=  "<embed name=\"" + identity + "\" src=\"" + url + "?" + vars +"\"  width=\"" + width + "\" height=\"" + height + "\" wmode=\"" + wmode + "\" scale=\"" + scale + "\" quality=\"" + quality + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"></embed>";
	content +=  "</object>";
	target.innerHTML = content;
}
//manda uma variavel no flash
function talkFlash(fla, func, arguments){
	if(window[fla])		window.document[fla].SetVariable("_root.func", func);
	if(document[fla])	document[fla].SetVariable("_root.func", func);
	
	if(window[fla]) 	window.document[fla].SetVariable(arguments, arguments);
	if(document[fla])	document[fla].SetVariable(arguments, arguments);
	
	if(window[fla])		window.document[fla].SetVariable("_root.flag", arguments);
	if(document[fla])	document[fla].SetVariable("_root.flag", arguments);
}
/*
_root.watch("flag", function() { 
    eval(this.func)(); 
}); 
*/