function abrirVentana(url,nombre,ancho,alto){window.open(url,nombre, "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,width=" + ancho + "px,height=" + alto + "px");}
var startList=function(){
if(document.all&&document.getElementById){
navRoot=document.getElementById("menuul");
if(navRoot!=null){
for(i=0;i<navRoot.childNodes.length;i++){
node=navRoot.childNodes[i];
if(node.nodeName=="LI"){
node.onmouseover=function(){
this.className+=" over";
};
node.onmouseout=function(){
this.className=this.className.replace(" over","");
};
}
}
}
navRoot=document.getElementById("lista");
if(navRoot!=null){
for(i=0;i<navRoot.childNodes.length;i++){
node=navRoot.childNodes[i];
if(node.nodeName=="LI"){
node.onmouseover=function(){
this.className+=" over";
};
node.onmouseout=function(){
this.className=this.className.replace(" over","");
};
}
}
}
}
};
window.onload=startList;
function abrirMapa(_1){window.open(_1,"TST","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,width=400px,height=432px");}
function abrirCorteAudio(_2){window.open(_2,"CA","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,width=470px,height=170px");}
function abrirCorteVideo(_3){window.open(_3,"TV","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,width=550px,height=380px");}
function abrirCorteVideoInternauta(_4,_5,_6){window.open(_4,"TV","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,width="+_5+"px,height="+_6+"px");}
function aR(_7,_8){
pixel=new Image();
parent.location.href=_7;
pixel.src="http://www.eldia.es/i/t1.gif?"+_8;
}
function installSearch(){
if((typeof window.sidebar=="object")&&(typeof window.sidebar.addSearchEngine=="function")){
window.sidebar.addSearchEngine("http://www.eldia.es/js/busquedas.src","http://www.eldia.es/i/busquedas.gif","eldia.es","Web");
}else{
if(window.external.AddSearchProvider){
window.external.AddSearchProvider("http://www.eldia.es/js/busquedas.xml");
}else{
alert("Lo sentimos. Navegador no soportado");
}
}
}
var bustcachevar=1;
var loadstatustext="<div style='color:#b2b8b9; font-size: 11px;'><img src='http://www.eldia.es/i/cargando.gif' /> cargando ...</div>";
var loadedobjects="";
var defaultcontentarray=new Object();
var bustcacheparameter="";
function ajaxpage(_9,_a,_b){
var _c=false;
if(window.XMLHttpRequest){
_c=new XMLHttpRequest();
}else{
if(window.ActiveXObject){
try{
_c=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
_c=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
}
}
}else{
return false;
}
}
var _d=_b.parentNode.parentNode.getElementsByTagName("li");
for(var i=0;i<_d.length;i++){
_d[i].className="";
}
_b.parentNode.className="selected";
if(_9.indexOf("#default")!=-1){
document.getElementById(_a).innerHTML=defaultcontentarray[_a];
return;
}
document.getElementById(_a).innerHTML=loadstatustext;
_c.onreadystatechange=function(){
loadpage(_c,_a);
};
if(bustcachevar){
bustcacheparameter=(_9.indexOf("?")!=-1)?"&"+new Date().getTime():"?"+new Date().getTime();
}
_c.open("GET",_9+bustcacheparameter,true);
_c.send(null);
}
function loadpage(_f,_10){
if(_f.readyState==4&&(_f.status==200||window.location.href.indexOf("http")==-1)){
document.getElementById(_10).innerHTML=_f.responseText;
}
}
function loadobjs(_11){
if(_11!=null&&_11!=""){
var _12=_11.split(/\s*,\s*/);
for(var i=0;i<_12.length;i++){
var _14=_12[i];
var _15="";
if(loadedobjects.indexOf(_14)==-1){
if(_14.indexOf(".js")!=-1){
_15=document.createElement("script");
_15.setAttribute("type","text/javascript");
_15.setAttribute("src",_14);
}else{
if(_14.indexOf(".css")!=-1){
_15=document.createElement("link");
_15.setAttribute("rel","stylesheet");
_15.setAttribute("type","text/css");
_15.setAttribute("href",_14);
}
}
}
if(_15!=""){
document.getElementsByTagName("head").item(0).appendChild(_15);
loadedobjects+=_14+" ";
}
}
}
}
function expandtab(_16,_17){
var _18=document.getElementById(_16).getElementsByTagName("a")[_17];
if(_18.getAttribute("rel")){
ajaxpage(_18.getAttribute("href"),_18.getAttribute("rel"),_18);
loadobjs(_18.getAttribute("rev"));
}
}
function savedefaultcontent(_19){
if(typeof defaultcontentarray[_19]=="undefined"){
defaultcontentarray[_19]=document.getElementById(_19).innerHTML;
}
}
function startajaxtabs(){
for(var i=0;i<arguments.length;i++){
var _1b=document.getElementById(arguments[i]);
var _1c=_1b.getElementsByTagName("li");
for(var x=0;x<_1c.length;x++){
var _1e=_1c[x].getElementsByTagName("a")[0];
if(_1e.getAttribute("rel")){
var _1f=_1e.getAttribute("href").replace(/^http:\/\/[^\/]+\//i,"http://"+window.location.hostname+"/");
_1e.setAttribute("href",_1f);
savedefaultcontent(_1e.getAttribute("rel"));
_1e.onclick=function(){
ajaxpage(this.getAttribute("href"),this.getAttribute("rel"),this);
loadobjs(this.getAttribute("rev"));
return false;
};
if(_1c[x].className=="selected"){
ajaxpage(_1e.getAttribute("href"),_1e.getAttribute("rel"),_1e);
loadobjs(_1e.getAttribute("rev"));
}
}
}
}
}
function Left(str,n){
if(n<=0){
return "";
}else{
if(n>String(str).length){
return str;
}else{
return String(str).substring(0,n);
}
}
}
function Right(str,n){
if(n<=0){
return "";
}else{
if(n>String(str).length){
return str;
}else{
var _24=String(str).length;
return String(str).substring(_24,_24-n);
}
}
}
function getCookieVal(_25){
var _26=document.cookie.indexOf(";",_25);
if(_26==-1){
_26=document.cookie.length;
}
return unescape(document.cookie.substring(_25,_26));
}
function GetCookie(_27){
var arg=_27+"=";
var _29=arg.length;
var _2a=document.cookie.length;
var i=0;
while(i<_2a){
var j=i+_29;
if(document.cookie.substring(i,j)==arg){
return getCookieVal(j);
}
i=document.cookie.indexOf(" ",i)+1;
if(i==0){
return null;
}
}
return null;
}
function MostrarNombre(){
var _2d;
_2d=GetCookie("ELDIAuser");
var ns6=(document.getElementById&&!document.all)?true:false;
if(ns6){
if(_2d==null){
document.write("<a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>Suscriptores</a>");
}else{
if(unescape(_2d).length<15){
document.write("<span class=us><a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>"+unescape(_2d)+"</a> <a href=http://www.eldia.es/eldia/suscriptores.jsp?accion=salir class=us>(Quitar)</a></span>");
}else{
document.write("<span class=us><a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>"+Left(unescape(_2d),14)+"...</a> <a href=http://www.eldia.es/eldia/suscriptores.jsp?accion=salir class=us>(Quitar)</a></span>");
}
}
}else{
if(navigator.appName=="Netscape"){
if(_2d==null){
document.write("<a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>Suscriptores</a>");
}else{
if(unescape(_2d).length<15){
document.write("<span class=us><a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>"+unescape(_2d)+"</a> <a href=http://www.eldia.es/eldia/suscriptores.jsp?accion=salir class=us>(Quitar)</a></span>");
}else{
document.write("<span class=us><a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>"+Left(unescape(_2d),14)+"...</a> <a href=http://www.eldia.es/eldia/suscriptores.jsp?accion=salir class=us>(Quitar)</a></span>");
}
}
}else{
if(_2d==null){
document.write("<a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>Suscriptores</a>");
}else{
if(unescape(_2d).length<15){
document.write("<span class=us><a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>"+unescape(_2d)+"</a> <a href=http://www.eldia.es/eldia/suscriptores.jsp?accion=salir class=us>(Quitar)</a></span>");
}else{
document.write("<span class=us><a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>"+Left(unescape(_2d),14)+"...</a> <a href=http://www.eldia.es/eldia/suscriptores.jsp?accion=salir class=us>(Quitar)</a></span>");
}
}
return;
}
}
}
function nombreSuscriptor(){
var _2d;
_2d=GetCookie("ELDIAuser");
var ns6=(document.getElementById&&!document.all)?true:false;
if(ns6){
if(_2d==null){
return("<a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>Suscriptores</a>");
}else{
if(unescape(_2d).length<15){
return("<span class=us><a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>"+unescape(_2d)+"</a> <a href=http://www.eldia.es/eldia/suscriptores.jsp?accion=salir class=us>(Quitar)</a></span>");
}else{
return("<span class=us><a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>"+Left(unescape(_2d),14)+"...</a> <a href=http://www.eldia.es/eldia/suscriptores.jsp?accion=salir class=us>(Quitar)</a></span>");
}
}
}else{
if(navigator.appName=="Netscape"){
if(_2d==null){
return("<a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>Suscriptores</a>");
}else{
if(unescape(_2d).length<15){
return("<span class=us><a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>"+unescape(_2d)+"</a> <a href=http://www.eldia.es/eldia/suscriptores.jsp?accion=salir class=us>(Quitar)</a></span>");
}else{
return("<span class=us><a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>"+Left(unescape(_2d),14)+"...</a> <a href=http://www.eldia.es/eldia/suscriptores.jsp?accion=salir class=us>(Quitar)</a></span>");
}
}
}else{
if(_2d==null){
return("<a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>Suscriptores</a>");
}else{
if(unescape(_2d).length<15){
return("<span class=us><a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>"+unescape(_2d)+"</a> <a href=http://www.eldia.es/eldia/suscriptores.jsp?accion=salir class=us>(Quitar)</a></span>");
}else{
return("<span class=us><a href=http://www.eldia.es/eldia/suscriptores.jsp class=us>"+Left(unescape(_2d),14)+"...</a> <a href=http://www.eldia.es/eldia/suscriptores.jsp?accion=salir class=us>(Quitar)</a></span>");
}
}
}
}
}
function tabberObj(_2f){
var arg;
this.div=null;
this.classMain="tabber";
this.classMainLive="tabberlive";
this.classTab="tabbertab";
this.classTabDefault="tabbertabdefault";
this.classNav="tabbernav";
this.classTabHide="tabbertabhide";
this.classNavActive="tabberactive";
this.titleElements=["h2","h3","h4","h5","h6"];
this.titleElementsStripHTML=true;
this.removeTitle=true;
this.addLinkId=false;
this.linkIdFormat="<tabberid>nav<tabnumberone>";
for(arg in _2f){
this[arg]=_2f[arg];
}
this.REclassMain=new RegExp("\\b"+this.classMain+"\\b","gi");
this.REclassMainLive=new RegExp("\\b"+this.classMainLive+"\\b","gi");
this.REclassTab=new RegExp("\\b"+this.classTab+"\\b","gi");
this.REclassTabDefault=new RegExp("\\b"+this.classTabDefault+"\\b","gi");
this.REclassTabHide=new RegExp("\\b"+this.classTabHide+"\\b","gi");
this.tabs=new Array();
if(this.div){
this.init(this.div);
this.div=null;
}
}
tabberObj.prototype.init=function(e){
var _32,i,i2,t,defaultTab=0,DOM_ul,DOM_li,DOM_a,aId,headingElement;
if(!document.getElementsByTagName){
return false;
}
if(e.id){
this.id=e.id;
}
this.tabs.length=0;
_32=e.childNodes;
for(i=0;i<_32.length;i++){
if(_32[i].className&&_32[i].className.match(this.REclassTab)){
t=new Object();
t.div=_32[i];
this.tabs[this.tabs.length]=t;
if(_32[i].className.match(this.REclassTabDefault)){
defaultTab=this.tabs.length-1;
}
}
}
DOM_ul=document.createElement("ul");
DOM_ul.className=this.classNav;
for(i=0;i<this.tabs.length;i++){
t=this.tabs[i];
t.headingText=t.div.title;
if(this.removeTitle){
t.div.title="";
}
if(!t.headingText){
for(i2=0;i2<this.titleElements.length;i2++){
headingElement=t.div.getElementsByTagName(this.titleElements[i2])[0];
if(headingElement){
t.headingText=headingElement.innerHTML;
if(this.titleElementsStripHTML){
t.headingText.replace(/<br>/gi," ");
t.headingText=t.headingText.replace(/<[^>]+>/g,"");
}
break;
}
}
}
if(!t.headingText){
t.headingText=i+1;
}
DOM_li=document.createElement("li");
t.li=DOM_li;
DOM_a=document.createElement("a");
DOM_a.appendChild(document.createTextNode(t.headingText));
DOM_a.href="javascript:void(null);";
DOM_a.title=t.headingText;
DOM_a.onclick=this.navClick;
DOM_a.tabber=this;
DOM_a.tabberIndex=i;
if(this.addLinkId&&this.linkIdFormat){
aId=this.linkIdFormat;
aId=aId.replace(/<tabberid>/gi,this.id);
aId=aId.replace(/<tabnumberzero>/gi,i);
aId=aId.replace(/<tabnumberone>/gi,i+1);
aId=aId.replace(/<tabtitle>/gi,t.headingText.replace(/[^a-zA-Z0-9\-]/gi,""));
DOM_a.id=aId;
}
DOM_li.appendChild(DOM_a);
DOM_ul.appendChild(DOM_li);
}
e.insertBefore(DOM_ul,e.firstChild);
e.className=e.className.replace(this.REclassMain,this.classMainLive);
this.tabShow(defaultTab);
if(typeof this.onLoad=="function"){
this.onLoad({tabber:this});
}
return this;
};
tabberObj.prototype.navClick=function(_33){
var _34,a,self,tabberIndex,onClickArgs;
a=this;
if(!a.tabber){
return false;
}
self=a.tabber;
tabberIndex=a.tabberIndex;
a.blur();
if(typeof self.onClick=="function"){
onClickArgs={"tabber":self,"index":tabberIndex,"event":_33};
if(!_33){
onClickArgs.event=window.event;
}
_34=self.onClick(onClickArgs);
if(_34===false){
return false;
}
}
self.tabShow(tabberIndex);
return false;
};
tabberObj.prototype.tabHideAll=function(){
var i;
for(i=0;i<this.tabs.length;i++){
this.tabHide(i);
}
};
tabberObj.prototype.tabHide=function(_36){
var div;
if(!this.tabs[_36]){
return false;
}
div=this.tabs[_36].div;
if(!div.className.match(this.REclassTabHide)){
div.className+=" "+this.classTabHide;
}
this.navClearActive(_36);
return this;
};
tabberObj.prototype.tabShow=function(_38){
var div;
if(!this.tabs[_38]){
return false;
}
this.tabHideAll();
div=this.tabs[_38].div;
div.className=div.className.replace(this.REclassTabHide,"");
this.navSetActive(_38);
if(typeof this.onTabDisplay=="function"){
this.onTabDisplay({"tabber":this,"index":_38});
}
return this;
};
tabberObj.prototype.navSetActive=function(_3a){
this.tabs[_3a].li.className=this.classNavActive;
return this;
};
tabberObj.prototype.navClearActive=function(_3b){
this.tabs[_3b].li.className="";
return this;
};
function tabberAutomatic(_3c){
var _3d,divs,i;
if(!_3c){
_3c={};
}
_3d=new tabberObj(_3c);
divs=document.getElementsByTagName("div");
for(i=0;i<divs.length;i++){
if(divs[i].className&&divs[i].className.match(_3d.REclassMain)){
_3c.div=divs[i];
divs[i].tabber=new tabberObj(_3c);
}
}
return this;
}
function tabberAutomaticOnLoad(_3e){
var _3f;
if(!_3e){
_3e={};
}
_3f=window.onload;
if(typeof window.onload!="function"){
window.onload=function(){
tabberAutomatic(_3e);
};
}else{
window.onload=function(){
_3f();
tabberAutomatic(_3e);
};
}
}
if(typeof tabberOptions=="undefined"){
tabberAutomaticOnLoad();
}else{
if(!tabberOptions["manualStartup"]){
tabberAutomaticOnLoad(tabberOptions);
}
}
function LoadTV(width, height, divName)
{
    var urlVideo = 'file=rtmp://emiratv.interlake.net/live&id=emira_eldia&start=5&displayheight=138&overstretch=fit&bufferlength=1&type=rtmp&autostart=true&enablejs=false&javascriptid=single&volume=20&smoothing=false&image=http://www.eldia.es/i/tv/logo.gif&link=http://www.eldia.tv/&linkfromdisplay=true';
    var urlPlayer = '/swf/flvplayer.swf';

    var div = document.getElementById(divName);

    var embed = document.createElement('embed');
    embed.setAttribute('width',width);
    embed.setAttribute('height',height);
    embed.setAttribute('flashvars',urlVideo);
    embed.setAttribute('allowfullscreen','false');
    embed.setAttribute('quality','low');
    embed.setAttribute('name','single');
    embed.setAttribute('id','single');
    embed.setAttribute('style','');
    embed.setAttribute('src',urlPlayer);
    embed.setAttribute('type','application/x-shockwave-flash');
    
    
    div.appendChild(embed);
    
}
/*-------- jquery.newsticker.pack.js -----------*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(1($){$.9.D=$.9.g=1(b){b=b||p;i=1(a){j(a);a.4=$("r",a);a.4.q(":o(0)").l().C();a.5=0;h(a)};h=1(a){a.m=t(1(){f(a)},b)};j=1(a){s(a.m)};8=1(a){a.3=7};d=1(a){a.3=c};f=1(a){e(a.3)6;a.3=7;$(a.4[a.5]).n("k",1(){$(2).l();a.5=++a.5%(a.4.B());$(a.4[a.5]).z("k",1(){a.3=c})})};2.y(1(){e(2.x.w()!="A")6;i(2)}).v("g").u(1(){8(2)},1(){d(2)});6 2}})(E);',41,41,'|function|this|pause|items|currentitem|return|true|pauseTicker|fn|||false|resumeTicker|if|doTick|newsticker|startTicker|initTicker|stopTicker|slow|hide|tickfn|fadeOut|eq|4000|not|li|clearInterval|setInterval|hover|addClass|toLowerCase|nodeName|each|fadeIn|ul|size|end|newsTicker|jQuery'.split('|'),0,{}))
/*-------- jquery.autocomplete.js -----------*/
jQuery.autocomplete = function(input, options) {
	// Create a link to self
	var me = this;

	// Create jQuery object for input element
	var $input = $(input).attr("autocomplete", "off");

	// Apply inputClass if necessary
	if (options.inputClass) $input.addClass(options.inputClass);

	// Create results
	var results = document.createElement("div");
	// Create jQuery object for results
	var $results = $(results);
	$results.hide().addClass(options.resultsClass).css("position", "absolute");
	if( options.width > 0 ) $results.css("width", options.width);

	// Add to body element
	$("body").append(results);

	input.autocompleter = me;

	var timeout = null;
	var prev = "";
	var active = -1;
	var cache = {};
	var keyb = false;
	var hasFocus = false;
	var lastKeyPressCode = null;

	// flush cache
	function flushCache(){
		cache = {};
		cache.data = {};
		cache.length = 0;
	};

	// flush cache
	flushCache();

	// if there is a data array supplied
	if( options.data != null ){
		var sFirstChar = "", stMatchSets = {}, row = [];

		// no url was specified, we need to adjust the cache length to make sure it fits the local data store
		if( typeof options.url != "string" ) options.cacheLength = 1;

		// loop through the array and create a lookup structure
		for( var i=0; i < options.data.length; i++ ){
			// if row is a string, make an array otherwise just reference the array
			row = ((typeof options.data[i] == "string") ? [options.data[i]] : options.data[i]);

			// if the length is zero, don't add to list
			if( row[0].length > 0 ){
				// get the first character
				sFirstChar = row[0].substring(0, 1).toLowerCase();
				// if no lookup array for this character exists, look it up now
				if( !stMatchSets[sFirstChar] ) stMatchSets[sFirstChar] = [];
				// if the match is a string
				stMatchSets[sFirstChar].push(row);
			}
		}

		// add the data items to the cache
		for( var k in stMatchSets ){
			// increase the cache size
			options.cacheLength++;
			// add to the cache
			addToCache(k, stMatchSets[k]);
		}
	}

	$input
	.keydown(function(e) {
		// track last key pressed
		lastKeyPressCode = e.keyCode;
		switch(e.keyCode) {
			case 38: // up
				e.preventDefault();
				moveSelect(-1);
				break;
			case 40: // down
				e.preventDefault();
				moveSelect(1);
				break;
			case 9:  // tab
			case 13: // return
				if( selectCurrent() ){
					// make sure to blur off the current field
					$input.get(0).blur();
					e.preventDefault();
				}
				break;
			default:
				active = -1;
				if (timeout) clearTimeout(timeout);
				timeout = setTimeout(function(){onChange();}, options.delay);
				break;
		}
	})
	.focus(function(){
		// track whether the field has focus, we shouldn't process any results if the field no longer has focus
		hasFocus = true;
	})
	.blur(function() {
		// track whether the field has focus
		hasFocus = false;
		hideResults();
	});

	hideResultsNow();

	function onChange() {
		// ignore if the following keys are pressed: [del] [shift] [capslock]
		if( lastKeyPressCode == 46 || (lastKeyPressCode > 8 && lastKeyPressCode < 32) ) return $results.hide();
		var v = $input.val();
		if (v == prev) return;
		prev = v;
		if (v.length >= options.minChars) {
			$input.addClass(options.loadingClass);
			requestData(v);
		} else {
			$input.removeClass(options.loadingClass);
			$results.hide();
		}
	};

 	function moveSelect(step) {

		var lis = $("li", results);
		if (!lis) return;

		active += step;

		if (active < 0) {
			active = 0;
		} else if (active >= lis.size()) {
			active = lis.size() - 1;
		}

		lis.removeClass("ac_over");

		$(lis[active]).addClass("ac_over");

		// Weird behaviour in IE
		// if (lis[active] && lis[active].scrollIntoView) {
		// 	lis[active].scrollIntoView(false);
		// }

	};

	function selectCurrent() {
		var li = $("li.ac_over", results)[0];
		if (!li) {
			var $li = $("li", results);
			if (options.selectOnly) {
				if ($li.length == 1) li = $li[0];
			} else if (options.selectFirst) {
				li = $li[0];
			}
		}
		if (li) {
			selectItem(li);
			return true;
		} else {
			return false;
		}
	};

	function selectItem(li) {
		if (!li) {
			li = document.createElement("li");
			li.extra = [];
			li.selectValue = "";
		}
		var v = $.trim(li.selectValue ? li.selectValue : li.innerHTML);
		input.lastSelected = v;
		prev = v;
		$results.html("");
		$input.val(v);
		hideResultsNow();
		if (options.onItemSelect) setTimeout(function() { options.onItemSelect(li) }, 1);
	};

	// selects a portion of the input string
	function createSelection(start, end){
		// get a reference to the input element
		var field = $input.get(0);
		if( field.createTextRange ){
			var selRange = field.createTextRange();
			selRange.collapse(true);
			selRange.moveStart("character", start);
			selRange.moveEnd("character", end);
			selRange.select();
		} else if( field.setSelectionRange ){
			field.setSelectionRange(start, end);
		} else {
			if( field.selectionStart ){
				field.selectionStart = start;
				field.selectionEnd = end;
			}
		}
		field.focus();
	};

	// fills in the input box w/the first match (assumed to be the best match)
	function autoFill(sValue){
		// if the last user key pressed was backspace, don't autofill
		if( lastKeyPressCode != 8 ){
			// fill in the value (keep the case the user has typed)
			$input.val($input.val() + sValue.substring(prev.length));
			// select the portion of the value not typed by the user (so the next character will erase)
			createSelection(prev.length, sValue.length);
		}
	};

	function showResults() {
		// get the position of the input field right now (in case the DOM is shifted)
		var pos = findPos(input);
		// either use the specified width, or autocalculate based on form element
		var iWidth = (options.width > 0) ? options.width : $input.width();
		// reposition
		$results.css({
			width: parseInt(iWidth) + "px",
			top: (pos.y + input.offsetHeight) + "px",
			left: pos.x + "px"
		}).show();
	};

	function hideResults() {
		if (timeout) clearTimeout(timeout);
		timeout = setTimeout(hideResultsNow, 200);
	};

	function hideResultsNow() {
		if (timeout) clearTimeout(timeout);
		$input.removeClass(options.loadingClass);
		if ($results.is(":visible")) {
			$results.hide();
		}
		if (options.mustMatch) {
			var v = $input.val();
			if (v != input.lastSelected) {
				selectItem(null);
			}
		}
	};

	function receiveData(q, data) {
		if (data) {
			$input.removeClass(options.loadingClass);
			results.innerHTML = "";

			// if the field no longer has focus or if there are no matches, do not display the drop down
			if( !hasFocus || data.length == 0 ) return hideResultsNow();

			if ($.browser.msie) {
				// we put a styled iframe behind the calendar so HTML SELECT elements don't show through
				$results.append(document.createElement('iframe'));
			}
			results.appendChild(dataToDom(data));
			// autofill in the complete box w/the first match as long as the user hasn't entered in more data
			if( options.autoFill && ($input.val().toLowerCase() == q.toLowerCase()) ) autoFill(data[0][0]);
			showResults();
		} else {
			hideResultsNow();
		}
	};

	function parseData(data) {
		if (!data) return null;
		var parsed = [];
		var rows = data.split(options.lineSeparator);
		for (var i=0; i < rows.length; i++) {
			var row = $.trim(rows[i]);
			if (row) {
				parsed[parsed.length] = row.split(options.cellSeparator);
			}
		}
		return parsed;
	};

	function dataToDom(data) {
		var ul = document.createElement("ul");
		var num = data.length;

		// limited results to a max number
		if( (options.maxItemsToShow > 0) && (options.maxItemsToShow < num) ) num = options.maxItemsToShow;

		for (var i=0; i < num; i++) {
			var row = data[i];
			if (!row) continue;
			var li = document.createElement("li");
			if (options.formatItem) {
				li.innerHTML = options.formatItem(row, i, num);
				li.selectValue = row[0];
			} else {
				li.innerHTML = row[0];
				li.selectValue = row[0];
			}
			var extra = null;
			if (row.length > 1) {
				extra = [];
				for (var j=1; j < row.length; j++) {
					extra[extra.length] = row[j];
				}
			}
			li.extra = extra;
			ul.appendChild(li);
			$(li).hover(
				function() { $("li", ul).removeClass("ac_over"); $(this).addClass("ac_over"); active = $("li", ul).indexOf($(this).get(0)); },
				function() { $(this).removeClass("ac_over"); }
			).click(function(e) { e.preventDefault(); e.stopPropagation(); selectItem(this) });
		}
		return ul;
	};

	function requestData(q) {
		if (!options.matchCase) q = q.toLowerCase();
		var data = options.cacheLength ? loadFromCache(q) : null;
		// recieve the cached data
		if (data) {
			receiveData(q, data);
		// if an AJAX url has been supplied, try loading the data now
		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
			$.get(makeUrl(q), function(data) {
				data = parseData(data);
				addToCache(q, data);
				receiveData(q, data);
			});
		// if there's been no data found, remove the loading class
		} else {
			$input.removeClass(options.loadingClass);
		}
	};

	function makeUrl(q) {
		var url = options.url + "?q=" + encodeURI(q);
		for (var i in options.extraParams) {
			url += "&" + i + "=" + encodeURI(options.extraParams[i]);
		}
		return url;
	};

	function loadFromCache(q) {
		if (!q) return null;
		if (cache.data[q]) return cache.data[q];
		if (options.matchSubset) {
			for (var i = q.length - 1; i >= options.minChars; i--) {
				var qs = q.substr(0, i);
				var c = cache.data[qs];
				if (c) {
					var csub = [];
					for (var j = 0; j < c.length; j++) {
						var x = c[j];
						var x0 = x[0];
						if (matchSubset(x0, q)) {
							csub[csub.length] = x;
						}
					}
					return csub;
				}
			}
		}
		return null;
	};

	function matchSubset(s, sub) {
		if (!options.matchCase) s = s.toLowerCase();
		var i = s.indexOf(sub);
		if (i == -1) return false;
		return i == 0 || options.matchContains;
	};

	this.flushCache = function() {
		flushCache();
	};

	this.setExtraParams = function(p) {
		options.extraParams = p;
	};

	this.findValue = function(){
		var q = $input.val();

		if (!options.matchCase) q = q.toLowerCase();
		var data = options.cacheLength ? loadFromCache(q) : null;
		if (data) {
			findValueCallback(q, data);
		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
			$.get(makeUrl(q), function(data) {
				data = parseData(data)
				addToCache(q, data);
				findValueCallback(q, data);
			});
		} else {
			// no matches
			findValueCallback(q, null);
		}
	}

	function findValueCallback(q, data){
		if (data) $input.removeClass(options.loadingClass);

		var num = (data) ? data.length : 0;
		var li = null;

		for (var i=0; i < num; i++) {
			var row = data[i];

			if( row[0].toLowerCase() == q.toLowerCase() ){
				li = document.createElement("li");
				if (options.formatItem) {
					li.innerHTML = options.formatItem(row, i, num);
					li.selectValue = row[0];
				} else {
					li.innerHTML = row[0];
					li.selectValue = row[0];
				}
				var extra = null;
				if( row.length > 1 ){
					extra = [];
					for (var j=1; j < row.length; j++) {
						extra[extra.length] = row[j];
					}
				}
				li.extra = extra;
			}
		}

		if( options.onFindValue ) setTimeout(function() { options.onFindValue(li) }, 1);
	}

	function addToCache(q, data) {
		if (!data || !q || !options.cacheLength) return;
		if (!cache.length || cache.length > options.cacheLength) {
			flushCache();
			cache.length++;
		} else if (!cache[q]) {
			cache.length++;
		}
		cache.data[q] = data;
	};

	function findPos(obj) {
		var curleft = obj.offsetLeft || 0;
		var curtop = obj.offsetTop || 0;
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
		return {x:curleft,y:curtop};
	}
}

jQuery.fn.autocomplete = function(url, options, data) {
	// Make sure options exists
	options = options || {};
	// Set url as option
	options.url = url;
	// set some bulk local data
	options.data = ((typeof data == "object") && (data.constructor == Array)) ? data : null;

	// Set default values for required options
	options.inputClass = options.inputClass || "ac_input";
	options.resultsClass = options.resultsClass || "ac_results";
	options.lineSeparator = options.lineSeparator || "\n";
	options.cellSeparator = options.cellSeparator || "|";
	options.minChars = options.minChars || 1;
	options.delay = options.delay || 400;
	options.matchCase = options.matchCase || 0;
	options.matchSubset = options.matchSubset || 1;
	options.matchContains = options.matchContains || 0;
	options.cacheLength = options.cacheLength || 1;
	options.mustMatch = options.mustMatch || 0;
	options.extraParams = options.extraParams || {};
	options.loadingClass = options.loadingClass || "ac_loading";
	options.selectFirst = options.selectFirst || false;
	options.selectOnly = options.selectOnly || false;
	options.maxItemsToShow = options.maxItemsToShow || -1;
	options.autoFill = options.autoFill || false;
	options.width = parseInt(options.width, 10) || 0;

	this.each(function() {
		var input = this;
		new jQuery.autocomplete(input, options);
	});

	// Don't break the chain
	return this;
}

jQuery.fn.autocompleteArray = function(data, options) {
	return this.autocomplete(null, options, data);
}

jQuery.fn.indexOf = function(e){
	for( var i=0; i<this.length; i++ ){
		if( this[i] == e ) return i;
	}
	return -1;
};
/*-------- jquery.rater.js -----------*/
/**
 * jQuery Ajax Rater Plugin
 *
 * This rater is based on the code Ritesh Agrawal did. Unfortunatly his CSS and the hover technique breaks in some browsers.
 * So i thought, why not use the best CSS star-rater known to man kind and throw it in the mix.
 * I have used the CSS and technique from Komodo Media since it is stable and tested on many, many browsers.
 *
 * This rater compared, has no cancel button. But i think we can live with that :)
 * To avoid conflicts i have changed the function name.
 *
 * Licensed under The MIT License
 *
 * @version     1.0
 * @since       03.01.2007
 * @author      Kjell Bublitz <m3nt0r.de@gmail.com
 * @link        http://www.m3nt0r.de/devel/raterDemo/ Demonstration and Documentation
 * @link        http://php.scripts.psu.edu/rja171/widgets/rating.php Based on Ritesh Agrawal Star Rating System
 * @link        http://komodomedia.com/blog/index.php/2007/01/20/css-star-rating-redux/ The Komodo Media CSS Rater Blogpost
 * @license     http://www.opensource.org/licenses/mit-license.php MIT
 * @package     jQuery Plugins
 * @subpackage  Rater
 */ 

/**
 * Usage: $('#rating').rater('your_servlet', {style:'basic', maxvalue:5, curvalue:0});
 *  
 * @param url The address you want to post the result to. 
 * @param options The style and value attributes
 *
 * Valid options:
 * ---------------------------------------
 *       style:       'basic', 'inline' OR 'small'
 *       maxvalue:    the maximum value / number of stars
 *       curvalue:    the initial value / selected stars
 */
RaterV = new Array('Nada interesante', 'Del montón', 'Interesante', 'Muy interesante');
jQuery.fn.rater = function(url, options)
{
	if(url == null) return;
	var settings = {
		url       : url, // post changes to
		maxvalue  : 4,   // max number of stars
		curvalue  : 0    // number of selected stars
	};

	if(options) { jQuery.extend(settings, options); };
	jQuery.extend(settings, {cancel: (settings.maxvalue > 1) ? true : false});

	var container = jQuery(this);
	jQuery.extend(container, { averageRating: settings.curvalue, url: settings.url });

	if(!settings.style || settings.style == null || settings.style == 'basic') {
		var raterwidth = settings.maxvalue * 25;
		var ratingparent = '<ul class="star-rating" style="width:'+raterwidth+'px">';
	}
	if(settings.style == 'small') {
		var raterwidth = settings.maxvalue * 18;
		var ratingparent = '<ul class="star-rating small-star" style="width:'+raterwidth+'px">';
	}
	if(settings.style == 'inline') {
		var raterwidth = settings.maxvalue * 18;
		var ratingparent = '<span class="inline-rating"><ul class="star-rating small-star" style="width:'+raterwidth+'px">';
	}
	container.append(ratingparent);

	// create rater
	var starWidth, starIndex, listitems = '';
	var curvalueWidth = Math.floor(100 / settings.maxvalue * settings.curvalue);
	for(var i = 0; i <= settings.maxvalue ; i++) {
		if (i == 0) {
			listitems+='<li class="current-rating" style="width:'+curvalueWidth+'%;">'+settings.curvalue+'/'+settings.maxvalue+'</li>';
		} else {
			starWidth = Math.floor(100 / settings.maxvalue * i);
			starIndex = (settings.maxvalue - i) + 2;
			listitems+='<li class="star"><a href="#'+i+'" title="'+RaterV[i-1]+'" style="width:'+starWidth+'%;z-index:'+starIndex+'">'+RaterV[i-1]+'</a></li>';
		}
	}
	container.find('.star-rating').append(listitems); // i am using find here, because the span wrapped in the small style would break children()

	if(settings.maxvalue > 1) // add a container for the ajax result
	{
		container.append('<span class="star-rating-result"></span>');
	}
	container.append('<div class="numvotos">' + settings.votos + ' votos</div>');
	var stars = jQuery(container).find('.star-rating').children('.star');
	stars.click(function()
	{
			settings.curvalue = stars.index(this) + 1;
			raterValue = jQuery(this).children('a')[0].href.split('#')[1];
			jQuery.post(container.url, { "rating": raterValue }, function(response){
				container.children('.star-rating-result').html(response)
			});
		return true;

	});

	return this; // strict warning: anonymous function does not always return a value. fix?
}

function mycarousel_itemLoadCallback(carousel, state)
{
    if (state != 'init')
        return;
    jQuery.get('/eldia/multitemas/galeriahome', function(data) {
        mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, data);
    });
};
function mycarousel_itemAddCallback(carousel, first, last, data) {
    // Simply add all items at once and set the size accordingly.
    var items = data.split('|');
    for (i = 0; i < items.length; i++) {
        carousel.add(i+1, items[i]);
    }
    carousel.size(items.length);
};
function cargarMes(anyo, mes) {  $('#calendhomemes').load('/eldia/multitemas/calendario/' + anyo + '/' + mes);}
