// JavaScript Document
function file(fichier)
 {
	 // FIREFOX
	 if(window.XMLHttpRequest)   xhr_object = new XMLHttpRequest();
	// IE
	else if(window.ActiveXObject)   xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	// ELSE 
	 else return(false);
	 xhr_object.open("GET", fichier, false);
	 xhr_object.send(null);
	 if(xhr_object.readyState == 4) return(xhr_object.responseText);
	 else return(false);
 }


function changeBackground(calque, color)
{
	isIE = (document.all) ;
	isNN6 = (!isIE) && (document.getElementById);	
	if (isIE) { calque = document.all[calque]; }
	if (isNN6){ calque = document.getElementById(calque); }
	calque.style.backgroundColor=color;
}

function changeClass(calque, classe)
{
	isIE = (document.all) ;
	isNN6 = (!isIE) && (document.getElementById);
	if (isIE) { calque = document.all[calque]; }
	if (isNN6){ calque = document.getElementById(calque); }
	calque.className=classe;
}


function change(type,calque)
{
	isIE = (document.all) ;
	isNN6 = (!isIE) && (document.getElementById);	
	if (isIE) { calque = document.all[calque]; }
	if (isNN6){ calque = document.getElementById(calque); }
	switch(type)
	{
			case "over":
				calque.style.backgroundColor='#4D4D4F';
				calque.style.color='#FFFFFF';
			break;
			
			case "out":
				calque.style.backgroundColor='#A9A8AD';
				calque.style.color='#4d4d4f';
			break;
	}
	
}

function changeClassVignette(calque)
{
	isIE = (document.all) ;
	isNN6 = (!isIE) && (document.getElementById);	
	if (isIE) { calque = document.all[calque]; }
	if (isNN6){ calque = document.getElementById(calque); }
	switch(calque.className)
	{
		case "vignette": calque.className = "normale"; break;
		default : calque.className = "vignette";
	}
}

function setSize(calque,action)
{
	
	isIE = (document.all) ;
	isNN6 = (!isIE) && (document.getElementById);
	if (isIE) { calque = document.all[calque]; }
	if (isNN6){ calque = document.getElementById(calque); }
	if(!calque.style.fontSize) temp = 1;
	switch(action)
	{
		case "+1" : temp += 0.1;calque.style.fontSize = temp+"em";break;
		case "-1" : temp -= 0.1;calque.style.fontSize = temp+"em";break;
	}
}

function popup(url, titre, largeur, hauteur, scrollbars,toolbar )
{
//window.open(url, titre, (width=" + largeur +, height=' + hauteur + ', scrollbars=' + scrollbars +', toolbar = ' + toolbar+'");
window.open(url,titre,"width=760,height=720,toolbar=no, scrollbars=false,status=no")
}


function PopupCentrer(page,largeur,hauteur, scroll) {
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+ ", scrollbars=" + scroll);
}

function myLocation(url)
{	
	parent.location = url;
}


/* increasing and decreasing text size.
how this works:
1- loop through all of the stylesheets
2 - check if they have a title
3 - check if that title contains "article" (indicates our article stylesheet)
4 - disable all article stylesheets
5 - enable the next size up or down.
6 - exit, enjoy the day.
*/
var sz=13 //default stylesheet
function selectStyleSheet(dir) {
var li; // link items - that is, stylesheets
//make sure we're under limit
if (10<sz+dir&&sz+dir<20){
   for(var i=0; li=document.getElementsByTagName("link")[i]; i++) {
// get stylesheets
     if(li.getAttribute("rel").indexOf("style") != -1 && li.getAttribute("title")) {
      if(li.getAttribute("title").indexOf("article") !=-1) li.disabled = true;
// check if 1 - it's a stylesheet with a title, 2- if it is an article stylesheet, disable it
		if (li.getAttribute("title").indexOf(sz+dir)>-1)li.disabled = false;
// if it's the next in line, enable it
	  }
	 }
//don't forget to increment the size, so we know what's next....
    sz=sz+dir;
   }
  }
  
  
function show(calque)
{
	var thecalque = document.getElementById(calque);
	switch(thecalque.style.display)
	{
		case "none" : thecalque.style.display = "block"; break;
		case "block" : thecalque.style.display = "none"; break;
		default: thecalque.style.display = "block";
	}
}

function show2(calque,mode)
{
	var thecalque = document.getElementById(calque);
	thecalque.style.display = mode;
}

function show3(calque,mode)
{
	var thecalque = document.getElementById(calque);
	thecalque.style.visibility = mode;
}
  
  
  
function ajouteSelection(idJoueur,idRencontre)
{
	loadQuery('http://www.assosports.com/club/include/scripts/ajax/query.php','INSERT INTO selections(id_joueur, id_rencontre) VALUES ('+idJoueur+','+idRencontre+')','');
	//loadUrl('http://www.64matchschrono.com/admin/ligue1/selections/express.php?IdJoueur='+idJoueur+'&IdRencontre='+idRencontre);
	show2('vert_'+idJoueur,'none');
}

