/**
 * Lookup logic
 *
 * @package JavaScript
 * @version $Id: edit.js,v 1.0
 */

	function Deplacer(l1,l2) {
		if (l1.options.selectedIndex>=0) {
			o=new Option(l1.options[l1.options.selectedIndex].text,l1.options[l1.options.selectedIndex].value);
			l2.options[l2.options.length]=o;
			l1.options[l1.options.selectedIndex]=null;
		}else{
			alert("Aucune club sélectionnée");
		}
	}
	function Ajouter(l1,l2) {
		if (l1.options.selectedIndex>=0) {
			o=new Option(l1.options[l1.options.selectedIndex].text,l1.options[l1.options.selectedIndex].value);
			l2.options[l2.options.length]=o;
		}else{
			alert("Aucune club sélectionnée");
		}
	}
	function Effacer(l1,l2) {
		if (l1.options.selectedIndex>=0) {
			o=new Option(l1.options[l1.options.selectedIndex].text,l1.options[l1.options.selectedIndex].value);
			l1.options[l1.options.selectedIndex]=null;
		}else{
			alert("Aucune club sélectionnée");
		}
	}
	
	function affecte(aff,unaff)	{
	sel=unaff.options.selectedIndex;
	if (sel != -1)
		{
			aff_txt = unaff.options[sel].text;
			aff_val = unaff.options[sel].value;
			aff_opt = new Option(aff_txt,aff_val,1,0);
			aff.options[aff.options.length] = aff_opt;
			unaff.options[sel] = null;
		}
		else
		{
			window.alert("Veuillez sélectionner un élément");
		}
	}

	function affectetout(aff,unaff)	{
	ind=(unaff.options.length);
		for (a = 0; a < ind; a += 1) {
			sel=unaff.options.selectedIndex;
			if (sel != -1) {
			aff_txt = unaff.options[sel].text;
			aff_val = unaff.options[sel].value;
			aff_opt = new Option(aff_txt,aff_val,1,0);
			aff.options[aff.options.length] = aff_opt;
			unaff.options[sel] = null;
			}
		}
	}
	
	function CheckAlbumForm(frm,alert1,alert2,limit)
    {
        var select_len = frm.candidate.length;
        var album = new Object();

        if (select_len >= limit) {
            if (confirm(alert1)) {
                for (i=0; i<select_len; i++) {
                        frm.candidate.options[i].selected = true;
                }
                return true;
            }
            else
                return false;
        }
        else {
            alert(alert2);
            return false;
        }
    }

	function ValidAlbumForm(frm,alert1)
    {
        var select_len = frm.candidate.length;
        var album = new Object();
        if (confirm(alert1)) {
          for (i=0; i<select_len; i++) {
              frm.candidate.options[i].selected = true;
          }
          return true;
        }
        else
          return false;

    }
	
	function lookupPlayer(firstname, lastname)
	{
		open('lookup_player.php?searchtype=player&find=' + escape(firstname) + ' ' + escape(lastname), 'lookup',
			 'width=450,height=500,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no');
	}
	
	

