<?php
	
	include ("connection.php");
	include ("frames_header.php");
	
	if ( (!isset($_SESSION["login"]))or(!isset($_SESSION["pass"])) ) {
	    print "<strong>you need to <a href=\"login.php\">login</a> as an authorised curator to proceed.</strong>";
		include ("frames_footer.php"); 
		return;
	}
		
	echo '<script language="JavaScript"><!-- 
	
	function chg(){
		if(window.document.form1.type.value=="Artificial"){ 
		  	window.document.form1.species.disabled=true; 
		} else { 
			window.document.form1.species.disabled=false; 
		}	  	
	}	
	--></script>';	
		
	echo '<br/><br/><center><strong>Change Origin</strong><br/><br/>';
	echo '<form name="form1" method="POST" action="reg-region-origin-edit-result.php">';
	echo '<input type="hidden" name="id" value="'.$_GET["id"].'"/>';
		
	echo '<br/><strong>Origin: </strong><select name="type" size="1" onChange="chg();">
	 <option selected="selected">Natural</option><option>Artificial</option></select>
	 &nbsp;&nbsp;<strong>Species: </strong><select name="species" size="1">';

	$khoueiry = "SELECT DISTINCT \"NAME\" FROM \"SPECIES\";";
	$stmt = pg_query($c,$khoueiry);
		
	while($row=pg_fetch_array($stmt)){ 
	  echo '<option>'.$row["NAME"].'</option>';
	}
	echo '</select>';
	
	echo '<br/><br/><img src="pictures/button-cur-delete.gif" title="Cancel"  onClick="javascript:self.close();">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
	echo '<input name="submit" type="image" src="pictures/button-cur-validate.gif" onClick="submit" title="Ok"></form></center>';
	
	include ("frames_footer.php");
	
	?>