onload=function() 
{	
	cLaguntza=document.getElementById("mezuLaguntza");
	cIzena=document.getElementById("laguntzaTitulo");
	cTex=document.getElementById("laguntzaTexto");
	laguntza=new Array();
	laguntza["Erabiltzailea"]="Sartu zure argitaletxeko erabiltzailea";
	laguntza["Pasahitza"]="Sartu zure argitaletxeko pasahitza";



	divTransparente=document.getElementById("transparencia");
	divMensaje=document.getElementById("transparenciaMensaje");
	form=document.getElementById("buletina");
		
	claseNormal="input";
	claseError="inputError";
	
	preCarga("ok.gif", "loading.gif", "error.gif");




	//Lagun bati bidali
 	posicion=0;

          // IE
          if(navigator.userAgent.indexOf("MSIE")>=0) nabegadorea=0;

          // Besteak
          else nabegadorea=1;
}

//Lagun bati bidali- Mugimendua
function evitaEventos(event){ // Funcion que evita que se ejecuten eventos adicionales

	if(nabegadorea==0){

		window.event.cancelBubble=true;

		window.event.returnValue=false;

	}

	if(nabegadorea==1) event.preventDefault();

}

function mugimenduHasiera(event, id){

	mugimendua=document.getElementById(id);

	// Obtengo la posicion del cursor

	if(nabegadorea==0){

		kurtsoreaHasieraX=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;

		kurtsoreaHasieraY=window.event.clientY+document.documentElement.scrollBottom+document.body.scrollBottom;


		document.attachEvent("onmousemove", mugitzen);

		document.attachEvent("onmouseup", mugimenduBukaera);

	}

	if(nabegadorea==1){
	
		kurtsoreaHasieraX=event.clientX+window.scrollX;

		kurtsoreaHasieraY=event.clientY+window.scrollY;

		document.addEventListener("mousemove", mugitzen, true);
	
		document.addEventListener("mouseup", mugimenduBukaera, true);

	}


	hasieraX=parseInt(mugimendua.style.left);

	hasieraY=parseInt(mugimendua.style.bottom);

	// Elementuaren posizioa berritzen da
	mugimendua.style.zIndex=++posicion;

	evitaEventos(event);

}

function mugitzen(event){

	var xAktual, yAktual;

	if(nabegadorea==0){   

		xAktual=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;

		yAktual=window.event.clientY+document.documentElement.scrollBottom+document.body.scrollBottom;

	} 

	if(nabegadorea==1){

		xAktual=event.clientX-window.scrollX;
	
		yAktual=event.clientY+window.scrollY;

	}

	
	mugimendua.style.left=(hasieraX+xAktual-kurtsoreaHasieraX)+"px";

	mugimendua.style.top=(hasieraY+yAktual-kurtsoreaHasieraY)+"px";
	evitaEventos(event);

}

function mugimenduBukaera(event){

	if(nabegadorea==0){   

		document.detachEvent("onmousemove", mugitzen);

		document.detachEvent("onmouseup", mugimenduBukaera);

	}

	if(nabegadorea==1){

		document.removeEventListener("mousemove", mugitzen, true);

		document.removeEventListener("mouseup", mugimenduBukaera, true);

	}

}//Lagun bati bidali-Mugimendua - bukaera



// Mensajes de laguntza del login de argitaletxeak

if(navigator.userAgent.indexOf("MSIE")>=0) nabegadorea=0;
else nabegadorea=1;

function jarriLaguntza(event)
{
	if(nabegadorea==0)
	{
		var corX=window.event.clientX+document.documentElement.scrollLeft;
		var corY=window.event.clientY+document.documentElement.scrollTop;
	}
	else
	{
		var corX=event.clientX+window.scrollX;
		var corY=event.clientY+window.scrollY;
	}
	cLaguntza.style.top=corY+35+"px";
	cLaguntza.style.left=corX-150+"px";
}
function kenduLaguntza()
{
	cLaguntza.style.display="none";
	if(nabegadorea==0) 
	{
		document.detachEvent("onmousemove", jarriLaguntza);
		document.detachEvent("onmouseout", kenduLaguntza);
	}
	else 
	{
		document.removeEventListener("mousemove", jarriLaguntza, true);
		document.removeEventListener("mouseout", kenduLaguntza, true);
	}
}

