
function is_there_text_in(tabb){
	
}



function reformat_survey(){
	divs=document.getElementsByTagName("survey");
	for(i=0;i<divs.length;i++){
		tables=divs[i].parentNode.getElementsByTagName("table");
		alert(tables.length);
	}
	
	
}


	var tab_type = new Array();
	var tab_img = new Array();
	var tab_title =new Array();
	tab_ind=0;

	
function load_publication(num,obj){
document.getElementById("anpublication_image").innerHTML=tab_img[num];
document.getElementById("anpublication_link").innerHTML=tab_title[num];
// reinit square 
tabble=obj.parentNode.parentNode;
mtds=tabble.getElementsByTagName("td");
for(i=0;i<mtds.length;i++){
	mtds[i].className="";
}

obj.className="active_publication_square";
}
	
function build_publication_square(){
// principal : publication_square
// hidden : anact-HP-publications-hidden
// 	 class="btype_doc"
// 	 class="lien_titre_doc"
// 	 class="image_doc"
buff="";
dbg="";
	mesdivs=document.getElementsByTagName("var");
	for(i=0;i<mesdivs.length;i++){
			mesinnerdivs=mesdivs[i].parentNode.getElementsByTagName("div");

				
	

			for(j=0;j<mesinnerdivs.length;j++){
				buff=mesinnerdivs[j].innerHTML;
				if(mesinnerdivs[j].className=="btype_doc"){
					tab_type[tab_ind] =buff;
				}
				else if (mesinnerdivs[j].className=="image_doc"){
					tab_img[tab_ind] = buff;
				}
				else if(mesinnerdivs[j].className=="lien_titre_doc"){
					tab_title [tab_ind] = buff;
				}
			}
			tab_ind++;
	}

	ttable=document.createElement("table");
	ttable.cellspacing=0;
	ttable.cellpadding=0;
	ttable.className="publication_square_table"
	ttr=document.createElement("tr");
	
	// gen tableau
	for(k=0;k<tab_ind;k++){
		if(Math.round(tab_ind/2)==k){
			ttable.appendChild(ttr);
			ttr="";
			ttr=document.createElement("tr");

		}
		ttd=document.createElement("td");
		ttd.onmouseover="javascript:load_publication('"+k+"')";
		ttd.setAttribute("onclick","javascript:load_publication('"+k+"',this)");
		if(k==0){
			ttd.className="active_publication_square";
		}
		ttd.innerHTML=tab_type[k];
		ttr.appendChild(ttd);
	}
	
	if(tab_ind%2==1){
		ttd=document.createElement("td");
		ttd.innerHTML="&nbsp;";
		ttr.appendChild(ttd);
	}
	
	ttable.appendChild(ttr);
	document.getElementById("anpublication_square").appendChild(ttable);

	// END gen tableau
	
	
	
}
