////////////////////////////////////////////////////////////////////////////
//
//  PMP CONCEPT 2007 :: MODIFIE LA CLASSE DE L'ELEMENT ID POUR L'AFFICHER OU NON
//
////////////////////////////////////////////////////////////////////////////


function expand(id, booleen)
{
	if(document.getElementById(id))
		document.getElementById(id).className = (booleen==true) ? "visible" : "invisible" ;
		//document.getElementById(id).style.display = (booleen==true) ? "block" : "none";
}


var selectedID = "";

function expand_only_one(name, classOn, classOff)
{
	if(document.getElementById(name))
	{
		if(document.getElementById(selectedID))
		{
			if(classOff)
				changeClassName(selectedID, classOff);
			else
				expand(selectedID, false);
		}

		selectedID = name;

		if(classOn)
			changeClassName(selectedID, classOn);
		else
			expand(selectedID, true);
	}
}



function autoChangeExpand(name)
{
	if(document.getElementById(name))
	{
		expand(name, document.getElementById(name).className=="visible" ? false : true );
	}
}


function changeClassName(id, className)
{
	if( document.getElementById(id))
	{
		document.getElementById(id).className = className;
	}
}
function changeTitle(id, val)
{
	if( document.getElementById(id))
	{
		document.getElementById(id).title = val;
	}
}

////////////////////////////////////////////////////////////////////////////
//
//  PMP CONCEPT 2007 :: DEPLACE LE CODE HTML D'UN ELEMENT A UN AUTRE
//
////////////////////////////////////////////////////////////////////////////


function moveInnerHTML(source, destination, notnull)
{
	if( (notnull==true && document.getElementById(source).innerHTML.trim()!="") || notnull==false )	// document.getElementById(source).textContent
	{
		document.getElementById(destination).innerHTML = document.getElementById(source).innerHTML ;
		document.getElementById(source).innerHTML = "";
	}
}


function trim(str) {
    return str.replace(/^\s*|\s*$/g,"");
}

// trim()
String.prototype.trim = function()
{
 return this.replace(/(^\s*)|(\s*$)/g, '');
}

// trimEnd()
String.prototype.trimEnd = function()
{
 return this.replace(/\s*$/g, '');
}

// trimStart()
String.prototype.trimStart = function()
{
 return this.replace(/^\s*/g, '');
}
