/****************************************************************************
* Flash Tag Write Object v1.5 - by Lucas Fererira - www.lucasferreira.com	*
* Info and Usage: www.lucasferreira.com/flashtag							*
* bugs/reports: contato@lucasferreira.com									*
****************************************************************************/

if(Browser == undefined){
	var Browser = {
		isIE: function(){ return (window.ActiveXObject && document.all && navigator.userAgent.toLowerCase().indexOf("msie") > -1  && navigator.userAgent.toLowerCase().indexOf("opera") == -1) ? true : false; }
	}
}

var Flash = function(movie, id, width, height, initParams){

	this.html = "";
	this.attributes = this.params = this.variables = null;
	
	this.variables = new Array();
	this.attributes = {
		"classid": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
		"codebase": "http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=7,0,0,0",
		"type": "application/x-shockwave-flash"
	}
	this.params = { "pluginurl": "http://www.macromedia.com/go/getflashplayer_br" };
	
	if(movie) {
		this.addAttribute("data", movie);
		this.addParameter("movie", movie);
	}
	
	if(id && id != null) this.addAttribute("id", id);
	if(width) this.addAttribute("width", width);
	if(height) this.addAttribute("height", height);
	
	if(initParams != undefined){
		for(var i in initParams){
			this.addParameter(i.toString(), initParams[i]);
		}
	}
	
}
Flash.version = "1.2b";
Flash.getObjectByExceptions = function(obj, excep){
	var tempObj = {};
	for(var i in obj){
		var inclui = true;
		for(var j=0; j<excep.length; j++)
			if(excep[j] == i.toString()) { inclui = false; break; };
		if(inclui) tempObj[i] = obj[i];
	}
	return tempObj;
}
Flash.prototype.addAttribute = function(prop, val){ this.attributes[prop] = val; }
Flash.prototype.addParameter = function(prop, val){ this.params[prop] = val; }
Flash.prototype.addVariable = function(prop, val){ this.variables.push([prop, val]); }
Flash.prototype.getFlashVars = function(){
	var tempString = new Array();
	
	for(var i=0; i<this.variables.length; i++)
		tempString.push(this.variables[i].join("="));
		
	return tempString.join("&");
}
Flash.prototype.toString = function(){
	
	this.params.flashVars = this.getFlashVars();
	if(Browser.isIE()){
		//IE
		this.html = "<ob" + "ject";
		var attr = Flash.getObjectByExceptions(this.attributes, ["type", "data"]);
		for(var i in attr) if(i.toString() != "extend") this.html += " " + i.toString() + " = \"" + attr[i] + "\"";
		this.html += "> ";
		var params = Flash.getObjectByExceptions(this.params, ["pluginurl", "extend"]);
		for(var i in params) if(i.toString() != "extend") this.html += "<param name=\"" + i.toString() + "\" value=\"" + params[i] + "\" /> ";
		this.html += " </obj" + "ect>";
	} else {
		//non-IE
		this.html = "<!--[if !IE]> <--> <obj" + "ect";
		var attr = Flash.getObjectByExceptions(this.attributes, ["classid", "codebase"]);
		for(var i in attr) if(i.toString() != "extend") this.html += " " + i.toString() + " = \"" + attr[i] + "\"";
		this.html += "> ";
		var params = Flash.getObjectByExceptions(this.params, ["extend"]);
		for(var i in params) if(i.toString() != "extend") this.html += "<param name=\"" + i.toString() + "\" value=\"" + params[i] + "\" /> ";
		this.html += " </obj" + "ect> <!--> <![endif]-->";
	}

	return this.html;
	
}
Flash.prototype.write = Flash.prototype.outIn = Flash.prototype.writeIn = function(w){
	if(typeof w == "string" && document.getElementById) var w = document.getElementById(w);
	if( w != undefined && w ) w.innerHTML = this.toString();
	else document.write( this.toString() );
}

