// JavaScript Document
var DatumHandler = function(d) {
    //alert('start');
    this.setOk=true;
    this.timestamp=-1;
    
    if ((d == "") || (d == null) ) {
      alert("Datum neni vyplněn!");
      this.setOk=false;
      
    } else if (/\d{1,2}\.\d{1,2}\.\d{4}/i.exec(d) == null){
   
      alert("Datum má špatný formát!");
      this.setOk=false;
      
    } else {
    
        this.setOk=true;
        var myDate=new Date();
        var vd = d.split(".");
        
        myDate.setFullYear(vd[2],(vd[1]-1),vd[0]);
        
        this.d=d;
        this.Y=vd[2];
        this.m=vd[1];
        this.d=vd[0];
        this.timestamp=myDate;
        
        
    }
    return this;
}

DatumHandler.prototype.jePracovni = function (){
   
    var dayinweek = this.timestamp.getDay()*1;
    if( dayinweek == 6 || dayinweek == 0 ) {
      return false;   
    } 
    return true;
}


DatumHandler.prototype.jePatek = function (){
  
    var dayinweek = this.timestamp.getDay()*1;
 
    if(dayinweek ==5) {
      return true;
    }
    return false;

}


