

function submitform(theForm){	

	  theForm.submit();

}





function enter(entry){

      var e = document.getElementById('entry');

      e.value = entry;



      var f = document.getElementById('entry_form');



	 f.submit();





      return false;

}







function forma_new_galeria()

{

  if (document.getElementById('nombreGaleria').style.visibility=='hidden'){

    document.getElementById('nombreGaleria').style.visibility = 'visible';

    document.getElementById('descGaleria').style.visibility = 'visible';

    document.getElementById('urlGaleria').style.visibility = 'visible';

    document.getElementById('listFolder').style.visibility = 'visible';

    document.getElementById('botonGaleria').style.visibility = 'visible';

  }else{

    document.getElementById('nombreGaleria').style.visibility = 'hidden';

    document.getElementById('descGaleria').style.visibility = 'hidden';

    document.getElementById('urlGaleria').style.visibility = 'hidden';

    document.getElementById('listFolder').style.visibility = 'hidden';

    document.getElementById('botonGaleria').style.visibility = 'hidden';

  }

}

var upload_miLastID = 0; //default of input element already written



function displayFlash(path, width, height)

{

	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0" WIDTH="' + width);

	document.write('" HEIGHT="' + height + '" id="FlashContent">');

	document.write('<PARAM NAME="movie" VALUE="' + path + '"><PARAM NAME="quality" VALUE="high">');

	document.write('<PARAM NAME="AllowScriptAccess" VALUE="never"><EMBED src="' + path + '"');

	document.write(' quality="high" WIDTH="' + width + '" HEIGHT="' + height + '" NAME="FlashContent"');

	document.write(' AllowScriptAccess="never" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');

	document.write('</EMBED></OBJECT>');

}





//VALIDADORES DE LA FORMA DE REMIND PASSWORD

function pass_FormValidator(theForm)

{



  if (theForm.pass1.value == "" || theForm.pass2.value == ""){

    alert("Es necesario especificar una contraseña para continuar.");

    theForm.pass1.focus();

    return (false);

  }



  if (theForm.pass1.value != theForm.pass2.value){



    alert("Las contraseñas no coinciden.");

    theForm.pass1.focus();

    return (false);

  }

}



function clickclear(thisfield, defaulttext) {

  if (thisfield.value == defaulttext) {

    thisfield.value = "";

  }

}



function clickrecall(thisfield, defaulttext) {

  if (thisfield.value == "") {

    thisfield.value = defaulttext;

  }

}



function insertAfter(newElement,targetElement) {

  var parent = targetElement.parentNode;

  if (parent.lastChild == targetElement) {

    parent.appendChild(newElement);

  } else {

    parent.insertBefore(newElement,targetElement.nextSibling);

  }

}

function clickclear(thisfield, defaulttext) {

  if (thisfield.value == defaulttext) {

    thisfield.value = "";

  }

}



function clickrecall(thisfield, defaulttext) {

  if (thisfield.value == "") {

    thisfield.value = defaulttext;

  }

}





function nuevoFolder_list(){
	var mylist=document.getElementById("listFolder")
	document.getElementById("queFolder").value=document.getElementById("listFolder").value
	if(document.getElementById("listFolder").value=="carpeta nueva"){		
		document.getElementById("listFolder").disabled=true;
		document.getElementById("queFolder").value="<Nombre de la carpeta>";
		document.getElementById("listFolder").style.visibility = 'hidden';
		document.getElementById("queFolder").style.visibility = 'visible';
	}
}

function nuevoCat_list(){
	var mylist=document.getElementById("listCat")
	document.getElementById("queCat").value=document.getElementById("listCat").value
	if(document.getElementById("listCat").value=="cat nueva"){		
		document.getElementById("listCat").disabled=true;
		document.getElementById("queCat").value="<Nombre de la categoria>";
		document.getElementById("listCat").style.visibility = 'hidden';
		document.getElementById("queCat").style.visibility = 'visible';
	}
}



function textCounter(field, countfield, maxlimit) {

	if (field.value.length > maxlimit) {

		field.value = field.value.substring(0, maxlimit);

		alert("La descripción deberá ser máximo de "+maxlimit+" caracteres.");

	}else{

		countfield.value = maxlimit - field.value.length;



	}

}



