function abrirVentana(foto,leyenda,ancho,altura) {
		url="ventana.php?foto="+foto+"&leyenda="+leyenda;
		ancho=parseInt(ancho)+50;
		altura=parseInt(altura)+50;
		propiedades="width="+ancho+",height="+altura+",menubar=no,location=no,resizable=no,scrollbars=no,status=no";
		window.open(url,"ventana",propiedades);
	}

function llamado(link) {
		link=link+"&contenido_home=1";
		document.forma.contenido_home.value="1";
		document.location.href=link;
		//document.forma.submit();
	}

function resize(ancho,alto){
	self.resizeTo(ancho,alto); 
	LeftPosition = (screen.width) ? (screen.width-ancho)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-alto)/2 : 0;
	self.moveTo(LeftPosition,TopPosition-70);
}

function abrir_ventana_noscroll(name){
	ventana = window.open(name, "ventana"+name, "width=5,height=5,dependent=yes,screenX=0,screenY=0,titlebar=no,directories=no,menubars=no,status=no,scrollbars=no,resizable=no"); 
}
function abrir_ventana_sencilla(name){
	ventana = window.open(name, "ventana"+name, "width=5,height=5,dependent=yes,screenX=0,screenY=0,titlebar=no,directories=no,menubars=no,status=no,scrollbars=yes,resizable=no"); 
}

function abrir_ventana2(name,ancho,alto){
	window.name="Tope"+name;
	window.open(name, "ventana", "width="+ancho+",height="+alto+",dependent=yes,screenX=0,screenY=0,titlebar=no,directories=no,menubars=no,status=no,scrollbars=no,resizable=no"); 
}

function validar_todo(laforma){
	for(var i = 0; i < laforma.elements.length; i++){
		if(laforma.elements[i].value == ""){
			alert("Ingrese todos los campos requeridos como obligatorios");
			laforma.elements[i].focus();
			return false;
		}
		if(laforma.elements[i].value.indexOf ("'", 0) != -1){
			alert("Elimine las comillas!");
			laforma.elements[i].focus();
			return false;
		}
	}
	return true;
}

function validar_perdio(laforma){
	for(var i = 0; i < laforma.elements.length; i++){
		if(laforma.elements[i].value == ""){
			alert("Ingrese todos los campos requeridos como obligatorios");
			laforma.elements[i].focus();
			return false;
		}
		if(laforma.elements[i].value.indexOf ("'", 0) != -1){
			alert("Elimine las comillas!");
			laforma.elements[i].focus();
			return false;
		}
		if((laforma.elements[i].name.indexOf("mail",0)!=-1) && ((laforma.elements[i].value.indexOf('@', 0) == -1) || (laforma.elements[i].value.indexOf('.', 0) == -1))){
			alert("Ingrese una dirección de E-Mail valida");
			laforma.elements[i].focus();
			return false;
		}
	}
	return true;
}

function validar_mail(laforma){
		if(laforma.var_mail.value == ""){
			abrir_ventana_noscroll("p_mensaje.php?id_men=1");
			return false;
		}
	if(laforma.var_mail.value.indexOf ("'", 0) != -1){
		alert("Elimine las comillas!");
		laforma.var_mail.focus();
		return false;
	}
	return true;
}

function mostrar(id){
	eval(id + ".style.display=\"block\"");
}

function no_mostrar(id){
     eval(id + ".style.display =\"none\"");
}

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_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function trim(sString)
{
   sTrimmedString = "";
   if (sString != "")
   {
      var iStart = 0;
      var iEnd = sString.length - 1;
      var sWhitespace = " \t\f\n\r\v";
     
      while (sWhitespace.indexOf(sString.charAt(iStart)) != -1)
      {
         iStart++;
         if (iStart > iEnd)
            break;
      }
     
      // If the string not just whitespace
      if (iStart <= iEnd)
      {
         while (sWhitespace.indexOf(sString.charAt(iEnd)) != -1)
            iEnd--;
         sTrimmedString = sString.substring(iStart,++iEnd);
      }
   }
   return sTrimmedString;
} 

function validar_nuevo_usuario(laforma){
	for(var i = 0; i < laforma.elements.length; i++){
		if(laforma.elements[i].value == "" && laforma.elements[i].name!="Observaciones"){
			alert("Ingrese todos los campos requeridos como obligatorios");
			laforma.elements[i].focus();
			return false;
		}
		if(laforma.elements[i].value.indexOf ("'", 0) != -1){
			alert("Elimine las comillas!");
			laforma.elements[i].focus();
			return false;
		}
	}
	return true;
}

function validar_forma_pub(){
	la_forma = eval("window.document.forma_usuario");
	if(la_forma.titulo.value == ""){
		alert("Ingrese el titulo, es campo requerido como obligatorio");
		la_forma.titulo.focus();
		return false;
	}
	if(la_forma.resena.value == ""){
		alert("Ingrese la reseña, es campo requerido como obligatorio");
		la_forma.resena.focus();
		return false;
	}
	la_forma.submit();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}