
/*  VARIABLES  */

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmouseout = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

	//índice
	i=0;
	
	//activar/desactivar menú fish
	fish = 1;
	
	//imagen anterior, la que hay que resetear al hacer click en una bola
	img_ant = 1;
	
	//siguiente página a cargar
	nextp = "";
	
	//estado
	state = "";
	
	//switch iframes
	actual = 0;
	siguie = 0;
	
	//direcciones
	izqui = -1;
	derec = 1;
	
	//velocidad de desplazamiento
	/*
	desp0=60;
	desp1=80;
	desp2=100;
*/	
	desp0=30;
	desp1=30;
	desp2=60;


	//ancho / alto doc
	var ancho = 0;
	var altur = 0;
	var conth = 0; //espacio para el contenido (sin el menu)

	//ancho capas
	var cap1w = 350;
	var cap2w = 260;
	var cap3w = 400;
	var barrw = 0;
	var txikw = 169;
	var opcsw = 600;
	var focow = 332;
	var bar2w = 0;
	var sub2w = 232;
	var log2w = 102;
	
	//altura capas
	var cap1h = 253;
	var cap2h = 34;
	var cap3h = 33;
	var capsh = cap1h + cap2h + cap3h;
	var barrh = 170;
	var txikh = 324;
	var opcih = 100;
	var focoh = 830;
	var bar2h = 100;
	var sub2h = 30;
	var log2h = 60;
	
	//situacion final
	var cap1f = 0;
	var cap2f = 0;
	var cap3f = 0;
	var barrf = 0;
	var bar2f = 0;
	var txikf = 0;
	var focof = 0;
	var bar2f = 0;
	var sub2f = 0;
	var log2f = 0;
	var musif = 0;

	var baryf = 0;
	var fisyf = 0;
	
	//capas
	var capas = new Array (
	"capa1", "capa2", "capa3", "barra",
	"txiki", "opci1", "opci2", "opci3",
	"opci4", "opci5", "opci6"
	)

	//desplazamientos
	var despl = new Array (
	desp0, desp0, desp0, desp0,
	desp0, desp2, desp2, desp2,
	desp2, desp2, desp2
	)	

	//direcciones
	var direc = new Array (
	derec, izqui, derec, izqui,
	derec, izqui, izqui, izqui,
	izqui, izqui, izqui
	)
	
	//posiciones finales x
	var posfx = new Array (
	0, 0, 0, 0, 
	0, 0, 0, 0, 
	0, 0, 0
	)
	
	img1=new Image(180,180);
	img1.src="images/icon1_2.png";
	img2=new Image(180,180);
	img2.src="images/icon2_2.png";
	img3=new Image(180,180);
	img3.src="images/icon3_2.png";
	img4=new Image(180,180);
	img4.src="images/icon4_2.png";
	img5=new Image(180,180);
	img5.src="images/icon5_2.png";
	img6=new Image(180,180);
	img6.src="images/icon6_2.png";	

	imo1=new Image(180,180);
	imo1.src="images/icon1.png";
	imo2=new Image(180,180);
	imo2.src="images/icon2.png";
	imo3=new Image(180,180);
	imo3.src="images/icon3.png";
	imo4=new Image(180,180);
	imo4.src="images/icon4.png";
	imo5=new Image(180,180);
	imo5.src="images/icon5.png";
	imo6=new Image(180,180);
	imo6.src="images/icon6.png";	
/*****************************/

function inicio(){
	setTimeout("inicio2()",2000.0);
}

function inicio2(){
	document.getElementById('music').style.display = "inline";
	document.getElementById('barraprogreso').style.display = "none";
	fish_ok2(); //activa fish
	fish_no2(); //desactiva fish (por cuestiones de funcionamiento interno ésto es necesario)
	fish = 3;
	state = "inicio";
	paramet(); //calcula algunos parámetros iniciales: ancho y alto de la página y altura del contenido
	act_scr(); //agranda la pantalla si la resolución es muy pequeña y activa los scrolls principales de la ventana

	baryf = (altur - barrh); //posicion y final de la barra
	fisyf = (altur - barrh - 180); //posicion y final del fish
	
	actual = 0; //pagina del contenido acutal
	siguie = 0; //página del contenido siguiente
	
	//Empezar la animación
	setTimeout("start_w()",100.0);
}

