/*
	JavaScript Document
	
	Version : 2.0 du 21/07/2010
	Pour	: Bridge Amical Club 44
	Web	: www.bac44.fr
	Auteur	: Vincent HUMEAU
	
	© Trans-Sphère Sarl		http://www.trans-sphere.com 	Internet & Multimédia
	
*/
function $(x) { return typeof(x) == "string" ? document.getElementById(x) : x; }
function affiche(id){ $(id).style.display='block';}
function cache(id) {$(id).style.display='none';}
function visible(id) {$(id).style.visibility='visible';}
function invisible(id) {$(id).style.visibility='hidden';}
function efface(id){ $(id).innerHTML='';}
function insert(id,contenu){ $(id).innerHTML=contenu;}
function reclass(id,classe){ $(id).className=classe;}
function flipflop_class(id,avant,apres){$(id).className = $(id).className.replace(avant,apres);}
function courriel(prefixe,id_societe){domaine = false;switch(id_societe){case 1 : domaine = "bac44.fr";break;case 2 : domaine = "trans-sphere.com";break;}if(domaine && prefixe) location.href = "mailto:"+prefixe+"@"+domaine;}
function magikmail(id,prefixe,domaine){ document.getElementById(id).innerHTML='<a href="mailto:'+prefixe+'@'+domaine+'">'+prefixe+'@'+domaine+'</a>';}
function affichajax(etat){ var fond = 'plan_ajax_fd'; var tanker = 'plan_ajax'; switch(etat){ case 0 : cache(fond);cache(tanker);efface('ajax');break; case 1 : affiche(fond);affiche(tanker);break; }}var xhr = null; 
function Xhr_get(){if(window.XMLHttpRequest) xhr = new XMLHttpRequest();else if(window.ActiveXObject){try { xhr = new ActiveXObject("Msxml2.XMLHTTP");} catch (e){ xhr = new ActiveXObject("Microsoft.XMLHTTP");}}else { alert("Votre navigateur est obsolète ou restreint dans ses fonctionnalités\n\n- mettez à jour la version de votre navigateur\n- activez le support des activeX"); xhr = false;}}var fonction_pre_Xhr = false;var fonction_post_Xhr = false;var fonction_js = new RegExp();fonction_js.compile("^<!-- JS::(.*)-->");
function Xhr_give(){affiche('throbber');var idDest = (arguments[0] != null) ? arguments[0]:"nulle_part";var urlcible = (arguments[1] != null) ? arguments[1]:"nulle_part.html";var parametres = (arguments[2]) ? arguments[2]:null;var methode = (arguments[3]) ? arguments[3]:"GET";var async = (arguments[4]) ? arguments[4]:true;Xhr_get();xhr.onreadystatechange = function(){ if(xhr.readyState == 4) { if(xhr.status == 200) {  if(fonction_js.test(xhr.responseText)) {  var fcts = fonction_js.exec(xhr.responseText);  var fonctions = fcts[0].substr(9);  fonctions = fonctions.substr(0,(fonctions.length-3));  eval(fonctions);  }  if(fonction_pre_Xhr) {  eval(fonction_pre_Xhr);  fonction_pre_Xhr=false;  }  $(idDest).innerHTML = xhr.responseText;  if(fonction_post_Xhr) {  eval(fonction_post_Xhr);  fonction_post_Xhr=false;  }  cache('throbber'); }else{cache('throbber');affichajax(0); } }};xhr.open(methode,urlcible,async);if(methode=='POST') {xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');parametres=encodeURI(parametres);} xhr.send(parametres);}var IE = (navigator.userAgent.match(/MSIE/i)) ? true:false;var IE6 = ( navigator.userAgent.match(/MSIE 6/i) && (navigator.userAgent.search(/MSIE 7/i)<0) && (navigator.userAgent.search(/MSIE 8/i)<0) ) ? true:false;var IE7 = ( !IE6 && navigator.userAgent.match(/MSIE 7/i) && (navigator.userAgent.search(/MSIE 8/i)<0) ) ? true:false;var IE8 = ( !IE6 && !IE7 && navigator.userAgent.match(/MSIE 8/i) ) ? true:false;var opacite_down_action = false;var opacite_down_cible = false;var opacite_down_suite = false;
function disparition(id){opacite_down_cible = id;opacite_down_action = window.setInterval("opacite_down()",42);}
function opacite_down(){var step_opacite = 0.05;if(IE){with($(opacite_down_cible).filters[0]) {valeur = parseInt(opacity);if(valeur>0) opacity = valeur - (step_opacite*100);else { window.clearInterval(opacite_down_action); cache(opacite_down_cible);}}}else{with($(opacite_down_cible).style) {valeur = parseFloat(opacity);if(valeur>0) opacity = valeur - step_opacite;else { window.clearInterval(opacite_down_action); cache(opacite_down_cible);}}}}
function input_alert(id,etat){switch(etat){case 0 : var avant = 'ko'; var apres = 'ok';break;case 1 : var avant = 'ok'; var apres = 'ko';break;}$(id).className = $(id).className.replace(avant,apres);}
function valeur_numerique(chaine){ numerique_temp = chaine.split("px"); numerique = parseInt(numerique_temp[0]); return numerique;}
function winDims(){ var w = (IE) ? document.documentElement.clientWidth:window.innerWidth; var h = (IE) ? document.documentElement.clientHeight:window.innerHeight; return w+'x'+h;}var photos_suite = false;var dims_suite = false;var photo_on = false;var diaporama = false;
function photo_show(){ var sens = (arguments.length == 1) ? arguments[0]:'next'; if(photos_suite && photo_on && sens){ var suite_tab = photos_suite.split(','); var total = suite_tab.length; switch(sens){  case 'next' : var photo_next = (photo_on == total) ? 1:(photo_on + 1);break;  case 'prev' : var photo_next = (photo_on == 1) ? total:(photo_on - 1);break; } var matcher = new RegExp(); matcher.compile(suite_tab[(photo_on-1)]); var html = $('galerie_photo_div').innerHTML; while( matcher.test(html) ){ html = html.replace(suite_tab[(photo_on-1)],suite_tab[(photo_next-1)]); } var dims_tab = dims_suite.split(','); var dims = dims_tab[(photo_next-1)].split('x'); if(!IE){  html = html.replace(/width=\"([0-9]{1,4})\"/, "width=\""+dims[0]+"\"");  html = html.replace(/height=\"([0-9]{1,4})\"/, "height=\""+dims[1]+"\""); } $('galerie_photo_div').innerHTML = html; if(IE){  $('galerie_photo_div').firstChild.setAttribute("width", dims[0]);  $('galerie_photo_div').firstChild.setAttribute("height", dims[1]); } photo_on = photo_next; $('galerie_index').innerHTML = photo_on+'/'+total; }}
function fond_pa(etat){ $('plan_ajax').style.backgroundColor = (etat == 1) ? 'rgb(0,0,0)':'transparent'; }
function diaporama_cmd(){ var etat = (arguments.length == 1) ? arguments[0]:((diaporama) ? 0:1); switch(etat){ case 0 : if(diaporama) { window.clearInterval(diaporama); fond_pa(0); diaporama = false; } break; case 1 : var temporisation = parseInt($('galerie_dtempo').innerHTML)*1000; diaporama = window.setInterval("photo_show();",temporisation); fond_pa(1); break; }}
function diaporama_btn(){ with($('galerie_dcmd')){ src = (diaporama) ? src.replace('pause','play'):src.replace('play','pause'); title = (diaporama) ? title.replace('Lancer','Arrêter'):title.replace('Arrêter','Lancer'); }}
function diaporama_temporize(sens){ var temporisation = parseInt($('galerie_dtempo').innerHTML); switch(sens){ case '+' : temporisation++; break; case '-' : temporisation--; break; } temporisation = (temporisation < 1) ? 1:temporisation; $('galerie_dtempo').innerHTML = temporisation; if(diaporama) {diaporama_cmd(); diaporama_cmd();}}
