function ufoMapa_DoFSCommand(command, args) {
  prId = args;
  $A($('pr').options).forEach (function (pOpt, pKey) {
  	if (pOpt.value == prId) $('pr').selectedIndex = pKey;
	});
}

function js_indexFlash () {
	var FO = { id:"ufoMapa",name:"ufoMapa",movie:"mapa.swf",width:"316",height:"241",majorversion:"6",build:"0",bgcolor:"#ffffff",wmode:"transparent",swliveconnect:"true",xi:"true" };
	UFO.create(FO,"mapa");
}

function js_indexBuscador () {
	$$('#publbuscador .inputtext').forEach (function (oIT) {
		oIT.value = oIT.title;
		$(oIT).setStyle ('color', '#999999');
	});
	$$('#publbuscador .inputtext').addEvent ('focus', function () {
		if (this.value == this.title) {
			this.value = '';
			$(this).setStyle ('color', '#000000');
		}
	});
	$$('#publbuscador .inputtext').addEvent ('blur', function () {
		if (this.value.length == 0) {
			this.value = this.title;
			$(this).setStyle ('color', '#999999');
		}
	});
	$('formulario').addEvent ('submit', function (e) {
		conTexto = false;
		$$('#publbuscador .inputtext').forEach (function (oIT) {
			if (oIT.value == oIT.title) oIT.value = '';
			else conTexto = true;
		});
		if (!conTexto) {
			e = new Event(e).stop();
			sPara = new Array ();
			if ($('fa').getValue () != 0) sPara.push ($('fa').options [$('fa').selectedIndex].title);
			if ($('pr').getValue () != 0) sPara.push ($('pr').options [$('pr').selectedIndex].title);
			if (sPara.length > 0) document.location = 'academias-de?'+ sPara.join ('&');
		}
	});
}

function js_yt () {
	if ($('ytdestacado')) $('ytdestacado').addEvent ('click', function (e) {
		e = new Event(e).stop();
		js_divYT (this.hash.substr (1), this.hasClass ('publicidad'));
		return false;
	});
}

function js_divYT (ydID, conPublicidad) {
	if ($('divYT')) $('divYT').remove ()
	
	if (conPublicidad) {
		b = ydID.split ('|');
		ydID = b [0];
		ytPubli = b [1];
	}
	
	oDiv = document.createElement ('div');
	$(oDiv).setProperty ('id', 'divYT');
	$(oDiv).setStyles ({
		'background': '#7696E3',
		'border': '#7696E3 solid 4px',
		'font': 'bold 11px Arial',
		'overflow': 'hidden',
		'padding': '0',
		'position': (window.ie6 ? 'absolute' : 'fixed'),
		'text-align': 'left',
		'top': (window.ie6 ? document.body.parentNode.scrollTop+280 : '200px'),
		'left': ($('ytdestacado').getLeft () - 540),
		'width': '425px',
		'height': conPublicidad ? '390px' : '360px'
	});
	oClose = document.createElement ('img');
	$(oClose).src = 'img/frmno.gif';
	$(oClose).alt = 'cerrar';
	$(oClose).width = 13;
	$(oClose).height = 13;
	$(oClose).setStyles ({
		'background': '#D7DEF8',
		'border': '#7696e3 solid',
		'border-width': '0 0 4px 4px',
		'cursor': (window.ie ? 'hand' : 'pointer'),
		'position': 'absolute',
		'right': 0,
		'z-align': 10000
	});
	$(oClose).addEvent ('click', function () {
		this.parentNode.remove ();
	});
	$(oDiv).adopt (oClose);
	oBig = document.createElement ('iframe');
	$(oBig).setProperty ('border', '0');
	$(oBig).setProperty ('frameborder', '0');
	$(oBig).setProperty ('scrolling', 'no');
	$(oBig).setProperty ('width', '425');
	$(oBig).setProperty ('height', '366'); //355
	$(oBig).setProperty ('src', 'video.popup.php?v='+ ydID +'&w=425&h=366');
	$(oDiv).adopt (oBig);
	
	if (conPublicidad) {
		oPub = document.createElement ('a');
		$(oPub).setStyles ({
			'border': 'none',
			'margin': '0 auto',
			'width': 123, 'height': 35
		});
		$(oPub).setProperties ({
			'target': '_blank',
			'href': ytPubli
		});
		$(oPub).setHTML ('<img src="img.1024/ytdestacado.jpg" width="123" height="35" alt="+ información" border="0" />');
		$(oPub).addEvent ('click', function () { this.parentNode.remove (); });
		$(oDiv).adopt (oPub);
	}
	
	$(oDiv).injectAfter ('ytdestacado');
}

window.addEvent ('domready', js_indexFlash);
window.addEvent ('domready', js_indexBuscador);
window.addEvent ('domready', js_yt);