/*function enviarcolor(radiogroup) {
    for (i=0; i<radiogroup.length;i++){ 
        if (radiogroup[i].checked == true) { 
          this.formPro.txtcolor.value=radiogroup[i].value; 
        } 
    } 
}*/
function puntitos(donde,caracter){
	pat = /[\*,\+,\(,\),\?,\,$,\[,\],\^]/
//	donde= this.form.txtInscripcionNew
	valor = donde.value
//	caracter=this.form.txtInscripcionNew.value.charAt(this.form.txtInscripcionNew.value.length-1)
	largo = valor.length
	crtr = true
	if(isNaN(caracter) || pat.test(caracter) == true){
		if (pat.test(caracter)==true){ 
			caracter = caracter
		}
		caracter = new RegExp(caracter,"g")
		valor = valor.replace(caracter,"")
		donde.value = valor
		crtr = false
	}
	else{
		var nums = new Array()
		cont = 0
		for(m=0;m<largo;m++){
			if(valor.charAt(m) == "." || valor.charAt(m) == " ")
				{continue;}
			else{
				nums[cont] = valor.charAt(m)
				cont++
			}
		}
	}
	var cad1="",cad2="",tres=0
	if(largo > 3 && crtr == true){
		for (k=nums.length-1;k>=0;k--){
			cad1 = nums[k]
			cad2 = cad1 + cad2
			tres++
			if((tres%3) == 0){
				if(k!=0){
					cad2 = "." + cad2
				}
			}
		}
		donde.value = cad2
	}
}
function cargar_pagina(enlace) {//mostrar los inmuebles de la categoria seleccionada
  if (this.formCat.selCat.selectedIndex!=-1) {
    var categoria;
    categoria =enlace+this.formCat.selCat.options[this.formCat.selCat.selectedIndex].value+'&categoria='+this.formCat.selCat.options[this.formCat.selCat.selectedIndex].text;
	if (categoria) location.href = categoria;
  }
}
function cerrar() {
	close();
}
function ventanaSecundaria2 (URL){ 
window.open(URL,"ventanaadm","width=217, height=117, scrollbars=no, menubar=no, location=no, resizable=no"); 
} 
function ventanaSecundaria (URL){ 
window.open(URL,"Detalles","width=670, height=500, top=50, left=20, scrollbars=yes, menubar=no, location=no, resizable=yes"); 
} 
function mostrar(codigo,producto,imagen,imagenP,descripcion,pvp,cod_cat) {
  var cadena
  cadena="images/productos/";//"images/productos/'.$cod_cat.'/
  var barra ="/";
    this.form.txtProductoNew.style.visibility="visible"; 
	this.form.txtDescripcionNew.style.visibility="visible";  
    this.form.txtpvpNew.style.visibility="visible";	
    this.form.txtImagenP.style.visibility="visible"; 
    this.form.txtImagen.style.visibility="visible";  
    this.form.txtImagenNewP.style.visibility="visible"; 
    this.form.txtImagenNew.style.visibility="visible";  	
    this.form.fotoP.style.visibility="visible"; 	
    this.form.foto.style.visibility="visible";  
  this.form.txtCodigoNew.style.visibility="visible";
  this.form.txtCodigoNew.value=codigo.value;
  this.form.txtpvpNew.value=pvp.value; 
    this.form.cod_cat.value=cod_cat.value;//codigo de la clase
    this.form.cod_pro.value=codigo.value;//codigo de la clase
    this.form.txtProductoNew.value=producto.value;//clase
    this.form.txtImagenP.value=imagenP.value;//imagen    
    this.form.txtImagen.value=imagen.value;//imagen    
    this.form.txtDescripcionNew.value=descripcion.value; 
	this.form.foto.src=cadena+cod_cat+barra+imagen.value;	
    this.form.fotoP.src=cadena+cod_cat+barra+imagenP.value;	
    this.form.SubmitGuardarM.style.visibility="visible";
    this.form.SubmitGuardarN.style.visibility="hidden"; 	
    this.form.accion.value="modificar";
}
function eliminar(codigo,producto,cod_cat) {
	this.form.accion.value="eliminar";
    this.form.txtProductoNew.value="";
    this.form.txtProductoNew.style.visibility="hidden";    	
    this.form.txtImagenNew.style.visibility="hidden";  
    this.form.txtDescripcionNew.value=""; 
    this.form.txtDescripcionNew.style.visibility="hidden";
    this.form.cod_cat.value=cod_cat.value;//codigo de la categoria
    this.form.cod_pro.value=codigo.value;//codigo de la clase  
    borrar = window.confirm('Se eliminara el producto '+producto.value);
    if (borrar==true) 
	  this.form.SubmitEliminar.click();
	else 
	  return false; 
}
function ingreso(c_cat) {
if (c_cat!=0) {
  this.form.txtCodigoNew.style.visibility="visible";
  this.form.txtCodigoNew.value=''; 	
  this.form.txtProductoNew.style.visibility="visible"; 
  this.form.txtProductoNew.value="";  
  this.form.txtDescripcionNew.style.visibility="visible";
  this.form.txtDescripcionNew.value='';  
  this.form.txtpvpNew.style.visibility="visible";
  this.form.txtpvpNew.value='';   
  this.form.txtImagenP.style.visibility="visible"; 
  this.form.txtImagenP.value="";
  this.form.txtImagenNewP.style.visibility="visible";   
  this.form.txtImagen.style.visibility="visible";   
  this.form.txtImagen.value="";   
  this.form.txtImagenNew.style.visibility="visible";    
  this.form.fotoP.style.visibility="visible";
  this.form.foto.style.visibility="visible";  
  this.form.fotoP.src="";
  this.form.foto.src="";
  this.form.accion.value="nuevo";
  this.form.cod_cat.value=c_cat;//codigo de la categoria 
  this.form.cod_pro.value='';
  this.form.txtCodigoNew.focus();  
  this.form.SubmitGuardarN.style.visibility="visible";
  this.form.SubmitGuardarM.style.visibility="hidden"; 
}
else {
  alert("Seleccione la Categoria a la que corresponde el producto a ingresar.");
}
}
/////////////para inventario tiendas/////////////////////
function mostrar_tienda(codigo,tienda,telefono,responsable) {
    this.form.txtTiendaNew.style.visibility="visible"; 
	this.form.txtTelefonoNew.style.visibility="visible";  
    this.form.txtResponsableNew.style.visibility="visible";	
    this.form.txtCodigoNew.style.visibility="visible";
    this.form.txtCodigoNew.value=codigo.value;
    this.form.cod_tienda.value=codigo.value;//codigo de la clase
    this.form.txtTiendaNew.value=tienda.value;//clase
    this.form.txtTelefonoNew.value=telefono.value;//imagen    
    this.form.txtResponsableNew.value=responsable.value;//imagen    
    this.form.SubmitGuardarM.style.visibility="visible";
    this.form.SubmitGuardarN.style.visibility="hidden"; 	
    this.form.accion.value="modificar";
}
function eliminar_tienda(codigo,tienda) {
	this.form.accion.value="eliminar";
    this.form.txtTiendaNew.value="";
    this.form.txtTiendaNew.style.visibility="hidden";    	
    this.form.txtTelefonoNew.value="";
	this.form.txtTelefonoNew.style.visibility="hidden";  
    this.form.txtResponsableNew.value=""; 
    this.form.txtResponsableNew.style.visibility="hidden";
    this.form.cod_tienda.value=codigo.value;//codigo de la clase  
    borrar = window.confirm('Se eliminara la tienda '+tienda.value);
    if (borrar==true) 
	  this.form.SubmitEliminar.click();
	else 
	  return false; 
}
function ingreso_tienda() {
  this.form.txtCodigoNew.style.visibility="visible";
  this.form.txtCodigoNew.value=''; 	
  this.form.txtTiendaNew.style.visibility="visible"; 
  this.form.txtTiendaNew.value="";  
  this.form.txtTelefonoNew.style.visibility="visible";
  this.form.txtTelefonoNew.value='';  
  this.form.txtResponsableNew.style.visibility="visible";
  this.form.txtResponsableNew.value='';   
  this.form.accion.value="nuevo";
  this.form.cod_tienda.value='';
  this.form.txtCodigoNew.focus();  
  this.form.SubmitGuardarN.style.visibility="visible";
  this.form.SubmitGuardarM.style.visibility="hidden"; 
}
/*function cargar_pagina_tienda(enlace) {//mostrar los inmuebles de la categoria seleccionada
  if (this.formTienda.selTienda.selectedIndex!=-1) {
    var tienda;
    tienda =enlace+this.formTienda.selTienda.options[this.formTienda.selTienda.selectedIndex].value+'&tienda='+this.formTienda.selTienda.options[this.formTienda.selTienda.selectedIndex].text;
	if (tienda) location.href = tienda;
  }
}*/
function cargar_pagina_ref(enlace) {//mostrar la existencia del articulo
  if (this.formTienda.selTienda.selectedIndex!=-1) {
    var tiendaurl;
    tiendaurl =enlace+this.formTienda.selTienda.options[this.formTienda.selTienda.selectedIndex].value+'&tienda='+this.formTienda.selTienda.options[this.formTienda.selTienda.selectedIndex].text+'&ref='+this.formTienda.txtCodPro.value;
	if (tiendaurl) location.href = tiendaurl;
  }
}
function cargar_pagina_barras(enlace) {//mostrar la existencia del articulo
  if (this.formTienda.txtCodPro.value!='') {
    var tiendaurl;
    tiendaurl =enlace+this.formTienda.txtCodPro.value;
	if (tiendaurl) location.href = tiendaurl;
  }
}
function limpiar() {
  this.formTienda.txtCodPro.value=''; 	
  this.formTienda.txtArticulo.text="";  
  this.formTienda.txtDetalle.value="";  
  this.formTienda.txtCant.value="";    
  this.formTienda.txtCant.focus();   
}
function cargar_pagina_inv(enlace) {//mostrar la existencia del articulo
  if (this.frmInv.selTienda.selectedIndex!=-1) {
    var tiendaurl;
    tiendaurl =enlace+this.frmInv.selTienda.options[this.frmInv.selTienda.selectedIndex].value+'&tienda='+this.frmInv.selTienda.options[this.frmInv.selTienda.selectedIndex].text;
	if (tiendaurl) location.href = tiendaurl;
  }
}
function cargar_pagina_inv_mes(enlace) {//mostrar la existencia del articulo
  if (this.frmInv.selTienda.selectedIndex!=-1) {
    var tiendaurl;
    tiendaurl =enlace+this.frmInv.selTienda.options[this.frmInv.selTienda.selectedIndex].value+'&tienda='+this.frmInv.selTienda.options[this.frmInv.selTienda.selectedIndex].text+'&mes='+this.frmInv.selMes.options[this.frmInv.selMes.selectedIndex].value+'&anno='+this.frmInv.selAnno.options[this.frmInv.selAnno.selectedIndex].value;
	if (tiendaurl) location.href = tiendaurl;
  }
}