/**
 * Fonction d'affichage/masquage des graphiques en Flash et Images
 * @author	nperriault
 * @version 0.1
 */

var HP_currentSelectedGraphID = 0;

function displayLegend(id, legendA, legendB) {
	if ($('legende' + id)) {
	    $('legende' + id).innerHTML = legendA;
	}
    if ($('legende_fond')) {
	    $('legende_fond' + id).innerHTML = '&nbsp;' + legendB;
	}
}

function displayGraph(id, path_to_graph_img) {
	
	HP_currentSelectedGraphID = id;
	var i = 0;
	
	while ($('graph' + i)) {
	  $('Chart' + i).style.visibility = "hidden";
		$('Chart' + i).style.position = 'absolute';
    $('Chart' + i).style.top = 0;
    $('Chart' + i).style.left = 0;
    $('Chart' + i).style.zIndex = i;
    $('fond_label' + i).className = '';
		$('fond_valeur' + i).className = '';
		$('fond_pourcentage' + i).className = '';
		HP_rollRow(i, false);
		i++;
	}

  if ($('Chart' + id)) {
    $('Chart' + id).style.visibility = "visible";
  }
  
  if ($('graph_img' + id) && path_to_graph_img) {
		$('graph_img' + id).src = path_to_graph_img;
	}
	
	HP_rollRow(id, true);
	
	switch (id) {
		case 0:		
			displayLegend(id, 'CAC 40', 'Richelieu France Entrepreneurs');
		break;
		case 1:		
			displayLegend(id, 'CAC 40', 'Richelieu Special');
		break;
		case 2:
			displayLegend(id, 'EuroStoxx 50', 'Richelieu Europe Entrepreneurs');
		break;
		case 3:
		    displayLegend(id, 'EuroStoxx 50', 'Richelieu Evolution');
		break;
		case 4:
		    displayLegend(id, 'EONIA', 'Richelieu Valeur');
		case 5:
		    displayLegend(id, 'EONIA / EuroStoxx 50', 'Richelieu Patrimoine');
		break;
    }
    
}

/**
 * G�re les styles de rollovers sur les rang�es de tableau sur la homepage
 * Note : D�di� � IE
 * @author	nperriault
 * @version	0.1 
 */
function HP_rollRow(id, rolling) {
	if (rolling == true) {
		$('fond' + id).className = 'on';
		$('fond_label' + id).className = 'fond_label';
		$('fond_valeur' + id).className = 'fond_valeur r';
		$('fond_pourcentage' + id).className = 'fond_pourcentage r';
		//$('fond_pourcentage_2004_' + id).className = 'fond_pourcentage r';
         } else if (id != HP_currentSelectedGraphID) {
		$('fond' + id).className = 'off';
		$('fond_label' + id).className = 'fond_label';
		$('fond_valeur' + id).className = 'fond_valeur';
		$('fond_pourcentage' + id).className = 'fond_pourcentage';
		//$('fond_pourcentage_2004_' + id).className = 'fond_pourcentage';
	}

}
