// JavaScript Document
var oldcolor;
var oldligne=0;
var detailsopen=0;
function changecolor(col){
	colb=(col.id);
	if (document.all){
		obj=eval("document.all."+colb+".style");
		oldcolor=obj.backgroundColor;
		obj.backgroundColor="#ffff9a";
		//document.all.getElementById(colb).style.background='#000000';
	}
	else{
		oldcolor=document.getElementById(colb).style.backgroundColor;
		document.getElementById(colb).style.background='#ffff9a';
	}
}
function reinitcolor(col){
	colb=(col.id);
	if (document.all){
	obj=eval("document.all."+colb+".style");
	obj.backgroundColor=oldcolor;
	}else{
	document.getElementById(colb).style.backgroundColor=oldcolor;
	}
}
function goto(lien){
	window.location.href=lien;
}
function confirmation(url,msg,obj,evt) {
	if(confirm(msg)) {document.location.href = url;
		}else{
		document.location.href = document.location.href;
		}
}
function TAinsert(text1,text2,id) 
{ 
     var ta = document.getElementById(id); 
      //var ta=id; 
     if (document.selection) { 
        var str = document.selection.createRange().text; 
        ta.focus(); 
        var sel = document.selection.createRange(); 
        if (text2!="") 
        { 
           if (str=="") 
           { 
              var instances = countInstances(text1,text2); 
              if (instances%2 != 0){ sel.text = sel.text + text2;} 
              else{ sel.text = sel.text + text1;} 
           } 
           else 
           { 
              sel.text = text1 + sel.text + text2; 
           } 
        } 
        else 
        { 
           sel.text = sel.text + text1; 
        } 
        
     } 
     else if (ta.selectionStart | ta.selectionStart == 0) 
     { 
        if (ta.selectionEnd > ta.value.length) { ta.selectionEnd = ta.value.length; } 
       
        var firstPos = ta.selectionStart; 
        var secondPos = ta.selectionEnd+text1.length; 
       
        ta.value=ta.value.slice(0,firstPos)+text1+ta.value.slice(firstPos); 
        ta.value=ta.value.slice(0,secondPos)+text2+ta.value.slice(secondPos); 
         
        ta.selectionStart = firstPos+text1.length; 
        ta.selectionEnd = secondPos; 
        ta.focus(); 
     } 
     else 
     { // Opera 
        //var sel = document.hop.contenuforum; 
       
        var instances = countInstances(text1,text2); 
        if (instances%2 != 0 && text2 != ""){ sel.value = sel.value + text2; } 
        else{ sel.value = sel.value + text1; } 
     }  
}
//
function aff_details(l){
  ligne=('prospect'+l.id);
  	if (document.all){
		if(oldligne!=0){
			obj=eval("document.all."+oldligne+".style");
			obj.display="none";
		}
		if(oldligne==ligne && detailsopen==0){
			obj=eval("document.all."+oldligne+".style");
			obj.display="block";
			detailsopen=1;
			return;
		}
		if(oldligne==ligne){
			obj=eval("document.all."+oldligne+".style");
			obj.display="none";
			detailsopen=0;
			return;
		}
	obj=eval("document.all."+ligne+".style");
	obj.display="block";
	detailsopen=1;
	//document.all.getElementById(colb).style.background='#000000';
	}else{
		if(oldligne!=0){
			document.getElementById(oldligne).style.display='none';
		}
		if(oldligne==ligne && detailsopen==0){
			document.getElementById(oldligne).style.display='block';
			detailsopen=1;
			return;
		}
		if(oldligne==ligne){
			document.getElementById(oldligne).style.display='none';
			detailsopen=0;
			return;
		}
	document.getElementById(ligne).style.display='block';
	detailsopen=1;
	}
			oldligne=ligne;
}
