var $sitename="webtonus.ru";var $sitenameshort="webtonusru";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 opened_tab=new Array();
function swichTab(tabSet,tabName,sender){
 if (opened_tab[tabSet]!=tabName){
  if (typeof(opened_tab[tabSet]) != 'undefined'){
   document.getElementById(tabSet+opened_tab[tabSet]).style.display="none";
  document.getElementById(tabSet+'Caption'+opened_tab[tabSet]).className="";
  }
  document.getElementById(tabSet+tabName).style.display="block";
  document.getElementById(tabSet+'Caption'+tabName).className="active";
  opened_tab[tabSet]=tabName;
  document.getElementById('catalog').style.backgroundImage="url(img/tabs"+tabName+".gif)";
 }
}
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(formId){
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]+"',"+formId+");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'+formId).innerHTML='<div>'+tagsline+'</div>';
}


function create_tag(tag,formId){
 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_"+formId+"_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(){
 return true;
}

var check_fields=new Array();
function checkFields(formId){
 js_check="";
 for (n=0;n<check_fields[formId]['id'].length;n++){
   el=document.getElementById('variable_'+formId+'_'+check_fields[formId]['id'][n]);
   if (!(el.value>'')) {
    js_check+=' \n \"'+check_fields[formId]['caption'][n]+'"';
    //el.className=class_names[n]+'_req';
   }else{
    el.className=check_fields[formId]['class_names'][n];
   }
 }

 if (js_check>''){
  alert("Заполните все выделенные поля!"+js_check);
  return false;
 }else{
  return true;
 }

}


function change_cont_file(field,sender){
 document.getElementById('form_row_'+field).style.display='';
}



function show_photos(form_id){
$ci_objects=eval('f'+form_id);
result='';
if(typeof($ci_objects)=='object')
 for ($nrow in $ci_objects){
  if ($nrow%2==1)$trclass=" class=\"b\""; else $trclass="";
  result='\
 <tr'+$trclass+'>\
  <td class="t-id">'+$nrow+'</td>\
  <td class="t-photo"><img height="62" src="'+$ci_objects[$nrow]['files']['s']['src']+'"/></td>\
  <td><div class="t-desc"><input type="text" name="f['+$nrow+'][alt]" value="'+$ci_objects[$nrow]['alt']+'" class="gallery_file-alt"/></td>\
  <td class="c"><input type=checkbox name="f['+$nrow+'][remove][auto]" value=1  class=field></td>\
 </tr>'+result;
 }
 if (result>''){
  result='\
<table class="t" width="100%">\
<tr align="center" class="t-name">\
  <td class="t-id">№</td>\
  <td class="t-photo">Фото</td>\
  <td class="t-txt" width="100%" >Описание</td>\
  <td class="t-pr">Удалить</td>\
</tr>\
 '+result+'\
</table>\
 ';
  document.getElementById('form_'+form_id+'_photos').innerHTML=result;
 }
}

function show_next_frame(form_id,gallery_id,$baseurl,$fullpath){
 if(nextnumber<=50){
  eval('fr'+nextnumber).document.open();
  eval('fr'+nextnumber).document.write('<html>\
 <body>\
  <form enctype="multipart/form-data" action="'+$baseurl+$fullpath+'?edit='+gallery_id+'&inputfile=js&form_id='+form_id+'&imgnumber='+nextnumber+'" method="post"><span id="divimg" style="display:none;"><img id="img"  alt=""/>&nbsp;<span id="filename"></span></span>\
   <input type="hidden" name="variable[0][store]" value="gallery">\
   <input type="hidden" name="variable[id][value]" value="'+gallery_id+'">\
   <input type="hidden" name="submitvariables" value="ok">\
   <input type="file"   name="f[last][auto]" id="variable_1_photo" style="border:1px #dddddd solid;" onchange="if (this.value>\'\'){this.style.display=\'none\';img.src=\''+$baseurl+'img/progress.gif\';window.parent.show_next_frame('+form_id+','+gallery_id+',\''+$baseurl+'\',\''+$fullpath+'\');parts=this.value.split(\'\\\\\');if(parts.length>0){filename.innerText=parts[parts.length-1];};divimg.style.display=\'block\';submit();}">\
  <img src="'+$baseurl+'img/progress.gif" style="display:none;"/>\
  </form>\
 </body>\
</html>');
  eval('fr'+nextnumber).document.close();

  divfr=document.getElementById('divfr'+nextnumber);
  divfr.style.display='block';

 }
 nextnumber++;
}




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 (sender, userwidth_img, userheight_img, userscrollbars_img,usertitle_img) {
if (typeof(open_img_window_edit_mode) == 'undefined'){
user_filename_img=sender.href
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;
sender.target='';
return false;
}else{
return 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();
}