function ikusiLaguntza(event, campo)
{
	jarriLaguntza(event);
	
	if(nabegadorea==0) 
	{ 
		document.attachEvent("onmousemove", jarriLaguntza); 
		document.attachEvent("onmouseout", kenduLaguntza); 
	}
	else 
	{
		document.addEventListener("mousemove", jarriLaguntza, true);
		document.addEventListener("mouseout", kenduLaguntza, true);
	}
	
	cIzena.innerHTML=campo;
	cTex.innerHTML=laguntza[campo];
	cLaguntza.style.display="block";
}





 
function despliega1(){
  var menu1 = document.getElementById("nuestrosDespliega1");
  var menu = document.getElementById("nuestrosDespliega2");
  
  
    if(menu1.style.display == "none"){
      menu1.style.display = "block";
 
	     menu.style.display = "none";
	  
    }
    else{
      menu1.style.display = "none";
    }
}

function despliega2(){
  var menu = document.getElementById("nuestrosDespliega3");
 var menu1 = document.getElementById("nuestrosDespliega2");
    if(menu.style.display == "none"){
      menu.style.display = "block";
   menu1.style.display = "none";
	  
	  
    }
    else{
      menu.style.display = "none";
    }
}
function despliega3(){
  var menu1 = document.getElementById("nuestrosDespliega2");
  var menu = document.getElementById("nuestrosDespliega3");
  
  
    if(menu1.style.display == "none"){
      menu1.style.display = "block";
 
	     menu.style.display = "none";
	  
    }
    else{
      menu1.style.display = "none";
    }
}


function bidaliProduktuaEmail(idFrm,idObj) {
        var formulario = document.getElementById(idFrm);
        //var opcion = formulario.opcion.value;
	var url_base = encodeURI(formulario.urlbase.value);
        var epostaj = encodeURI(formulario.epostaj.value);
        var epostab = encodeURI(formulario.epostab.value);
        var izenab = encodeURI(formulario.izenab.value);
//	 var izenaj = encodeURI(formulario.izenaj.value);
        var mezua = encodeURI(formulario.mezua.value);
	var produrl = encodeURI(document.location);
       // var url = encodeURI(document.location);
        //var titulo = encodeURI(document.title);
        //var codNoticia = encodeURI(formulario.codNoticia.value);
        var obj = document.getElementById(idObj);
        var peticion = false;
        if (window.XMLHttpRequest) {
            peticion = new XMLHttpRequest();
        } else if (window.ActiveXObject) {
            peticion = new ActiveXObject("Microsoft.XMLHTTP");
        }
	
	url_baseh = url_base + "inc/produktuak/bidali.php";
        peticion.open("POST", url_baseh, true);
        peticion.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
        peticion.onreadystatechange = function () {
            if (peticion.readyState == 1) {
                obj.innerHTML = "<center><img src="+ url_base + "images/loading.gif alt='' /><p>Bidaltzen... Itxaron mesedez.</p></center>";
            }
            else if (peticion.readyState == 4) {
                obj.innerHTML = peticion.responseText;
            }
        }
//         peticion.send("epostab="+epostab+"&epostaj="+epostaj+"&izenab="+izenab+"&izenaj="+izenaj+"&mezua="+mezua+"&url="+url_baseh+"&url_base="+url_base+"&produrl="+produrl);
peticion.send("epostab="+epostab+"&epostaj="+epostaj+"&izenab="+izenab+"&mezua="+mezua+"&url="+url_baseh+"&url_base="+url_base+"&produrl="+produrl);
}

