<?php

if ($_POST['rate']) {
    if (substr($_COOKIE['hd_manualrate'], -1) == 'x') {
        $newvalue = $_COOKIE['hd_manualrate'] . $_POST['pageid'] . "x";
    } else {
        $newvalue = $_COOKIE['hd_manualrate'] . "x" . $_POST['pageid'] . "x";
    }
    setcookie('hd_manualrate', $newvalue, time() + 15552000);
}
include_once("postget.php");
include_once("common.php");

$pagetitle = lang("_MANUALS");

if ($_REQUEST['client'] == 1) {
    checklevel(1, $_REQUEST['clientid']);
}

moduleaccess(71);


if ($_REQUEST[id] AND !is_numeric($_REQUEST[id])) {
    messagetop(_ERROR_403, '', 'index.php', 0);
}
if ($_REQUEST[c] AND !is_numeric($_REQUEST[c])) {
    messagetop(_ERROR_403, '', 'index.php', 0);
}
if ($_REQUEST[s] AND !is_numeric($_REQUEST[s])) {
    messagetop(_ERROR_403, '', 'index.php', 0);
}
if ($_REQUEST[i] AND !is_numeric($_REQUEST[i])) {
    messagetop(_ERROR_403, '', 'index.php', 0);
}



session_start();
if ($_SESSION['hd_accesslvl'] > 0) {
    include("head_template.php");
    $onlycl = "";
} else {
    include("head_template_guest.php");
    $onlycl = "AND onlyclients = 0";
}

//if($_SESSION['hd_accesslvl']==1) {
//	include("menu_client.php");
//}elseif (substr($config[73][1],0,1)=='1') {
//	include("menu_guest.php");
//}

if ($_POST['rate']) {
    query("UPDATE hd_manuals_pages SET rating = rating+" . $_POST['rate'] . ", ratingcount = ratingcount+1 WHERE id=" . $_POST['pageid'], 0);
}

echo '<div class="container">
    <div class="row">';





