function confirmSubmit()
{
	var agree=confirm("Na pewno usunąć ten element?");
	if (agree)
			return true ;
	else
			return false ;

}

function toggle(dv)
{
	adiv=document.getElementById(dv);
	if (adiv.style.display!='none')
	{
		$("#"+dv).hide("slow");
//		adiv.style.display='none';
	}
	else
	{
		$("#"+dv).show("slow");
		//adiv.style.display='';
	}
}

function PrintContent()
{
      var DocumentContainer = document.getElementById('printContent');
      var WindowObject = window.open('', "TrackHistoryData",
      "width=740,height=325,top=200,left=250,toolbars=no,scrollbars=yes,status=no,resizable=no");
      WindowObject.document.writeln(DocumentContainer.innerHTML);
      WindowObject.document.close();
      WindowObject.focus();
      WindowObject.print();
      WindowObject.close();
}

function showRegisterFields()
{
	$("#loginFields").hide("slow");
    $("#registerButton").hide();
	$("#registerFields").show();
}

function checkLogin()
{
	login=$("#regLogin")[0].value;
    $.ajax({
            method:"get",
            url:"templates/checkData.php",
            data:"login="+login,
            success: function(html)
           {
				$("#regLoginDiv")[0].innerHTML=html;
           }
    });
}

function checkMail()
{
	mail=$("#regMail")[0].value;
    $.ajax({
            method:"get",
            url:"templates/checkData.php",
            data:"mail="+mail,
            success: function(html)
           {
				$("#regMailDiv")[0].innerHTML=html;
           }
    });
}

function checkRegisterData()
{
	pass=$("#regPassword")[0].value;
	pass2=$("#regPassword2")[0].value;
	ml=$("#regMail")[0].value;
	lg=$("#regLogin")[0].value;
	mail=$("#regMailDiv")[0].innerHTML;
	login=$("#regLoginDiv")[0].innerHTML;
	if (mail.search("ok.png")!="-1") {} else {return false;}
	if (login.search("ok.png")!="-1") {} else {return false;}
	if (pass=="" || pass2=="") {$("#resDiv")[0].innerHTML='<font color="red">Uzupełnij hasła</font>'; return false;}
	if (pass!=pass2) {$("#resDiv")[0].innerHTML='<font color="red">Podane hasła nie są takie same</font>'; return false;}
    if (ml=="") { $("#resDiv")[0].innerHTML='<font color="red">Uzupełnij adres email</font>'; return false;}
    if (lg=="") { $("#resDiv")[0].innerHTML='<font color="red">Uzupełnij login</font>'; return false;}

	return true;
}


