function twitter_login(uid) {
		
		var form = 
				'<form class="userdata" action="/login.php" method="post">'+
				'<p>Моля, влезте с вече съществуващ ваш акаунт в Blog.bg <br/></p>'+
				'<ul>'+
					'<table width="300" cellspacing="5" cellpadding="5">\
						<tr>\
							<td width="100"><label for="username">Потребител:</label></td>\
							<td width="200"><input id="login_user" size="32" class="text" type="text" value="" name="username"/>\
							</td>\
						</tr>\
						<tr>\
							<td><label for="password">Парола:</label></td>\
							<td><input size="32" id="login_pass" class="password" type="password" value="" name="password"/></td>\
						</tr>'+
						'<tr>'+
							'<td>&nbsp;</td>'+
							'<td><a class="left20" href="/register.php?get_twitter_info"> Регистрация в Blog.bg  </a></td>'+
						'</tr>'+
						'</table>'+
						'<p style="text-align: center;">'+
							'<input class="btn btn_big" id="btnTwitterConnectLogin" type="submit" value="Вход" title="Вход" />'+
							'<input type="hidden" name="log_user_x" value="1" />'+
							'<input type="hidden" id="fb_id" name="fb_id" value="'+uid+'" />'+
						'</p>'+
					'</li>'+
				'</ul>'+
			'</form>'+
		'<div class="clear"></div>';
		
		//alert(form);
		
		boxyLoginMessage = new Boxy(	form, {
			title: 'Влез в Blog.bg',
			closeText: '[затвори]',
			draggable: true,
			modal: true
		});
		
		boxyLoginMessage.moveTo(200, 80);
	
}

/*
 * Prompts the user to grant a permission to the application.
 */
 
 jQuery("#btnTwitterConnectLogin").live('click', function() {

	jQuery.ajax({
			type: "GET", url: "/ajax/twitter_login.php?username=" + $('#login_user').val() + "&password="+$('#login_pass').val(), 
			dataType: "text", contentType: "text/plain",
			success: updateTwitterConnectLogin
		});
		
	return false;
});

updateTwitterConnectLogin = function(data) {
	if (data != 'SUCCESS') {
		Boxy.alert(data);
	}
	else {
		boxyLoginMessage.hide();
		var form = 
				'<div style="width: 500px;">'+
				'<p>Профилът ви в Blog.bg беше успешно обвързан с профила ви във Twitter.</p>'+
				'</div>';
				
		boxyAlert = new Boxy(form, {
			title: 'Съобщение',
			closeText: '[затвори]',
			draggable: true,
			modal: true,
			afterHide: function() { window.location = 'http://blog.bg/'; } });
		
		boxyAlert.moveTo(200, 80);
	}
}
