/*
_____________
::    botikode    ::
¯¯¯¯¯¯¯¯¯¯¯¯¯
*/
function español() {
	window.location="es/1ioar/zer.htm";
}
function refresh() {
	location.reload();
}
function lehiostatus(zein) {
	window.defaultStatus="IOAR Cerramientos  :: Carpintería Metálica ::";
	if (zein==0) {
		atala="zero";
	} else if (zein==11) {
		atala="empresa/present";
	} else if (zein==12) {
		atala="empresa/localiza";
	} else if (zein==13) {
		atala="empresa/contac";
	} else {
		atala="productes/prod"+zein;
	}
	//eguna();
}
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];
	}
}
/*
____________________
::      FORM       ::
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*/
function validate() {
	x=document.contact;
	at=x.email.value.indexOf("@");
	nombre=x.nombre.value;
	empresa=x.empresa.value;
	consulta=x.consulta.value;
	submitOK="True";
	if (nombre<1) {
		alert("introduzca el nombre");
		submitOK="False";
	}
	if (empresa<1) {
		alert("introduzca la empresa");
		submitOK="False";
	}
	if (consulta<1) {
		alert("introduzca algún comentario");
		submitOK="False";
	}
	if (at==-1) {
		alert("e-mail invalido");
		submitOK="False";
	}
	if (submitOK=="False") return false;
}
/*
____________________
::      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";
}
function tabla (zein){
	document.getElementById("tabla1").style.display="none";
	document.getElementById("tabla2").style.display="none";
	document.getElementById("tabla3").style.display="none";
	if(zein!=0){
		y=document.getElementById("tabla"+zein);
		y.style.display="block";
	}
}

/*
____________________
::            date            ::
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*/

function eguna() {
	var d = new Date()
	var egun=d.getDate()
	if (egun<10) { egun="0"+egun }
	var hila=d.getMonth()+1
	if (hila<10) { hila="0"+hila }
	var urte=d.getFullYear()
	var eguna= d.getFullYear()+ "." +hila+ "." +egun
	document.data.egun.value = eguna
	
	var asteguna=new Array("Igandea","Astelehena","Asteartea","Asteazkena","Osteguna","Ostirala","Larunbata")
	var zegun=asteguna[d.getDay()]
	document.data.astegun.value = zegun
}
function eguna_g() {
	var d = new Date()
	var egun=d.getDate()
	var hila=d.getMonth()+1
	var urte=d.getFullYear()
	var eguna= d.getDate()+ "." +hila+ "." +d.getFullYear()
	document.data.egun.value = eguna
}
function asteguna() {
	var d = new Date()
	var asteguna=new Array("igandea","astelehena","asteartea","asteazkena","osteguna","ostirala","larunbata")
	var zegun=asteguna[d.getDay()]
	document.data.astegun.value = zegun
}
function asteguna_g() {
	var d = new Date()
	var asteguna=new Array("domingo","lunes","martes","miercoles","jueves","viernes","sabado")
	var zegun=asteguna[d.getDay()]
	document.data.astegun.value = zegun
}
var timer = null
function stop()
{
clearTimeout(timer)
}
function start() {
	var time = new Date()
	var hours = time.getHours()
	hours=((hours < 10) ? "0" : "") + hours
	var minutes = time.getMinutes()
	minutes=((minutes < 10) ? "0" : "") + minutes
	var clock = hours + ":" + minutes
	document.data.ordu.value = clock
	timer = setTimeout("start()",60000)
}

/*
_____________
::   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 hartuhizkuntza() {
	if (readCookie('boticookie')){
		hizkuntzaoain=readCookie('boticookie');
		if (hizkuntzaoain == 1) {
			window.location="es/1ioar/zer.htm";
		} else if (hizkuntzaoain == 2) {
			window.location="eu/1ioar/zer.htm";
		}
	}
 }
function hartuhizkunflash() {
	if (readCookie('boticookie')){
		hizkuntzaoain=readCookie('boticookie');
		window.document.moldafla.SetVariable("hizkuntza", hizkuntzaoain);
	}	
 }
function hizkuntzaldaketa(berria) {
	saveCookie('boticookie',berria,666);
	if (berria==1) {
		hk="es";
	} else if (berria==2) {
		hk="eu";
	} else if (berria==3) {
	}
	nora="../"+hk+"/molki"+zeatal+""+subatal+".htm?"+zeatal+":"+subatal;
	window.location.href=nora;
}
 function hasera() {
	if (readCookie('boticookie')){
		deleteCookie('boticookie');
		window.location="../../index.htm";
	}else{
		window.location="../../index.htm";
	}	
 }
 
/*
_____________________
::             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);
}

 
