/*
_____________
::    botikode    ::
ŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/

function refresh() {
	location.reload();
}
function lehiostatus() {
	window.defaultStatus="pelota live";
}
function obretan(hizk) {
	window.defaultStatus="pelota live";
	if (hizk=='eu') {
		alert("Emaitzen bilatzailea hobetzen ari gara, egun gutxi barru martxan egongo da berriro, barkatu eragozpenak.");
		}
	if (hizk=='es') {
		alert("Estamos mejorando el buscador de resultados, estará activo en los próximos días, perdonen las molestias.");
		}
	if (hizk=='fr') {
		alert("We are making changes in the Results finder and it'll be working in a few days, sorry for the inconveniences.");
		}
	if (hizk=='en') {
		alert("We are making changes in the Results finder and it'll be working in a few days, sorry for the inconveniences.");
		}
}
/*
____________________
::      edukiarentzat       ::
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/

window.onload=lehiostatus;

function m_over(ni) { 
	//document.getElementById(ni).style.background="#4D9A4D url('../irudi/live.gif') center position no-repeat fixed"; 
	document.getElementById(ni).className="match liveOver";
}
function m_out(ni) { 
	//document.getElementById(ni).style.background="#6A8C6A url('../irudi/gezi_gora.gif') center right no-repeat"; 
	document.getElementById(ni).className="match playin live";
}

var popa=true;
function nopop() { popa=false; }
function popper(param){
	if (popa) {
		/*if (document.all) {
			window.showModelessDialog("pop.php", "","dialogHeight:200px; dialogWidth:550px");
		} else {
			pop('pop.php', 'emaipop', 'n', '544', '150', '1');
		}*/
		pop('pop.php?add='+param, 'emaipop', 'n', '544', '50', '1', param);
	}
	popa=true;
}

function f_on(ni) { document.getElementById(ni).className="fover"; }
function f_of(ni) { document.getElementById(ni).className="fout"; }
function contact() {
	try{
		document.getElementById('nom').focus();
	}catch(er){
		
	}
}

function edozeinpic(zeatal,subatal){
	x=document.getElementById("pics");
	zein=Math.floor(Math.random()*6)+1;
	x.src="../irudi/pics/bimg"+zeatal+subatal+"."+zein+".jpg";
	y=document.getElementById("pic"+zein);
	y.className="pictxikion";
}

/*
____________________
::         egutegia         ::
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/

function egutegi(zein) {
	try{
		var eguna=document.getElementById(zein).value;
	}catch(ex){
		var eguna='';	
	}
	if (eguna!='') {
		var banaka=eguna.split("-");
		popp('../php/egutegia.php?zelai='+zein+'&eguna='+banaka[2]+'&hila='+banaka[1]+'&urtea='+banaka[0]+'', 'egutegia', 'n', '167', '151', '1');
	} else {
		popp('../php/egutegia.php?zelai='+zein+'&eguna=0&hila=0&urtea=0', 'egutegia', 'n', '165', '151', '1');
	}
}
function itzuli(zer, zein) {
	opener.document.getElementById(zein).value=zer;
	window.close();
}

/*
_____________
::   lehio*pop   ::
ŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/

var wObj={};
function popp(url,name,features, myWidth, myHeight, isCenter,wName) {
	if(window.screen)if(isCenter)if(isCenter=="1") {
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
	}
	if(wName==undefined){wName="flop"} else {wName="flop"+wName;}
	wObj[wName]=window.open(url,wName,features+((features!='')?',':'')+'width='+myWidth+',height=151,location=no,status=no');
	wObj[wName].focus();
}
function pop(url,name,features, myWidth, myHeight, isCenter,wName) {
	if(window.screen)if(isCenter)if(isCenter=="1") {
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
	}
	if(wName==undefined){wName="flop"} else {wName="flop"+wName;}
	wObj[wName]=window.open(url,wName,features+((features!='')?',':'')+'width='+myWidth+',height=55,location=yes,status=no');
	wObj[wName].focus();
}
function pop2(url,name,features, myWidth, myHeight, isCenter) {
    if(window.screen)if(isCenter)if(isCenter=="1") {
        var myLeft = (screen.width-myWidth)/2;
        var myTop = (screen.height-myHeight)/2;
        features+=(features!='')?',':'';
        features+=',left='+myLeft+',top='+myTop;
    }
    flop=window.open(url,name,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
    flop.focus();
}
/*
_____________________
::          hizkuntzak       ::
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/

function hizkuntzazein(zein) {
	saveCookie('pelookie',zein,666);
 }
 function hasera() {
	if (readCookie('pelookie')){
		deleteCookie('pelookie');
		window.location="../index.php";
	}else{
		window.location="../index.php";
	}	
 }
function hartuhizkuntza() {
	if (readCookie('pelookie')){
		hizkuntzaoain=readCookie('pelookie');
		if (hizkuntzaoain == 1) {
			window.location="eu/index.php";
		} else if (hizkuntzaoain == 2) {
			window.location="es/index.php";
		} else if (hizkuntzaoain == 3) {
			window.location="en/index.php";
		} else if (hizkuntzaoain == 4) {
			window.location="fr/index.php";
		}
	}
 }
function hizkuntzaldaketa(berria) {
	saveCookie('pelookie',berria,666);
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if (berria==1) {
		hk="eu";
	} else if (berria==2) {
		hk="es";
	} else if (berria==3) {
		hk="en";
	} else if (berria==4) {
		hk="fr";
	}
	gainerakoa=window.location.search;
	nora="../"+hk+"/"+sPage+""+gainerakoa;
	window.location.href=nora;
}
 
/*
_____________________
::             cookie          ::
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/

function saveCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000))
		var expires = "; expires="+date.toGMTString()
	}
    else expires = ""
    document.cookie = name+"="+value+expires+"; path=/"
}
function readCookie(name) {
	var nameEQ = name + "="
	var ca = document.cookie.split(';')
	for(var i=0;i<ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length)
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length)
	}
	return null
}
function deleteCookie(name) {
    saveCookie(name,"",-1)
}
