/*------------------------------------------------------------
	Document Text Sizer- Copyright 2003 - Taewook Kang.  All rights reserved.
	Coded by: Taewook Kang (txkang.REMOVETHIS@hotmail.com)
	Web Site: http://txkang.com
	Script featured on Dynamic Drive (http://www.dynamicdrive.com)
	
	Please retain this copyright notice in the script.
	License is granted to user to reuse this code on 
	their own website if, and only if, 
	this entire copyright notice is included.
--------------------------------------------------------------*/
// les damos 30 días de vida a las cookies
var validez = 30;
var caduca = new Date(); 
caduca.setTime(caduca.getTime() + (validez*24*60*60*1000));
ini = 2;
//Specify affected tags. Add or remove from list:
//var tgs = new Array( 'div','td','tr','p','a','span','font','th','li');
var tgs = new Array( '-2','-1','0','1','2');

function cambia_tamano(pos){
	
	//document.styleSheets[1].rules[0].style.fontSize = 20+"pt";
	for(i=0;i<document.styleSheets.length;i++){
		reglas = null;
		var agt=navigator.userAgent.toLowerCase();
		this.ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
		if(this.ie){
			document.styleSheets.item(i).href= document.styleSheets.item(i).href;
		}
		else{
			
		}
		
		if(document.styleSheets.item(i).rules){
			reglas = document.styleSheets.item(i).rules;
		}
		else if(document.styleSheets.item(i).cssRules){
			reglas = document.styleSheets.item(i).cssRules		
		}
		if(reglas!=null){
			for(j=0;j<reglas.length;j++){
				atam = reglas.item(j).style.fontSize;
				if(parseInt(atam)){
					//alert(reglas.item(j).style.fontSize);
					if(atam.indexOf("px")>=0)
					 	reglas.item(j).style.fontSize = (parseFloat(atam)+ parseFloat(tgs[pos]))+"px";
					else if(atam.indexOf("pt")>=0)
					 	reglas.item(j).style.fontSize = (parseFloat(atam)+ parseFloat(tgs[pos]))+"pt";
				 }
			}
		}
	}	
	
	/*if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;
	
	sz += inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > 6 ) sz = 6;
	startSz = sz;
		
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = body.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = inc;
	}*/
}




function fijaTamano(tipo)
{

	var pos=getCookie('tamano');
	if ( pos == null )
		pos=ini;
	if(tipo==1){
		
		pos=(parseInt(pos)+1);
		if ( pos > 4 ){ pos = 4;	}
		else{
			//alert(pos)
			cambia_tamano(pos)
		}
	}
	else{
		
		pos=(parseInt(pos)-1);
		if ( pos < 0 ) {
			pos = 0;
		}else{
			//alert(pos)
			cambia_tamano(pos)
		
		}
	}
	
	

	//alert(inc)
	setCookie ("tamano", pos, caduca);

}

function initamano(){
	var inc=getCookie('tamano');
	//alert(inc)
	if ( inc != null ){
		if(parseInt(inc)!=0)
		 cambia_tamano(inc);
	}
	
}


