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

function refresh() {
	location.reload();
}
function lehiostatus() {
	window.defaultStatus="Jon Cazenave Photography [ tel: 647 707 122 ]";
}
window.onload=lehiostatus;

/*
____________________
::      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(); lehiostatus(); }

function barne(zein,zer) {
	if (document.getElementById(zein).value==zer) {
		document.getElementById(zein).value="";
	}
}
function kanpo(zein,zer) {
	if (document.getElementById(zein).value=="") {
		document.getElementById(zein).value=zer;
	}
}


/*
____________________
::          forms           ::
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*/

function contact() { 
	//document.getElementById('nom').focus(); 
	lehiostatus(); 
}

function jarritext() {
	document.sarbidea.name.value="erabiltzailea";
	document.sarbidea.fake.value="pasahitza";
	document.getElementById("iru").style.display="none";
}
function barne(zein,zer) {
	if (document.getElementById(zein).value==zer) {
		document.getElementById(zein).value="";
	}
}
function kanpo(zein,zer) {
	if (document.getElementById(zein).value=="") {
		document.getElementById(zein).value=zer;
	}
}
function passing(){
	if (document.sarbidea.fake.value=="pasahitza") {
		document.getElementById("bit").style.display="none";
		document.getElementById("iru").style.display="block";
		document.sarbidea.pass.focus();
	}
}
function shot(){
	if (document.sarbidea.pass.value=="") {
		x=document.getElementById("bit").style.display="block";
		y=document.getElementById("iru").style.display="none";
	}
}

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

function egutegi(zein) {
	eguna=document.getElementById(zein).value;
	if (eguna!='fin' && eguna!='inicio') {
		var banaka=eguna.split("-");
		pop('egutegia.php?zelai='+zein+'&eguna='+banaka[2]+'&hila='+banaka[1]+'&urtea='+banaka[0]+'', 'egutegia', 'n', '228', '187', '1');
	} else {
		pop('egutegia.php?zelai='+zein+'&eguna=0&hila=0&urtea=0', 'egutegia', 'n', '228', '187', '1');
	}
}
function bestegutegia(zein, hila) {
	window.document.src="../orokor/egutegia.php?zelai="+zein+"&hila="+hila;
}
function itzuli(zer, zein, end) {
	parentform = opener.document.datak;
	opener.document.getElementById(zein).value=zer;
	if (zein=="new_start") { opener.document.getElementById('new_end').value=end; };
	window.close();
}

/*
_____________
::   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('boticookie',zein,666);
 }
 function hasera() {
	if (readCookie('boticookie')){
		deleteCookie('boticookie');
		window.location="../";
	}else{
		window.location="../";
	}	
 }
function hartuhizkuntza() {
	if (readCookie('boticookie')){
		hizkuntzaoain=readCookie('boticookie');
		if (hizkuntzaoain == 1) {
			window.location="eu/";
		} else if (hizkuntzaoain == 2) {
			window.location="es/";
		} else if (hizkuntzaoain == 3) {
			window.location="en/";
		}
	}
 }
function hizkuntzaldaketa(berria) {
	saveCookie('boticookie',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";
	}
	nora="../"+hk+"/"+sPage;
	window.location.href=nora;
}
function hizkuntzmamu(berria) {
	if (berria==1) {
		document.getElementById('eu').style.display="block";
		document.getElementById('es').style.display="none";
		document.getElementById('en').style.display="none";
	} else if (berria==2) {
		document.getElementById('eu').style.display="none";
		document.getElementById('es').style.display="block";
		document.getElementById('en').style.display="none";
	} else if (berria==3) {
		document.getElementById('eu').style.display="none";
		document.getElementById('es').style.display="none";
		document.getElementById('en').style.display="block";
	}
}

/*
_____________________
::             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)
}
function hizkuntzazein(zein) {
	saveCookie('boticookie',zein,666);
}

 