<?
session_start();
if ($_SESSION['estado'] != "ON")
		{
		?>
		<script>
			parent.location.href = 'index.php';
		</script>
		<? 
		exit();
		}
include "../conex.php";                // ***************  29/11(09 ********************
$rut_cliente_buscar = $_GET["rutc"];


$cont=0;
$sql_bc = "SELECT * FROM nombres WHERE rut = '$rut_cliente_buscar'";
	$res_bc = mysql_query($sql_bc,$enlace);
	if(mysql_fetch_object($res_bc))
		{
		$bc_rsoc = mysql_result($res_bc, $cont, "razon_social");
		$cont=$cont+1;
        }
	
?>
	
<script language="javascript" type="text/javascript">
	
	
	if ('<? echo $cont;?>'!=0)
	  {
		window.opener.document.form1.txtrsoc.value = '<? echo $bc_rsoc;?>';
	  }
	
	else 
	   {
		window.opener.document.form1.txtrut.value ='';	
		alert("El Rut ingresado no corresponde a un cliente");
		}
	
		window.close();
		
	</script>
