var dominio = "http://"+document.domain+"/";

//Ajax
function sack(file) {
	this.xmlhttp = null;

	this.resetData = function() {
		this.method = "POST";
  		this.queryStringSeparator = "?";
		this.argumentSeparator = "&";
		this.URLString = "";
		this.encodeURIString = true;
  		this.execute = false;
  		this.element = null;
		this.elementObj = null;
		this.requestFile = file;
		this.vars = new Object();
		this.responseStatus = new Array(2);
  	};

	this.resetFunctions = function() {
  		this.onLoading = function() { };
  		this.onLoaded = function() { };
  		this.onInteractive = function() { };
  		this.onCompletion = function() { };
  		this.onError = function() { };
		this.onFail = function() { };
	};

	this.reset = function() {
		this.resetFunctions();
		this.resetData();
	};

	this.createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				this.xmlhttp = null;
			}
		}

		if (! this.xmlhttp) {
			if (typeof XMLHttpRequest != "undefined") {
				this.xmlhttp = new XMLHttpRequest();
			} else {
				this.failed = true;
			}
		}
	};

	this.setVar = function(name, value){
		this.vars[name] = Array(value, false);
	};

	this.encVar = function(name, value, returnvars) {
		if (true == returnvars) {
			return Array(encodeURIComponent(name), encodeURIComponent(value));
		} else {
			this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
		}
	}

	this.processURLString = function(string, encode) {
		encoded = encodeURIComponent(this.argumentSeparator);
		regexp = new RegExp(this.argumentSeparator + "|" + encoded);
		varArray = string.split(regexp);
		for (i = 0; i < varArray.length; i++){
			urlVars = varArray[i].split("=");
			if (true == encode){
				this.encVar(urlVars[0], urlVars[1]);
			} else {
				this.setVar(urlVars[0], urlVars[1]);
			}
		}
	}

	this.createURLString = function(urlstring) {
		if (this.encodeURIString && this.URLString.length) {
			this.processURLString(this.URLString, true);
		}

		if (urlstring) {
			if (this.URLString.length) {
				this.URLString += this.argumentSeparator + urlstring;
			} else {
				this.URLString = urlstring;
			}
		}

		this.setVar("rndval", new Date().getTime());

		urlstringtemp = new Array();
		for (key in this.vars) {
			if (false == this.vars[key][1] && true == this.encodeURIString) {
				encoded = this.encVar(key, this.vars[key][0], true);
				delete this.vars[key];
				this.vars[encoded[0]] = Array(encoded[1], true);
				key = encoded[0];
			}

			urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
		}
		if (urlstring){
			this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
		} else {
			this.URLString += urlstringtemp.join(this.argumentSeparator);
		}
	}

	this.runResponse = function() {
		eval(this.response);
	}

	this.runAJAX = function(urlstring) {
		if (this.failed) {
			this.onFail();
		} else {
			this.createURLString(urlstring);
			if (this.element) {
				this.elementObj = document.getElementById(this.element);
			}
			if (this.xmlhttp) {
				var self = this;
				if (this.method == "GET") {
					totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
					this.xmlhttp.open(this.method, totalurlstring, true);
				} else {
					this.xmlhttp.open(this.method, this.requestFile, true);
					try {
						this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
					} catch (e) { }
				}

				this.xmlhttp.onreadystatechange = function() {
					switch (self.xmlhttp.readyState) {
						case 1:
							self.onLoading();
							break;
						case 2:
							self.onLoaded();
							break;
						case 3:
							self.onInteractive();
							break;
						case 4:
							self.response = self.xmlhttp.responseText;
							self.responseXML = self.xmlhttp.responseXML;
							self.responseStatus[0] = self.xmlhttp.status;
							self.responseStatus[1] = self.xmlhttp.statusText;

							if (self.execute) {
								self.runResponse();
							}

							if (self.elementObj) {
								elemNodeName = self.elementObj.nodeName;
								elemNodeName.toLowerCase();
								if (elemNodeName == "input"
								|| elemNodeName == "select"
								|| elemNodeName == "option"
								|| elemNodeName == "textarea") {
									self.elementObj.value = self.response;
								} else {
									self.elementObj.innerHTML = self.response;
								}
							}
							if (self.responseStatus[0] == "200") {
								self.onCompletion();
							} else {
								self.onError();
							}

							self.URLString = "";
							break;
					}
				};

				this.xmlhttp.send(this.URLString);
			}
		}
	};

	this.reset();
	this.createAJAX();
}

