Помогите разобраться. Ниже приведен код. Проблема: не корректно отображается кириллица в пунктах меню . Что необходимо изменить или исправить? cjgmenu.php Код (Text): include("cjgmenuconfig.php"); function menuhere() { echo("<script>menuhere();</SCRIPT>\n"); } function linea() { global $ln,$f; if(feof($f)) return(false); do { $l=fgets($f,4096); $l=trim($l); $ln++; } while(substr($l,0,2)=="//" || $l==""); return($l); } function parse() { global $ln; $s="[ "; $c=""; while($l=linea()) { if($l==")") { $s.="] "; return($s); } $a=split(",",$l,4); if(count($a)<4) die("Expected 4 comma-separated fields (line $ln)"); if($a[3]!="(") $icon=htmlentities(trim($a[3]),ENT_QUOTES); else $icon=""; $label=htmlentities($a[0],ENT_QUOTES); $url=htmlentities($a[1],ENT_QUOTES); $target=htmlentities($a[2],ENT_QUOTES); $s.=$c."['$label','$url','$target','$icon',0,'','',0,0,"; if($a[3]=="(") $s.=parse()."] "; else $s.="''] "; $c=","; } die("Unexpected EOF in $def"); } $f=fopen($def,"r") or die("Can't open $def"); $ln=0; $l=linea($f) or die("Unexpected EOF in $def"); if($l!="(") die("Format error in $def (line $ln): expected '('"); echo("<script>\n"); echo("var showfoldericon=$showfoldericon;\n"); echo("var showfileicon=$showfileicon;\n"); echo("var shownodelines=$shownodelines;\n"); echo("var showroot=$showroot;\n"); echo("var folderimages='$folderimages';\n"); echo("var foldericons='$foldericons';\n"); echo("var imgattrs=' width=$imgwidth height=$imgheight border=0';\n"); echo("var imgroot='$imgroot';\n"); echo("var imgfolderclose='$imgfolderclose';\n"); echo("var imgfolderopen='$imgfolderopen';\n"); echo("var imgplustop='$imgplustop';\n"); echo("var imgplustopbot='$imgplustopbot';\n"); echo("var imgplusmiddle='$imgplusmiddle';\n"); echo("var imgplusbottom='$imgplusbottom';\n"); echo("var imgminusmiddle='$imgminusmiddle';\n"); echo("var imgminustop='$imgminustop';\n"); echo("var imgminustopbot='$imgminustopbot';\n"); echo("var imgminusbottom='$imgminusbottom';\n"); echo("var imgjoinmiddle='$imgjoinmiddle';\n"); echo("var imgjointop='$imgjointop';\n"); echo("var imgjointopbot='$imgjointopbot';\n"); echo("var imgjoinbottom='$imgjoinbottom';\n"); echo("var imglinemiddle='$imglinemiddle';\n"); echo("var imglinebottom='$imglinebottom';\n"); echo("var imgfiledefault='$imgfiledefault';\n"); echo("</SCRIPT>\n"); echo("<LINK rel='STYLESHEET' type='text/css' href='cjgmenu.css'>\n"); echo("<script language='JavaScript' src='cjgmenu.js'></SCRIPT>\n"); echo("<script>\n"); echo("var root=['','','','',0,'','m0',0,0,".parse()."];\n"); echo("</SCRIPT>\n"); fclose($f); ?> cjgmenuconfig.php Код (Text): <?php /*------------------------------------------------------------------------------ CJG MENU v1.0 - Html Tree Menu Structure - Copyright (C) 2002 CARLOS GUERLLOY cjgmenu@guerlloy.com guerlloy@hotmail.com carlos@weinstein.com.ar Buenos Aires, Argentina -------------------------------------------------------------------------------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------*/ $def="cjgmenu.def"; // Menu definition file $showfoldericon=1; // Show/Hide folder icons $showfileicon=1; // Show/Hide file icons $shownodelines=1; // Show/Hide lines and plus/minus icons $showroot=0; // Show/Hide root icon $imgwidth=19; // Width for all icons and lines $imgheight=16; // Height for all icons and lines $folderimages="img"; // Location for images $foldericons="ico"; // Location for custom file icons // All these icons must be located under $folderimages folder $imgroot="folderopen.gif"; // Icon for root folder $imgfolderclose="folderclose.gif"; // Icon for closed folder $imgfolderopen="folderopen.gif"; // Icon for opened folder $imgplustop="plustop.gif"; // Icon for top plus mark $imgplustopbot="plustopbot.gif"; // Icon for unique plus mark $imgplusmiddle="plusmiddle.gif"; // Icon for middle plus mark $imgplusbottom="plusbottom.gif"; // Icon for bottom plus mark $imgminustop="minustop.gif"; // Icon for top minus mark $imgminustopbot="minustopbot.gif"; // Icon for unique minus mark $imgminusmiddle="minusmiddle.gif"; // Icon for middle minus mark $imgminusbottom="minusbottom.gif"; // Icon for bottom minus mark $imgjointop="jointop.gif"; // Icon for top join line $imgjointopbot="jointopbot.gif"; // Icon for unique join line $imgjoinmiddle="joinmiddle.gif"; // Icon for middle join line $imgjoinbottom="joinbottom.gif"; // Icon for bottom join line $imglinemiddle="linemiddle.gif"; // Icon for line $imglinebottom="linebottom.gif"; // Icon for bottom line (space) $imgfiledefault="page.gif"; // Icon for files ?> cjgmenu.js Код (Text): /*------------------------------------------------------------------------------ CJG MENU v1.0 - Html Tree Menu Structure - Copyright (C) 2002 CARLOS GUERLLOY cjgmenu@guerlloy.com guerlloy@hotmail.com carlos@weinstein.com.ar Buenos Aires, Argentina -------------------------------------------------------------------------------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------*/ var VLABEL=0; var VHREF=1; var VTARGET=2; var VICON=3; var VOPEN=4; var VPARENT=5; var VNAME=6; var VPOS=7; var VHEIGHT=8; var VMENU=9; var IROOT=0; var IFOLDER=1; var IPLUS=2; var IMINUS=3; var IJOIN=4; var ILINE=5; var IFILE=6; var ICLOSE=0; var IOPEN=1; var IMIDDLE=0; var IBOTTOM=1; var ITOP=2; var ITOPBOT=3; var seqname=0; var selback=''; function menuhtml(sm,id) { var i,s,o,starget,shref,sfolder,sfile,splus,sjoin,stomenu; if(arguments.length<1) sm="root[VMENU]"; if(arguments.length<2) id=0; seqname=id+1; var m=eval(sm); s="<TABLE class=tm id=m"+id+" border=0 cellspacing=0 cellpadding=0>\n"; if(showfoldericon) sfolder='<IMG align=absmiddle src="'+menuimg(IFOLDER,ICLOSE)+'" '+imgattrs+'>'; else sfolder=''; if(id==0 && showfoldericon && shownodelines && showroot) s+='<TR><TD><IMG src="'+menuimg(IROOT)+'" '+imgattrs+'>\n'; for(i=0;i<m.length;i++) { o=m[i]; o[VPOS]=IMIDDLE; if(i==m.length-1) o[VPOS]=IBOTTOM; if(id==0 && !showroot && shownodelines) { if(!i) o[VPOS]=ITOP; if(m.length==1) o[VPOS]=ITOPBOT; } if(o[VTARGET]!='') starget=' target="'+o[VTARGET]+'"'; else starget=''; if(o[VHREF]!='') shref=' href="'+o[VHREF]+'"'; else shref=' href="#"'; if(shownodelines) splus='<IMG src="'+menuimg(IPLUS,o[VPOS])+'" '+imgattrs+'>'; else splus=''; sjoin='<IMG src="'+menuimg(IJOIN,o[VPOS])+'" '+imgattrs+'>'; if(o[VMENU]!='') { s+="<TR><TD><A onclick='menuanchor(this,\""+sm+"\","+i+");'>"+splus+"</A></TD><TD nowrap>"+sfolder+"<A id=t"+id+"_"+i+shref+starget+" onclick='menusel(this);menuopen(this,\""+sm+"\","+i+");'>"+o[VLABEL]+"</A></TD></TR>\n"; } else { if(showfileicon) sfile='<IMG align=absmiddle src="'+menuimg(IFILE,o[VICON])+'" '+imgattrs+'>'; else sfile=''; s+="<TR><TD>"+sjoin+"</TD><TD nowrap>"+sfile+"<A id=t"+id+"_"+i+shref+starget+" onclick='menusel(this);'>"+o[VLABEL]+"</A></TD></TR>\n"; } } s+="</TABLE>\n"; return(s); } function menuanchor(este,sm,opt) { var m=eval(sm); if(m[opt][VOPEN]) menuclose(este,sm,opt); else menuopen(este,sm,opt); } function menuopen(este,sm,opt) { var m=eval(sm); var n; if(m[opt][VOPEN]) return; var t0=este.parentElement.parentElement.children.tags('TD')[0]; var t1=este.parentElement.parentElement.children.tags('TD')[1]; if(shownodelines) t0.children.tags('A')[0].children.tags('IMG')[0].src=menuimg(IMINUS,m[opt][VPOS]); if(showfoldericon) t1.children.tags('IMG')[0].src=menuimg(IFOLDER,IOPEN); n=seqname++; t1.innerHTML+=menuhtml(sm+'['+opt+'][VMENU]',n); m[opt][VOPEN]=1; m[opt][VNAME]="m"+n; for(var i=0;i<m[opt][VMENU].length;i++) m[opt][VMENU][i][VPARENT]=m[opt]; if(shownodelines) menubacktd(m[opt],0); } function menuclose(este,sm,opt) { var m=eval(sm); var t0=este.parentElement.parentElement.children.tags('TD')[0]; var t1=este.parentElement.parentElement.children.tags('TD')[1]; t0.innerHTML=t0.innerHTML.match(/.*<\/A>/); if(shownodelines) t0.children.tags('A')[0].children.tags('IMG')[0].src=menuimg(IPLUS,m[opt][VPOS]); t1.innerHTML=t1.innerHTML.match(/.*<\/A>/); if(showfoldericon) t1.children.tags('IMG')[0].src=menuimg(IFOLDER,ICLOSE); if(shownodelines) menubacktd(m[opt],1); menuclosevar(m[opt]); } function menuclosevar(o) { var i; if(o[VMENU]!="") { o[VNAME]=""; o[VOPEN]=0; o[VHEIGHT]=0; for(i=0;i<o[VMENU].length;i++) menuclosevar(o[VMENU][i]); } } function menuline(n,bottom) { var s,i; s='<TABLE class=tm border=0 cellspacing=0 cellpadding=0>'; for(var i=0;i<n;i++) s+='<TR><TD><IMG src="'+menuimg(ILINE,bottom)+'" '+imgattrs+'></TD></TR>'; s+='</TABLE>'; return(s); } function menubacktd(o,neg) { var t0,s,e1; l=o[VMENU].length; if(neg) { l=-o[VHEIGHT]; o=o[VPARENT]; } while(o!='') { o[VHEIGHT]+=l; e1=eval(o[VNAME]); t0=e1.parentElement.parentElement.children.tags('TD')[0]; s=t0.innerHTML.match(/<A.*<\/A>/); s+=menuline(o[VHEIGHT],o[VPOS]); t0.innerHTML=s; o=o[VPARENT]; } } function menusel(t) { if(selback!='') { eval(selback).className=''; } selback=t.id; t.className='sel'; } function menuimg(t,s) { var img,dir; dir=folderimages; switch(t) { case IROOT: img=imgroot; break; case IFOLDER: switch(s) { case ICLOSE: img=imgfolderclose; break; case IOPEN: img=imgfolderopen; break; } break; case IPLUS: switch(s) { case ITOP: img=imgplustop; break; case ITOPBOT: img=imgplustopbot; break; case IMIDDLE: img=imgplusmiddle; break; case IBOTTOM: img=imgplusbottom; break; } break; case IMINUS: switch(s) { case ITOP: img=imgminustop; break; case ITOPBOT: img=imgminustopbot; break; case IMIDDLE: img=imgminusmiddle; break; case IBOTTOM: img=imgminusbottom; break; } break; case IJOIN: switch(s) { case ITOP: img=imgjointop; break; case ITOPBOT: img=imgjointopbot; break; case IMIDDLE: img=imgjoinmiddle; break; case IBOTTOM: img=imgjoinbottom; break; } if(!shownodelines) img=imglinebottom; break; case ILINE: switch(s) { case IBOTTOM: case ITOPBOT: img=imglinebottom; break; default: img=imglinemiddle; break; } break; case IFILE: if(s=='') img=imgfiledefault; else { dir=foldericons; img=s; } break; } return(dir+"/"+img); } function menuexpand(r,i) { return(menuclick(r,i,false)); } function menucollapse(r,i) { return(menuclick(r,i,true)); } function menuclick(r,n,oc) { var m,qt,mh,o,i; if(r[VNAME]=='') return(false); mh=eval(r[VNAME]); m=r[VMENU]; if(typeof(n)=='number') i=n; else { for(i=0;i<m.length;i++) if(n==m[i][VLABEL]) break; if(i==m.length) return(false); } qt=mh.children.tags('TBODY')[0].children.tags('TR'); o=m[i]; if(o[VMENU]!='') { if(o[VOPEN]==oc) qt[i].children.tags('TD')[0].children.tags('A')[0].click(); } return(o); } function menuexpandall(r) { var m,i,qt,mh,o; if(arguments.length<1) { r=root; } mh=eval(r[VNAME]); m=r[VMENU]; qt=mh.children.tags('TBODY')[0].children.tags('TR'); for(i=0;i<m.length;i++) { o=m[i]; if(o[VMENU]!='') { if(!o[VOPEN]) qt[i].children.tags('TD')[0].children.tags('A')[0].click(); menuexpandall(o); } } } function menucollapseall() { var i,qt,o,m; qt=m0.children.tags('TBODY')[0].children.tags('TR'); m=root[VMENU]; for(i=0;i<m.length;i++) { o=m[i]; if(o[VMENU]!='') { if(o[VOPEN]) qt[i].children.tags('TD')[0].children.tags('A')[0].click(); menuclosevar(o); } } } function menuhere() { document.write(menuhtml()); } cjgmenu.def Код (Text): ( Numbers,,,( One,w.php?p=one.html,_blank, ) Letters,,,( Alfa,w.php?p=alfa.html,_blank, ) Colors,,,( Blue,w.php?p=blue.html,_blank, Green,w.php?p=green.html,_blank,html.gif Red,w.php?p=red.html,_blank, Grayscales,,,( Black,w.php?p=black.html,_blank, Dark gray,w.php?p=darkgray.html,_blank, Gray,w.php?p=gray.html,_blank, Light gray,w.php?p=lightgray.html,_blank, White,w.php?p=white.html,_blank, Deeper,w.php?p=deeper.html,_blank,( I'm,w.php?p=im.html,_blank, Out of,w.php?p=outof.html,_blank, Topics,w.php?p=topics.html,_blank, ) ) Yellow,w.php?p=yellow.html,_blank, ) Months,,,( January,w.php?p=january.html,_blank, ) Weekdays,,,( Monday,w.php?p=monday.html,_blank, ) )