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

function refresh() {
	location.reload();
}
function lehiostatus() {
	window.defaultStatus="tel: 943 64 63 09 - fax: 943 64 09 60";
}

/*
____________________
::      edukiarentzat       ::
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/

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

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";
}

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

function pop(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('laiakie',zein,666);
 }
 function hasera() {
	if (readCookie('laiakie')){
		deleteCookie('laiakie');
		window.location="../";
	}else{
		window.location="../";
	}	
 }
function hartuhizkuntza() {
	if (readCookie('laiakie')){
		hizkuntzaoain=readCookie('laiakie');
		if (hizkuntzaoain == 1) {
			window.location="eu/";
		} else if (hizkuntzaoain == 2) {
			window.location="es/";
		} else if (hizkuntzaoain == 3) {
			window.location="en/";
		}
	}
 }
function hizkuntzaldaketa(berria) {
	saveCookie('laiakie',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="fr";
	}
	nora="../"+hk+"/"+sPage;
	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)
}
