// JavaScript Document

function trocaIMG(imgName) {
		var novo;
		var imgs = document.getElementsByName(imgName);
		for (var i=0;i<imgs.length;i++) {
			//alert(imgs[i].src.search(/OFF/));
			if (imgs[i].src.search(/OFF/) == -1) novo = "images/"+ imgName +"OFF.png";
			else novo = "images/"+ imgName +"ON.png";
			//alert(novo);
			imgs[i].src = novo;
		}
		
	}
function shrink(Tot)
    {
		for (var i=1;i<=Tot;i++){
			var idSpan = "dynamicSpan"+i;
			var idDiv = "dynamicDiv"+i;
			//alert("foi");
			
			var textSpan = document.getElementById(idSpan);
			var textDiv = document.getElementById(idDiv);
			//document.getElementById("dynamicSpan1").style.fontSize = 16;
			//alert(document.getElementById("dynamicSpan1").style.fontSize);
			//alert(textSpan.offsetHeight);
			if (textDiv.offsetHeight > 10) {
				if (textSpan.offsetHeight > textDiv.offsetHeight )
				{
					
					while(textSpan.offsetHeight > textDiv.offsetHeight )
					{
							//alert("textSpan.offsetHeight = " + textSpan.offsetHeight + "/n textDiv.offsetHeight = "+ textDiv.offsetHeight +"/n fonte atual é " + textSpan.style.fontSize);
							
							atual = parseInt(textSpan.style.fontSize)
							
							atual = atual - 1;
							//textSpan.style.fontSize = parseInt(textSpan.fontSize) - 1;
							
							//alert(atual);
							
							textSpan.style.fontSize = atual + "px"; 
					}
				}
				else
				{	
					while(textSpan.offsetHeight < textDiv.offsetHeight )
					{
							//alert("textSpan.offsetHeight = " + textSpan.offsetHeight + "/n textDiv.offsetHeight = "+ textDiv.offsetHeight +"/n fonte atual é " + textSpan.style.fontSize);
							
							atual = parseInt(textSpan.style.fontSize)
							
							atual = atual + 1;
							//textSpan.style.fontSize = parseInt(textSpan.fontSize) - 1;
							
							//alert(atual);
							
							textSpan.style.fontSize = atual + "px"; 
					}
				}
				//if(i==1){alert(textSpan.style.fontSize);};
			}
		}
		
    }