function paramet(){
	docsize(); //obtenemos altur (alto) y ancho de la pagina
	conth = altur - barrh; //altura de la zona de contenido
	barrw = ancho; //ancho de la barra inferior
}

function docsize(){

	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
		ancho = window.innerWidth
		altur = window.innerHeight
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
		ancho = document.documentElement.clientWidth
		altur = document.documentElement.clientHeight
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
		ancho = document.body.clientWidth
		altur = document.body.clientHeight
	}
}

function act_scr(){
	if (ancho<1000){
		ancho = 1000;
		barrw = ancho;
		document.getElementById("body").style.overflowX = "auto";
	}
	if (altur<550){
		altur = 550;
		conth = altur - barrh;
		document.getElementById("body").style.overflowY = "auto";
	}
}

function start_w(){
	situarx();
	situary();
	mostrar();
	sitfinx();
	i=0;
	movcapa(capas[i],despl[i],direc[i],posfx[i]);
}

function situarx(){
	document.getElementById('capa1').style.marginLeft = -cap1w;
	document.getElementById('capa2').style.marginLeft =  ancho;
	document.getElementById('capa3').style.marginLeft = -cap3w;
	document.getElementById('barra').style.marginLeft =  ancho;
	document.getElementById('barra').style.width      =  ancho;
	document.getElementById('txiki').style.marginLeft = -txikw;
	document.getElementById('fishm').style.marginLeft =  ancho/2;
	document.getElementById('opci1').style.marginLeft =  ancho;
	document.getElementById('opci2').style.marginLeft =  ancho;
	document.getElementById('opci3').style.marginLeft =  ancho;
	document.getElementById('opci4').style.marginLeft =  ancho;
	document.getElementById('opci5').style.marginLeft =  ancho;
	document.getElementById('opci6').style.marginLeft =  ancho;
	document.getElementById('foco1').style.marginLeft =  ancho/2 - 550;
	document.getElementById('foco2').style.marginLeft =  ancho/2 - 550;
	document.getElementById('music').style.marginLeft =  ancho - 150;
	document.getElementById('frame0').style.marginLeft = ancho;
	document.getElementById('frame1').style.marginLeft = ancho;
	document.getElementById('frame2').style.marginLeft = ancho;
	document.getElementById('frame3').style.marginLeft = ancho;
	document.getElementById('frame4').style.marginLeft = ancho;
	document.getElementById('frame5').style.marginLeft = ancho;
}

function situary(){
	document.getElementById('capa1').style.marginTop = (conth - capsh)/2;
	document.getElementById('capa2').style.marginTop = (conth - capsh)/2 + cap1h;
	document.getElementById('capa3').style.marginTop = (conth - capsh)/2 + cap1h + cap2h + 10;
	if ((state=="inicio")||(state=="correct")){
		document.getElementById('txiki').style.marginTop = (altur - txikh - 50);
		document.getElementById('barra').style.marginTop = baryf;
		document.getElementById('fishm').style.marginTop = fisyf;
		document.getElementById('opci1').style.marginTop = (altur - opcih);
		document.getElementById('opci2').style.marginTop = (altur - opcih);
		document.getElementById('opci3').style.marginTop = (altur - opcih);
		document.getElementById('opci4').style.marginTop = (altur - opcih);
		document.getElementById('opci5').style.marginTop = (altur - opcih);
		document.getElementById('opci6').style.marginTop = (altur - opcih);
		document.getElementById('music').style.marginTop = (altur - 50);
	}
	document.getElementById('foco1').style.marginTop = (altur - focoh - 20);
	document.getElementById('foco2').style.marginTop = (altur - focoh - 20);
	document.getElementById('frame0').style.marginTop = barrh-20;
	document.getElementById('frame1').style.marginTop = barrh-20;
	document.getElementById('frame2').style.marginTop = barrh-20;
	document.getElementById('frame3').style.marginTop = barrh-20;
	document.getElementById('frame4').style.marginTop = barrh-20;
	document.getElementById('frame5').style.marginTop = barrh-20;
	document.getElementById('frame0').style.height = altur - barrh + 24 - bar2h;
	document.getElementById('frame1').style.height = altur - barrh + 24 - bar2h;
	document.getElementById('frame2').style.height = altur - barrh + 24 - bar2h;
	document.getElementById('frame3').style.height = altur - barrh + 24 - bar2h;
	document.getElementById('frame4').style.height = altur - barrh + 24 - bar2h;
	document.getElementById('frame5').style.height = altur - barrh + 24 - bar2h;
	document.getElementById('venta0').style.height = altur - barrh + 24 - bar2h;
	document.getElementById('venta1').style.height = altur - barrh + 24 - bar2h;
	document.getElementById('venta2').style.height = altur - barrh + 24 - bar2h;
	document.getElementById('venta3').style.height = altur - barrh + 24 - bar2h;
	document.getElementById('venta4').style.height = altur - barrh + 24 - bar2h;
	document.getElementById('venta5').style.height = altur - barrh + 24 - bar2h;
}

