diff --git a/pretty_calendar/pretty_calendar.module b/pretty_calendar/pretty_calendar.module
index 23c66fb..1bfeb25 100644
--- a/pretty_calendar/pretty_calendar.module
+++ b/pretty_calendar/pretty_calendar.module
@@ -141,7 +141,7 @@ function pretty_calendar_block_configure($delta = '') {
     '#type' => 'checkbox',
     '#title' => t('Invert selection.'),
     '#default_value' => variable_get('pretty_calendar_node_invert', FALSE),
-  );
+  );  
 
   // Search date fields.
   $fields = field_info_fields();
@@ -170,7 +170,14 @@ function pretty_calendar_block_configure($delta = '') {
     '#title' => t('Date field'),
     '#default_value' => variable_get('pretty_calendar_field_date', ''),
     '#description' => $field_desc,
+  );  
+  
+   $form['pretty_calendar_node_range'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Use range date'),
+    '#default_value' => variable_get('pretty_calendar_node_range', FALSE),
   );
+  
   $form['pretty_calendar_title_words'] = array(
     '#type' => 'textfield',
     '#size' => 64,
@@ -220,6 +227,7 @@ function pretty_calendar_block_save($delta = '', $edit = array()) {
   variable_set('pretty_calendar_node_type', implode(",", $edit['pretty_calendar_node_type']));
   variable_set('pretty_calendar_node_invert', $edit['pretty_calendar_node_invert']);
   variable_set('pretty_calendar_field_date', $edit['pretty_calendar_field_date']);
+  variable_set('pretty_calendar_node_range', $edit['pretty_calendar_node_range']);
   variable_set('pretty_calendar_node_per_page', $edit['pretty_calendar_node_per_page']);
   variable_set('pretty_calendar_title_words', $edit['pretty_calendar_title_words']);
   variable_set('pretty_calendar_preload_tooltips', $edit['pretty_calendar_preload_tooltips']);
@@ -336,26 +344,63 @@ function pretty_calendar_block_content($month) {
 
   $output = '';
 
-  // Get all nides for selected month.
-  $day_nids = array();
-  for ($i = 1; $i < 32; $i++) {
-    $day_nids[$i] = 0;
+  // Get all nides for selected month.  
+  $days_info = array();
+  
+  for ($i = 0; $i < 32; $i++) {
+	$days_info[$i] = array("isTip" => false, "isRange"=>false, "nids"=>array(), "day"=>array(), "count"=>0,"type"=>"");
   }
+  
   $nids = pretty_calendar_select_month_nodes($month);
+
   if (isset($nids['error'])) {
     $output .= '<center><span style="color:red">' . t('database error') . '</span></center>';
   }
   else {
     foreach ($nids as $row) {
-      $field_name = variable_get('pretty_calendar_field_date', '');
-      if ($field_name != '') {
+      $field_name = variable_get('pretty_calendar_field_date', '');	  
+      if ($field_name != '') { 
         $field_name .= '_value';
+		$field_name2 = $field_name.'2';
       }
-      if (isset($row->$field_name)) {
-        $day_nids[(int) date('d', strtotime($row->$field_name))]++;
+      if (isset($row->$field_name)) {  
+	  
+	  	$cd = (int) date('d', strtotime($row->$field_name));		
+		$mcd = date('m', strtotime($row->$field_name));
+		$ccd = date('m', $month);
+		$isNextMonth = ($mcd<$ccd);	
+			
+		if($isNextMonth)$cd=1;
+	
+				
+				
+		$isRangeUse = variable_get('pretty_calendar_node_range');
+		
+		if($isRangeUse &&
+		   $row->$field_name < $row->$field_name2)
+		{	
+				
+			$cd2 = (int) date('d', strtotime($row->$field_name2))+1;
+			if(!$isNextMonth) $days_info[$cd]['type'] .= add_single_tag($days_info[$cd]['type'],"first");
+			
+			if(date("m", strtotime($row->$field_name)) < date("m", strtotime($row->$field_name2)) && !$isNextMonth) $cd2 = date("t", strtotime($row->$field_name))+1;
+			
+			$days_info[$cd2-1]['type'].=add_single_tag($days_info[$cd]['type'],"last");
+			for($i=$cd; $i<$cd2; $i++)
+			{
+				$days_info[$i]['count']++;
+				$days_info[$i]['type'] .= add_single_tag($days_info[$i]['type'],"range");
+			}
+		}
+		else{
+			$days_info[$cd]['count']++;
+			$days_info[$cd]['type'].=add_single_tag($days_info[$cd]['type'],"alone");
+		}
       }
       elseif (isset($row->created)) {
-        $day_nids[(int) date('d', $row->created)]++;
+	    $cd = (int) date('d', $row->created)+1;
+        $days_info[$cd]['count']++;
+		$days_info[$cd]['type'].=add_single_tag($days_info[$cd]['type'],"alone");
       }
     }
   }
@@ -381,24 +426,28 @@ function pretty_calendar_block_content($month) {
       }
 
       // YYYY/MM/DD format for links.
-      $days_date = '';
-      if (!empty($day)) {
-        $days_date = date('Y/m', $month) . '/' . ($day > 9 ? $day : '0' . $day);
-      }
+      $days_date = "";
+	  if (!empty($day)) {
+        $days_date = date('Y/m', $month) . '/' . ($day > 9 ? $day: '0' . $day);
+        $cls.=$days_info[$day]["type"];
+	  }	  
+	  
       $days[] = theme('pretty_calendar_day', array(
         'number' => $day,
         'date' => $days_date,
         'delta' => $j + 1,
         'class' => $cls,
-        'count' => !empty($day) ? $day_nids[$day] : 0,
+        'count' => !empty($day) ? $days_info[$day]['count'] : 0,
         'using_tooltip' => $use_tooltips,
-        'is_empty' => empty($day),
+        'is_empty' => empty($day)
       ));
-    }
+    }	
+
     $output .= theme('pretty_calendar_week', array(
       'days' => $days,
       'delta' => $i + 1,
     ));
+	
     $days = array();
   }
 
@@ -411,6 +460,11 @@ function pretty_calendar_block_content($month) {
   ));
 }
 
+ function add_single_tag($str,$tag){
+	return (strpos($str, $tag) === false)?" $tag":"";
+	//return "";
+ }
+
 /**
  * AJAX response for calendar navigation.
  *
@@ -510,7 +564,8 @@ function pretty_calendar_select_nodes($date = 0, $links_only = FALSE) {
   global $language;
   $field_name = variable_get('pretty_calendar_field_date', '');
   $node_types = explode(',', variable_get('pretty_calendar_node_type', ''));
-
+  $isUseRange = variable_get('pretty_calendar_node_range');
+  
   // Check if field was deleted.
   if (field_info_field($field_name) == '') {
     $field_name = '';
@@ -533,11 +588,18 @@ function pretty_calendar_select_nodes($date = 0, $links_only = FALSE) {
     }
     else {
       $select->distinct();
-      $select->leftJoin('field_data_' . $field_name, 'fd', 'fd.entity_id = n.nid');
-      $select->fields('fd', array($field_name . '_value'));
-      $select->where('DATE(' . $field_name . '_value) = :date', array(':date' => date('Y.m.d', $date)));
+      $select->leftJoin('field_data_' . $field_name, 'fd', 'fd.entity_id = n.nid');      
+	  $select->fields('fd', array($field_name . '_value'));
+	  if(!$isUseRange)
+	  {	  
+		$select->where('DATE(' . $field_name . '_value) = :date', array(':date' => date('Y.m.d', $date)));		
+	  }
+	  else{
+		$select->where('DATE(' . $field_name . '_value) = :date OR (DATE(' . $field_name . '_value) <= :date AND DATE(' . $field_name . '_value2) >= :date   )', array(':date' => date('Y.m.d', $date)));
+	  }
     }
   }
+  
   // Check types.
   if ($node_types[0] != '') {
     if (variable_get('pretty_calendar_node_invert', FALSE)) {
@@ -561,11 +623,11 @@ function pretty_calendar_select_nodes($date = 0, $links_only = FALSE) {
     $result = array();
     foreach ($select->execute() as $row) {
       $result[] = $row;
-    }
+    }	
+	
     return $result;
   }
 }
-
 /**
  * Select all month nodes.
  *
@@ -579,7 +641,8 @@ function pretty_calendar_select_month_nodes($date = 0) {
   global $language;
   $field_name = variable_get('pretty_calendar_field_date', '');
   $node_types = explode(',', variable_get('pretty_calendar_node_type', ''));
-
+  $isUseRange = variable_get('pretty_calendar_node_range');
+  
   // Check if field was deleted.
   if (field_info_field($field_name) == '') {
     $field_name = '';
@@ -603,8 +666,14 @@ function pretty_calendar_select_month_nodes($date = 0) {
     else {
       $select->distinct();
       $select->leftJoin('field_data_' . $field_name, 'fd', 'fd.entity_id = n.nid');
-      $select->fields('fd', array($field_name . '_value'));
-      $select->where('DATE_FORMAT(fd.' . $field_name . '_value, \'%Y%m\') = :stamp', array(':stamp' => date('Ym', $date)));
+      $select->fields('fd', array($field_name . '_value', $field_name . '_value2'));
+	  if(!$isUseRange)
+	  {	  
+		$select->where('DATE_FORMAT(fd.' . $field_name . '_value, \'%Y%m\') = :stamp', array(':stamp' => date('Ym', $date)));	
+	  }
+	  else{
+		 $select->where('DATE_FORMAT(fd.' . $field_name . '_value, \'%Y%m\') = :stamp  OR DATE_FORMAT(fd.' . $field_name . '_value2, \'%Y%m\') = :stamp', array(':stamp' => date('Ym', $date)));
+	  }
     }
   }
   // Check types.
@@ -628,7 +697,7 @@ function pretty_calendar_select_month_nodes($date = 0) {
   catch (Exception $e) {
     $result['error'] = $e;
   }
-
+  
   return $result;
 }
 