function isEmailAddr(email){

  var result = false;

  var theStr = new String(email);

  var index = theStr.indexOf("@");

  if (index > 0){

    var pindex = theStr.indexOf(".",index);

    if ((pindex > index+1) && (theStr.length > pindex+1))

        result = true;

  }

  return result;

}





function FormValidator(theForm){

  if (theForm.name_pag.value == ""){

    alert("Es necesario especificar el nombre de la página.");

    theForm.name_pag.focus();

    return (false);

  }

  return (true);

}





//VALIDADORES DE LA FORMA DE REGISTRO0

function reg0_FormValidator(theForm)

{



  if (theForm.reg0_login.value == ""){

    alert("Es necesario especificar un login para continuar.");

    theForm.reg0_login.focus();

    return (false);

  }



  if (theForm.reg0_pass1.value == ""){

    alert("Es necesario especificar una contraseña para continuar.");

    theForm.reg0_pass1.focus();

    return (false);

  }



}

//VALIDADORES DE LA FORMA DE NUEVO GRUPO

function newgrupo_FormValidator(theForm)

{



  if (theForm.nombreGrupo.value == ""){

    alert("Es necesario especificar el nombre del grupo para continuar.");

    theForm.nombreGrupo.focus();

    return (false);

  }

  if (theForm.urlGrupo.value == ""){

    alert("Es necesario especificar un url válido para continuar.");

    theForm.urlGrupo.focus();

    return (false);

  }



}

//VALIDADORES DE LA FORMA DE EDITAR GRUPO

function editgrupo_FormValidator(theForm)

{



  if (theForm.nombreGrupo_edit.value == ""){

    alert("Es necesario especificar el nombre del grupo para continuar.");

    theForm.nombreGrupo_edit.focus();

    return (false);

  }

  if (theForm.urlGrupo_edit.value == ""){

    alert("Es necesario especificar un url válido para continuar.");

    theForm.urlGrupo_edit.focus();

    return (false);

  }



}

//VALIDADORES DE LA FORMA DE APORTACIONES

function aportaciones_FormValidator(theForm)

{



  if (theForm.file_name.value == "0"){

    alert("Falta usuario.");

    theForm.file_name.focus();

    return (false);

  }



  if (theForm.userfile.value == ""){

    alert("Es necesario subir una copia de la ficha de depósito.");

    theForm.userfile.focus();

    return (false);

  }



}



//VALIDADORES DE LA FORMA DE CONTACTO

function contacto_FormValidator(theForm)

{



  if (theForm.nombre.value == ""){

    alert("Porfavor especifica tu nombre.");

    theForm.nombre.focus();

    return (false);

  }



  if (!isEmailAddr(theForm.contacto_email.value))

  {

    alert("Porfavor especifica un correo electrónico");

    theForm.contacto_email.focus();

    return (false);

  }

  return (true);

}



//VALIDADORES DE LA FORMA DE EMAIL

function email_FormValidator(theForm)

{



  if (!isEmailAddr(theForm.email_to.value))

  {

    alert("Porfavor especifica un correo electrónico");

    theForm.email_to.focus();

    return (false);

  }



  if (!isEmailAddr(theForm.email_from.value))

  {

    alert("Porfavor especifica un correo electrónico");

    theForm.email_from.focus();

    return (false);

  }

  return (true);

}





//VALIDADORES DE LA FORMA DE REGISTRO

function reg_FormValidator(theForm)

{

	if(theForm.reg_manifiesto.value=="true"){

		  if (theForm.reg_firma_contrato.checked == false){

			alert("Para participar es necesario suscribir el manifiesto.");

			theForm.reg_firma_contrato.focus();

			return (false);

		  }

	}



  if (theForm.reg_login.value == ""){

    alert("Es necesario especificar un login para continuar.");

    theForm.reg_login.focus();

    return (false);

  }



  if (theForm.reg_pass1.value == "" || theForm.reg_pass2.value == ""){

    alert("Es necesario especificar una contraseña para continuar.");

    theForm.reg_pass1.focus();

    return (false);

  }



  if (theForm.reg_pass1.value != theForm.reg_pass2.value){



    alert("Las contraseñas no coinciden.");

    theForm.reg_pass1.focus();

    return (false);

  }



  if (theForm.reg_nombre.value == "")

  {

    alert("Es necesario registrar un nombre.");

    theForm.reg_nombre.focus();

    return (false);

  }



  if (!isEmailAddr(theForm.reg_email1.value))

  {

    alert("Es necesario especificar un correo válido");

    theForm.reg_email1.focus();

    return (false);

  }

 /* if (theForm.reg_dependencia.value == ""){

    alert("Es necesario especificar a que dependencia académica pertenece.");

    theForm.reg_dependencia.focus();

    return (false);

  }

*/

  if (theForm.reg_email1.value.length < 3)

  {

    alert("Es necesario especificar un correo válido");

    theForm.reg_email1.focus();

    return (false);

  }

  //return (true);

}

