var optionS = new Array();

function subForm(no,fiche){

/*
  if ( no == '' ){

       var address = location.href;

       address = address.split('?')

       if(address.length==2 && address[1].search('fiche') < 0)
         document.search.action="?page=categ&"+address[1];
       else
         document.search.action="?page=categ";
  }
  
  else if(no == 'recherche')
       document.search.action="index.php";
	   
  else*/ if (fiche != ''){
      //document.searchService.action="?page=categ&"+no;  
       document.getElementById("fiche").value = fiche;
  }
  else{
      // document.searchService.action="?page=categ&no="+no;
	   document.getElementById("no").value = no;
  }	   
       
  document.searchService.submit();


}

function addOption(ID_Scian,Scian_Niveau,Scian_Hierar,Scian_Code,Scian_Nom_Fr){
  
  objArray = new array2D(ID_Scian,Scian_Niveau,Scian_Hierar,Scian_Code,Scian_Nom_Fr);
      
  optionS[optionS.length]=objArray;

}
function array2D(col1,col2,col3,col4,col5){

this.col1=col1;
this.col2=col2;
this.col3=col3;
this.col4=col4;
this.col5=col5;

}

function genScian(niveau,code){


delDiv();
div = document.getElementById('N1').innerHTML.split('<P');
//alert(div);
html = "";
for(i=1;i<div.length;i++){

   html += "<P"+div[i];
   
   if (div[i].match(niveau+','+code) == niveau+','+code){
     
	 html += "<DIV>";

	 for(j=0;j<optionS.length;j++){
       //alert(Math.floor(optionS[j].col4/10)+"=="+code)
	   if (Math.floor(optionS[j].col4/10) == code){
			html += "<p style=\"margin-top:2px;margin-bottom:2px;margin-left:60px\"><input type=\"radio\" name=\"scian\" value=\""+optionS[j].col4+"\">"+optionS[j].col5+"</p>";    
		}
	
	 }
	 html += "</DIV>";
   
   }
}
//alert(html)
document.getElementById('N1').innerHTML = html;
//html += "<input type=\"radio\" style=\"margin-left:"+margin[niveau]+"px\" name=\"N"+optionS[i].col2+"\" value=\""+optionS[i].col4+"\"> "+optionS[i].col5+"<br>";    

}

function delDiv(){
	html = "";
	div = document.getElementById('N1').innerHTML.split('<DIV');
	div2 = document.getElementById('N1').innerHTML.split('</DIV>');
	html = div[0];
	if (div2.length>1)
       html += div2[1];

  document.getElementById('N1').innerHTML = html;
}
