// ------------------------------------------------------------
function voletAct(voletLst, voletElm, prefixCmd, prefixCnt) {
	voletLst = voletLst.split(',');
	for(var ii = 0; ii<voletLst.length; ii++)
	{
		gebi(prefixCnt+voletLst[ii]).style.display = 'none';
		upClassName(gebi(prefixCmd+voletLst[ii]), '-activat');
	}
	gebi(prefixCnt+voletElm).style.display = 'block';
	upClassName(gebi(prefixCmd+voletElm), 'activat');
}
// ------------------------------------------------------------
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if (node == null)
		node = document;
	if (tag == null)
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	var j = 0;
	for (i = 0; i < elsLen; i++) {
		if (pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}
//document.getElementsByClass('la_class')[0].style.display
// ------------------------------------------------------------
function elementDisplay(dispId, dispAct) {
	if(!gebi(dispId))return false;
	if (dispAct==1)
	{
	gebi(dispId).style.display = '';
	}
	else if (dispAct==-1)
	{
	gebi(dispId).style.display = 'none';
	}
	else
	{
	if (gebi(dispId).style.display=='')
		elementDisplay(dispId, -1);
	else
		elementDisplay(dispId, 1);
	}
}
// ------------------------------------------------------------
olList = new Array(); 
function olFunc(Obj, Ord) { 
  if(isNaN(Ord)) Ord = 5;
	olList[olList.length] = Ord +':'+ Obj;
} 
// ------------------------------------------------------------
window.onload = function() { 
	olList.sort();
	for(i=0; i<olList.length; i++){
		eval(olList[i].split(':')[1]);
	}
}
// ------------------------------------------------------------
function getTotalWidth() {
	var width = document.documentElement.scrollWidth;
	if(document.documentElement.clientWidth > width )
		width  = document.documentElement.clientWidth;
	if(document.body.scrollWidth > width)
		width = document.body.scrollWidth;
	return width;
}
// ------------------------------------------------------------
function getTotalHeight() {
	var height = document.documentElement.scrollHeight;
	if(document.documentElement.clientHeight > height )
		height  = document.documentElement.clientHeight;
	if(document.body.scrollHeight > height)
		height = document.body.scrollHeight;
	return height;
}
// ------------------------------------------------------------
function classNameUp(cId, cElm, cAct) {
	if(cAct=='add'){
		gebi(cId).className = gebi(cId).className +' '+ cElm;
	}else{
		cLst = gebi(cId).className.split(' ');
		nLst = '';
		for(var ii = 0; ii<cLst.length; ii++) {
			if(cLst[ii] != cElm) nLst = nLst +' '+ cLst[ii];
		}
		gebi(cId).className = nLst;
	}
}
// ------------------------------------------------------------
function inDevOvr(cId){
	classNameUp(cId, 'inDev', 'add');
}
// ------------------------------------------------------------
function inDevOut(cId){
	classNameUp(cId, 'inDev', 'del');
}
// ------------------------------------------------------------
function gebi(id){
	return document.getElementById(id);
}
// ------------------------------------------------------------
function popFullscreen() {
	if(gebi('popFullscreen')){
		gebi('popFullscreen').style.width = getTotalWidth()+'px';
		gebi('popFullscreen').style.height = getTotalHeight()+'px';
	}
}
olFunc('popFullscreen()');
// ------------------------------------------------------------
function newwin(source, w, h) {
	window.open(source,'_blank','scrollbars=yes,resizable=no,width=' + w + ',height=' + h + ',status=yes,location=no,toolbar=no,menubar=yes');
}
// ------------------------------------------------------------
function popHid() {
	if(!gebi(divThis))return;
	gebi(divThis).innerHTML = gebi('popMessage').innerHTML;
	elementVisibility('popDiv','hide');
	elementVisibility('popFullscreen','hide');
}
// ------------------------------------------------------------
function popAff(divNom, divWidth, divHeight) {
	if(!gebi(divNom))return;
	gebi('popMessage').innerHTML = gebi(divNom).innerHTML;
	gebi(divNom).innerHTML='';
	divThis = divNom;
	if(isNaN(divWidth)) divWidth=400;
	if(isNaN(divHeight)) divHeight=300;
	if(divWidth>window.document.body.clientWidth-10) divWidth=window.document.body.clientWidth-10;
	if(divWidth>980) divWidth=980;
	if(divHeight>window.document.body.clientHeight-60) divHeight=window.document.body.clientHeight-60;
	gebi('popDiv').style.height = divHeight +'px';
	gebi('popDiv').style.marginTop = (divHeight/-2)-2 +'px';
	gebi('popDiv').style.width = divWidth +'px';
	gebi('popDiv').style.marginLeft = divWidth/-2 +'px';
	gebi('popDiv').style.top = document.body.scrollTop+(window.document.body.clientHeight/2) +'px';
	gebi('popDiv').style.left = document.body.scrollLeft+(window.document.body.clientWidth/2) +'px';
	elementVisibility('popFullscreen','show');
	elementVisibility('popDiv','show');
}
// ------------------------------------------------------------
function elementVisibility(nomdiv, etat) {
    with (document) if (getElementById && ((obj=getElementById(nomdiv))!=null)) { v=etat;
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v;
	}
}
// ------------------------------------------------------------
function SHL(nomdiv, etat) {
    with (document) if (getElementById && ((obj=getElementById(nomdiv))!=null)) { v=etat;
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v;
	}
}
// ------------------------------------------------------------
function escapeHTML(str)
{
   var div = document.createElement('div');
   var text = document.createTextNode(str);
   div.appendChild(text);
   return div.innerHTML;
};
// ------------------------------------------------------------
function redAccord(url, msg) {
	if (confirm(msg)) window.open(url, target="_self");
}
// ------------------------------------------------------------
function upClassName(clsObject, clsName) {
	arrayClassName = clsObject.className.split(' ')
	newClassName = '';
	AclsName = clsName.substr(0,1)=='-' ? clsName.substr(1) : clsName
	for(var ii = 0; ii<arrayClassName.length; ii++) {
		if(arrayClassName[ii]!=AclsName) newClassName += ' '+ arrayClassName[ii];
	}
	if (clsName.substr(0,1)!='-') newClassName += ' '+ AclsName;
	clsObject.className = newClassName;
}
// ------------------------------------------------------------
function classDisplay(dispCls, dispAct) {
	allel = (document.getElementsByTagName)?document.getElementsByTagName("*"):document.all;
	for(var a = 0; a<allel.length; a++) {
		arrayClassName = allel[a].className.split(' ')
		for(var ii = 0; ii<arrayClassName.length; ii++) {
			if(arrayClassName[ii] == dispCls) elementDisplay(allel[a], dispAct);
		}
	}
}
// ------------------------------------------------------------
function elementDisplay(dispId, dispAct) {
	if(!document.getElementById(dispId))return false;
	if (dispAct==1)
	{
	document.getElementById(dispId).style.display = '';
	}
	else if (dispAct==-1)
	{
	document.getElementById(dispId).style.display = 'none';
	}
	else
	{
	if (document.getElementById(dispId).style.display=='')
		elementDisplay(dispId, -1);
	else
		elementDisplay(dispId, 1);
	}
}
// ------------------------------------------------------------
function emailCliquable(email) {
  var exp=new RegExp("([a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\-_]+\.[a-zA-Z0-9]{2,})","g");
  return email.replace(exp,"<a href='mailto:$1'>$1</a>");
}
// ------------------------------------------------------------
function Replace(all,exV,nwV) {
   var regEx = new RegExp(exV,"g")
   return all.replace(regEx,nwV)
}
// ------------------------------------------------------------
function redirect(thisUrl){
	window.open(thisUrl, target="_self")
}
// ------------------------------------------------------------
function htmlencode(ch) {
   ch = ch.replace(/&/g,"&amp;")
   ch = ch.replace(/\"/g,"&quot;")
   ch = ch.replace(/\'/g,"&#039;")
   ch = ch.replace(/</g,"&lt;")
   ch = ch.replace(/>/g,"&gt;")
   return ch
}
// ------------------------------------------------------------
function htmldecode(ch) {
   ch = ch.replace(/&quot;/g,"\"")
   ch = ch.replace(/&#039;/g,"'")
   ch = ch.replace(/&lt;/g,"<")
   ch = ch.replace(/&gt;/g,">")
   ch = ch.replace(/&amp;/g,"&")
   return ch
}
// ------------------------------------------------------------
function getPosition(gpID,XY){
	var el = document.getElementById(gpID);
	var pL = 0;
	if (XY == 'X')
	{
		while(el){pL+=el.offsetLeft;el=el.offsetParent;}
	}
	else
	{
		while(el){pL+=el.offsetTop;el=el.offsetParent;}
	}
	return pL
}
// ------------------------------------------------------------
