
function addCategoria(MDuse,Mtit){
   var name = "sugerencia";
   var c = getAnchorPosition(name);
  // Vimg =  document.getElementById("IdCenitem").value;
   document.getElementById("IDwesq").style.display="block";
   document.getElementById("IDwesq").className= "centrar";
   document.getElementById("wcontbl").innerHTML="<div style='background-color:red;width:78px; padding: 2px 2px 2px 2px;' align=left><font color=#ffffff><b>Cargando...</b></font></div>";
   document.getElementById("IDwesq").style.width="328px";
   document.getElementById("hc-window").innerHTML="Sugerir "+Mtit;
   document.getElementById("hc-window").style.width="310px";
   document.getElementById("wcenter").style.width="328px";
   document.getElementById("dwindowcontent").style.height="98px";
   document.getElementById("dbodycontent").style.height="98px";
   document.getElementById("dbodycontent").style.overflow="hidden";
   document.getElementById("IDwesq").style.padding= c.y+"px 0px 0px "+c.x+"px";
   xajax_Agregarcategoria(xajax.getFormValues("idformadicionar"),MDuse,Mtit);
}

function fresponder(coment,login){
	document.getElementById('cforminfo').style.display = "block";
	document.getElementById('cforminfo').innerHTML = "<b>Respondiendo comentario de "+login+"</b> (<a href='#' onclick=\"fcresp(); return false;\" class=\"c-reply\">cancelar</a>)";
	document.getElementById('responder').value = coment;
	document.getElementById('icomentario').value = "";
	document.getElementById('idaccion').value = "";
	document.getElementById('idcomment').value = "";
	document.getElementById('idcomment').focus();

}
function fcresp(){
	document.getElementById('cforminfo').style.display = "none"; 
	document.getElementById('responder').value = "";
	document.getElementById('icomentario').value = "";
	document.getElementById('idaccion').value = "";
	document.getElementById('idcomment').value = "";
	document.getElementById('idcomment').focus();
}
function popcm(id,text,url){
   var vC = getCookie('agora_usuario');
   if (!vC){
	   if ((text == "votar")){
         document.getElementById('popup'+id).style.display = "block";
         document.getElementById('popup'+id).innerHTML = '<div id="poppDiv" class="inline-warning"><div><p><strong>Para '+text+'!</strong> debe entrar a <a href="index.php" onclick="vLogin('+id+'); return false;">Su cuenta</a> o <a href="index.php?fr=registro">Registrase</a> Gratis.</p><a href="#" onclick="unpoppem('+id+')"><img src="./img/close2.gif" class="close" width="22" height="22" alt="Cerrar" border="0"/></a></div></div>'; 
	   }else{
		  window.location = url;
	   }
	}else{
		if (text != "votar"){
	      window.location = url;	 
		}else{
			xajax_ProcessVotar(id,url);
		}
	}
}
function getCookie(name){
        var cname=name + "=";
        var dc=document.cookie;  
		var dl = dc.length;
		var begin=dc.indexOf(cname);
		if(dc.length>0){
	          begin=dc.indexOf(cname);
                  if(begin!=-1){
		    begin+=cname.length;
	            end=dc.indexOf(";",begin);
                    if(end==-1)
			     end=dc.length;
		    return(dc.substring(begin,end));
                  }
        }

		
 }

function vLogin(id){
	document.getElementById('idemail').focus();
    unpoppem(id);
}

function popde(id,text){
    document.getElementById('popup'+id).style.display = "block";
    document.getElementById('popup'+id).innerHTML = '<div id="poppDiv" class="inline-warning" style="height:150px"><div><p><strong>&iquest;Realmente desea eliminar este comentario?</strong>  <a href="login.php" onclick="xajax_processEliminarComentario(\''+id+'\',\''+text+'\'); return false;">SI</a> o <a href="#" onclick="unpoppem(\''+id+'\'); return false;">NO</a> </p><a href="#" onclick="unpoppem('+id+'); return false;"><img src="./img/close2.gif" class="close" width="22" height="22" alt="Cerrar" border="0"/></a></div></div>'; 
}

