function getPwdDialog(url)
{
	$.post(
		"auth.php", 
		{check:"1"}, 
		function(stat)
		{
			switch(stat)
			{
				case "0":
					get_user_pwd(url);
				break;
				case "1":
					window.location = url;
				break;
			}
		}
	);
}

function get_user_pwd(url)
{
	var pwd = prompt("Enter Password:", "");

	if ( pwd )
	{
		if ( pwd.length > 3 )
		{
			 $.post(
				"auth.php", 
				{key:pwd}, 
				function(data)
				{ 
					if ( data == "1" )
					{
						window.location = url;
					}
					else 
					{
						alert("Wrong Password !");  
						get_user_pwd(url);
					}
				}
			);
		}
		else
		{
			alert("Required minimum 2 symbols !");
			get_user_pwd(url);
		}
	}

}