$(document).ready(function() {
	$('#login .submit').hover(
		function(){
			$(this).attr('src', '/images/login-submit-hover.png');
		},
		function(){
			$(this).attr('src', '/images/login-submit.png');
		}
	);
});
function dateDayAdd(posun)
{
  var a = document.getElementById ("date_created").value;
  var datum = a.split(".");
  var d = new Date(datum[2],datum[1],parseInt(datum[0])+posun);
  var b = document.getElementById ("date_limit");
  b.value= d.getDate()+"."+d.getMonth()+"."+d.getFullYear();
  var c = document.getElementById ("date_tax");
  c.value= a;
}

function delete_user(id)
{	
    var x=confirm("Opravdu chcete tohoto uživatele smazat?");
    if (x) {
        window.location.href = "?action=del_user&u=" +id;
    }
}

function delete_invoice(id)
{
    var x=confirm("Opravdu chcete tuto fakturu smazat?");
    if (x) {
        window.location.href = "?action=del_inv&inv=" +id;
    }
}

function delete_cost(cash_id, search, cost_id)
{
    var x=confirm("Opravdu chcete tuto transakci smazat?");
    if (x) {
        window.location.href = "?cash_id="+cash_id+"&search="+search+"&cost_delete=" +cost_id;
    }
}


function delete_cash(id)
{
    var x=confirm("Opravdu chcete tuto fakturu smazat?");
    if (x) {
        window.location.href = "?delete&cash_delete=" +id;
    }
}


function check_cash_cost()
{
    if (f.name.value == "") {
        alert('Vypl\u0148te název transakce!');
        return false;
    }

    if (f.sum.value == "" || f.sum.value == "0.00") {
        alert('Vypl\u0148te částku transakce!');
        return false;
    }

    return true;
}

// zformatuje datum na 31.12.2008 nebo na 2008-01-31
// @param $date .... 2008-01-31 => 31.01.2008, 31.01.2008 => 2008-01-31
/*
function formatDate($date, $hours = 0) {
	
	// pokud je v datumu pomlcke jedna se o format 2008-12-31
	if(eregi("[0-9]{4}-[0-9]{2}-[0-9]{2}", $date)) {

		$date_parse = date_parse($date);
		
		if($hours == 1) {
			if($date_parse[hour] < 10) {
				$zero = '0';
			}
			if($date_parse[minute] < 10) {
				$zero1 = '0';
			}
			$time = $zero.$date_parse[hour].":".$zero1.$date_parse[minute]."&nbsp;&nbsp;&nbsp;";
		}
			
		
		return $time.$date_parse[day].".".$date_parse[month].".".$date_parse[year];	

	} else {
		
		$date_parse = explode(".", $date);
		return $date_parse[2]."-".$date_parse[1]."-".$date_parse[0];
		
	}

}*/

