/************************************************************************
Menu
************************************************************************/
function big(lyr, width, height)
{
	document.getElementById('sub'+lyr).style.visibility='visible';
	/*document.getElementById('sub'+lyr).style.height=px+'px';
	document.getElementById(lyr).style.height=px+'px';*/
	document.getElementById('sub'+lyr).style.height=height+'px';
	document.getElementById(lyr).style.height=height+'px';
	document.getElementById('sub'+lyr).style.width=width+'px';
	document.getElementById(lyr).style.width=width+'px';
}

function small(lyr)
{

	document.getElementById('sub'+lyr).style.visibility='hidden';
	document.getElementById('sub'+lyr).style.height='0px';
	document.getElementById(lyr).style.height='18px';

}

/************************************************************************
Navigation
************************************************************************/
function loadXMLDoc(page, image, IsCotationVisible)
{
	var xmlhttp;
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
		setOpacity(document.getElementById('main1Photo'), 0);
		setOpacity(document.getElementById('contactPhoto'), 0);
		setOpacity(document.getElementById('liensPhoto'), 0);
		setOpacity(document.getElementById('assurancesPhoto'), 0);
		setOpacity(document.getElementById('placementsPhoto'), 0);
		if (IsCotationVisible)
			ShowCotationLink();
		else
			HideCotationLink();
		initImage(image+'Photo','TexteContainer');
		document.getElementById("dataDiv").innerHTML=xmlhttp.responseText;
		}
	}
xmlhttp.open("GET","txt/getText.php?file="+page,true);
xmlhttp.send();
}

/************************************************************************
Animation Couleur et image
************************************************************************/
var Colors = new Array();
Colors[0] = "333333";
Colors[10] = "555555";
Colors[20] = "666666";
Colors[30] = "888888";
Colors[40] = "999999";
Colors[50] = "AAAAAA";
Colors[60] = "BBBBBB";
Colors[70] = "CCCCCC";
Colors[80] = "DDDDDD";
Colors[90] = "EEEEEE";
Colors[100] = "FFFFFF";

  
function initImage(imageId, texteId) {
  image = document.getElementById(imageId);
  setOpacity(image, 0);
  texte = document.getElementById(texteId);
  setColor(texte, 0);
  image.style.visibility = 'visible';
  window.setTimeout("fadeIn('"+imageId+"','"+texteId+"',"+10+")", 25);
}
function setColor(obj, opacity) {
	obj.style.color = "#"+Colors[opacity];
	innerTable = document.getElementById('innerDataTable');
	if (innerTable != null)
		{
		innerTable.style.color = "#"+Colors[opacity];
		}
}

function setOpacity(obj, opacity) {

  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,txtId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    txtObj = document.getElementById(txtId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      setColor(txtObj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"','"+txtId+"',"+opacity+")", 33);
    }
  }
}

/************************************************************************
Activation du css
************************************************************************/
function ActivateJs() {
	window.onload = function() {initImage('main1Photo','TexteContainer')}
	document.write("<style type='text/css'>#main1Photo {visibility:hidden;} </style>");
}

/************************************************************************
Fond disctincts Table
************************************************************************/
function ShowFondsDistincts() {
	document.getElementById('DistinctsTable').style.visibility = 'visible';
}

function HideFondsDistincts() {
	document.getElementById('DistinctsTable').style.visibility = 'hidden';
}
/************************************************************************
Cotation
************************************************************************/
function ShowCotationLink() {
	//document.getElementById('CotationLink').style.visibility = 'visible';
}
function HideCotationLink() {
	//document.getElementById('CotationLink').style.visibility = 'hidden';
}
function ShowCotation() {
ClearFormCotation();
	document.getElementById('Cotation').style.visibility = 'visible';
}
function HideCotation() {
	document.getElementById('Cotation').style.visibility = 'hidden';
}

function ClearFormCotation() {
	document.getElementById('nom').value = "";
	document.getElementById('prenom').value = "";
	document.getElementById('courriel').value = "";
	document.getElementById('telephone').value = "";
	document.getElementById('collective').checked = false;
	document.getElementById('maladie').checked = false;
	document.getElementById('hypotheque').checked = false;
	document.getElementById('salaire').checked = false;
	document.getElementById('vie').checked = false;
	document.getElementById('voyage').checked = false;
	document.getElementById('commentaire').value = "";

}
function SendFormCotation() {
	document.getElementById("CotationMessage").innerHTML="Envoi en cours...";
var xmlhttp;
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
		document.getElementById("CotationMessage").innerHTML=xmlhttp.responseText;
		}
	}

var nom = escape(document.getElementById('nom').value)
var prenom = escape(document.getElementById('prenom').value);
var courriel = escape(document.getElementById('courriel').value);
var telephone = escape(document.getElementById('telephone').value);
var collective = document.getElementById('collective').checked;
var maladie = document.getElementById('maladie').checked;
var hypotheque = document.getElementById('hypotheque').checked;
var salaire = document.getElementById('salaire').checked;
var vie = document.getElementById('vie').checked;
var voyage = document.getElementById('voyage').checked;
var commentaire = escape(document.getElementById('commentaire').value);
	
var chaine=
"nom="+nom+
"&prenom="+prenom+
"&courriel="+courriel+
"&telephone="+telephone+
"&commentaire="+commentaire;
if (collective)
	chaine = chaine+"&collective=true";
if (maladie)
	chaine = chaine+"&maladie=true";
if (hypotheque)
	chaine = chaine+"&hypotheque=true";
if (salaire)
	chaine = chaine+"&salaire=true";
if (vie)
	chaine = chaine+"&vie=true";
if (voyage)
	chaine = chaine+"&voyage=true";

xmlhttp.open("GET","envoyer_mail.php?"+chaine,true);
xmlhttp.send();
ClearFormCotation();
}

