
function PopupAide(Langue)
{
	var vNouvelle;
	var vUrl;
	if(Langue=="fr")
	{
		vUrl = "info2.html";
	}
	else
	{
		vUrl = "info2E.html";
	}
	vNouvelle=window.open(vUrl,"_blank","width=510,height=488,scrollbars=no,resizable=no,status=no,toolbar=no,menubar=no,location=no,directories=no,left=15,top=10");
	vNouvelle.focus;
	return false;
}

function PopupForum(Langue)
{
	var vNouvelle;
	var vUrl;
	if(Langue=="fr")
	{
		vUrl = "forum/forum.html";
	}
	else
	{
		vUrl = "forum/forumE.html";
	}
	vNouvelle=window.open(vUrl,"_blank","width=510,height=488,scrollbars=no,resizable=no,status=no,toolbar=no,menubar=no,location=no,directories=no,left=15,top=10");
	vNouvelle.focus;
	return false;
}

function FormGo()
{
	var vMot = document.form1.MotCle.value;
	if (Len(Trim(vMot)) > 0)
	{
		return true;
	}
	else return false;
}

function FormGo2()
{
	var vOK = 0;
	var cbo1 = document.form1.elements["cboNomRegion"].selectedIndex;
	var cbo2 = document.form1.elements["cboRubrPrinc"].selectedIndex;
	var cbo3 = document.form1.elements["cboDevis"].selectedIndex;
	var vMot = document.form1.MotCle.value;
	var vLangue = document.form1.Langue.value;
	if ((Len(Trim(vMot)) < 3) && (cbo1 == 0) && (cbo2 == 0) && (cbo3 == 0))
	{
		if (Len(Trim(vMot)) > 0)
		{
			if (vLangue == "FR")
				alert("Recherche invalide");
			else
				alert("Invalid word");
		}
		return false;
	}
	else
	{
		if ((cbo2 != 0) && (cbo3 != 0))
		{
			if (vLangue == "FR")
				alert("Vous ne pouvez pas sélectionner à la fois une RUBRIQUE et une DIVISION car une division regroupe plusieurs RUBRIQUES.");
			else
				alert("You can not select both a SUBJECT and a DIVISION because a division regroups more than one SUBJECT.");
			return false;
		}
		return true;
	}
}


function Trim(str)
{
  while (str.charAt(0) == ' ')
    str = str.substring(1);
  while (str.charAt(str.length - 1) == ' ')
    str = str.substring(0, str.length - 1);
  return str;
}

function InStr(strSearch, charSearchFor)
{
	for (i=0; i < Len(strSearch); i++)
	{
	    if (charSearchFor == Mid(strSearch, i, 1))
	    {
			return i;
	    }
	}
	return -1;
}

function Mid(str, start, len)
{
    if (start < 0 || len < 0) return "";

    var iEnd, iLen = String(str).length;
    if (start + len > iLen)
            iEnd = iLen;
    else
            iEnd = start + len;

    return String(str).substring(start,iEnd);
}


function Len(str)
{
	return String(str).length;
}

