 function showhide(chapter){
  if (document.getElementById(chapter)){
   if (document.getElementById(chapter).style.display == "none"){
    if (chapter == 'tb_ask'){document.getElementById('b_statistic').value = "Скрыть статистику";};
    document.getElementById(chapter).style.display = "block";
   } else {
    if (chapter == 'tb_ask'){document.getElementById('b_statistic').value = "Показать статистику";};
    document.getElementById(chapter).style.display = "none";
   }
  }
 }

 function hidewin(chapter){  
    document.getElementById(chapter).style.display = "none";
 }

 function showwin(chapter){  
   document.getElementById(chapter).style.display = "block";
 }


 function space_height(name, value){
  if (document.getElementById(name)){ document.getElementById(name).height = value }
 }

 function header_width(){
  if (screen.width <= 1024) {
   if (document.getElementById('tb_main') && document.getElementById('tb_header')){ 
    document.getElementById('tb_header').width = document.getElementById('tb_main').clientWidth 
    document.getElementById('tb_hotmenu').width = document.getElementById('tb_main').clientWidth 
   }
  } else {
   if (document.getElementById('tb_main') && document.getElementById('tb_header')){ 
    document.getElementById('tb_header').width = screen.width - 20
    document.getElementById('tb_hotmenu').width = screen.width - 20
   }
  }
 }

 function spaceAll(){
//  space_height('space_1', 453); 
//  space_height('space_2', 185); 
//  space_height('space_3', 199); 
//  space_height('space_4', 841); 
//  space_height('space_5', 180); 
//  space_height('space_6', 136);
//  space_height('space_7', 616);
  space_height('space_1', 1); 
  space_height('space_2', 1); 
  space_height('space_3', 1); 
  space_height('space_4', 1); 
  space_height('space_5', 1); 
  space_height('space_6', 1);
  space_height('space_7', 1);
  header_width();
 }

function set_security(){
 document.cookie = "secure=1";
}

function security(){
 var cookstr = document.cookie;
 var arG = new Array();
 var unlock = false;
 arG = cookstr.split(';');
 
 for (var i=0; i < arG.length; i++){ if (arG[i].search('secure') >= 0) { unlock = true }}
	
 if (!unlock){ 
  document.write('<p align="center" style="color:red"><b>IAAAOI?ECIAAIIUE AINOOI! AOAAA INOI?I?IU!</b></p>') 
  document.write('<p align="center" style="color:red"><b>WARNING! ENTER WITHOUT AUTHENTICATION!</b></p>')
  
 }
}

//searchSetWord
function ssw(word){ 
 if ((document.f_search) && (word != '')){ document.cookie = "search_word=" + document.f_search.ss.value} else {document.cookie = "search_word=" + word}
	
}

//searchGetWord
function sgw(){
 var cookstr = document.cookie;
 var arG = new Array();
 var arL = new Array();

 arG = cookstr.split(';');
 
 for (var i=0; i < arG.length; i++){
  if (arG[i].search('search_word') >= 0) {
   arL = arG[i].split('=');   

  }
 }

 if ((document.f_search) && (arL[1] != null)){ document.f_search.ss.value = arL[1] }
	
}

var isGaleryStart = 0;

function galery(){
 obj = new Object(document.elementFromPoint(event.x, event.y));
 if (isGaleryStart) {w_gal.close()};
 width_  = 10;
 height_ = 10;
// w_gal = window.open('', 'w_gal','resizable scrollbars top='+Math.round(screen.height/2)+' left='+Math.round(screen.width/2)+' width='+width_+', height='+height_);
 w_gal = window.open('', 'w_gal','resizable scrollbars top=1 left=1');
 isGaleryStart = 1;
 w_gal.document.write("<title>"+obj.alt+"</title>");
 w_gal.document.write("<body><img alt='"+obj.alt+ "' src='http://www.wushu.org/foto/big/"+obj.nameProp+"'></body>");
 width_  = w_gal.document.images[0].width + 50;
 height_ = w_gal.document.images[0].height + 65;
 if (screen.width <= width_ ){ width_ = screen.width};
 if (screen.height <= height_ ){ height_ = screen.height};
// w_gal.resizeTo(width_, height_);
// w_gal.moveTo(Math.round(screen.width/2)-Math.round(width_/2),Math.round(screen.height/2)-Math.round(height_/2));
   
}

function empty(){};

function gal_load(){
 for (var j=0; j < document.getElementsByName("galery").length; j++){
  document.getElementsByName("galery")[j].onclick = galery;
  
 }
};
	