///////////////////////////////////////////////// tabla grande, dividida en 2 partes
print("<table cellpadding='80'>
<tr>
<td 
width='47%' 
valign='top' 
background='images/borderspiralleft.gif'
style='padding-top: 20; padding-bottom: 20; padding-left: 20; padding-right: 20;'
>");
////////////////////////////////////////////////////////////////////////////////////

print("<table class='table'>");

print("<tr><td align='center' colspan='3'>
<form method='POST'>
<b>" . ucfirst(_SEARCH) . ":</b> <input name='search' size=30 value='" . $_REQUEST['search'] . "'> 
<input type='submit' name='submitsearch' value='" . _SEARCH . "' class='btnform'>
</form>");
if ($_REQUEST['search']) {
    print ("<a href='" . $serverurl . "/manuals.php'>" . ucfirst(_RESET_SEARCH) . "</a>");
}

print("</td></tr>");

if ($_REQUEST['search']) {
    print("<tr><td align='center' colspan='3'><b>" . ucfirst(_RESULTS) . "</b></td></tr>");

    $item = query("SELECT * FROM hd_manuals_pages
	WHERE (`question` LIKE '%" . $_REQUEST['search'] . "%' OR `answer` LIKE '%" . $_REQUEST['search'] . "%') AND langs LIKE '%" . $currentlang . "%' " . $onlycl . " ORDER by position", 0);

    //	WHERE category=".$rowC[id]." ".$onlycl." AND subcategory=0 ORDER by position",0);
    while ($rowI = mysql_fetch_array($item)) {
        print("<tr>");

        if ($rowI['ratingcount']) {
            $nota = round($rowI['rating'] / $rowI['ratingcount'], 0);
        } else {
            $nota = 0;
        }

        if ($_REQUEST['i'] == $rowI[id]) {
            query("UPDATE hd_manuals_pages SET views = views+1 WHERE id=" . $rowI[id], 0);


                        
			print("<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<b>".$rowI[question]."</b>");
			$manual_title = $rowI[question];
			print("</td>");
			print("<td align='center'>".($rowI[views]+1)." ".strtolower(_VIEWS)."</td>");


			print("<td nowrap='nowrap' align='center'>");

			/////////////////////////////////////// estrellas
			if ($nota==1) {$notatitulo = _VERY_POOR;
			}elseif ($nota==2) {$notatitulo = _POOR;
			}elseif ($nota==3) {$notatitulo = _FAIR;
			}elseif ($nota==4) {$notatitulo = _GOOD;
			}elseif ($nota==5) {$notatitulo = _EXCELLENT;
			}

			if ($nota >= 1) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}
			if ($nota >= 2) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}
			if ($nota >= 3) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}
			if ($nota >= 4) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}
			if ($nota >= 5) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}
//
//			if (strpos($_COOKIE['hd_manualrate'],"x".$rowI[id]."x")===false AND $_POST['pageid']<>$rowI[id]){
//				print("<form method='POST' class='form'>");
//				print("<select name='rate' class='input-medium' onChange='this.form.submit()'>");
//				print ("<option value=''>".ucfirst(_YOUR_VOTE)."</option>");
//				print ("<option value='5'>".ucfirst(_EXCELLENT)."</option>");
//				print ("<option value='4'>".ucfirst(_GOOD)."</option>");
//				print ("<option value='3'>".ucfirst(_FAIR)."</option>");
//				print ("<option value='2'>".ucfirst(_POOR)."</option>");
//				print ("<option value='1'>".ucfirst(_VERY_POOR)."</option>");
//				print("</select>");
//				print ("<input type='hidden' name='pageid' value='".$rowI[id]."'>");
//				print("</form>");
//			}


			print("</td>");
//                        

            $califica = "<table><tr>";
            $manual_title = $rowI[question];
            $califica .= "<td align='center'>" . ($rowI[views] + 1) . " " . strtolower(_VIEWS) . "</td>";


            $califica .= "<td nowrap='nowrap' align='center'>" . $rowI[ratingcount] . " " . strtolower(_VOTES) . " ";

            /////////////////////////////////////// estrellas
            if ($nota == 1) {
                $notatitulo = _VERY_POOR;
            } elseif ($nota == 2) {
                $notatitulo = _POOR;
            } elseif ($nota == 3) {
                $notatitulo = _FAIR;
            } elseif ($nota == 4) {
                $notatitulo = _GOOD;
            } elseif ($nota == 5) {
                $notatitulo = _EXCELLENT;
            }

            if ($nota >= 1) {
                $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
            } else {
                $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
            }
            if ($nota >= 2) {
                $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
            } else {
                $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
            }
            if ($nota >= 3) {
                $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
            } else {
                $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
            }
            if ($nota >= 4) {
                $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
            } else {
                $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
            }
            if ($nota >= 5) {
                $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
            } else {
                $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
            }

            if (strpos($_COOKIE['hd_manualrate'], "x" . $rowI[id] . "x") === false AND $_POST['pageid'] <> $rowI[id]) {
                $califica .= "</td><td><form method='POST' style='margin-bottom:0;'>";
                $califica .= "<select name='rate' class='input-medium' onChange='this.form.submit()'>";
                $califica .= "<option value=''>" . ucfirst(_YOUR_VOTE) . "</option>";
                $califica .= "<option value='5'>" . ucfirst(_EXCELLENT) . "</option>";
                $califica .= "<option value='4'>" . ucfirst(_GOOD) . "</option>";
                $califica .= "<option value='3'>" . ucfirst(_FAIR) . "</option>";
                $califica .= "<option value='2'>" . ucfirst(_POOR) . "</option>";
                $califica .= "<option value='1'>" . ucfirst(_VERY_POOR) . "</option>";
                $califica .= "</select>";
                $califica .= "<input type='hidden' name='pageid' value='" . $rowI[id] . "'>";
                $califica .= "</form>";
            }


            $califica .= "</td></tr></table>";





            $content = $rowI[answer];
        } else {
            print("<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<a href='" . $PHP_SELF . "?c=" . $rowC[id] . "&i=" . $rowI[id] . "&search=" . $_REQUEST[search] . "'><font color='blue'>" . $rowI[question] . "</font></a>
				");
            print("</td>");
            print("<td align='center' style='color: blue;'>" . $rowI[views] . " " . strtolower(_VIEWS) . "</td>");
            print("<td nowrap='nowrap' align='center'>");
            if ($nota >= 1) {
                print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
            } else {
                print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
            }
            if ($nota >= 2) {
                print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
            } else {
                print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
            }
            if ($nota >= 3) {
                print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
            } else {
                print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
            }
            if ($nota >= 4) {
                print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
            } else {
                print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
            }
            if ($nota >= 5) {
                print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
            } else {
                print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
            }
            print("</td>");
        }
        print("</tr>");
    }
} else {

    print("<tr><td align='center' colspan='3'><b>" . ucfirst(_INDEX) . "</b></td></tr>");

    /////////////////////////////////// CATEGORIAS (MANUALES)
    $cat = query("SELECT * FROM hd_manuals_manuals WHERE numfaqs > 0 AND langs LIKE '%" . $currentlang . "%' ORDER by position", 0);
    while ($rowC = mysql_fetch_array($cat)) {
        print("<tr>");
        print("<td colspan='3'><b>
	<a href='" . $PHP_SELF . "?c=" . $rowC[id] . "'><font size='+1' color='black'>" . ucfirst($rowC[name]) . "</font></a>
	</b> (" . $rowC[numfaqs] . " " . strtolower(_PAGES) . ")</td>");
        print("</tr>");

        /////////////////////////////////// SUB CATEGORIAS (CAPITULOS)
        $subcat = query("SELECT * FROM hd_manuals_chapters WHERE category=" . $rowC[id] . " AND numfaqs > 0 AND langs LIKE '%" . $currentlang . "%' ORDER by position", 0);
        while ($rowS = mysql_fetch_array($subcat)) {
            print("<tr>");
            print("<td colspan='3' style='color: #666666;'>
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<b>
		<a href='" . $PHP_SELF . "?s=" . $rowS[id] . "'><font color='#666666'>" . ucfirst($rowS[name]) . "</font></a>
		</b> (" . $rowS[numfaqs] . " " . strtolower(_PAGES) . ")
		</td>");
            print("</tr>");

            /////////////////////////////////// ITEMS dentro de SUB CATEGORIAS (CAPITULOS)
            if ($_REQUEST['s'] == $rowS[id]) {
                $item = query("SELECT * FROM hd_manuals_pages WHERE subcategory=" . $rowS[id] . " " . $onlycl . " AND langs LIKE '%" . $currentlang . "%' ORDER by position", 0);
                while ($rowI = mysql_fetch_array($item)) {
                    print("<tr>");

                    if ($rowI['ratingcount']) {
                        $nota = round($rowI['rating'] / $rowI['ratingcount'], 0);
                    } else {
                        $nota = 0;
                    }

                    if ($_REQUEST['i'] == $rowI[id]) {
                        query("UPDATE hd_manuals_pages SET views = views+1 WHERE id=" . $rowI[id], 0);
						print("<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<b>".$rowI[question]."</b>");
						$manual_title = $rowI[question];
						print("</td>");
						print("<td align='center'>".($rowI[views]+1)." ".strtolower(_VIEWS)."</td>");


						print("<td nowrap='nowrap' align='center'>");

						/////////////////////////////////////// estrellas
						if ($nota==1) {$notatitulo = _VERY_POOR;
						}elseif ($nota==2) {$notatitulo = _POOR;
						}elseif ($nota==3) {$notatitulo = _FAIR;
						}elseif ($nota==4) {$notatitulo = _GOOD;
						}elseif ($nota==5) {$notatitulo = _EXCELLENT;
						}

						if ($nota >= 1) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}
						if ($nota >= 2) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}
						if ($nota >= 3) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}
						if ($nota >= 4) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}
						if ($nota >= 5) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}
//
//						if (strpos($_COOKIE['hd_manualrate'],"x".$rowI[id]."x")===false AND $_POST['pageid']<>$rowI[id]){
//							print("<form method='POST' class='form'>");
//							print("<select name='rate' class='input-medium' onChange='this.form.submit()'>");
//							print ("<option value=''>".ucfirst(_YOUR_VOTE)."</option>");
//							print ("<option value='5'>".ucfirst(_EXCELLENT)."</option>");
//							print ("<option value='4'>".ucfirst(_GOOD)."</option>");
//							print ("<option value='3'>".ucfirst(_FAIR)."</option>");
//							print ("<option value='2'>".ucfirst(_POOR)."</option>");
//							print ("<option value='1'>".ucfirst(_VERY_POOR)."</option>");
//							print("</select>");
//							print ("<input type='hidden' name='pageid' value='".$rowI[id]."'>");
//							print("</form>");
//						}
						print("</td>");

                        $califica = "<table><tr>";
                        $manual_title = $rowI[question];
                        $califica .= "<td align='center'>" . ($rowI[views] + 1) . " " . strtolower(_VIEWS) . "</td>";


                        $califica .= "<td nowrap='nowrap' align='center'>" . $rowI[ratingcount] . " " . strtolower(_VOTES) . " ";

                        /////////////////////////////////////// estrellas
                        if ($nota == 1) {
                            $notatitulo = _VERY_POOR;
                        } elseif ($nota == 2) {
                            $notatitulo = _POOR;
                        } elseif ($nota == 3) {
                            $notatitulo = _FAIR;
                        } elseif ($nota == 4) {
                            $notatitulo = _GOOD;
                        } elseif ($nota == 5) {
                            $notatitulo = _EXCELLENT;
                        }

                        if ($nota >= 1) {
                            $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
                        } else {
                            $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
                        }
                        if ($nota >= 2) {
                            $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
                        } else {
                            $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
                        }
                        if ($nota >= 3) {
                            $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
                        } else {
                            $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
                        }
                        if ($nota >= 4) {
                            $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
                        } else {
                            $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
                        }
                        if ($nota >= 5) {
                            $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
                        } else {
                            $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
                        }

                        if (strpos($_COOKIE['hd_manualrate'], "x" . $rowI[id] . "x") === false AND $_POST['pageid'] <> $rowI[id]) {
                            $califica .= "</td><td><form method='POST' style='margin-bottom:0;'>";
                            $califica .= "<select name='rate' class='input-medium' onChange='this.form.submit()'>";
                            $califica .= "<option value=''>" . ucfirst(_YOUR_VOTE) . "</option>";
                            $califica .= "<option value='5'>" . ucfirst(_EXCELLENT) . "</option>";
                            $califica .= "<option value='4'>" . ucfirst(_GOOD) . "</option>";
                            $califica .= "<option value='3'>" . ucfirst(_FAIR) . "</option>";
                            $califica .= "<option value='2'>" . ucfirst(_POOR) . "</option>";
                            $califica .= "<option value='1'>" . ucfirst(_VERY_POOR) . "</option>";
                            $califica .= "</select>";
                            $califica .= "<input type='hidden' name='pageid' value='" . $rowI[id] . "'>";
                            $califica .= "</form>";
                        }
                        $califica .= "</td></tr></table>";


                        $content = $rowI[answer];
                    } else {
                        print("<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<a href='" . $PHP_SELF . "?s=" . $rowS[id] . "&i=" . $rowI[id] . "'><font color='blue'>" . $rowI[question] . "</font></a>
					");
                        print("</td>");
                        print("<td align='center' style='color: blue;'>" . $rowI[views] . " " . strtolower(_VIEWS) . "</td>");
                        print("<td nowrap='nowrap' align='center' style='color: blue;'>");
                        if ($nota >= 1) {
                            print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
                        } else {
                            print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
                        }
                        if ($nota >= 2) {
                            print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
                        } else {
                            print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
                        }
                        if ($nota >= 3) {
                            print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
                        } else {
                            print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
                        }
                        if ($nota >= 4) {
                            print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
                        } else {
                            print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
                        }
                        if ($nota >= 5) {
                            print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
                        } else {
                            print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
                        }
                        print("</td>");
                    }
                    print("</tr>");
                }
            }
        }

        /////////////////////////////////// ITEMS dentro de CATEGORIAS (MANUALES)
        if ($_REQUEST['c'] == $rowC[id]) {
            $item = query("SELECT * FROM hd_manuals_pages WHERE category=" . $rowC[id] . " " . $onlycl . " AND subcategory=0 AND langs LIKE '%" . $currentlang . "%' ORDER by position", 0);
            while ($rowI = mysql_fetch_array($item)) {
                print("<tr>");

                if ($rowI['ratingcount']) {
                    $nota = round($rowI['rating'] / $rowI['ratingcount'], 0);
                } else {
                    $nota = 0;
                }

                if ($_REQUEST['i'] == $rowI[id]) {
                    query("UPDATE hd_manuals_pages SET views = views+1 WHERE id=" . $rowI[id], 0);

					print("<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<b>".$rowI[question]."</b>");
					$manual_title = $rowI[question];
					print("</td>");
					print("<td align='center'>".($rowI[views]+1)." ".strtolower(_VIEWS)."</td>");


					print("<td nowrap='nowrap' align='center'>");

					/////////////////////////////////////// estrellas
					if ($nota==1) {$notatitulo = _VERY_POOR;
					}elseif ($nota==2) {$notatitulo = _POOR;
					}elseif ($nota==3) {$notatitulo = _FAIR;
					}elseif ($nota==4) {$notatitulo = _GOOD;
					}elseif ($nota==5) {$notatitulo = _EXCELLENT;
					}

					if ($nota >= 1) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}
					if ($nota >= 2) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}
					if ($nota >= 3) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}
					if ($nota >= 4) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}
					if ($nota >= 5) {print("<img class='sprites star' src='images/transparent.gif' border='0' title='".ucfirst($notatitulo)."'>");}else{print("<img class='sprites staroff' src='images/transparent.gif' border='0'>");}

