
function completo(obj,nombre,tipo){ 
	if(tipo=='int'){ 
		if ((obj.value=='')||(isNaN(obj.value))){ 
			return "\n "+nombre; 
			}else{ 
			return ""; 
			}
		}else if(obj.value=='' ){ 
			return "\n "+nombre; 
		}else{ return ""; 
		}
}
	
function emailvalido(obj,nombre) { 
	msg=""; 
	if(obj.value!=""){ 
		var reg = /^[\w-\.\']{2,}\@([\da-zA-Z-]{2,}\.){1,}[\da-zA-Z-]{2,3}$/;
		if (!reg.test(obj.value)) {
			msg= "\n "+ nombre;
		}
	}
	else { 
		msg="\n "+ nombre;
	}	
	return msg;
}

function igualdad(obj,reobj,nombre){
	if(obj.value!=reobj.value){
		return "\n "+nombre;
	}else{
		return ""
	}
}

function chequeado(obj, nombre){ 
	ok = false;
	for(i=0;i<obj.length;i++){ 
		if(obj[i].checked){
			ok = true
		}
	}; 
	if(ok){
		return ""
	}else{
		return "\n "+nombre;
	}
} 
function ch(obj, nombre){ 
	ok = false;
	for(i=0;i<obj.length;i++){ 
		if(obj[i].checked){
			ok = true
		}
	}; 
	if(ok){
		return ""
	}else{
		return nombre;
	}
}

function seleccionado(obj, nombre){ 
	ok = false;
	if(obj.checked){
		ok = true
	}
	if(ok){
		return ""
	}else{
		return "\n "+nombre;
	}
}

function fechapartesvalidas(dia, mes, ano, nombre){
	val=dia.value+'-'+mes.value+'-'+ano.value; 
	dr=/^[ ]*[0]?(\d{1,2})[-\/\\](\d{1,2})[-\/\\](\d{4,})[ ]*$/; 
	mc=val.match(dr);
	if (mc){ 
		var td=new Date(mc[3],parseInt(mc[2])-1,mc[1]);    
		if ( td.getDate()==parseInt(mc[1]) && td.getFullYear()==parseInt(mc[3]) && (td.getMonth()+1)==parseInt(mc[2])) 
		return"";
		} 
	return "\n "+nombre;
}
	
function fechavalida(obj,nombre){
	val= obj.value; 
	dr=/^[ ]*[0]?(\d{1,2})[-\/\\](\d{1,2})[-\/\\](\d{4,})[ ]*$/; 
	mc=val.match(dr);
	if (mc){ 
	var td=new Date(mc[3],parseInt(mc[2])-1,mc[1]); 
	if (td.getDate()==parseInt(mc[1]) && td.getFullYear()==parseInt(mc[3]) && ( td.getMonth()+1)==parseInt(mc[2])) return"";
	} return "\n "+nombre+' es obligatori.'
}
function openVentanaFull (dirRoot, ancho, alto) {
	//correccionAncho = 50;
	//correccionAlto = 70;
	wtop = (screen.height/2) - (alto/2);
	wleft = (screen.width/2) - (ancho/2);
	//ancho += correccionAncho;
	//alto += correccionAlto;
	propiedades = "toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,resizable=no,width="+ancho+",height="+alto+",top="+wtop+",left="+wleft;
window.open(dirRoot,'FullScreen',propiedades);
return;

}

function popUp(url,ancho,alto,id,extras){
	if(navigator.userAgent.indexOf("Mac")>0){ancho=parseInt(ancho)+15;alto=parseInt(alto)+15;}
	var left = (screen.availWidth-ancho)/2;
	var top = (screen.availHeight-alto)/2;
	if(extras!=""){extras=","+extras;};
	var ventana = window.open(url,id,'width='+ancho+',height='+alto+',left='+left+',top='+top+',screenX='+left+',screenY='+top+extras);
	var bloqueado = "AVISO:\n\nPara ver este contenido es necesario que desactive\nel Bloqueo de Ventanas para este Sitio."
	//var bloqueado = "WARNING:\n\nIn order to use this functionality, you need\nto deactivate Popup Blocking for this site."
	if(ventana==null || typeof(ventana.document)=="undefined"){ alert(bloqueado) }else{ return ventana; };
}

function popUpUpload(url,ancho,alto,id,ado,extras){
	if(navigator.userAgent.indexOf("Mac")>0){ancho=parseInt(ancho)+15;alto=parseInt(alto)+15;}
	var left = (screen.availWidth-ancho)/2;
	var top = (screen.availHeight-alto)/2;
	if(extras!=""){extras=","+extras;};
	var ventana = window.open(url+'&ado='+ado,id,'width='+ancho+',height='+alto+',left='+left+',top='+top+',screenX='+left+',screenY='+top+extras);
	var bloqueado = "AVISO:\n\nPara ver este contenido es necesario que desactive\nel Bloqueo de Ventanas para este Sitio."
	//var bloqueado = "WARNING:\n\nIn order to use this functionality, you need\nto deactivate Popup Blocking for this site."
	if(ventana==null || typeof(ventana.document)=="undefined"){ alert(bloqueado) }else{ return ventana; };
}

