/**
 * w3cookies (0.1) - 23/12/2006
 * Leandro Vieira Pinho
 * http://leandrovieira.com
 */
var w3cookies = {
	date: new Date(),
	// Cria o(s) cookie(s)
	// Forma de uso: w3cookies.create('nome_do_cookie','valor',dias_para_expirar);
	create: function(strName, strValue, intDays) {
		if ( intDays ) {
			this.date.setTime(this.date.getTime()+(intDays*24*60*60*1000));
			var expires = "; expires=" + this.date.toGMTString();
		} else {
			var expires = "";
		}
		document.cookie = strName + "=" + strValue + expires + "; path=/";
	},
	// Ler as informações de um cookie em específico
	// Forma de uso: w3cookies.read('nome_do_cookie');
	read: function(strName) {
		var strNameIgual = strName + "=";
		var arrCookies = document.cookie.split(";");
		for ( var i = 0, strCookie; strCookie = arrCookies[i]; i++ ) {
			while ( strCookie.charAt(0) == " ") {
				strCookie = strCookie.substring(1,strCookie.length);
			}
			if ( strCookie.indexOf(strNameIgual) == 0 ) {
				return strCookie.substring(strNameIgual.length,strCookie.length);
			}
		}
		return null;
	},
	// Delete um cookie desejado
	// Forma de uso: w3cookies.erase('nome_do_cookie');
	erase: function(strName) {
		this.create(strName,"",-1);
	}
}

function bg(cor) {
	if (!w3cookies.read('color_profileDC')) { w3cookies.create('color_profileDC', 'class1', '30'); } 
	else { w3cookies.create('color_profileDC', cor, '30'); }
	document.body.className = 'color-'+w3cookies.read('color_profileDC');
	document.getElementById('menu')
}

function carrega () {
	var elems = document.getElementsByTagName("input");
	for (i=0; i<elems.length; i++) {
		elems[i].value = elems[i].alt;
	}
}

function limpaCombo (object) {
	if ( object.value.length == 0 ) { 
		object.value = object.alt;
		object.style.color = "#C1C1C1";
		object.style.border = "solid 1px #C1C1C1";
	} else if (object.value == object.alt) { 
		object.value = "";
		object.style.color = "#333333";
		object.style.border = "solid 1px #004e52";
	}
}

function abrevideo(id) {
	document.getElementById('movie').innerHTML = "<object width='610' height='412'><param name='movie' value='http://www.youtube.com/v/"+id+"&hl=pt_BR&fs=1&rel=0'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/"+id+"&hl=pt_BR&fs=1&rel=0' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='610' height='412'></embed></object>";
}

function abrevideoMensagem(id) {
	document.getElementById('movieMensagem').innerHTML = "<object width='610' height='412'><param name='movie' value='http://www.youtube.com/v/"+id+"&hl=pt_BR&fs=1&rel=0'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/"+id+"&hl=pt_BR&fs=1&rel=0' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='610' height='412'></embed></object>";
}

function abremusica(id) {
	if (document.getElementById('music'+id).style.display == "none") {
		document.getElementById(id+'music').className = "audioTitle";
		document.getElementById('play'+id).style.display = "none";
		document.getElementById('music'+id).style.display = "block";
	} else {
		document.getElementById(id+'music').className = "musicaHover";
		document.getElementById('play'+id).style.display = "inline";
		document.getElementById('music'+id).style.display = "none";
	}
}

function abrircobertura (idCobertura) {
	window.open ("Album.asp?idCobertura="+idCobertura,"mywindow","width=750, height=610"); 
}

function mostraequipe(img, texto) {
	document.getElementById('equipe').innerHTML = '<p style="text-align:justify"><img src="imagens/Equipe/'+img+'" align="left" style="padding-right:5px;"/>'+texto+'</p>';
}

function abreradio(id) {
	window.open('radio.asp?idradio='+id,'online','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=280,height=198');	
}

function abreNoticia(id, Titulo){

	if(document.getElementById('modalPage')){
		document.body.removeChild(document.getElementById('modalPage'));
	}
	
	modalPage = document.createElement("div");
	modalPage.id = "modalPage";
	
	modalBackground = document.createElement("div");
	modalBackground.className = "modalBackground";

	modalContainer = document.createElement("div");
	modalContainer.className = "modalContainer";

	modal = document.createElement("div");
	modal.className = "modal";
	
	modalTop = document.createElement("div");
	modalTop.className = "modalTop";
	modalTop.innerHTML = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"modalTop\"><tr><td align=\"left\"  width=\"100%\">"+Titulo+"</td><td align=\"right\" width=\"10%\" style=\"cursor:pointer;\" onClick=\"hideModal('modalPage')\">[X]</td></tr></table>";
	
	modalBody = document.createElement("div");
	modalBody.innerHTML = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" height=\"350\"><tr><td><iframe src=\"Noticias.asp?idNoticia="+id+"\" width=\"100%\"  height=\"350\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"auto\" frameborder=\"0\" hspace=\"0\" vspace=\"0\"></iframe></td></tr></table>";
	
	
	modal.appendChild(modalTop);
	modal.appendChild(modalBody);
	modalContainer.appendChild(modal);
	modalPage.appendChild(modalContainer);
	modalPage.appendChild(modalBackground);

	document.body.appendChild(modalPage);
		
	revealModal('modalPage');
}

function revealModal(divID){
    window.onscroll = function () { document.getElementById(divID).style.top = document.body.scrollTop; };
    document.getElementById(divID).style.display = "block";
    document.getElementById(divID).style.top = document.body.scrollTop;
}

function hideModal(divID){
    document.getElementById(divID).style.display = "none";
	
}

function display (id) {
	if (document.getElementById(id).style.display != "none") {
		document.getElementById(id).style.display = "none";
	} else {
		document.getElementById(id).style.display = "inline";
	}
}

