function getroomrate_second($rooms, $yearnum, $monthnum, $todaynum, $id, $departure = "")
 {
     //Si departure viene vacio quiere decir que es primera vez que carga la pagina completa del hotel
     //Hago esta validacion para poder determinar en los resultados cuantas habitaciones estan disponibles
     if ($departure != "") {
         global $hgconf;
         $JApp =& JFactory::getApplication();
         $JUser =& JFactory::getUser();
         $JDate = JFactory::getDate();
         $JDate->setOffset($JApp->getCfg('offset'));
         $time = mktime(0, 0, 0, $monthnum, $todaynum, $yearnum);
         $today = date('j', $time);
         $day = $JDate->_dayToString(date('w', $time), true);
         $month = $JDate->_monthToString(date('m', $time), true);
         $departure_array = split(",", $departure);
         $arrival_date = strtotime($yearnum . '-' . $monthnum . '-' . $today);
         $departure_date = strtotime($departure_array[2] . '-' . $departure_array[1] . '-' . $departure_array[0]);
         //Numero de noche de la estadia
         $number_nights = hg_html::count_days($arrival_date, $departure_date);
         //Numero de habitaciones encontradas
         $room_no = count($rooms);
         $details_row = 0;
         //Si no existen detalles de rates ni de cancellation policy esa fila se elimina restandole a el div de class tx
         for ($f = 0; $f < $room_no; $f++) {
             if (!$rooms[$f]->rate_details and !$rooms[$f]->cancellation) {
                 $details_row = 24 + $details_row;
             }
         }
         //Altura del div tx que muestra el boton book now
         $txheight = 74 * $room_no + 25 * $room_no - 25 - $details_row;
         $txtopmargin = 30 * $room_no;
         $output = hg_html::boxtop();
         //Si el hotel es Upon Request entonces:
         $output .= '<h3 class="title" id="choose_room">' . "\n";
         if (!$rooms[0]->upon_request) {
             $output .= JText::_('HG_CHOOSE_YOUR_ROOM_AND_RATE') . " " . $rooms[0]->currencyname;
         } else {
             $output .= JText::_('HG_UPON REQUEST_MESSAGE') . " " . $rooms[0]->hotelname;
         }
         $output .= '<br /></h3>' . "\n";
         $output .= '<table class="table" id="table" style="border-collapse: collapse;">' . "\n";
         $output .= '<thead><tr>' . "\n";
         //Si el hotel es Upon Request entonces:
         if ($rooms[0]->upon_request) {
             $width_td = 60;
             $output .= '<td class="td" style="width: ' . $width_td . '%; height:14px; line-height:14px;">' . JText::_('HG_ROOM_TYPE') . '</th>' . "\n";
         } else {
             $width_td = 44.5;
             $output .= '<td class="td" style="width: ' . $width_td . '%; height:14px; line-height:14px;">' . JText::_('HG_ROOM_TYPE') . '</th>' . "\n";
             //Titulo columna numero maximo de personas para la habitacion
             $output .= '<td class="td" style="height:14px; line-height:14px;"></th>' . "\n";
             if ($number_nights == 1) {
                 $output .= '<td class="td" style="width:16%; height:14px; line-height:14px;">' . JText::_('HG_RATE') . '</th>' . "\n";
             } else {
                 $output .= '<td class="td" style="width:16%; height:34px; padding:0px; margin-top:4px">' . JText::sprintf('HG_AVERAGE_DAILY_RATE', $number_nights) . '</th>' . "\n";
             }
         }
         $output .= '<td class="td" style="width:15%; height:14px; line-height:14px;">' . JText::_('HG_NO_OF_ROOMS') . '</th>
                                     <td class="td" style="width:15%; height:14px; line-height:14px; margin-right:-2px;"></th>
                                 </tr></thead>' . "\n";
         $no_roomsrate_array = array();
         $order = 0;
         for ($i = 0; $i < $room_no; $i++) {
             $beds = $rooms[$i]->beds;
             $bed_count = count($beds);
             if ($bed_count <= 1) {
                 $subheight = 20;
             } else {
                 $subheight = 20;
             }
             if ($bed_count >= 1) {
                 if ($bed_count == 2) {
                     $height = 71;
                 } else {
                     $height = $bed_count * 36 + ($bed_count - 1) * 2;
                 }
                 if ($height <= 70) {
                     $height = 50;
                 }
                 $output .= '<tr class="tr">' . "\n";
                 $output .= '<td class="td" rowspan="' . $bed_count . '" style="width: ' . $width_td . '%; height: ' . $height . 'px; border-left: 1px solid #ffffff; text-align:left;">' . "\n";
                 if ($rooms[$i]->filename) {
                     $output .= '
                                                         <a href="' . JURI::base() . 'images/hotelguide/gallery/hotel_' . $rooms[$i]->hotel . '/album/' . $rooms[$i]->filename . '" rel="lightbox-atomium' . $rooms[$i]->id . '" title="' . $rooms[$i]->title . '">
                                                             <img class="img_left imgshadow" style="width:64px; border-color:' . $hgconf->bordercolor . '; float:left;" src="' . JURI::base() . 'images/hotelguide/gallery/hotel_' . $rooms[$i]->hotel . '/resize/' . $rooms[$i]->filename . '" title="' . $rooms[$i]->title . '" alt="' . $rooms[$i]->title . '"/>
                                                         </a>' . "\n";
                     for ($m = 2; $m <= 6; $m++) {
                         eval("\$filename=\$rooms[\$i]->filename" . $m . ";");
                         if ($filename) {
                             $output .= '
                                                         <a href="' . JURI::base() . 'images/hotelguide/gallery/hotel_' . $rooms[$i]->hotel . '/album/' . $filename . '" rel="lightbox-atomium' . $rooms[$i]->id . '" title="' . $rooms[$i]->title . '" style="display:none">
                                                             <img class="img_left imgshadow" style="width:64px; border-color:' . $hgconf->bordercolor . '; float:left;" src="' . JURI::base() . 'images/hotelguide/gallery/hotel_' . $rooms[$i]->hotel . '/resize/' . $filename . '" title="' . $rooms[$i]->title . '" alt="' . $rooms[$i]->title . '"/>
                                                         </a>' . "\n";
                         }
                     }
                 }
                 $output .= '
                                                         <span class="roomtitle" style="font-weight:bold; margin-left: 10px">' . $rooms[$i]->title . '</span>' . "\n";
                 /*if ($beds[0]->breakfast==2) {
                        $output .= '<p style="font-style:italic; font-weight:normal; padding:0px; margin:0px;">&nbsp;&nbsp;'.JText::_('HG_BREAKFAST_INCLUDED').'</p>'. "\n";
                   }*/
                 $output .= '</td>';
                 if (!$rooms[0]->upon_request) {
                     //Para reunir toda la informacion adicional sobre el precio especifico
                     $info_rate = "";
                     if ($beds[0]->bedtype != $rooms[$i]->title) {
                         if (trim($beds[0]->bedtype) != "") {
                             $info_rate .= "<b>" . $beds[0]->bedtype . "</b>";
                         }
                     }
                     //Valida si hay informacion acerca del precio
                     if (trim($beds[0]->inclusion) != "") {
                         if ($info_rate != "") {
                             $info_rate .= "<br><b>" . JText::_('HG_INCLUSION') . "</b>: " . $beds[0]->inclusion;
                         } else {
                             $info_rate .= "<b>" . JText::_('HG_INCLUSION') . "</b>: " . $beds[0]->inclusion;
                         }
                     }
                     //Muestra el numero maximo de personas para la habitacion
                     if ($beds[0]->maxguest > 1) {
                         $info_maxguest = JText::sprintf('HG_MAX_PERSONS', $beds[0]->maxguest);
                     } else {
                         $info_maxguest = JText::_('HG_SINGLE_OCCUPANCY');
                     }
                     $output .= '<td class="td" style="height:' . $subheight . 'px;">';
                     $output .= '<div class="container_maxguest">
                                                 <div class="column_maxguest span-12_maxguest">
                                                     <p class="max_persons_title max' . $beds[0]->maxguest . '" style="width:44px; margin:0; line-height:' . $subheight . 'px; cursor: help;" title="' . $info_maxguest . '" alt="">&nbsp;</p>
                                                 </div>';
                     if ($info_rate != "") {
                         $output .= '<div class="column_maxguest last_maxguest span-12_maxguest">
                                                     <img class="info_rate" src="' . JURI::base() . '/components/com_hotelguide/assets/images/info.gif" title="' . $info_rate . '" style="cursor: help;">
                                                 </div>';
                     }
                     $output .= '</div> ';
                     $output .= '</td>' . "\n";
                 }
                 //Si el hotel es Upon Request entonces:
                 if ($rooms[0]->upon_request) {
                     $output .= '<td class="td" style="width:15%; height:' . $subheight . 'px;"><div style="margin-top:' . $topmargin . 'px; text-align:center;">' . "\n";
                     $order = $i;
                     $output .= '<select name="roomnumber' . $order . '" id="roomnumber' . $order . '" style="width:70px" class="' . $rooms[$i]->id . '">';
                     //Para definir una cantidad de habitaciones especifica
                     $quantity_number = $rooms[$i]->quantity;
                     if ($quantity_number == 0) {
                         //Default quantity
                         $quantity_number = 10;
                     }
                     for ($k = 0; $k <= $quantity_number; $k++) {
                         if ($k == 0) {
                             $output .= '<option value="0" >0</option>';
                         } else {
                             $output .= '<option value="' . $k . '" >' . $k . '</option>';
                         }
                     }
                     $output .= '</select>' . "\n";
                     $output .= '</div></td>' . "\n";
                 } else {
                     $bed =& $beds[0];
                     switch ($monthnum) {
                         case 1:
                             $rate = explode(",", $bed->rate1);
                             $discount = explode(",", $bed->discount1);
                             $room = explode(",", $bed->room1);
                             $nextrate = explode(",", $bed->rate2);
                             $nextdiscount = explode(",", $bed->discount2);
                             break;
                         case 2:
                             $rate = explode(",", $bed->rate2);
                             $discount = explode(",", $bed->discount2);
                             $room = explode(",", $bed->room2);
                             $nextrate = explode(",", $bed->rate3);
                             $nextdiscount = explode(",", $bed->discount3);
                             break;
                         case 3:
                             $rate = explode(",", $bed->rate3);
                             $discount = explode(",", $bed->discount3);
                             $room = explode(",", $bed->room3);
                             $nextrate = explode(",", $bed->rate4);
                             $nextdiscount = explode(",", $bed->discount4);
                             break;
                         case 4:
                             $rate = explode(",", $bed->rate4);
                             $discount = explode(",", $bed->discount4);
                             $room = explode(",", $bed->room4);
                             $nextrate = explode(",", $bed->rate5);
                             $nextdiscount = explode(",", $bed->discount5);
                             break;
                         case 5:
                             $rate = explode(",", $bed->rate5);
                             $discount = explode(",", $bed->discount5);
                             $room = explode(",", $bed->room5);
                             $nextrate = explode(",", $bed->rate6);
                             $nextdiscount = explode(",", $bed->discount6);
                             break;
                         case 6:
                             $rate = explode(",", $bed->rate6);
                             $discount = explode(",", $bed->discount6);
                             $room = explode(",", $bed->room6);
                             $nextrate = explode(",", $bed->rate7);
                             $nextdiscount = explode(",", $bed->discount7);
                             break;
                         case 7:
                             $rate = explode(",", $bed->rate7);
                             $discount = explode(",", $bed->discount7);
                             $room = explode(",", $bed->room7);
                             $nextrate = explode(",", $bed->rate8);
                             $nextdiscount = explode(",", $bed->discount8);
                             break;
                         case 8:
                             $rate = explode(",", $bed->rate8);
                             $discount = explode(",", $bed->discount8);
                             $room = explode(",", $bed->room8);
                             $nextrate = explode(",", $bed->rate9);
                             $nextdiscount = explode(",", $bed->discount9);
                             break;
                         case 9:
                             $rate = explode(",", $bed->rate9);
                             $discount = explode(",", $bed->discount9);
                             $room = explode(",", $bed->room9);
                             $nextrate = explode(",", $bed->rate10);
                             $nextdiscount = explode(",", $bed->discount10);
                             break;
                         case 10:
                             $rate = explode(",", $bed->rate10);
                             $discount = explode(",", $bed->discount10);
                             $room = explode(",", $bed->room10);
                             $nextrate = explode(",", $bed->rate11);
                             $nextdiscount = explode(",", $bed->discount11);
                             break;
                         case 11:
                             $rate = explode(",", $bed->rate11);
                             $discount = explode(",", $bed->discount11);
                             $room = explode(",", $bed->room11);
                             $nextrate = explode(",", $bed->rate12);
                             $nextdiscount = explode(",", $bed->discount12);
                             break;
                         case 12:
                             $rate = explode(",", $bed->rate12);
                             $discount = explode(",", $bed->discount12);
                             $room = explode(",", $bed->room12);
                             $nextrate = explode(",", $bed->rate1);
                             $nextdiscount = explode(",", $bed->discount1);
                             break;
                     }
                     $topmargin = $subheight / 2 - 12;
                     $maxmargin = $subheight / 2 - 5;
                     $daysofmonth = count($rate) . "\n";
                     $leftdays = $daysofmonth - $today + 1;
                     //comente esta condicion porque no me mostraba precios para mas de 7 dias de estadia
                     //if ($leftdays < 7) {
                     $rate = array_merge($rate, $nextrate);
                     $discount = array_merge($discount, $nextdiscount);
                     //}
                     $sum_rate = 0;
                     $room_no_available = false;
                     for ($r = 0; $r < $number_nights; $r++) {
                         if ($r == 1) {
                             //Acumula los rates por dia
                             $sum_rate = $rate[$today] + $sum_rate;
                             //Verificando si existe algun dia con el rate en 0
                             if ($rate[$today] == 0.0) {
                                 $room_no_available = true;
                             }
                         } else {
                             //Acumula los rates por dia
                             $sum_rate = $rate[$today + ($r - 1)] + $sum_rate;
                             //Verificando si existe algun dia con el rate en 0
                             if ($rate[$today + ($r - 1)] == 0.0) {
                                 $room_no_available = true;
                             }
                         }
                     }
                     //Media promedio de precios x dias de estadia
                     $new_prom_rates = hg_html::getCurrency($id, $sum_rate / $number_nights);
                     //Valor de descuento por defecto para todos los hoteles
                     //$discount[$today-1]=10;
                     if ($discount[$today - 1] > 0) {
                         $output .= '<td class="td" style="width:16%; height:' . $subheight . 'px;"><p style="text-align:center; margin:0; line-height:' . $subheight . 'px;"><span style="text-decoration:line-through;">' . hg_html::getCurrency($id, $rate[$today - 1]) . '</span>';
                     } else {
                         $output .= '<td class="td" style="width:16%; height:' . $subheight . 'px;"><p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; margin:0; line-height:' . $subheight . 'px; font-weight:bold; ">' . $new_prom_rates;
                     }
                     if ($discount[$today - 1] > 0) {
                         $newrate = $rate[$today - 1] * (100 - $discount[$today - 1]) / 100;
                         $output .= '&nbsp;&nbsp;&nbsp;<span style="font-size:1.2em; color:' . $hgconf->pricecolor . '; font-weight:bold; line-height:' . $subheight . 'px;">' . hg_html::getCurrency($id, $newrate) . '</span>';
                     }
                     $output .= '</p></td>' . "\n";
                     $output .= '<td class="td" style="width:15%; height:' . $subheight . 'px;"><div style="margin-top:' . $topmargin . 'px; text-align:center;">';
                     $combo_rate_sum = 0;
                     for ($z = 0; $z <= $room[$today - 1]; $z++) {
                         $combo_rate_sum += $k * $new_prom_rates;
                     }
                     //Order: asignado a los combobox identificandolos como unicos.
                     //Si el order es mayor que cero se le suma uno esto para saltar de habitacion en habitacion
                     //y que te de el numero que sigue
                     if ($i > 0) {
                         $order++;
                     }
                     if (!$room_no_available) {
                         $output .= '<select name="roomnumber' . $order . '" id="roomnumber' . $order . '" style="width:70px" class="' . $rooms[$i]->beds[0]->id . '">';
                         $combo_rate = 0;
                         for ($k = 0; $k <= $room[$today - 1]; $k++) {
                             if ($k == 0) {
                                 $output .= '<option value="0" >0</option>';
                             } else {
                                 $combo_rate = $k * $new_prom_rates;
                                 $output .= '<option value="' . $k . '" >' . $k . '</option>';
                                 /*if ($discount[$today-1] > 0) {
                                       $output .= '<option value="'.$k.'" >'.$k.' ('.hg_html::getCurrency($id, $combo_rate).')</option>';
                                   } else {
                                       $output .= '<option value="'.$k.'" >'.$k.' ('.hg_html::getCurrency($id, $combo_rate).')</option>';
                                   }*/
                             }
                         }
                         $output .= '</select>';
                         //Muestra mensaje si hay entre 1 y 9 habitaciones
                         if ($room[$today - 1] == 1) {
                             $output .= '<br /><span class="last_change_room">' . JText::sprintf('HG_LAST_CHANGE_ROOM', $room[$today - 1]) . '</span>';
                         } else {
                             if ($room[$today - 1] > 1 and $room[$today - 1] <= 9) {
                                 $output .= '<br /><span class="last_change_room">' . JText::sprintf('HG_ONLY_LEFT', $room[$today - 1]) . '</span>';
                             }
                         }
                     } else {
                         $output .= JText::_('HG_NOT_AVAILABLE');
                         $output .= '<select name="roomnumber' . $order . '" id="roomnumber' . $order . '" style="width:50px; display:none" class="' . $rooms[$i]->id . '">';
                         $output .= '<option value="0" >0</option>';
                         $output .= '</select>';
                         array_push($no_roomsrate_array, '0');
                     }
                     $output .= '</div></td>' . "\n";
                 }
                 //Crea rowspan en la celda para mostrar boton Next
                 if ($i == 0) {
                     for ($hx = 0; $hx < $room_no; $hx++) {
                         //Si el hotel NO es Upon Request entonces:
                         if (!$rooms[0]->upon_request) {
                             /*if ($rooms[$hx]->rate_details or $rooms[$hx]->cancellation) {
                                   $rowspan++;
                               }*/
                             $bedsx = $rooms[$hx]->beds;
                             for ($bx = 0; $bx < count($bedsx); $bx++) {
                                 $rowspan++;
                             }
                         } else {
                             $rowspan++;
                         }
                     }
                     $output .= '<td class="tx" rowspan="' . $rowspan . '">' . "\n";
                     $output .= '<button class="button_css_style_header" type="button" id="bookingbutton" onclick="submitbutton(\'' . $id . '\', \'' . $rooms[$i]->id . '\', \'-1\', \'' . $bed->id . '\', \'roomnumber' . $order . '\', \'' . $rowspan . '\'); return false;" style="line-height:0px;">';
                     //Si el hotel es Upon Request entonces:
                     if ($rooms[0]->upon_request) {
                         $output .= JText::_('HG_SEND_REQUEST');
                     } else {
                         $output .= JText::_('HG_BOOK_NOW');
                     }
                     $output .= '</button>' . "\n";
                     $output .= '<span class="message_under_buttom_book"><br />' . JText::_('HG_BOOK_NOW_BOTTOM_MESSAGE') . '</span>';
                 }
                 $output .= '</tr>' . "\n";
             }
             //Esta condicion es para colocar precios por personas si existen
             if ($bed_count > 1) {
                 for ($b = 1; $b < $bed_count; $b++) {
                     //Order: asignado a los combobox identificandolos como unicos
                     $order++;
                     $output .= '<tr>' . "\n";
                     if (!$rooms[0]->upon_request) {
                         //Para reunir toda la informacion adicional sobre el precio especifico
                         $info_rate2 = "";
                         if ($beds[$b]->bedtype != $rooms[$i]->title) {
                             if (trim($beds[$b]->bedtype) != "") {
                                 $info_rate2 .= "<b>" . $beds[$b]->bedtype . "</b>";
                             }
                         }
                         //Valida si hay informacion acerca del precio
                         if (trim($beds[$b]->inclusion) != "") {
                             if ($info_rate2 != "") {
                                 $info_rate2 .= "<br><b>" . JText::_('HG_INCLUSION') . "</b>: " . $beds[$b]->inclusion;
                             } else {
                                 $info_rate2 .= "<b>" . JText::_('HG_INCLUSION') . "</b>: " . $beds[$b]->inclusion;
                             }
                         }
                         //Muestra el numero maximo de personas para la habitacion
                         if ($beds[$b]->maxguest > 1) {
                             $info_maxguest2 = JText::sprintf('HG_MAX_PERSONS', $beds[$b]->maxguest);
                         } else {
                             $info_maxguest2 = JText::_('HG_SINGLE_OCCUPANCY');
                         }
                         $output .= '<td class="td" style="height:' . $subheight . 'px;">';
                         $output .= '<div class="container_maxguest">
                                             <div class="column_maxguest span-12_maxguest">
                                                 <p class="max_persons_title max' . $beds[$b]->maxguest . '" style="width:44px; margin:0; line-height:' . $subheight . 'px; cursor: help;" title="' . $info_maxguest2 . '" alt="">&nbsp;</p>
                                             </div>';
                         if ($info_rate2 != "") {
                             $output .= '<div class="column_maxguest last_maxguest span-12_maxguest">
                                                 <img class="info_rate" src="' . JURI::base() . '/components/com_hotelguide/assets/images/info.gif" title="' . $info_rate2 . '" style="cursor: help;">
                                             </div>';
                         }
                         $output .= '</div> ';
                         $output .= '</td>' . "\n";
                     }
                     //Si el hotel es Upon Request entonces:
                     if ($rooms[0]->upon_request) {
                         $output .= '<td class="td" style="width:15%; height:' . $subheight . 'px;"><div style="margin-top:' . $topmargin . 'px; text-align:center;">' . "\n";
                         $order = $i . $j;
                         $output .= '<select name="roomnumber' . $order . '" id="roomnumber' . $order . '" style="width:70px" class="' . $rooms[$i]->id . '">';
                         //Para definir una cantidad de habitaciones especifica
                         $quantity_number = $rooms[$i]->quantity;
                         if ($quantity_number == 0) {
                             //Default quantity
                             $quantity_number = 10;
                         }
                         for ($k = 0; $k <= $quantity_number; $k++) {
                             if ($k == 0) {
                                 $output .= '<option value="0" >0</option>';
                             } else {
                                 $output .= '<option value="' . $k . '" >' . $k . '</option>';
                             }
                         }
                         $output .= '</select>' . "\n";
                         $output .= '</div></td>' . "\n";
                     } else {
                         $bed =& $beds[$b];
                         switch ($monthnum) {
                             case 1:
                                 $rate = explode(",", $bed->rate1);
                                 $discount = explode(",", $bed->discount1);
                                 $room = explode(",", $bed->room1);
                                 $nextrate = explode(",", $bed->rate2);
                                 $nextdiscount = explode(",", $bed->discount2);
                                 break;
                             case 2:
                                 $rate = explode(",", $bed->rate2);
                                 $discount = explode(",", $bed->discount2);
                                 $room = explode(",", $bed->room2);
                                 $nextrate = explode(",", $bed->rate3);
                                 $nextdiscount = explode(",", $bed->discount3);
                                 break;
                             case 3:
                                 $rate = explode(",", $bed->rate3);
                                 $discount = explode(",", $bed->discount3);
                                 $room = explode(",", $bed->room3);
                                 $nextrate = explode(",", $bed->rate4);
                                 $nextdiscount = explode(",", $bed->discount4);
                                 break;
                             case 4:
                                 $rate = explode(",", $bed->rate4);
                                 $discount = explode(",", $bed->discount4);
                                 $room = explode(",", $bed->room4);
                                 $nextrate = explode(",", $bed->rate5);
                                 $nextdiscount = explode(",", $bed->discount5);
                                 break;
                             case 5:
                                 $rate = explode(",", $bed->rate5);
                                 $discount = explode(",", $bed->discount5);
                                 $room = explode(",", $bed->room5);
                                 $nextrate = explode(",", $bed->rate6);
                                 $nextdiscount = explode(",", $bed->discount6);
                                 break;
                             case 6:
                                 $rate = explode(",", $bed->rate6);
                                 $discount = explode(",", $bed->discount6);
                                 $room = explode(",", $bed->room6);
                                 $nextrate = explode(",", $bed->rate7);
                                 $nextdiscount = explode(",", $bed->discount7);
                                 break;
                             case 7:
                                 $rate = explode(",", $bed->rate7);
                                 $discount = explode(",", $bed->discount7);
                                 $room = explode(",", $bed->room7);
                                 $nextrate = explode(",", $bed->rate8);
                                 $nextdiscount = explode(",", $bed->discount8);
                                 break;
                             case 8:
                                 $rate = explode(",", $bed->rate8);
                                 $discount = explode(",", $bed->discount8);
                                 $room = explode(",", $bed->room8);
                                 $nextrate = explode(",", $bed->rate9);
                                 $nextdiscount = explode(",", $bed->discount9);
                                 break;
                             case 9:
                                 $rate = explode(",", $bed->rate9);
                                 $discount = explode(",", $bed->discount9);
                                 $room = explode(",", $bed->room9);
                                 $nextrate = explode(",", $bed->rate10);
                                 $nextdiscount = explode(",", $bed->discount10);
                                 break;
                             case 10:
                                 $rate = explode(",", $bed->rate10);
                                 $discount = explode(",", $bed->discount10);
                                 $room = explode(",", $bed->room10);
                                 $nextrate = explode(",", $bed->rate11);
                                 $nextdiscount = explode(",", $bed->discount11);
                                 break;
                             case 11:
                                 $rate = explode(",", $bed->rate11);
                                 $discount = explode(",", $bed->discount11);
                                 $room = explode(",", $bed->room11);
                                 $nextrate = explode(",", $bed->rate12);
                                 $nextdiscount = explode(",", $bed->discount12);
                                 break;
                             case 12:
                                 $rate = explode(",", $bed->rate12);
                                 $discount = explode(",", $bed->discount12);
                                 $room = explode(",", $bed->room12);
                                 $nextrate = explode(",", $bed->rate1);
                                 $nextdiscount = explode(",", $bed->discount1);
                                 break;
                         }
                         $topmargin = $subheight / 2 - 12;
                         $maxmargin = $subheight / 2 - 5;
                         $daysofmonth = count($rate) . "\n";
                         $leftdays = $daysofmonth - $today + 1;
                         if ($leftdays < 7) {
                             $rate = array_merge($rate, $nextrate);
                             $discount = array_merge($discount, $nextdiscount);
                         }
                         $sum_rate = 0;
                         $room_no_available = false;
                         for ($r = 0; $r < $number_nights; $r++) {
                             if ($r == 1) {
                                 //Acumula los rates por dia
                                 $sum_rate = $rate[$today] + $sum_rate;
                                 //Verificando si existe algun dia con el rate en 0
                                 if ($rate[$today] == 0.0) {
                                     $room_no_available = true;
                                 }
                             } else {
                                 //Acumula los rates por dia
                                 $sum_rate = $rate[$today + ($r - 1)] + $sum_rate;
                                 //Verificando si existe algun dia con el rate en 0
                                 if ($rate[$today + ($r - 1)] == 0.0) {
                                     $room_no_available = true;
                                 }
                             }
                         }
                         //Media promedio de precios x dias de estadia
                         $new_prom_rates = hg_html::getCurrency($id, $sum_rate / $number_nights);
                         //Valor de descuento por defecto para todos los hoteles
                         //$discount[$today-1]=10;
                         if ($discount[$today - 1] > 0) {
                             $output .= '<td class="td" style="width:16%; height:' . $subheight . 'px;"><p style="text-align:center; margin:0; line-height:' . $subheight . 'px;"><span style="text-decoration:line-through;">' . hg_html::getCurrency($id, $rate[$today - 1]) . '</span>';
                         } else {
                             $output .= '<td class="td" style="width:16%; height:' . $subheight . 'px;"><p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; margin:0; line-height:' . $subheight . 'px; font-weight:bold; ">' . $new_prom_rates;
                         }
                         if ($discount[$today - 1] > 0) {
                             $newrate = $rate[$today - 1] * (100 - $discount[$today - 1]) / 100;
                             $output .= '&nbsp;&nbsp;&nbsp;<span style="font-size:1.2em; color:' . $hgconf->pricecolor . '; font-weight:bold; line-height:' . $subheight . 'px;">' . hg_html::getCurrency($id, $newrate) . '</span>';
                         }
                         $output .= '</p></td>' . "\n";
                         $output .= '<td class="td" style="width:15%; height:' . $subheight . 'px;"><div style="margin-top:' . $topmargin . 'px; text-align:center;">';
                         $combo_rate_sum = 0;
                         for ($z = 0; $z <= $room[$today - 1]; $z++) {
                             $combo_rate_sum += $k * $new_prom_rates;
                         }
                         if (!$room_no_available) {
                             $output .= '<select name="roomnumber' . $order . '" id="roomnumber' . $order . '" style="width:70px" class="' . $rooms[$i]->beds[$b]->id . '">';
                             $combo_rate = 0;
                             for ($k = 0; $k <= $room[$today - 1]; $k++) {
                                 if ($k == 0) {
                                     $output .= '<option value="0" >0</option>';
                                 } else {
                                     $combo_rate = $k * $new_prom_rates;
                                     $output .= '<option value="' . $k . '" >' . $k . '</option>';
                                     /*if ($discount[$today-1] > 0) {
                                           $output .= '<option value="'.$k.'" >'.$k.' ('.hg_html::getCurrency($id, $combo_rate).')</option>';
                                       } else {
                                           $output .= '<option value="'.$k.'" >'.$k.' ('.hg_html::getCurrency($id, $combo_rate).')</option>';
                                       }*/
                                 }
                             }
                             $output .= '</select>';
                             //Muestra mensaje si hay entre 1 y 9 habitaciones
                             if ($room[$today - 1] >= 1 and $room[$today - 1] <= 9) {
                                 $output .= '<br /><span class="last_change_room">' . JText::sprintf('HG_LAST_CHANGE_ROOM', $room[$today - 1]) . '</span>';
                             }
                         } else {
                             $output .= JText::_('HG_NOT_AVAILABLE');
                             $output .= '<select name="roomnumber' . $order . '" id="roomnumber' . $order . '" style="width:50px; display:none" class="' . $rooms[$i]->id . '">';
                             $output .= '<option value="0" >0</option>';
                             $output .= '</select>';
                             array_push($no_roomsrate_array, '0');
                         }
                         $output .= '</div></td>' . "\n";
                         $order_bed = $bed_count;
                     }
                     $output .= '</tr>' . "\n";
                 }
             }
             //Si el hotel NO es Upon Request entonces:
             /*if (!$rooms[0]->upon_request){
                                     if ($rooms[$i]->rate_details or $rooms[$i]->cancellation) {
             
                                         $output .= '<tr class="slidebox">' . "\n";
                                         if ($rooms[$i]->rate_details) {
                                             $output .= '<td class="left" style="padding-left: 5px;"><div class="slide_wrapper2">' . "\n";
                                                     $output .= '<fieldset class="layout" style="border:none">' . "\n";
                                                             $output .= '<legend style="font-size:11px" class="legend_slide_wrapper">'.JText::_('HG_RATE_DETAILS').'</legend>' . "\n";
             
                                                     $output .= '<div class="slidevisible2" style="text-align:left;">' . "\n";
                                                             $output .= '<p style="font-size:11px">';
                                                             $output .= $rooms[$i]->rate_details;
                                                             $output .= '</p>';
                                                     $output .= '</div>' . "\n";
             
                                                     $output .= '</fieldset>' . "\n";
                                             $output .= '</div></td>' . "\n";
                                         } else {
                                             $output .= '<td class="left" style="padding-left: 5px;"><div class="slide_wrapper2">' . "\n";
                                                 $output .= '<fieldset class="layout" style="border:none">' . "\n";
                                                     $output .= '<legend></legend>' . "\n";
                                                         $output .= '<div class="slidevisible2" style="text-align:left;"></div>' . "\n";
                                                 $output .= '</fieldset>' . "\n";
                                             $output .= '&nbsp;</div></td>' . "\n";
                                         }
             
                                         if ($rooms[$i]->cancellation) {
                                             $output .= '<td colspan="3" class="right" style="padding-left: 5px;"><div class="slide_wrapper2">' . "\n";
                                                     $output .= '<fieldset class="layout" style="border:none">' . "\n";
                                                             $output .= '<legend style="font-size:11px" class="legend_slide_wrapper">'.JText::_('HG_CANCELLATION_POLICY').'</legend>' . "\n";
                                                     $output .= '<div class="slidevisible2" style="text-align:left;">' . "\n";
                                                             $output .= '<p style="font-size:11px">';
                                                             $output .= $rooms[$i]->cancellation;
                                                             $output .= '</p>';
                                                     $output .= '</div>' . "\n";
             
                                                     $output .= '</fieldset>' . "\n";
                                             $output .= '</div></td>' . "\n";
                                         } else {
                                             $output .= '<td colspan="2" class="right" style="padding-left: 5px; border-collapse: collapse;"><div class="slide_wrapper2">' . "\n";
                                                 $output .= '<fieldset class="layout" style="border:none">' . "\n";
                                                     $output .= '<legend></legend>' . "\n";
                                                     $output .= '<div class="slidevisible2" style="text-align:left;"></div>' . "\n";
                                                 $output .= '</fieldset>' . "\n";
                                             $output .= '&nbsp;</div></td>' . "\n";
                                         }
                                         $output .= '</tr>' . "\n";
                                     }
                                 }*/
         }
         $output .= '</table>' . "\n";
         if ($room_no == count($no_roomsrate_array)) {
             //Inicializo $output para mostrar mensaje de No Availability, con la finalidad de no mostrar lo anteriormente calculado
             $output = '<input type="hidden" id="show_results" value="1">';
             $output .= '<div id="show_results_message" class="show_results_message" style"display:none">' . JText::sprintf('HG_NO_AVAILABILITY', date('M d, Y', $arrival_date), date('M d, Y', $departure_date)) . '</div>';
             $body = 'http://www.jpmoser.com/' . $rooms[0]->alias . '.html<br><br>';
             $body .= 'From ' . date('M d, Y', $arrival_date) . ' to ' . date('M d, Y', $departure_date);
             JUtility::sendMail('*****@*****.**', 'Reserve', '*****@*****.**', 'No Availability for ' . $rooms[0]->hotelname, $body, $mode = true, $cc = null, $bcc = null, $attachment = null, $replyto = null, $replytoname = null);
         } else {
             $output .= '<input type="hidden" id="show_results" value="0">';
         }
         $output .= hg_html::boxbottom();
         echo $output;
     }
 }