var ajax = new Array();

function EstadoBus(sel)
{
	var estadoCodigo = sel.options[sel.selectedIndex].value;
	document.getElementById('cidade2').options.length = 0;
	if(estadoCodigo.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'config/cidade.php?estado='+estadoCodigo;
		ajax[index].onCompletion = function(){ CriarCidadeBus(index) };
		ajax[index].runAJAX();
	}
}
function CriarCidadeBus(index)
{
	var obj = document.getElementById('cidade2');
	eval(ajax[index].response);
}

function Estado(sel)
{
	var estadoCodigo = sel.options[sel.selectedIndex].value;
	document.getElementById('cidade').options.length = 0;
	if(estadoCodigo.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'config/cidade.php?estado='+estadoCodigo;
		ajax[index].onCompletion = function(){ CriarCidade(index) };
		ajax[index].runAJAX();
	}
}
function CriarCidade(index)
{
	var obj = document.getElementById('cidade');
	eval(ajax[index].response);
}

function Plano(sel)
{
	var Plano = sel.value;
	if(Plano == "")
	{
		document.form2.valor.value = "";
	}
	else if(Plano == "PL-01/Mensal")
	{
		document.form2.valor.value = "R$ 30,00";
	}
	else if(Plano == "PL-02/Trimestral")
	{
		document.form2.valor.value = "R$ 85,00";
	}
	else if(Plano == "PL-03/Semestral")
	{
		document.form2.valor.value = "R$ 120,00";
	}
	else if(Plano == "PL-04/Anual")
	{
		document.form2.valor.value = "R$ 160,00";
	}
}


//Ajax
function openAjax() {

var ajax;

try{
    ajax = new XMLHttpRequest();
}catch(ee){
    try{
        ajax = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            ajax = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            ajax = false;
        }
    }
}
return ajax;
}


//Email
function VerificaEmail(nome) {
	if(document.getElementById) {
		var cod = document.form3.email.value;
		var verifica = document.getElementById('verificaemail');
		if(cod !== "" && cod !== null && cod.length >= 0) {
			var ajax = openAjax();
			ajax.open("GET", dominio+"config/cliente.php?email="+cod+"", true);
			ajax.onreadystatechange = function() {
				if(ajax.readyState == 1) {
					verifica.innerHTML = "Verificando...";
				}
				if(ajax.readyState == 4) {
					if(ajax.status == 200) {
						var resultado = ajax.responseText;
						resultado = resultado.replace(/\+/g," ");
						resultado = unescape(resultado);
						verifica.innerHTML = resultado;
					} else {
						verifica.innerHTML = "";
					}
				}
			}
			ajax.send(null);
		} else if(cod == "") {
			verifica.innerHTML = "";
		}
	}
}


