/**************************************/
/* JavaScript Document for XS-Gallery */
/*   Last Update : 2006-06-25 14:22   */
/*          LICENCE GNU / GPL         */
/*     DEVELOPED & DISTRIBUTE by      */
/*      http://www.althama.com        */
/**************************************/
/**************************************/
function launch(action){
	
	if(action=='album'){
		
		document.selection.selecti.value="album";
  	document.selection.submit();
  
	}
	
	if(action=='categorie'){
				
		document.selection.selecti.value="categorie";
		document.getElementById("catgalo").value=document.getElementById("cat_gali").options[document.getElementById('cat_gali').selectedIndex].text;
  	document.selection.submit();
  
	}
	
}
/**************************************/
function confirmation(url)
{
	if(confirm('Etes-vous sûr de vouloir supprimer cet élément ?'))
	document.location.href=url;
}
/**************************************/
var x = "";
var e = null;

function cntchar(m) {
	if(window.document.post.commentaire.value.length > m) {
		window.document.post.commentaire.value = x;
	} else {
		x = window.document.post.commentaire.value;
	}
	if(e == null)
	e = document.getElementById('cntChars');
	else
	e.childNodes[0].data = window.document.post.commentaire.value.length;
}

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

function ouvrirImage(url, height, width) {
  window.open(url, '', 'height='+height+', width='+width +',toolbar=no,menubar=no,status=no,resizable=yes');
}
/**************************************/

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 


