function Inicializar(){
	document.getElementById('lstTopicoContenido1').focus();
}

function CargarEnSesion(){
	document.getElementById('PostBackAction').value = 'CargarEnSesion';
	AjaxRequest('','','Form','');
}

function RegistrarUsuario(){
	window.location = 'RegistrarUsuario.aspx';
}
function LoguearUsuario(){
	if (!Validar()){
		alert('Please, check the invalid fields.');
		return;
	}
	document.getElementById('PostBackAction').value = 'Loguear';
	//AjaxRequest('','','Form','');
	document.getElementById('Form').submit();
}
function FinalizarLogueo(strUrl){
	window.returnValue = "refreshCarrito";
	window.location.href=strUrl;
}

function ExplorarVideos(){
	if (document.getElementById('lstTopicoContenido1').value == '' || document.getElementById('lstTopicoContenido2').value == '' || document.getElementById('lstTopicoContenido3').value == '' || document.getElementById('lstTopicoContenido4').value == ''){
		alert('Please, select the four topics.');
		return;
	}
	if (document.getElementById('lstTopicoContenido1').options[document.getElementById('lstTopicoContenido1').selectedIndex].className == 'opcionEstado2' || 
		document.getElementById('lstTopicoContenido2').options[document.getElementById('lstTopicoContenido2').selectedIndex].className == 'opcionEstado2' ||
		document.getElementById('lstTopicoContenido3').options[document.getElementById('lstTopicoContenido3').selectedIndex].className == 'opcionEstado2' ||
		document.getElementById('lstTopicoContenido4').options[document.getElementById('lstTopicoContenido4').selectedIndex].className == 'opcionEstado2'){
		alert('Topics in light gray have no associated videos, and cannot be selected.');
		return;
	}
	if (document.getElementById('lstTopicoContenido1').value == document.getElementById('lstTopicoContenido2').value ||
		document.getElementById('lstTopicoContenido1').value == document.getElementById('lstTopicoContenido3').value ||
		document.getElementById('lstTopicoContenido1').value == document.getElementById('lstTopicoContenido4').value ||
		document.getElementById('lstTopicoContenido2').value == document.getElementById('lstTopicoContenido3').value ||
		document.getElementById('lstTopicoContenido2').value == document.getElementById('lstTopicoContenido4').value ||
		document.getElementById('lstTopicoContenido3').value == document.getElementById('lstTopicoContenido4').value){
		alert('Please, select four different topics.');
		return;
	}
	if (document.getElementById('lstTopicoContenido1').value == ''){
		alert('Please, select at least one filter.');
		return;
	}

	document.getElementById('Form').action = 'ExplorarVideos.aspx';
	document.getElementById('Form').submit();
}
function SeleccionTopicoContenido1(){
	if (document.getElementById('lstTopicoContenido1').value == ''){
	/*	document.getElementById('lstTopicoContenido2').value = '';
		DeshabilitarControl('lstTopicoContenido2');
		document.getElementById('lstTopicoContenido3').value = '';
		DeshabilitarControl('lstTopicoContenido3');
		document.getElementById('lstTopicoContenido4').value = '';
		DeshabilitarControl('lstTopicoContenido4');
	*/}else{
		if (document.getElementById('lstTopicoContenido1').options[document.getElementById('lstTopicoContenido1').selectedIndex].className == 'opcionEstado2'){
			alert('Topics in light gray have no associated videos, and cannot be selected.');
		}else{
			HabilitarControl('lstTopicoContenido2');
		}
	}
}
function SeleccionTopicoContenido2(){
	if (document.getElementById('lstTopicoContenido2').value == ''){
	/*	document.getElementById('lstTopicoContenido3').value = '';
		DeshabilitarControl('lstTopicoContenido3');
		document.getElementById('lstTopicoContenido4').value = '';
		DeshabilitarControl('lstTopicoContenido4');
	*/}else{
		if (document.getElementById('lstTopicoContenido2').options[document.getElementById('lstTopicoContenido2').selectedIndex].className == 'opcionEstado2'){
			alert('Topics in light gray have no associated videos, and cannot be selected.');
		}else{
			HabilitarControl('lstTopicoContenido3');
		}
	}
}
function SeleccionTopicoContenido3(){
	if (document.getElementById('lstTopicoContenido3').value == ''){
	/*	document.getElementById('lstTopicoContenido4').value = '';
		DeshabilitarControl('lstTopicoContenido4');
	*/}else{
		if (document.getElementById('lstTopicoContenido3').options[document.getElementById('lstTopicoContenido3').selectedIndex].className == 'opcionEstado2'){
			alert('Topics in light gray have no associated videos, and cannot be selected.');
		}else{
			HabilitarControl('lstTopicoContenido4');
		}
	}
}
function SeleccionTopicoContenido4(){
	if (document.getElementById('lstTopicoContenido4').options[document.getElementById('lstTopicoContenido4').selectedIndex].className == 'opcionEstado2'){
		alert('Topics in light gray have no associated videos, and cannot be selected.');
	}
}

function LimpiarPalabraClave(){
	document.getElementById('txtPalabraClave').value = document.getElementById('hidPalabraClave').value;
}

function SetearPalabraClave(){
	document.getElementById('hidPalabraClave').value = document.getElementById('txtPalabraClave').value;
}