  function updateArea(page_name, lang){
      new Ajax.Updater('action_area', 'updater.php', {
    	method:'post',asynchronous:true, parameters :{page: page_name, lang:lang},onComplete: function(responce){updateAreaComplete(); }
    	}); 
    }
    
    function updateAreaComplete(){
       //runFeedCarousel_1();
       //reCacheFeeds();
       //remake_carousel();
       //orderFeeds();
       //search_posts($('filter_box'));
       
    }
    
  function changePhotoView(photo_name, photo_link, photo_id, lang){
     $('photo_view').src = 'images/photos/'+ photo_name;
     
     $('photo_view_link').href = 'images/photos/'+ photo_link;
     
     $('photo_in_win_link').href = 'images/photos/'+ photo_link;
     
     new Ajax.Updater('photo_info_description', 'photo_comment.php', {
    	method:'post',asynchronous:true, parameters :{id: photo_id, lang:lang}
    	}); 
  
  }
  
  function removePhoto(photo_id){
      new Ajax.Updater('photos_list', 'remove_photo.php', {
    	  method:'post',asynchronous:true, parameters :{photo_id: photo_id}
    	}); 
    }
    
 function editPhoto(photo_id){
      new Ajax.Updater('photo_cell_' + photo_id, 'edit_photo.php', {
    	  method:'post',asynchronous:true, parameters :{photo_id: photo_id}
    	}); 
    }     
    
  function removeNew(new_id){
      new Ajax.Updater('news_list', 'remove_new.php', {
    	  method:'post',asynchronous:true, parameters :{new_id: new_id}
    	}); 
    }    
    
  function editNew(new_id){
      new Ajax.Updater('new_cell_' + new_id, 'edit_new.php', {
    	  method:'post',asynchronous:true, parameters :{new_id: new_id}
    	}); 
    } 
    
   function removeFile(file_id, section){
      new Ajax.Updater('files_list', 'remove_file.php', {
    	  method:'post',asynchronous:true, parameters :{file_id: file_id,section:section}
    	}); 
    }
    
   function editFile(file_id, section){
      new Ajax.Updater('file_cell_' + file_id, 'edit_file.php', {
    	  method:'post',asynchronous:true, parameters :{file_id: file_id,section:section}
    	}); 
    }    
    
//   function archiveFile(file_id, section){
//      new Ajax.Updater('files_list', 'edit_file.php', {
//    	  method:'post',asynchronous:true, parameters :{file_id: file_id,section:section}
//    	}); 
//    }     
    
 function updateFilesList(section){
      new Ajax.Updater('files_list', 'update_files_list.php', {
    	  method:'post',asynchronous:true, parameters :{section:section}
    	}); 
    }
    
 function updateArchiveList(section){
      new Ajax.Updater('files_list', 'update_files_list.php', {
    	  method:'post',asynchronous:true, parameters :{section:section, archive:true}
    	}); 
    }    
    
    
    
function AddBookmark(){
  if(document.all)
    window.external.AddFavorite(location.href,document.title);
  else if(window.sidebar)window.sidebar.addPanel(document.title,location.href,'');
}


function SwitchNews(new_height){
  if($('news_section').style.height == 'auto') HideNews(new_height);
  else ShowNews();
}

function ShowNews(e){
  $('news_section').style.height = 'auto';
  $('img_news_open').src = 'images/key_up.png';
}

function HideNews(new_height){
  $('news_section').style.height = new_height + 'px';
  $('img_news_open').src = 'images/key_down.png';
}


  function sendUserEmail(lang){
      var user_email_value = $('user_email').value;
      var user_msg_value = $('user_msg').value;
      
      new Ajax.Updater('send_email_notify', 'send_email.php', {encoding:'windows-1251',
    	method:'post',asynchronous:true, parameters :{user_email: user_email_value, user_msg: user_msg_value, lang:lang}
    	}); 
    }
    
  function sendConsult(lang){
      var user_email_value = $('user_email').value;
      var user_msg_value = $('user_msg').value;
      var user_name_value = $('user_name').value;
      var user_theme_value = $('user_theme').value;
      var antispam_code_value = $('antispam_code').value;
      
      new Ajax.Updater('send_email_notify', 'send_consult.php', {encoding:'windows-1251',
    	method:'post',asynchronous:true, parameters :{antispam_code: antispam_code_value,user_name: user_name_value,user_theme: user_theme_value,user_email: user_email_value, user_msg: user_msg_value, lang:lang}
    	}); 
    }    
    
  function showSingle(sender,page_name,lang){  
    show_sub_menu(sender, page_name); 
    updateArea(page_name, lang);
    }
    
 function markCurrentSection(e){
 if(!current_page || current_page =="") return;
 var temp = 'p='+current_page;
 //alert(temp);
   $$('#menu ul li a').each(function(el){
     if(stripos(el.href, temp)>0){
        var ref_parent = el.parentNode.parentNode;
        ref_parent.removeClassName('sub_menu');
        ref_parent.toggleClassName('sub_menu_lock');
        
        var ref_parent = ref_parent.parentNode;
                
        var div = ref_parent.getElementsBySelector('div.key_unlock');
        if(div[0]){
          div[0].removeClassName('key_unlock');
          div[0].toggleClassName('key_lock');
        }
         
         return;
        
      }
   });
   
   $$('#menu li div.key_unlock a').each(function(el){
     if(stripos(el.href, temp)>0){
        var ref_parent = el.parentNode;
        ref_parent.removeClassName('key_unlock');
        ref_parent.toggleClassName('key_lock');
      
         return;
        
      }
   });   
   
 }
 
 function stripos ( f_haystack, f_needle, f_offset ){
    // http://kevin.vanzonneveld.net
    // +     original by: Martijn Wieringa
    // +      revised by: Onno Marsman
    // *         example 1: stripos('ABC', 'a');
    // *         returns 1: 0
 
    var haystack = (f_haystack+'').toLowerCase();
    var needle = (f_needle+'').toLowerCase();
    var index = 0;
 
    if ((index = haystack.indexOf(needle, f_offset)) !== -1) {
        return index;
    }
    return false;
}

 function updateContentList(lang){
      Element.hide($('content_msg')); 
      $('content_msg').innerHTML  ='';  
      new Ajax.Updater('content_list', 'content_list.php', {
    	  method:'post',asynchronous:true, parameters :{lang:lang}
    	}); 
    	
    	if($('current_page_name').value && $('current_page_name').value != ''){
    	  getContentPage($('current_page_name').value, lang);
    	}
 }    



  function getContentPage(page_name, lang){   
      Element.hide($('content_msg'));   
      $('content_msg').innerHTML  ='';  
      $('current_page_name').value = page_name;
      $('current_lang').value = lang;
      
      new Ajax.Request('get_page_content.php', {encoding:'windows-1251',
    	method:'post',asynchronous:true, parameters :{page: page_name, lang:lang},onComplete: function(responce){setEditorContent(responce); }
    	}); 
    }
    
  function writeContentPage(){
    var content = tinyMCE.get('elm1').getContent();
    var page_name = $('current_page_name').value;
    var lang = $('current_lang').value;
      
    new Ajax.Updater('content_msg','write_page_content.php', {
      method:'post',asynchronous:true, parameters :{page: page_name, lang:lang, content:content}
    }); 
   
  }
    
 function setEditorContent(data){
 //alert('jop');
  Element.show($('content_msg'));
  Element.show($('content_area'));
  tinyMCE.get('elm1').setContent(data.responseText);
 }