/*
* +-----------------------------------------------------------------------------+
* | Version française															|
* +-----------------------------------------------------------------------------+
* | Copyright (©) 2004-2006 DOL - DataOnLine									|
* | Auteur: DOL developpement <dev@dol.fr>										|
* | contributeur(s) : salem Aguemoun <salem@dol.fr>								|
* |.............................................................................|
* | Ce logiciel est un programme informatique servant à :						|
* | la gestion documentaire.													|
* | Il permet l'administration de document de tous types en permettant :		|
* | - la définition des modèles de document (propriétés)						|
* | - la saisie des documents (valeur des propriétés)							|
* | - la recherche de documents par des critères portés sur les propriétés		|
* |.............................................................................|
* | Ce logiciel est régi par la licence CeCILL soumise au droit français et		|
* | respectant les principes de diffusion des logiciels libres. Vous pouvez		|
* | utiliser, modifier et/ou redistribuer ce programme sous les conditions		|
* | de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA		|
* | sur le site "http://www.cecill.info".										|
* |																				|
* | En contrepartie de l'accessibilité au code source et des droits de copie,	|
* | de modification et de redistribution accordés par cette licence, il n'est	|
* | offert aux utilisateurs qu'une garantie limitée.  Pour les mêmes raisons,	|
* | seule une responsabilité restreinte pèse sur l'auteur du programme,  le		|
* | titulaire des droits patrimoniaux et les concédants successifs.				|
* | 																			|
* | A cet égard l'attention de l'utilisateur est attirée sur les risques		|
* | associés au chargement,  à l'utilisation,  à la modification et/ou au		|
* | développement et à la reproduction du logiciel par l'utilisateur étant 		|
* | donné sa spécificité de logiciel libre, qui peut le rendre complexe à 		|
* | manipuler et qui le réserve donc à des développeurs et des professionnels	|
* | avertis possédant  des  connaissances  informatiques approfondies.  Les		|
* | utilisateurs sont donc invités à charger  et  tester  l'adéquation  du		|
* | logiciel à leurs besoins dans des conditions permettant d'assurer la		|
* | sécurité de leurs systèmes et ou de leurs données et, plus généralement, 	|
* | à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. 			|
* | 																			|
* | Le fait que vous puissiez accéder à cet en-tête signifie que vous avez		|
* | pris connaissance de la licence CeCILL, et que vous en avez accepté les		|
* | termes.																		|
* +-----------------------------------------------------------------------------+
* | English version																|
* +-----------------------------------------------------------------------------+
* | Copyright (©) 2004-2006 DOL - DataOnLine									|
* | Author: DOL developpement <dev@dol.fr>										|
* | contributor(s) : salem Aguemoun												|
* |.............................................................................|
* | This software is a computer program whose purpose is to :					|
* | document management.														|
* | It allows the administration of document of all types while allowing :		|
* | - the definition of the models of document (properties)						|
* | - seizure of the documents (value of the properties)						|
* | - the document retrieval by criteria related to the properties				|
* |.............................................................................|
* | This software is a computer program whose purpose is to [describe			|
* | functionalities and technical features of your software].					|
* |																				|
* | This software is governed by the CeCILL license under French law and		|
* | abiding by the rules of distribution of free software. You can use,			|
* | modify and/ or redistribute the software under the terms of the CeCILL		|
* | license as circulated by DOL, CEA, CNRS and INRIA at the following URL		|
* | "http://www.cecill.info".													|
* |																				|
* | As a counterpart to the access to the source code and rights to copy,		|
* | modify and redistribute granted by the license, users are provided only		|
* | with a limited warranty  and the software's author, the holder of the		|
* | economic rights, and the successive licensors have only limited				|
* | liability.																	|
* |																				|
* | In this respect, the user's attention is drawn to the risks associated		|
* | with loading, using, modifying and/or developing or reproducing the			|
* | software by the user in light of its specific status of free software,		|
* | that may mean that it is complicated to manipulate, and that also			|
* | therefore means that it is reserved for developers and experienced			|
* | professionals having in-depth computer knowledge. Users are therefore		|
* | encouraged to load and test the software's suitability as regards their		|
* | requirements in conditions enabling the security of their systems			|
* | and/or data to be ensured and,  more generally, to use and operate it		|
* | in the same conditions as regards security.									|
* |																				|
* | The fact that you are presently reading this means that you have had		|
* | knowledge of the CeCILL license and that you accept its terms.				|
* +-----------------------------------------------------------------------------+
* $Id: v 1.00 2006/10/01 00:00:00 salem $
*/
/**
* Javascript functions for public space of DS.DOL
*@package DS.DOL
*@subpackage Javascript
*@version $Id: v 1.00 2006/10/01 00:00:00 salem $
*@since Class available since the release 1.00
*@access public
*@author DOL developpement <dev@dol.fr>
*@see headers.php
*@deprecated
*/

/**
* select (in order) or unselect the list of select (for SQL query)
*@abstract
*@param string ids list of identifier
*@param int max number of elements
*@param string action '+' to select, '-' to unselect
*@return
*@access public
*@author DOL developpement <dev@dol.fr>
*@version $Id: v 1.00 2006/10/01 00:00:00 salem $
*@since Method available since Release 1.00
*@deprecated
*@see menu.php
*/
function Select_all(ids,action) {

	if (ids != '') {

		// split in array
		ids = ids.split(',');

		for (var i= 0; i < ids.length; i++) {

			if (action == '+') document.getElementById(ids[i]).value = i+1;
			if (action == '-') document.getElementById(ids[i]).value = 0;

		}

	}

}

