/**
 * Ouvre un lien dans une nouvelle fenetre
 */
function openBlank( uri ) {

    var p = window.open(uri);
    return false;

} // end of 'openBlank()'

/**
 * Verifie que la chaine passée n'est pas une chaine vide
 *
 * @param	string strSaisie	Chaine de caractère
 * @return	boolean				Retourne false si elle est vide, true dans la cas contraire
 */
function isBlank(strSaisie) {
	var iSaisie = 0;
	var strBlank = ""

	if (strSaisie != "") {
		for (i=0; i < strSaisie.length; i++)
			if (strSaisie.charAt(i) != ' ') iSaisie = 1;
		if (iSaisie == 1)
			return false;
	}
	return true;
}

/**
 * Verifie la validité d'une adresse email (presence d'un @ puis d'un .
 *
 * @param	string strSaisie	Adresse email à vérifier
 * @return	boolean				Retourne true si c'est une adresse email, false dans le cas contraire
 */
function isEmail(strSaisie) {

    var verif = /^[^@]+@(([\w\-]+\.){1,4}[a-zA-Z]{2,4}|(([01]?\d?\d|2[0-4]\d|25[0-5])\.){3}([01]?\d?\d|2[0-4]\d|25[0-5]))$/
    return ( verif.test(strSaisie) );

    /*
	a = strSaisie.indexOf("@");
	if ( a != -1 ) {
		p = strSaisie.indexOf(".", a);
		if ( p != -1 )
			return true;
	}
	return false;
	*/
}

/**
 * Verifie si un objet de type radio ou checkbox a au moins un element selectionné
 *
 * @param	object obj	Input de type radio ou checkbox d'un formulaire
 * @return	boolean		Retourne true si un element au moins est selectionné false dans le cas contraire
 * @author				David Duret
 * @created				2002-06-12
 */
function isChecked(obj) {
	for ( var i = 0; i < obj.length; i++ ) {
		if ( typeof(checked) == 'undefined' ) checked = false;
		checked = ( obj[i].checked || checked );
	}
	return checked
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function swapImage(obj, name, title) {

    MM_swapImage('zoom','','../../../images/applications/' + name + '_zoom.jpg',1);
    document.getElementById('info').innerHTML = obj.parentNode.title;

}

/**
 * @see http://www.dustindiaz.com/getelementsbyclass
 */
function getElementsByClass( node, searchClass, tag ) {

    var classElements = new Array();
    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
    for ( var i = 0, j = 0; i < elsLen; i++) {
        if ( pattern.test(els[i].className) ) {
            classElements[j] = els[i];
            j++;
        }
    }

    return classElements;

} // end of 'getElementsByClass()'

