// JavaScript Document
function addSWF   (URL, WIDTH, HEIGHT, TRANSPARENT)
{
document.write (' <object classid="clsid:27CDB6E-AE6D-11cf-96B8-444553540000" ');
document.write (' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ');
document.write (' width="'+ WIDTH +'" height="'+ HEIGHT +'">');
document.write (' <param name="movie" value="'+ URL +'" />');
document.write (' <param name="quality" value="high" />');

if ( TRANSPARENT ) {
  document.write (' <param name="Wmode" value="Transparent" />');
}

document.write (' <embed src="'+ URL +'" quality="high" ');

if ( TRANSPARENT ) {
document.write (' Wmode = "transparent" ');
}

document.write (' pluginspage="http://www.macromedia.com/go/getflashplayer" ');
document.write (' type="application/x-shockwave-flash" width="'+ WIDTH +'" height="'+ HEIGHT +'"></embed> ');
document.write (' </object>');

}

function addSWF_nova  (URL, WIDTH, HEIGHT, TRANSPARENT)
{
document.write (' <object classid="clsid:27CDB6E-AE6D-11cf-96B8-444553540000" ');
document.write (' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ');
document.write (' width="'+ WIDTH +'" height="'+ HEIGHT +'" id="FLVPlayer"> ');
document.write (' <param name="movie" value="FLVPlayer_Progressive.swf" />');
document.write (' <param name="quality" value="high" />');
document.write (' <param name="FlashVars" value="&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=http://www.baressp.com.br'+ URL +'&autoPlay=true&autoRewind=false" />');

if ( TRANSPARENT ) {
  document.write (' <param name="Wmode" value="Transparent" />');
}

document.write (' <embed src="FLVPlayer_Progressive.swf" quality="high" flashvars="&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=http://www.baressp.com.br'+ URL +'&autoPlay=true&autoRewind=false" scale="noscale" name="FLVPlayer" salign="LT" ');

if ( TRANSPARENT ) {
document.write (' Wmode = "transparent" ');
}

document.write (' pluginspage="http://www.macromedia.com/go/getflashplayer" ');
document.write (' type="application/x-shockwave-flash" width="'+ WIDTH +'" height="'+ HEIGHT +'"></embed> ');
document.write (' </object>');
}

var carregar;

function carregarImagem(imagem) {
	carregar = new Image();
	carregar.src = imagem;
	document.getElementById("imagem").innerHTML = "<img src=\"imagem/carregando.gif\" />";
	setTimeout("verificar()", 100);
}

function verificar() {
	if(carregar.complete) {
		document.getElementById("imagem").innerHTML = "<img src=\"" + carregar.src + "\" />";
	} else {
		setTimeout("verificar()", 100);
	}
}


<!-- Begin
var eventos = "";
var evento = new Array(12);
for (i = 0; i <= 12; i++) {
	evento[i] = new Array(32);
	for (x = 0; x <= 31; x++) {
		evento[i][x] = false;//marca todos os "dias" de eventos como false
	}
}

/*evento[3][16] = "Track & Fiel Run Series - S&atilde;o Paulo";
evento[4][13] = "este";
evento[5][4] = "Track & Fiel Run Series - Belo Horizonte";
evento[5][25] = "Ironman Brasil";
evento[6][8] = "Track & Fiel Run Series - Bras&iacute;lia";
evento[6][15] = "Track & Fiel Run Series - Campinas";
evento[6][29] = "Track & Fiel Run Series - S&atilde;o Paulo";
evento[7][6] = "Track & Fiel Run Series - Goi&acirc;nia";
evento[7][27] = "Track & Fiel Run Series - Ribeir&atilde;o Preto";
evento[8][3] = "Track & Fiel Run Series - Rio de Janeiro";
evento[8][10] = "Wolkswagen Run";
evento[8][17] = "Track & Fiel Run Series - Campinas";
evento[8][24] = "Track & Fiel Run Series - Florian&oacute;polis";
evento[8][31] = "Track & Fiel Run Series - Curitiba";
evento[9][14] = "Ironman 70.3";
evento[9][21] = "Track & Fiel Run Series - Po&aacute;";
evento[9][28] = "Track & Fiel Run Series - Belo Horizonte";
evento[10][19] = "Track & Fiel Run Series - Bras&iacute;lia";
evento[11][9] = "Rock'n Run - S&atilde;o Paulo";
evento[11][16] = "Ayrton Senna Racing Day";
evento[11][23] = "Rock'n Run - Florian&oacute;polis";
evento[11][30] = "Track & Fiel Run Series - S&atilde;o Paulo";*/

var ano, mes=0;