function mostrar(){
	document.getElementById('capa1').style.visibility = "visible";
	document.getElementById('capa2').style.visibility = "visible";
	document.getElementById('capa3').style.visibility = "visible";
	document.getElementById('txiki').style.visibility = "visible";
	document.getElementById('barra').style.visibility = "visible";
	document.getElementById('opci1').style.visibility = "visible";
	document.getElementById('opci2').style.visibility = "visible";
	document.getElementById('opci3').style.visibility = "visible";
	document.getElementById('opci4').style.visibility = "visible";
	document.getElementById('opci5').style.visibility = "visible";
	document.getElementById('opci6').style.visibility = "visible";
	document.getElementById('txiki').style.display = "inline";
	document.getElementById('barra').style.display = "inline";
	document.getElementById('opci1').style.display = "inline";
	document.getElementById('opci2').style.display = "inline";
	document.getElementById('opci3').style.display = "inline";
	document.getElementById('opci4').style.display = "inline";
	document.getElementById('opci5').style.display = "inline";
	document.getElementById('opci6').style.display = "inline";
	document.getElementById('music').style.visibility = "visible";
}

function sitfinx(){
	cap1f = ancho/2-cap1w/2;
	posfx[0] = cap1f;

	cap2f = ancho/2-cap2w/2;
	posfx[1] = cap2f;

	cap3f = ancho/2-cap3w/2;
	posfx[2] = cap3f;

	barrf = 0;
	bar2f = 0;

	txikf = ancho/2-482;
	posfx[4] = txikf;
	
	sub2f = ancho/2 - 500;
	log2f = ancho - 150;
}

function movcapa(pcapa, pdesp, pdire, pposf){
	valor = document.getElementById(pcapa).style.marginLeft;
	numer = parseInt(valor);
	numer = numer + (pdesp * pdire);
	if (numer*pdire < pposf*pdire){
		document.getElementById(pcapa).style.marginLeft = numer;
		setTimeout("movcapa(capas[i],despl[i],direc[i],posfx[i])",1.0);
	}else{
		document.getElementById(pcapa).style.marginLeft = pposf;
		if (i<10){
			i++;
			setTimeout("movcapa(capas[i],despl[i],direc[i],posfx[i])",1.0);
		}else{
			setTimeout("act_fc1()",500.0);
		}
	}
}

function act_fc1(){
	document.getElementById('foco1').style.visibility = "visible";
	document.getElementById('foco1').style.display = "inline";
	setTimeout("act_fc2()",800.0);
}

function act_fc2(){
	document.getElementById('foco2').style.visibility = "visible"
	document.getElementById('foco2').style.display = "inline";
	setTimeout("act_fis()",100.0);
}

function act_fis(){
	//inicialmente aquí se ponían como automáticos los scrolls de las ventantas, pero con Firefox el flash se reiniciaba y se tuvo que quitar
	//Ahora se activan los scrolls si las ventanas son pequeñas o si se reducen una vez ya cargada la página
	fish = 1;
//	setTimeout("fish_ok1()",1.0);
	setTimeout("fish_ok2()",1.0);
	state = "correct";
	top.frames[0].location = "histo.php";
	top.frames[1].location = "escue.php";
	top.frames[2].location = "txiki.php";
	top.frames[3].location = "notic.php";
	top.frames[4].location = "galim.php";
	top.frames[5].location = "conta.php";
}

function fish_ok1(){
	if (state=='correct'){
		cambiarPropiedad('.dock','top','-100');
		cambiarPropiedad('.dock-container2','top','50');
	}
	if (state=='opciones'){
		cambiarPropiedad('.dock','top','-160');
		cambiarPropiedad('.dock-container2','top','-510');
	}
	fish_ok2();	
}

