// JavaScript Document

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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_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_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' debes poner un e-mail correctamente.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' debe contener un nï¿½mero.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' debe contener un nï¿½mero entre '+min+' y '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' campo requerido.\n'; }
  } if (errors) alert('Se ha/n encontrado los siguientes error/es:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function closewindow()
{
self.close()
}


function mailnobot(nm,dm)
{
var ma = 'ma';
var il = 'il';
var to = 'to';
mailurl = ma + il + to + ":" + nm + "@" + dm;
window.location = mailurl;
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function LimitAttach(tField,iType) {
file=tField.value;
if (iType==1) {
extArray = new Array(".gif",".jpg",".png");
//extArray = new Array(".jpg");
}
if (iType==2) {
extArray = new Array(".swf");
}
if (iType==3) {
extArray = new Array(".exe",".sit",".zip",".tar",".swf",".mov",".hqx",".ra",".wmf",".mp3",".qt",".med",".et");
}
if (iType==4) {
extArray = new Array(".mov",".ra",".wmf",".mp3",".qt",".med",".et",".wav");
}
if (iType==5) {
extArray = new Array(".html",".htm",".shtml");
}
if (iType==6) {
extArray = new Array(".doc",".xls",".ppt");
}
allowSubmit = false;
if (!file) return;
while (file.indexOf("\\") != -1) file = file.slice(file.indexOf("\\") + 1);
ext = file.slice(file.indexOf(".")).toLowerCase();
for (var i = 0; i < extArray.length; i++) {
if (extArray[i] == ext) {
allowSubmit = true;
break;
}
}
if (allowSubmit) {
} else {
tField.value="";
alert("Usted sólo puede subir archivos con extensiones " + (extArray.join(" ")) + "\nPor favor seleccione un nuevo archivo");
}
}

//Event.observe(window, 'load', function() { setupDependencies('registro') }, false);

function openForm(nombreV) {
	window.open('', nombreV, 'width=250,height=100,top=20,left=50');
	return true;
       }

function inscodimg(numImg,campo){
	var input = document.getElementById(campo);
	alert("Procura poner la imagen delante de pÃ¡rrafos con mucho texto y alternar su colocaciï¿½n. Cuidado!!!!!!!, actualmente pone el cï¿½digo al final del campo 'contenido'...");
	var my_align = prompt("Indica alineaciÃ³n de la imagen left, right o center","left");
	var my_pie = prompt("Â¿QuiÃ©res poner un pie de foto a la imagen?","");
	if (my_align != null){
		if (my_pie == null){ my_pie == "" }
		input.value+=" [foto=" + numImg +  "-" + my_align +  "]" + my_pie + "[/foto]";
		return;
	}
}

function checkCats(click)
{
	//alert(click);
	document.getElementById(click).checked=true;
}

function campoColor(soy,campo)
{
	//alert(soy+"  "+campo);
	if(document.getElementById(soy).checked==true)
	{
		document.getElementById(campo).disabled=true;
	}else{
		document.getElementById(campo).disabled=false;
	}
}

function mostrarAutores()
{
	if(document.getElementById('otrosautores').style.display=='none')
	{
		document.getElementById('otrosautores').style.display='';
		document.getElementById('ver').innerHTML=' &#9660; ocultar &#9660; ';
	}
	else
	{
		document.getElementById('otrosautores').style.display='none';
		document.getElementById('ver').innerHTML=' &#9650; ver todos &#9650; ';
	}
}

