


function FechaEsValida (dia,mes,ano,oblig){
	Error=true;
	if (oblig==true){
		if (dia=="" || mes=="" || ano=="")
			Error=false;
	}
	if ((mes>12) || (dia>31))
			{Error=false;}
	if (((mes==4)||(mes==6)||(mes==9)||(mes==11)) && (dia==31)){
			Error=false;}
	if ((mes==2) && (dia>28)){
			Error=false;}
	resto=ano%4;

	if ((resto==0) && (mes==2) && (dia==29)){
			Error=true;}
	if (ano<1880)
		{Error=false;}
	return Error;
}


function EmailValido(pass){
    if (pass)
    {
       var tevaloresults = true;
       var index = 0;
       var filter=/^.+@.+\..{2,3}$/
       var filter2=/\.\./
       var rejected = false;
       var rejectedDomain=new Array();
       rejectedDomain[index]="";
       if (filter.test(pass))
       {
	    	var tempstring = pass.split("@");
            tempstring = tempstring[1].split(".")
            for ( i = 0; i < rejectedDomain.length; i++)
              if (tempstring[0]==rejectedDomain[i])
                rejected=true
            if (rejected)
            {
              return false
            }
            if ( filter2.test(pass) )
              return false;
       }
       else
         return false;
   }
   else
     return false;
  return true;
}


/*
 *  WRAPPER DEL DIALOG
 *  Recibe :
 *     title : el titulo del Alert
 *     mensaje : texto informativo
 *     options : opciones para inciar el dialog
 *     
 **/
function Alertar(title,mensaje,options){
    $("<div title='"+ title +"'>"+ mensaje +"</div>").dialog({
        modal: true ,
        buttons: { "Ok": function() {$(this).dialog("close");} }
    });
}


function AlertarConEvtCerrar ( title , mensaje , onCloseEvent ){

    $("<div title='"+ title +"'>"+ mensaje +"</div>").dialog({
        modal: true ,
        buttons: { "Ok": function() {$(this).dialog("close");} },
        close : onCloseEvent
    });

}

function IsNumeric(input){
   return (input - 0) == input && input.length > 0;
}

function isInt(x) {
   var y=parseInt(x);
   if (isNaN(y)) return false;
   return x==y && x.toString()==y.toString();
}


function getFlash(id, ancho,alto){
    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width',ancho,'height',alto,'src',id,'quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie',id );
}
function getPopUp(direccion, pantallacompleta, herramientas, direcciones, estado, barramenu, barrascroll, cambiatamano, ancho, alto, izquierda, arriba, sustituir){
     var opciones = "fullscreen=" + pantallacompleta +
                 ",toolbar=" + herramientas +
                 ",location=" + direcciones +
                 ",status=" + estado +
                 ",menubar=" + barramenu +
                 ",scrollbars=" + barrascroll +
                 ",resizable=" + cambiatamano +
                 ",width=" + ancho +
                 ",height=" + alto +
                 ",left=" + izquierda +
                 ",top=" + arriba;
     var ventana = window.open(direccion,"venta",opciones,sustituir);
}