function fish_ok2(){
			$('#dock2').Fisheye(
				{
					maxWidth: 40,
					items: 'a',
					itemsText: 'span',
					container: '.dock-container2',
					itemWidth: 100,
					proximity: 90,
					alignment : 'left',
					valign: 'top',
					halign : 'center'
				}
			)	
}

function fish_no1(){

	if (state=='correct'){
		cambiarPropiedad('.dock','top','250');
		cambiarPropiedad('.dock-container2','top','-560');
	}
	if (state=='opciones'){
		cambiarPropiedad('.dock','top','-160');
		cambiarPropiedad('.dock-container2','top','-510');
	}
	fish_no2();
}

function fish_no2(){
			$('#dock2').Fisheye(
				{
					maxWidth: 240,
					items: 'a',
					itemsText: 'span',
					container: '.dock-container2',
					itemWidth: 100,
					proximity: 0,
					alignment : 'left',
					valign: 'top',
					halign : 'center'
				}
			)
}

//********* EVENTOS *********//
function getMouseXY(e){

  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }
	if (tempX < 0) {tempX = 0};
	if (tempY < 0) {tempY = 0};
	
	if (fish!=3){
/*
		if (state=="correct"){
			if (((tempY==0)||(tempX==0))||((tempY>=149)&&(tempY<=380))){
				fish_no2();
				fish=0;
			}else{
				if (fish==0){
					fish_ok2();
					fish=1;
				}
			}
		}
*/
		if ((state=="opciones")||(state="correct")){
			if (((tempY==0)||(tempX==0))||((tempY>=149)&&(tempY<=380))){
				fish_no2();
				fish=0;
			}else{
				if (fish==0){
					fish_ok2();
					fish=1;
				}
			}
		}
	}

  return true
}

function ajustar(){
	ant_ancho = ancho;
	ant_altur = altur;
	paramet();
	if ((ant_ancho < ancho)||(ant_altur < altur)){ //si se ha hecho más grande la pantalla
		if (ant_ancho < ancho){
			barrw = ancho;
		}else{
			ancho = ant_ancho;
		}
		if (ant_altur < altur){
			conth = altur - barrh;
		}else{
			altur = ant_altur
		}
		baryf = (altur - barrh);
		fisyf = (altur - barrh - 180);
		situary();

		sitfinx();
		document.getElementById('capa1').style.marginLeft = cap1f;
		document.getElementById('capa2').style.marginLeft = cap2f;
		document.getElementById('capa3').style.marginLeft = cap3f;
		document.getElementById('barra').style.marginLeft = barrf;
		document.getElementById('barra').style.width      = ancho;
		document.getElementById('barr2').style.width      = ancho;
		if (state=="opciones"){
			document.getElementById('barr2').style.visibility = "visible";
			document.getElementById('barr2').style.display = "inline";
			document.getElementById('barr2').style.marginLeft = 0;
			document.getElementById('barr2').style.marginTop = altur - bar2h;
			document.getElementById('logo2').style.visibility = "visible";
			document.getElementById('logo2').style.display = "inline";
			document.getElementById('logo2').style.marginLeft = log2f;
			document.getElementById('logo2').style.marginTop = altur - log2h - 6;
		}
		document.getElementById('fishm').style.marginLeft =  ancho/2;
		document.getElementById('foco1').style.marginLeft =  ancho/2 - 550;
		document.getElementById('foco2').style.marginLeft =  ancho/2 - 550;
		document.getElementById('txiki').style.marginLeft =  txikf;
		document.getElementById('music').style.marginLeft =  ancho - 150;
		
		if((altur>=550)&&(ancho>=1000)){
			document.getElementById("body").style.overflow = "hidden";
			document.all.body.style.overflow = "hidden";
		}	
		
	}else{
		document.getElementById("body").style.overflow = "auto";
		ancho = ant_ancho;
		altur = ant_altur;
	}
}

function jump_to(ppage,refer,nueva){
	if((state=="correct")||(state=="opciones")){
		rstimgs(img_ant);
		window.document[refer].src=eval(nueva+".src") 
		nextp = ppage;
		fish_no2();
		fish = 3;
	}
	siguie=cambio();
	img_ant=siguie+1;
	if (state == "correct"){
		final_w();
	}else{
		frameout();
	}
}

//***************************//

function rstimgs(zz){
	window.document["imagen"+zz].src=eval("imo"+zz+".src");
}

function final_w(){
	hid_fc2();
}