function popus(id,text){
    document.getElementById('popup'+id).style.display = "block";
    document.getElementById('popup'+id).innerHTML = '<div id="poppDiv" class="inline-warning" style="height:150px"><div><p><strong>&iquest;Realmente desea eliminar este usuario?</strong>  <a href="login.php" onclick="xajax_processEliminarAmigo('+id+',1); return false;">SI</a> o <a href="#" onclick="unpoppem('+id+')">NO</a> </p><a href="#" onclick="unpoppem('+id+')"><img src="./images/close2.gif" class="close" width="22" height="22" alt="Cerrar" border="0"/></a></div></div>'; 
}

function unpoppem(id){
	document.getElementById('popup'+id).style.display = "none"; 
}

function AbrirFormPostularse(){
	var pgp = document.getElementById("idformpostulado").style.display;
	if (pgp == "none"){
	  document.getElementById("idformpostulado").style.display="block";
	  document.getElementById("idarrow").src="./images/arrow_downp.gif";
	}
	if (pgp == "block"){
	  document.getElementById("idformpostulado").style.display="none";
	  document.getElementById("idarrow").src="./images/arrow1p.gif";
	}
}

function openWinPop(URL,w,h,s,n) {
	var c = getAnchorPosition(n);
	window.open(URL,"_blank","top="+c.x+",left=10,toolbar=no,width="+w+",height="+h+",status=yes,scrollbars="+s+",resize=no,menubars=no");
	
}


function multiSelectorgrupo(g){
	<!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->
	var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 100 );
	<!-- Pass in the file element -->
	multi_selector.addElement( document.getElementById( 'element_input' ) );
    xajax_processListaFotosGrupo(g);
}

function grupover(g,m){
    document.getElementById("idcuerpogrupo").innerHTML="<span style='background-color:#910000;width:78px; padding: 2px 2px 2px 2px;' align=left><font color=#ffffff><b>Cargando...</b></font></span>";
	if (m==1){
	  xajax_processListMensaje(g);
	}
	if (m==2){
	  xajax_processFromMensaje(xajax.getFormValues('idform'),g,0);
	}
	if (m==3){
	  xajax_processListFotos(g);
	}
	if (m==4){
	  xajax_processAgregarFotos(g);
	}
	if (m==5){
	  xajax_processListMiembro(g);
	}
	if (m==6){
	  xajax_processRecomendarGrupo('',g,'');
	}
	if (m==7){
	  xajax_processBajaGrupo('',g,'');
	}
	if (m==8){
	  xajax_processListSolicitudesGrupo(g);
	}
}

function grupocat(cat,name){
	
  document.getElementById('idcategoria').value = cat;
  document.getElementById('idnamecategoria').innerHTML =name;
  document.getElementById('idformgrupo').style.display = "block";
  document.getElementById('idcatgrupo').style.display = "none";
}

function poppu(id,it,text,act){
   if (text == "Bloquear"){
	   if (act==''){
		 document.getElementById('mscomentario'+id).style.display = "block";
		 document.getElementById('msalerta').style.display = "none";
	   }else{
		   var pg = document.getElementById('IdPagetp').value;
		   var cm = document.getElementById("idComentario"+id).value;
		   xajax_processForoBloquearUsr(id,it,pg,cm);
	   }
	}	
}

