
/******************************************/
/* Iconos de dimensiones dinámicas        */
/******************************************/
/* Autor: Javier López                    */
/* Para: Netsphere Software               */
/* Fecha: 090108                          */
/* Última Revisión:                       */
/* Contacto: Netsphere.Software@gmail.com */
/******************************************/

var aum_netsphere;
var pos_img_netsphere=0;
var dir_netsphere=0;

var aum_informatica;
var pos_img_informatica=0;
var dir_informatica=0;

var aum_software;
var pos_img_software=0;
var dir_software=0;

var aum_formacion;
var pos_img_formacion=0;
var dir_formacion=0;

var aum_ecotinta;
var pos_img_ecotinta=0;
var dir_ecotinta=0;

var urlImg="./archivos/netsphere/";


var url_fotograma_netsphere=urlImg + "logo_portada_netsphere_";
var url_fotograma_informatica=urlImg + "logo_portada_informatica_";
var url_fotograma_software=urlImg + "logo_portada_software_";
var url_fotograma_formacion=urlImg + "logo_portada_formacion_";
var url_fotograma_ecotinta=urlImg + "logo_portada_ecotinta_";

var netsphere_frames=new Array();
var informatica_frames=new Array();
var software_frames=new Array();
var formacion_frames=new Array();
var ecotinta_frames=new Array();

var i;


for (i=0;i<=10;i++)
{
	netsphere_frames[i]= new Image();
	netsphere_frames[i].src=url_fotograma_netsphere + i + ".png";

	informatica_frames[i]= new Image();
	informatica_frames[i].src=url_fotograma_informatica + i + ".png";

	software_frames[i]= new Image();
	software_frames[i].src=url_fotograma_software + i + ".png";

	formacion_frames[i]= new Image();
	formacion_frames[i].src=url_fotograma_formacion + i + ".png";

	ecotinta_frames[i]= new Image();
	ecotinta_frames[i].src=url_fotograma_ecotinta + i + ".png";
}


function aumenta_netsphere()
{
	var num_fotogramas=10;
	var timer=30;

	var id=document.getElementById("logo_netsphere");

	url_fotograma = netsphere_frames[pos_img_netsphere].src;

	id.src=url_fotograma;

	if(dir_netsphere==0)
	{
		if(pos_img_netsphere>=num_fotogramas)
		{
			clearTimeout(aum_netsphere);
			dir_netsphere=1;
		}
		else
		{
			pos_img_netsphere++;
			aum_netsphere=setTimeout("aumenta_netsphere()", timer);
		}
	}
	else
	{
		if(pos_img_netsphere<=0)
		{
			clearTimeout(aum_netsphere);
			dir_netsphere=0;
		}
		else
		{
			pos_img_netsphere--;
			aum_netsphere=setTimeout("aumenta_netsphere()", timer);
		}
	}
}

function reduce_netsphere()
{
	dir_netsphere=1;
	aumenta_netsphere();
}

function aumenta_informatica()
{
	var num_fotogramas=10;
	var timer=30;

	var id=document.getElementById("logo_informatica");

	url_fotograma = informatica_frames[pos_img_informatica].src;

	id.src=url_fotograma;

	if(dir_informatica==0)
	{
		if(pos_img_informatica>=num_fotogramas)
		{
			clearTimeout(aum_informatica);
			dir_informatica=1;
		}
		else
		{
			pos_img_informatica++;
			aum_informatica=setTimeout("aumenta_informatica()", timer);
		}
	}
	else
	{
		if(pos_img_informatica<=0)
		{
			clearTimeout(aum_informatica);
			dir_informatica=0;
		}
		else
		{
			pos_img_informatica--;
			aum_informatica=setTimeout("aumenta_informatica()", timer);
		}
	}
}

function reduce_informatica()
{
	dir_informatica=1;
	aumenta_informatica();
}

function aumenta_software()
{
	var num_fotogramas=10;
	var timer=30;

	var id=document.getElementById("logo_software");

	url_fotograma = software_frames[pos_img_software].src;
	
	id.src=url_fotograma;

	if(dir_software==0)
	{
		if(pos_img_software>=num_fotogramas)
		{
			clearTimeout(aum_software);
			dir_software=1;
		}
		else
		{
			pos_img_software++;
			aum_software=setTimeout("aumenta_software()", timer);
		}
	}
	else
	{
		if(pos_img_software<=0)
		{
			clearTimeout(aum_software);
			dir_software=0;
		}
		else
		{
			pos_img_software--;
			aum_software=setTimeout("aumenta_software()", timer);
		}
	}
}

function reduce_software()
{
	dir_software=1;
	aumenta_software();
}


function aumenta_formacion()
{
	var num_fotogramas=10;
	var timer=30;

	var id=document.getElementById("logo_formacion");

	url_fotograma = formacion_frames[pos_img_formacion].src;
	
	id.src=url_fotograma;

	if(dir_formacion==0)
	{
		if(pos_img_formacion>=num_fotogramas)
		{
			clearTimeout(aum_formacion);
			dir_formacion=1;
		}
		else
		{
			pos_img_formacion++;
			aum_informatica=setTimeout("aumenta_formacion()", timer);
		}
	}
	else
	{
		if(pos_img_formacion<=0)
		{
			clearTimeout(aum_formacion);
			dir_formacion=0;
		}
		else
		{
			pos_img_formacion--;
			aum_formacion=setTimeout("aumenta_formacion()", timer);
		}
	}
}

function reduce_formacion()
{
	dir_formacion=1;
	aumenta_formacion();
}



function aumenta_ecotinta()
{
	var num_fotogramas=10;
	var timer=30;

	var id=document.getElementById("logo_ecotinta");

	url_fotograma = ecotinta_frames[pos_img_ecotinta].src;
	
	id.src=url_fotograma;

	if(dir_ecotinta==0)
	{
		if(pos_img_ecotinta>=num_fotogramas)
		{
			clearTimeout(aum_ecotinta);
			dir_ecotinta=1;
		}
		else
		{
			pos_img_ecotinta++;
			aum_ecotinta=setTimeout("aumenta_ecotinta()", timer);
		}
	}
	else
	{
		if(pos_img_ecotinta<=0)
		{
			clearTimeout(aum_ecotinta);
			dir_ecotinta=0;
		}
		else
		{
			pos_img_ecotinta--;
			aum_ecotinta=setTimeout("aumenta_ecotinta()", timer);
		}
	}
}

function reduce_ecotinta()
{
	dir_ecotinta=1;
	aumenta_ecotinta();
}

