$(document).ready(function()
{
	if ($.query.get('login')) mudis_login();
});


// LISTADO DE DISPOSITIVOS
function dispositivos_filtrar(dispositivos_link)
{
	var param_devices = $('#select_devices option:selected').val();
	var param_brands = $('#select_brands option:selected').val();
	window.location.href = dispositivos_link + '?' + param_devices + param_brands;
}

// SELECIONAR DISPOSITIVO
function dispositivos_buscar(search)
{
	var id_device = 0;
	var id_brand = 0;

	// solo si la ventana ya esta abierta
	if ($('#select_devices').size() && $('#select_brands').size()) {
		var param_devices = $('#select_devices option:selected').val().split('&id_device=')[1];
		if (!isNaN(param_devices)) id_device = param_devices;
		var param_brands = $('#select_brands option:selected').val().split('&id_brand=')[1];
		if (!isNaN(param_brands)) id_brand = param_brands;
	}

	$.ajax({
		type: "GET",
		url: WEB_PATH + "app/ajax/dispositivos_buscar.php",
		data: {search: search, id_device: id_device, id_brand: id_brand},
		async: false,
		success: function(response)
		{
			$("#contenedor_ajax_div").html(response);
			show_div('contenedor_ajax_div');
			Custom.init(); // mostrar selects customizables
		}
	});
}

// PARA SELECCIONAR DESDE EL FLASH
function dispositivos_seleccionar()
{
	var id_device = 0;
	var id_brand = 0;

	// solo si la ventana ya esta abierta
	if ($('#select_devices').size() && $('#select_brands').size()) {
		var param_devices = $('#select_devices option:selected').val().split('&id_device=')[1];
		if (!isNaN(param_devices)) id_device = param_devices;
		var param_brands = $('#select_brands option:selected').val().split('&id_brand=')[1];
		if (!isNaN(param_brands)) id_brand = param_brands;
	}

	$.ajax({
		type: "GET",
		url: WEB_PATH + "app/ajax/dispositivos_seleccionar.php",
		data: {id_device: id_device, id_brand: id_brand},
		async: false,
		success: function(response)
		{
			$("#contenedor_ajax_div").html(response);
			show_div('contenedor_ajax_div');
			Custom.init(); // mostrar selects customizables
		}
	});
}

// QUEDO SELECCIONADO ENVIAR AL FLASH
function dispositivos_selecionado(id_device)
{
	hide_div('contenedor_ajax_div');
	getFlashMovieObject('swfCreate').setModel(id_device);
}

// LISTADO DE DISEÑOS (MUDIS)
function mudis_filtrar(mudis_link)
{

	//var param_devices = $('#select_devices option:selected').val();
	//var param_brands = $('#select_brands option:selected').val();
	//var param_models = $('#select_models option:selected').val();
	var param_devices = $('#hid_devices').val();
	var param_brands = $('#hid_brands').val();
	var param_models = $('#hid_models').val();
	var param_types = $('#select_types option:selected').val();
	var param_artists = $('#select_artists option:selected').val();
	window.location.href = mudis_link + '?' + param_devices + param_brands + param_models + param_types + param_artists;
}

// LISTADO DE ARTISTAS
function artistas_filtrar(artistas_link)
{
	var param_devices = $('#select_devices option:selected').val();
	var param_types = $('#select_types option:selected').val();
	window.location.href = artistas_link + '?' + param_devices + param_types;
}

// MOSTRAR SELECTOR ANIMO
function mudis_change_mood()
{
	$.ajax({
		type: "POST",
		url: WEB_PATH + "app/ajax/cambiar_estado_div.php",
		data: { },
		async: false,
		success: function(response)
		{
			$("#contenedor_ajax_div").html(response);
			show_div('contenedor_ajax_div');

			// Para que quede un poco más centrado verticalmente
			var div_height = Number($('#contenedor_ajax_div').css('top').replace('px', ''));
			div_height = Math.max(0, div_height - 50);
			$('#contenedor_ajax_div').css('top', div_height+'px');
		}
	});
}

