if (document.images) {
	var activado = new Array();
	var desactivado = new Array();	
	for (i=1;i<=5;i++){
		desactivado['menu_0'+i] = new Image();
		desactivado['menu_0'+i].src = 'imagenes/menu/menu_0'+i+'.gif';
		activado['menu_0'+i] = new Image();
		activado['menu_0'+i].src = 'imagenes/menu/menu_0'+i+'_on.gif';
	}
}

function act(nombreImagen) {
	//alert(activado[nombreImagen].src);
	if (document.images){
		if (nombreImagen!="icono_"+jQuery('#id_trabajo').attr('value')+'-'+jQuery('#id_trabajo').attr('value')){
			document[nombreImagen].src = activado[nombreImagen].src;
		}
	}
}

function desact(nombreImagen) {
	//alert(desactivado[nombreImagen].src);
	if (document.images){
		if (nombreImagen!="icono_"+jQuery('#id_trabajo').attr('value')+'-'+jQuery('#id_trabajo').attr('value')){
			document[nombreImagen].src=desactivado[nombreImagen].src;
		}
	}
}

function inicializar_iconos(numero){
	for (i=1;i<=numero;i++){
		for (j=1;j<=numero;j++) {
			desactivado['icono_'+i+'-'+j] = new Image();
			desactivado['icono_'+i+'-'+j].src = 'imagenes/icono_off.gif';
			activado['icono_'+i+'-'+j] = new Image();
			activado['icono_'+i+'-'+j].src = 'imagenes/icono_on.gif';
		}
	}
}

function mostrar(mapa){
	if (mapa == 'oviedo') {
		jQuery('#div_mapa').html("<iframe width='626' height='372' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='http://maps.google.es/maps?f=q&amp;source=s_q&amp;hl=es&amp;geocode=&amp;q=diseco+oviedo&amp;sll=52.362607,4.898795&amp;sspn=0.001206,0.002757&amp;ie=UTF8&amp;hq=diseco&amp;hnear=Oviedo&amp;ll=43.369244,-5.842752&amp;spn=0.011092,0.022058&amp;t=h&amp;z=14&amp;iwloc=A&amp;cid=12496997352384652236&amp;output=embed'></iframe>");
		jQuery('#enlace_oviedo').html("<strong>Oviedo:</strong>");
		jQuery('#enlace_amsterdam').html("<a href='#' onclick=\"javascript: mostrar('amsterdam'); return false;\"><strong>Amsterdam:</strong></a>");
		jQuery('#trabajo_texto_esp').html("<p>Las oficinas en Oviedo de <strong>Diseco, The 'Diseño' Company</strong> están ubicadas en el centro de la ciudad (calle Rosal).</p><p>Puedes visitarnos de lunes a viernes de 9:30 a 145:00 y de 15:30 a 19:00 horas, llamarnos al número de teléfono +34 985 21 83 83 o escribirnos a <a href='mailto:hola@diseco.es'>hola@diseco.es</a></p>");
		jQuery('#trabajo_texto_ing').html("<p><strong>Diseco, The 'Diseño' Company</strong>, is located in Oviedo, in the downtown (c/ Rosal).</p><p>You are free to visit us from monday to friday (9:30 to 14:00 and 15:30 to 19:00), call us (+34 985 21 83 83) or send an e-mail to <a href='mailto:hola@diseco.es'>hola@diseco.es</a></p>");
	} else {
		jQuery('#div_mapa').html("<iframe width='626' height='372' frameborder='0' scrolling='no' marginheight='0' marginwidth='0' src='http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;view=map&amp;q=Utrechtsestraat+105+1%C2%BA+1017+VK+Amsterdam&amp;sll=52.362598,4.898793&amp;sspn=0.009264,0.01884&amp;g=Utrechtsestraat+105,+1017+Amsterdam,+Noord-Holland,+Holanda&amp;ie=UTF8&amp;hq=&amp;hnear=Utrechtsestraat+105,+1017+Amsterdam,+Noord-Holland,+The+Netherlands&amp;ll=52.370045,4.902992&amp;spn=0.009264,0.01884&amp;t=h&amp;z=14&amp;iwloc=A&amp;output=embed'></iframe>");
		jQuery('#enlace_oviedo').html("<a href='#' onclick=\"javascript: mostrar('oviedo'); return false;\"><strong>Oviedo:</strong></a>");
		jQuery('#enlace_amsterdam').html("<strong>Amsterdam:</strong>");
		jQuery('#trabajo_texto_esp').html("<p>Las oficinas en Amsterdam de <strong>Diseco, The 'Diseño' Company</strong> están ubicadas en el centro de la ciudad.</p><p>Puedes visitarnos de lunes a viernes de 9:30 a 13:00 y de 14:00 a 18:30, llamarnos por teléfono al número +31 0614431393 o enviarnos un correo electrónico a la <a href='mailto:hello@diseco.nl'>hello@diseco.nl</a></p>");
		jQuery('#trabajo_texto_ing').html("<p><strong>Diseco, The 'Diseño' Company</strong> Amsterdam headquaerters are located in the city centre.</p><p>You can visit us from monday to friday 9:30 to 13:00 and 14:00 to 18:30, call us (+31 0614431393) or send us an e-mail to <a href='mailto:hello@diseco.nl'>hello@diseco.nl</a></p>");
	}
}

