function loadPageAjax(page,Id)
{

	var xmlHttp;
	
	try
	{ 
		xmlHttp=new XMLHttpRequest(); 

	}
	catch (e)
	{
		try
		{ 
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
		}
		catch (e)
		{
			try
			{ 
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 
				
			}
			catch (e)
			{
					alert("Votre navigateur ne supporte pas la technologie AJAX!");
					return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
      	{
      		if(xmlHttp.readyState==4)
		{
			document.getElementById(Id).innerHTML=xmlHttp.responseText;
		}
		else
		{
			document.getElementById(Id).innerHTML='<img src=./images/ajax-loader.gif></img>';
		}
      	}
	xmlHttp.open("GET",page,true);
	xmlHttp.send(null);
}

function getNodeValue(node) 
{
	// Retourne la valeur d'un element node dans l'arbre DOM
	var nodeValue = [];
	var i = end = 0;
	var child = null;

	if (node.childNodes) {
		end = node.childNodes.length;
		for (i; i < end; i++) {
		child = node.childNodes[i];
		if (child.nodeName === '#text') {
			nodeValue.push(child.nodeValue);
		}
		}
	} else if (node.nodeValue) {
		nodeValue.push(node.nodeValue);
	}

	return nodeValue.join('');
}

function resize(iframeid)
{

	if (!window.parent)
	{	
		return;
	}
	
	var myiframe = iframeid;
	if(!myiframe)
	{
		return;
	}
	myiframe.style.height = document.body.scrollHeight+50+"px";

}

function resize2(iframeid)
{

	if (!window.parent)
	{	
		return;
	}
	var myiframe = iframeid;
	if(!myiframe)
	{
		return;
	}
	myiframe.style.height = parent.document.body.scrollHeight+50+"px";

}

function showLoading()
{
	document.getElementById('loading').style.display = "";
}

function changeLangue()
{
	if(document.getElementById('selectLangue').value=='fr')
	{
		window.location = 'http://www.nautilusplus.com/index.html';
	}
	if(document.getElementById('selectLangue').value=='en')
	{
		window.location = 'http://www.nautilusplus.com/EN_index.html';
	}
}

function showDesc(id)
{
	el = document.getElementById(id);
	if (el.style.display == 'none')
	{
		Effect.Appear(id);

	} else {
		Effect.Fade(id);
	}

}

function cUpper(cObj)
{
	cObj.value=cObj.value.toUpperCase();
}

function sendInfo()
{
	document.getElementById('erreur_nom').innerHTML = '';
	document.getElementById('erreur_prenom').innerHTML = '';
	document.getElementById('erreur_adresse').innerHTML = '';
	document.getElementById('erreur_ville').innerHTML = '';
	document.getElementById('erreur_cp').innerHTML = '';
	document.getElementById('erreur_telmaison').innerHTML = '';
	document.getElementById('erreur_telbureau').innerHTML = '';
	document.getElementById('erreur_courriel').innerHTML = '';
	
	var frmid = document.getElementById('ctl00_ContentPlaceHolder1_lbl_frmid').innerHTML;
	var nom = document.getElementById('txt_nom').value;
	var prenom = document.getElementById('txt_prenom').value;
	var adresse = document.getElementById('txt_adresse').value;	
	var ville = document.getElementById('txt_ville').value;
	var cp = document.getElementById('txt_cp').value;
	var telmaison = document.getElementById('txt_telmaison').value;
	var telbureau = document.getElementById('txt_telbureau').value;
	var courriel = document.getElementById('txt_courriel').value;
	var postule = 'yes';
	if(nom=='')
	{
		document.getElementById('erreur_nom').innerHTML = 'Entrez votre nom.';
		postule='no';
	}
	if(prenom=='')
	{
		document.getElementById('erreur_prenom').innerHTML = 'Entrez votre pr&eacute;nom.';
		postule='no';
	}
	if(adresse=='')
	{
		document.getElementById('erreur_adresse').innerHTML = 'Entrez votre adresse.';
		postule='no';
	}
	if(ville=='')
	{
		document.getElementById('erreur_ville').innerHTML = 'Entrez votre ville.';
		postule='no';
	}
	if(cp=='')
	{
		document.getElementById('erreur_cp').innerHTML = 'Entrez votre code postal.';	
		postule='no';
	}
	if(telmaison=='')
	{
		document.getElementById('erreur_telmaison').innerHTML = 'Entrez votre # de t&eacute;l&eacute;phone de la maison.';
		postule='no';
	}
	if(telbureau=='')
	{
		document.getElementById('erreur_telbureau').innerHTML = 'Entrez votre # de t&eacute;l&eacute;phone du bureau.';
		postule='no';
	}
	if(courriel=='')
	{
		document.getElementById('erreur_courriel').innerHTML = 'Entrez votre courriel.';
		postule='no';
	}
	if(postule=='yes')
	{
		var executeAction = function(request)
		{
			document.getElementById('ctl00_ContentPlaceHolder1_formulaire').innerHTML = "Votre demande d'inscription a bien &eacute;t&eacute; envoy&eacute;e.";
			var exdate=new Date();
			exdate.setDate(exdate.getDate()+60);
			document.cookie=frmid+ "postulation=yes" +((60==null) ? "" : ";expires="+exdate.toGMTString());
		}
		var request = new XHConn();
		request.connect("writeInfo.asp?frmid="+frmid+"&nom="+nom+"&prenom="+prenom+"&adresse="+adresse+"&ville="+ville+"&cp="+cp+"&telmaison="+telmaison+"&telbureau="+telbureau+"&courriel="+courriel, "POST", "null", executeAction)	
	}
								
}

function XHConn()
{
  var xmlhttp, bComplete = false;
  try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  catch (e) { try { xmlhttp = new XMLHttpRequest(); }
  catch (e) { xmlhttp = false; }}}
  if (!xmlhttp) return null;
  this.connect = function(sURL, sMethod, sVars, fnDone)
  {
    if (!xmlhttp) return false;
    bComplete = false;
    sMethod = sMethod.toUpperCase();

    try {
      if (sMethod == "GET")
      {
        xmlhttp.open(sMethod, sURL+"?"+sVars, true);
        sVars = "";
      }
      else
      {
        xmlhttp.open(sMethod, sURL, true);
        xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
        xmlhttp.setRequestHeader("Content-Type",
          "application/x-www-form-urlencoded");
      }
      xmlhttp.onreadystatechange = function(){
        if (xmlhttp.readyState == 4 && !bComplete)
        {
          bComplete = true;
          fnDone(xmlhttp);
        }};
      xmlhttp.send(sVars);
    }
    catch(z) { return false; }
    return true;
  };
  return this;
}