function exibirCalendario() {
	
var day_of_week = new Array('Dom','Seg','Ter','Qua','Qui','Sex','Sab');
var month_of_year = new Array('Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro');

var Calendar = new Date(ano,mes,dia,0,0,0,0);
//var Calendar = new Date();

var year = Calendar.getYear();	   // Retorna o ano
var month = Calendar.getMonth();   // Retorna mes (0-11)
var today = Calendar.getDate();    // Retorna dias (1-31)
var weekday = Calendar.getDay();   // Retorna dia da Semana (0-6)


var DAYS_OF_WEEK = 7;    // constante para o numero de dias na semana
var DAYS_OF_MONTH = 31;    // constante para o numero de dias no mes
var cal;    // Usado para imprimir na tela

Calendar.setDate(1);    // Comecar o calendario no dia '1'
Calendar.setMonth(month);    // Comecar o calendario com o mes atual
var agora = new Date();

//declarações das tags para o calendario
var TR_start = '<TR>';
var TR_end = '</TR>';
var highlight_start = '<TD WIDTH="22"  bgcolor="#ff6600"><CENTER>';
var highlight_end   = '</CENTER></TD>';
var evento_start = '<TD WIDTH="22"  bgcolor="#999999"><CENTER>';
var evento_end   = '</CENTER></TD>';
var TD_start = '<TD WIDTH="22"><CENTER>';
var TD_end = '</CENTER></TD>';	
	
//  MOSTRAR CALENDARIO
cal =  '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 STYLE="border:1px solid #999999;"><TR><TD>';
cal += '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>' + TR_start;
cal += '<TD COLSPAN="' + DAYS_OF_WEEK + '" BGCOLOR="#999999">';
cal += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
cal += '  <tr>';
cal += '    <td align="left"><a href="?mes=vol" ><<</a></td>';
cal += '    <td align="center"><b>'+  month_of_year[month]  +'</b></td>';
cal += '    <td align="right"><a href="?mes=pro" >>></a></td>';
cal += '  </tr>';
cal += '</table>';
cal += TD_end + TR_end;


cal += TR_start;
for(index=0; index < DAYS_OF_WEEK; index++)//laço para a semanain
{

	if(weekday == index)
	cal += TD_start + day_of_week[index] + TD_end;//dia de hj em cima
	else
	cal += TD_start + day_of_week[index] + TD_end;//dias restantes em cima
}
cal += TR_end;


cal += TR_start;
	for(index=0; index < Calendar.getDay(); index++)
	cal += TD_start + '  ' + TD_end;
	
	for(index=0; index < DAYS_OF_MONTH; index++) {
		//alert(Calendar.getDate() + ">" + index);
		if( Calendar.getDate() > index ) {
			week_day =Calendar.getDay();
			
		if(week_day == 0)//se dia da semana for domingo
			cal += TR_start;//começa outra linha
			
			if(week_day != DAYS_OF_WEEK) {//se dia atual da semana for diferente dos dias totais(7, uma constante)
				var day  = Calendar.getDate();//obtem o dia da semana
				if(evento[month + 1][index + 1] != false) {
					eventos += "<B>" + (index + 1) + "</B> - " + evento[month + 1][index + 1] + "<BR>"; //printa os eventos
					cal += evento_start + (index + 1) + evento_end;//insere os dias com evento
				} else if( today==Calendar.getDate() && month==agora.getMonth())
					cal += highlight_start + (index + 1) + highlight_end; // marca o dia de hoje
				else
					cal += TD_start + (index + 1) + TD_end;
			}
			if(week_day == DAYS_OF_WEEK)
				cal += TR_end;
		}
		Calendar.setDate(Calendar.getDate()+1);
		if (month==9 && Calendar.getDate() == 9 ) {
			Calendar.setDate(Calendar.getDate()+1);	
		}
}
//alert(DAYS_OF_MONTH);
cal += '</TD></TR><TR><TD COLSPAN="7" BGCOLOR="#999999" >';
cal += eventos;
cal += '</TD></TR></TABLE></TABLE>';

document.write(cal);
}
//  End -->


