Datepicker beforeShowDay not working

Datepicker beforeShowDay not working

Hello to all,
 
I am having problems with beforeShowDay event in Datepicker.
In IE the error is: '0' is null or not an object
IN FF the error is: F is undefined
 
Below is a very simple example that reproduces the problem . Let me know if you need me to post it somewhere on the web, but its just a simple and straight-forward HTML file.
Thanks is advance for any help provided.
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
function setScheduledDays(date){
   var dat = $(this).formatDate("dd-mm-yy", date);
   alert(dat);
}










$(document).ready(function() {
 $("#datepicker").datepicker({
  beforeShowDay: function(date) {
   alert(date);
  }
 });
});
</script>
</head>
<body>
<div id="datepicker"></div>









</body>
</html>