

function json_load_file(url,func,p1,p2){
var json_req = null; 
if(window.XMLHttpRequest) // Firefox 
	   json_req = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // Internet Explorer 
	   json_req = new ActiveXObject("Microsoft.XMLHTTP"); 
	else 
{ // XMLHttpRequest non supporté par le navigateur 
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	    
} 



json_req.open("GET", url, true); 
json_req.onreadystatechange = function (){
var json_func="";
var json_p1="";
json_func=func;
json_p2=p2;
json_p1=p1;
//alert("json_p2="+json_p2);
   if (json_req.readyState == 4) 
   { 	
 
				
        var data = eval('(' + json_req.responseText + ')');
       // alert(json_func);
        call_func=json_func+"(data,'"+json_p1+"','"+json_p2+"');";
        
        eval(call_func); 
   }
   
}
json_req.send(null);
}

function json_load_list(data,elt_id,selected_value){
//alert(data);
//alert("elt_id="+elt_id+" selected_value="+selected_value);
elt=document.getElementById(elt_id);
//alert(elt.name);
elt.innerHTML="";
list=data.list;
l=list.length;
 //alert("list long="+l)
//alert(l);
option = new Option("SELECT","");
option.selected=true;
elt.options[0]=option;

for (i=0;i<l;i++){
option = new Option(list[i].title,list[i].code);
//alert("option value="+option.value + "selected_value="+selected_value);
if (option.value==selected_value)
option.selected=true;
elt.options[i+1]=option;
}
//alert(elt.options.length);
}

function ws_json_load_images(images,elt_id){

elt=document.getElementById(elt_id);
//alert(elt.name);
elt.innerHTML="";
l=images.length;

html='';
if(l<=0) return false;
html='';

for (i=0;i<l;i++){
image=images[i];
html+='<h4>'+image.title+'</h4>';
html+='<img src="'+image.th_src+'" />';
html+='<br/><a href="#" onclick="insertInParent(\''+image.src+'\')"; >Insérer</a>';
}
elt.innerHTML=html;
//alert(html);
}
function default_function(data,p1,p2){

}


