/*****************************************************************************/
/* Llibreria JavaScript Botigues DRAC                                        */
/*****************************************************************************/

function obre_bigi (port, lang, img, alt) {
   if ( port ) {
      bigi = window.open ('/appl/botiga/bigi.php?lang='+lang+'img='+img+'&alt='+escape(alt), 'bigi', 'top=100,left=100,height=400,width=600,resizable=yes,scrollbars=no,toolbar=no,locationbar=no,statusbar=no');
      bigi.focus();
   } else {
      bigi = window.open ('bigi.php?lang='+lang+'img='+img+'&alt='+escape(alt), 'bigi', 'top=100,left=100,height=400,width=600,resizable=yes,scrollbars=no,toolbar=no,locationbar=no,statusbar=no');
      bigi.focus();
   }
}

function obre_cist (port, lang, back, cist, fami, prod) {
   if ( port ) {
      document.getElementById ('cata').oper.value = '2';
      document.getElementById ('cata').codi.value = prod;
      document.getElementById ('cata').back.value = back+'/0/'+fami;
      document.getElementById ('cata').action = '/'+lang+'/'+cist+'/2/'+prod+'/'+fami;
      document.getElementById ('cata').submit();
   } else {
      document.getElementById ('cata').codi.value = prod;
      document.getElementById ('cata').back.value = 'cata.php';
      document.getElementById ('cata').action = 'cist.php';
      document.getElementById ('cata').submit();
   }
}

function obre_cisp (port, lang, back, cist, varp, prod, win1) {
   if ( port ) {
      if ( (win1 == 'flot') || (win1 == 'blank') ) {
         window.opener.document.getElementById ('cata').oper.value = '2';
         window.opener.document.getElementById ('cata').codi.value = prod;
         window.opener.document.getElementById ('cata').quan.value = document.getElementById ('prod').quan.value;
         for (v = 0; v < $varp; v++) {
            opva = eval ('window.opener.document.getElementById (\"cata\").vari_' + v + '.value');
            prva = eval ('document.getElementById (\"prod\").vari_' + v + '.value');
            opva = prva;
         }
         window.opener.document.getElementById('cata').submit();
         window.close();
      } else {
         document.getElementById('prod').oper.value = '2';
         document.getElementById('prod').action = '/'+lang+'/'+back+'/2';
         document.getElementById('prod').submit();
      }
   } else {
      if ( (win1 == 'flot') || (win1 == 'blank') ) {
         window.opener.document.getElementById ('cata').action = 'cist.php';
         window.opener.document.getElementById ('cata').codi.value = prod;
         window.opener.document.getElementById ('cata').quan.value = document.getElementById('prod').quan.value;
         for (v = 0; v < $varp; v++) {
            opva = eval ('window.opener.document.getElementById (\"cata\").vari_' + v + '.value');
            prva = eval ('document.getElementById (\"prod\").vari_' + v + '.value');
            opva = prva;
         }
         window.opener.document.getElementById ('cata').submit();
         window.close();
      } else {
         document.getElementById('prod').action = 'cist.php';
         document.getElementById('prod').codi.value = prod;
         window.opener.document.getElementById('cata').submit();
      }
   }
}

function obre_prod (port, lang, back, cist, fami, prod, win1) {
   if ( port ) {
      switch (win1) {
         case 'blank':
            prod = window.open ('/'+lang+'/FinestraProducte/1/'+prod);
            prod.focus();
            break;
         case "flot":
            prod = window.open ('/'+lang+'/FinestraProducte/1/'+prod, 'prod', 'top=100,left=250,height=400,width=500,resizable=yes,scrollbars=yes,toolbar=no,locationbar=no,statusbar=no');
            prod.focus();
            break;
         default:
            document.getElementById ('cata').oper.value = '1';
            document.getElementById ('cata').codi.value = prod;
            document.getElementById ('cata').back.value = back+'/0/'+fami;
            document.getElementById ('cata').action = '/'+lang+'/'+back+'/1/'+prod;
            document.getElementById ('cata').submit();
      }
   } else {
      switch (win1) {
         case "blank":
            prod = window.open ('dpro.php?lang='+lang+'&codi='+prod);
            prod.focus();
            break;
         case "flot":
            prod = window.open ('dpro.php?lang='+lang+'&codi='+prod, 'prod', 'top=150,left=250,height=400,width=500,resizable=yes,scrollbars=yes,toolbar=no,locationbar=no,statusbar=no');
            prod.focus();
            break;
         default:
            document.getElementById ('cata').codi.value = prod;
            document.getElementById ('cata').back.value = 'cata.php';
            document.getElementById ('cata').action = 'dpro.php';
            document.getElementById ('cata').submit();
      }
   }
}

function obre_text (port, lang, oper) {
   if ( port ) {
      text = window.open ('/appl/botiga/text.php?lang='+lang+'&oper='+oper, 'text', 'top=100,left=100,height=400,width=600,resizable=no,scrollbars=yes,toolbar=no,locationbar=no,statusbar=no');
      text.focus();
   } else {
      text = window.open ('text.php?lang='+lang+'&oper='+oper, 'text', 'top=100,left=100,height=400,width=600,resizable=no,scrollbars=yes,toolbar=no,locationbar=no,statusbar=no');
      text.focus();
   }
}

/*****************************************************************************/
/* J. Badiella A. jbadiella@drac.com                                         */
/* DRAC telemātic  http://www.drac.com                                       */
/* Terrassa, Febrer 2008                                                     */
/*****************************************************************************/
