// showDef
function showDef(idmenu, id, type)
{
	var menu = document.getElementById(idmenu); // the root element
	var lis = menu.getElementsByTagName(type); // all the dd

	for ( var item, i=0; i<lis.length; i++ )
    {
		item = lis.item(i);
		if (item.id == id)
			item.style.display = 'block';
			
		else
			
			item.style.display = 'none';
	}
	return false;
}

// showOnglet
function showOnglet(elt)
{
	var root = document.getElementById('onglet');
	var li = root.getElementsByTagName('li'); 
	
	for(var i=0; i<(li.length-1); i++)
	{
		// li
		li[i].className = (li[i] != li[elt])? "off" : "on";
		// content
		document.getElementById('content_' + i).style.display = (elt !=i) ? "none" : "block";	
	}

	if((elt-1) >= 0)
		li[(elt-1)].className = "before_off";
	
	// repositionne la classe du dernier onglet
	li[(i-1)].className = (li[(i-1)] != li[elt]) ? "last_off" : "last_on";
	
	// last li	# longeur ul - nb li * largeur li
	li[i].style.width = (818 - (i*147)) + "px";
	
}

// openChat
function openChat()
{
	var d = new Date(), 
	h = d.getHours(),
	url = (h >= 9 && h < 19) ? 'http://www.client.linkeo.com/123credit.com/CHAT/index.htm' : 'http://www.linkeo.net/accueil.nsf/F_ReponseKoFerme?OpenForm&CODEBOUTON=MEDIATIS6003&';

	window.open(url,'','width=450,height=450');
}

// wOpen
function wOpen(href, width, height, srcoll)
{
	window.open(href, 'target', 'toolbar=0, location=0, directories=0, status=1, scrollbars=' + srcoll + ', resizable=0, copyhistory=0, menuBar=0, width='+width+', height='+height+', left=200, top=200')
	return false;
}

function goCheckCO(url, from, coDef, params)
{
	if (!params || !params.length || !params.match(/&from=/))
		params += '&from=' + from;
	params = params.replace('?', '&');
	if (!params.match(/^(\?|&)/))
		params = "&"+params;
	if (!params.match(/&co=/))
		wOpen(base + "popup.php?page=" + escape(url) + params + '&co=' + coDef, 530, 250);
	else
		window.location.href = base + "?page=" + url + params;
	return false;
}

function addTracking(el){
	if(!TRACKING || el.href.indexOf('?')>-1)
		return true
	window.location.href = el.href + TRACKING;
	return false;
}
		