function sprawdz_value(element,opis){
	if (element.value=='')
		element.value=opis;
}

function naruszenie(element){
	var confirmed = confirm('Czy na pewno chcesz zgłosić naruszenie zasad forum w wybranym poście?');
	if (confirmed){
	 	element.href=element.href + 'potwierdzenie/';		
		return true;
	}
	return false;
}

function get_action()
{
	
	form = document.getElementById("GetForm");
	form.action ="http://www.wp.pl/?ID=lekarz-wyszukiwarka";
	
}


function czcionka($wybor)
{
	
	element = document.getElementById("czcionka");
	
	if($wybor == 1)
	{
		element.className="";
	}
	else if($wybor == 2)
	{
		element.className="czcionka2";
	}
	else if($wybor == 3)
	{
		element.className="czcionka3";
	}
	
}

function woj(woj,idk)
{
	
	var req = mint.Request();
    req.AddParam("woj", woj);
    req.Send("/req.php5", idk);
	
}

function sprawdz_glos()
{
	
	if (!IsEmailCorrect(document.getElementById('email2').value))
	{
		alert('Prosze podac poprawny adres e-mail.');
		return false;
	}
	
	return true;
	
}

function pokaz(idk,pokaz)
{
	
	if(pokaz == 1) $("#"+idk).show("slow");
	
	if(pokaz == 0) $("#"+idk).hide("slow");

	return false
	
}

function IsEmailCorrect(email) {

  return email.match(/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,4})$/)!=null;

}



function IsEmpty(pole) {

  if (pole=='') 

  	return true

	else

	return false

}


function komentarz()
{
	
	if (IsEmpty(document.getElementById('podpis').value)) {
		alert('Prosze podac podpis.');
		return false;
	  }
	
	if (!IsEmailCorrect(document.getElementById('email2').value)) {
		alert('Prosze podac poprawny adres e-mail.');
		return false;
	}
	
	
	if (IsEmpty(document.getElementById('ktxt').value)) {
		alert('Prosze podac Tresc.');
		return false;
	  }
	
	
	return true;
	
}


/* Forum */

function sprawdz_rejestracja()
{
if (!login_test(document.getElementById('login').value) || document.getElementById('login').value.length<5 || document.getElementById('login').value=='admin') {
    alert(' Podany login jest nie poprawny.\n Login może składać się jedynie z liter i cyfr i powinien mieć conajmniej 5 znaków.');
    Focus(document.getElementById('login'));
    return false;
  }
if (document.getElementById('haslo').value.length<5 || document.getElementById('haslo').value!=document.getElementById('haslo_retype').value) {
	alert('Podane hasło jest nie poprawne. \nHasło musi mieć conajmniej 5 znaków');
    Focus(document.getElementById('haslo'));
	return false;
	}
if (!IsEmailCorrect(document.getElementById('email').value))	{
    alert('Proszę podać poprawny adres e-mail.');
    Focus(document.getElementById('email'));
	return false;
	}
if (!document.getElementById('regulamin').checked) {
    alert('Proszę zaakceptować regulamin.');
	return false;
	}
sprawdz_login_istnieje();
return false;
}

function login_test(login)
{
	return login.match(/^[-_a-zA-Z0-9]+$/)!=null;
}

function sprawdz_login_istnieje()
{
	var req = mint.Request();		
	req.OnSuccess =
	function()
    {
		if (this.responseText=='jest')
			{
				alert('Podany login istnieje w naszym systemie. Prosimy wybrać inny.');
			    Focus(document.getElementById('login'));
				return false;
			}
		sprawdz_email_istnieje();
	}
	req.AddParam("rodzaj", 'sprawdz_login');
	req.AddParam("login", jQuery('#login').val());
	req.Send("/ajax.php");
	return false;
}

function sprawdz_email_istnieje()
{
	var req = mint.Request();		
	req.OnSuccess =
	function()
    {		
		if (this.responseText=='jest')
			{
				alert('Podany adres email istnieje w naszym systemie. Prosimy wybrać inny.');
			    Focus(document.getElementById('email'));
				return false;
			}
		jQuery('#register').submit();
	}
	
	req.AddParam("rodzaj", 'sprawdz_email');
	req.AddParam("email", jQuery('#email').val());
	req.Send("/ajax.php");
	return false;
}