// Java Document

/*BORRAR*/


	
	/*Numeros*/
	function entero(e){
		 var key //= (window.event) ? event.keyCode : e.which;
        if (window.event)
                key = event.keyCode
        else
                key = e.which
        if ( key > 47 && key < 58 || key == 8 )
                return; // if so, do nothing
        else // otherwise, discard character
                if (window.event) //IE
                     window.event.returnValue = null;               
				else //Firefox
                     e.preventDefault();
	};



//TOOLTIP
function ToolTip( texto ){
  // - - - - - - - - - - - - - - - - - - - - - - - - - 
  this.constructor = function(){
    this.idToolTip = 'jsCapaToolTip';
    
    if ( undefined == this.idCtrlParent ){
      if ( document.body.id )
        this.idCtrlParent = document.body.id;
      else{
        document.body.id = 'bodyForm';
        this.idCtrlParent = document.body.id;
      }
    }
      
    this.ctrlToolTip = ( $(this.idToolTip) ? $(this.idToolTip) : this.crearToolTip());
  },
  
  // - - - - - - - - - - - - - - - - - - - - - - - - - 
  this.crearToolTip = function(){
    c = document.createElement('DIV');
    c.className = 'ToolTip';
    c.id = this.idToolTip;
    c.style.display = 'none';
    c.style.position = 'absolute';
   
    
    $(this.idCtrlParent).appendChild( c );
    
    return c;
  }

  // - - - - - - - - - - - - - - - - - - - - - - - - -   
  this.damePosicionCursor = function( e ){
    //e = e || window.event;
    var cursor = {x:0, y:0};
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX ;
        cursor.y = e.pageY;
    } 
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX + 
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY + 
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
  },
  
  // - - - - - - - - - - - - - - - - - - - - - - - - - 
  this.mostrar = function( e ){
	
    this.posicionar( e );
    this.ctrlToolTip.innerHTML = texto;
    this.ctrlToolTip.style.display = '';
  },
  
  // - - - - - - - - - - - - - - - - - - - - - - - - - 
  this.ocultar = function(){
    this.ctrlToolTip.style.display = 'none';
  },
  
  // - - - - - - - - - - - - - - - - - - - - - - - - -
  this.posicionar = function( e ){
      this.ctrlToolTip.style.left =(this.damePosicionCursor( e ).x)- 33 + 'px';
      this.ctrlToolTip.style.top = (this.damePosicionCursor( e ).y )+ 30 + 'px';
  },
  
  this.constructor();
}

//EMERGENTE
function openForm (titulo,pagina, ancho, alto) {
		var opciones = 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width='+ancho+', height ='+alto+', top=center, left=140';
		window.open(pagina,titulo,opciones);
	}
//Validar
function valiCto(){
	var Cli=$F('nombre');
	if (Cli==''){
		window.alert("Ingrese su Nombre");
		var cli=$('nombre');
		cli.focus();
		return false;
	}else{
		var Ref=$F('coment');
		if(Ref==''){
			window.alert("Ingrese su consulta");
			var ref=$('coment');
			ref.focus();
			return false;
		}else{
			var mail =$F('correo');
			if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail))){
				window.alert("introduzca un mail valido");
				var mail=$('correo');
				mail.focus();
				return false;
			}else{
				return true;
			}
		}
	}
}

function valiCtoRef(){
	var Cli=$F('nombre');
	if (Cli==''){
		window.alert("Ingrese su Nombre");
		var cli=$('nombre');
		cli.focus();
		return false;
	}else{
		var mail =$F('correo');
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail))){
			window.alert("introduzca un mail valido");
			var mail=$('correo');
			mail.focus();
			return false;
		}else{
			return true;	
		}
	}
}

function valiVta(){
	var Cli=$F('nombre');
	if (Cli==''){
		window.alert("Ingrese su Nombre");
		var cli=$('nombre');
		cli.focus();
		return false;
	}else{
		var mail =$F('correo');
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail))){
			window.alert("introduzca un mail valido");
			var mail=$('correo');
			mail.focus();
			return false;
		}else{
			return true;
		}
	}
}

function imprSelec(nombre){
  var ventimp = window.open(nombre, 'popimpr'); 
  


} 