<?
mysql_query("insert into pers(pers_nombre, pers_apellido, pers_pais_res) values ('$i017n', '$i017a', '$pais')", $link);

$pid = mysql_insert_id();

mysql_query("insert into pers_telefono(pers_codigo, pais, area, numero, tipo)
	values
($pid, '$i013p1', '$i013a1', '$i013t1', 'Telefono')", $link);

if($i013p2!=""){
	mysql_query("insert into pers_telefono(pers_codigo, pais, area, numero, tipo)
		values
	($pid, '$i013p2', '$i013a2', '$i013t2', 'Telefono')", $link);
}
if($i013p3!=""){
	mysql_query("insert into pers_telefono(pers_codigo, pais, area, numero, tipo)
		values
	($pid, '$i013p3', '$i013a3', '$i013t3', 'Telefono')", $link);
}
//=======================================================================================
if($faxpa!=""){
	mysql_query("insert into pers_telefono(pers_codigo, pais, area, numero, tipo)
		values
	($pid, '$faxpa', '$faxaa', '$faxta', 'Fax')", $link);
}
if($faxpb!=""){
	mysql_query("insert into pers_telefono(pers_codigo, pais, area, numero, tipo)
		values
	($pid, '$faxpb', '$faxab', '$faxtb', 'Fax')", $link);
}
//=======================================================================================
mysql_query("insert into pers_correo(pers_codigo, correo)
	values
($pid, '$i020p')", $link);
if($i020a!=""){
	mysql_query("insert into pers_correo(pers_codigo, correo)
		values
	($pid, '$i020a')", $link);
}

echo "<script>";
echo "window.parent.getElement('iframeoculto').style.width='0px';";
echo "window.parent.getElement('iframeoculto').style.height='0px';";
echo "var sel = window.parent.getElement ( 'persona' );";
echo "sel[sel.length] = new Option('$i017n $i017a', '$pid');";
echo "sel.selectedIndex = sel.length-1;";
echo "</script>";

?>
