function usingIE()
{
    return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}

function miniphoto(obj,type,link,img)
{
    return false; //ne plus utiliser
    
    
    d = document.getElementById('miniphoto_div');
    a = document.getElementById('miniphoto_a');
    i = document.getElementById('miniphoto_img');
    if (type=='over')
    {
        d.style.display = '';
        if (link != 'same')
        {
            a.href = link;
            i.src = 'fichiers/event_photo/' + img;
            if (i.width > 650)
            {
                d.style.left = '5%';
            }
            else
            {
                d.style.left = '20%';
            }
        }
    }
    else //onmouseout
    {
        d.style.display = 'none';
    }
}

function loadPath(photo_id)
{
    d = document.getElementById(photo_id);
    npar = d.getNext();
    if (npar == null) return;
    n = npar.getChildren()[0];
    n.onload = function(){ loadPath(npar.id);};
    n.src = n.getAttribute('path');
}

function fisheye(obj,count,mode)
{
    //taille normale = 28 x 20
    if (mode == 'in')
    {
        obj.style.width = (obj.offsetWidth * 1.25) + 'px';
        obj.style.height = (obj.offsetHeight * 1.25) + 'px';
    }
    else // 'out' - taille normale
    {
        obj.style.width = '28px';
        obj.style.height = '20px';
    }
}

//Definir opacidade com valores decimais entre 0(transparente)..0.5(semi)..1(opaco)
function opacidade(id,valor)
{
    var object = document.getElementById(id).style; 
    object.opacity = valor; 
    object.MozOpacity = valor; 
    object.KhtmlOpacity = valor; 
    object.filter = "alpha(opacity=" + (valor*100) + ")"; 
}

function validaHoraMin(tempo,obrigatorio)
{
  //Aceitar apenas no formato- hh:mm em que hh (de 00 a 24) e mm (de 00 a 60)
  if (obrigatorio && tempo == '') return false;
  if (tempo.length != 5) return false;
  l1 = tempo.charAt(0);
  l2 = tempo.charAt(1);
  l3 = tempo.charAt(2);
  l4 = tempo.charAt(3);
  l5 = tempo.charAt(4);
  if (!isInteger(l1) || !isInteger(l2) || !isInteger(l4) || !isInteger(l5)) return false;
  if (l3 != ':') return false;
  if (parseInt(l1+l2) > 23) return false;  
  if (parseInt(l4+l5) > 59) return false;
  return true;  
}

function isInteger(s){
	var i;
 	for (i = 0; i < s.length; i++)
	{   
       // Check that current character is number.
       var c = s.charAt(i);
       if (((c < "0") || (c > "9"))) return false;
 	}
 	// All characters are numbers.
 	return true;
}

//Source: http://www.imasters.com.br/artigo/4768/javascript/tudo_sobre_javascript_nao-obstrutivo_-_parte_04_chamadas_de_funcao//imprimir/
function addEvent(obj, evType, fn)
{
    if (obj.addEventListener)
    {
       obj.addEventListener(evType, fn, false);
       return true;
    }
    else if (obj.attachEvent)
    {
       var r = obj.attachEvent("on"+evType, fn);
       return r;
    } 
    else
    {
       return false;
    }
}

//onkeydown='return onlyInteger(event)'
function onlyInteger(e)
{
	if (!e) var e = window.event;
	if (e.keyCode) charCode = e.keyCode;
	else if (e.which) charCode = e.which;
	validchars = new Array();
	validchars.push(48); //0
	validchars.push(49); //1
	validchars.push(50); //2
	validchars.push(51); //3
	validchars.push(52); //4
	validchars.push(53); //5
	validchars.push(54); //6
	validchars.push(55); //7
	validchars.push(56); //8
	validchars.push(57); //9
	validchars.push(96); //0(from numpad)
	validchars.push(97); //1(from numpad)
	validchars.push(98); //2(from numpad)
	validchars.push(99); //3(from numpad)
	validchars.push(100); //4(from numpad)
	validchars.push(101); //5(from numpad)
	validchars.push(102); //6(from numpad)
	validchars.push(103); //7(from numpad)
	validchars.push(104); //8(from numpad)
	validchars.push(105); //9(from numpad)
	validchars.push(37); //left arrow
	validchars.push(39); //right arrow
	validchars.push(8); //backspace
	validchars.push(9); //Tab
	validchars.push(46); //delete
	validchars.push(116); // 'F5'
	validchars.push(36); // Home
	validchars.push(35); // End
	//Ignore invalid characters
	validcode = false;
	for(number in validchars)
	{
		if (charCode == validchars[number])
		{
			validcode = true;
		}
	}
	if (!validcode) return false;
}

/* This script and many more are available free online at 
The JavaScript Source!! http://javascript.internet.com 
Original:  jgw (jgwang@csua.berkeley.edu ) 
Web Site:  http://www.csua.berkeley.edu/~jgwang/ 
*/
function checkCapsLock( e ) {
	var myKeyCode=0;
	var myShiftKey=false;

	// Internet Explorer 4+
	if ( document.all ) {
		myKeyCode=e.keyCode;
		myShiftKey=e.shiftKey;

	// Netscape 4
	} else if ( document.layers ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	// Netscape 6
	} else if ( document.getElementById ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	}

	// Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on
	if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) {
	  document.getElementById('capswarn').style.display = 'block';
	// Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on
	} else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) {
	  document.getElementById('capswarn').style.display = 'block';
	}
	else document.getElementById('capswarn').style.display = 'none';
}
