function ConfirmSubmit(label)
{
	var agree=confirm(label);
	if (agree)
		return true ;
	else
		return false ;
}
function entsub(event,ourform) 
{
  if (event && event.which == 13)
    ourform.submit();
  else
    return true;
}
function formatCurrency(num) 
{
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
		num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
		cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+' '+num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + num + ',' + cents);
}
function HideShowDiv(whichDivId,attribute)
{
	//alert('HideShowDiv');
	if (document.all) 
	{ //IS IE 4 or 5 (or 6 beta)
		eval( "document.all." + whichDivId + ".style.visibility = attribute;");
	}
	if (document.layers) 
	{ //IS NETSCAPE 4 or below
		document.layers[whichDivId].visibility = attribute;
	}
	if (document.getElementById && !document.all) 
	{
		theDiv = document.getElementById(whichDivId);
		theDiv.style.visibility = attribute;
	}
}
function RadioOn(frm, elem, x) 
{
	// SET RADIO BUTTON CHECKED STATUS
	var c = 'document.'+frm+'["'+elem+'"]['+x+'].checked = 1;';
	eval(c);
}
function ClearSelectList(listElem,defaultSelectText,defaultSelectValue) 
{
    while(listElem.options.length > 0) 
    {
    	listElem.options[0] = null;
    }
    if(defaultSelectText && defaultSelectText.length>0)
    {
		listElem.options.add(new Option(unescape(defaultSelectText), defaultSelectValue));
    }
}
function AddInputType(fieldCounterId,fieldsDivId,fieldName,inputType,attribute)
{
	var fieldCursor = 1;
	if(document.getElementById(fieldCounterId))
		fieldCursor = Number(document.getElementById(fieldCounterId).value)+1;
		
	document.getElementById(fieldCounterId).value = fieldCursor;
	var retTxt = "";//document.getElementById(fieldsDivId).innerHTML;
	for(var i=1;i<=fieldCursor;i++)
	{	
		retTxt = retTxt + "<input type='" + inputType + "' name='" + fieldName +"["+(fieldCursor*-1)+"]'" + attribute  + "><br>";
	}
	document.getElementById('debug').value = retTxt;
	document.getElementById(fieldsDivId).innerHTML = retTxt;
}
function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}
function CheckUnCheckAllFields(theForm,field,isChecked) 
{
	var fieldNameLength = field.length;
	var tmpCompareString = "";
	for(var i=0; i < theForm.elements.length; i++)
	{
		tmpCompareString = theForm.elements[i].name.substring(0,fieldNameLength);
		if(theForm.elements[i].disabled == false && theForm.elements[i].type=="checkbox" && tmpCompareString == field)
		{
			theForm.elements[i].checked=isChecked;
		}
	}	
}
// Copyright 1999 - 2002 by Ray Stott, Pop-up Windows Script ver 2.0
// OK to use if this copyright is included
// Script is available at http://www.crays.com/jsc          

var popWin = null    // use this when referring to pop-up window
var winCount = 0
var winName = "popWin"
function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
  var d_winLeft = 20  // default, pixels from screen left to window left
  var d_winTop = 20   // default, pixels from screen top to window top
  winName = "popWin" + winCount++ //unique name for each pop-up window
  closePopWin()           // close any previously opened pop-up window
  if (openPopWin.arguments.length >= 4)  // any additional features? 
    winFeatures = "," + winFeatures
  else 
    winFeatures = "" 
  if (openPopWin.arguments.length == 6)  // location specified
    winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
  else
    winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
  popWin = window.open(winURL, winName, "width=" + winWidth 
           + ",height=" + winHeight + winFeatures)
  }
function closePopWin(){    // close pop-up window if it is open 
  if (navigator.appName != "Microsoft Internet Explorer" 
      || parseInt(navigator.appVersion) >=4) //do not close if early IE
    if(popWin != null) if(!popWin.closed) popWin.close() 
  }
function getLocation(winWidth, winHeight, winLeft, winTop){
  var winLocation = ""
  if (winLeft < 0)
    winLeft = screen.width - winWidth + winLeft
  if (winTop < 0)
    winTop = screen.height - winHeight + winTop
  if (winTop == "cen")
    winTop = (screen.height - winHeight)/2 - 20
  if (winLeft == "cen")
    winLeft = (screen.width - winWidth)/2
  if (winLeft>0 & winTop>0)
    winLocation =  ",screenX=" + winLeft + ",left=" + winLeft	
                + ",screenY=" + winTop + ",top=" + winTop
  else
    winLocation = ""
  return winLocation
  }

//
// THIS FUNCTION ARE RELATED TO THIS CLIENT
//
function SendEmail(id)
{
	var myConn = new XHConn();
	if (!myConn) alert("XMLHTTP not available. Try a newer/better browser.");
	var fnWhenDone = function (oXML) {
		//document.getElementById('debug').value = oXML.responseText;
		document.getElementById('MembresMsgDivId_'+id).innerHTML = oXML.responseText;
	};
	myConn.connect("includer_ajax.php", "GET", "sid=membres&pid=sendmail&ks=invitation&ctid="+id, fnWhenDone);	
}
function validateform()
{
	if (document.myform.nom.value=='')
	{
		alert ("Veuillez inscrire votre nom");
		document.all.nom.focus();
	}
	else if (document.myform.courriel.value=='')
	{
		alert ("Veuillez inscrire votre adresse courriel!");
		document.all.courriel.focus();
	}
	else if (document.myform.message.value=='')
	{
		alert ("Veuillez écrire votre message!");
		document.all.message.focus();
	}
	else
	{
		document.myform.submit();
	}
}

/*
function formData2QueryString(docForm) {

        var strSubmit       = '';
        var formElem;
        var strLastElemName = '';
        
        for (i = 0; i < docForm.elements.length; i++) {
                formElem = docForm.elements[i];
                switch (formElem.type) {
                        // Text, select, hidden, password, textarea elements
                        case 'text':
                        case 'select-one':
                        case 'hidden':
                        case 'password':
                        case 'textarea':
                                strSubmit += formElem.name + 
                                '=' + escape(formElem.value) + '&'
                        break;
                        default:
                        
                        break;
            	}
        }
}
*/