// CAMBIAR ANIMO / DISEÑO
function mudis_set_mood(value)
{
	$.ajax({
		type: "POST",
		url: WEB_PATH + "app/ajax/cambiar_estado_post.php",
		data: {value: value},
		async: false,
		success: function(response)
		{
			var v_result = response.split("|");
			if (v_result[0] == 1) {
				$('#section_header_h1').attr('class', (value == 'rainy') ? 'white' : 'black');
				$('#img_artistas').attr('src', (v_result[1]));
				$('#img_dispositivos').attr('src', (v_result[2]));
				$('#img_mudis').attr('src', (v_result[3]));
				hide_div('contenedor_ajax_div');
				$('.body_class').attr('id', value);
				getFlashMovieObject('headerSwf').setMood(value);
			}
		}
	});
}

// RECARGAR COMBO DE MARCAS
function mudis_select_brands_refresh()
{
	$.ajax({
		type: "GET",
		url: WEB_PATH + "app/ajax/select_brands_refresh.php?"+$('#select_devices option:selected').val(),
		success: function(response)
		{
			$('#p_select_brands').html(response);
			mudis_select_models_refresh();
			Custom.init();
		}
	});
}

// RECARGAR COMBO DE MODELOS
function mudis_select_models_refresh()
{
	$.ajax({
		type: "GET",
		url: WEB_PATH + "app/ajax/select_models_refresh.php?"+$('#select_brands option:selected').val(),
		success: function(response)
		{
			$('#p_select_models').html(response);
			Custom.init();
		}
	});
}


// MOSTRAR MODELOS DISPONIBLES PARA UN DISEÑO
function mudis_show_related_models(id_design, id_device)
{
	$.ajax({
		type: "POST",
		url: WEB_PATH + "app/ajax/mudis_modelos_relacionados.php",
		data: {id_design: id_design, id_device: id_device},
		async: false,
		success: function(response)
		{
			$("#contenedor_ajax_div").html(response);
			show_div('contenedor_ajax_div');

			// Para que quede un poco más centrado verticalmente
			var div_height = Number($('#contenedor_ajax_div').css('top').replace('px', ''));
			div_height = Math.max(0, div_height - 50);
			$('#contenedor_ajax_div').css('top', div_height+'px');
		}
	});
}

function mudis_filter_related_models(id_design, p)
{
	var param_devices = $('#select_devices option:selected').val();
	var id_device = param_devices.split('&id_device=')[1];
	if (isNaN(id_device)) id_device = 0;
	var param_brands = $('#select_brands option:selected').val();
	var id_brand = param_brands.split('&id_brand=')[1];
	if (isNaN(id_brand)) id_brand = 0;
	var param_models = $('#select_models option:selected').val();
	var id_model = param_models.split('&id_model=')[1];
	if (isNaN(id_model)) id_model = 0;
	$.ajax({
		type: "POST",
		url: WEB_PATH + "app/ajax/mudis_modelos_relacionados.php",
		data: {id_design: id_design, id_device: id_device, id_brand: id_brand, id_model: id_model, p: p},
		async: false,
		success: function(response)
		{
			$("#contenedor_ajax_div").html(response);
			show_div('contenedor_ajax_div');

			// Para que quede un poco más centrado verticalmente
			var div_height = Number($('#contenedor_ajax_div').css('top').replace('px', ''));
			div_height = Math.max(0, div_height - 50);
			$('#contenedor_ajax_div').css('top', div_height+'px');
		}
	});
}


// MUDIS USUARIO ESTA LOGUEADO
function mudis_usario_loguedo()
{
	return ($('#hid_id_user').val() > 0);
}




// MUDIS CREATOR LUEGO DE TERMINAR
function mudis_creator_finalizar(id_mudis_created)
{
	hide_alert();
	compra_modificar_item(id_mudis_created, 3, 1);
}


// MUDIS CREATOR - MENSAJE DE ESPERA
function mudis_creator_creando()
{
	$.ajax({
		type: "POST",
		url: WEB_PATH + "app/ajax/creando_mudis.php",
		success: function(response)
		{
			$("#contenedor_ajax_div").html(response);
			show_div('contenedor_ajax_div');

			// Para que quede un poco más centrado verticalmente
			var div_height = Number($('#contenedor_ajax_div').css('top').replace('px', ''));
			div_height = Math.max(0, div_height - 50);
			$('#contenedor_ajax_div').css('top', div_height+'px');
			
			// Llamar a funcion del SWF para que continue con el proceso
			getFlashMovieObject('swfCreate').mudis_creator_crear();
		}
	});
}


