// JavaScript Document

function confirmer(texte){
	return confirm(texte);
}
function afficher(menu){
	fermerOuvert();
	Effect.toggle(menu,'BLIND',{duration:0.3, queue:{scope:'myscope', position:'end'}});
	return false;

}
function fermerOuvert(){
	menus = document.getElementsByClassName('menuR');

	for(i=0; i<menus.length ; i++){
		//$('message').innerHTML += menus[i]+"<br />\n";
		if(menus[i].style.display != 'none'){
			Effect.toggle(menus[i],'BLIND',{duration:0.3,  queue:{scope:'myscope', position:'end'}});
		}
	}
}

function cacher(){
	if(document.getElementById('erreur').style.display == "none"){
		return false;
	}else{
		//alert('coucou');
		//document.getElementById('erreur').style.display = 'none';
		Effect.Fade('erreur',{duration:0.4});
		//Effect.multiple('erreur', Effect.DropOut, {speed:0.07, afterFinishInternal:function(){Effect.Fade('erreur',{duration:0.4})}}); return false;
	}
}
function rollon(id, queue){
	//id.color = $(id).style.backgroundColor;
	new Effect.Highlight(id, {queue:{scope:queue, position:'end'}, duration:0.4, startcolor:'#CCCCCC'});
}
function changeCouleur(ligne){
	this.color = ligne.style.backgroundColor;
	ligne.style.backgroundColor ="#CCCCCC";
}

function remetCouleur(ligne){
	//ligne.bgColor = '#FFFFFF';
	ligne.style.backgroundColor = this.color;
}

function recommander()
{
mail_str = "mailto:?subject=Site internet Saintes Poker Club"
mail_str += "&body=Bonjour, le site internet du Saintes Poker Club pourrait t'interesser. Voici le lien pour le visiter  http://www.saintespokerclub.fr/  "

location.href = mail_str;
}

function ajouterFavoris() {
	if ( navigator.appName != 'Microsoft Internet Explorer' )
		{ window.sidebar.addPanel("Site officiel Saintes Poker Club","http://www.saintespokerclub.fr",""); }
	else { window.external.AddFavorite("http://www.saintespokerclub.fr","Site officiel Saintes Poker Club"); }
}
function openwindows(numero)
{
    window.open("popFiche.php?id_membre="+numero+"", "",
		"width=300,height=300,scrollbars=0,left=" +
		((screen.width - 300)/2) + ",top=" + ((screen.height - 300)/2) )
}
function openwindowsChampionnat(numero)
{
    window.open("php/exportParticipant.php?partie="+numero+"", "",
		"width=600,height=500,scrollbars=1,left=" +
		((screen.width - 600)/2) + ",top=" + ((screen.height - 500)/2) )
}
function openwindowsInitiationVariantes(numero)
{
    window.open("php/exportParticipantAvecVariante.php?partie="+numero+"", "",
		"width=600,height=600,scrollbars=1,left=" +
		((screen.width - 600)/2) + ",top=" + ((screen.height - 600)/2) )
}
function openwindowsInitiationSansVariantes(numero)
{
    window.open("php/exportParticipantSansVariante.php?partie="+numero+"", "",
		"width=500,height=600,scrollbars=1,left=" +
		((screen.width - 500)/2) + ",top=" + ((screen.height - 600)/2) )
}
function openwindowsAide()
{
    window.open("aide.php", "",
		"width=800,height=600,scrollbars=1,left=" +
		((screen.width - 800)/2) + ",top=" + ((screen.height - 600)/2) )
}
function ajaxWaiting(){
	$('contentFrame').update('<div id="ajaxWainting"> </div>');
}
function getInit(id){
	//alert("get fiche : "+id);
	var url = 'ajax/init.php';
	var pars = 'id_partie='+id;
	var target = 'contentFrame';
	var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars, onLoading : ajaxWaiting()});
}

function getEvent(id){
	//alert("get fiche : "+id);
	var url = 'ajax/autre.php';
	var pars = 'id_partie='+id;
	var target = 'contentFrame';
	var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars, onLoading : ajaxWaiting()});
}

function getChamp(id){
	//alert("get fiche : "+id);
	var url = 'ajax/champ.php';
	var pars = 'id_partie='+id;
	var target = 'contentFrame';
	var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars, onLoading : ajaxWaiting()});
}
function getTournoi(id){
	//alert("get fiche : "+id);
	var url = 'ajax/tournoi.php';
	var pars = 'id_partie='+id;
	var target = 'contentFrame';
	var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars, onLoading : ajaxWaiting()});
}

function getCours(id){
	//alert("get fiche : "+id);
	var url = 'ajax/cours.php';
	var pars = 'id_partie='+id;
	var target = 'contentFrame';
	var myAjax = new Ajax.Updater(target, url, {method: 'get', parameters: pars, onLoading : ajaxWaiting()});
}

function message(html, fermetureAuto, delai){
	Shadowbox.open({
        player:     'html',
        content:    '<div class="shadowbox_message">'+html+'</div>',
        height:     125,
        width:      250
    });
	if(fermetureAuto == undefined){
		fermetureAuto = false;
	}
	if(delai == undefined){
		delai = 5000;
	}
	if(fermetureAuto == true){
		setTimeout(fermerShadowBox, delai);
	}
}

function fermerShadowBox(){
	Shadowbox.close();
}
