////////////// EVENTOS //////////////
/////////////////////////////////////
document.onmouseover = handleOver;
document.onmouseout  = handleOut;

function handleOver() {
	el = window.event.srcElement;
	if (el.tagName == "IMG") {
		el.style.height = 42;
		el.style.marginBottom =- 7;
	}  
}

function handleOut() {
	el = window.event.srcElement;
	if (el.tagName == "IMG") {
		el.style.height = 58;
		el.style.marginBottom =- 11;
		el.onmouseover = '';
	}
}

function refreshwin(prevId){
	location.href = "top.asp?prev="+prevId;
}

////////////// LEGIBILIZADOR //////////////
///////////////////////////////////////////

var count2 = 0;
var timeout2;

function fix(){
	target = document;
    target.body.background="white";
/*	top.logoFrame.document.body.background="white";
	top.logoFrame.document.images[0].src = 'accesible_es/logo_low.gif'*/
	running = false;
	imagenes = target.images;
	smallize();	
}


function smallize(){ //repeated on helper.js... check
	try{
		imagenes[count2].style.height=32;
		imagenes[count2].style.marginBottom=0;
	} catch(e){
		return true;
	}
	count2 += 1;
	if (count2 == imagenes.length){
		clearTimeout(timeout2); 
		count2=0; 
	}
	timeout2 = setTimeout("smallize();", 0);
}


////////////// EFECTOS //////////////
/////////////////////////////////////

// defino efectos varios

efectos = new Array();
efectos[0] = "60";  // que hacemos con este random , lo dejamos???
efectos[1] = "70";
efectos[2] = "80";

var count = 0;
var timeout;
running = true;

function flipMagic() { //repeated on helper.js... check
	target = document;
	imagenes = target.images;
	imagenx = Math.round(Math.random()*(imagenes.length-1));
	efectox = efectos[Math.round((Math.random()*(efectos.length-1)))];
	if (running){
		try{
			imagenes[imagenx].style.height=efectox;
			switch (efectox){
			   case (efectos[0]): imagenes[imagenx].style.marginBottom = -3;
				   break;
			   case (efectos[1]): imagenes[imagenx].style.marginBottom = -7;
				   break;
			   case (efectos[2]): imagenes[imagenx].style.marginBottom = -11;
				   break;
			}
			} catch(e){
				return true;
			}
		count += 1;
		if (count == imagenes.length){
			clearTimeout(timeout); 
			count=0; 
			flipMagic();
		}
		timeout = setTimeout("flipMagic();", 1);
	}
} // end flip