// BUSQUEDA
function mudis_search(frm_mudis)
{
	var q = $('inp_mudis_search').val();
	if (!isInputEmpty('inp_mudis_search')) {
		alert('se genera la busqueda');
		frm_mudis.submit();
	} else {
		alert('a ver');
	}
	return false;
}

// BUSQUEDA - CAMBIAR VISTA
function mudis_busqueda_filtrar_resultados()
{
	var opt_selected = $('#select_busqueda option:selected').val();
	var arr_divs = ['mudis', 'dispositivos'];
	if (opt_selected == '') {
		for (i in arr_divs) $('#div_'+arr_divs[i]+'_container').show();
	} else {
		for (i in arr_divs) $('#div_'+arr_divs[i]+'_container').hide();
		$('#div_'+opt_selected+'_container').show();
	}
}


// LOGIN DE USUARIO
var mudis_login_callback = "";
function mudis_login()
{
	$.ajax({
		type: "POST",
		url: WEB_PATH + "app/ajax/login_div.php",
		data: { },
		async: false,
		success: function(response)
		{
			$("#contenedor_ajax_div").html(response);
			show_div('contenedor_ajax_div');
			Custom.init();
			_initInput('inp_email', $('#inp_email').val());
			_initInput('inp_password', $('#inp_password').val());
			
			// Para que quede un poco más centrado verticalmente
			var div_height = Number($('#contenedor_ajax_div').css('top').replace('px', ''));
			div_height = Math.max(-150, div_height - 150);
			$('#contenedor_ajax_div').css('top', div_height+'px');
			
			Custom.clear();

		}
	});
}

function mudis_login_submit()
{
	if (!jQuery.isReady) return;

	if (!is_email($('#inp_email').val())) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_EMAIL_INVALIDO, error: 1});
		$('#inp_email').focus();
	} else
	if (inputIsEmpty('inp_password')) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_COMPLETAR_PASSWORD, error: 1});
		$('#inp_password').focus();
	} else {
		$.ajax({
			type: "POST",
			url: WEB_PATH + "app/ajax/login_post.php",
			data: {email: $('#inp_email').val(), password: $('#inp_password').val(), remember: ($('#chk_remember').attr('checked') == true) ? 1 : 0},
			async: false,
			success: function(response)
			{
				var v_response = response.split('|');
				if (v_response[0] == 1) {
					if (mudis_login_callback != '') {
						hide_div('contenedor_ajax_div');
						eval(mudis_login_callback);
						mudis_login_callback = '';
					} else {
						window.location.href = v_response[1];
					}
				} else {
					show_alert({titulo: MSG_ATENCION, descripcion: MSG_EMAIL_PASS_INVALIDO, error: 1});
				}
			}
		});
	}
}

// LOGOUT DE USUARIO
function mudis_logout()
{
	$.ajax({
		type: "POST",
		url: WEB_PATH + "app/ajax/logout_post.php",
		async: false,
		success: function(response)
		{
			window.location.href = WEB_PATH;
		}
	});
}

// REGISTRO DE USUARIO
function mudis_registro()
{
	$.ajax({
		type: "POST",
		url: WEB_PATH + "app/ajax/registro_div.php",
		data: { },
		async: false,
		success: function(response)
		{
			$("#contenedor_ajax_div").html(response);
			show_div('contenedor_ajax_div');
			
			// Para que quede un poco más centrado verticalmente
			var div_height = Number($('#contenedor_ajax_div').css('top').replace('px', ''));
			div_height = Math.max(-50, div_height - 100);
			$('#contenedor_ajax_div').css('top', div_height+'px');
		}
	});
}

