function valida_buscador(obj)
{
	ok=false;	
	if(obj.busqueda!=null&&obj.busqueda.value=="")
	{
		alert("Debe escribir una frase o palabra a buscar!!!"); 
		obj.busqueda.focus();
	}
	else if(obj.busqueda!=null&&obj.busqueda.value==" ")
	{
		alert("Debe escribir una frase o palabra a buscar!!!"); 
		obj.busqueda.focus();
	}
	else
	{
		ok = true;
	}
	return ok;
}

function abrir(URL)
{
var win=null;
win=window.open(URL,"IMPRIMIENDO");
win.focus();
}
function abrir_janela_popup2(theURL,winName,features) { 
  		window.open(theURL,winName,features);
}
function redirect(url)
{
location.href=url;
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function esInteger(e) {
var charCode
if (navigator.appName == "Netscape") // Veo si es Netscape o Explorer (mas adelante lo explicamos)
charCode = e.which // leo la tecla que ingreso
else
charCode = e.keyCode // leo la tecla que ingreso
status = charCode 
if (charCode > 31 && (charCode < 48 || charCode > 57)) { // Chequeamos que sea un numero comparandolo con los valores ASCII
alert("Esto no es un Numero !!")
return false
}
return true
}
function viewHide(id) 
{
var targetId, srcElement, targetElement;
var targetElement;

targetElement = document.getElementById('tabla1');
targetElement.style.display = "none";
targetElement = document.getElementById('tabla2');
targetElement.style.display = "none";

targetElement = document.getElementById(id);
if (targetElement.style.display == "none") {
targetElement.style.display = "";
} else {
targetElement.style.display = "none";
} 

}
function viewHide2(id) 
{
var targetId, srcElement, targetElement;
var targetElement;

targetElement = document.getElementById('tabla3');
targetElement.style.display = "none";
targetElement = document.getElementById('tabla4');
targetElement.style.display = "none";

targetElement = document.getElementById(id);
if (targetElement.style.display == "none") {
targetElement.style.display = "";
} else {
targetElement.style.display = "none";
} 

}
function viewHide3(id) 
{
var targetId, srcElement, targetElement;
var targetElement;

targetElement = document.getElementById('tabla5');
targetElement.style.display = "none";
targetElement = document.getElementById('tabla6');
targetElement.style.display = "none";

targetElement = document.getElementById(id);
if (targetElement.style.display == "none") {
targetElement.style.display = "";
} else {
targetElement.style.display = "none";
} 

}
function viewHide4(id) 
{
var targetId, srcElement, targetElement;
var targetElement;

targetElement = document.getElementById('tabla7');
targetElement.style.display = "none";
targetElement = document.getElementById('tabla8');
targetElement.style.display = "none";
targetElement = document.getElementById('tabla9');
targetElement.style.display = "none";
targetElement = document.getElementById('tabla10');
targetElement.style.display = "none";

targetElement = document.getElementById(id);
if (targetElement.style.display == "none") {
targetElement.style.display = "";
} else {
targetElement.style.display = "none";
} 

}
function viewHideList(id) 
{
var targetId, srcElement, targetElement;
var targetElement;

targetElement = document.getElementById('tabla3');
targetElement.style.display = "none";
targetElement = document.getElementById('tabla5');
targetElement.style.display = "none";
targetElement = document.getElementById('tabla13');
targetElement.style.display = "none";

targetElement = document.getElementById(id);
if (targetElement.style.display == "none") {
targetElement.style.display = "";
} else {
targetElement.style.display = "none";
} 
if(id=='tabla5' || id=='tabla13'){
targetElement = document.getElementById('tabla33');
targetElement.style.display = "";
	} else {
		targetElement = document.getElementById('tabla33');
	targetElement.style.display = "none";	
	}
}
function viewHide5(id) 
{
var targetId, srcElement, targetElement;
var targetElement;

targetElement = document.getElementById('tabla11');
targetElement.style.display = "none";
targetElement = document.getElementById('tabla12');
targetElement.style.display = "none";

targetElement = document.getElementById(id);
if (targetElement.style.display == "none") {
targetElement.style.display = "";
} else {
targetElement.style.display = "none";
} 

}
function viewHide6(id) 
{
var targetId, srcElement, targetElement;
var targetElement;

targetElement = document.getElementById('tabla13');
targetElement.style.display = "none";
targetElement = document.getElementById('tabla14');
targetElement.style.display = "none";

targetElement = document.getElementById(id);
if (targetElement.style.display == "none") {
targetElement.style.display = "";
} else {
targetElement.style.display = "none";
} 

}
function viewHideNit(id) 
{
var targetId, srcElement, targetElement;
var targetElement;

targetElement = document.getElementById('tabla15');
targetElement.style.display = "none";
targetElement = document.getElementById('tabla16');
targetElement.style.display = "none";

targetElement = document.getElementById(id);
if (targetElement.style.display == "none") {
targetElement.style.display = "";
} else {
targetElement.style.display = "none";
} 

}
function abrir_popup(theURL,winName,features) { 
  		window.open(theURL,winName,features);
}
function confirmSubmit(){
				var agree=confirm("Esta seguro de eliminar la fila de la factura  ");
				if (agree)
					return true ;
				else
					return false ;
}
function confirmAnular(){
				var agree=confirm("Esta seguro de anular la factura ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function confirmAnular_c(){
				var agree=confirm("Esta seguro de anular el comprobante? ");
				if (agree)
					return true ;
				else
					return false ;
}

function conf_ap_n(){
				var agree=confirm("Esta seguro de aprobar la novedad ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_nov(){
				var agree=confirm("Esta seguro de anular la novedad ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc(){
				var agree=confirm("Esta seguro de eliminar el cliente de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc1(){
				var agree=confirm("Esta seguro de eliminar el usuario de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_ag(){
				var agree=confirm("Esta seguro de eliminar la agencia de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}

function conf_loc_detalle(){
				var agree=confirm("Esta seguro de eliminar la fila de la lista ?");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_ciu(){
				var agree=confirm("Esta seguro de eliminar el atributo de la lista ?");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_matprod(){
				var agree=confirm("Esta seguro de eliminar el material de produccion de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_fin(){
				var agree=confirm("Esta seguro de eliminar el finalizado de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_res(){
				var agree=confirm("Esta seguro de eliminar la resolucion de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_tin(){
				var agree=confirm("Esta seguro de eliminar la tinta de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_tprov(){
				var agree=confirm("Esta seguro de eliminar el tipo de proveedor de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_prov(){
				var agree=confirm("Esta seguro de eliminar el proveedor de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_prod(){
				var agree=confirm("Esta seguro de eliminar el producto de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_mat(){
				var agree=confirm("Esta seguro de eliminar el material de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_maq(){
				var agree=confirm("Esta seguro de eliminar la maquina de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_loca(){
				var agree=confirm("Esta seguro de eliminar la locacion de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_ilu(){
				var agree=confirm("Esta seguro de eliminar el tipo de iluminacion de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_fopa(){
				var agree=confirm("Esta seguro de eliminar la forma de pago de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_ele(){
				var agree=confirm("Esta seguro de eliminar el elemento de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_usua(){
				var agree=confirm("Esta seguro de eliminar el usuario de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_tele(){
				var agree=confirm("Esta seguro de eliminar el tipo de elemento de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc_afo(){
				var agree=confirm("Esta seguro de eliminar el espacio de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc3(){
				var agree=confirm("Esta seguro de eliminar el perfil de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function conf_loc3_t(vn){
	var year=mydate.getYear()
	document.write(""+year+"")
				var agree=confirm("Esta seguro de eliminar el perfil de la lista ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function v_novedad(obj){
	ok  = false;
	if(obj.cliente != null && obj.cliente.value == ""){
		alert("No ha seleccionado un cliente de la lista");
		obj.cliente.focus();
	}else if(obj.facturar_a != null && obj.facturar_a.value == ""){
		alert("No seleccionado de la lista a quien se facturara ");
		obj.facturar_a.focus();
	}else if(obj.agencia_n != null && obj.agencia_n.value == ""){
		alert("No ha seleccionado de la lista la agencia");
		obj.agencia_n.focus();
	}else if(obj.ord_medios != null && obj.ord_medios.value == ""){
		alert("No ha ingresado el N� de orden de medios");
		obj.ord_medios.focus();
	}else if(obj.ord_agencia != null && obj.ord_agencia.value == ""){
		alert("No ha ingresado el N� de orden de agencia");
		obj.ord_agencia.focus();
	}else if(obj.descto != null && obj.descto.value == ""){
		alert("No ha ingresado un descuento");
		obj.descto.focus();
	}else if(obj.forma_pago != null && obj.forma_pago.value == ""){
		alert("No ha seleccionado una forma de pago");
		obj.forma_pago.focus();
	}else if(obj.documentos != null && obj.documentos.value == ""){
		alert("No ha ingresado documentos");
		obj.documentos.focus();
	}else if(obj.contacto != null && obj.contacto.value == ""){
		alert("No ha ingresado el nombre del contacto que confirma la negociacion");
		obj.contacto.focus();
	}else{
		ok = true;
	}
	return ok;
}
function validar_add_space(obj){
ok  = false;
	if(obj.elemento != null && obj.elemento.value == ""){
		alert("Por favor seleccione un elemento de la lista");
	}else if(obj.descripcion != null && obj.descripcion.value == ""){
		alert("Por favor ingrese una descripcion o detalle");
	}else if(obj.precio != null && obj.precio.value == "" && obj.total != null && obj.total.value == "" ){
		alert("Por favor ingrese un valor en el total o en el valor unitario para poder realizar la operacion que desea");
	}else if(obj.precio != null && obj.precio.value == "" && obj.total != null && obj.total.value == "" ){
		alert("Por favor ingrese un valor en el total o en el valor unitario para poder realizar la operacion que desea");
	}else if(obj.precio != null && obj.precio.value == "" && obj.total != null && obj.total.value == "" ){
		alert("Por favor ingrese un valor en el total o en el valor unitario para poder realizar la operacion que desea");
	}else if(obj.precio != null && obj.precio.value == "" && obj.total != null && obj.total.value == "" ){
		alert("Por favor ingrese un valor en el total o en el valor unitario para poder realizar la operacion que desea");
	}else if(obj.precio != null && obj.precio.value == "" && obj.total != null && obj.total.value == "" ){
		alert("Por favor ingrese un valor en el total o en el valor unitario para poder realizar la operacion que desea");
	}else{
		ok = true;
	}
	return ok;
}
function validarCliente(obj){
	ok  = false;
	if(obj.cliente_id != null && obj.cliente_id.value == ""){
		alert("Para realizar una factura primero debe seleccionar un cliente de la lista");
		obj.cliente_id.focus();
	}else{
		ok = true;
	}
	return ok;
}
function validarDetalle(obj){
	ok  = false;
	if(obj.cantidad != null && obj.cantidad.value == ""){
		alert("Por favor ingrese una cantidad");
	}else if(obj.descripcion != null && obj.descripcion.value == ""){
		alert("Por favor ingrese una descripcion o detalle");
	}else if(obj.vr_unitario != null && obj.vr_unitario.value == "" && obj.vr_total != null && obj.vr_total.value == "" ){
		alert("Por favor ingrese un valor total o un valor unitario para poder realizar la operacion que desea");
	}else{
		ok = true;
	}
	return ok;
}

function v_movimiento(obj){
	ok  = false;
	if(obj.producto_id != null && obj.producto_id.value == ""){
		alert("Por favor seleccione un producto de la lista");
		obj.producto_id.focus();
	}else if(obj.cantidad != null && obj.cantidad.value == ""){
		alert("Por favor ingrese la cantidad del movimiento");
		obj.cantidad.focus();
	}else if(obj.responsable != null && obj.responsable.value == ""){
		alert("Por favor ingrese el nombre de la persona responsable del movimiento");
		obj.responsable.focus();
	}else{
		ok = true;
	}
	return ok;
}
function confirmPrint(){
				var agree=confirm("Esta seguro de generar la factura, recuerde que si acepta no podra hacer modificaciones posteriores a esta factura ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function confirmPrint_I(){
				var agree=confirm("Esta seguro de generar el Comprobante de Ingreso, recuerde que si acepta no podra hacer modificaciones posteriores a este Comprobante ? ");
				if (agree)
					return true ;
				else
					return false ;
}
function EnterSubmit() { 
if (13 == window.event.keyCode) 
document.encabezado.submit()
}
function checkEnterKey() { 
if (13 == window.event.keyCode) 
document.add.descripcion.value += "<br>"; 
}
function checkEnterKey2() { 
if (13 == window.event.keyCode) 
document.act.descripcion.value += "<br>"; 
}
function enviar(obj){
obj.submit()
}
function enviar_h_r(){
document.ruta_search.submit()
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function v_usuarios(obj){
	ok  = false;
	if(obj.nombre != null && obj.nombre.value == ""){
		alert("No ha ingresado el nombre del usuario");
		obj.nombre.focus();
	}else if(obj.apellidos != null && obj.apellidos.value == ""){
		alert("No ha ingresado apellidos");
		obj.apellidos.focus();
	}else if(obj.perfil != null && obj.perfil.value == ""){
		alert("No ha seleccionado un perfil para el usuario");
		obj.perfil.focus();
	}else if(obj.ciudad != null && obj.ciudad.value == ""){
		alert("No ha seleccionado una ciudad de la lista ");
		obj.ciudad.focus();
	}else if(obj.login != null && obj.login.value == ""){
		alert("No ha ingresado un nombre de usuario valido ");
		obj.login.focus();
	}else if(obj.password != null && obj.password.value == ""){
		alert("No ha ingresado un password valido ");
		obj.password.focus();
	}else if(obj.password.value != obj.c_password.value){
		alert("El password digitado y la confirmacion no son iguales");
		obj.c_password.focus();
	}else if(obj.telefono != null && obj.telefono.value == ""){
		alert("No ha ingresado un numero telefonico ");
		obj.telefono.focus();
	}else if(obj.direccion != null && obj.direccion.value == ""){
		alert("No ha ingresado una direccion ");
		obj.direccion.focus();
	}else if(obj.email != null && obj.email.value == ""){
		alert("No ha ingresado un e-mail");
		obj.email.focus();
	}else if(obj.email.value != ""){
		var ind1, ind2, ind3;
		ind1 = obj.email.value.indexOf('@');
		ind2 = obj.email.value.indexOf('.');
		ind3 = obj.email.value.lastIndexOf('@');
		if ((ind1<=0) || (ind2<=0) || (ind3 != ind1))	{
			alert("El correo electr�nico ingresado no es v�lido");
			obj.email.focus();
		}else{
			ok = true;
		}
	}else{
		ok = true;
	}
	return ok;
}

function v_aforo(obj){
	ok  = false;
	if(obj.elemento != null && obj.elemento.value == ""){
		alert("No ha seleccionado ningun elemento de la lista");
		obj.elemento.focus();
	}else if(obj.nit != null && obj.nit.value == ""){
		alert("No ha ingresado nit");
		obj.nit.focus();
	}else if(obj.direccion != null && obj.direccion.value == ""){
		alert("No ha ingresado  una direcci�n");
		obj.direccion.focus();
	}else if(obj.telefono != null && obj.telefono.value == ""){
		alert("No ha ingresado telefono ");
		obj.telefono.focus();
	}else if(obj.tipo_cliente != null && obj.tipo_cliente.value == ""){
		alert("No ha seleccionado un tipo de cliente ");
		obj.tipo_cliente.focus();
	}else if(obj.email != null && obj.email.value == ""){
		alert("No ha ingresado un e-mail");
		obj.email.focus();
	}else if(obj.email.value != ""){
		var ind1, ind2, ind3;
		ind1 = obj.email.value.indexOf('@');
		ind2 = obj.email.value.indexOf('.');
		ind3 = obj.email.value.lastIndexOf('@');
		if ((ind1<=0) || (ind2<=0) || (ind3 != ind1))	{
			alert("El correo electr�nico ingresado no es v�lido");
			obj.email.focus();
		}else{
			ok = true;
		}
	}else{
		ok = true;
	}
	return ok;
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function v_elementos(obj){
	ok  = false;
	if(obj.t_elemento != null && obj.t_elemento.value == ""){
		alert("Por favor seleccione un elemento de la lista");
		obj.t_elemento.focus();
	}else if(obj.area_i_b != null && obj.area_i_b.value == ""){
		alert("Por favor ingrese la base del �rea de impresi�n");
		obj.area_i_b.focus();
	}else if(obj.area_i_h != null && obj.area_i_h.value == ""){
		alert("Por favor ingrese la altura del �rea de impresi�n");
		obj.area_i_h.focus();
	}else if(obj.area_v_b != null && obj.area_v_b.value == ""){
		alert("Por favor ingrese la base del �rea visual");
		obj.area_v_b.focus();
	}else if(obj.area_v_h != null && obj.area_v_h.value == ""){
		alert("Por favor ingrese la altura del �rea visual");
		obj.area_v_h.focus();
	}else if(obj.finalizado != null && obj.finalizado.value == ""){
		alert("Por favor seleccione el finalizado de la lista");
		obj.finalizado.focus();
	}else if(obj.iluminacion != null && obj.iluminacion.value == ""){
		alert("Por favor seleccione el tipo de iluminacion de la lista");
		obj.iluminacion.focus();
	}else if(obj.material != null && obj.material.value == ""){
		alert("Por favor seleccione el material de la lista");
		obj.material.focus();
	}else if(obj.resolucion != null && obj.resolucion.value == ""){
		alert("Por favor seleccione la resolucion de la lista");
		obj.resolucion.focus();
	}else if(obj.tinta != null && obj.tinta.value == ""){
		alert("Por favor seleccione la tinta de la lista");
		obj.tinta.focus();
	}else if(obj.tarifa_prod != null && obj.tarifa_prod.value == ""){
		alert("Por favor ingrese la tarifa de produccion");
		obj.tarifa_prod.focus();
	}else{
		ok = true;
	}
	return ok;
}

function v_s_prod(obj){
	ok  = false;
	if(obj.elemento != null && obj.elemento.value == ""){
		alert("Por favor seleccione un elemento de la lista");
		obj.elemento.focus();
	}else if(obj.cantidad != null && obj.cantidad.value == ""){
		alert("Por favor ingrese una cantidad");
		obj.cantidad.focus();
	}else if(obj.referencia!= null && obj.referencia.value == ""){
		alert("Por favor ingrese una referencia de arte");
		obj.referencia.focus();
	}else if(obj.element!= null && obj.element.value == ""){
		alert("Por favor seleccione un �rea de impresion de la lista");
		obj.element.focus();
	}else if(obj.datos_entrega!= null && obj.datos_entrega.value == ""){
		alert("Por favor ingrese los datos de entrega del producto");
		obj.datos_entrega.focus();
	}else if(obj.ciudad_id != null && obj.ciudad_id.value == ""){
		alert("Por favor seleccione una ciudad de entrega de la lista");
		obj.ciudad_id.focus();
	}else{
		ok = true;
	}
	return ok;
}
function v_s_pauta(obj){
	ok  = false;
	if(obj.codigo != null && obj.codigo.value == ""){
		alert("Por favor ingrese un c�digo de espacio");
		obj.codigo.focus();
	}else if(obj.referencia != null && obj.referencia.value == ""){
		alert("Por favor ingrese una referencia");
		obj.referencia.focus();
	}else if(obj.proveedor!= null && obj.proveedor.value == ""){
		alert("Por favor ingrese un proveedor del arte");
		obj.proveedor.focus();
	}else if(obj.vr!= null && obj.vr.value == ""){
		alert("Por favor ingrese un valor de pauta");
		obj.vr.focus();
	}else{
		ok = true;
	}
	return ok;
}
function v_locac(obj){
	ok  = false;
	if(obj.producto != null && obj.producto.value == ""){
		alert("Por favor seleccione el producto de la lista");
		obj.producto.focus();
	}else if(obj.ciudad != null && obj.ciudad.value == ""){
		alert("Por favor seleccione la ciudad de la lista");
		obj.ciudad.focus();
	}else if(obj.nombre_loc!= null && obj.nombre_loc.value == ""){
		alert("Por favor ingrese un nombre para la locacion");
		obj.nombre_loc.focus();
	}else{
		ok = true;
	}
	return ok;
}
function v_city(obj){
	ok  = false;
	if(obj.ciudad != null && obj.ciudad.value == ""){
		alert("Por favor ingrese un nombre");
		obj.ciudad.focus();
	}else{
		ok = true;
	}
	return ok;
}
function v_mat(obj){
	ok  = false;
	if(obj.nombre != null && obj.nombre.value == ""){
		alert("Por favor ingrese un nombre");
		obj.nombre.focus();
	}else{
		ok = true;
	}
	return ok;
}
function v_pago(obj){
	ok  = false;
	if(obj.pago != null && obj.pago.value == ""){
		alert("Por favor ingrese una forma de pago");
		obj.pago.focus();
	}else{
		ok = true;
	}
	return ok;
}
function agregarangos(form)
{
	ban=0
	if(form.desde.value=="" || isNaN(form.desde.value))
	{
		alert('los campos no pueden estar vacios y deben ser numeros')
		ban=1
		return false;
	}
	
	if(form.hasta.value=="" || isNaN(form.hasta.value))
	{
		alert('los campos no pueden estar vacios y deben ser numeros')
		return false;
		ban=1
	}
	
	if(parseInt(form.hasta.value)<=parseInt(form.desde.value))
	{
		//alert(form.hasta.value);
		alert('El rango final no puede ser menor o igual al inicial')
		return false;
		ban=1
	}
	
	if(ban==0)
	{
		if(confirm('Desea agregar otro rango de codigos postales'))
		{
			form.bandera.value=1;
			return true;
		}
	}
}
/*INICIO --- FUNCIONES PARA COLOREAR LAS FILAS DE LAS TABLAS AL DAR CLICK Y AL PASAR POR ENCIMA*/
function sobre(celda)
{
  
		if( celda.className!='marca')
		{
		  celda.className='sobre'
		}	  
}  
		  
function quita(celda)
{
		if(celda.className=='sobre')
		{
		  celda.className='quita'
		}
}
        
function marcar(celda)
{ 
		
		if(celda.className=='quita'||celda.className=='sobre')
		{
		  celda.className='marca'
		}
		else
		if(celda.className=='marca')
		{
		  celda.className='quita'
		}
 }
 
/*FIN --*/

function validacheck(form)
{
   j=0;
   k=0;
   for(i=0;i<form.elements.length;i++) 
   {
	  if(form.elements[i].type=="text")
	  {
		  if(form.elements[i].value=="")
		  {
			  j++;
		  }
	  }
	  else
	  if(form.elements[i].type=="file")
	  {
		  if(form.elements[i].value=="")
		  {
			  j++;
		  }
	  }
	  else
	  if(form.elements[i].type!="text" && form.elements[i].type!="file")
	  {
		  
		 if(form.elements[i].type!="submit")
	      {
		      if(form.elements[i].options[form.elements[i].selectedIndex].value==0)
		      {
			      k++; 
		      }
		  }
	  }
	  
    }
   
   if(j!=0)
   {
	  alert("Los campos no pueden estar vacios");  
	  return false;
   }
   else
    if(k!=0)
   {
	  alert("No ha seleccionado el item");  
	  return false;
   }
   else{
	  return true; 
     
   }
}

function validacheckt(form)
{
   j=k=0;
  
   for(i=0;i<form.elements.length;i++) 
   {
		  if(form.elements[i].type=="text")
		  {
			  if(form.elements[i].value=="")
			  {
				  j++;
			  }
		  }
		  else
		  if(form.elements[i].type!="text" && form.elements[i].type!="submit" && form.elements[i].type!="file"
			 && form.elements[i].type!="hidden")
		  {
			 if(form.elements[i].options[form.elements[i].selectedIndex].value==0)
			 {
				   k++; 
			 }
		  }
	  
    }
   
   if(j!=0)
   {
	  alert("Los campos no pueden estar vacios");  
	  return false;
   }
   else
   if(k!=0)
   {
	  alert("No ha seleccionado el item");  
	  return false;
   }
   else
   {
	  return true; 
   }
}

function selecheck(form)
{
   j=0 
   for(i=0;i<form.elements.length;i++) 
   {
	  if(form.elements[i].type=="checkbox")
	  {
		  if(form.elements[i].checked==true)
		  {
			  j++;
		  }
	  }
   }
   
   if(j==0)
   {
	  alert("No ha chequeado ningun registro");  
	  return false;
   }
   else
   {
	  if(confirm('Eliminar registros?'))
	  {
	     return true; 
	  }
	  else
	  {
		 return false;   
	  }
   }
}
function valirangos(form)
{
	ban=0
	if(form.desde.value=="" || isNaN(form.desde.value))
	{
		alert('los campos no pueden estar vacios y deben ser numeros')
		ban=1
		return false;
	}
	
	if(form.hasta.value=="" || isNaN(form.hasta.value))
	{
		alert('los campos no pueden estar vacios y deben ser numeros')
		return false;
		ban=1
	}
	
	if(parseInt(form.hasta.value)<=parseInt(form.desde.value))
	{
		alert('El rango final no puede ser menor o igual al inicial')
		return false;
		ban=1
	}
	
	if(ban==0)
	{
		if(confirm('Desea eliminar los codigos'))
		{
		   return true;
		}
		else
		{
		   return false;	
		}
	}
}


function valida_registro(obj)
{
	ok  = false;
	var re=/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	if(obj.nombre != null && obj.nombre.value == ""){
		alert("No ha ingresado el nombre del usuario");
		obj.nombre.focus();
	}else if(obj.apellidos != null && obj.apellidos.value == ""){
		alert("No ha ingresado apellidos");
		obj.apellidos.focus();
	}else if(obj.direccion != null && obj.direccion.value == ""){
		alert("No ha ingresado una direccion ");
		obj.direccion.focus();
	}else if(obj.telefono != null && obj.telefono.value == ""){
		alert("No ha ingresado un numero telefonico ");
		obj.telefono.focus();
	}else if(obj.email != null && obj.email.value == ""){
		alert("No ha ingresado un e-mail");
		obj.email.focus();
	}else if(!re.test(obj.email.value)){
		alert("Correo electrónico inválido!!!");
		obj.email.focus();
	}else if((obj.dia != null && obj.dia.value == "")||(obj.mes != null && obj.mes.value == "")||(obj.ano != null && obj.ano.value == "")){
		alert("No ha ingresado una fecha válida");
	}else if(obj.pais != null && obj.pais.value == ""){
		alert("No ha ingresado un país");
		obj.pais.focus();
	}else if(obj.departamento != null && obj.departamento.value == ""){
		alert("No ha ingresado un estado");
		obj.departamento.focus();
	}else if(obj.postal != null && obj.postal.value == ""){
		alert("No ha ingresado un numero código postal");
		obj.postal.focus();
	}
	else{
		ok = true;}
	return ok;
}

function valida_contacxx(obj)
{
	ok  = false;
	var re=/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	if(obj.nombre != null && obj.nombre.value == ""){
		alert("No ha ingresado el nombre del usuario");
		obj.nombre.focus();
	}else if(obj.apellidos != null && obj.apellidos.value == ""){
		alert("No ha ingresado apellidos");
		obj.apellidos.focus();
	}else if(obj.direccion != null && obj.direccion.value == ""){
		alert("No ha ingresado una direccion ");
		obj.direccion.focus();
	}else if(obj.telefono != null && obj.telefono.value == ""){
		alert("No ha ingresado un numero telefonico ");
		obj.telefono.focus();
	}else if(obj.email != null && obj.email.value == ""){
		alert("No ha ingresado un e-mail");
		obj.email.focus();
	}else if(!re.test(obj.email.value)){
		alert("Correo electrónico inválido!!!");
		obj.email.focus();
	}else if(obj.comentarios != null && obj.comentarios.value == ""){
		alert("No ha ingresado su comentario");
		obj.comentarios.focus();
	}else{
		ok = true;}
	return ok;
}

function selecodi(form)
{
	 if(form.codigos.options[form.codigos.selectedIndex].value==0)
	 {
		alert('Seleccione un codigo postal valido')	
		return false
	 }
	 else
	 {
		return true 
	 }
}


function validavacios(form)
{
	if(form.sucursal.value=="" || isNaN(form.sucursal.value))
	{
		alert('los campos no pueden estar vacios y deben ser numeros')
		return false;
	}
	else
	{
	    return true;
	}
}

function validavaciosa(form)
{
   if(form.codigo.disabled==false)
   {
		if(form.codigo.value=="" || isNaN(form.codigo.value))
		{
			alert('los campos no pueden estar vacios y deben ser numeros')
			return false;
		}
		else
		{
			return true;
		}
   }
}


function bloquea(form)
{
	form.delegacion.disabled=true;
	form.estado.disabled=true;
}

function desbloquea(form)
{
	form.delegacion.disabled=false;
	form.estado.disabled=false;
	
}

function bloqueacamb(form)
{
	if(form.delegacion.options[form.delegacion.selectedIndex].value!=0)
	{
		form.codigo.disabled=true;
	    form.estado.disabled=true; 
		form.codigo.value="";
	}
	else
	{
		form.codigo.disabled=false;
	    form.estado.disabled=false;  
	}
}

function bloqueacamb1(form)
{
	if(form.estado.options[form.estado.selectedIndex].value!=0)
	{
		form.codigo.disabled=true;
	    form.delegacion.disabled=true;
		form.codigo.value="";
	}
	else
	{
		form.codigo.disabled=false;
	    form.delegacion.disabled=false;  
	}
}

function valida_bolsa1(obj)
{
	ok  = false;
	var re=/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	if(obj.nombre != null && obj.nombre.value == ""){
		alert("No ha ingresado el nombre.");
		obj.nombre.focus();
	}else if(obj.apellido1 != null && obj.apellido1.value == ""){
		alert("No ha ingresado el primer apellido.");
		obj.apellido1.focus();
	}else if(document.getElementById('mas').checked == false && document.getElementById('fem').checked == false){
		alert("No ha seleccionado el sexo.");
		document.getElementById('mas').focus();
	}else if(obj.anno.options[obj.anno.selectedIndex].value == 0 || obj.mess.options[obj.mess.selectedIndex].value == 0){
		alert("No ha seleccionado la fecha de nacimiento.");
		obj.anno.focus();
	}else if(obj.select3.options[obj.select3.selectedIndex].value == 0){
		alert("No ha seleccionado el lugar de nacimiento.");
		obj.select1.focus();
	}else if(obj.estadocivil.options[obj.estadocivil.selectedIndex].value == 0){
		alert("No ha seleccionado el estado civil.");
		obj.estadocivil.focus();
	}else if(obj.calle != null && obj.calle.value == ""){
		alert("No ha ingresado la calle.");
		obj.calle.focus();
	}else if(obj.numero != null && obj.numero.value == ""){
		alert("No ha ingresado el numero.");
		obj.numero.focus();
	}else if(obj.selectp1.options[obj.selectp1.selectedIndex].value == 0){
		alert("No ha seleccionado el pais.");
		obj.selectp1.focus();
	}else if(obj.selectp2.options[obj.selectp2.selectedIndex].value == 0){
		alert("No ha seleccionado el estado.");
		obj.selectp2.focus();
	}else if(obj.selectp3.options[obj.selectp3.selectedIndex].value == 0){
		alert("No ha seleccionado la ciudad.");
		obj.selectp3.focus();
	}else if(obj.telefono != null && obj.telefono.value == ""){
		alert("No ha ingresado el telefono");
		obj.telefono.focus();
	}else if(obj.email != null && obj.email.value == ""){
		alert("No ha ingresado el e-mail");
		obj.email.focus();
	}else if(!re.test(obj.email.value)){
		alert("Correo electronico invalido!!!");
		obj.email.focus();
	}
	else{
		ok = true;}
	return ok;
}

function valida_bolsa2(obj)
{
	ok  = false;
	//var re=/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	
	var fechain = obj.anno.options[obj.anno.selectedIndex].value+"-"+obj.mess.options[obj.mess.selectedIndex].value+"-"+obj.dias.options[obj.dias.selectedIndex].value;
	var fechafi = obj.annom.options[obj.annom.selectedIndex].value+"-"+obj.messm.options[obj.messm.selectedIndex].value+"-"+obj.diasm.options[obj.diasm.selectedIndex].value;
	
	var mydate=new Date();
	var mesh = mydate.getMonth()+1;
	if(mesh < 10){
		mesh = "0"+mesh;
	}
	var diah = mydate.getDate();
	if(diah < 10){
		diah = "0"+diah;
	}
	var hoy = mydate.getFullYear()+"-"+mesh+"-"+diah;
	
	//alert(fechain+" "+hoy);
	
	if(obj.select1.options[obj.select1.selectedIndex].value == 0){
		alert("No ha seleccionado el pais.");
		obj.select1.focus();
	}else if(document.getElementById('es').checked == false && document.getElementById('en').checked == false){
		alert("No ha seleccionado si estudia actualmente.");
		document.getElementById('es').focus();
	/*}else if(obj.anno.options[obj.anno.selectedIndex].value == 0 || obj.mess.options[obj.mess.selectedIndex].value == 0){
		alert("No ha seleccionado la fecha de inicio.");
		obj.anno.focus();*/
	}else if(document.getElementById('es').checked == true){
		if(obj.ultimo != null && obj.ultimo.value == ""){
			alert("No ha ingresado el ultimo grado de estudios.");
			obj.ultimo.focus();
		}else if(obj.institucion != null && obj.institucion.value == ""){
			alert("No ha ingresado la institucion.");
			obj.institucion.focus();
		}else if(obj.institulo != null && obj.institulo.value == ""){
			alert("No ha ingresado institucion titulo.");
			obj.institulo.focus();
		}else if(obj.area != null && obj.area.value == ""){
			alert("No ha ingresado area de estudio.");
			obj.area.focus();
		}else if(obj.titulo != null && obj.titulo.value == ""){
			alert("No ha ingresado el titulo obtenido.");
			obj.titulo.focus();
		}else if(obj.horario != null && obj.horario.value == ""){
			alert("No ha ingresado el horario de estudios actuales.");
			obj.horario.focus();
		}else if(fechain > hoy){
			alert("La fecha de inicio debe ser menor a la fecha actual.");
			obj.anno.focus();
		}else if(fechafi > hoy){
			alert("La fecha fin debe ser menor a la fecha actual.");
			obj.anno.focus();
		}else if(fechain >= fechafi){
			alert("La fecha de inicio debe ser menor a la fecha fin.");
			obj.anno.focus();	
		}else if(document.getElementById('ms').checked == true){
			if(obj.paqueteria != null && obj.paqueteria.value == ""){
				alert("No ha ingresado paqueteria.");
				obj.paqueteria.focus();
			}
			else{
				ok = true;
			}
		}
		else{
			ok = true;
		}
	}
	/*}else if(obj.annom.options[obj.annom.selectedIndex].value == 0 || obj.messm.options[obj.messm.selectedIndex].value == 0){
		alert("No ha seleccionado fecha fin.");
		obj.annom.focus();*/
	else if(fechain > hoy){
		alert("La fecha de inicio debe ser menor a la fecha actual.");
		obj.anno.focus();
	}else if(fechafi > hoy){
		alert("La fecha fin debe ser menor a la fecha actual.");
		obj.anno.focus();
	}else if(fechain >= fechafi){
		alert("La fecha de inicio debe ser menor a la fecha fin.");
		obj.anno.focus();
	}else if(document.getElementById('ms').checked == true){
			if(obj.paqueteria != null && obj.paqueteria.value == ""){
				alert("No ha ingresado paqueteria.");
				obj.paqueteria.focus();
			}
			else{
				ok = true;
			}
	}else{
			ok = true;
	}
	return ok;
}

function valida_bolsa3(obj)
{
	ok  = false;
	//var re=/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	
	var fechain = obj.anno.options[obj.anno.selectedIndex].value+"-"+obj.mess.options[obj.mess.selectedIndex].value+"-"+obj.dias.options[obj.dias.selectedIndex].value;
	var fechafi = obj.annom.options[obj.annom.selectedIndex].value+"-"+obj.messm.options[obj.messm.selectedIndex].value+"-"+obj.diasm.options[obj.diasm.selectedIndex].value;
	var fechain1 = obj.anno1.options[obj.anno1.selectedIndex].value+"-"+obj.mess1.options[obj.mess1.selectedIndex].value+"-"+obj.dias1.options[obj.dias1.selectedIndex].value;
	var fechafi1 = obj.annom1.options[obj.annom1.selectedIndex].value+"-"+obj.messm1.options[obj.messm1.selectedIndex].value+"-"+obj.diasm1.options[obj.diasm1.selectedIndex].value;
	
	var mydate=new Date();
	var mesh = mydate.getMonth()+1;
	if(mesh < 10){
		mesh = "0"+mesh;
	}
	var diah = mydate.getDate();
	if(diah < 10){
		diah = "0"+diah;
	}
	var hoy = mydate.getFullYear()+"-"+mesh+"-"+diah;
	
	if(fechain != '0-0-0' && fechafi != '0-0-0'){
		//alert(fechain+" "+hoy);
		if(fechain > hoy){
			alert("La fecha de inicio trabajo debe ser menor a la fecha actual.");
			obj.anno.focus();
		}else if(fechafi > hoy){
			alert("La fecha fin trabajo debe ser menor a la fecha actual.");
			obj.anno.focus();
		}else if(fechain >= fechafi){
			alert("La fecha de inicio trabajo debe ser menor a la fecha fin.");
			obj.anno.focus();
		}
		else{
			if(fechain1 != '0-0-0' && fechafi1 != '0-0-0'){
				if(fechain1 > hoy){
					alert("La fecha de inicio trabajo debe ser menor a la fecha actual.");
					obj.anno1.focus();
				}else if(fechafi1 > hoy){
					alert("La fecha fin trabajo debe ser menor a la fecha actual.");
					obj.anno1.focus();
				}else if(fechain1 >= fechafi1){
					alert("La fecha de inicio trabajo debe ser menor a la fecha fin.");
					obj.anno1.focus();
				}
				else{
					ok = true;
				}
			}
			else{
				ok = true;
			}
		}
	}
	else{
		if(fechain1 != '0-0-0' && fechafi1 != '0-0-0'){
			if(fechain1 > hoy){
				alert("La fecha de inicio trabajo debe ser menor a la fecha actual.");
				obj.anno1.focus();
			}else if(fechafi1 > hoy){
				alert("La fecha fin trabajo debe ser menor a la fecha actual.");
				obj.anno1.focus();
			}else if(fechain1 >= fechafi1){
				alert("La fecha de inicio trabajo debe ser menor a la fecha fin.");
				obj.anno1.focus();
			}
			else{
				ok = true;
			}
		}
		else{
			ok = true;
		}
	}
	return ok;
}

function valida_bolsa4(obj)
{
	ok  = false;
	var re=/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	if(obj.sucursal.options[obj.sucursal.selectedIndex].value == 0){
		alert("No ha seleccionado la sucursal mas cercana.");
		obj.sucursal.focus();
	}
	else{
		ok = true;}
	return ok;
}

function esInteger(e) {
var charCode
if (navigator.appName == "Netscape") // Veo si es Netscape o Explorer
charCode = e.which // leo la tecla que ingreso
else
charCode = e.keyCode // leo la tecla que ingreso
status = charCode 
if (charCode > 31 && (charCode < 48 || charCode > 57)) { // Chequeamos que sea un numero comparandolo con los valores ASCII
alert("Solo Numeros!!")
return false
}
}