<?php
    require('meniuri.php');

    function writepagetitle($title = "")
    {
        global $scriptroot, $imagine_antet;
        if (!isset($title)) $title = "BizMedica - Secțiunea de administrare";
        if (strlen($title) == 0) $title = "BizMedica - Secțiunea de administrare";
        if (!isset($imagine_antet)) $imagine_antet = 'antet_1.jpg';
        ?>
        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
        <html>
        <head>
            <title><?php echo $title; ?></title>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2;">
            <link href="<?=$scriptroot?>main.css.php?imagine_antet=<?=$imagine_antet?>" rel="stylesheet">
            <!-- TinyMCE -->
            <script type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
            <script type="text/javascript">
	            tinyMCE.init({
		            // General options
		            mode : "textareas",
		            theme : "advanced",
		            plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,artlink",

		            // Theme options
		            theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
		            theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,image,cleanup,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		            theme_advanced_buttons3 : "link,advlink,artlink,unlink,anchor,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,advhr,|,print,|,ltr,rtl,|,fullscreen",
		            theme_advanced_buttons4 : "tablecontrols,|,insertlayer,moveforward,movebackward,absolute,|,visualchars,nonbreaking,template,pagebreak",
		            theme_advanced_toolbar_location : "top",
		            theme_advanced_toolbar_align : "left",
		            theme_advanced_statusbar_location : "bottom",
		            theme_advanced_resizing : true,

		            // Example content CSS (should be your site CSS)
		            content_css : "content.css",
		            //editor_css: "ui.css",

		            // Drop lists for link/image/media/template dialogs
		            template_external_list_url : "lists/template_list.js",
		            external_link_list_url : "lists/link_list.js",
		            external_image_list_url : "lists/image_list.js",
		            media_external_list_url : "lists/media_list.js",

            		// Replace values for the template plugin
		            template_replace_values : {
			            username : "Some User",
			            staffid : "991234"
		            }
	            });
            </script>
            <!-- /TinyMCE -->
        </head>
        <body>
        <?php
    }

    function writepagetop()
    {
        global $scriptroot, $authenticated, $id_meniu, $imagine_meniu, $imagesroot;
        ?>
            <table class='admin'>
                <tr><td colspan="2" style="height: 50px"><img src="<?=$imagesroot?>sigla.jpg"><br />
                    <div style="margin-left: 165px">Versiunea 1.0.0.1</div></td></tr>
                <tr>
				     <td class='meniu'> 	  
					 	 <?=meniu_sus()?>
					 </td>
                     <td class='continut' style='vertical-align: top; padding-top: 50px; padding-left: 2em;'>
                <?
    }
    
    function writepagebottom($detalii = '')
    {
        global $scriptroot, $id_meniu;
        ?>
        			</td>
                </tr>
            </table>
        </body>
        </html>
        <?php
    }
    
    function writeinfolayer()
    {
        ?>        
        <script type='text/javascript'>
        
            function openInfo(id_articol)
            {
                document.getElementById("info_text").src = "gettext.php?id_articol=" + id_articol;
                document.getElementById("info").style.left = parseInt((document.body.clientWidth - 790) / 2) + "px"; 
                document.getElementById("info").style.display = "inline";
            }
            
            function closeInfo()
            {
                document.getElementById("info").style.display = "none";
            }
            
            function openNews(id_noutate)
            {
                document.getElementById("info_text").src = "gettext.php?id_noutate=" + id_noutate;
                document.getElementById("info").style.left = parseInt((document.body.clientWidth - 790) / 2) + "px"; 
                document.getElementById("info").style.display = "inline";
            }
            
            function scrollInfoTop()
            {
                document.getElementById("info_text").contentWindow.scrollTop = 0;
            }
        
        </script>
        <?
        echo "<div class='info' id='info' style='display: none'>";
        echo "<iframe class='text' id='info_text'></iframe>";
        echo "<a href='#' class='link_sus' onClick='scrollInfoTop()'>sus</a>";
        echo "<a href='#' class='link_inchide' onClick='closeInfo()'>închide fereastra</a>";
        echo "</div>";
    }
    
    function gettextfromdb($id_articol)
    {
        $text = "<span class='articol'>";
        if (!$connected)
            $text .= 'Ne pare rău, dar momentan nu se poate accesa baza de date. Vă rugăm să reveniți.';
        else
        {
            if ($id_articol)
            {
                $q = mysql_query("SELECT * FROM articole WHERE id = $id_articol");
                if ($r = mysql_fetch_assoc($q))
                    $text .= $r['articol'];
                else
                    $text .= 'Ne pare rău, dar articolul solicitat de dumneavoastră nu mai există în baza de date.';
            }
        }
        $text .= "</span>";
        $text = "cucu";
        return $text;//addslashes($text);
    }
?>