Example #2
0
        echo '<p style="font-size:10px; font-weight:normal; text-align:center;">';
        echo JTEXT::_('HG_USERS_RATING') . '&nbsp;(' . $hotels->rate . ')';
        echo '</P>';
        echo '</div>';
    }
    echo '</div>';
    echo '</div>' . "\n";
    echo '</div>' . "\n";
    $i++;
    $k = 1 - $k;
}
echo '</div>' . "\n";
if ($this->hgconf->box == 'None') {
    echo '<div class="clear"></div>' . "\n";
} else {
    echo hg_html::boxbottom();
}
echo '<div class="clear"></div>' . "\n";
?>


    <?php 
if ($this->params->get('show_pagination', 2) != 0) {
    ?>
        <div class="pageslinks">
            <?php 
    echo $this->pageNav->getPagesLinks();
    ?>
        </div>
    
        <?php 
Example #3
0
 function getroomrate()
 {
     global $hgconf;
     $id = JRequest::getInt('id', 0);
     $yearnum = JRequest::getInt('year', 0);
     $monthnum = JRequest::getInt('month', 0);
     $todaynum = JRequest::getInt('today', 0);
     $model = $this->getModel('hotel');
     //Le pase el parametro $yearnum a getRoom() para que me muestre resultados solo del ano consultado
     $rooms = $model->getRoom($id, $yearnum);
     $JApp =& JFactory::getApplication();
     $JUser =& JFactory::getUser();
     $JDate = JFactory::getDate();
     $JDate->setOffset($JApp->getCfg('offset'));
     $time = mktime(0, 0, 0, $monthnum, $todaynum, $yearnum);
     $today = date('j', $time);
     $second = date('j', $time + 86400);
     $third = date('j', $time + 86400 * 2);
     $fourth = date('j', $time + 86400 * 3);
     $fifth = date('j', $time + 86400 * 4);
     $sixth = date('j', $time + 86400 * 5);
     $seventh = date('j', $time + 86400 * 6);
     $day = $JDate->_dayToString(date('w', $time), true);
     $month = $JDate->_monthToString(date('m', $time), true);
     $secondday = $JDate->_dayToString(date('w', $time + 86400), true);
     $thirdday = $JDate->_dayToString(date('w', $time + 86400 * 2), true);
     $fourthday = $JDate->_dayToString(date('w', $time + 86400 * 3), true);
     $fifthday = $JDate->_dayToString(date('w', $time + 86400 * 4), true);
     $sixthday = $JDate->_dayToString(date('w', $time + 86400 * 5), true);
     $seventhday = $JDate->_dayToString(date('w', $time + 86400 * 6), true);
     $output = '';
     if ($hgconf->box == 'None') {
         $output .= '<div style="clear:both;padding-bottom:10px;"></div>' . "\n";
     } else {
         $output .= hg_html::boxtop();
     }
     $output .= '<h3 class="title">' . "\n";
     $output .= JText::_('HG_CHOOSE_YOUR_ROOM_AND_RATE');
     $output .= '</h3>' . "\n";
     $room_no = count($rooms);
     $output .= '<div class="table">' . "\n";
     $output .= '<div class="th"><div class="td" style="width: 19%; height:22px; line-height:24px; border-left: 1px solid #fff;">' . JText::_('HG_ROOM_TYPE') . '</div><div class="td" style="height:22px; line-height:12px;">' . $day . '<br/>' . $today . '&nbsp;' . $month . '</div><div class="td" style="height:22px; line-height:12px;">' . $secondday . '<br/>' . $second . '&nbsp;' . $JDate->_monthToString(date('m', mktime(0, 0, 0, $monthnum, $todaynum + 1, $yearnum)), true) . '</div><div class="td" style="height:22px; line-height:12px;">' . $thirdday . '<br/>' . $third . '&nbsp;' . $JDate->_monthToString(date('m', mktime(0, 0, 0, $monthnum, $todaynum + 2, $yearnum)), true) . '</div><div class="td" style="height:22px; line-height:12px;">' . $fourthday . '<br/>' . $fourth . '&nbsp;' . $JDate->_monthToString(date('m', mktime(0, 0, 0, $monthnum, $todaynum + 3, $yearnum)), true) . '</div><div class="td" style="height:22px; line-height:12px;">' . $fifthday . '<br/>' . $fifth . '&nbsp;' . $JDate->_monthToString(date('m', mktime(0, 0, 0, $monthnum, $todaynum + 4, $yearnum)), true) . '</div><div class="td" style="height:22px; line-height:12px;">' . $sixthday . '<br/>' . $sixth . '&nbsp;' . $JDate->_monthToString(date('m', mktime(0, 0, 0, $monthnum, $todaynum + 5, $yearnum)), true) . '</div><div class="td" style="height:22px; line-height:12px;">' . $seventhday . '<br/>' . $seventh . '&nbsp;' . $JDate->_monthToString(date('m', mktime(0, 0, 0, $monthnum, $todaynum + 6, $yearnum)), true) . '</div><div class="td" style="width:18%; height:22px; line-height:12px; margin-right:-3px;"></div><div style="clear: both;"></div></div>' . "\n";
     for ($i = 0, $n = $room_no; $i < $n; $i++) {
         $beds = $rooms[$i]->beds;
         $bed_count = count($rooms[$i]->beds);
         if ($bed_count > 0) {
             //$output .= '<div class="ratetitle" style="margin-top:10px;"><strong>'.$rooms[$i]->title.'</strong></div>' . "\n";
             if ($rooms[$i]->roomsoffer) {
                 $output .= '<br /><span style="padding-right:5px;"><img src="' . JURI::base() . 'components/com_hotelguide/assets/images/specialoffer.png" alt="Special Offer"/></span><span style="font-size:11px; vertical-align:top; color:#6a71ff;">' . $this->rooms[$i]->roomsoffer . '</span><br />' . "\n";
             }
             //$output .= '<div class="table">' . "\n";
             //$output .= '<div class="th"><div class="td" style="width: 15%; height:22px; line-height:24px; border-left: 1px solid #fff;">'.JText::_('HG_BED_TYPES').'</div><div class="td" style="height:22px; line-height:12px;">'.$day.'<br/>'.$today.'&nbsp;'.$month.'</div><div class="td" style="height:22px; line-height:12px;">'.$secondday.'<br/>'.$second.'&nbsp;'.$JDate->_monthToString(date( 'm', mktime(0, 0, 0, $monthnum, $todaynum+1, $yearnum)), true).'</div><div class="td" style="height:22px; line-height:12px;">'.$thirdday.'<br/>'.$third.'&nbsp;'.$JDate->_monthToString(date( 'm', mktime(0, 0, 0, $monthnum, $todaynum+2, $yearnum)), true).'</div><div class="td" style="height:22px; line-height:12px;">'.$fourthday.'<br/>'.$fourth.'&nbsp;'.$JDate->_monthToString(date( 'm', mktime(0, 0, 0, $monthnum, $todaynum+3, $yearnum)), true).'</div><div class="td" style="height:22px; line-height:12px;">'.$fifthday.'<br/>'.$fifth.'&nbsp;'.$JDate->_monthToString(date( 'm', mktime(0, 0, 0, $monthnum, $todaynum+4, $yearnum)), true).'</div><div class="td" style="height:22px; line-height:12px;">'.$sixthday.'<br/>'.$sixth.'&nbsp;'.$JDate->_monthToString(date( 'm', mktime(0, 0, 0, $monthnum, $todaynum+5, $yearnum)), true).'</div><div class="td" style="height:22px; line-height:12px;">'.$seventhday.'<br/>'.$seventh.'&nbsp;'.$JDate->_monthToString(date( 'm', mktime(0, 0, 0, $monthnum, $todaynum+6, $yearnum)), true).'</div><div class="td" style="width:18%; height:22px; line-height:12px; margin-right:-3px;"></div><div style="clear: both;"></div></div>' . "\n";
             for ($j = 0; $j < $bed_count; $j++) {
                 $bed =& $beds[$j];
                 switch ($monthnum) {
                     case 1:
                         $rate = explode(",", $bed->rate1);
                         $discount = explode(",", $bed->discount1);
                         $room = explode(",", $bed->room1);
                         $nextrate = explode(",", $bed->rate2);
                         $nextdiscount = explode(",", $bed->discount2);
                         break;
                     case 2:
                         $rate = explode(",", $bed->rate2);
                         $discount = explode(",", $bed->discount2);
                         $room = explode(",", $bed->room2);
                         $nextrate = explode(",", $bed->rate3);
                         $nextdiscount = explode(",", $bed->discount3);
                         break;
                     case 3:
                         $rate = explode(",", $bed->rate3);
                         $discount = explode(",", $bed->discount3);
                         $room = explode(",", $bed->room3);
                         $nextrate = explode(",", $bed->rate4);
                         $nextdiscount = explode(",", $bed->discount4);
                         break;
                     case 4:
                         $rate = explode(",", $bed->rate4);
                         $discount = explode(",", $bed->discount4);
                         $room = explode(",", $bed->room4);
                         $nextrate = explode(",", $bed->rate5);
                         $nextdiscount = explode(",", $bed->discount5);
                         break;
                     case 5:
                         $rate = explode(",", $bed->rate5);
                         $discount = explode(",", $bed->discount5);
                         $room = explode(",", $bed->room5);
                         $nextrate = explode(",", $bed->rate6);
                         $nextdiscount = explode(",", $bed->discount6);
                         break;
                     case 6:
                         $rate = explode(",", $bed->rate6);
                         $discount = explode(",", $bed->discount6);
                         $room = explode(",", $bed->room6);
                         $nextrate = explode(",", $bed->rate7);
                         $nextdiscount = explode(",", $bed->discount7);
                         break;
                     case 7:
                         $rate = explode(",", $bed->rate7);
                         $discount = explode(",", $bed->discount7);
                         $room = explode(",", $bed->room7);
                         $nextrate = explode(",", $bed->rate8);
                         $nextdiscount = explode(",", $bed->discount8);
                         break;
                     case 8:
                         $rate = explode(",", $bed->rate8);
                         $discount = explode(",", $bed->discount8);
                         $room = explode(",", $bed->room8);
                         $nextrate = explode(",", $bed->rate9);
                         $nextdiscount = explode(",", $bed->discount9);
                         break;
                     case 9:
                         $rate = explode(",", $bed->rate9);
                         $discount = explode(",", $bed->discount9);
                         $room = explode(",", $bed->room9);
                         $nextrate = explode(",", $bed->rate10);
                         $nextdiscount = explode(",", $bed->discount19);
                         break;
                     case 10:
                         $rate = explode(",", $bed->rate10);
                         $discount = explode(",", $bed->discount10);
                         $room = explode(",", $bed->room10);
                         $nextrate = explode(",", $bed->rate11);
                         $nextdiscount = explode(",", $bed->discount11);
                         break;
                     case 11:
                         $rate = explode(",", $bed->rate11);
                         $discount = explode(",", $bed->discount11);
                         $room = explode(",", $bed->room11);
                         $nextrate = explode(",", $bed->rate12);
                         $nextdiscount = explode(",", $bed->discount12);
                         break;
                     case 12:
                         $rate = explode(",", $bed->rate12);
                         $discount = explode(",", $bed->discount12);
                         $room = explode(",", $bed->room12);
                         $nextrate = explode(",", $bed->rate1);
                         $nextdiscount = explode(",", $bed->discount1);
                         break;
                 }
                 $daysofmonth = count($rate) . "\n";
                 $leftdays = $daysofmonth - $today + 1;
                 if ($leftdays < 7) {
                     $rate = array_merge($rate, $nextrate);
                     $discount = array_merge($discount, $nextdiscount);
                 }
                 if (max($discount) > 0) {
                     if ($bed->breakfast == 2) {
                         $output .= '<div class="tr"><div class="td" style="width: 19%; border-left: 1px solid #fff; text-align:left;">&nbsp;&nbsp;' . $bed->bedtype . '<br/>';
                         $output .= '<p style="color:#333acc; font-style:italic; font-weight:normal;">&nbsp;&nbsp;' . JText::_('HG_BREAKFAST_INCLUDED') . '</p></div>';
                     } else {
                         $output .= '<div class="tr"><div class="td" style="width: 19%; font-weight:bold; line-height:40px; border-left: 1px solid #fff; text-align:left;">&nbsp;&nbsp;' . $bed->bedtype;
                         $output .= '</div>';
                     }
                     if ($rate[$today - 1]) {
                         $output .= '<div class="td"><p style="text-decoration:line-through; text-align:center; margin:0;">' . hg_html::getCurrency($id, $rate[$today - 1]) . '</p>';
                         $newrate = $rate[$today - 1] * (100 - $discount[$today - 1]) / 100;
                         $output .= '<p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $newrate) . '</p></div>';
                     } else {
                         //Modifique esta linea para que me mostrara el mensaje Contact cuando el rate para un dia especifico este todo en todos
                         //los campos en cero (0), esta de esta manera: $output .= JText::_('HG_CONTACT');
                         $output .= '<div class="td">' . JText::_('HG_CONTACT') . '</div>';
                     }
                     $output .= '<div class="td">';
                     if ($rate[$today]) {
                         $output .= '<p style="text-decoration:line-through; text-align:center; margin:0;">' . hg_html::getCurrency($id, $rate[$today]) . '</p>';
                         $newrate = $rate[$today] * (100 - $discount[$today]) / 100;
                         $output .= '<p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $newrate) . '</p></div>';
                     } else {
                         $output .= JText::_('HG_CONTACT') . '</div>';
                     }
                     $output .= '<div class="td">';
                     if ($rate[$today + 1]) {
                         $output .= '<p style="text-decoration:line-through; text-align:center; margin:0;">' . hg_html::getCurrency($id, $rate[$today + 1]) . '</p>';
                         $newrate = $rate[$today + 1] * (100 - $discount[$today + 1]) / 100;
                         $output .= '<p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $newrate) . '</p></div>';
                     } else {
                         $output .= JText::_('HG_CONTACT') . '</div>';
                     }
                     $output .= '<div class="td">';
                     if ($rate[$today + 2]) {
                         $output .= '<p style="text-decoration:line-through; text-align:center; margin:0;">' . hg_html::getCurrency($id, $rate[$today + 2]) . '</p>';
                         $newrate = $rate[$today + 2] * (100 - $discount[$today + 2]) / 100;
                         $output .= '<p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $newrate) . '</p></div>';
                     } else {
                         $output .= JText::_('HG_CONTACT') . '</div>';
                     }
                     $output .= '<div class="td">';
                     if ($rate[$today + 3]) {
                         $output .= '<p style="text-decoration:line-through; text-align:center; margin:0;">' . hg_html::getCurrency($id, $rate[$today + 3]) . '</p>';
                         $newrate = $rate[$today + 3] * (100 - $discount[$today + 3]) / 100;
                         $output .= '<p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $newrate) . '</p></div>';
                     } else {
                         $output .= JText::_('HG_CONTACT') . '</div>';
                     }
                     $output .= '<div class="td">';
                     if ($rate[$today + 4]) {
                         $output .= '<p style="text-decoration:line-through; text-align:center; margin:0;">' . hg_html::getCurrency($id, $rate[$today + 4]) . '</p>';
                         $newrate = $rate[$today + 4] * (100 - $discount[$today + 4]) / 100;
                         $output .= '<p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $newrate) . '</p></div>';
                     } else {
                         $output .= JText::_('HG_CONTACT') . '</div>';
                     }
                     $output .= '<div class="td">';
                     if ($rate[$today + 5]) {
                         $output .= '<p style="text-decoration:line-through; text-align:center; margin:0;">' . hg_html::getCurrency($id, $rate[$today + 5]) . '</p>';
                         $newrate = $rate[$today + 5] * (100 - $discount[$today + 5]) / 100;
                         $output .= '<p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $newrate) . '</p></div>';
                     } else {
                         $output .= JText::_('HG_CONTACT') . '</div>';
                     }
                     $output .= '<div class="td" style="width: 18%; margin-right:-3px;">';
                     $output .= '<button class="button" type="button" id="bookingbutton" onclick="submitbutton(\'' . $rooms[$i]->hotel . '\', \'' . $rooms[$i]->id . '\', \'-1\', \'' . $bed->id . '\'); return false;">' . JText::_('HG_BOOK_NOW') . '</button><p style="padding:0 3px; color:#ffffff; font-style:italic; text-align:center;">';
                     if ($room[$today - 1] == 0) {
                     } else {
                         if ($room[$today - 1] == 1) {
                             $output .= JText::sprintf('HG_LAST_CHANCE_ONLY_ROOM_LEFT', $room[$today - 1]);
                         } else {
                             if ($room[$today - 1] > 1 && $room[$today - 1] < 6) {
                                 $output .= JText::sprintf('HG_ONLY_ROOMS_LEFT', $room[$today - 1]);
                             } else {
                             }
                         }
                     }
                     $output .= '</p>' . "\n";
                     $output .= '</div><div style="clear: both;"></div></div>' . "\n";
                 } else {
                     if ($bed->breakfast == 2) {
                         $output .= '<div class="tr"><div class="td" style="width: 19%; border-left: 1px solid #fff; text-align:left;">&nbsp;' . $bed->bedtype . '<br/>';
                         $output .= '&nbsp;<span style="font-size:10px">' . JText::_('HG_BREAKFAST_INCLUDED') . '</span></div>';
                     } else {
                         $output .= '<div class="tr"><div class="td" style="width: 19%; line-height:40px; border-left: 1px solid #fff; text-align:left;">&nbsp;' . $bed->bedtype;
                         $output .= '</div>';
                     }
                     if ($rate[$today - 1]) {
                         $output .= '<div class="td"><p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $rate[$today - 1]) . '</p></div>';
                     } else {
                         $output .= '<div class="td">' . JText::_('HG_CONTACT') . '</div>';
                     }
                     if ($rate[$today]) {
                         $output .= '<div class="td"><p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $rate[$today]) . '</p></div>';
                     } else {
                         $output .= '<div class="td">' . JText::_('HG_CONTACT') . '</div>';
                     }
                     if ($rate[$today + 1]) {
                         $output .= '<div class="td"><p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $rate[$today + 1]) . '</p></div>';
                     } else {
                         $output .= '<div class="td">' . JText::_('HG_CONTACT') . '</div>';
                     }
                     if ($rate[$today + 2]) {
                         $output .= '<div class="td"><p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $rate[$today + 2]) . '</p></div>';
                     } else {
                         $output .= '<div class="td">' . JText::_('HG_CONTACT') . '</div>';
                     }
                     if ($rate[$today + 3]) {
                         $output .= '<div class="td"><p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $rate[$today + 3]) . '</p></div>';
                     } else {
                         $output .= '<div class="td">' . JText::_('HG_CONTACT') . '</div>';
                     }
                     if ($rate[$today + 4]) {
                         $output .= '<div class="td"><p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $rate[$today + 4]) . '</p></div>';
                     } else {
                         $output .= '<div class="td">' . JText::_('HG_CONTACT') . '</div>';
                     }
                     if ($rate[$today + 5]) {
                         $output .= '<div class="td"><p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $rate[$today + 5]) . '</p></div>';
                     } else {
                         $output .= '<div class="td">' . JText::_('HG_CONTACT') . '</div>';
                     }
                     $output .= '<div class="td" style="width: 18%; margin-right:-3px;">';
                     $output .= '<button class="button" type="button" id="bookingbutton" onclick="submitbutton(\'' . $rooms[$i]->hotel . '\', \'' . $rooms[$i]->id . '\', \'-1\', \'' . $bed->id . '\'); return false;">' . JText::_('HG_BOOK_NOW') . '</button><p style="padding:0 3px; color:#ffffff; font-style:italic; text-align:center;">';
                     if ($room[$today - 1] == 0) {
                     } else {
                         if ($room[$today - 1] == 1) {
                             $output .= JText::sprintf('HG_LAST_CHANCE_ONLY_ROOM_LEFT', $room[$today - 1]);
                         } else {
                             if ($room[$today - 1] > 1 && $room[$today - 1] < 6) {
                                 $output .= JText::sprintf('HG_ONLY_ROOMS_LEFT', $room[$today - 1]);
                             } else {
                             }
                         }
                     }
                     $output .= '</p>' . "\n";
                     $output .= '</div><div style="clear: both;"></div></div>' . "\n";
                 }
             }
             //$output .= '</div>' . "\n";
             $output .= '<div class="slidebox">' . "\n";
             if ($rooms[$i]->rate_details) {
                 $output .= '<div class="left" style="padding-left: 5px;"><div class="slide_wrapper2">' . "\n";
                 $output .= '<fieldset class="layout" style="border:none">' . "\n";
                 $output .= '<legend style="font-size:11px"><a href="javascript:void(0)" style="color:#fff">' . JText::_('HG_RATE_DETAILS') . '</a></legend>' . "\n";
                 $output .= '<div class="slidevisible2" style="text-align:left;">' . "\n";
                 $output .= '<p style="font-size:11px">';
                 $output .= $rooms[$i]->rate_details;
                 $output .= '</p>';
                 $output .= '</div>' . "\n";
                 $output .= '</fieldset>' . "\n";
                 $output .= '</div></div>' . "\n";
             }
             if ($rooms[$i]->cancellation) {
                 $output .= '<div class="right" style="padding-left: 5px;"><div class="slide_wrapper2">' . "\n";
                 $output .= '<fieldset class="layout" style="border:none">' . "\n";
                 $output .= '<legend style="font-size:11px"><a href="javascript:void(0)" style="color:#fff">' . JText::_('HG_CANCELLATION_POLICY') . '</a></legend>' . "\n";
                 $output .= '<div class="slidevisible2" style="text-align:left;">' . "\n";
                 $output .= '<p style="font-size:11px">';
                 $output .= $rooms[$i]->cancellation;
                 $output .= '</p>';
                 $output .= '</div>' . "\n";
                 $output .= '</fieldset>' . "\n";
                 $output .= '</div></div>' . "\n";
             }
             $output .= '</div>' . "\n";
             $output .= '<div style="clear:both;"></div>' . "\n";
         }
         $subrate_count = count($rooms[$i]->subrate);
         if ($subrate_count > 0) {
             for ($m = 0; $m < $subrate_count; $m++) {
                 $beds = $rooms[$i]->subrate[$m]->beds;
                 $bed_count = count($beds);
                 if ($bed_count > 0) {
                     //$output .= '<div class="ratetitle" style="margin-top:10px;"><strong>'.$rooms[$i]->title.'&nbsp;-&nbsp;'.$rooms[$i]->subrate[$m]->title.'</strong></div>' . "\n";
                     if ($rooms[$i]->roomsoffer) {
                         $output .= '<br /><span style="padding-right:5px;"><img src="' . JURI::base() . 'components/com_hotelguide/assets/images/specialoffer.png" alt="Special Offer"/></span><span style="font-size:11px; vertical-align:top; color:#6a71ff;">' . $rooms[$i]->roomsoffer . '</span><br />' . "\n";
                     }
                     $output .= '<div class="table">' . "\n";
                     $output .= '<div class="th"><div class="td" style="width: 19%; height:22px; line-height:24px; border-left: 1px solid #fff;">' . JText::_('HG_BED_TYPES') . '</div><div class="td" style="height:22px; line-height:12px;">' . $day . '<br/>' . $today . '&nbsp;' . $month . '</div><div class="td" style="height:22px; line-height:12px;">' . $secondday . '<br/>' . $second . '&nbsp;' . $JDate->_monthToString(date('m', mktime(0, 0, 0, $monthnum, $todaynum + 1, $yearnum)), true) . '</div><div class="td" style="height:22px; line-height:12px;">' . $thirdday . '<br/>' . $third . '&nbsp;' . $JDate->_monthToString(date('m', mktime(0, 0, 0, $monthnum, $todaynum + 2, $yearnum)), true) . '</div><div class="td" style="height:22px; line-height:12px;">' . $fourthday . '<br/>' . $fourth . '&nbsp;' . $JDate->_monthToString(date('m', mktime(0, 0, 0, $monthnum, $todaynum + 3, $yearnum)), true) . '</div><div class="td" style="height:22px; line-height:12px;">' . $fifthday . '<br/>' . $fifth . '&nbsp;' . $JDate->_monthToString(date('m', mktime(0, 0, 0, $monthnum, $todaynum + 4, $yearnum)), true) . '</div><div class="td" style="height:22px; line-height:12px;">' . $sixthday . '<br/>' . $sixth . '&nbsp;' . $JDate->_monthToString(date('m', mktime(0, 0, 0, $monthnum, $todaynum + 5, $yearnum)), true) . '</div><div class="td" style="height:22px; line-height:12px;">' . $seventhday . '<br/>' . $seventh . '&nbsp;' . $JDate->_monthToString(date('m', mktime(0, 0, 0, $monthnum, $todaynum + 6, $yearnum)), true) . '</div><div class="td" style="width:18%; height:22px; line-height:12px; margin-right:-3px;"></div><div style="clear: both;"></div></div>' . "\n";
                     for ($j = 0; $j < $bed_count; $j++) {
                         $bed =& $beds[$j];
                         switch ($monthnum) {
                             case 1:
                                 $rate = explode(",", $bed->rate1);
                                 $discount = explode(",", $bed->discount1);
                                 $room = explode(",", $bed->room1);
                                 $nextrate = explode(",", $bed->rate2);
                                 $nextdiscount = explode(",", $bed->discount2);
                                 break;
                             case 2:
                                 $rate = explode(",", $bed->rate2);
                                 $discount = explode(",", $bed->discount2);
                                 $room = explode(",", $bed->room2);
                                 $nextrate = explode(",", $bed->rate3);
                                 $nextdiscount = explode(",", $bed->discount3);
                                 break;
                             case 3:
                                 $rate = explode(",", $bed->rate3);
                                 $discount = explode(",", $bed->discount3);
                                 $room = explode(",", $bed->room3);
                                 $nextrate = explode(",", $bed->rate4);
                                 $nextdiscount = explode(",", $bed->discount4);
                                 break;
                             case 4:
                                 $rate = explode(",", $bed->rate4);
                                 $discount = explode(",", $bed->discount4);
                                 $room = explode(",", $bed->room4);
                                 $nextrate = explode(",", $bed->rate5);
                                 $nextdiscount = explode(",", $bed->discount5);
                                 break;
                             case 5:
                                 $rate = explode(",", $bed->rate5);
                                 $discount = explode(",", $bed->discount5);
                                 $room = explode(",", $bed->room5);
                                 $nextrate = explode(",", $bed->rate6);
                                 $nextdiscount = explode(",", $bed->discount6);
                                 break;
                             case 6:
                                 $rate = explode(",", $bed->rate6);
                                 $discount = explode(",", $bed->discount6);
                                 $room = explode(",", $bed->room6);
                                 $nextrate = explode(",", $bed->rate7);
                                 $nextdiscount = explode(",", $bed->discount7);
                                 break;
                             case 7:
                                 $rate = explode(",", $bed->rate7);
                                 $discount = explode(",", $bed->discount7);
                                 $room = explode(",", $bed->room7);
                                 $nextrate = explode(",", $bed->rate8);
                                 $nextdiscount = explode(",", $bed->discount8);
                                 break;
                             case 8:
                                 $rate = explode(",", $bed->rate8);
                                 $discount = explode(",", $bed->discount8);
                                 $room = explode(",", $bed->room8);
                                 $nextrate = explode(",", $bed->rate9);
                                 $nextdiscount = explode(",", $bed->discount9);
                                 break;
                             case 9:
                                 $rate = explode(",", $bed->rate9);
                                 $discount = explode(",", $bed->discount9);
                                 $room = explode(",", $bed->room9);
                                 $nextrate = explode(",", $bed->rate10);
                                 $nextdiscount = explode(",", $bed->discount19);
                                 break;
                             case 10:
                                 $rate = explode(",", $bed->rate10);
                                 $discount = explode(",", $bed->discount10);
                                 $room = explode(",", $bed->room10);
                                 $nextrate = explode(",", $bed->rate11);
                                 $nextdiscount = explode(",", $bed->discount11);
                                 break;
                             case 11:
                                 $rate = explode(",", $bed->rate11);
                                 $discount = explode(",", $bed->discount11);
                                 $room = explode(",", $bed->room11);
                                 $nextrate = explode(",", $bed->rate12);
                                 $nextdiscount = explode(",", $bed->discount12);
                                 break;
                             case 12:
                                 $rate = explode(",", $bed->rate12);
                                 $discount = explode(",", $bed->discount12);
                                 $room = explode(",", $bed->room12);
                                 $nextrate = explode(",", $bed->rate1);
                                 $nextdiscount = explode(",", $bed->discount1);
                                 break;
                         }
                         //			$rate = explode(",", $bed->rate2);
                         //			$discount = explode(",", $bed->discount2);
                         //			$room = explode(",", $bed->room2);
                         $daysofmonth = count($rate) . "\n";
                         $leftdays = $daysofmonth - $today + 1;
                         if ($leftdays < 8) {
                             $rate = array_merge($rate, $nextrate);
                             $discount = array_merge($discount, $nextdiscount);
                         }
                         if (max($discount) > 0) {
                             if ($bed->breakfast == 2) {
                                 $output .= '<div class="tr"><div class="td" style="width: 19%; border-left: 1px solid #fff; text-align:left;">&nbsp;&nbsp;' . $bed->bedtype;
                                 $output .= '<p style="color:#333acc; font-style:italic; font-weight:normal;">&nbsp;&nbsp;&nbsp;' . JText::_('HG_BREAKFAST_INCLUDED') . '</p></div>';
                             } else {
                                 $output .= '<div class="tr"><div class="td" style="width: 19%; font-weight:bold; line-height:40px; border-left: 1px solid #fff; text-align:left;">&nbsp;&nbsp;' . $bed->bedtype;
                                 $output .= '</div>';
                             }
                             if ($rate[$today - 1]) {
                                 $output .= '<div class="td"><p style="text-decoration:line-through; text-align:center; margin:0;">' . hg_html::getCurrency($id, $rate[$today - 1]) . '</p>';
                                 $newrate = $rate[$today - 1] * (100 - $discount[$today - 1]) / 100;
                                 $output .= '<p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $newrate) . '</p></div>';
                             } else {
                                 $output .= JText::_('HG_CONTACT');
                             }
                             $output .= '<div class="td">';
                             if ($rate[$today]) {
                                 $output .= '<p style="text-decoration:line-through; text-align:center; margin:0;">' . hg_html::getCurrency($id, $rate[$today]) . '</p>';
                                 $newrate = $rate[$today] * (100 - $discount[$today]) / 100;
                                 $output .= '<p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $newrate) . '</p></div>';
                             } else {
                                 $output .= JText::_('HG_CONTACT');
                             }
                             $output .= '<div class="td">';
                             if ($rate[$today + 1]) {
                                 $output .= '<p style="text-decoration:line-through; text-align:center; margin:0;">' . hg_html::getCurrency($id, $rate[$today + 1]) . '</p>';
                                 $newrate = $rate[$today + 1] * (100 - $discount[$today + 1]) / 100;
                                 $output .= '<p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $newrate) . '</p></div>';
                             } else {
                                 $output .= JText::_('HG_CONTACT');
                             }
                             $output .= '<div class="td">';
                             if ($rate[$today + 2]) {
                                 $output .= '<p style="text-decoration:line-through; text-align:center; margin:0;">' . hg_html::getCurrency($id, $rate[$today + 2]) . '</p>';
                                 $newrate = $rate[$today + 2] * (100 - $discount[$today + 2]) / 100;
                                 $output .= '<p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $newrate) . '</p></div>';
                             } else {
                                 $output .= JText::_('HG_CONTACT');
                             }
                             $output .= '<div class="td">';
                             if ($rate[$today + 3]) {
                                 $output .= '<p style="text-decoration:line-through; text-align:center; margin:0;">' . hg_html::getCurrency($id, $rate[$today + 3]) . '</p>';
                                 $newrate = $rate[$today + 3] * (100 - $discount[$today + 3]) / 100;
                                 $output .= '<p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $newrate) . '</p></div>';
                             } else {
                                 $output .= JText::_('HG_CONTACT');
                             }
                             $output .= '<div class="td">';
                             if ($rate[$today + 4]) {
                                 $output .= '<p style="text-decoration:line-through; text-align:center; margin:0;">' . hg_html::getCurrency($id, $rate[$today + 4]) . '</p>';
                                 $newrate = $rate[$today + 4] * (100 - $discount[$today + 4]) / 100;
                                 $output .= '<p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $newrate) . '</p></div>';
                             } else {
                                 $output .= JText::_('HG_CONTACT');
                             }
                             $output .= '<div class="td">';
                             if ($rate[$today + 5]) {
                                 $output .= '<p style="text-decoration:line-through; text-align:center; margin:0;">' . hg_html::getCurrency($id, $rate[$today + 5]) . '</p>';
                                 $newrate = $rate[$today + 5] * (100 - $discount[$today + 5]) / 100;
                                 $output .= '<p style="font-size:1.2em; color:' . $hgconf->pricecolor . '; text-align:center; font-weight:bold;">' . hg_html::getCurrency($id, $newrate) . '</p></div>';
                             } else {
                                 $output .= JText::_('HG_CONTACT');
                             }
                             $output .= '<div class="td" style="width: 18%; margin-right:-3px;">';
                             $output .= '<button class="button" type="button" id="bookingbutton" onclick="submitbutton(\'' . $rooms[$i]->hotel . '\', \'' . $rooms[$i]->id . '\', \'' . $rooms[$i]->subrate[$m]->id . '\', \'' . $bed->id . '\'); return false;">' . JText::_('HG_BOOK_NOW') . '</button><p style="padding:0 3px; color:#ffffff; font-style:italic; text-align:center;">';
                             if ($room[$today - 1] == 0) {
                                 $output .= JText::_('HG_NOT_AVAILABLE');
                             } else {
                                 if ($room[$today - 1] == 1) {
                                     $output .= JText::sprintf('HG_LAST_CHANCE_ONLY_ROOM_LEFT', $room[$today - 1]);
                                 } else {
                                     if ($room[$today - 1] > 1 && $room[$today - 1] < 6) {
                                         $output .= JText::sprintf('HG_ONLY_ROOMS_LEFT', $room[$today - 1]);
                                     } else {
                                     }
                                 }
                             }
                             $output .= '</p>' . "\n";
                             $output .= '</div></div>' . "\n";
                         } else {
                             $output .= '<div class="tr" style="background:none"><div class="td" style="width: 19%; border-left: 1px solid #fff; text-align:left;">&nbsp;&nbsp;' . $bed->bedtype;
                             if ($bed->breakfast == 2) {
                                 $output .= '<p style="padding-bottom:5px; line-height:26px; color:#333acc; font-style:italic; font-weight:normal;">&nbsp;' . JText::_('HG_BREAKFAST_INCLUDED') . '</p></div><div class="td" style="line-height:34px; font-weight:bold; color:' . $hgconf->pricecolor . ';">';
                             } else {
                                 $output .= '</div><div class="td" style="line-height:34px; font-weight:bold; color:' . $hgconf->pricecolor . ';">';
                             }
                             if ($rate[$today - 1]) {
                                 $output .= hg_html::getCurrency($id, $rate[$today - 1]);
                             } else {
                                 $output .= JText::_('HG_CONTACT');
                             }
                             $output .= '</div><div class="td" style="line-height:34px; font-weight:bold; color:' . $hgconf->pricecolor . ';">';
                             if ($rate[$today]) {
                                 $output .= hg_html::getCurrency($id, $rate[$today]);
                             } else {
                                 $output .= JText::_('HG_CONTACT');
                             }
                             $output .= '</div><div class="td" style="line-height:34px; font-weight:bold; color:' . $hgconf->pricecolor . ';">';
                             if ($rate[$today + 1]) {
                                 $output .= hg_html::getCurrency($id, $rate[$today + 1]);
                             } else {
                                 $output .= JText::_('HG_CONTACT');
                             }
                             $output .= '</div><div class="td" style="line-height:34px; font-weight:bold; color:' . $hgconf->pricecolor . ';">';
                             if ($rate[$today + 2]) {
                                 $output .= hg_html::getCurrency($id, $rate[$today + 2]);
                             } else {
                                 $output .= JText::_('HG_CONTACT');
                             }
                             $output .= '</div><div class="td" style="line-height:34px; font-weight:bold; color:' . $hgconf->pricecolor . ';">';
                             if ($rate[$today + 3]) {
                                 $output .= hg_html::getCurrency($id, $rate[$today + 3]);
                             } else {
                                 $output .= JText::_('HG_CONTACT');
                             }
                             $output .= '</div><div class="td" style="line-height:34px; font-weight:bold; color:' . $hgconf->pricecolor . ';">';
                             if ($rate[$today + 4]) {
                                 $output .= hg_html::getCurrency($id, $rate[$today + 4]);
                             } else {
                                 echo JText::_('HG_CONTACT');
                             }
                             $output .= '</div><div class="td" style="line-height:34px; font-weight:bold; color:' . $hgconf->pricecolor . ';">';
                             if ($rate[$today + 5]) {
                                 $output .= hg_html::getCurrency($id, $rate[$today + 5]);
                             } else {
                                 $output .= JText::_('HG_CONTACT');
                             }
                             $output .= '</div><div class="td" style="line-height:14px; width: 22%; margin-right:-3px;">';
                             $output .= '<button class="button" type="button" id="bookingbutton" onclick="submitbutton(\'' . $rooms[$i]->hotel . '\', \'' . $rooms[$i]->id . '\', \'' . $rooms[$i]->subrate[$m]->id . '\', \'' . $bed->id . '\'); return false;">' . JText::_('HG_BOOK_NOW') . '</button><p style="padding:0 3px; color:#ffffff; font-style:italic; text-align:center;">';
                             if ($room[$today - 1] == 0) {
                             } else {
                                 if ($room[$today - 1] == 1) {
                                     $output .= JText::sprintf('HG_LAST_CHANCE_ONLY_ROOM_LEFT', $room[$today - 1]);
                                 } else {
                                     if ($room[$today - 1] > 1 && $room[$today - 1] < 6) {
                                         $output .= JText::sprintf('HG_ONLY_ROOMS_LEFT', $room[$today - 1]);
                                     } else {
                                     }
                                 }
                             }
                             $output .= '</p>' . "\n";
                             $output .= '</div></div>' . "\n";
                         }
                     }
                     $output .= '</div>' . "\n";
                     $output .= '<div class="slidebox">' . "\n";
                     if ($rooms[$i]->subrate[$m]->rate_details) {
                         $output .= '<div class="left"><div class="slide_wrapper2">' . "\n";
                         $output .= '<fieldset class="layout" style="border:none">' . "\n";
                         $output .= '<legend style="font-size:11px"><a href="javascript:void(0)" style="color:#fff">' . JText::_('HG_RATE_DETAILS') . '</a></legend>' . "\n";
                         $output .= '<div class="slidevisible2" style="text-align:left;">' . "\n";
                         $output .= '<p style="font-size:11px">';
                         $output .= $rooms[$i]->subrate[$m]->rate_details;
                         $output .= '</p>';
                         $output .= '</div>' . "\n";
                         $output .= '</fieldset>' . "\n";
                         $output .= '</div></div>' . "\n";
                     }
                     if ($rooms[$i]->subrate[$m]->cancellation) {
                         $output .= '<div class="right"><div class="slide_wrapper2">' . "\n";
                         $output .= '<fieldset class="layout" style="border:none">' . "\n";
                         $output .= '<legend style="font-size:11px"><a href="javascript:void(0)" style="color:#fff">' . JText::_('HG_CANCELLATION_POLICY') . '</a></legend>' . "\n";
                         $output .= '<div class="slidevisible2" style="text-align:left;">' . "\n";
                         $output .= '<p style="font-size:11px">';
                         $output .= $rooms[$i]->subrate[$m]->cancellation;
                         $output .= '</p>';
                         $output .= '</div>' . "\n";
                         $output .= '</fieldset>' . "\n";
                         $output .= '</div></div>' . "\n";
                     }
                     $output .= '</div>' . "\n";
                     $output .= '<div style="clear:both;"></div>' . "\n";
                 }
             }
         }
     }
     $output .= '</div>' . "\n";
     if ($hgconf->box == 'None') {
         $output .= '<div style="clear:both;padding-bottom:10px;"></div>' . "\n";
     } else {
         $output .= hg_html::boxbottom();
     }
     echo $output;
 }