//Senha
function Senha(form, senhac, senha) {
	var senhac = form[senhac].value;
	var senha = form[senha].value;
	
	var erro = false;
	if(senha != senhac)
	{
		mensagem = "As Senha devem ser iguais"; 
		erro = true;
	}

	if(erro) alert(mensagem);
	return !(erro);
}
function VerificaSenha(val, tamanho, id) {
	document.getElementById('senhamensagem'+id).innerHTML = "";
 	document.getElementById('senhabaixa'+id).style.background = '#F4F4F4';
 	document.getElementById('senhamedia'+id).style.background = '#EAEAEA';
 	document.getElementById('senhaalta'+id).style.background = '#E0E0E0';
 
	if(val.length >= tamanho && val.search(/[a-z]/) != -1 && val.search(/[A-Z]/) != -1 && val.search(/[0-9]/) != -1 || val.length >= tamanho && val.search(/[a-z]/) != -1 && val.search(/[A-Z]/) != -1 && val.search(/[@!#$%&*+=?|-]/) || val.length >= tamanho && val.search(/[a-z]/) != -1 && val.search(/[@!#$%&*+=?|-]/) != -1 && val.search(/[0-9]/) || val.length >= tamanho  && val.search(/[@!#$%&*+=?|-]/) != -1 && val.search(/[A-Z]/) != -1 && val.search(/[0-9]/)) {
		document.getElementById('senhamensagem'+id).innerHTML = "<font color=\"\#D52800\">Forte</font>";
		document.getElementById('senhabaixa'+id).style.background = '#D52800';
		document.getElementById('senhamedia'+id).style.background = '#D52800';
		document.getElementById('senhaalta'+id).style.background = '#D52800';
	} else {
		if(val.length >= tamanho && val.search(/[a-z]/) != -1 && val.search(/[A-Z]/) != -1 || val.length >= tamanho && val.search(/[a-z]/) != -1 && val.search(/[0-9]/) != -1  || val.length >= tamanho && val.search(/[a-z]/) != -1 && val.search(/[@!#$%&*+=?|-]/) != -1 || val.length >= tamanho && val.search(/[A-Z]/) != -1 && val.search(/[0-9]/) != -1 || val.length >= tamanho && val.search(/[A-Z]/) != -1 && val.search(/[@!#$%&*+=?|-]/) != -1 || val.length >= tamanho && val.search(/[0-9]/) != -1 && val.search(/[@!#$%&*+=?|-]/) != -1) {
			document.getElementById('senhamensagem'+id).innerHTML = "<font color=\"#E4C100\">Média</font>";
			document.getElementById('senhabaixa'+id).style.background = '#E4C100';
			document.getElementById('senhamedia'+id).style.background = '#E4C100';
			document.getElementById('senhaalta'+id).style.background = '#E0E0E0';
		} else {
			if(val.length >= tamanho) {
				document.getElementById('senhamensagem'+id).innerHTML = "<font color=\"#73B401\">Fraca</font>";
				document.getElementById('senhabaixa'+id).style.background = '#73B401';
				document.getElementById('senhamedia'+id).style.background = '#EAEAEA';
				document.getElementById('senhaalta'+id).style.background = '#E0E0E0';
			}
		}
	}
}


//Galeria
function profoto(foto1, foto2)
{
	var img1 = foto1;
	var img2 = foto2;
	var descricao = document.getElementById('produtofototm');
	
	descricao.innerHTML = "<a href=\"javascript: void(0);\" onclick=\"popUp('popup.php?url="+img2+"', 500, 500, 'no', 100, 100);\"><img src=\""+img1+"\" border=\"0\" /></a>";
}


//Fotos
function Fotos(atual)
{
	var foto = atual;
	
	if(document.getElementById) {
		var cod = atual;
		var descricao = document.getElementById('amplia');
		var ajax = openAjax();
		ajax.open("GET", dominio+"config/fotos.php?id="+foto, true);
		ajax.onreadystatechange = function() {
			if(ajax.readyState == 1) {
				descricao.innerHTML = "<div id=\"load\"><script language=\"JavaScript\" type=\"text/javascript\"> new Flash(\""+dominio+"images/carregando.swf\", \"carregandoswf\", \"26\", \"26\", {wmode: \"transparent\"}).write(); </script></div>";
			}
			if(ajax.readyState == 4) {
				if(ajax.status == 200) {
					var resultado = ajax.responseText;
					resultado = resultado.replace(/\+/g," ");
					resultado = unescape(resultado);
					descricao.innerHTML = resultado;
				} else {
					descricao.innerHTML = "Erro!";
				}
			}
		}
		ajax.send(null);
	}
}


//Mascara
function Mascara(objForm, strField, sMask, evtKeyPress)
{
	var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;
	
	if(document.all)
	{
		nTecla = evtKeyPress.keyCode;
	}
	else
	{
		nTecla = evtKeyPress.which;
	}
	
	sValue = objForm[strField].value;
	
	sValue = sValue.toString().replace( "D", "" );
	sValue = sValue.toString().replace( "D", "" );
	sValue = sValue.toString().replace( "e", "" );
	sValue = sValue.toString().replace( "e", "" );
	sValue = sValue.toString().replace( "à", "" );
	sValue = sValue.toString().replace( "à", "" );
	sValue = sValue.toString().replace( "-", "" );
	sValue = sValue.toString().replace( "-", "" );
	sValue = sValue.toString().replace( ".", "" );
	sValue = sValue.toString().replace( ".", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "(", "" );
	sValue = sValue.toString().replace( "(", "" );
	sValue = sValue.toString().replace( ")", "" );
	sValue = sValue.toString().replace( ")", "" );
	sValue = sValue.toString().replace( " ", "" );
	sValue = sValue.toString().replace( " ", "" );
	sValue = sValue.toString().replace( " ", "" );
	sValue = sValue.toString().replace( ":", "" );
	sValue = sValue.toString().replace( ":", "" );
	fldLen = sValue.length;
	mskLen = sMask.length;
	
	i = 0;
	nCount = 0;
	sCod = "";
	mskLen = fldLen;
	
	while(i <= mskLen)
	{
		bolMask = ((sMask.charAt(i) == "D") || (sMask.charAt(i) == "e") || (sMask.charAt(i) == "à") || (sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ":"))
		bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))
		
		if(bolMask)
		{
			sCod += sMask.charAt(i);
			mskLen++;
		}
		else
		{
			sCod += sValue.charAt(nCount);
			nCount++;
		}
		
		i++;
	}
	
	objForm[strField].value = sCod;
	
	if(nTecla != 8)
	{
		if(sMask.charAt(i-1) == "9")
		{
			return((nTecla > 47) && (nTecla < 58));
		}
		else
		{
			return true;
		}
	}
	else
	{
		return true;
	}
}
function MascaraDisponibilidade(objForm, strField, sMask, evtKeyPress)
{
	var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;
	
	if(document.all)
	{
		nTecla = evtKeyPress.keyCode;
	}
	else if(document.layers)
	{
		nTecla = evtKeyPress.which;
	}
	
	sValue = objForm[strField].value;
	
	sValue = sValue.toString().replace( "D", "" );
	sValue = sValue.toString().replace( "D", "" );
	sValue = sValue.toString().replace( "e", "" );
	sValue = sValue.toString().replace( "e", "" );
	sValue = sValue.toString().replace( "à", "" );
	sValue = sValue.toString().replace( "à", "" );
	sValue = sValue.toString().replace( "-", "" );
	sValue = sValue.toString().replace( "-", "" );
	sValue = sValue.toString().replace( ".", "" );
	sValue = sValue.toString().replace( ".", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "(", "" );
	sValue = sValue.toString().replace( "(", "" );
	sValue = sValue.toString().replace( ")", "" );
	sValue = sValue.toString().replace( ")", "" );
	sValue = sValue.toString().replace( " ", "" );
	sValue = sValue.toString().replace( " ", "" );
	sValue = sValue.toString().replace( " ", "" );
	sValue = sValue.toString().replace( ":", "" );
	sValue = sValue.toString().replace( ":", "" );
	fldLen = sValue.length;
	mskLen = sMask.length;
	
	i = 0;
	nCount = 0;
	sCod = "";
	mskLen = fldLen;
	
	while(i <= mskLen)
	{
		bolMask = ((sMask.charAt(i) == "D") || (sMask.charAt(i) == "e") || (sMask.charAt(i) == "à") || (sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ":"))
		bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))
		
		if(bolMask)
		{
			sCod += sMask.charAt(i);
			mskLen++;
		}
		else
		{
			sCod += sValue.charAt(nCount);
			nCount++;
		}
		
		i++;
	}
	
	objForm[strField].value = sCod;
	
	if(nTecla != 8)
	{
		if(sMask.charAt(i-1) == "9")
		{
			return((nTecla > 47) && (nTecla < 58));
		}
		else
		{
			return true;
		}
	}
	else
	{
		return true;
	}
}
function EnviaCopia(none) {
	document.form4['disponibilidade'].value = document.form2['disponibilidade'].value;
	form4.submit();
}


