function send()
{
	var path = arguments[0];
	var el = arguments[1];
	var toDo = arguments[2];	
	if (!document.getElementById(el)){
		//alert('sin getElementById');
		return false;
	}
	
	el = $(el);
	if (el.hasClass('ajax-loading')) return false;
	el.toggleClass('ajax-loading');
	el.setHTML('<br><br>Cargando Motor..');
	
	var newajax = new Ajax(path,{
			evalScripts: true,
			method: 'get',
			update: el,
			onComplete:function(e){
				this.evalScript = true;
				el.toggleClass('ajax-loading');
				correctPNG();
				toDo();
				
			},
			onRequest:function(){
				el.setHTML('<br><br><br>Cargando....');
			},
			onFailure: function(){
				el.setHTML('<br><br><br>Error al cargar');
			}
		}).request();
}

function load_full_banner() {
	send('full_banner.php', 'full_banner', nextload);
	return true;
}
function load_menu() {
	send('div_menu.php', 'menu', nextload);
	return true;
}
function load_div_mas_titulares() {
	send('/contenidos/publish/menu_articulos/mas_notas.php', 'mas_titulares', nextload);
	return true;
}
function load_div_especiales() {
	send('/contenidos/publish/1260_especiales/index_especial_inter.php', 'especiales_int', nextload);
	return true;
}
function load_div_recomendamos() {
	send('/contenidos/publish/889_recomendacion_interna.php', 'recomendamos_cont', nextload);
	return true;
}
function load_box_banner() {
	send('box_banner.php', 'interna_box_banner', nextload);
	return true;
}

function load_videoplayer() {
//	send('videoplayer.php', 'videoplayer', nextload);

var myAjax = new Ajax('videoplayer.php', {
    method: 'get',
    evalScripts: true,
    update: $('videoplayer'),
    onRequest: function(){
        $('videoplayer').setHTML('Cargando');
    },
    onComplete: function(){
        this.evalScript = true;
    },
    onFailure: function(){
		$('videoplayer').setHTML('Error al cargar')
	}
}).request();
nextload();
return true;
}

function load_vpinter() {
//	send('videoplayer.php', 'videoplayer', nextload);

var myAjax = new Ajax('vpinter.php', {
    method: 'get',
    evalScripts: true,
    update: $('videoplayer'),
    onRequest: function(){
        $('videoplayer').setHTML('Cargando');
    },
    onComplete: function(){
        this.evalScript = true;
    },
    onFailure: function(){
		$('videoplayer').setHTML('Error al cargar')
	}
}).request();
nextload();
return true;
}

function ajuste_final() {
	
	try {
	document.getElementById('interna_left').style.height = 'auto';
	} catch(e) { var exceptions = e; }
	
	try {
	document.getElementById('interna_right').style.height = 'auto';
	} catch(e) { var exceptions = e; }
	
	try {
	document.getElementById('columnas').style.height = 'auto';
	} catch(e) { var exceptions = e; }
	
	try {
	document.getElementById('nota_completa').style.height = 'auto';
	} catch(e) { var exceptions = e; }
	
	return true;
}

function full_load() {
	AJAX2load[i_loading]();
	return true;
}
function nextload() {
	i_loading++;
	if (i_loading<AJAX2load.length)
		full_load(); 
	return true;
}

var i_loading = 0;
var AJAX2load = new Array();

AJAX2load[(AJAX2load.length)] = load_menu;
AJAX2load[(AJAX2load.length)] = load_div_mas_titulares;
AJAX2load[(AJAX2load.length)] = load_div_especiales;
AJAX2load[(AJAX2load.length)] = load_div_recomendamos;

event2obj(window,'load',full_load);
