var ROOT_PATH = ""

var OpenCat = null;
var oOpenCat;
var CANCALLBANCO = false;

function showCategoria(n1,n2,n3) {
   document.mainform.frm_cat1N.value = (n1) ? n1 : 0;
   document.mainform.frm_cat2N.value = (n2) ? n2 : 0;
   document.mainform.frm_cat3N.value = (n3) ? n3 : 0;
   
   if (n2 != null || n3 != null) {
      document.mainform.action = ROOT_PATH  + "/tienda/subcategoria.asp";      
   } else {
      document.mainform.action = ROOT_PATH  + "/tienda/index.asp";
   }
   
   document.mainform.frm_subsecc.value = -1;
   
   SubmitForm();
}

function showProducto(n1,n2,n3,idp) {
   document.mainform.frm_cat1N.value = (n1) ? n1 : 0;
   document.mainform.frm_cat2N.value = (n2) ? n2 : 0;
   document.mainform.frm_cat3N.value = (n3) ? n3 : 0;
   document.mainform.frm_prod.value = idp;
   
   document.mainform.action = ROOT_PATH  + "/tienda/detalleproducto.asp";            
   document.mainform.frm_subsecc.value = -1;
   
   SubmitForm();
}

function addCesta() { 
   document.mainform.action = ROOT_PATH + "/compra/CestaInsert.asp";   
   SubmitForm(); 
}

function ShowCesta() {
  document.mainform.action = ROOT_PATH + "/compra/Cesta.asp";   
   SubmitForm(); 
}

function cestaChgCant(item) {
   document.mainform.frm_item.value=item;
   document.mainform.action = ROOT_PATH + "/compra/CestaChgCantidad.asp";
   document.mainform.submit();   
}

function cestaDelItem(item) {
   document.mainform.frm_item.value=item;
   document.mainform.action = ROOT_PATH + "/compra/CestaDelItem.asp";
   document.mainform.submit();   
}

function cestaClear() {   
   document.mainform.action = ROOT_PATH + "/compra/CestaClear.asp";
   document.mainform.submit();  
}

function copyDataClient(o) {     
    tForm = document.mainform;
    tForm.frm_nombre_e.value    = (o.checked) ? tForm.frm_nombre_c.value     : "";
	tForm.frm_apellidos_e.value = (o.checked) ? tForm.frm_apellidos_c.value  : "";
	tForm.frm_direccion_e.value = (o.checked) ? tForm.frm_direccion_c.value  : "";
	tForm.frm_poblacion_e.value = (o.checked) ? tForm.frm_poblacion_c.value  : "";
	tForm.frm_prov_e.value      = (o.checked) ? tForm.frm_prov_c.value : "";
	tForm.frm_pais_e.value      = (o.checked) ? tForm.frm_pais_c.value : "";
	tForm.frm_cp_e.value        = (o.checked) ? tForm.frm_cp_c.value         : "";	   
	tForm.frm_telef_e.value     = (o.checked) ? tForm.frm_telef_c.value      : "";	   
}

function clearDataClient(o) {     
    tForm = document.mainform;
    tForm.frm_nombre_e.value    = (!o.checked) ? tForm.frm_nombre_c.value     : "";
	tForm.frm_apellidos_e.value = (!o.checked) ? tForm.frm_apellidos_c.value  : "";
	tForm.frm_direccion_e.value = (!o.checked) ? tForm.frm_direccion_c.value  : "";
	tForm.frm_poblacion_e.value = (!o.checked) ? tForm.frm_poblacion_c.value  : "";
	tForm.frm_prov_e.value      = (!o.checked) ? tForm.frm_prov_c.value : "";
	tForm.frm_pais_e.value      = (!o.checked) ? tForm.frm_pais_c.value : "";
	tForm.frm_cp_e.value        = (!o.checked) ? tForm.frm_cp_c.value         : "";	   
	tForm.frm_telef_e.value     = (!o.checked) ? tForm.frm_telef_c.value      : "";	   
}

function openFoto(fotopath,w,h) {
   if (w>800) w=750;
   if (h>600) h=550;
   w=w+50; h=h+50;
   var url = ROOT_PATH + "/tienda/foto_detalle.asp?path="+fotopath;
   open(url,"fotodetalle",'menubar=no,height=' + h + ',width=' + w + ',scrollbars=1,resizable=yes,toolbar=no,location=no,status=no,top=10,left=10');
}

function CallBanco() {   
   if (CANCALLBANCO) {
	   ventana = window.open("","ventanaBanco","width=620, height=560, scrollbars=1,resizable=1");
	   //ventana = window.open("","ventanaBanco");	  
	   document.pago.target = "ventanaBanco";
	   document.pago.submit();
	   
	   document.mainform.action = "procesop3.asp"
	   return false;     
   }	   
}

function reCallBanco() {
   document.mainform.action = "procesop3.asp";   
   document.mainform.submit();
}