function	change_fontsize(type, id)
{
	size = document.getElementById(id).style.fontSize;
	size = parseInt(size);
	
	new_size = size;
	if (type == 1 && size < 14)
		new_size = size + 1;
	else if (type == 2 && size > 10)
		new_size = size - 1;
	
	document.getElementById(id).style.fontSize = new_size + 'px';
}

function	tt_disapear(div, time)
{
	action = "document.getElementById('"+div+"').style.display = 'none';";
	setTimeout(action, time);
}

function	change_info_flash(id)
{
	var bg_color = new Array('#214266', '#3E6AA0', '#CC1A6A');
	
	for (i = 1; i <= 3; i++)
	{
		if (i != id)
		{
			document.getElementById('home_if_' + i).style.height = '16px';
			document.getElementById('home_if_' + i).style.backgroundColor = '#EEEEEE';
			document.getElementById('home_if_' + i).style.fontWeight = 'normal';
			document.getElementById('home_if_contenu_' + i).style.display = 'none';
		}
	}
	document.getElementById('home_if_' + id).style.height = '18px';
	document.getElementById('home_if_' + id).style.backgroundColor = '#FFFFFF';
	document.getElementById('home_if_' + id).style.fontWeight = 'bold';
	document.getElementById('home_if_contenu_' + id).style.display = 'block';
	document.getElementById('td_if').style.backgroundColor = bg_color[id-1];
}

function	change_news(id)
{
	navigateur = navigator.appName;
	for (i = 0; i < 5; i++)
	{
		if (i != id)
		{
			document.getElementById('news_' + i).style.display = 'none';
			document.getElementById('news_miniature_' + i).style.opacity = '0.3';
			document.getElementById('news_miniature_' + i).style.filter = 'alpha(opacity=30)';
			document.getElementById('td_block_news_' + i).style.border = '1px solid #FFFFFF';
			document.getElementById('td_block_news_' + i).style.borderTop = '1px solid #808080';
		}
	}
	
	document.getElementById('news_' + id).style.display = 'block';
	document.getElementById('td_block_news_' + id).style.border = '1px solid #FFFFFF';
	document.getElementById('td_block_news_' + id).style.borderTop = '1px solid #F1F1F1';
	document.getElementById('news_miniature_' + id).style.opacity = 1;
	document.getElementById('news_miniature_' + id).style.filter = 'alpha(opacity=100)';
		
}

function	highlight_player(type, class_name, genre)
{
	var elem = document.getElementsByTagName('div');
	var resultats = new Array();
	if (genre == 2)
	{
		for(var i = 0; i < elem.length; i++)
		if(elem[i].className == class_name)
			elem[i].style.background = ((type == 1) ? '#A7D4FF' : '');
	}
	else if (genre == 1)
	{
		for(var i = 0; i < elem.length; i++)
		if(elem[i].className == class_name)
			elem[i].style.background = ((type == 1) ? '#FFADE1' : '');
	}
	else
	{
		for(var i = 0; i < elem.length; i++)
		if(elem[i].className == class_name)
			elem[i].style.background = ((type == 1) ? '#A7D4FF' : '');
	}
}

function	highlight_player_ranking(type, color, id_name)
{
	var i = 1;
	while (i <= 100)
	{
		if (document.getElementById(id_name + '_' + i))
		{
			if (type == 1)
				document.getElementById(id_name + '_' + i).style.background = color;
			else
				document.getElementById(id_name + '_' + i).style.background = ((i % 2 == 1) ? '#FFFFFF' : '#F3F3F3');
		}
		i++;
	}
}

function	see_all_res(class_name)
{
	if (navigator.appName == 'Microsoft Internet Explorer')
		attr = 'block';
	else
		attr = 'table-row';
	var elem = document.getElementsByTagName('tr');
	for(var i = 0; i < elem.length; i++)
		if(elem[i].className == class_name)
			elem[i].style.display = ((elem[i].style.display == attr) ? 'none' : attr);
}

/*function	change_transparence(div_id, tr, tr_end, timing, type)
{
	if (type == 1)
	{
		document.getElementById(div_id).style.opacity = tr / 10;
		if (tr < tr_end)
		{
			new_tr = tr + 2;
			action = "change_transparence('" + div_id + "', " + new_tr + ", " + tr_end + ", " + timing + ", " + type + ");";
			setTimeout(action, timing);
		}
	}
	else if (type == 2)
	{
		document.getElementById(div_id).style.opacity = tr / 10;
		if (tr > tr_end)
		{
			new_tr = tr - 2;
			action = "change_transparence('" + div_id + "', " + new_tr + ", " + tr_end + ", " + timing + ", " + type + ");";
			setTimeout(action, timing);
		}
		if (tr == tr_end)
			document.getElementById(div_id).style.display = 'none';
	}
}*/

function	change_menu_head(id, img_back_bann)
{
	
	document.getElementById('bann_special').style.background = 'url(' + img_back_bann + ') no-repeat center center';
	
	id = parseInt(id);
	for (i = 0; i < 5; i++)
	{
		pos = parseInt(document.getElementById('sous_menu_' + i).style.top);
		//alert("Menu " + i + " | top = " + pos);
		if (pos == 0 && id != i)
		{
			up_menu_head(i, 1);
			//down_menu_head(id, 2, 0);
			action = "down_menu_head(" + id + ", 2);";
			setTimeout(action, 0);
			break;
		}
	}
}

