// JavaScript Document
<!--
var newwindow = ''
function popitup(url) {
if (newwindow.location && !newwindow.closed) {
    newwindow.location.href = url;
    newwindow.focus(); }
else {
    newwindow=window.open(url,'htmlname','width=320, height=320, resizable=no', 'scroll=1');
	}
}
function tidy() {
if (newwindow.location && !newwindow.closed) {
   newwindow.close(); }
}
function MM_jumpMenu(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-

function dataok () { 
	var errorMsg = "";
	if (document.busqueda.q.value == ""){
		errorMsg += "Ingrese un término para comenzar la búsqueda.";	
	}
	
	if (errorMsg != ""){
		msg = "Busquedas por criterio.\n";
		msg +="_________________________________________\n\n";
				errorMsg += alert(msg + errorMsg + "");
		return false;
	}
	
	return true;
}

function jumping(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function donde(url){ 
document.formulario.action=url; 
} 


function permite(elEvento, permitidos) {
  // Variables que definen los caracteres permitidos
  var numeros = "0123456789";
  var caracteres = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ";
  var numeros_caracteres = numeros + caracteres;
  var numtel = "0123456789()-";
 
  // Seleccionar los caracteres a partir del parámetro de la función
  switch(permitidos) {
    case 'num':
      permitidos = numeros;
      break;
    case 'car':
      permitidos = caracteres;
      break;
    case 'num_car':
      permitidos = numeros_caracteres;
      break;
	case 'numtel':
      permitidos = numtel;
      break;
  }
 
  // Obtener la tecla pulsada 
  var evento = elEvento || window.event;
  var codigoCaracter = evento.charCode || evento.keyCode;
  var caracter = String.fromCharCode(codigoCaracter);
 
  // Comprobar si la tecla pulsada se encuentra en los caracteres permitidos
  return permitidos.indexOf(caracter) != -1;
}

function CheckRegistroUser () { 
	var errorMsg = "";
	var elemento = document.getElementById("acepto");
	
		if (document.formulario.nombreuser.value == ""){
		errorMsg += "\nNombre de Usuario:  Elige un nombre de Usuario.";
	}
		if (document.formulario.tipo_user.value == ""){
		errorMsg += "\nTipo de Usuario: \t Elija su Perfil.";
	}
		
	if ((document.formulario.email.value == "") || (document.formulario.email.value.length > 0 && (document.formulario.email.value.indexOf("@",0) == - 1 || document.formulario.email.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\nEmail \t\t Ingrese un E-mail Válido";
	}

	if (document.formulario.email.value == document.formulario.pass.value)
	{
		errorMsg += "\nDatos idénticos: \t Password y E-mail deben ser diferentes!.";
	}

	if (document.formulario.pass.value == ""){
		errorMsg += "\nPassword: \t Elija su Password de acceso.";
	}
	if (document.formulario.pass.value != document.formulario.pass2.value)
	{
		errorMsg += "\nPassword: \t Las claves ingresadas no coinciden.";
	}
	
	if (errorMsg != ""){
		msg = "____________________________________________\n\n";
		msg += "POR FAVOR COMPLETE TODOS LOS CAMPOS.\n";
		msg += "____________________________________________\n";
		msg += "Los siguientes campos necesitan ser corregidos: \n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}
function oculta(a)
{
a = document.getElementById(a);

if(a.style.display=="block")
{
a.style.display = "none";
} else {
a.style.display = "block";
}
}


function CheckUser() { 
	var errorMsg = "";
	
		if (document.access.quien.value == "Ingresar"){
		errorMsg += "\nNombre Usuario:\tIngrese su Nombre de Usuario.";
	}
		if (document.access.que.value == ""){
		errorMsg += "\nPassword:\tIngrese su Password.";
	}
			
	if (errorMsg != ""){
		msg = "____________________________________________\n\n";
		msg += "POR FAVOR COMPLETE TODOS LOS CAMPOS.\n";
		msg += "____________________________________________\n";
		msg += "Los siguientes campos necesitan ser corregidos: \n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}

function ctct () { 
	var errorMsg = "";
	if (document.frmEnquiry.firstName.value == ""){
		errorMsg += "\nNombre \t\t- Por favor ingrese su Nombre";	
	}
	if (document.frmEnquiry.lastName.value == ""){
		errorMsg += "\nTeléfono \t\t- Por favor ingrese un número de contacto";
	}
	
	if (document.frmEnquiry.asunto.value == ""){
		errorMsg += "\nAsunto \t\t- Ingrese un Asunto para su Comentario";
	}
	if ((document.frmEnquiry.email.value == "") || (document.frmEnquiry.email.value.length > 0 && (document.frmEnquiry.email.value.indexOf("@",0) == - 1 || document.frmEnquiry.email.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\nE-mail \t\t- Ingrese una dirección válida de E-mail";
	}
	if (document.frmEnquiry.enquiry.value == "") { 
 		errorMsg += "\nComentarios \t- Aún no ha ingresado sus Comentarios";
	}
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "Su comentario no ha sido enviado. Hay un inconveniente(s) en el formulario.\n";
		msg += "Por favor revíselo y corrija los campos requeridos.\n";
		msg += "______________________________________________________________\n\n";
		msg += "Los siguientes campos necesitan ser corregidos: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}
function rcm () { 
	var errorMsg = "";
	if (document.frmEnquiry.VisitorsName.value == ""){
		errorMsg += "\nSu Nombre \t\t- Por favor ingrese su Nombre";	
	}
	if ((document.frmEnquiry.VisitorsEmail.value == "") || (document.frmEnquiry.VisitorsEmail.value.length > 0 && (document.frmEnquiry.VisitorsEmail.value.indexOf("@",0) == - 1 || document.frmEnquiry.VisitorsEmail.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\nSu E-mail \t\t\t- Su dirección de E-mail no parece válida.";
	}
	if (document.frmEnquiry.FriendsName.value == ""){
		errorMsg += "\nSu amigo \t\t\t- Ingrese el nombre del destinatario";
	}
	if ((document.frmEnquiry.FriendsEmail.value == "") || (document.frmEnquiry.FriendsEmail.value.length > 0 && (document.frmEnquiry.FriendsEmail.value.indexOf("@",0) == - 1 || document.frmEnquiry.FriendsEmail.value.indexOf(".",0) == - 1))) { 
		errorMsg += "\nE-mail de su contacto \t- Por favor ingrese el E-mail de su amigo.";
	}
	if (document.frmEnquiry.Subject.value == ""){
		errorMsg += "\nTitulo del mensaje \t\t- Ingrese un titulo para su mensaje";
	}
	if (document.frmEnquiry.message.value == "") { 
 		errorMsg += "\nComentario \t\t- Ingrese un comentario.";
	}
	if (errorMsg != ""){
		msg = "_____________________________________________________________\n\n";
		msg += "Hay un inconveniente en el formulario\n";
		msg += "Por favor revise la información requerida.\n";
		msg += "____________________________________________________________\n\n";
		msg += "Los siguientes campos necesitan ser corregidos: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
		return true;
}
function DescriptionCharCount() {
	document.frmSignGuestBook.countcharacters.value = document.frmSignGuestBook.comments.value.length;	
}

// Function to add the code for bold italic and underline, to the message
function AddMessageCode(code,promptText, InsertText) {

	if (code != "") {
		insertCode = prompt(promptText + "\n[" + code + "]xxx[/" + code + "]", InsertText);
			if ((insertCode != null) && (insertCode != "")){
				document.frmSignGuestBook.comments.value += "[" + code + "]" + insertCode + "[/"+ code + "] ";
			}
	}		
	document.frmSignGuestBook.comments.focus();
}


//Function to add the code to the message for the smileys
function AddSmileyIcon(iconCode) {	
		document.frmSignGuestBook.comments.value += iconCode + " ";
		document.frmSignGuestBook.comments.focus();
}

//Function to open pop up window
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}
//-->