function popp(id,text,it){
    unpopp();
	var pg = document.getElementById('IdPagetp').value;
	if (text == "Eliminar"){
		var url = 'xajax_processForoMensajeDel('+id+','+it+','+pg+')';
		var msn = text+' este mensaje';
	}
	
	if (text == "Bloquear"){
		var url = 'poppu('+id+','+it+',\''+text+'\',\'\')';
		var url2 = 'poppu('+id+','+it+',\''+text+'\',\'1\')';
		var msn = text+' este Usuario';
	}
	
    document.getElementById('vtemaid_'+id).innerHTML+='<div id="poppDiv" class="inline-warning"><div style="width:484px; padding: 10px 60px 0 10px; " ><span id=msalerta><strong>Esta seguro!</strong> que desea '+msn+', <a href="#" onClick="'+url+';return false">SI</a> or <a href="#" onClick="unpopp();return false">NO</a>.</p> <a href="javascript:unpopp()"></span><img src="./images/close2.gif" class="close" width="22" height="22" alt="Close" border=0 /></a><div style="border:0px; background:#FAF9F7;display:none" id=mscomentario'+id+'>Comentario: (¿Porque lo bloquea?)<br><textarea name="comentario'+id+'" cols="35" rows="3" id="idComentario'+id+'"></textarea><input type="submit" name"submit" value="Bloquear" onclick="'+url2+'" id="idbotomsubmit"></div></div></div>';
	document.getElementById('vtemaid_'+id).className = "inline-warning-bg"; 
    return(false);
}

function unpopp(){
	  poppDiv=document.getElementById('poppDiv');
	  if(poppDiv){
		  poppDiv.parentNode.removeChild(poppDiv);
		  poppDiv=false;
	   }
}


function ForoMensajeEdt(i){
 var cont = document.getElementById("post_message_"+i).innerHTML;
 document.getElementById("idmensaje").value = i;
 document.getElementById("idtrarget").innerHTML = "<textarea name=\"contenido\" cols=\"65\" rows=\"15\" id=\"idContenido\">"+cont+"</textarea>";
 tinyMCE.execCommand('mceAddControl', true, 'idContenido');
 getScrollBottom('idtrarget');
 //tinyMCE.execCommand('mceRemoveControl', false, 'idContenido');

}

function swap_posticon(i){
  var dimga = "./images/iconos/icon"+i+".gif";
  document.getElementById("display_posticon").src = dimga; 
}

function Smile(texto){  
 var vl = document.getElementById('Editor_001_textarea').value;
 document.getElementById('Editor_001_textarea').value = vl + texto;  
 document.getElementById("IDwesq").style.display="none";
 document.getElementById('DivShim').style.display="none";
} 

function modPopupSmile(w,h,m,r,t,b,k){
	var i = 1;
	var wh = w-10;
	var name = "countname_"+m;
	var c = getAnchorPosition(name);
	var vTitulo = "Lista de Smiles";	
	var id = "Editor_001_textarea";
	
	//document.getElementById(i).style.background = "#FFFFCC";
	//document.getElementById("Idid").value = i;
	//document.getElementById("IDwesq").style.display="block";
    document.getElementById("wcontbl").innerHTML="<span style='background-color:red;width:78px; padding: 2px 2px 2px 2px;' align=left><font color=#ffffff><b>Cargando...</b></font></span>";
    document.getElementById("hc-window").innerHTML= vTitulo;
    document.getElementById("IDwesq").style.width=w+"px";
	document.getElementById("hc-window").style.width=wh+"px";
    document.getElementById("dwindowcontent").style.height=h+"px";
    document.getElementById("dbodycontent").style.height=h+"px";
	document.getElementById("IDwesq").style.padding= c.y+"px 0px 0px "+c.x+"px";
	xajax_ProcessMensajeAvatar(id);
	DivSetVisible(i,w,h,c.x,c.y);
}



