/*
articlepxfontsize_j16 - Plugin Article PXFont Size for Joomla! 1.6, 1.7
author karmany
copyright (C) 2011 by karmany (http://www.karmany.net)
license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
	
Please retain this copyright notice.
You can use this code if this copyright notice are included
*/

//Los tags que seran modificados:
var tgs = new Array( 'div', 'p', 'tr', 'td', 'table', 'ul', 'ol');
var sz = new Array();
var size_inicial = 9;

function sz_default (por_defecto,contador){
	//Reinicializa la variable sz y guardamos dato
	sz[contador] = por_defecto;
	size_inicial = por_defecto;
}

function modify_size(busca,inc,contador) {
	
	var doc = document,eldoc = null,busca_tgs,i,j;
	
	if (inc == 0)
	{
		sz[contador] = size_inicial;
	}
	else
	{
		sz[contador] += inc;
		if ( sz[contador] < 6 ) sz[contador] = 6;
		if ( sz[contador] > 21 ) sz[contador] = 21;
	}
	busca = busca + contador;
	//Buscamos el div con Id
	if (!(eldoc = doc.getElementById(busca))) return;
	eldoc.style.fontSize = sz[contador]+'px';
	
	for (i=0; i<tgs.length; i++)
	{
		busca_tgs = eldoc.getElementsByTagName( tgs[i] );
		for (j=0; j<busca_tgs.length; j++) busca_tgs[j].style.fontSize = sz[contador]+'px'; 	
	}	
}