function mudis_registro_submit()
{

	var fecha_nacimiento = $('#inp_nacimiento_d').val()+'/'+$('#inp_nacimiento_m').val()+'/'+$('#inp_nacimiento_a').val();

	if (inputIsEmpty('inp_nombre')) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_COMPLETAR_NOMBRE, error: 1});
		$('#inp_nombre').focus();
	} else 
	if (inputIsEmpty('inp_apellido')) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_COMPLETAR_APELLIDO, error: 1});
		$('#inp_apellido').focus();
	} else 
	if (!is_email($('#inp_email').val())) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_EMAIL_INVALIDO, error: 1});
		$('#inp_email').focus();
	} else
	if (!is_date(fecha_nacimiento)) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_FECHA_INVALIDA, error: 1});
		$('#inp_nacimiento_d').focus();
	} else 
	if (inputIsEmpty('inp_password')) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_COMPLETAR_PASSWORD, error: 1});
		$('#inp_password').focus();
	} else
	if ($('#inp_password').val().length < 7) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_PASSWORD_CORTO, error: 1});
		$('#inp_password').focus();
	} else
	if ($('#inp_password').val() != $('#inp_password2').val()) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_PASSWORD_DIFERENTES, error: 1});
		$('#inp_password2').focus();
	} else {
		var dataObj = new Object();
		dataObj.nombre = urlencode($('#inp_nombre').val());
		dataObj.apellido = urlencode($('#inp_apellido').val());
		dataObj.email = urlencode($('#inp_email').val());
		dataObj.fecha_nacimiento_d = $('#inp_nacimiento_d').val();
		dataObj.fecha_nacimiento_m = $('#inp_nacimiento_m').val();
		dataObj.fecha_nacimiento_a = $('#inp_nacimiento_a').val();
		dataObj.password = urlencode($('#inp_password').val());
		$.ajax({
			type: "POST",
			url: WEB_PATH + "app/ajax/registro_post.php",
			data: dataObj,
			async: false,
			success: function(response)
			{
				var v_response = response.split('|');
				if (v_response[0] == 1) {
					if (mudis_login_callback != '') {
						hide_div('contenedor_ajax_div');
						eval(mudis_login_callback);
						mudis_login_callback = '';
					} else {
						window.location.href = v_response[1];
					}
				} else {
					show_alert({titulo: MSG_ATENCION, descripcion: MSG_ERROR, error: 1});
				}
			}
		});
	}
}

// PEDIR PASSWORD
function mudis_pedir_password()
{
	$.ajax({
		type: "POST",
		url: WEB_PATH + "app/ajax/pedir_password.php",
		async: false,
		success: function(response)
		{
			$("#contenedor_ajax_div").html(response);
			show_div('contenedor_ajax_div');

			// Para que quede un poco más centrado verticalmente
			var div_height = Number($('#contenedor_ajax_div').css('top').replace('px', ''));
			div_height = Math.max(0, div_height - 50);
			$('#contenedor_ajax_div').css('top', div_height+'px');
		}
	});
}

function mudis_pedir_password_submit()
{
	if (!is_email($('#inp_password_recovery_email').val())) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_EMAIL_INVALIDO, error: 1});
		$('#inp_password_recovery_email').focus();
	} else {
		show_alert({titulo: MSG_INFORMACION, descripcion: MSG_ENVIANDO, error: 0});
		$.ajax({
			type: "POST",
			url: WEB_PATH + "app/ajax/pedir_password_post.php",
			data: {email: urlencode($('#inp_password_recovery_email').val())},
			async: false,
			success: function(response)
			{
				var v_response = response.split('|');
				if (v_response[0] == 1) {
					show_alert({titulo: MSG_ATENCION, descripcion: MSG_PASSWORD_ENVIADO, error: 0, callback: 'hide_alert();'});
				} else
				if (v_response[0] == -1) {
					show_alert({titulo: MSG_ATENCION, descripcion: MSG_EMAIL_INCORRECTO, error: 1});
				} else {
					show_alert({titulo: MSG_ATENCION, descripcion: MSG_ERROR, error: 1});
				}
			}			
		});
	}
}