//funções de automatização...
Flash.correctAll = function(){
	
	if(!/MSIE (5|6)/.test(navigator.userAgent) || !document.getElementsByTagName) return false;

	for (var i = 0, objects = document.getElementsByTagName("OBJECT");
			i < objects.length; (objects[i].outerHTML ? (objects[i].outerHTML = objects[i].outerHTML, objects[i].style.visibility = "visible") : null), i++);

}
Flash.automatic = function(r){
	
	if(r && window.attachEvent){
	
		for (var i = 0, objects = document.getElementsByTagName("OBJECT");
				i < objects.length; (objects[i].style.visibility = "hidden"), i++);
		
		window.attachEvent("onload", Flash.correctAll);
		window.attachEvent("onunload", function(){	window.detachEvent("onload", Flash.correctAll);	});
		
	} else {
		Flash.correctAll();
	}

}
// --------------------- PopUPs -----------------------------
function open_Popup(name) {
    var newWindow = window.open((name), 'popOpen', 'width=500,height=350,scrollbars=yes,resizable=yes,toolbar=no,status=yes,menubar=no');
    if (newWindow && !newWindow.opener) newWindow.opener = self;
	if (self.opb_in_popup != null) window.close();
}

function WindowPopup(Name, Parameters) 
{
    var newWindow = window.open( (Name), 'popWin', (Parameters) ); 
}

if ((typeof wsmlMakeWebServiceHref) == "undefined")
{
  wsmlMakeWebServiceHref =  wsmlMakeResourceUrl = wsmlMakeLeakHref = 
  wsmlMakeCssHref = new Function ("u", "return u;");
}

function Popup_cafe(name,width,height,id) {
    var winName = id ? id : 'popPhoto';
	var newWindow = window.open((wsmlMakeLeakHref(name)), winName, 'width=' + width + ',height=' + height +',scrollbars=no,resizable=no,toolbar=no,status=no,menubar=no');
	if (self.opb_in_popup != null) window.close();
}

function meu_Popup(name,width,height,id) {
    var winName = id ? id : 'popPhoto';
	var newWindow = window.open((wsmlMakeLeakHref(name)), winName, 'width=' + width + ',height=' + height +',scrollbars=no,resizable=no,toolbar=no,status=no,menubar=no');
	if (self.opb_in_popup != null) window.close();
}

function photo_Popup(name,width,height,id) {
    var winName = id ? id : 'popPhoto';
	var newWindow = window.open((wsmlMakeLeakHref(name)), winName, 'width=' + width + ',height=' + height +',scrollbars=yes,resizable=no,toolbar=no,status=no,menubar=no');
	if (self.opb_in_popup != null) window.close();
}

function resize_Popup(name,width,height) {
	var newWindow = window.open((wsmlMakeLeakHref(name)), 'popResize', 'width=' + width + ',height=' + height +',scrollbars=yes,resizable=yes,toolbar=no,status=no,menubar=no');
	if (self.opb_in_popup != null) window.close();
}

function external_link(name,width,height,scrollbars,resizable,toolbar,status,menubar) {
	var newWindow = window.open((name), 'popExternal', 'width=' + width + ',height=' + height + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',toolbar=' + toolbar + ',status=' + status + ',menubar=' + menubar + "'");
	if (self.opb_in_popup != null) window.close();
}

// same as above, but only has the first parameter
function external_link2(name) {
	var newWindow = window.open((name));
	if (self.opb_in_popup != null) window.close();
}

function Pcertify() { 
	popupWin = window.open('http://www.bbbonline.org/cks.asp?id=201011617182710681', 'Participant', 'location=yes,scrollbars=yes,width=450,height=300') 
	window.name = 'opener'; 
}

function popAdvisor(path) {
  var openvars = "width=575,height=539,resizable=yes,scroll=auto";
  var wnd      = window.open(path, 'Advisor', openvars);
  if (self.opb_in_popup != null) window.close();
}

var zeroComm = "comente";
var humComm = "";
var enesComm = "";

var url;
function abre(url,w,h,scr)
{
window.open(url,'comentarios','width='+w+',height='+h+',directories=0,location=0,menubar=0,resizable=0,scrollbars='+scr+',status=0,toolbar=0,marginleft=0,margintop=0,left=25,top=25');
}

function commentText(qtd)
{
if(qtd == "0")
txtFinal = "("+qtd+") "+ zeroComm;
else if (qtd == "1")
txtFinal = "("+qtd+") "+ humComm;
else
txtFinal = "("+qtd+") "+ enesComm;
return txtFinal;
}
