<?
include ("connection.php");
include ("frames_header.php");
?>
<script language="JavaScript">

//Ma fonction
	function giveMe(species,dev,ishid)
	{
	tab=new Array();
	count=0;
	for(a=0;a<document.form2.length;++a){
			if(document.form2[a].checked==true){
				obj=document.form2[a];
				tab[obj.name]=obj.value;
				++count;
			}
		}

	reg='';
	for (key in tab){
	if(tab[key]=="idanat") reg=reg+key+':';
	}
	
	regi='idanat='+reg;
	
	phplink='deletepartanatselected.php?'+regi;

	if(count==0){
			alert("Click on the anatomical part checkboxes to select which you want to remove.");
			return;
		}
	//alert(phplink);
		//window.document.open(phplink);
		//document.location.href=phplink+'&species='+species+'&dev='+dev+'&insituid='+ishid;
		window.open(phplink+'&species='+species+'&dev='+dev+'&insituid='+ishid);
		

	}
//Fin de ma fonction



	function searchIt(){
		tab=new Array();
		
		count=0;
		for(a=0;a<document.form2.length;++a){
			if(document.form2[a].checked==true){
				obj=document.form2[a];
				tab[obj.name]=obj.value;
				++count;
			}
		}
		
		targ=''; amp=''; reg=''; mut='';
		
		for (key in tab){
				if(tab[key]=="idanat")
					reg=reg+key+':';
					
				if(tab[key]=="amputation")
					amp=amp+key+':';
				
				else if(tab[key]=="target")
					targ=targ+':'+key;
				
				else if(tab[key]=="mutant")
					mut=mut+':'+key;
		}
		
		targ='&target='+targ.substring(1,targ.length);
		reg='&idanat='+reg;
		amp='&amputation='+amp;
		mut='&mutant='+mut.substring(1,mut.length);
		
		phplink='insitu-result.php?BOOLanat=1&BOOLmut=1&BOOLtarg=1&BOOLamp=1'+targ+reg+amp+mut;
		
		if(document.form.species.checked==true){
			phplink+="&species="+document.form.species.value;
			++count;
		}
		if(document.form.stage.checked==true){
			phplink+="&selectediddev="+document.form.stage.value+":";
			++count;
		}
		
		
		for (a=0;a<document.form3.length;a++) {
		 	if ( (document.form3[a].checked)&&(document.form3[a].value=='1') ) {
				phplink+="&xref=1";
		 	}
		 	else if ( (document.form3[a].checked)&&(document.form3[a].value=='2') ) {
				phplink+="&xref=2";
		 	}
			
		}
		
		if(count==0){
			alert("Click on the checkboxes to select the properties you want to search for.");
			return;
		}
		
		//window.document.open(phplink);
		document.location.href=phplink;
	}
	

//fonctions pour le zoom des images
	function ZoomIn() {
			for(a=0;a<document.images.length;++a){
				if(document.images[a].name=="thumb")
					document.images[a].width+=20;
			}
	}
	function ZoomOut() {
			for(a=0;a<document.images.length;++a){
				if(document.images[a].name=="thumb")
					document.images[a].width-=20;
			}
	}

//systeme pour afficher en grand le thumbnail selectionne
	function growPics(pic){
		document.images["BIGimage"].src = pic.src;
		document.images["BIGimage"].id = pic.name;
		document.images["BIGimage"].border = 1;
		
		//pour la curation
		document.images["BIGdel"].id = pic.name;
	}
	
	function growPics2(pic){
		document.images["BIGimage"].src = pic.src;
		document.images["BIGimage"].id = pic.name;
		document.images["BIGimage"].border = 1;
		document.images["BIGimage"].width = 370;

		//pour la curation aussi
		document.images["BIGdel"].id = pic.name;
	}
	
	function getOriginal(lien){
		if(lien.id.length>0)
			//window.open("insitu-original-picture.php?id="+lien.id);
			self.location.href = "insitu-original-picture.php?id="+lien.id;
	}

</script>

<?
$id=$_GET["id"];

print "<h2>Mixed stages</h2><br>";
print '<table border="0" width="100%" cellspacing="0">
<tr bgcolor="#000000">
            <td bgcolor="#000033"><strong>Picture description</strong></td>
		  </tr><tr>
<td valign="top"> 
';

$requete="SELECT \"PICTURE_ID\", \"CONTROL\", \"PATH\" FROM \"PICTURE\" WHERE \"IN_SITU_ID\" = $id";
$stmt = pg_query($c,$requete);	
while($row=pg_fetch_array($stmt)){
								$idpicture=$row["PICTURE_ID"];
								print '<table border="0" cellspacing="0" cellpadding="0">';
								//echo "<tr><td><img src=\"picture.php?id=$idpicture\" border=\"1\" width=\"180\" name=\"$idpicture\" onClick=\"self.growPics(this);\"></td></tr> ";
								if(strlen($row["PATH"])>0)
								{
								  echo "<tr><td><img src=\"picturesDB/".$row["PATH"]."\" border=\"1\" width=\"180\" name=\"$idpicture\" onClick=\"self.growPics2(this);\"></td></tr> ";
									
								}
								else
								    echo "<tr><td><img src=\"picture.php?id=$idpicture\" border=\"1\" width=\"180\" name=\"$idpicture\" onClick=\"self.growPics(this);\"></td></tr> ";


}
print '</table>';


?>
			</td>
						<td width="400" align="center">
							<img border="0" name="BIGimage" src="pictures/clic a picture.gif" onClick="self.getOriginal(this);" id="">
						    <!-- curation -->
							<br><img name="BIGdel" id="" src="pictures/button-cur-delete.gif" border="0" onClick="window.open('curator-pic-delete.php?id='+this.id)">
						</td>
					</tr>
				</table>



<?
include ("frames_footer.php");
?>