// ------------------------------------------------------------
// VARIOS JAVASCRIPT UTILES
// Autor: Desarrollos NEA
// Si estas observando estos script quiere decir que quieres obtener
// un poco de codigo de aquí. Adelante...
// ------------------------------------------------------------


//------------------------------------------------------------
//PROTEGER ARCHIVOS 
//------------------------------------------------------------
var TimeID; 
function timer() 
{ window.clipboardData.clearData(); 
timeID = setTimeout("timer()", 100); }



//------------------------------------------------------------
//MENSAJE CON RESPUESTA SI/NO
//------------------------------------------------------------
function MensajePopUp(msg) { //v1.0
  if (confirm(msg))
  	return true;
else
	return false;
  
}






//------------------------------------------------------------------------
//ABRIR VENTANA
//Abre una ventana popup. Con las caracteristicas pasadas como parametro
//y la centra a la pantalla segun sea el navegador (depende como
//se obtiene el tamaño de la pantalla)
//------------------------------------------------------------------------
function AbrirVentana(direccion,nombre,width,height,resize,scroll) {
var dialogWin = new Object();
dialogWin.width = width;
dialogWin.height = height;
now = new Date();
var millis=now.getTime();
var mstr=""+millis;

    //Configurando ventana dependiendo del navegador
    if (navigator.appName == "Netscape") {
	    dialogWin.left = window.screenX + ((window.outerWidth - dialogWin.width) / 2);
	    dialogWin.top = window.screenY + ((window.outerHeight - dialogWin.height) / 2);
	    var atributos = 'screenX=' + dialogWin.left + ',screenY=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
    } else if (document.all) {
	    dialogWin.left = (screen.width - dialogWin.width) / 2;
	    dialogWin.top = (screen.height - dialogWin.height) / 2;
	    var atributos = 'left=' + dialogWin.left + ',top=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
    }
    
    //Abriendo ventana
    win =window.open(direccion,nombre,atributos);
    
    //Focus en la ventana
    win.focus()    

}


// -------------------------------------------------------------------------------------
//ATRAS
// -------------------------------------------------------------------------------------
function Atras() {
	window.history.go(-1);		
}






// -------------------------------------------------------------------------------------
//Efectos sobre grilla/celda
// -------------------------------------------------------------------------------------
function grillaMouseOver(src,classOver) {
	if (!src.contains(event.fromElement)) {
		src.style.cursor = 'default';//'hand';
		src.className = classOver;
		/*src.bgColor = colorOver;*/
	}
}
function grillaMouseOut(src,classIn) {
	if (!src.contains(event.toElement)) {
		src.style.cursor = 'default';
		src.className = classIn;
		/*src.bgColor = colorIn;*/
	}
}


//-------------------------------------------------------------------------------------
//Fuentes/Tipografia: Aumentar Tamano
//-------------------------------------------------------------------------------------
//TAGS
var aTagsFuente = new Array( 'div','td','tr');

//ARREGLO DE TAMANOS
var aTamanosFuente = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var aTamanoInicial = 2;

function TamanoFuente(tag,incremento ) {
	if (!document.getElementById) return
	var d = document,cEl = null,sz = aTamanoInicial,i,j,cTags;
	
	sz += incremento;
	if ( sz < 0 ) sz = 0;
	if ( sz > 6 ) sz = 6;
	aTamanoInicial = sz;
		
	if ( !( cEl = d.getElementById( tag ) ) ) cEl = d.getElementsByTagName( tag )[ 0 ];

	cEl.style.fontSize = aTamanosFuente[ sz ];

	for ( i = 0 ; i < aTagsFuente.length ; i++ ) {
		cTags = cEl.getElementsByTagName( aTagsFuente[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = aTamanosFuente[ sz ];
	}
}





/* jQuery */


  //--------------------------------------------------------------------
  // Articulo: Fuente
//-------------------------------------------------------------------- 
  
$(document).ready(function(){
    // Resetear
    if ($('#articuloBotones') != null) {
      var originalFontSize = $('#articulo').css('font-size');
        $("#articuloBotones .resetearFuente").click(function() {
        $('#articulo').css('font-size', originalFontSize);
      });
      
      // Incrementar tamaño fuente
      $("#articuloBotones .aumentarFuente").click(function() {
        TamanoFuente('articulo',1);
        return false;
      });
      
      // Decrementar tamaño fuente
      $("#articuloBotones .disminuirFuente").click(function() {
        TamanoFuente('articulo',-1);
        return false;
      });
      
      
      // Imprimir
      $("#articuloBotones .imprimir").click(function() {
        window.print();
      });
   }
});




