/*
* +-----------------------------------------------------------------------------+
* | 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 for admin space in dol 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 thesaurus values 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_thes_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 thesaurus
*@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_thes_send_input(id,value) {

	window.opener.document.getElementById(id).value = value;

}

/**
* put string in value of html element for thesaurus
*@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_thes_send_html(id,value) {

	window.opener.document.getElementById(id).innerHTML = value;

}

/**
* take off value of list
*@abstract
*@param string action action to do input tag
*@param string url new url for form
*@param string data 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 Datathes(action,url,data,method) {

	// change url of form (action)
	document.getElementById('fo_datathes_menu').action += url;

	// change url of form
	document.getElementById('datathes_action').value = action;

	// change url of form
	document.getElementById('datathes_data').value = data;

	// submit the form
	document.getElementById('fo_datathes_menu').submit();
}

/**
* add selected identifier of thesaurus values 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_link_open(url,name,features,method) {

	url_add = document.getElementById(name).value;

	if (url_add != '') {

		re = /\\|\//g;
		url_add = url_add.replace(re, "|");

		if (method == 'get')
			url += '&value=' + url_add
		else
			url += '/' + url_add

	}

	window.open(url,name,features);

	return false;

}

/**
* put string in value of html element on change
*@abstract
*@param string id_from identifier of input element contains value
*@param string id identifier of input element
*@param string id_html identifier of html element
*@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_link_change(path,id_from,id,id_html) {

	re = /\\/g;
	path_replace = path.replace(re, "\\\\");

	re = /\\/g;
	path_show = path.replace(re, "|");

	value = document.getElementById(id_from).value;

	re =  new RegExp(path_replace, 'gi');
	subvalue = value.replace(re, "");

	re = /\\|\//g;
	htlm = subvalue.replace(re, "|");

	if (subvalue == value) {

		htlm = '<div style="font-weight: bold; color: #f00;">Erreur<br />le chemin de base &#58; &#171;'+path_show+'&#187;<br />n&#39;est pas pr&#233;sent dans :</div>'+htlm;

	}

	document.getElementById(id).value = subvalue;

	document.getElementById(id_html).innerHTML = htlm;

}

/**
* empty value of html element
*@abstract
*@param string id identifier of input element
*@param string id_html identifier of html element
*@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_link_empty(id,id_html) {

	document.getElementById(id).value = '';

	document.getElementById(id_html).innerHTML = '';

}

/**
* put string in value of input element for link
*@abstract
*@param string id identifier of html element
*@param string id_this identifier of html element contains value
*@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_link_send_input(id,id_this) {

	window.opener.document.getElementById(id).value = document.getElementById(id_this).value;

}

/**
* put string in value of html element for link
*@abstract
*@param string id identifier of html element
*@param string id_this identifier of html element contains value
*@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_link_send_html(id,id_this) {

	window.opener.document.getElementById(id).innerHTML = document.getElementById(id_this).value;

}



