/*
///	<copyright>(c) 2004 - PSA Peugeot Citroen </copyright>
///	<project>Collcit</project>
///	<class>general.js
///		<summary></summary>
///	</class>
///	<version information>
///		<version number="1.0" date="29/07/2005" author="unknown"> 
///         <summary>First release </summary> 
///      </version> 
///		<version number="1.1" date="30/08/2005" author="DDA"> 
///         <summary>
///            - Addition of trim
///            - Addition of getObjectById 
///         </summary> 
///      </version> 
///	</version information>
*/


var ie4 = (document.all)? true:false;
var ns6 = (document.getElementById && !document.all)? true:false;


function DstepRoll(ImgID, ImgSrc) {
	document.images[ImgID].src=ImgSrc;
}

function flashvsjpg(){
	fairederoule();
}

var OldCol;

function CH(td, mode) {
	if (mode == 0) {
		oldCol = td.className;
		td.className = 'tdNavLeftOver';
	} else {
		td.className = 'tdNavLeftOut';
	}
}

function CH1(td) {
	if (td.className == 'TxtContent') {
		td.className = 'TxtContentHighlight';
	} else {
		td.className = 'TxtContent';
	}
}

function CH2(td) {
	if (td.className == 'txtContentHighlight') {
		td.className = 'TxtContent';
	} else {
		td.className = 'txtContentHighlight';
	}
}

function ChBoutonOff(td, mode) {
	if (mode == 0) {
		oldCol = td.className;
		td.className = 'tdBoutonOver';
	} else {
		td.className = 'tdBoutonOut';
	}
}

function ChBoutonOn(td, mode) {
	if (mode == 0) {
		oldCol = td.className;
		td.className = 'tdBoutonOut';
	} else {
		td.className = 'tdBoutonOver';
	}
}

function DstepShow(id) {
	if (id != ""){
		if (ie4) {document.all[id].style.visibility = "visible";}
		else
			if (ns6) {document.getElementById(id).style.visibility = "visible";}
		}
}

function DstepHide(id) {
	if (id != ""){
		if (ie4) {document.all[id].style.visibility = "hidden";}
		else
			if (ns6) {document.getElementById(id).style.visibility = "hidden";}
	
		}
}

function getObjectById(id) {
	var element = null;	
	
	if (id != ""){
		if (ie4) { element = document.all[id]; }
		else 
			if (ns6) { element = document.getElementById(id); }	
	}		
	return element;
}

function flash2jpg(id,imgSrc,imgWidth,imgHeight,imgClickUrl)
{
	if (imgClickUrl == null)
	{
		hrefStart ="";
		hrefEnd ="";
	}
	else
	{
	 	hrefStart ="<a href=\""+ imgClickUrl+ "\">";
		hrefEnd ="</a>";
	}
	document.getElementById(id).innerHTML= hrefStart + '<img src='+ imgSrc +' width='+ imgWidth+ ' height='+ imgHeight + ' border=\"0\" id="illustration" name="illustration" style=\"filter:progid:DXImageTransform.Microsoft.Fade(Duration=1.0,overlap=1.0)\">' + hrefEnd;
}

function flash2jpg(id,imgSrc,imgWidth,imgHeight, imgAlt, imgClickUrl)
{
	if (imgClickUrl == null)
	{
		hrefStart ="";
		hrefEnd ="";
	}
	else
	{
	 	hrefStart ="<a href=\""+ imgClickUrl+ "\">";
		hrefEnd ="</a>";
	}
	if (imgAlt == null)
	{
		imgAlt ="";
	}
	// Correction for banner : when the alt = string.Empty, alt value is equal to border = 0 (as below)
	if (imgAlt != "")
	{
		document.getElementById(id).innerHTML= hrefStart + '<img src='+ imgSrc +' width='+ imgWidth+ ' height='+ imgHeight + ' alt=' + imgAlt + ' border=\"0\" id="illustration" name="illustration" style=\"filter:progid:DXImageTransform.Microsoft.Fade(Duration=1.0,overlap=1.0)\">' + hrefEnd;	
	}
	else
	{
		document.getElementById(id).innerHTML= hrefStart + '<img src='+ imgSrc +' width='+ imgWidth+ ' height='+ imgHeight + ' border=\"0\" id="illustration" name="illustration" style=\"filter:progid:DXImageTransform.Microsoft.Fade(Duration=1.0,overlap=1.0)\">' + hrefEnd;
	}
	
}
	
