var a = new Date();
var b = new Date();
var x = 0;

function setDateStyle(currentDate)
{
  currentDate.setHours(0,0,0,0);
  x = currentDate.getTime();
  var output= new String();
  

  for(var i=0; i<Reserv.length;i++)
  {
    var dummyDate= new Date(Reserv[i][0]);
  //  alert (dummyDate);
    a=dummyDate.getTime();
    var dummyDate2 = new Date(Reserv[i][1]);
    b=dummyDate2.getTime();
    if ((x >= a) && (x <= b))
    {
      return ' disabled reserved ';  
    }
    if (x==a)
    {
      output= output+ ' reservedStart ';  
    }
    if (x==b)
    {
      output= output+ ' reservedEnd ';  
    }
    if (x<a)
      break;  
  }
  for(var i=0; i<Booked.length;i++)
  {
    var dummyDate= new Date(Booked[i][0]);
    a=dummyDate.getTime();
    var dummyDate2 = new Date(Booked[i][1]);
    b=dummyDate2.getTime();
    if ((x >= a) && (x <= b))
    {
    
      return ' disabled booked ';  
    }
    if (x==a)
    {
    
      output= output+ ' bookedStart ';  
    }
    if (x==b)
    {
    
      output= output+ ' bookedEnd ';  
    }
    if (x<a)
      break;  
  }
  for(var i=0; i<Navail.length;i++)
  {
    var dummyDate= new Date(Navail[i][0]);
    a=dummyDate.getTime();
    var dummyDate2 = new Date(Navail[i][1]);
    b=dummyDate2.getTime();
    if ((x >= a) && (x <= b))
    {
    
      return ' disabled notavailable ';  
    }
    if (x==a)
    {
    
      output= output+ ' notavailableStart ';  
    }
    if (x==b)
    {
    
      output= output+ ' notavailableEnd ';  
    }
    if (x<a)
      break;  
  }
    //if this date is the End of the first range and the Start of the second.
    if (output.indexOf('Start')>-1 && output.indexOf('End')>-1)
	{
		var str1 = output.slice(0,output.indexOf('Start'));
		var str2 = output.slice(output.indexOf('Start')+5);
		output=str1+' '+str2+ ' disabled Start ';
		
		return output;
	}
				
  for(var i=0; i<Special.length;i++)
  {
    var dummyDate= new Date(Special[i][0]);
    a=dummyDate.getTime();
    var dummyDate2 = new Date(Special[i][1]);
    b=dummyDate2.getTime();
    if ((x >= a) && (x <= b))
    {
    
     output=output+ ' special ';  
    }
    if (x==a)
    {
    
      output=output+ ' spclStart ';  
    }
    if (x==b)
    {
    
      output=output+ ' spclEnd ';  
    }
    if (x<a)
      break;  
  }
        //if this is a special range
	if (output.indexOf('special')>-1)
	{
		//if start of some range matches start of special range
		if (output.indexOf('Start')!=output.lastIndexOf('Start'))
			{
				var str1 = output.slice(0,output.lastIndexOf('special'));
				output=str1;
				return output; 
			
			}
		//if end of some range matches end of special range
		if (output.indexOf('End')!=output.lastIndexOf('End'))
			{
				var str1 = output.slice(0,output.lastIndexOf('special'));
				output=str1;
				return output; 
			
			}
		//it end or start of some range matches the end or start of special range
		if (output.indexOf('Start')>-1 && output.indexOf('End')>-1)
			{
				var str1 = output.slice(0,output.lastIndexOf('special')+7);
				output=str1;
				
				return output;
			}
	
			
	}
  if (output.length==0)
	output=false;
  // console.log(currentDate,' ',output);	
  return output;

}