+ return("stamp:\t".date("r")."\n");
+}
+
+function return_back($what)
+{
+ global $have_js;
+
+ return(""
+ .(!$have_js ? "" : "<input type=\"button\" value=\"")
+ .$what
+ .(!$have_js ? " (tlaèítkem "
+ .""<span class=\"quote\">Zpìt</span>" èi "
+ .""<span class=\"quote\">Back</span>" prohlí¾eèe)"
+ : "\" onclick=\"history.back()\" />")
+ );
+}
+
+// Data acquision error checking:
+function datacheck_fail()
+{
+ print("<p>Nyní se prosím ".return_back("vra»te zpìt")
+ ." na pøedchozí stránku a chybu zadaných dat opravte.</p>\n");
+ footer();
+}
+
+function mail_data($title,$data)
+{
+ global $admin_mail,$mail_to;
+
+ // 5th mail argument is supported from PHP-4.0.5
+ return (!mail($mail_to,"EnergieWeb: $title",$data,
+"From: EnergieWeb <$admin_mail>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=iso-8859-2
+Content-Disposition: inline
+Content-Transfer-Encoding: 8bit
+"));
+}
+
+function gsm_row($name,$value)
+{
+ return("<tr><td align=\"left\">$name</td>"
+ ."<td align=\"right\">".($value=="" ? "neuvádìjte" : $value)."</td>"
+ ."</tr>\n");
+}
+
+function gsm_table($total,$varsym)
+{
+ global $firma_ucet,$firma_konstsym,$firma_specsym;
+
+ return("<blockquote><table border=\"1\" cellpadding=\"5\">\n"
+ ."<tr><th>polo¾ka</th><th>bankovní pøíkaz</th></tr>\n"
+ .gsm_row("Èíslo úètu",$firma_ucet)
+ .gsm_row("Èástka",sprintf("%.2f",$total))
+ .gsm_row("Konstantní symbol",$firma_konstsym)
+ .gsm_row("Variabilní symbol",$varsym)
+ .gsm_row("Specifický symbol",$firma_specsym)
+ ."</table></blockquote>\n"
+ );
+}
+
+function return_to_homepage()
+{
+ global $HTTP_SERVER_VARS;
+
+ return("<p>Nyní se mù¾ete vrátit na <a href=\"".dirnameslashed($HTTP_SERVER_VARS["SCRIPT_NAME"])."\">úvodní stránku</a>.</p>\n");
+}
+
+function input_text($name,$size,$default_value="",$addons="")
+{
+ $r="<input type=\"text\" name=\"$name\" size=\"$size\"";
+ $value=(isset($GLOBALS[$name]) ? $GLOBALS[$name] : $default_value);
+ if (""!=$value)
+ $r.=" value=\"".htmlspecialchars($value)."\"";
+ $r.=$addons." />";
+ return($r);
+}
+
+function form_charset()
+{
+ // CSacek-2.1.9+ required (mod_czech support dropped!)
+ // We MUST have input coded in "iso-8859-2" as we use
+ // "csacekRecodeInput Off", CSacek otherwise tries to recode input but CSacek
+ // _cannot_ know the encoding used by the client (moreover it IGNORES POST
+ // data MIME type, even if provided by Lynx 2.8.4dev.11, Mozilla 1.0.0
+ // doesn't provide anything).
+ // "iso-8859-2" should be replaced by $HTTP_SERVER_VARS["HTTP_X_CLIENT_CHARSET"]
+ // and "csacekRecodeInput On"(default) when CSacek fixes support of "utf-8"
+ // input-decoding, details in my mail <20020620134930.GA18761@short.ucw.cz>.
+
+ return('enctype="application/x-www-form-urlencoded" accept-charset="iso-8859-2"');
+}
+
+function print_form_radkova_inzerce($readonly,$total,$submit_name,$submit_value)
+{
+ global $have_js,$text,$doklad;
+
+ $addons=(!$readonly ? "" : " readonly=\"readonly\"");
+ ?>
+<blockquote>
+<form action="inzerat-submit.php<?php print($have_js); ?>" method="post" <?php print(form_charset()); ?>>
+<table border="1" width="100%" cellpadding="5">
+<tr><td align="center"><table border="0">
+ <tr><td align="left" class="tab-head">Text inzerátu</td></tr>
+ <tr><td align="center"><?php
+ print("<textarea name=\"text\" rows=\"7\" cols=\"60\""
+ .($readonly ? "" : " onkeyup=\"sum_total(this)\" onchange=\"sum_total(this)\"")
+ .$addons.">"
+ .(!isset($text) ? "" : htmlspecialchars(trim($text)))
+ ."</textarea>");
+ ?></td></tr>
+ <?php
+ if ($have_js || $total!="") {
+ ?>
+ <tr><td colspan="3"><hr /></td></tr>
+ <tr><td colspan="3" id="celkova_cena">Celková cena:
+ <input type="text" name="total" value="<?php
+ print(htmlspecialchars($total));
+ ?>" size="8" readonly="readonly" /></td></tr>
+ <?php
+ }
+ ?>
+ </table></td></tr>
+<tr><td align="left"><table border ="0" width="100%">
+ <tr><td>Název firmy / Jméno:</td ><td colspan="3"><?php print(input_text("name" ,60,"",$addons)); ?></td></tr>
+ <tr><td>Úplná adresa:</td ><td colspan="3"><?php print(input_text("adresa",60,"",$addons)); ?></td></tr>
+ <tr><td>Telefon:</td ><td colspan="3"><?php print(input_text("tel" ,25,"",$addons)); ?></td></tr>
+ <tr><td>IÈO:</td ><td ><?php print(input_text("ico" ,20,"",$addons)); ?></td>
+ <td>DIÈ</td ><td ><?php print(input_text("dic" ,20,"",$addons)); ?></td></tr>
+ <tr><td id="danovy_doklad"
+ >Zaslat daòový doklad?</td><td colspan="3"><input type="checkbox" name="doklad"<?php
+ print(""
+ // some hacks as "readonly" not supported for "checkbox"es (->"disabled" for them)
+ .(!($have_js || $readonly) ? "" : " onclick=\"sum_total(this)\"")
+ .(!($have_js || $readonly) ? "" : " disabled=\"disabled\"")
+ .(!isset($doklad) ? "" : " checked=\"checked\"")
+ .ereg_replace(" readonly=\"readonly\"","",$addons)." />");
+ ?></td></tr>
+ <tr><td id="pocet_zverejneni"
+ >Poèet zveøejnìní:</td ><td ><?php print(input_text("pocet",5,1,
+ $addons." onkeyup=\"sum_total(this)\" onchange=\"sum_total(this)\"")); ?></td>
+ <td>e-mail:</td ><td ><?php print(input_text("mail",40,"",$addons)); ?></td></tr>
+ </table></td></tr>
+<tr><td align="center" id="submit_button"><?php
+ print("<input type=\"submit\" name=\"$submit_name\" value=\"".htmlspecialchars($submit_value)."\""
+ .(!($have_js || $readonly) ? "" : " onclick=\"return(validate(this.form))\"")
+ ." />");
+ ?></td></tr>
+</table></form>
+</blockquote>
+<?php
+}
+
+function footer_img($url,$text,$size)
+{
+ global $footer_LOCAL;
+ if (!isset($footer_LOCAL))
+ return("<img src=\"$url\" $size alt=\"$text\" title=\"$text\" />");
+ else
+ return($text);
+}
+
+function a_href($url,$contents)
+{
+ global $have_ent,$energie_base;
+
+ $r="<a href=\"";
+ $urlent=htmlspecialchars($url);
+ if ($url==$urlent)
+ $r.=$url;
+ else if (!ereg("^[a-z]+://",$url)) // $url is our resource
+ $r.=$urlent;
+ else if (isset($have_ent) && !$have_ent) // non-ent client
+ $r.=$url;
+ else if ($have_ent) // ent client
+ $r.=$urlent;
+ else // unknown client, htmlspecialchars() should not be needed here
+ $r.=htmlspecialchars($energie_base."redirect.php?location=".urlencode($url));
+ $r.="\">$contents</a>";
+ return($r);