		var window_callback = {
				cache:false
		}
		// Functions for manage the pop-ups (like Loading, Listing or Contact Form)

		function manageDivLegend(display)
		{
			div = document.getElementById('backgroundLoadingDiv');
			div.style.display = display;
			div = document.getElementById('centerLegendDiv');
			div.style.display = display;

		}

		function manageDivLoading(display)
		{
			div = document.getElementById('backgroundLoadingDiv');
			div.style.display = display;
			div = document.getElementById('centerLoadingDiv');
			div.style.display = display;
	
			// TODO: take YAHOO token	
			if(display != 'none' && document.getElementById('phone')){
				var request = YAHOO.util.Connect.asyncRequest('POST', base_url_global+'/ajax/leadwindow', window_callback, null);
			}
		}

		function loadWindowsLoading(baseURL_param)
		{
			img = document.getElementById('imgLoadingHtml');
			div = document.getElementById('centerLoadingDiv');

			img.src = baseURL_param + '/images/ajax-loader.gif';
			div.style.border = "2px solid #CCCCCC";
			div.className = "centerLegendDiv";
			manageDivLoading('');
		}
	
		function loadWindowsFormContact(ret_value,email,phone,lang)
		{
			div = document.getElementById('centerLoadingDiv');
			div.style.background = '#FFFFFF';
			div.className = 'contact_form';
			if (lang == 'en')
			{
				div.innerHTML = '<span class="estates">Send your information directy to the agent. He will contact you as son as is possible</span>' +
							'<form method="post">' +
                    		'<div class="label"><label for="email">E-Mail:</label></div><input type="text" id="email" name="email" size="20" value="' +email+ '"><br />' +
                    		'<div class="label"><label for="phone">Contact phone:</label></div><input type="text" id="phone" name="phone" size="20" value="' +phone+ '"><br />' +
                   			'<center><input type="submit" value="Send" class="submit">' +
							'<input type="button" onClick="manageDivLoading(\'none\');" class="submit" value="Return"></center></form>' +
                			'</form><br />';
			}
			else
			{
				div.innerHTML = '<span class="estates">Envía tus datos directamente al agente, para que se ponga en contacto contigo en la brevedad posible</span>' +
							'<form method="post">' +
                    		'<div class="label"><label for="email">Correo electrónico:</label></div><input type="text" id="email" name="email" size="20" value="' +email+ '"><br />' +
                    		'<div class="label"><label for="phone">Teléfono de contacto:</label></div><input type="text" id="phone" name="phone" size="20" value="' +phone+ '"><br />' +
                   			'<center><input type="submit" value="Enviar datos" class="submit">' +
							'<input type="button" onClick="manageDivLoading(\'none\');" class="submit" value="Volver"></center></form>' +
                			'</form><br />';
			}

			if (ret_value != 0) 
			{
				if (ret_value == 1)
				{
					if (lang == 'en') {
						div.innerHTML += '<center><span class="red">The email format is not correct</span></center><br />';
					} else {
						div.innerHTML += '<center><span class="red">El formato del correo no es correcto</span></center><br />';
					}
				}
				else if (ret_value == 2)
				{
					if (lang == 'en') {
						div.innerHTML += '<center><span class="red">The contact phone format is not correct</span></center><br />';
					} else {
						div.innerHTML += '<center><span class="red">El formato del teléfono no es correcto</span></center><br />';
					}
				}
			}

			if (lang == 'en') {
				div.innerHTML += '<center><span>Your privacy is the most important for us, we will not share your private information with others and you will not recive spam.</span></center><br />';
				div.innerHTML += '<center><span>We will send you a email for verify that you are the owner of the email account that you have entered. Please, check that the mail is not in the junk mail.</span></center>';
			} else {
				div.innerHTML += '<center><span>Tu privacidad es lo más importante para nosortos, no compartimos tu información con terceros y no recibirás spam.</span></center><br />';
				div.innerHTML += '<center><span>A continuación te mandaremos un correo para que verifiques que eres el propietario de la cuenta de correo electrónico que has introducido. <b>Por favor, verifica que este no está en tu bandeja de correo no deseado.</b></span></center>';
			}

		}

function loadWindowsFormLogin(contentWindow)
{
	div = document.getElementById('centerLoadingDiv');
	div.innerHTML = contentWindow;

	manageDivLoading('');
}
