/*
 * Bastien Veysseyre pour Nexxpix
 * http://www.nexxpix.fr/
 * Version Beta 0.2
 */
var selectRef=function(){
	var b,t,v;
	return{
		init:function(b,t,v){
			if(v===undefined){v="_blank";}
			var bul,bli,blilen,blistoption,blistvalue,bsel,bulbyid,ultosel,bopt,situ,blia,i;
			bul=document.getElementById(b);
			bli=bul.getElementsByTagName('li');
			blilen = bli.length;
			bsel = document.createElement("select");
			bulbyid = document.getElementById(b);
			ultosel = bulbyid.parentNode;
			if(t != ''){
				bopt = document.createElement("option");
				bsel.appendChild(bopt);
				bopt.setAttribute("value", "");
				bopt.text = t;
			}
			for(i=0;i<blilen;i++){
				situ = bli[i];
				blia = situ.getElementsByTagName('a');
				blistvalue = blia[0];
				blistoption = blistvalue.childNodes[0].nodeValue;
				bopt[i] = document.createElement("option");
				bsel.appendChild(bopt[i]);
				bopt[i].setAttribute("value", blistvalue.href);
				bopt[i].text = blistoption;
			}
			bsel.setAttribute("onchange", "if(this.value != \'\'){window.open(this.value,\'"+v+"\')};");
			bsel.setAttribute("id", b);
			ultosel.replaceChild(bsel,bulbyid);
		}
	}
}();
