cb='b0';
var cblock=0;
function showblock(block){
if (cblock>0){
document.getElementById('stationsblock'+cblock).style.display="none";
}
document.getElementById('stationsblock'+ block).style.display="block";
cblock=block;
}
function over(buttonname){
eval('window.document.'+buttonname).src=(eval('window.document.'+buttonname).src).substr(0,(eval('window.document.'+buttonname).src).length-5)+'1.gif';
}
function out(buttonname){
eval('window.document.'+buttonname).src=(eval('window.document.'+buttonname).src).substr(0,(eval('window.document.'+buttonname).src).length-5)+'0.gif';
}
function over2(buttonname){
buttonname.src=(buttonname.src).substr(0,(buttonname.src).length-5)+'1.gif';

}
function out2(buttonname){
buttonname.src=(buttonname.src).substr(0,(buttonname.src).length-5)+'0.gif';
}

function over3(buttonname){
if (cb!=buttonname){eval('window.document.'+buttonname).src=eval('window.document.'+buttonname+'_1').src};
}

function out3(buttonname){
if (cb!=buttonname){eval('window.document.'+buttonname).src=eval('window.document.'+buttonname+'_0').src};
}

function closewindow(){
//if(window_name_img_number_old>0){window_handle_img[window_name_img_number_old].close();}
}





var tags=new Array('b','i','u','s');
var tags_replace=new Array('strong','em','u','s');
var tags_rus=new Array('Ж','К','Ч','З');
var tags_titles=new Array('Жирный','Курсив','Подчеркнуть','Зачеркнуть');
function createToolbar(){
var tagsline='';
for(n=0;n<tags.length;n++){//<input type=button value=\"\" class=editor_button_"+tags[n]+" />
 tagsline+="<a href=\".\" onclick=\"create_tag('"+tags[n]+"');return false;\" title=\""+tags_titles[n]+"\"><img src=\"img/tag-"+tags[n]+".gif\" width=\"20\" height=\"20\" alt=\""+tags_rus[n]+"\"></a>";
}
document.getElementById('commentToolbar').innerHTML='<div>'+tagsline+'</div>';
}


function create_tag(tag){
 function insert_tag(tag,textSelected){
    textNew=textSelected;
    for(n=0;n<tags.length;n++){
     if (tag==tags[n])textNew='<'+tags_replace[n]+'>'+textSelected+'</'+tags_replace[n]+'>';
    }
    return textNew;
 }

 var working_area="variable_comment";
 element = document.getElementById(working_area);

  if (element.setSelectionRange) {
    var selectionStart = element.selectionStart;
    var selectionEnd = element.selectionEnd;
    textBefore=element.value.substring(0, selectionStart);
    textSelected=element.value.substring(selectionStart,selectionEnd);
    textAfter=element.value.substring(selectionEnd);
    textNew=insert_tag(tag,textSelected);
    element.value=textBefore+textNew+textAfter;
    if (selectionStart != selectionEnd) // has there been a selection
     element.setSelectionRange(selectionStart, selectionStart+textNew.length);
    element.focus();
  }else if (document.selection) {

    var selectionStart = element.selectionStart;
    var selectionEnd = element.selectionEnd;

	   element.focus();
	   if (document.selection) {
	    SelectedText = element.document.selection.createRange();
	    if(SelectedText.text>''){
      textNew=insert_tag(tag,SelectedText.text);
      SelectedText.text=textNew;
      SelectedText.moveStart('character', -textNew.length);
      SelectedText.select();
	    }

   }
 }
}


/*
if (!((navigator.appName=='Netscape') & (navigator.appVersion.substr(0,1)<='4'))){
 document.write('\
<style>\
.field,.field100px,.button {\
	font-size:8pt;\
	font-family : Tahoma;\
 margin:0px;\
 padding: 1px 2px 0px 3px;\
	ccolor: #8ec5ff;\
}\
.field,.field100px {\
    ccolor: #021176;\
    border: #bdbdbd solid 1px;\
}\
.field100px, .field100px option {\
    ccolor: #021176;\
    border: #bdbdbd solid 1px;\
    width: 160px;\
}\
.button{\
    ccolor: #ffffff;\
				background-color : #888888;\
    border: #333333 solid 1px;\
				cursor:hand;\
}\
.tobasket{\
	border:0px;\
	cursor:hand;\
}\
</style>\
 ');
}
*/


var is_open_submenu=new Array();
var opencloseimg=new Array();
opencloseimg[0]=new Image();
opencloseimg[1]=new Image();
opencloseimg[0].src='img/minus.gif';
opencloseimg[1].src='img/plus.gif';
function openclose(m_id){
 if (typeof(is_open_submenu[m_id]) == 'undefined'){
  is_open_submenu[m_id]=true;
 }

 if (is_open_submenu[m_id]){
  eval('window.document.img'+m_id).src=opencloseimg[0].src;
  eval('window.document.img'+m_id).alt='-';
  document.getElementById('submenu'+m_id).style.display='block';
  is_open_submenu[m_id]=false;
 }else{
  eval('window.document.img'+m_id).src=opencloseimg[1].src;
  eval('window.document.img'+m_id).alt='+';
  document.getElementById('submenu'+m_id).style.display='none';
  is_open_submenu[m_id]=true;
 }
return false;
}



