function sacartapa(){
	$("body").css({ cursor:"default" });
	tb_remove();
};

function IniciarContactForm(){
	tb_ShowOverlay();
	$("#mensajes_form").remove();
	$('.campo_error').removeClass("campo_error").addClass("campo");
	$("body").css({ cursor:"wait" });
};

function IniciarConsultaForm(){
	$("#mensajes_form").remove();
	$('.campo_error').removeClass("campo_error").addClass("campo");
	$("#consulta_form").fadeTo( "normal", 0.2 );
	$("body").css({ cursor:"wait" });
};

function IniciarNewsForm(){
	tb_ShowOverlay();
	$("#mensajes_news_form").remove();
	$('.campo_error').removeClass("campo_error").addClass("campo");
	$("body").css({ cursor:"wait" });
};

function IniciarCotizarForm(){
	tb_ShowOverlay();
	$("#mensajes_cotizar_form").remove();
	$('.campo_error').removeClass("campo_error").addClass("campo");
	$("body").css({ cursor:"wait" });
};

function processContactForm(responseXML) {
	$("#datos_contacto").after("<div id='mensajes_form' style='display:none;'></div>");
	if($('ok', responseXML).length > 0){
		$('#items_form').remove();
		$('#mensajes_form').addClass("mensajes_form_ok").html($('ok', responseXML).text()).show();
	}else if($('error', responseXML).length > 0){
		var Mensajes = '<strong>Se han producido los siguientes errores:</strong><br />';
		$('error', responseXML).each(function() {
			$("#"+$(this).attr('campo')).removeClass("campo").addClass("campo_error");
			Mensajes += '- '+$(this).text()+'<br />';
		});
		$('#mensajes_form').addClass("mensajes_form_error").html(Mensajes).show();
	}
	sacartapa();
}

function processConsultaForm(responseXML) {
	$("#paquete_form").after("<div id='mensajes_form' style='display:none;'></div>");
	$("#consulta_form").fadeTo( "normal", 1 );
	$("body").css({ cursor:"default" });
	if($('ok', responseXML).length > 0){
		$('#items_form').remove();
		$('#mensajes_form').addClass("mensajes_form_ok").html($('ok', responseXML).text()).show();
	}else if($('error', responseXML).length > 0){
		var Mensajes = '<strong>Se han producido los siguientes errores:</strong><br />';
		$('error', responseXML).each(function() {
			$("#"+$(this).attr('campo')).removeClass("campo").addClass("campo_error");
			Mensajes += '- '+$(this).text()+'<br />';
		});
		$('#mensajes_form').addClass("mensajes_form_error").html(Mensajes).show();
	}
}

function processNewsForm(responseXML) {
	$("#desc_news_form").after("<div id='mensajes_news_form' style='display:none;'></div>");
	if($('ok', responseXML).length > 0){
		$('#items_news_form').remove();
		$('#mensajes_news_form').addClass("mensajes_news_form_ok").html($('ok', responseXML).text()).show();
	}else if($('error', responseXML).length > 0){
		var Mensajes = '<strong>Error..!</strong><br />';
		$('error', responseXML).each(function() {
			$("#"+$(this).attr('campo')).removeClass("campo").addClass("campo_error");
			Mensajes += '- '+$(this).text()+'<br />';
		});
		$('#mensajes_news_form').addClass("mensajes_news_form_error").html(Mensajes).show();
	}
	sacartapa();
}

function processCotizarForm(responseXML) {
	$("#intro_cotizar_form").after("<div id='mensajes_cotizar_form' style='display:none;'></div>");
	if($('ok', responseXML).length > 0){
		$('#items_form').remove();
		$('#mensajes_cotizar_form').addClass("mensajes_news_form_ok").html($('ok', responseXML).text()).show();
	}else if($('error', responseXML).length > 0){
		var Mensajes = '<strong>Error..!</strong><br />';
		$('error', responseXML).each(function() {
			$("#"+$(this).attr('campo')).removeClass("campo").addClass("campo_error");
			Mensajes += '- '+$(this).text()+'<br />';
		});
		$('#mensajes_cotizar_form').addClass("mensajes_news_form_error").html(Mensajes).show();
	}
	sacartapa();
}