function modPopup(w,h,m,r,t,b,k){
	var i = 1;
	var wh = w-10;
	var name = "countname_"+m;
	var c = getAnchorPosition(name);
	if (b=="foro_contenido"){
	  var vTitulo = "Lista de Usuarios";	
	}
	if (m == "grupos") {
	  var vTitulo = "Lista de Grupos";
	}
	
	//document.getElementById(i).style.background = "#FFFFCC";
	//document.getElementById("Idid").value = i;
	//document.getElementById("IDwesq").style.display="block";
    document.getElementById("wcontbl").innerHTML="<span style='background-color:red;width:78px; padding: 2px 2px 2px 2px;' align=left><font color=#ffffff><b>Cargando...</b></font></span>";
    document.getElementById("hc-window").innerHTML= vTitulo;
    document.getElementById("IDwesq").style.width=w+"px";
	document.getElementById("hc-window").style.width=wh+"px";
    document.getElementById("wcenter").style.width=w+"px";
    
	
	
	
	
	document.getElementById("IDwesq").style.padding= c.y+"px 0px 0px "+c.x+"px";
	if (m != "grupos"){
	  xajax_ProcessForoUsuariosMensaje(b,m,k);
	}else{
	  xajax_ProcessGruposUsuario(xajax.getFormValues("IdFormAdminConf"),k);
	}
		  DivSetVisible(i,w,h,c.x,c.y);
}

function DivSetVisible(i,w,h,l,t)
  {
   var hw = eval(h)+30;
   var DivRef = document.getElementById('IDwesq');
   var IfrRef = document.getElementById('DivShim');
   if(i)
   {
    DivRef.style.display = "block";
    IfrRef.style.width = w+"px" ;
    IfrRef.style.height = hw+"px";
    IfrRef.style.top = t;
    IfrRef.style.left = l;
    IfrRef.style.zIndex =  1;
    IfrRef.style.display = "block";
	//IfrRef.style.padding= t+"px 0px 0px "+l+"px";
	
   }
   else
   {
    DivRef.style.display = "none";
    IfrRef.style.display = "none";
   }
 }

function getScrollTop() { 
	self.scroll(0100);
} 

function getScrollBottom(y) { 
 var c = getAnchorPosition(y);
 self.scroll(0,c.y);
	
} 

function addform(a,b,c){
  document.getElementById(a).action = b;
  document.getElementById(a).encoding = "multipart/form-data";
  document.getElementById(a).target = c;
  document.getElementById(a).method = "POST";
  document.getElementById(a).submit();
}

function enviarrepuesta(qv,t,l){
    xajax.$('idbotomsubmit').disabled=true;
    xajax.$('idbotomsubmit').value="por favor espere...";
	document.getElementById("idContenido").value = tinyMCE.getContent();  
	
	if (t=="foro_contenido"){
	  var ed = document.getElementById("idmensaje").value;	
	  var ct = document.getElementById("idContenido").value;
	  if (ed == ""){
	 	    xajax_processEnviarRepuesta(xajax.getFormValues(qv),t,l);
	  }else{
		   xajax_processForoMensajeEdt(ed,ct);  
		   //document.getElementById("msnprueba").innerHTML = ct;
	  }
	}
	
	if (t=="foro_temas"){
	  document.getElementById("msnprueba").innerHTML = "ramon"+qv;	
	  document.getElementById("idContenido").value = tinyMCE.getContent();	
	  document.getElementById(qv).submit();
	}
  }
  
  function setBrowserType(){ 
    var aBrowFull = new Array("opera", "msie", "netscape", "gecko", "mozilla"); 
    var aBrowVers = new Array("opera", "msie", "netscape", "rv",    "mozilla"   ); 
    var aBrowAbrv = new Array("op",    "ie",   "ns",       "mo",    "ns"   ); 
    var sInfo = navigator.userAgent.toLowerCase();; 

    sBrowser = ""; 
    for (var i = 0; i < aBrowFull.length; i++){ 
     if ((sBrowser == "") && (sInfo.indexOf(aBrowFull[i]) != -1)){ 
      sBrowser = aBrowAbrv[i]; 
      sVersion = String(parseFloat(sInfo.substr(sInfo.indexOf(aBrowVers[i]) + aBrowVers[i].length + 1))); 
     } 
    } 
   } 

   function getBrowserName(){ 
   setBrowserType();
    return sBrowser; 
   } 

   function getBrowserVersion(){ 
   setBrowserType();
    return sVersion; 
   } 


