Rev Author Line No. Line
45 kakl 1 // History:
82 kaklik 2 // Dopln�a detekce jazyka dokumentu (ve zna�e body)
3 // Ped��o na jinou strukturu adres�, dopln�o poukov��odkaz
4 // Oprava regul�n�o vrazu tak, aby nekazil odkaz Nahoru v pati�e
45 kakl 5  
6 //var undefined; // Pro zpetnou kompatibilitu kdyby JS nepodporoval undefined
7  
82 kaklik 8 var RelPath=""; // Prom�n�pro uloen�relativn�cesty k rootu webu
9 // Vechny cesty v tomto skriptu pak maj�bt cestami od
10 // rootu webu (nap�lad Web/PIC/MLAB.ico)
45 kakl 11  
12 function Test()
82 kaklik 13 // Testovac�funkce pro lad��
45 kakl 14 {
15 with (document)
16 {
17 var Info;
18 // Test
82 kaklik 19 // Uite�� document.URL (cesta a jm�o souboru str�ky)
45 kakl 20 write('<p class="MenuText Small">');
21 write('document language '+DocLang());
22 write('</p>');
23 write('<p class="MenuText Small">');
24 write('document language '+navigator.appVersion);
25 write('</p>');
26 write('<p class="MenuText Small">');
27 write('document language '+document.body.lang);
28 write('</p>');
29 write('<p class="MenuText Small">');
30 write('navigator language '+navigator.language); // FF ano, IE6 ne
31 write('</p>');
32 }
33 }
34  
35  
36 function DocLang()
82 kaklik 37 // Vrac�zkratku jazyka str�ky ( cs en )
38 // Nen�li v dokumentu uveden�vrac�en
45 kakl 39 {
40 var s;
41 s=document.body.lang.toLowerCase();
82 kaklik 42 if(s=="cs") return "cs"; // To by m�zaj�alo pro�je �tina cs a ne cz
43 if(s=="sk") return "cs"; // Pro slov�y bude asi �tina vhodn��
44 return "en"; // Pro vechny ostatn�d�e angli�inu
45 kakl 45 }
46  
47  
48 function SetRelativePath(Path)
82 kaklik 49 // Nastav�relativn��st cesty tak, abychom se dostali k rootu webu
50 // Nap�lad pro str�ky v adres�i "Web" je tento parametr "../"
45 kakl 51 {
82 kaklik 52 // Zapamatuji si relativn�cestu
45 kakl 53 RelPath=Path;
82 kaklik 54 // P�adn�dopln� na konec lom�ko
45 kakl 55 if (RelPath.length!=0)
56 if (RelPath.charAt(RelPath.length-1)!='/')
57 RelPath+='/';
58 }
59  
60  
61 function PokeRelativePath(Content)
82 kaklik 62 // Vezme et�ec a dopln�v n� vechny odkazy o relativn��st cesty
45 kakl 63 {
54 miho 64 Content=(Content.replace(/(\s+href=[\"\'])([^#])/ig,'$1'+RelPath+'$2'));
65 Content=(Content.replace(/(\s+src=[\"\'])([^#])/ig,'$1'+RelPath+'$2'));
45 kakl 66 return Content;
67 }
68  
69  
70 function DrawHeader(MoreInfo)
71 // Nepovinny parametr udava nadpis stranky
72 // Neni-li uveden bere se text ze znacky title dokumentu
73 {
82 kaklik 74 // Prom�n�pro vznikaj��vkl�an obsah
45 kakl 75 var Content="";
76 // Default informace pokud je parametr nezadany
77 if(MoreInfo==undefined) MoreInfo=document.title;
78 // Vlozeni HTML kodu
79 Content+='<div class="InnerHeader"> ';
80 if (DocLang()=="cs")
82 kaklik 81 { // �sk text
82 Content+='<a href="index.cs.html" title="Dom"><span class="HeaderLogo">MLAB</span><img border=0 width=120 height=57 src="Web/PIC/MLAB_online.gif" alt="MLAB Logo"></a>';
45 kakl 83 }
84 else
85 { // English text
86 Content+='<a href="index.en.html" title="Home"><span class="HeaderLogo">MLAB</span><img border=0 width=120 height=57 src="Web/PIC/MLAB_online.gif" alt="MLAB Logo"></a>';
87 }
88 Content+='<span class="HeaderText">'+MoreInfo+'</span>';
89 Content+='</div> ';
90 // Korekce cest v odkazech
91 Content=PokeRelativePath(Content);
82 kaklik 92 // Vstup sestaven�o textu
45 kakl 93 document.write(Content);
94 }
95  
96  
97 function DrawMenu(MoreInfo)
98 // Nepovinny parametr udava nazev menu
99 // Neni-li uveden dava se text Menu
100 {
82 kaklik 101 // Prom�n�pro vznikaj��vkl�an obsah
45 kakl 102 var Content="";
103 // Default text
104 if(MoreInfo==undefined) MoreInfo="Menu";
105 // Vlastni menu
106 Content+='<div class="InnerMenu">';
107 Content+=' <div class="Navigation">';
108 Content+=' <div class="MenuText">';
109 Content+= MoreInfo;
110 Content+=' </div>';
111 if (DocLang()=="cs")
82 kaklik 112 { // �sk text
45 kakl 113 Content+='<ul>';
82 kaklik 114 Content+=' <li> <a href="index.cs.html" title="Dom">Home</a> </li>';
115 Content+=' <li> <a href="Web/Modules.cs.html" title="Jednotliv�moduly MLAB">Moduly</a> </li>';
116 Content+=' <li> <a href="Web/Apparatus.cs.html" title="Samostatn�za�en�>Za�en�/a> </li>';
117 Content+=' <li> <a href="Web/Articles.cs.html" title="��ky, informace">Texty</a> </li>';
118 Content+=' <li> <a href="Web/Photos.cs.html" title="Galerie fotografi�>Fotogalerie</a> </li>';
119 Content+=' <li> <a href="../Forum" title="Forum uivatel a autor">Forum</a> </li>';
71 miho 120 Content+=' <li> <a href="Web/About.cs.html" title="O webu, stavebnici MLAB atd.">O projektu</a> </li>';
45 kakl 121 Content+='</ul>';
122 }
123 else
124 { // English text
125 Content+='<ul>';
71 miho 126 Content+=' <li> <a href="index.html" title="Home">Home</a> </li>';
127 Content+=' <li> <a href="Web/Modules.en.html" title="Individual MLAB Modules">Modules</a> </li>';
45 kakl 128 Content+=' <li> <a href="Web/Apparatus.en.html" title="Independed Devices">Apparatus</a> </li>';
129 Content+=' <li> <a href="Web/Articles.en.html" title="Articles and other Texts">Texts</a> </li>';
130 Content+=' <li> <a href="Web/News.cen.html" title="News">News</a> </li>';
71 miho 131 Content+=' <li> <a href="Web/Photos.en.html" title="Photo Gallery">Photogallery</a> </li>';
82 kaklik 132 Content+=' <li> <a href="../Forum" title="Forum MLAB">Forum</a> </li>';
71 miho 133 Content+=' <li> <a href="Web/About.en.html" title="About Project">About</a> </li>';
45 kakl 134 Content+='</ul>';
135 }
136 Content+=' </div>';
137 Content+='</div> ';
138 // Korekce cest v odkazech
139 Content=PokeRelativePath(Content);
82 kaklik 140 // Vstup sestaven�o textu
45 kakl 141 document.write(Content);
142 }
143  
144  
145 function DrawFooter(MoreInfo)
146 // Nepovinny parametr pro text do paticky
147 {
82 kaklik 148 // Prom�n�pro vznikaj��vkl�an obsah
45 kakl 149 var Content="";
150 // Default text je prazdny
151 if(MoreInfo==undefined) MoreInfo="";
152 // Vlozeni HTML kodu
153 Content+='<div class="InnerFooter">';
82 kaklik 154 Content+='&nbsp;'; // stupek IE6 (chyba vpo�u �ky pi nenulov� paddingu )
45 kakl 155 if (DocLang()=="cs")
82 kaklik 156 { // �sk text
45 kakl 157 Content+='<a href="#">Nahoru</a> &nbsp; ';
158 Content+='<a href="Web/Copyright.cs.html">Copyright</a> &copy; ';
82 kaklik 159 Content+='<a href="Web/AboutAuthors.cs.html">Autoi MLAB</a> &nbsp; ';
45 kakl 160 }
161 else
162 { // English text
54 miho 163 Content+='<a href="#">Up</a> &nbsp; ';
45 kakl 164 Content+='<a href="Web/Copyright.en.html">Copyright</a> &copy; ';
165 Content+='<a href="Web/AboutAuthors.en.html">MLAB Authors</a> &nbsp; ';
166 }
167 Content+='['+document.lastModified+'] &nbsp;&nbsp;&nbsp;';
168 Content+=MoreInfo;
169 Content+='</div>';
170 // Korekce cest v odkazech
171 Content=PokeRelativePath(Content);
82 kaklik 172 // Vstup sestaven�o textu
45 kakl 173 document.write(Content);
174 }