function mudis_password_reestablecer_submit()
{
	if (inputIsEmpty('inp_password_1')) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_COMPLETAR_PASSWORD, error: 1});
		$('#inp_password_1').focus();
	} else
	if ($('#inp_password_1').val().length < 7) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_PASSWORD_CORTO, error: 1});
		$('#inp_password_1').focus();
	} else
	if ($('#inp_password_1').val() != $('#inp_password_2').val()) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_PASSWORD_DIFERENTES, error: 1});
		$('#inp_password_2').focus();
	} else {
		$.ajax({
			type: "POST",
			url: WEB_PATH + "app/ajax/password_reestablecer_post.php",
			data: {password: urlencode($('#inp_password_1').val()), key: $('#hid_key').val()},
			async: false,
			success: function(response)
			{
				var v_response = response.split('|');
				if (v_response[0] == 1) {
					window.location.href = v_response[1];
				} else {
					show_alert({titulo: MSG_ATENCION, descripcion: MSG_ERROR, error: 1});
				}
			}
		});
	}
}

function mudis_registro_cuenta()
{
	$('#div_datos_mostrar').hide();
	$('#div_datos_editar').show();
}

// GUARDAR DATOS DE MI CUENTA
function mudis_registro_cuenta_submit()
{

	var fecha_nacimiento = $('#inp_nacimiento_d').val()+'/'+$('#inp_nacimiento_m').val()+'/'+$('#inp_nacimiento_a').val();

	if (inputIsEmpty('inp_nombre')) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_COMPLETAR_NOMBRE, error: 1});
		$('#inp_nombre').focus();
	} else
	if (inputIsEmpty('inp_apellido')) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_COMPLETAR_APELLIDO, error: 1});
		$('#inp_apellido').focus();
	} else
	if (!is_email($('#inp_email').val())) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_EMAIL_INVALIDO, error: 1});
		$('#inp_email').focus();
	} else
	if (!is_date(fecha_nacimiento)) {
		show_alert({titulo: MSG_ATENCION, descripcion: MSG_FECHA_INVALIDA, error: 1});
		$('#inp_nacimiento_d').focus();
	} else {
		var dataObj = new Object();
		dataObj.nombre = urlencode($('#inp_nombre').val());
		dataObj.apellido = urlencode($('#inp_apellido').val());
		dataObj.email = urlencode($('#inp_email').val());
		dataObj.fecha_nacimiento_d = $('#inp_nacimiento_d').val();
		dataObj.fecha_nacimiento_m = $('#inp_nacimiento_m').val();
		dataObj.fecha_nacimiento_a = $('#inp_nacimiento_a').val();
		$.ajax({
			type: "POST",
			url: WEB_PATH + "app/ajax/registro_cuenta_post.php",
			data: dataObj,
			async: false,
			success: function(response)
			{
				var v_response = response.split('|');
				if (v_response[0] == 1) {
					$('#str_nombre').html(dataObj.nombre);
					$('#str_apellido').html(dataObj.apellido);
					$('#str_email').html(dataObj.email);
					$('#str_fecha_nacimiento').html(fecha_nacimiento);
					$('#div_datos_editar').hide();
					$('#div_datos_mostrar').show();
				} else {
					show_alert({titulo: MSG_ATENCION, descripcion: MSG_ERROR, error: 1});
				}
			}
		});
	}
}

//AGREGAR A FAVORITOS
function add_favorite_design(id_design)
{
	$('.add_favorite').html(MSG_ADD_FAVORITE_AGREGANDO);
	$.ajax({
		type: "POST",
		url: WEB_PATH + "app/ajax/favorites_add.php",
		data: {id_design: id_design},
		async: false,
		success: function(response)
		{
			var v_response = response.split('|');
			if (v_response[0] == 1) {
				$('.add_favorite').html(MSG_ADD_FAVORITE_AGREGADO);
				if($('.account-info').size() == 0) {
					window.location.reload();
				} else{
					$.ajax({
						url: WEB_PATH + "app/ajax/favorites_get_total.php",
						async: false,
						success: function(response)
						{
							$('.total_favorites').html('('+response+')');
						}
					});
				}
			} else {
				show_alert({titulo: MSG_ERROR, descripcion: MSG_ADD_FAVORITE_ERROR, error: 1});
			}
		}
	});
}

