/*LICENCE****************************************************
* Tous droits reserves 2008 - 2009 / Copyright 2008 - 2009  *
*                                                           *
* Le Groupe Nippour                                         *
* 2655, boul. du Royaume,                                   *
* Bureau 600                                                *
* Jonquiere, Quebec, Canada                                 *
* G7S 4S9                                                   *
*                                                           *
* Ce fichier fait partie integrante du gestionnaire de site *
* internet Sitadel(C). L'utilisation de Sitadel est soumise *
* à une licence restreinte que vous trouverez dans le       *
* fichier suivant :                                         *
*                                                           *
* htdocs\sitadel\extranet\licence\licence.txt               *
****************************************************LICENCE*/

// JavaScript Document

/************************ Variables globales ************************/

/********************************************************************/

/************************************************************************************************/
// Création de l'objet pour faire de l'AJAX
function ajaxObject(activeLoading, elementChoix){
	var xmlHttp;
	if (activeLoading == true){		
		toggleLoading(true, elementChoix);
	}
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
			}
		}
	}
	return xmlHttp;
}
/************************************************************************************************/

/************************************************************************************************/
// Fait afficher/cacher le popup de loading
function toggleLoading(aff, elementChoix){
	if (aff == true){
		ajaxRunning = true;
		document.body.style.cursor = "wait";
		document.getElementById(elementChoix).style.display = "block";
		document.getElementById(elementChoix).style.left = (document.body.clientWidth / 2 - 230) + "px";
		document.getElementById(elementChoix).style.top = (document.body.clientHeight / 2 - 160) + "px";
		//document.getElementById("ajaxLoading").innerHTML = "<img src='../principal/images/ajax-loader.gif' />";
	}else{
		ajaxRunning = false;
		document.body.style.cursor = "auto";
		document.getElementById(elementChoix).style.display = "none";
	}
}
/************************************************************************************************/

/******************************************************/
/* Fonction de mise à jour du compteur d'inscriptions */
/******************************************************/
function updateCompteur(nbrInsc)
{
	document.getElementById('nbrInscriptions2').innerHTML = nbrInsc;
}
/******************************************************/



/************************ PNG24 Hack ************************/
function applyPNGFilter(o)
{	
	var t="images/spacer.gif";	
	if( o.src != t ) {
		var s=o.src;
		try{
			
			o.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + s + "',sizingMethod='scale')";
			o.src = t;
		}catch(e){
			e = "";	
		}
	}
}
/************************************************************************/

/************************ Fonctions JQuery ************************/
// Ce code doit être là pour que les fonctions JQuery fonctionnent si Lightbox est aussi présent dans le site Internet
jQuery.noConflict();
     
// Put all your code in your document ready area
jQuery(document).ready(function($){
	// Do jQuery stuff using $
	
});

// Use Prototype with $(...), etc.
//$('someid').hide();

/*********************************************************************************************/


/************************ Scripts ayant rapport seulement à l'interface de connexion. ************************/
function effacerLogin()
{
	if(document.getElementById('case_login').value == "Nom d'utilisateur")
	{
		document.getElementById('case_login').value = '';
	}
}
function effacerPassword()
{
	if(document.getElementById('case_pass').value == "Mot de passe")
	{
		document.getElementById('case_pass').value = '';
		//document.getElementById('case_pass').setAttribute('type', 'password');
		//alert("sa passe");

		test_focus = changeInputType(document.getElementById('case_pass'), 'password');

		document.getElementById('case_pass').focus();
		document.getElementById('case_pass').focus();	
	}
}

function changeInputType(oldObject, oType)
{
	var newObject = document.createElement('input');
	newObject.type = oType;
	if(oldObject.size) newObject.size = oldObject.size;
	if(oldObject.value) newObject.value = oldObject.value;
	if(oldObject.name) newObject.name = oldObject.name;
	if(oldObject.id) newObject.id = oldObject.id;
	if(oldObject.className) newObject.className = oldObject.className;
	if(oldObject.onkeypress) newObject.setAttribute("onkeypress", oldObject.getAttribute("onkeypress"));
	oldObject.parentNode.replaceChild(newObject,oldObject);
	return newObject;
}
	
/*********************************************************************************************/
