/************************************************************/
/* Compteur de caractères */
/************************************************************/
function setCharCounter (a, b, n) {
	var o = my_getbyid(a);
	o.charCounterMax = n;
	o.charCounterDisplay = b;
	o.onkeyup = charCounterUpdate;
}
function charCounterUpdate () {
	var n = this.value.length;
	if (this.charCounterDisplay) {
		var o = document.getElementById(this.charCounterDisplay);
		if (o.tagName.toLowerCase()=="input") o.value = n;
		else o.innerHTML = n;
	}
}

function gkIm()
{
	var leftpos = (screen.availWidth - 200)-40;
	resiz = (navigator.appName=="Netscape") ? 0 : 1;
	window.open("/communaute/im/im_affichage.html", "IMGK","width=170,height=446,top=40,left="+leftpos+",directories=no,location=no,menubar=no,scroll=no,status=no,titlebar=no,toolbar=no,resizable=1");
}
function confirmation(valLibelle,valUrl)
{
	conf=confirm(valLibelle)
	if (conf)
	{
		document.location.href=valUrl;
	}
}

/************************************************************/
/* Get element by id */
/************************************************************/

function my_getbyid(id)
{
	itm = null;		
	if (document.getElementById)
	{
		itm = document.getElementById(id);
	}
	else if (document.all)
	{
		itm = document.all[id];
	}
	else if (document.layers)
	{
		itm = document.layers[id];
	}
	return itm;
}

/************************************************************/
/* Show/hide toggle */
/************************************************************/

function toggleview(id)
{
	if ( ! id ) return;
	if ( itm = my_getbyid(id) )
	{
		if (itm.style.display == "none")
		{
			my_show_div(itm);
		}
		else
		{
			my_hide_div(itm);
		}
	}
}

/************************************************************/
/* Set DIV ID to show */
/************************************************************/

function my_show_div(itm)
{
	if ( ! itm ) return;
	
	itm.style.display = "";
}

/************************************************************/
/* Set DIV ID to hide */
/************************************************************/

function my_hide_div(itm)
{
	if ( ! itm ) return;		
	itm.style.display = "none";
}
	
/************************************************************/
/* Pour la reduction d'image */
/************************************************************/

function forum_img_over() { 
	window.status='Cette image a été réduite. Cliquez pour l\'agrandir'; 
	document.body.style.cursor = "pointer";
	return true;
} 

function forum_img_out() { 
	window.status=''; 
	document.body.style.cursor = "default"; 
	return true;
}