function	up_menu_head(id, pos)
{
	new_pos = pos + 4;
	
	if (pos < 20)
	{
		document.getElementById('sous_menu_' + id).style.top = -new_pos + 'px';
		action = 'up_menu_head(' + id + ', ' + new_pos + ');';
		up_timer = setTimeout(action, 20);
	}
	else
	{
		document.getElementById('sous_menu_' + id).style.top = -20 + 'px';
		document.getElementById('sous_menu_' + id).style.display = 'none';
	}
}

function	down_menu_head(id, pos)
{
	document.getElementById('sous_menu_' + id).style.display = 'block';
	
	new_pos = pos + 4;
	
	if (new_pos < 20)
	{
		document.getElementById('sous_menu_' + id).style.top = -20 + new_pos + 'px';
		action = 'down_menu_head(' + id + ', ' + new_pos + ');';
		down_timer = setTimeout(action, 20);
	}
	else
		document.getElementById('sous_menu_' + id).style.top = -20 + 20 + 'px';
}

function	tt_res_load(div, file)
{
	//On affiche le resultat
	tt_Load(div, file);
	
	//Rappel tt_res_load pour le score suivant
	action = "tt_res_load('" + div + "', '" + file + "');";
	setTimeout(action, 3000);
}

function	tt_Load(div, file)
{
    var xhr; 
    try {  xhr = new ActiveXObject('Msxml2.XMLHTTP');   }
    catch (e) 
    {
        try {   xhr = new ActiveXObject('Microsoft.XMLHTTP');    }
        catch (e2) 
        {
          try {  xhr = new XMLHttpRequest();     }
          catch (e3) {  xhr = false;   }
        }
    }
    /*
	var locat = String(file);
	var res = locat.match(/\?/gi);
	if(res)
	{
		file = file + '&d=' + new Date().getTime();
	}else{
		file = file + '?d=' + new Date().getTime();
	}*/
	
    xhr.onreadystatechange = function()
    {
		if(xhr.readyState == 4)
		{
			if(xhr.status == 200)
			{
				if(xhr.responseText)
					document.getElementById(div).innerHTML = xhr.responseText;
				return (1);
			}
         }
    }; 

	xhr.open('GET', file,  true);
	xhr.send(null);
}

function tt_Ajax(file)
{
	if(window.XMLHttpRequest)
		xhr_object = new XMLHttpRequest();
		
	else if(window.ActiveXObject)
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
		
	else
		return(false);
	
	xhr_object.open("GET", file, true);
	xhr_object.send(null);
	
	xhr_object.onreadystatechange = function(){}
	
}

function	see_pic(id, img, div, width, tags)
{
	doc_diapo = document.getElementById(div);
	doc_diapo.style.display = 'block';
	
	doc_diapo.innerHTML = '<div style="margin:20px auto auto auto;max-height:95%;overflow-y:auto;overflow-x:hidden;width:'+(width+20)+'px;"><table style="width:'+(width+20)+'px;" cellpadding="0" cellspacing="0"><tr><td style="width:'+(width+20-150)+'px;">&nbsp;</td><td style="background:url(images/back_close_img.png) no-repeat center center;width:150px;"><a onclick="document.getElementById(\''+div+'\').style.display = \'none\';" style="color:#EEEEEE;font-weight:bold;font-size:15px;cursor:pointer;">Fermer</a></td></tr><tr><td style="padding:10px 10px 5px 10px;background:white;" colspan="2"><div><img src="images/upload/images/big/' + img + '" /><div></td></tr><tr><td style="border-top:1px dotted #C9C9C9;background:white;padding:5px 10px 5px 10px;text-align:left;" colspan="2"><span style="padding-left:20px;background:url(images/tag.png) no-repeat left center;">'+tags+'</span></td></tr></table>';
	tt_Ajax('pages/actions/see_pic.php?id='+id);
}

function	focus_form_txt(val, input)
{
	if (input.value == val)
	{
		input.style.color = '#565656';
		input.style.fontStyle = 'normal';
		input.value = '';
	}
}

function	blur_form_txt(val, input)
{
	if (input.value == '')
	{
		input.style.color = '#B5B5B5';
		input.style.fontStyle = 'italic';
		input.value = val;
	}
}

function server_calc()
{
if (server_sec < 10)
	server_sec = "0"+Math.round(server_sec);
else if(server_sec >= 60)
	{
	server_sec = "00";
	server_min++;
	}
if (server_min < 10)
	server_min = "0"+Math.round(server_min);
else if(server_min >= 60)
	{
	server_min = "00";
	server_hou++;
	}
if (server_hou < 10)
	server_hou = "0"+Math.round(server_hou);
else if(server_hou >= 24)
	{
	server_hou = "00";
	}
server_text = server_hou + ":" + server_min + ":" + server_sec;
if (document.getElementById){
	document.getElementById("server_time_ft").innerHTML=server_text;
	}
server_sec++;
}