//					if (strpos($_COOKIE['hd_manualrate'],"x".$rowI[id]."x")===false AND $_POST['pageid']<>$rowI[id]){
//						print("<form method='POST' class='form'>");
//						print("<select name='rate' class='input-medium' onChange='this.form.submit()'>");
//						print ("<option value=''>".ucfirst(_YOUR_VOTE)."</option>");
//						print ("<option value='5'>".ucfirst(_EXCELLENT)."</option>");
//						print ("<option value='4'>".ucfirst(_GOOD)."</option>");
//						print ("<option value='3'>".ucfirst(_FAIR)."</option>");
//						print ("<option value='2'>".ucfirst(_POOR)."</option>");
//						print ("<option value='1'>".ucfirst(_VERY_POOR)."</option>");
//						print("</select>");
//						print ("<input type='hidden' name='pageid' value='".$rowI[id]."'>");
//						print("</form>");
//					}
					print("</td>");


                    $califica = "<table><tr>";
                    $manual_title = $rowI[question];
                    $califica .= "<td align='center'>" . ($rowI[views] + 1) . " " . strtolower(_VIEWS) . "</td>";


                    $califica .= "<td nowrap='nowrap' align='center'>" . $rowI[ratingcount] . " " . strtolower(_VOTES) . " ";

                    /////////////////////////////////////// estrellas
                    if ($nota == 1) {
                        $notatitulo = _VERY_POOR;
                    } elseif ($nota == 2) {
                        $notatitulo = _POOR;
                    } elseif ($nota == 3) {
                        $notatitulo = _FAIR;
                    } elseif ($nota == 4) {
                        $notatitulo = _GOOD;
                    } elseif ($nota == 5) {
                        $notatitulo = _EXCELLENT;
                    }

                    if ($nota >= 1) {
                        $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
                    } else {
                        $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
                    }
                    if ($nota >= 2) {
                        $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
                    } else {
                        $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
                    }
                    if ($nota >= 3) {
                        $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
                    } else {
                        $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
                    }
                    if ($nota >= 4) {
                        $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
                    } else {
                        $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
                    }
                    if ($nota >= 5) {
                        $califica .= "<img class='sprites star' src='images/transparent.gif' border='0' title='" . ucfirst($notatitulo) . "'>";
                    } else {
                        $califica .= "<img class='sprites staroff' src='images/transparent.gif' border='0'>";
                    }

                    if (strpos($_COOKIE['hd_manualrate'], "x" . $rowI[id] . "x") === false AND $_POST['pageid'] <> $rowI[id]) {
                        $califica .= "</td><td><form method='POST' style='margin-bottom:0;'>";
                        $califica .= "<select name='rate' class='input-medium' onChange='this.form.submit()'>";
                        $califica .= "<option value=''>" . ucfirst(_YOUR_VOTE) . "</option>";
                        $califica .= "<option value='5'>" . ucfirst(_EXCELLENT) . "</option>";
                        $califica .= "<option value='4'>" . ucfirst(_GOOD) . "</option>";
                        $califica .= "<option value='3'>" . ucfirst(_FAIR) . "</option>";
                        $califica .= "<option value='2'>" . ucfirst(_POOR) . "</option>";
                        $califica .= "<option value='1'>" . ucfirst(_VERY_POOR) . "</option>";
                        $califica .= "</select>";
                        $califica .= "<input type='hidden' name='pageid' value='" . $rowI[id] . "'>";
                        $califica .= "</form>";
                    }
                    $califica .= "</td></tr></table>";





                    $content = $rowI[answer];
                } else {
                    print("<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<a href='" . $PHP_SELF . "?c=" . $rowC[id] . "&i=" . $rowI[id] . "'><font color='blue'>" . $rowI[question] . "</font></a>
				");
                    print("</td>");
                    print("<td align='center' style='color: blue;'>" . $rowI[views] . " " . strtolower(_VIEWS) . "</td>");
                    print("<td nowrap='nowrap' align='center'>");
                    /////////////////////////////////////// estrellitas
                    if ($nota >= 1) {
                        print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
                    } else {
                        print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
                    }
                    if ($nota >= 2) {
                        print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
                    } else {
                        print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
                    }
                    if ($nota >= 3) {
                        print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
                    } else {
                        print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
                    }
                    if ($nota >= 4) {
                        print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
                    } else {
                        print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
                    }
                    if ($nota >= 5) {
                        print("<img class='sprites starmini' src='images/transparent.gif' border='0'>");
                    } else {
                        print("<img class='sprites staroffmini' src='images/transparent.gif' border='0'>");
                    }
                    /////////////////////////////////////////////////////////////
                    print("</td>");
                }
                print("</tr>");
            }
        }
    }
}
print("</table>");



