function upCitySelect(theSelect) {
	var selectSize = theSelect.options.length;
	var list2value = "";

	list2value = theSelect.options[theSelect.selectedIndex].value;
	if ((list2value == '') || (list2value.substr(0, 4) == 'CTRY')) {	//No city selected
		alert('Por favor selecione uma cidade.');
	}
	else
		document.frmCity.submit();
}

function validate_email(cur) {
	// Make sure that the user has entered values into both
	// the username and password fields.
	// Otherwise, give an error and don't submit the form.
	if (cur.elements['Username'].value == '' || cur.elements['Password'].value == '') {
		alert('Usted debe escribir un nombre de usuario y contrasena.');
		return false;
	} else {
		return true;
	}
}

function Survey(){
	var LeftPosition = ((screen.width)?(screen.width-400)/2:100);
	var TopPosition = ((screen.height)?(screen.height-200)/2:100);

	var ICOK = false;
	var i = document.frmVote.Count.value;

	for (ic=0; ic < document.frmVote.elements.length; ic++) {
		if (document.frmVote.elements[ic].name == 'AnswerID') {
			if (document.frmVote.elements[ic].checked){ 
				var AnswerID = document.frmVote.elements[ic].value;
				var QuestionID = document.frmVote.QuestionID.value;
				var CityCode =  document.frmVote.CityCode.value;
				ICOK = true;
				break;
			}
		}
	}
	if (!ICOK)
	{
		alert("Para votar, debe seleccionar una opcion.");
		document.frmVote.AnswerID[0].focus();
	}
	else
	{
		window.open('Vote/vote_post.asp?QuestionID=' + QuestionID + '&AnswerID=' + AnswerID + '&CityCode=' + CityCode, 'Encuesta', 'width=215,height=215,top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
	}
}

function openchatwin() {
	var RoomID = document.chat.room.options[document.chat.room.selectedIndex].value;
	var nickname = document.chat.nickname.value;
	
	if (nickname == ''  ||  nickname == 'Apodo') 
			{
		alert('Usted debe escribir un nombre.');
		
		chat.nickname.select();
			} 
		else {	
			var LeftPosition = ((screen.width)?(screen.width-825)/2:100);
			var TopPosition = ((screen.height)?(screen.height-625)/2:100);
			window.open('http://www.tutopia.com/ChatBBS/chat_login1.asp?RoomID=' + RoomID + '&nickname=' + nickname, 'Encuesta', 'width=825,height=625,top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
			}
}

function OpenPopupWindow(URL, Height, Width) {
	var LeftPosition = ((screen.width)?(screen.width-Width)/2:100);
	var TopPosition = ((screen.height)?(screen.height-Height)/2:100);

	window.open(URL,'_blank', 'width=' + Width + ',height=' + Height + ',top=' + TopPosition + ',left=' + LeftPosition + ',resizable=false,maxbutton=false');
}

function OpenRadioGuide() {
	var StationID = document.frmRadio.cboStationID.options[document.frmRadio.cboStationID.selectedIndex].value;
	if (StationID == '') {
		alert('Por favor selecciona una estación de radio.');
	}
	else {
		var LeftPosition = ((screen.width)?(screen.width-470)/2:100);
		var TopPosition = ((screen.height)?(screen.height-426)/2:100);

		window.open('/Channels/musica/batanga/batangaredirect.asp?StationID='+StationID,'LaunchPlayerAndPlaylist','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,width=470,height=426,top=' + TopPosition + ',left' + LeftPosition);
	}
}

function OpenPopupWindow1(URL, Height, Width) {
	var LeftPosition = ((screen.width)?(screen.width-Width)/2:100);
	var TopPosition = ((screen.height)?(screen.height-Height)/2:100);

	window.open(URL,'_blank', 'width=' + Width + ',height=' + Height + ',top=' + TopPosition + ',left=' + LeftPosition + ',resizable=true,maxbutton=false,scrollbars=yes');
}

function ValidateDateSearch() {
	if (document.frmDateSearch.cat.options[document.frmDateSearch.cat.selectedIndex].value == '') {
		alert('Por favor selecciona una opción.');
		document.frmDateSearch.cat.focus();
		return false;
	}
	if (document.frmDateSearch.Country.options[document.frmDateSearch.Country.selectedIndex].value == '') {
		alert('Por favor selecciona una opción.');
		document.frmDateSearch.Country.focus();
		return false;
	}
	return true;
}

function SelectChannel(Field) {
	//var url = 'http://www.tutopia.com/channels/realmedia.asp?channel=' + Field.options[Field.selectedIndex].value;
	var url = Field.options[Field.selectedIndex].value;
	window.open(url, '_blank');
}

function SelectGame(Field) {
	OpenPopupWindow(Field.options[Field.selectedIndex].value, 550, 670);
}

function openbchatwin()  {
	var nickname = document.frmBChat.nickname.value;
	var LeftPosition = ((screen.width)?(screen.width-825)/2:100);    
	var TopPosition = ((screen.height)?(screen.height-625)/2:100);
	window.open('http://rmwww1.tutopia.com/chatBBS/Boheringer/Chat_Boringer.asp?RoomID=1004'+'&nickname=' + nickname, 'Encuesta', 'width=790,height=500,top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
}
