/*
* +-----------------------------------------------------------------------------+
* | PHP version 5.x																|
* +-----------------------------------------------------------------------------+
* | 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 privée :										|
* | la copie complète ou partielle ainsi que sa distribution 					|
* | est formellement interdite.													|
* +-----------------------------------------------------------------------------+
* | English version																|
* +-----------------------------------------------------------------------------+
* | Copyright (©) 2004-2006 DOL - DataOnLine									|
* | Author: DOL developpement <dev@dol.fr>										|
* | contributor(s) : salem Aguemoun												|
* |.............................................................................|
* | This software is a private program :										|
* | the complete or partial copy and his distribution are formally prohibited.	|
* |.............................................................................|
* +-----------------------------------------------------------------------------+
* $Id: v 1.00 2006/10/01 00:00:00 salem $
*/
/**
* Javascript functions in hlm addons
*@package 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
*/

/**
* add selected identifier of hlm entities in url to open popup
*@abstract
*@param string url url for the window
*@param string name name for the window
*@param string features features for method open()
*@param string method method of posting : 'rewrite' or 'get'
*@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_hlm_open(url,name,features,method) {

	url_add = document.getElementById(name).value;

	if (url_add != '') {

		url_add = url_add.substr(0,(url_add.length -1));

		re = new RegExp("/", "g");
		url_add = url_add.replace(re, "");

		re = new RegExp(",", "g");
		url_add = url_add.replace(re, "_");

		if (method == 'get')
			url += '&value2='+url_add
		else
			url += '/'+url_add

	}

	window.open(url,name,features);

	return false;

}

/**
* put string in value of input element for hlm
*@abstract
*@param string id identifier of html element
*@param string value value to send
*@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_hlm_send_input(id,value) {

	window.opener.document.getElementById(id).value = value;

}

/**
* put string in value of html element for hlm
*@abstract
*@param string id identifier of html element
*@param string value value to send
*@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_hlm_send_html(id,value) {

	window.opener.document.getElementById(id).innerHTML = value;

}

/**
* take off entity of list
*@abstract
*@param string id_form identifier of form
*@param string id_list identifier of element constains list
*@param string entity value of identifier to take off
*@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 Datahlm(id_form,id_list,entity) {

	// get list of identifiers
	list = document.getElementById(id_list).value;

	// take off the element in list
	re =  new RegExp('/'+entity+'/,', 'gi');
	new_list = list.replace(re, '');

	// put in new value in 'input' element
	document.getElementById(id_list).value = new_list;

	// submit form
	document.getElementById(id_form).submit();

}

/**
* change topic
*@abstract
*@param int level level of topic changed
*@param object tag input object of form
*@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_hlm_change(level, tag, element) {

	if (level == 1) {

		document.getElementById(element).value = 0;

	}

	tag.form.submit();

}