function delete_favorite_design(id_design)
{
	if(confirm(MSG_DELETE_QUESTION))
	var dataObj = new Object();
	dataObj.id_design = id_design;
	$.ajax({
		type: "POST",
		url: WEB_PATH + "app/ajax/favorites_delete.php",
		data: dataObj,
		async: false,
		success: function(response)
		{
			var v_response = response.split('|');
			if (v_response[0] == 1) {
				show_alert({titulo: MSG_ATENCION, descripcion: MSG_DELETE_FAVORITE_OK, error: 0});
				$.ajax({
					url: WEB_PATH + "app/ajax/favorites_get_total.php",
						async: false,
						success: function(response)
						{
							$('.total_favorites').html('('+response+')');
						}
					});
				$.ajax({
					url: WEB_PATH + "app/ajax/favorites_div.php",
						async: false,
						success: function(response)
						{
							$('#contenedor_ajax_div').html(response);
						}
					});
			} else {
				show_alert({titulo: MSG_ERROR, descripcion: MSG_DELETE_FAVORITE_ERROR, error: 1});
			}
		}
	});
}

//MOSTRAR FAVORITOS
function show_favorite_designs()
{
	$.ajax({
		type: "POST",
		url: WEB_PATH + "app/ajax/favorites_div.php",
		data: { },
		async: false,
		success: function(response)
		{
			$("#contenedor_ajax_div").html(response);
			show_div('contenedor_ajax_div');
		}
	});
}

// CAMBIO PARTICULAR DE OPCIONES
function mudis_user_change_recive(option)
{
	var value = ($('#chk_receive_'+option).attr('checked')) ? 1 : 0;
	$.ajax({
		type: "POST",
		async: false,
		url: WEB_PATH + "app/ajax/user_change_recive_post.php",
		data: {option: option, value: value},
		success: function(response)
		{
			var v_result = response.split('|');
			if (v_result[0] == -1) {
				mudis_login_callback = 'mudis_user_change_recive("'+option+'")';
				mudis_login();
			} else {
				// OK
			}
		}
	});
}

// CAMBIO DE TODAS LAS OPCIONES
function mudis_user_change_options()
{
	var receive_designs = ($('#chk_receive_designs').attr('checked')) ? 1 : 0;
	var receive_artists = ($('#chk_receive_artists').attr('checked')) ? 1 : 0;
	var receive_devices = ($('#chk_receive_devices').attr('checked')) ? 1 : 0;
	var receive_news = ($('#chk_receive_news').attr('checked')) ? 1 : 0;
	$.ajax({
		type: "POST",
		async: false,
		url: WEB_PATH + "app/ajax/user_change_options_post.php",
		data: {
			receive_designs: receive_designs,
			receive_artists: receive_artists,
			receive_devices: receive_devices,
			receive_news: receive_news
		},
		success: function(response)
		{
			var v_result = response.split('|');
			if (v_result[0] == -1) {
				mudis_login_callback = 'mudis_user_change_options()';
				mudis_login();
			} else {
				show_alert({titulo: MSG_INFORMACION, descripcion: MSG_CAMBIOS_GUARDADOS_OK, error: 0});
			}
		}
	});
}


// ALERTA GENERICA
function show_alert(objParams)
{
	if ($('#div_alerta').size() == 0) {
		$("<div id='div_alerta'></div>").appendTo(".body_class");
	}
	$('#div_alerta').attr('callback', objParams.callback);
	$.ajax({
		type: "POST",
		url: WEB_PATH + "app/ajax/mensaje_div.php",
		data: objParams,
		async: false,
		success: function(response)
		{			
			$('#div_alerta').html(response);
			if ($("#contenedor_ajax_div").is(':visible')) {
				$('#contenedor_ajax_div').attr('enabled', 'true');
				$('#contenedor_ajax_div').hide();
			}
			show_div('div_alerta');
		}
	});
}
function hide_alert()
{
	$('#div_alerta').hide();
	if ($('#contenedor_ajax_div').attr('enabled') == 'true') {
		$('#contenedor_ajax_div').attr('enabled', 'false');
		$("#contenedor_ajax_div").show();
	} else {
		hide_div('contenedor_ajax_div');
	}
	var callback = $('#div_alerta').attr('callback');
	$('#div_alerta').attr('callback', '');
	eval(callback);
}