//Fonctions de "dépli" / "repli" de branches
var openImg = new Image();
openImg.src = "/CWF/Collcit/images/ico_deplier.gif";
var closedImg = new Image();
closedImg.src = "/CWF/Collcit/images/ico_plier.gif";

function showBranch(branch, idbranch){
	var objBranch = document.getElementById(branch).style;
	var objidBranch = document.getElementById(idbranch).style;
	if(objBranch.display=="block"){
		objBranch.display="none";
		objidBranch.color = 'black';
		objidBranch.fontWeight = 'normal';
	}
	else {
		objBranch.display="block";
		objidBranch.color = 'red';
		objidBranch.fontWeight = '600';
		//alert(objidBranch.font-weight);
	}
		//objidBranch.color = 'black';
		//objidBranch.className = 'txtContentHighlight';
}

function swapFolder(img){
	objImg = document.getElementById(img);
	if(objImg.src.indexOf('/CWF/Collcit/images/ico_plier.gif')>-1)
		objImg.src = openImg.src;
	else
		objImg.src = closedImg.src;
}

// trim a string text
function trim(sValue) { 

    // this will get rid of leading spaces 
    while (sValue.substring(0,1) == ' '){ 
        sValue = sValue.substring(1, sValue.length);
    }

    // this will get rid of trailing spaces 
    while (sValue.substring(sValue.length-1,sValue.length) == ' '){
        sValue = sValue.substring(0, sValue.length-1);
    }

   return sValue;
} 



///////////
//Banner///
///////////

//Identifier of version
var Page_Cw3BannerValidationVer = "1";

//Ids of the banner flash objects
var flashIds = new Array();
//Url of the banner flash media
var flashData = new Array();

/**
* Add an identifier to the list
* @param flashId Identfier of the object tag
*/
function pushFlashId(flashId)
{
	flashIds.push(flashId);
}

/**
* Add an Url to the list
* @param flashUrl Url of the flash
*/
function pushFlashData(flashUrl)
{
	flashData.push(flashUrl);
}

/**
* Load and play each flash by using flashIds and flashData
*/
function loadAndPlay()
{
	var currentFlashId = null;
	var currentFlashData = null;

	while(flashIds.length > 0 && flashData.length > 0)
	{
		if(flashIds == null)
		{
			throw 'flashIds null';
		}
		if(flashData == null)
		{
			throw 'falshDataNull';
		}
		currentFlashId = flashIds.pop();
		currentFlashData = flashData.pop();
		if(currentFlashId != null && currentFlashData != null)
		{
			var movie = document.getElementById(currentFlashId);
			if(movie != null)
			{
				movie.loadMovie(0, currentFlashData)
				movie.Play()
			}
		}
	}
}


//Traitment of banners
var fl_ns4 = (document.layers);
var fl_ie4 = (document.all && !document.getElementById);
var fl_ie5 = (document.all && document.getElementById);
var fl_ns6 = (!document.all && document.getElementById);
var _bannerNameList = null;
var _bannerTimeOutList = null;

function hide(id){ 
	if(fl_ns4){
		document.layers[id].visibility = "hide";
	}
	else if(fl_ie4){
		document.all[id].style.visibility = "hidden";
	}else if(fl_ie5 || fl_ns6){
		document.getElementById(id).style.visibility = "hidden";
	}
}

function anim_overlay(myid,time) 
{
	document.getElementById(myid).style.visibility = "hidden";	
	document.getElementById(myid).style.visibility = "visible";
	
	if(_bannerNameList == null)
	{
		_bannerNameList = new Array();
		_bannerTimeOutList = new Array();		
	}
	bannerCount = _bannerNameList.length;
	_bannerNameList[bannerCount] = myid;
	_bannerTimeOutList[bannerCount] = time;
	
}

// Banner launcher 
function LaunchBanner()
{
	if(_bannerNameList != null)
	{
		for(i = 0; i < _bannerNameList.length; i++)
		{
			setTimeout("hide('" + _bannerNameList[i] +"');", _bannerTimeOutList[i]);
		} 
	}
}