//Valida
function Valida(objForm, strField, sVali, evtKeyPress, a)
{
	var erro = false;
	var mensagem = "Você deve informar: \n";
	
	var arr = new Array(a);
	
	var str = strField.split("|=|");
	var sva = sVali.split("|=|");
	var evt = evtKeyPress.split("|=|");
	
	for(b = 1; b < a + 1; b++)
	{
		arr[b] = objForm[str[b]].value;

		if(arr[b].length < evt[b])
		{
			mensagem += "\n"+sva[b];
			erro = true;
			objForm[str[b]].style.background = "#FFCCCC";
			objForm[str[b]].style.border = "1px solid #CC0000";
		}
		else
		{
			objForm[str[b]].style.background = "#FFFFFF";
			objForm[str[b]].style.border = "1px solid #00CC00";
		}
	}

	if(erro) alert(mensagem);
	return !(erro);
}


//Valor
function currencyFormat(fld, milSep, decSep, e) {
	var sep = 0;
	var key = '';
	var i = j = 0;
	var len = len2 = 0;
	var strCheck = '0123456789';
	var aux = aux2 = '';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode == 13) return true;  // Enter
	if (whichCode == 8) return true;  // Delete (Bug fixed)
	key = String.fromCharCode(whichCode);  // Get key value from key code
	if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
	len = fld.value.length;
	for(i = 0; i < len; i++)
	if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != decSep)) break;
	aux = '';
	for(; i < len; i++)
	if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i);
	aux += key;
	len = aux.length;
	if (len == 0) fld.value = '';
	if (len == 1) fld.value = '0'+ decSep + '0' + aux;
	if (len == 2) fld.value = '0'+ decSep + aux;
	if (len > 2) {
	aux2 = '';
	for (j = 0, i = len - 3; i >= 0; i--) {
	if (j == 3) {
	aux2 += milSep;
	j = 0;
}
	aux2 += aux.charAt(i);
	j++;
	}
	fld.value = 'R$ ';
	len2 = aux2.length;
	for (i = len2 - 1; i >= 0; i--)
	fld.value += aux2.charAt(i);
	fld.value += decSep + aux.substr(len - 2, len);
}
return false;
}


//Sair
function sair(url)
{
	if(confirm('Deseja mesmo sair?'))
	{
		window.open(""+dominio+"?menu=sair&url="+url,"_parent");
	}
}


//popup
function popup(thisitem,startstate){
  divname = thisitem;
  this.thediv = document.getElementById(divname);
  this.thediv.style.visibility = startstate;
}
function visible(objeto)
{
	objeto.thediv.style.visibility = "visible";
}
function hidden(objeto)
{
	objeto.thediv.style.visibility = "hidden";
}


//Pop Up
var popUpWin=0;
function popUp(url, intWi, intHei, scr, intTop, intLeft)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(url, 'popUpWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scr+',resizable=no,menubar=no,width=' + intWi + ',height=' + intHei+ ', left=' + intLeft + ', top=' + intTop + '');
}


//Flash
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=8,0,22,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() );
}