///////////////////////////////////////////////// tabla grande, division en 2 partes
print("</td>
<td width='53%' 
valign='top' 
align='left' 
background='images/borderspiral.gif' 
style='padding-top: 20; padding-bottom: 20; padding-left: 80; padding-right: 20;'
 >");
////////////////////////////////////////////////////////////////////////////////////


if (!$manual_title) {
    print("<font size='+1' color='black'><i><b>" . ucfirst(_SELECT_AN_OPTION_IN_THE_INDEX_ON_THE_LEFT) . "</b></i></font>");
} else {
    if ($_REQUEST['search']) {
        if (phpversion() < 5) {
            $manual_title = str_replace($_REQUEST['search'], '<font color=red><b>' . $_REQUEST['search'] . '</b></font>', $manual_title);
            $content = str_replace($_REQUEST['search'], '<font color=red><b>' . $_REQUEST['search'] . '</b></font>', $content);
        } else {
            $manual_title = str_ireplace($_REQUEST['search'], '<font color=red><b>' . $_REQUEST['search'] . '</b></font>', $manual_title);
            $content = str_ireplace($_REQUEST['search'], '<font color=red><b>' . $_REQUEST['search'] . '</b></font>', $content);
        }
    }

    print("<font size='+1' color='black'><i><b>" . $manual_title . "</b></i></font>");
    print("<br><font color='black' class=manuals_faq>");
    $content = stripslashes($content);
    $content = replacellaves($content);
    print($content);
    print("</font>");
    print("<hr>");
    print($califica);
}


///////////////////////////////////////////////// tabla grande, cierre
print("</td></tr></table>");
////////////////////////////////////////////////////////////////////////////////////



echo '
</div>
</div>
';

include("foot_template.php");
?>
	
