/*
_____________
::    botikode    ::
ŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/

function refresh() {
	location.reload();
}
function lehiostatus(zein) {
	//eguna();
	if (zein==0) {
		atala="zero";
	} else if (zein==1) {
		atala="bat";
	} else if (zein==2) {
		atala="bit";
	}
	//window.defaultStatus="Asociación de Parkinson de Guipúzcoa.";
}
function defaultstatus(zeinhizkuntz) {
	if (zeinhizkuntz==1) {
		window.defaultStatus="Asociación de Parkinson de Guipúzcoa.";
	} if (zeinhizkuntz==2) {
		window.defaultStatus="Gipuzkoako Parkinson Elkartea.";
	}
}
function htm_ondorengoa() {
	if (window.location.search != 0) {
		var lukas=window.location.search;
		var stat=lukas.split(":");
		zeatal=stat[0].substring(1, stat[0].length);	
		subatal=stat[1];
	}
}

/*------------ aitor -------------*/

function ireki(zein){
	document.getElementById("gurutz1").style.display="none";
	document.getElementById("gurutz2").style.display="none";
	document.getElementById("gurutz3").style.display="none";
	document.getElementById("gurutz4").style.display="none";
	document.getElementById("gurutz5").style.display="none";
	document.getElementById("gurutz6").style.display="none";
	if(zein!=0) {
		y=document.getElementById("gurutz"+zein);
		y.style.display="block";
	}
}
function irekisocios(zein){
	document.getElementById("socios1").style.display="none";
	document.getElementById("socios2").style.display="none";
	if(zein!=0) {
		y=document.getElementById("socios"+zein);
		y.style.display="block";
	}
}

orain=1;
function zoom(zeimg,lang) {
	x=document.getElementById(zeimg);
	orain=orain+1;
	if (lang=='es') {
		if(orain==1){
			x.src="../irudi/zero/koka1a.gif";
		}else if(orain==2){
			x.src="../irudi/zero/koka2a.gif";
		}else if(orain==3){
			x.src="../irudi/zero/koka3.gif";
		orain=0 
		}
	}
	if (lang=='eu') {
		if(orain==1){
			x.src="../irudi/zero/koka1b.gif";
		}else if(orain==2){
			x.src="../irudi/zero/koka2b.gif";
		}else if(orain==3){
			x.src="../irudi/zero/koka3.gif";
		orain=0 
		}
	}
}
function garbitu(){
var user, pass, x, y;
user=document.sarrera.user.value="";
pass=document.sarrera.pass.value="";
x=document.getElementById("bat");
y=document.getElementById("bit");
	x.style.display="block"
	y.style.display="none"
}
function login(){
var egina, user, pass, hizkuntza, x, y;
egina=0;
user=document.sarrera.user.value.toLowerCase();
pass=document.sarrera.pass.value.toLowerCase();
hizkuntza=document.sarrera.lang.value;
x=document.getElementById("bat");
y=document.getElementById("bit");
	if (user=="aspargui" && pass=="tulipan"){
		//window.location="users.htm";
		egina=1;
		x.style.display="none"
		y.style.display="block"
	}
	if (egina==0 && hizkuntza=="eu"){
		alert("Erabiltzailea edo pasahitza ez da zuzena!");
	}else if (egina==0 && hizkuntza=="es"){
		alert("Usuario o contraseña incorrecta!");
	}
}
/*orain=1;
function zoom(zeimg) {
	x=document.getElementById(zeimg);
	orain=orain*(-1);
	if(orain==1){
		x.src="../../irudi/zero/koka1.gif";
	}else if(orain==-1){
		x.src="../../irudi/zero/koka2.gif";
	}
}
____________________
::            form            ::
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/

function validate(lang) {
	x=document.betagarri;
	at=x.email.value.indexOf("@");
	izena=x.nor.value;
	submitOK="True";
	if (lang=='es') {
		if (izena<1) {
			alert("introduzca el nombre");
			submitOK="False";
		}
		if (at==-1) {
			alert("e-mail invalido");
			submitOK="False";
		}
		if (submitOK=="False") return false;
	}
	if (lang=='eu') {
		if (izena<1) {
			alert("izena sartu ezazu");
			submitOK="False";
		}
		if (at==-1) {
			alert("e-maila ez da zuzena");
			submitOK="False";
		}
		if (submitOK=="False") return false;
	}
}


/*------------ aitor -------------*/



/*
____________________
::      edukiarentzat       ::
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/
function menu(zediv){
	x=document.getElementById('sub'+zediv);
	y=document.getElementById("i"+zediv);
	if(x.style.display != "block"){
		x.style.display="block";
		y.src="../../irudi/i.gezion.gif";
	}else{
		x.style.display="none";
		y.src="../../irudi/i.gezioff.gif";
    }
}
function but_on(ni) {
	document.getElementById(ni).className="buton";
	}
function but_of(ni) {
	document.getElementById(ni).className="but";
	}
function hizkbut_on(ni) {
	document.getElementById(ni).className="hizkbutton";
	}
function hizkbut_of(ni) {
	document.getElementById(ni).className="hizkbutt";
	}

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();
}
function popper(zein) {
	zabalera="619";
	altuera="387";
	if(zein==1) {
		pop('popup.htm?'+zein,'popi','status=yes',zabalera,altuera,'1');
	} else {
		pop('popup.htm?0','popi','status=yes',zabalera,altuera,'1');
   	}
}

/*
_____________________
::          hizkuntzak       ::
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/

function hizkuntzazein(zein) {
	saveCookie('boticookie',zein,666);
 }
 function hasera() {
	if (readCookie('boticookie')){
		deleteCookie('boticookie');
		window.location="../../index.asp";
	}else{
		window.location="../../index.asp";
	}	
 }
function hartuhizkuntza() {
	if (readCookie('boticookie')){
		hizkuntzaoain=readCookie('boticookie');
		if (hizkuntzaoain == 1) {
			window.location="es/index.asp";
		} else if (hizkuntzaoain == 2) {
			window.location="eu/index.asp";
		} 
	}
 }
function hartuhizkunflash() {
	if (readCookie('boticookie')){
		hizkuntzaoain=readCookie('boticookie');
		window.document.moldafla.SetVariable("hizkuntza", hizkuntzaoain);
	}	
 }
function hizkuntzaldaketa(berria) {
	saveCookie('boticookie',berria,666);
	var sPath = window.location.pathname+window.location.search;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	if (berria==1) {
		hk="eu";
	} else if (berria==2) {
		hk="es";
	}
	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)

}/*
_____________________
::             igo.asp          ::
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/
function yuyu(param,name){
	var arr=param.split("\\");
	var name
		document.forms["editnoticia"].argazkia.value=arr[(arr.length-1)];
}
