function EntrarChat(Form)
{
	if(Form.Nombre.value == '')
	{
		alert('Debes introducir tu nombre');
	}
	else
	{
		window.open('Chat/Chat.php?Nick='+Form.Nombre.value, '_blank', 'width=710, height=500');
	}
}


function CargaJuego(IdJuego, Tiempo, AltoJuego)
{

	Juego 		= GetById('Flash'+IdJuego);
	ETiempo 	= Tiempo+9;
	EAltoJuego 	= AltoJuego;
	
	if(ETiempo >= 100)
	{
		DisplayNone('CargaPublicidad');
		GetById('CargaJuego').style.height = EAltoJuego+'px';
		
	}
	else
	{
		GetById('Porcentaje').innerHTML = ETiempo+' %';
		setTimeout('CargaJuego('+IdJuego+', '+ETiempo+', '+EAltoJuego+')', 1000);
	}

}


function Confirmar(Mensaje)
{

	var agree = confirm(Mensaje)
	if (agree)
	{
		return true
	}
	else
	{
		return false
	}
	
}



function FormUrl(Mod, FormObj)
{

	Texto = FormObj.Texto.value;
	
	Texto = Texto.replace(/([\s]+)/g,'_');
	Texto = Texto.replace(/\'/gi,'');
	Texto = Texto.replace(/\"/gi,'');
	Texto = Texto.replace(/:/gi,'');
	Texto = Texto.replace(/</gi,'');
	Texto = Texto.replace(/>/gi,'');
	Texto = Texto.replace(/á/gi,'a');
	Texto = Texto.replace(/é/gi,'e');
	Texto = Texto.replace(/í/gi,'i');
	Texto = Texto.replace(/ó/gi,'o');
	Texto = Texto.replace(/ú/gi,'u');
	Texto = Texto.replace(/ñ/gi,'n');
	Texto = Texto.replace(/'/gi,'');
	Texto = Texto.replace(/"/gi,'');
	

	if(Texto != '')
	{
		Redirecionar('http://www.juegospormonton.com/'+Mod+'/'+Texto+'/');

	}
	else
	{
		alert('Estas realizando una busqueda vacia');
	}
	
	return false;
}



function Redirecionar(Url)
{
	window.location.href=Url;

}




function CheckBuscador(Texto, Tipo)
{
	if(Texto.value == '¿Qué juego buscas?' && Tipo == 'Click')
	{
		Texto.value = '';
	}
	
	if(Texto.value == '' && Tipo == 'Blur')
	{
		Texto.value = '¿Qué juego buscas?';
	}

}



function SetAlpha(Elemento, Alpha)
{

  Elemento.style.opacity = (Alpha / 100);

  Elemento.style.filter = "alpha(opacity=" + Alpha + ")";

}


function CrearCargando(Elemento)
{
	Cont = GetById(Elemento);

	BoxCargando = document.createElement('div');
	BoxCargando.className = 'BoxCargando';

	Cargador = document.createElement('div');
	Cargador.className = 'Cargador';
	Cargador.innerHTML = '<img src="Estilo/Imagenes/Iconos/cargando.gif" /><br />Cargando';

	BoxCargando.appendChild(Cargador)
	
	PrimerElemento = Cont.childNodes[0];
	if(!PrimerElemento)
	{
		Cont.appendChild(BoxCargando)
	}
	else
	{
		PrimerElemento.parentNode.insertBefore(BoxCargando, PrimerElemento);
	}

	

}