function openWinDes(URL,w,h,s) {
	//window.open(URL,"_blank","top=0,left=0,toolbar=no,width="+w+",height="+h+",status=no,scrollbars="+s+",resize=no,menubars=no");
    childWindow=open(URL,"_blank","top=0,left=0,toolbar=no,width="+w+",height="+h+",status=no,scrollbars="+s+",resize=no,menubars=no");
    //if (childWindow.opener == null) childWindow.opener = self;
}

//paginadores
function inputpaginadorphp(t,v,i,u,l){
	
    var p = (document.getElementById("IdPagetp").value);
    if (t == "foro_temas"){
	 window.location = 'index.php?mn=foro&vw=2&sf='+v+'&tp='+i+'&ord='+u+'&sort='+l+'&pg='+p+'';  
	}
  }

function inputpaginador(t,v,i,u,l){
    var p = (document.getElementById("IdPagetp").value);
    xajax_processPaginador(xajax.getFormValues(i),t,p,v,u,l);
	  
  }

function vwFotos(m,u){
	document.getElementById('idvwFotos').src = "./images/trans.gif";
	var a = document.getElementById('idaImagen').value;
	xajax_processvwFotos(m,u,a);
}

function outcomentarioimg(m,u){
	document.getElementById('vercomentario').innerHTML = "Comentario de Imagen:";
}


function cargarcomentarioimggrupo(m,u){
	var f = document.getElementById('id'+m).value;
	xajax_cargarcomentarioimggrupo(f,m,u);
}

function cargarcomentarioimg(m,u){
	var f = document.getElementById('id'+m).value;
	xajax_cargarcomentarioimg(f,m,u);
}

function vwComentario(m){
	document.getElementById('idcom'+m).style.display = "block";
	if (m != "SelectForo"){
	  document.getElementById('id'+m).focus();
	}else{
		var va = document.getElementById('idforo_tipot').value;
		var tm = document.getElementById('idforo_temas').value;
		if( va != ""){
			xajax_processModeradorAct('foro_temas',tm,'movido',va);
			//document.getElementById('msnprueba').innerHTML = tm;
		}
	}
}

function getElement() {
		var d2 = document.getElementById('einmput');
	    var num = d2.childNodes.length;
		for (i=1;i< num;i++){
			d2.removeChild(d2.childNodes[i]);
  		}
		document.getElementById('hc-window').innerHTML = num;
}