function calendario(mes, ano) {
	var nome_mes = new Array('Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro');
	
	hoje = new Date();
	data = new Date(ano, mes, 1);
	
	ultimo_dia = new Date(data.getYear(), (data.getMonth() + 1), 1);
	ultimo_dia.setDate(ultimo_dia.getDate() - 1);
	
	
	saida='<table border="0" style="border:1px solid #999999;" cellpadding="0" cellspacing="0">';
	saida += '<tr><td bgcolor="#999999"><a href="javascript:void(calendario(' + (data.getMonth()-1) + ',' + data.getFullYear() + '))"><<</a></td><td colspan="5" bgcolor="#999999">' + nome_mes[data.getMonth()] + ' - ' +  data.getFullYear() + '</td><td bgcolor="#999999"><a href="javascript:void(calendario(' + (data.getMonth()+1) + ',' + data.getFullYear() + '))">>></a></td></tr>';
	saida += '<tr><td>Dom</td><td>Seg</td><td>Ter</td><td>Qua</td><td>Qui</td><td>Sex</td><td>Sab</td></tr>';
	
	var inicio = '';
	var eventos = '';
	if (data.getDay() != 0) {
		for (i = 0; i < data.getDay(); i++) {
			inicio += '<td>&nbsp;</td>';
		}
	}
	for (i = 1; i <= ultimo_dia.getDate(); i++) {
		if (data.getDay() == 6) { saida += '<tr>'; }
		if (i == 1)  { saida += inicio; }
			
		data.setDate(i);
		
		//if (evento[(data.getMonth()+1)][data.getDate()] != false && ano == 2008) {
			//eventos += data.getDate() + ' - ' + evento[(data.getMonth()+1)][data.getDate()] + '<br>';
		
		posicao = evento.indexOf(data.getFullYear() + '-' + (data.getMonth()+1) + '-' + data.getDate() + ';');
		if (posicao > -1) {
			saida += '<td bgcolor="#999999" width="22" align="center">' + data.getDate() + '</td>';
			pos1 = evento.indexOf(';',posicao);
			pos2 = evento.indexOf('|',posicao);
			dados_evento = evento.substring((pos1+1),pos2);
			eventos += data.getDate() + ' - ' + dados_evento + '<br>';
		} else {
			if (data.getDate() == hoje.getDate() && data.getMonth() == hoje.getMonth()) {
				saida += '<td bgcolor="#ff6600" width="22" align="center">' + data.getDate() + '</td>';			
			} else {
				saida += '<td width="22" align="center">' + data.getDate() + '</td>';
			}
		}
		
		if (data.getDay() == 7) { saida += '</tr>'; }
	}
	saida += '<tr><td colspan="7" bgcolor="#999999">' + eventos + '</td></tr>';
	saida += '</table>';
	
	document.getElementById('calendario').innerHTML = saida;
}

function carregarVideo(video, width, height, transparent) {
	var teste = document.getElementById("video");
	var novovideo;
	novovideo = ' <object classid="clsid:27CDB6E-AE6D-11cf-96B8-444553540000" ';
	novovideo += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ';
	novovideo += ' width="'+ width +'" height="'+ height +'">';
	novovideo += ' <param name="movie" value="'+ video +'" />';
	novovideo += ' <param name="quality" value="high" />';
	
	if ( transparent ) {
		novovideo += ' <param name="Wmode" value="Transparent" />';
	}	
	novovideo += ' <embed src="'+ video +'" quality="high" ';
	if ( transparent ) {
	novovideo += ' Wmode = "transparent" ';
	}	
	novovideo += ' pluginspage="http://www.macromedia.com/go/getflashplayer" ';
	novovideo += ' type="application/x-shockwave-flash" width="'+ width +'" height="'+ height +'"></embed> ';
	novovideo += ' </object>';

	teste.innerHTML = "<br>" + novovideo;
	
}

function carregarVideo_nova(video, width, height, transparent) {
	var teste = document.getElementById("video");
	var novovideo;
	novovideo = ' <object classid="clsid:27CDB6E-AE6D-11cf-96B8-444553540000" ';
	novovideo += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ';
	novovideo += ' width="'+ width +'" height="'+ height +'" id="FLVPlayer">';
	novovideo += ' <param name="movie" value="FLVPlayer_Progressive.swf" />';
	novovideo += ' <param name="quality" value="high" />';
	novovideo += ' <param name="FlashVars" value="&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=http://www.baressp.com.br'+ video +'&autoPlay=true&autoRewind=false" />';
	
	if ( transparent ) {
		novovideo += ' <param name="Wmode" value="Transparent" />';
	}	
	
	novovideo += ' <embed src="FLVPlayer_Progressive.swf" quality="high" flashvars="&MM_ComponentVersion=1&skinName=Halo_Skin_3&streamName=http://www.baressp.com.br'+ video +'&autoPlay=true&autoRewind=false" scale="noscale" name="FLVPlayer" salign="LT" ';
	if ( transparent ) {
	novovideo += ' Wmode = "transparent" ';
	}	
	novovideo += ' pluginspage="http://www.macromedia.com/go/getflashplayer" ';
	novovideo += ' type="application/x-shockwave-flash" width="'+ width +'" height="'+ height +'"></embed> ';
	novovideo += ' </object>';

	teste.innerHTML = novovideo;	
}