  function showbig(picname){
    window.open('/includes/foto.php5?pic='+picname,'_blank','scrollbars=yes,taskbar=no,resizeable=no,status=no,menubar=no,top=30,left=30,width=30,height=30');
  }

  function PreLoad(source){
    var NewImage = new Image();
    NewImage.src = source;
  }

  function prepareSubmit(frm){
    var len = frm.all("editbox").length; if (!len) len = 1;
    for (var i=0; i<len; i++)
      frm.all("codebox", i).innerText = frm.all("codebox", i).style.display ? borderOn(frm.all("codebox", i).innerText) : borderOn(frm.all("editbox", i).innerHTML);
  }

 function menuProcess(menuId){
    if(menuId.style.display == 'none'){
     menuId.style.display = 'block';
   }else{
      menuId.style.display = 'none';
   }
 }

 function btShowFunctionArguments(name){
   btChangeFunctionArgumentsBlock(name,'none','block','block');
 }

 function btHideFunctionArguments(name){
   btChangeFunctionArgumentsBlock(name,'block','none','none');
 }

 function btChangeFunctionArgumentsBlock(name,plus,minus,arguments){
    document.getElementById('backtrace_img_plus_'+name).style.display = plus;
    document.getElementById('backtrace_img_minus_'+name).style.display = minus;
    document.getElementById('backtrace_arguments_'+name).style.display = arguments;
 }

  function processTree(elementId,isTop){
    tbl = document.getElementById('dir_'+elementId);
    img = document.getElementById('img_'+elementId);

    if(tbl.style.display != 'none'){
       tbl.style.display = 'none';
       img.alt = 'Раскрыть';
       if(isTop)
         img.src = '/images/design/tree_plus.gif';
       else
         img.src = '/images/design/tree_sub_plus.gif';
    }else{
       tbl.style.display = 'block';
       img.alt = 'Закрыть';
       if(isTop)
         img.src = '/images/design/tree_minus.gif';
       else
         img.src = '/images/design/tree_sub_minus.gif';
    }
 }

$(document).ready(function(){
  if($('#newquest').length){
    $('#newquest input').focus(function(){
      
      rel = $(this).attr('rel');
      val = $(this).val();
      
      if (rel == val){
        $(this).val('');
      }
      
      if ($(this).hasClass('error')){
        $(this).removeClass('error');
        $(this).next().remove();
      }
      
      $(this).addClass('active');
      
    }).blur(function(){
      val = $(this).val();
      if ('' == val){
        rel = $(this).attr('rel');
        $(this).val(rel);
      }
      $(this).removeClass('active');
    });
    
    $('#newquest textarea').focus(function(){
      if ($(this).hasClass('error')){
        $(this).removeClass('error');
        $(this).next().remove();
       }

      rel = $(this).attr('rel');
      val = $(this).val();
      
      if (rel == val){
        $(this).val('');
      }
      $(this).addClass('active');
    }).blur(function(){
      val = $(this).val();
      if (val == ''){
        rel = $(this).attr('rel');
        $(this).val(rel);
      }
      $(this).removeClass('active');
    });
    
    $('#newquest').submit(function(){
      $('#newquest input').each(function(){
        rel = $(this).attr('rel');
        val = $(this).val();
        if (rel == val){
          $(this).val('');
        }
      });
      
      $('#newquest textarea').each(function(){
        rel = $(this).attr('rel');
        val = $(this).val();
        if (rel == val){
          $(this).val('');
        }
      });
    });
    

  }
}); 
    function reload(){
      image = new Image();
      image.onload = function(){
        $('#newquest .images .captcha img').attr('src',this.src);
      }
      rand = Math.random();
      image.src = '/captcha/?'+rand;
      return false;
    } 