function getObject(obj) {
  var theObj;
  if(document.all) {
    if(typeof obj=="string") {
      return document.all(obj);
    } else {
      return obj.style;
    }
  }
  if(document.getElementById) {
    if(typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}

//Contador de caracteres.
function Contar(entrada,salida,texto,caracteres) {  
 var entradaObj=getObject(entrada);  
 var salidaObj=getObject(salida);  
 var longitud=caracteres - entradaObj.value.length;  
 if(longitud <= 0) {  
   longitud=0;  
   texto='<b><font color="#008000">Ya puedes enviar el mensaje!</font></b>';  
   salidaObj.innerHTML = texto;  
 }  
 else {  
 salidaObj.innerHTML = texto.replace("{CHAR}",longitud);  
 }  
} 


function validarForm(r) {
	if (r=="adicionar"){
		var f = "idformadicionar";
	}else{
	    var f = "idform";
	}
	var num = document.getElementById(f).elements.length;
	var bot = document.getElementById('submitButton').value;
	var msn = "";
	
    xajax.$('submitButton').disabled=true;
    xajax.$('submitButton').value="por favor espere...";
	
	for (var a = 0; a < num;a++){
	  var nmt = document.getElementById(f).elements[a].name;	
	   if (document.getElementById('ast_'+nmt)){
	    var djb = document.getElementById('ast_'+nmt).innerHTML;
	  }else{
		var djb = ""; 
	  }
	  
	  if (djb=="*"){
		 var vlt = document.getElementById('id'+nmt).value; 
		 if (nmt=="email"){
			 vlt = document.getElementById('id'+nmt).value; 
		 }
		 if (nmt=="fechacumple"){
			 vlt = document.getElementById('id'+nmt).value; 
			 crt = vlt.length;
			 if (crt < 10){
				 vlt= "";
			 }
		 }
		 
		 if (vlt==""){
			 if ((r=="publicar_empleo")||(r=="editar_empleo")){
				 
			    var msn = "<font color=#FF9900>* Datos Requeridos</font>";
				document.getElementById('cl_'+nmt).style.color = "#FF9900";
			 }else{
				
				if (r != "login"){
			      var msn = "<font color=#FF9900>* Datos Requeridos</font>";
				}else{
					  var msn = "<font color=#FF9900>* Error...</font>";
				}
			   document.getElementById('cl_'+nmt).style.color = "#FF9900";
			   
			 }
			 
		 }else{
			 
				if (((r=="publicar_empleo")||(r=="editar_empleo")) && (nmt == "titulo")){
			      document.getElementById('cl_'+nmt).style.color = "#FFFFFF";
			   }else{
				 
				     document.getElementById('cl_'+nmt).style.color = "#E9E6E1"; 
				
			   }			 
		 }
	  }
	}
	
	if (!msn){
		var msn = "";
		if (r=="registro"){
		  xajax_processregistro(xajax.getFormValues(f));
		}
		if (r=="login"){
		  xajax_processLogin(xajax.getFormValues(f));
		}
		if (r=="basico"){
		  xajax_processUpdatePerfil(xajax.getFormValues(f));
		}
		if (r=="password"){
		  xajax_processEnviarPassword(xajax.getFormValues(f));
		}
		if (r=="cambiar"){
			if (document.getElementById('idpassword').value != document.getElementById('idpassword2').value){
				var msn = "<font color=#FF0000>* Estos datos deben ser iguales</font>";
			    document.getElementById('cl_password').style.color = "#FF0000";
				document.getElementById('cl_password2').style.color = "#FF0000"
				xajax.$('submitButton').disabled=false;
        		xajax.$('submitButton').value=bms;
				
			}else{
		     xajax_processCambiarPassword(xajax.getFormValues(f));
			}
		}
		if (r=="comment"){
		  xajax_processGuardarComentario(xajax.getFormValues(f));
		}
		
		if (r=="enviarmensaje"){
		  xajax_processEnviarEmial(xajax.getFormValues(f));
		}

		if (r == "adicionar"){
			document.getElementById(f).action = "index.php";
  			document.getElementById(f).encoding = "multipart/form-data";
  			document.getElementById(f).method = "POST";
			enviar = window.confirm('Se enviarán todos los datos del formulario');
			xajax.$('submitButton').disabled=false;
			(enviar)?formadicionar.submit():'return false';
			
        		xajax.$('submitButton').value=bms;

		}
		
		if (r=="cambiar_password"){
			if (document.getElementById('idnuevo').value != document.getElementById('idnuevo2').value){
				var msn = "<font color=#FF0000>* Estos datos deben ser iguales</font>";
			    document.getElementById('cl_nuevo').style.color = "#FF0000";
				document.getElementById('cl_nuevo2').style.color = "#FF0000"
				xajax.$('submitButton').disabled=false;
        		xajax.$('submitButton').value=bms;
				
			}else{
		     xajax_processCambiarPasswordCliente(xajax.getFormValues(f));
			}
		}
		
		xajax.$('submitButton').disabled=false;
        xajax.$('submitButton').value=bot;
				
	}else{
		xajax.$('submitButton').disabled=false;
        xajax.$('submitButton').value=bot;
	}
	document.getElementById('idmsn').innerHTML = msn;
}

function OcultarCantidades(i,m,n) {
	if (n==1){ 
	   st="block";
	   mm = "<span onclick=\"OcultarCantidades('"+i+"','"+m+"','2')\" onMouseOver=\"this.style.color='#AABBDD'; this.style.cursor='pointer'\" onMouseOut=\"this.style.color='#000000';\">Ocultar Tama&ntilde;os</span>";
	 }
	if (n==2){
		st="none";
		mm = "<span onclick=\"OcultarCantidades('"+i+"','"+m+"','1')\" onMouseOver=\"this.style.color='#AABBDD'; this.style.cursor='pointer'\" onMouseOut=\"this.style.color='#000000';\">Mostrar Tama&ntilde;os</span>";
	}
	
  for (a=1;a<=i;a++){
    var tr = "TR"+a+"-"+m;
	var ct = "idcant"+a+"-"+m;
	var c = Number(document.getElementById(ct).value);
	if (c < 1){
     document.getElementById(tr).style.display = st;
	}
  }
  document.getElementById("mmc"+m).innerHTML = mm;
}

function CalcularPrecio(i,m,n) {
	var p  = "idprecio"+i+"-"+m;
	var tp = "idtprecio"+i+"-"+m;
	var c  = "idcant"+n+"-"+m;
	document.getElementById(tp).value = (document.getElementById(p).value) * (document.getElementById(c).value);
	xajax_processCantidadOrden(m,i,(document.getElementById(c).value),(document.getElementById(p).value));
	
}

function agregarfotos(c) {
	  	var cs = document.getElementById("idform2").elements.length;
		
		if (c){
		  checked = false;
		  boton = true;
		  document.getElementById('selectfoto').innerHTML =  '<input name="agregar" type="button" value="Seleccionar todos"  onClick="agregarfotos(\'\')">';
		}else{
		  checked = true;
		  boton = false;
		  document.getElementById('selectfoto').innerHTML =  '<input name="agregar" type="button" value="Desmarcar todos" onClick="agregarfotos(\'1\')">';
		}
         for (var i = 0; i < cs; i++) {
			 if(document.getElementById("idform2").elements[i].type == "checkbox") 
	          document.getElementById("idform2").elements[i].checked = checked;
         }
		 
		 document.getElementById("btagregar").disabled = boton;
}

function checkboton() {
	  	var cs = document.getElementById("idform2").elements.length;
		var c = 0;
		for (var i = 0; i < cs; i++) {
	       if (document.getElementById("idform2").elements[i].checked==true){
		     boton = false;
			 c = 1; 
		   }
         }
		if (c == 0){
		  boton = true;
		}
		 document.getElementById("btagregar").disabled = boton;
		 
}

function esNum(e) {
var charCode
if (navigator.appName == "Netscape") // Veo si es Netscape o Explorer (mas adelante lo explicamos)
charCode = e.which // leo la tecla que ingreso
else
charCode = e.keyCode // leo la tecla que ingreso
status = charCode
if (charCode > 31 && (charCode < 48 || charCode > 57)) { // Chequeamos que sea un numero comparandolo con los valores ASCII
  alert("Caracter no permitido...")
  return false
}

return true
}

function esNumDe(e) {
var charCode
if (navigator.appName == "Netscape") // Veo si es Netscape o Explorer (mas adelante lo explicamos)
charCode = e.which // leo la tecla que ingreso
else
charCode = e.keyCode // leo la tecla que ingreso
status = charCode
if (charCode > 31 && (charCode < 48 || charCode > 57)) { // Chequeamos que sea un numero comparandolo con los valores ASCII
  if (charCode == 46){
    return true
  }else{
	  alert("Caracter no permitido...")
     return false
  }
}

return true
}

function IsNumeric(valor) 
{ 
var log=valor.length; var sw="S"; 
for (x=0; x<log; x++) 
{ v1=valor.substr(x,1); 
v2 = parseInt(v1); 
//Compruebo si es un valor numérico 
if (isNaN(v2)) { sw= "N";} 
} 
if (sw=="S") {return true;} else {return false; } 
} 

var primerslap=false; 
var segundoslap=false; 
function formateafecha(fecha) 
{ 
var long = fecha.length; 
var dia; 
var mes; 
var ano; 

if ((long>=2) && (primerslap==false)) { dia=fecha.substr(0,2); 
if ((IsNumeric(dia)==true) && (dia<=31) && (dia!="00")) { fecha=fecha.substr(0,2)+"/"+fecha.substr(3,7); primerslap=true; } 
else { fecha=""; primerslap=false;} 
} 
else 
{ dia=fecha.substr(0,1); 
if (IsNumeric(dia)==false) 
{fecha="";} 
if ((long<=2) && (primerslap=true)) {fecha=fecha.substr(0,1); primerslap=false; } 
} 
if ((long>=5) && (segundoslap==false)) 
{ mes=fecha.substr(3,2); 
if ((IsNumeric(mes)==true) &&(mes<=12) && (mes!="00")) { fecha=fecha.substr(0,5)+"/"+fecha.substr(6,4); segundoslap=true; } 
else { fecha=fecha.substr(0,3);; segundoslap=false;} 
} 
else { if ((long<=5) && (segundoslap=true)) { fecha=fecha.substr(0,4); segundoslap=false; } } 
if (long>=7) 
{ ano=fecha.substr(6,4); 
if (IsNumeric(ano)==false) { fecha=fecha.substr(0,6); } 
else { if (long==10){ if ((ano==0) || (ano<1900) || (ano>2100)) { fecha=fecha.substr(0,6); } } } 
} 

if (long>=10) 
{ 
fecha=fecha.substr(0,10); 
dia=fecha.substr(0,2); 
mes=fecha.substr(3,2); 
ano=fecha.substr(6,4); 
// Año no viciesto y es febrero y el dia es mayor a 28 
if ( (ano%4 != 0) && (mes ==02) && (dia > 28) ) { fecha=fecha.substr(0,2)+"/"; } 
} 
return (fecha); 
} 

function checkdisclaimer(){
   var allok=true;
   var radgrp1=document.login.cond1;
   var alertext="";
   if (document.login.email.value.length<1) {alertext=alertext+"- Por favor, escribe tu dirección de correo electrónico \n"; allok= false;}
   if (document.login.pass.value.length<1) {alertext=alertext+"- Por favor, escríbe tu contraseña \n"; allok= false;}
   if (allok==false){alert("Atención: \n"+alertext);}
   return allok;
}


function uno(src,color_entrada) { 
    src.bgColor=color_entrada;src.style.cursor="hand"; 
} 
function dos(src,color_default) { 
    src.bgColor=color_default;src.style.cursor="default"; 
} 
function closetag(d){
  if (document.getElementById){
  obj = document.getElementById(d); 
  djb = document.getElementById('img_'+d); 
  var dimga = "./foro/images/tcat.gif";
  var dimgb = "./foro/images/tcat_closed.gif";
  if (obj.style.display == "none"){ 
     obj.style.display = ""; 
	 djb.src = dimga; 
	 
   }else { 
     obj.style.display = "none"; 
	 djb.src = dimgb; 
  }
 }
}
function closeit(CT){
 if (CT=="AL"){
    
	var IfrRef = document.getElementById('DivShim');
	IfrRef.style.display = "none";
    document.getElementById("IDwesq").style.display="none";
	
 }
 
 if (CT=="IM"){
     document.getElementById("IDwesq").style.display="none";
     //xajax_AgregarLocalidad(xajax.getFormValues("IDFormLocalidad"),CT);   
 }
 
 if (CT=="salir"){
   //xajax_processSalir();
 }
}  