/**
* close popup
*@abstract
*@return
*@access public
*@author DOL developpement <dev@dol.fr>
*@version $Id: v 1.00 2006/10/01 00:00:00 salem $
*@since Method available since Release 1.00
*@deprecated
*@see menu.php
*/
function Popup_close() {

	window.close();

}

/**
* submit form and close popup in opener windows
*@abstract
*@param string form_name name of form to close
*@return
*@access public
*@author DOL developpement <dev@dol.fr>
*@version $Id: v 1.00 2006/10/01 00:00:00 salem $
*@since Method available since Release 1.00
*@deprecated
*@see menu.php
*/
function Popup_opener_form_submit(form_name) {

//	eval('window.opener.document.'+form_name+'.submit()');
//	eval('window.opener.location.reload()');

}

/**
* put in html element values selected from a 'select' element
*@abstract
*@param boolean checked state of checkbox
*@param string id identifier of element to put value
*@param string value value to put in tag
*@return
*@access public
*@author DOL developpement <dev@dol.fr>
*@version $Id: v 1.00 2006/10/01 00:00:00 salem $
*@since Method available since Release 1.00
*@deprecated
*@see menu.php
*/
function Listmulti_check_show(checked,id,value) {

	// get actual value
	html = document.getElementById(id).innerHTML;

	if (checked) {

		// html is empty
		if (html != '') {

			// clear linefeed
			re =  /\r|\n|\r\n/g;
			html = html.replace(re, '');

			// replace html tag
			re = /<li>/gi;
			html = html.replace(re, '¤');

			// clear html tag
			re =  /<\/li>/gi;
			html = html.replace(re, '');

			html = html.substr(1);

			// split in array
			html = html.split('¤');

			// add value
			html.push(value);

			// order array
			html.sort();

			// join in string
			html = html.join('¤');

			// put html tags
			re =  /\¤/gi;
			html = html.replace(re, '</li><li>');

			html = '<li>'+html+'</li>';

		} else {

			html = '<li>'+value+'</li>';

		}

	} else {

		// clear linefeed
		re =  /\r|\n|\r\n/g;
		html = html.replace(re, '');

		// clear value
		re =  new RegExp('<li>'+value+'</li>', 'gi');
		html = html.replace(re, '');

		// clear value for ie
		re =  new RegExp('<li>'+value, 'gi');
		html = html.replace(re, '');

	}

	// put new value
	document.getElementById(id).innerHTML = html;

}

/**
* display ul tag on over evenement
*@abstract
*@param string id identifier of ul tag
*@return
*@access public
*@author DOL developpement <dev@dol.fr>
*@version $Id: v 1.00 2006/10/01 00:00:00 salem $
*@since Method available since Release 1.00
*@deprecated
*@see menu.php
*/
function Listmulti_show(id) {

	with (document.getElementById(id).style) {

		position = 'static';
		visibility = 'visible';
	}

}

/**
* display ul tag on out evenement
*@abstract
*@param string id identifier of ul tag
*@return
*@access public
*@author DOL developpement <dev@dol.fr>
*@version $Id: v 1.00 2006/10/01 00:00:00 salem $
*@since Method available since Release 1.00
*@deprecated
*@see menu.php
*/
function Hide(id) {

	with (document.getElementById(id).style) {

		position = 'absolute';
		visibility = 'hidden';
	}

}

/**
* display ul tag on out evenement
*@abstract
*@param string id identifier of ul tag
*@return
*@access public
*@author DOL developpement <dev@dol.fr>
*@version $Id: v 1.00 2006/10/01 00:00:00 salem $
*@since Method available since Release 1.00
*@deprecated
*@see menu.php
*/
function Hide2visible(id) {

	// show
	if (document.getElementById(id).style.visibility != 'visible') {

		with (document.getElementById(id).style) {

			position = 'static';
			visibility = 'visible';
		}

	// hidde
	} else {

		with (document.getElementById(id).style) {

			position = 'absolute';
			visibility = 'hidden';
		}

	}

}

/**
* display ul tag on out evenement
*@abstract
*@param string id identifier of ul tag
*@return
*@access public
*@author DOL developpement <dev@dol.fr>
*@version $Id: v 1.00 2006/10/01 00:00:00 salem $
*@since Method available since Release 1.00
*@deprecated
*@see menu.php
*/
function Visible2hide(id) {

	// show
	if (document.getElementById(id).style.visibility != 'hidden') {

		with (document.getElementById(id).style) {

			position = 'absolute';
			visibility = 'hidden';
		}

	// hidde
	} else {

		with (document.getElementById(id).style) {

			position = 'static';
			visibility = 'visible';
		}

	}

}

/**
* check a list of checkbox
*@abstract
*@param boolean checked state of checkbox
*@param string type 'all' or 'none'
*@param string match list of identifier
*@return
*@access public
*@author DOL developpement <dev@dol.fr>
*@version $Id: v 1.00 2006/10/01 00:00:00 salem $
*@since Method available since Release 1.00
*@deprecated
*@see menu.php
*/
function Search_global_check(checked, match) {

	// split in array
	match = match.split(',');

	for (var i= 0; i < match.length; i++) {

		document.getElementById(match[i]).checked = checked;

	}

}

/**
* uncheck a list of checkbox
*@abstract
*@param boolean checked state of checkbox
*@param string type 'all' or 'none'
*@param string match list of identifier
*@return
*@access public
*@author DOL developpement <dev@dol.fr>
*@version $Id: v 1.00 2006/10/01 00:00:00 salem $
*@since Method available since Release 1.00
*@deprecated
*@see menu.php
*/
function Search_global_uncheck(match) {

	// split in array
	match = match.split(',');

	for (var i= 0; i < match.length; i++) {

		document.getElementById(match[i]).checked = 0;

	}

}