//FORMA ARCHIVO

function file_FormValidator(theForm)

{





	//APPENDE ANTES EL TAG DE GRUPO CUANDO NUEVA CARPETA

	if (theForm.listFolder.value == "carpeta nueva" ){

		//theForm.queFolder.value=theForm.grupo.value+""+theForm.queFolder.value;

		if(theForm.queFolder.value == "<Nombre de la carpeta>"){

			    alert("Falta nombre de la carpeta");

    			theForm.queFolder.focus();

   			 	return (false);

		}

	}



  if (theForm.listFolder.value == "0" ){

    alert("Es necesario elegir una carpeta.");

    theForm.listFolder.focus();

    return (false);

	



  }

  

  /*

  if (theForm.queFolder.value == "" || theForm.queFolder.value=="Nombre de la carpeta"){

    alert("Es necesario elegir el nombre de la nueva carpeta");

    theForm.queFolder.focus();

    return (false);

  }

  if (theForm.file_name.value == ""){

    alert("Es necesario elegir una nombre para el archivo.");

    theForm.file_name.focus();

    return (false);

  }*/

  if (theForm.userfile.value == ""){

    alert("Es necesario elegir un archivo.");

    theForm.userfile.focus();

    return (false);

  }

}



//FORMA FOTO

function photo_FormValidator(theForm)

{



  if (theForm.id_gal.value == "0"){

    alert("Es necesario elegir una galería.");

    theForm.id_gal.focus();

    return (false);

  }

  if (theForm.myfile0.value == ""){

    alert("Es necesario elegir una foto.");

    theForm.myfile0.focus();

    return (false);

  }

}



//FORMA NEW FOLDER

function folder_FormValidator(theForm)

{



  if (theForm.nombreFolder.value == ""){

    alert("Es indispensable elegir el nombre de la carpeta.");

    theForm.nombreFolder.focus();

    return (false);

  }

}





//FORMA EDITAR FOLDER

function edit_folder_FormValidator(theForm)

{



  if (theForm.folder_editar_nombre.value == ""){

    alert("Es indispensable elegir el nombre de la carpeta.");

    theForm.folder_editar_nombre.focus();

    return (false);

  }

}



//FORMA NEW GALERIA

function galeria_FormValidator(theForm)

{



  if (theForm.nombreGaleria.value == ""){

    alert("Es indispensable elegir el nombre de la galería.");

    theForm.nombreGaleria.focus();

    return (false);

  }

}



//FORMA EDIT FOLDER

function edit_galeria_FormValidator(theForm)

{



  if (theForm.edit_nombreGaleria.value == ""){

    alert("Es indispensable elegir el nombre de la galería.");

    theForm.edit_nombreGaleria.focus();

    return (false);

  }

}



//FORMA NEW GRUPO

function grupo_FormValidator(theForm)

{



  if (theForm.nombreGrupo.value == ""){

    alert("Es indispensable elegir el nombre del grupo.");

    theForm.nombreGrupo.focus();

    return (false);

  }

}



//FORMA UPLOAD LINK

function link_FormValidator(theForm)

{



  if (theForm.href.value == "" || theForm.href.value == "http://"){

    alert("Es indispensable definir la dirección del vínculo.");

    theForm.href.focus();

    return (false);

  }

  if (theForm.queFolder.value == "0" ){

    alert("Es indispensable elegir una carpeta.");

    theForm.queFolder.focus();

    return (false);

  }



}



//FORMA NEW TEMA

function tema_FormValidator(theForm)

{



  if (theForm.titulo.value == ""){

    alert("Es indispensable elegir el nombre de la discusión.");

    theForm.titulo.focus();

    return (false);

  }

}