function chatt() {
	var tamy = document.documentElement.clientHeight - 25;
	var chat = document.getElementById('chat').style;
	var inchat = document.getElementById('lightIRC').style;
	if ((typeof(maximizado) == 'undefined') || (maximizado == "no")) {
	chat.left = "0px";
	chat.top = "0px";
	chat.width = "100%";
	chat.height = "100%";
	inchat.height = tamy+"px";
	window.scrollTo(0,0);
	maximizado = "si";
	document.getElementById('subcontenido').style.display = 'none';
	document.getElementById('maximin').firstChild.nodeValue = 'Minimizar Chat';
	document.getElementById('pie').style.display = 'none';
	return;
	}
	if (maximizado == "si") {
	chat.left = "inherit";
	chat.top = "108px";		
	chat.width = "780px";
	chat.height = "425px";
	inchat.height = "400px";
	window.scrollTo(0,0);	
	maximizado = "no";
	document.getElementById('subcontenido').style.display = 'block';
	document.getElementById('maximin').firstChild.nodeValue = 'Maximizar Chat';
	document.getElementById('pie').style.display = 'block';	
	return;
	}
}
window.onscroll = function() {
	var explorador = navigator.userAgent;
	if (explorador.indexOf("MSIE") != -1) {
		muevey = document.documentElement.scrollTop;
	} else {
		muevey = window.scrollY;
	}
	if (muevey > 50) { document.getElementById('sube').style.display = 'block'; }
	else { document.getElementById('sube').style.display = 'none'; }
	if ((typeof(maximizado) != 'undefined') && (maximizado == "si")) {
	document.getElementById('chat').style.top = muevey + 'px';
	}
}
window.onresize = function() {
	var tamy = document.documentElement.clientHeight - 25;
	var chat = document.getElementById('chat').style;
	var inchat = document.getElementById('lightIRC').style;	
	if ((typeof(maximizado) != 'undefined') && (maximizado == "si")) {
	chat.height = "100%";
	inchat.height = tamy+"px";		
	document.getElementById('chat').style.top = muevey + 'px';
	}	
}
function sec(seccion) {
 document.getElementById('subcontenido').innerHTML = '';
 if (seccion == "inicio") {
	if (typeof(cargasalas) != 'undefined') { clearInterval(cargasalas); };
	if (typeof(cargaestats) != 'undefined') { clearInterval(cargaestats); };	
	if (typeof(cargatrivias) != 'undefined') { clearInterval(cargatrivias); };
	if (typeof(radiodatos2) != 'undefined') { clearInterval(radiodatos2); };	
	tcarga();
	if (typeof(enchat) != 'undefined') {
		document.getElementById('precon').style.display = 'none';		
 		document.getElementById('chat').style.top = '108px'; 
		document.getElementById('chat').style.height = '425px';  
		document.getElementById('subcontenido').style.marginTop = '432px';
	} else { document.getElementById('precon').style.display = 'block'; }	
 }
 else { 
	if (typeof(cargasalas) != 'undefined') { clearInterval(cargasalas); };
	if (typeof(cargaestats) != 'undefined') { clearInterval(cargaestats); };	
	if (typeof(cargatrivias) != 'undefined') { clearInterval(cargatrivias); };	
	if (typeof(radiodatos2) != 'undefined') { clearInterval(radiodatos2); };			
 	document.getElementById('chat').style.top = '-11111px'; 
	document.getElementById('chat').style.height = '1px';  	
	document.getElementById('subcontenido').style.marginTop = '0px';
	document.getElementById('precon').style.display = 'none';	
 };
 carga('/'+seccion+'.php','subcontenido');
}
function tcarga() {
	cargasalas = setInterval(function() { carga("/lista.php","canales"); }, 30000);
	cargaestats = setInterval(function() { carga("/stats.php","estadisticas"); }, 30000);
	cargatrivias = setInterval(function() { carga("/trivias.php","trivias"); }, 30000);
	radiodatos2 = setInterval(function() { carga("/x/r.php?dame=datos","datosr2"); }, 30000);
	carga("/x/r.php?dame=datos","datosr2");
}
function refp() { carga("/x/p.php","player"); }
function firebug(que) { console.log(que); }
function enviasel(nc) {
var nick = document.getElementById('nickp').value;
if (nick == '') { var nick = 'indiorante'; }
var t = nc - 1;
canales = new Array();
for (var x = 0;x <= t;x++) {
	if (document.getElementsByName('poc')[x].checked == true) { 
		var canal = document.getElementsByName('poc')[x].value;
		canales.push(canal);
	}
}
if (canales.length == 0) { canales.push('Indiorantez'); }
document.location.href = "?canales="+canales+"&nick="+nick;
}
function lcans() { 
if (typeof(vlcans) == 'undefined' || vlcans == "si") {
	document.getElementById('canales').style.height = '26px';
	document.getElementById('canales').style.overflow = 'hidden';
	document.getElementById('mtcan').innerHTML = 'Ver informarci&oacute;n en tiempo real de los canales de irc.indiorantez.com';
	vlcans = "no";
	return;	
}
if (vlcans == "no") {
	document.getElementById('canales').style.height = 'auto';
	document.getElementById('mtcan').innerHTML = 'Canales oficiales del servidor irc.indiorantez.com';
	vlcans = "si";
	return;
}
}
function cnc() {
	var nick = document.getElementById('nickp').value;
	if (nick == "indiorante") { document.getElementById('nickp').value = ''; }
}
