/**
 * E-Bureau Javascript library
 * 
 * @author        Sebastien
 * @version       $Revision: 57 $
 * @modifiedby    $LastChangedBy: seb $
 * @lastmodified  $Date: 2007-01-28 17:17:33 +0100 (Sun, 28 Jan 2007) $
 *
 * @use           prototype
 *
 */
 
 

/**
 * Check all checkboxes of a group
 *
 * @param   (string)  Form id
 * @param   (string)  Name of a checkboxes group
 * @param   (bool)    Checkbox state
 *
 * @return  (bool)
 */
toggleCheckAll = function (strFormId, strCkbName, blnCkbState) {

  var arrCkb = Form.getInputs(strFormId, 'checkbox', strCkbName);
  
  arrCkb.each(function(objCkb){
    
   objCkb.checked = blnCkbState;
  });
        
  return true;
}


/**
 * Alert window
 *
 * @param  (string) Message
 * @return (bool)
 */  
showAlert = function (message) {
  
  Dialog.alert( message, 
               { windowParameters: { className: 'alphacube', width: 300, height: 100 }, okLabel: 'Fermer' });
  
  return true;
}


/**
 * Show whole news
 *
 * @param  (int) News id
 * @return (bool)
 */  
readMore = function (id) {
  
  $('readmore_'+id).hide();
  new Ajax.Updater('readmore_'+id,'/news/readmore/'+id, { 
    onComplete: function(request) { Effect.BlindDown('readmore_'+id, { duration: 1 }) }, 
    asynchronous:true, evalScripts:true, requestHeaders:['X-Update', 'formbox'] });
}


/**
 * Close a news
 *
 * @param  (int) News id
 * @return (bool)
 */  
closeMore = function (id) {
  
  new Ajax.Updater('readmore_'+id,'/news/closemore/'+id, {  
    asynchronous:true, evalScripts:true, requestHeaders:['X-Update', 'formbox'] });
}