function cambiar_tab(tab){
	if (tab=="oviedo"){
		jQuery("#tab_amsterdam").fadeOut(300, function(){
			jQuery("#tab_oviedo").fadeIn(300);
		});
	} else {
		jQuery("#tab_oviedo").fadeOut(300, function(){
			jQuery("#tab_amsterdam").fadeIn(300);
		});
	}
}

function cambiar_trabajo(tab){
	trabajo_actual=jQuery('#id_trabajo').attr('value');
	//alert('#icono_'+trabajo_actual+'-'+trabajo_actual);
	jQuery('#icono_'+trabajo_actual+'-'+trabajo_actual).attr('src','imagenes/icono_off.gif');
	jQuery('#icono_'+tab+'-'+tab).attr('src','imagenes/icono_on.gif');
	
	jQuery("#tab_texto_"+trabajo_actual).hide();
	jQuery("#tab_trabajo_foto_"+trabajo_actual).hide();
	jQuery("#tab_texto_"+trabajo_actual).fadeOut(500, function(){
		jQuery("#tab_texto_"+tab).fadeIn(500);
	});
	jQuery("#tab_trabajo_foto_"+trabajo_actual).fadeOut(500, function(){
		jQuery("#tab_trabajo_foto_"+tab).fadeIn(500);
	});
	
	jQuery('#id_trabajo').attr('value',tab);
}

function formulario_esp_toggle(){
	jQuery('#cargando_esp').hide();
	jQuery('#email_valido_esp').hide();
	jQuery('#obligatorio_esp').hide();
	jQuery('#resultado_esp').hide();
	jQuery('#formulario_esp').toggle();
	jQuery('#idioma').attr('value','esp');
}

function formulario_ing_toggle(){
	jQuery('#cargando_ing').hide();
	jQuery('#email_valido_ing').hide();
	jQuery('#obligatorio_ing').hide();
	jQuery('#resultado_ing').hide();
	jQuery('#formulario_ing').toggle();
	jQuery('#idioma').attr('value','ing');
}

function mail(texto){
	var mailres = true;            
	var cadena = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ1234567890@._-";
	var arroba = texto.indexOf("@",0);
	var punto = texto.lastIndexOf(".");
	if ((texto.lastIndexOf("@")) != arroba){
		return false;
	}
	var contador=0;
	while (contador<texto.length){
		if (cadena.indexOf(texto.substr(contador, 1),0) == -1){
			return false;
		} else contador++;
	}
	
	if ((arroba > 1) && (arroba + 1 < punto) && (punto + 1 < (texto.length)) && (mailres == true) && (texto.indexOf("..",0) == -1)){
		mailres = true;
	} else mailres = false;
	
	return mailres;
} 