// JavaScript Document

//Agregar a favoritos
	function agregar()
	{
	if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
	var url="http://www.lareira.net/cast";
	var titulo="lareira.net";
	window.external.AddFavorite(url,titulo);
	}
	else {
	if(navigator.appName == "Netscape") 
	alert ("Presione Crtl+D para agregar este sitio en sus Favoritos");
	}
	}

//Fecha
function fecha() {
	var mydate=new Date();
	var year=mydate.getYear();
	if (year < 1000) {
		year+=1900; }
	var day=mydate.getDay();
	var month=mydate.getMonth();
	var daym=mydate.getDate();
	if (daym<10){
		daym="0"+daym; }

	var dayarray=new Array("Domingo","Luns","Martes","M&eacute;rcores","Xoves","Venres","S&aacute;bado");
	var montharray=new Array("xaneiro","febreiro","marzo","abril","maio","xu&ntilde;o","xullo","agosto","setembro","outubro","novembro","decembro");
	document.write(dayarray[day] + ", " + daym + " de " + montharray[month] + " de " + year);

}


//Cambiar a gallego
function url()
{
var url = window.location.href;
url = unescape(url);
url = url.replace("/ga/", "/cast/");
url = url.replace("/receitas/", "/recetas/");
url = url.replace("/produtos_tipicos/", "/productos_tipicos/");
url = url.replace("/produtos_de_temporada/", "/productos_de_temporada/");
url = url.replace("/festas_gastronomicas/", "/fiestas_gastronomicas/");
url = url.replace("/as_tuas_receitas/", "/tus_recetas/");
url = url.replace("palabra=Ovos", "palabra=Huevos");
url = url.replace("palabra=Peixes", "palabra=Pescados");
url = url.replace("palabra=Vexetais", "palabra=Vegetales");
document.write("<a href="+(url)+" class='autil' title='lareira.net en castellano'><img src='http://www.lareira.net/images/banderaesp.jpg' border='0'> </a>");
}

//Reload
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

// Dynamic Breadcrumbs
// By Harry Love (http://harrylove.org/)
// License: http://creativecommons.org/licenses/by-sa/3.0/
// Updated: June 20, 2007
 
// Link to the script in the head of your page and change the customizations
// below to fit your scenario. That's it. No extra HTML or inline script calls necessary.
// The breadcrumb output is a div with id="breadcrumbs" so you can style it with CSS.
 
function Breadcrumb() {
	//////////////////////
	// Begin customization
	//////////////////////
	this.inicio = "<a href=\"http://www.lareira.net/ga/\">";
	this.homeLinkText = 	'lareira.net'; 	// Text for the home link
	this.separator = 		' » ' ;		// Character(s) to use between breadcrumbs
	this.homeLinkPosition = 1;			// Where is home? 0 = domain, 1 = 1st directory, and so on ...
	this.attachTo = 		'#migas';	// Attach breadcrumb to a tag or an ID: e.g., body, h1, div, #header, #breadcrumb
	this.replaceTheseCharacters = [["_", " "], [" » ", " » "]]; // Replace underscores with spaces
	//this.titulo = document.getElementById("titulo").innerHTML
	////////////////////
	// End customization
	////////////////////
 
	var inicio = this.inicio;
	var homeText = this.homeLinkText;
	var sep = this.separator;
	var position = this.homeLinkPosition;
	var tag = this.attachTo;
	var replacements = this.replaceTheseCharacters;
	var d = document;
	var url = d.location.href.split('//')[1];
	var text = url;
	url = url.split('/');
	if(url[url.length-1] === '') {url.pop();}
	url.pop();
	var title = d.title;
	var rex;
	for (var i=0; i < replacements.length; i++) {
		rex = new RegExp(replacements[i][0], "g");
		text = text.replace(rex,replacements[i][1]);
		title = title.replace(rex,replacements[i][1]);
	}
	text = text.split('/');
 
	function createBreadcrumbs() {
		var href = '', a, div = d.createElement('div');
		div.setAttribute('id', 'breadcrumbs');
		div.innerHTML = inicio;
		for (var i = 0; i < url.length; i++) {
			href += url[i] + '/';
			if (i < position) {continue;}
			if (i === position) {text[i] = homeText;}
			text[i] = text[i].charAt(0).toUpperCase() + text[i].substr(1);
			a = d.createElement('a');
			a.setAttribute('href', 'http://' + href);
			a.appendChild(d.createTextNode(text[i]));
			div.appendChild(a);
			div.appendChild(d.createTextNode(sep));
		}
		div.appendChild(d.createTextNode(title));
		return div;
	}
 

	function writeHTML() {
		tag = tag.match('#') ? d.getElementById(tag.substring(1)) : d.getElementsByTagName(tag)[0];
		if (tag) {
			tag.appendChild(createBreadcrumbs());
		}
	}
	this.output = writeHTML;
}
 
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload !== 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		};
	}
}
 
addLoadEvent(function() {
	var crumb = new Breadcrumb();
	crumb.output();					  
});


//Año del Copyright

function ano() {
	var mydate=new Date();
	var year=mydate.getYear();
	if (year < 1000) {
		year+=1900; }
	document.write(year);

}


//Borrar value del formulario//
function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}