function hid_fc2(){
	document.getElementById('foco2').style.visibility = "hidden";
	document.getElementById('foco2').style.display = "none";
	setTimeout("hid_fc1()",800.0);
}

function hid_fc1(){
	document.getElementById('foco1').style.visibility = "hidden";
	document.getElementById('foco1').style.display = "none";
	setTimeout("hid_txi()",800.0);
}

function hid_txi(){
	val_1 = document.getElementById('txiki').style.marginLeft;
	num_1 = parseInt(val_1);
	num_1 = num_1 + (desp2 * -1);
	if (num_1 > -txikw){
		document.getElementById('txiki').style.marginLeft = num_1;
		setTimeout("hid_txi()",1.0);
	}else{
		document.getElementById('txiki').style.visibility = "hidden";
		document.getElementById('txiki').style.display = "none";
		setTimeout("salcap3()",800.0);
	}
}

function salcap3(){
	val_3 = document.getElementById('capa3').style.marginLeft;
	num_3 = parseInt(val_3);
	num_3 = num_3 + (desp2 * -1);
	if (num_3 > -cap3w){
		document.getElementById('capa3').style.marginLeft = num_3;
		setTimeout("salcap3()",1.0);
	}else{
		document.getElementById('capa3').style.visibility = "hidden";
		document.getElementById('capa3').style.display = "none";
		setTimeout("salcap2()",100.0);
	}
}

function salcap2(){
	val_2 = document.getElementById('capa2').style.marginLeft;
	num_2 = parseInt(val_2);
	num_2 = num_2 + (desp2 *  1);
	if (num_2 < ancho){
		document.getElementById('capa2').style.marginLeft = num_2;
		setTimeout("salcap2()",1.0);
	}else{
		document.getElementById('capa2').style.visibility = "hidden";
		document.getElementById('capa2').style.display = "none";
		setTimeout("salcap1()",100.0);
	}
}

function salcap1(){
	val_1 = document.getElementById('capa1').style.marginLeft;
	num_1 = parseInt(val_1);
	num_1 = num_1 + (desp2 * -1);
	if (num_1 > -cap1w){
		document.getElementById('capa1').style.marginLeft = num_1;
		setTimeout("salcap1()",1.0);
	}else{
		document.getElementById('capa1').style.visibility = "hidden";
		document.getElementById('capa1').style.display = "none";
		
		setTimeout("submenu()",800.0);
	}
}

function submenu(){
	val_0 = document.getElementById('barra').style.marginTop;
	num_0 = parseInt(val_0);
	num_0 = num_0 + (desp1 * -1);
	if ((num_0 > 12 + desp1)){
		document.getElementById('barra').style.marginTop = num_0;
		setTimeout("submenu()",1.0);
	}else{
		document.getElementById('barra').style.marginTop = 12;
		baryf = 12;
		setTimeout("subbola()",10.0);
	}
}

function subbola(){
	val_1 = document.getElementById('fishm').style.marginTop;
	num_1 = parseInt(val_1);
	num_1 = num_1 + (desp1 * -1);
	if ((num_1 > -168 + desp1)){
		document.getElementById('fishm').style.marginTop = num_1;
		setTimeout("subbola()",1.0);
	}else{
		document.getElementById('fishm').style.marginTop = -168;
		fisyf = -168;
		setTimeout("submusi()",10.0);
	}
}

function submusi(){
	val_2 = document.getElementById('music').style.marginTop;
	num_2 = parseInt(val_2);
	num_2 = num_2 + (desp1 * -1);
	if ((num_2 > 84 + desp1)){
		document.getElementById('music').style.marginTop = num_2;
		setTimeout("submusi()",1.0);
	}else{
		document.getElementById('music').style.marginTop = 84;
		document.getElementById('barr2').style.visibility = "visible";
		document.getElementById('barr2').style.display = "inline";
		document.getElementById('barr2').style.marginLeft = ancho;
		document.getElementById('barr2').style.marginTop = altur - bar2h;
		setTimeout("menu2_i()",1000.0);
	}
}

