// ??????????????????????
// <? header("Content-type: text/javascript");  require("../config.php");   print "var \$sitename=\"$sitename\";var \$sitenameshort=\"$sitenameshort\";"; ?>
//

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 MM_FlashCanPlay;
var MM_FlashCanPlayVersion=new Array();

function IsFlashCanPlay(contentVersion){

//return false; // отладка

  if(MM_FlashCanPlayVersion[contentVersion]==null){
    var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
    if ( plugin ) {
      var words = navigator.plugins["Shockwave Flash"].description.split(" ");
      for (var i = 0; i < words.length; ++i) {
	   if (isNaN(parseInt(words[i])))  continue;
	   var MM_PluginVersion = words[i];
      }
      MM_FlashCanPlay = MM_PluginVersion >= contentVersion;
    }
    else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
      document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); 
      document.write('on error resume next \n');
      document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & '+contentVersion+')))\n');
      document.write('</SCR' + 'IPT\> \n');
    }
    MM_FlashCanPlayVersion[contentVersion]=MM_FlashCanPlay;
    MM_FlashCanPlay=null;
  }
  return MM_FlashCanPlayVersion[contentVersion];
}


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++){ 
    tagsline += "<a href=\".\" onclick=\"create_tag('"+tags[n]+"',"+formId+");return false;\" title=\""+tags_titles[n]+"\">"
             +  "<img src=\"/i/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) 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();
      }
    }
  }
}

function MaskingMysql($sting){
 if ($sting!=null && $sting>''){
  $sting=$sting.replace(/(\\)/g,chr(92)+chr(92)); // \
  $sting=str_replace(/(')/g,chr(92)+"'");
 }
 return $sting;
}
function MaskingHtml($sting){
 if ($sting!=null && $sting>''){
  $sting=$sting.replace(/(&)/g,"&amp;");
  $sting=$sting.replace(/(<)/g,"&lt;");
  $sting=$sting.replace(/(>)/g,"&gt;");  //ereg_replace
  $sting=$sting.replace(/(")/g,"&quot;");
 }
 return $sting;
}
function MaskingHtmlSimple($sting){        
 if ($sting!=null && $sting>''){
  $sting=$sting.replace(/(<)/g,"&lt;");
  $sting=$sting.replace(/(>)/g,"&gt;");  //ereg_replace
  $sting=$sting.replace(/(")/g,"&quot;");
 }
 return $sting;
}


var is_open_submenu= new Array();
var opencloseimg   = new Array();
opencloseimg[0]    = new Image();
opencloseimg[1]    = new Image();
opencloseimg[0].src = '/i/minus.gif';
opencloseimg[1].src = '/i/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 != null){
     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;
 }
 return true;
}

function checkDefCode(formId, newvalue) {
 el=document.getElementById('variablereq_'+formId+'_defcode');
 if( el != null) {
   if(el.value == '1') el.value = newvalue;
 }
}

function change_cont_file(field, sender){
 document.getElementById('form_row_'+field).style.display='';
}


var title_img='chernogoria_club'; //$sitename;
var bgcolor_img="ffffff";
var window_name_img='img_chernogoria_club.ru'; //"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='chernogoria_club'; //$sitename;
var bgcolor_html="ffffff";
var window_name_html="html_chernogoria_club"; //"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();
}
