function $(tag)
{
	return document.getElementById(tag);
}
var _q = 'INTRODUCE TU BÚSQUEDA AQUÍ';
$('q').onfocus = function ()
{
	if(this.value == _q)
	{
		this.value = '';
	}
}
$('q').onblur = function ()
{
	if(this.value == '')
	{
		this.value = _q;
	}
}
$('f').onsubmit = function ()
{
	if($('q').value == _q || $('q').value == '')
	{
		return false;
	}
	if($('q').value.replace(/(\s|-)+/g, '').length < 3)
	{
		alert('Introduce un texto más largo.');
		return false;
	}
	var q = $('q').value.replace(/(\s|-)+/g, '-');
	window.location = 'busqueda/'+encodeURIComponent(q)+'.html';
	return false;
}
function url() {
	var id = this.id;
	var url = encodeURIComponent(this.getAttribute('url'));
	this.href =  '/r.php?id='+id+'&url='+url;
	this.onmousedown = null;
	return true;
}
function getlinks(tag) {
	var l = tag.getElementsByTagName('a');
	for (var i = 0, c = l.length; i < c; i++) {
		if (!l[i].getAttribute('link')) {
			continue;
		}
		l[i].onmousedown = url;
	}
}