function menu2_i(){
	val_0 = document.getElementById('barr2').style.marginLeft;
	num_0 = parseInt(val_0);
	num_0 = num_0 + (desp0 * -1);
	if ((num_0 > 0 + desp0)){
		document.getElementById('barr2').style.marginLeft = num_0;
		setTimeout("menu2_i()",1.0);
	}else{
		document.getElementById('barr2').style.marginLeft = 0;
		document.getElementById('subt2').style.visibility = "visible";
		document.getElementById('subt2').style.display = "inline";
		document.getElementById('subt2').style.marginLeft = -sub2w;
		document.getElementById('subt2').style.marginTop = altur - sub2h - 20;
//		setTimeout("subt2_i()",100.0);
		document.getElementById('logo2').style.visibility = "visible";
		document.getElementById('logo2').style.display = "inline";
		document.getElementById('logo2').style.marginLeft = ancho;
		document.getElementById('logo2').style.marginTop = altur - log2h - 6;
		setTimeout("logo2_i()",100.0);
	}
}

function logo2_i(){
	val_0 = document.getElementById('logo2').style.marginLeft;
	num_0 = parseInt(val_0);
	num_0 = num_0 + (desp0*-1);
	if ((num_0 > log2f + desp0)){
		document.getElementById('logo2').style.marginLeft = num_0;
		setTimeout("logo2_i()",1.0);
	}else{
		document.getElementById('logo2').style.marginLeft = log2f;
		document.getElementById('frame0').style.visibility = "visible";
		document.getElementById('frame1').style.visibility = "visible";
		document.getElementById('frame2').style.visibility = "visible";
		document.getElementById('frame3').style.visibility = "visible";
		document.getElementById('frame4').style.visibility = "visible";
		document.getElementById('frame5').style.visibility = "visible";
		document.getElementById('frame'+siguie).style.marginLeft = ancho;		
		setTimeout("framein()",1.0);
	}
}

function framein(){
	val_0 = document.getElementById('frame'+siguie).style.marginLeft;
	num_0 = parseInt(val_0);
	num_0 = num_0 + (desp0*-1);
	if ((num_0 > desp0)){
		document.getElementById('frame'+siguie).style.marginLeft = num_0;
		setTimeout("framein()",1.0);
	}else{
		document.getElementById('frame'+siguie).style.marginLeft = 0;
		fish = 1;
		fish_ok2();
		state = "opciones";
		auxili = actual;
		actual = siguie;
		siguie = auxili;
	}
}

function frameout(){
	val_0 = document.getElementById('frame'+actual).style.marginLeft;
	num_0 = parseInt(val_0);
	num_0 = num_0 + (desp0*-1);
	if ((num_0 > -ancho)){
		document.getElementById('frame'+actual).style.marginLeft = num_0;
		setTimeout("frameout()",1.0);
	}else{
		document.getElementById('frame'+actual).style.marginLeft = -ancho;
		document.getElementById('frame'+siguie).style.marginLeft = ancho;
		reest(actual);
		setTimeout("framein()",1.0);
	}
}

function cambiarPropiedad(regla,propi,valor) {
  if (document.all)
    miRegla = document.styleSheets[0].rules;
  else
    miRegla = document.styleSheets[0].cssRules;
  for (i=0; reg=miRegla[i]; i++)
    if (reg.selectorText.toLowerCase() == regla.toLowerCase() )
      reg.style[propi]=valor;
}

function buscarPropiedad(selector,propi) {
  if (document.all)
    miRegla = document.styleSheets[0].rules;
  else
    miRegla = document.styleSheets[0].cssRules;
  for (i=0; reg=miRegla[i]; i++)
    if (reg.selectorText.toLowerCase() == selector.toLowerCase() )
      return reg.style[propi];
}

function cambiaStatus(){
	window.status = "TXIKI BASTIDA";
	window.defaultStatus = "TXIKI BASTIDA";
}

function cambio(){
	switch (nextp){
		case "historia":
		return 0;
		break;
		case "esc_de_b":
		return 1;
		break;
		case "txikiysa":
		return 2;
		break;
		case "noticias":
		return 3;
		break;
		case "gal_imag":
		return 4;
		break;
		case "contacta":
		return 5;
		break;
	}
}

function reest(dato){
	dato = dato + '';
	switch (dato){
		case "0":
		top.frames[0].location = "histo.php";
		break;
		case "1":
		top.frames[1].location = "escue.php";
		break;
		case "2":
		top.frames[2].location = "txiki.php";
		break;
		case "3":
		top.frames[3].location = "notic.php";
		break;
		case "4":
		top.frames[4].location = "galim.php";
		break;
		case "5":
		top.frames[5].location = "conta.php";
		break;
	}
}