function chekfields(){
 js_check='';
 for (n=0;n<check_fields.length;n++){
   el=document.getElementById('variable_'+check_fields[n]);


   if (check_fields_group[n]>'') groupCheck=document.getElementById('variable_'+check_fields_group[n]).checked; else groupCheck=true;

   if (!(el.value>'') & groupCheck) {
    js_check+=' \n \"'+check_fields_caption[n]+'"';
   }else{
    el.className=class_names[n];
   }
 }

 if (js_check>''){
  alert("Заполните все выделенные поля!"+js_check);
  return false;
 }else{
  return true;
 }

}

function click_group(group,obj){
 document.getElementById('variable_'+group).click();
 if (!document.getElementById('variable_'+group).checked){
  document.getElementById('content_'+group).style.display='none';
  document.getElementById('marker_'+group).src='img/order-plus.gif';
  document.getElementById('link_'+group).title='Открыть';
 }else{
  document.getElementById('content_'+group).style.display='block';
  document.getElementById('marker_'+group).src='img/order-minus.gif';
  document.getElementById('link_'+group).title='Закрыть';
 }
}


function change_cont_file(field,sender){
 row=document.getElementById('form_row_'+field);
 row.style.display='block';
}



var title_img=$sitename;
var bgcolor_img="ffffff";
var window_name_img="img_"+$sitenameshort;
var window_handle_img;
var filename_img;
var title_img;
var width_img_auto=600;
var height_img_auto=400;
var scrollbars_img_auto='no';
var window_is_open=false;

function open_img_window (user_filename_img, userwidth_img, userheight_img, userscrollbars_img,usertitle_img) {
filename_img=user_filename_img;
width_img=width_img_auto;
height_img=height_img_auto;
scrollbars_img=scrollbars_img_auto;
resize_img_auto=1;
if (usertitle_img>''){}else{usertitle_img='';}
if ((userwidth_img>40)&(userheight_img>40)){
 width_img=userwidth_img;
 height_img=userheight_img;
 resize_img_auto=0;
 }

if (userscrollbars_img>''){scrollbars_img=userscrollbars_img;};
window_handle_img = window.open("",window_name_img, "menubar=no,directories=no,location=no,resizable=no,scrollbars="+scrollbars_img+",width="+width_img +",height="+height_img+",left="+((screen.width-width_img)/2)+",top="+((screen.height-height_img-56)/2));
window_handle_img.document.open();
window_handle_img.document.write('                                                            \
<html>                                                                                        \
 <head>                                                                                       \
  <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">                  \
  <meta http-equiv="Content-Language" content="ru">                                           \
  <title>'+usertitle_img+' '+title_img+'</title>                                              \
  <link rel="stylesheet" type="text/css" href="main.css">                                     \
  <script language="JavaScript">                                                              \
var resize_img_auto='+resize_img_auto+';                                                      \
function resizewindow(){                                                                      \
/*window.document.title=window.document.img.width+\' \'+window.document.img.height;*/         \
self.resizeTo((window.document.img.width+10),(window.document.img.height+68));                \
self.moveTo(                                                                                  \
(screen.width-window.document.img.width-10)/2,                                                \
(screen.height-window.document.img.height-68)/2);}                                            \
  </script>                                                                                   \
 </head>                                                                       				  \
                                                                                              \
 <body onblur="window.close();" bgcolor="#'+bgcolor_img+'" topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0 marginwidth=0 marginheight=0  onload="if (resize_img_auto==1){self.resizeTo((window.document.img.width+10),(window.document.img.height+48));self.moveTo((screen.width-window.document.img.width-10)/2,(screen.height-window.document.img.height-68)/2);openwnd=setTimeout(\'resizewindow();\',500);}else{self.resizeTo(('+width_img+'+10),('+height_img+'+48));self.moveTo((screen.width-'+width_img+'-10)/2,(screen.height-'+height_img+'-68)/2);}">                            \
                                                                                              \
<table width=1000 height=768 border=0 cellpadding=0 cellspacing=0 width=100% height=100%>     \
 <tr>                                                                                         \
  <td align=left valign=top><a href="JavaScript:window.close();" title="close"><img src="'+filename_img+'" alt="закрыть" border=0 name=img></a><!--br>'+usertitle_img+'<br-->                                          \
  </td>                                                                                       \
 </tr>                                                                                        \
</table>                                                                                      \
                                                                                              \
 </body>                                                                                      \
</html>');
window_handle_img.document.close();
window_handle_img.focus();
window_is_open=true;
}









var title_html=$sitename;
var bgcolor_html="ffffff";
var window_name_html="html_"+$sitenameshort;
var window_handle_html;
var filename_html;
var width_html_auto=600;
var height_html_auto=400;
var scrollbars_html_auto='yes';

function open_html_window (user_filename_html, userwidth_html, userheight_html,userscrollbars_html) {
filename_html=user_filename_html;
width_html=width_html_auto;
height_html=height_html_auto;
scrollbars_html=scrollbars_html_auto;

if (userwidth_html>40){width_html=userwidth_html;};
if (userheight_html>40){height_html=userheight_html;};
if (userscrollbars_html>''){scrollbars_html=userscrollbars_html;};

window_handle_html = window.open(filename_html,window_name_html,"menubar=no,directories=no,location=no,resizable=no,scrollbars="+scrollbars_html+",width="+width_html +",height="+height_html+",left="+((screen.width-width_html)/2)+",top="+((screen.height-height_html-56)/2));
window_handle_html.focus();
}