home *** CD-ROM | disk | FTP | other *** search
/ ifirobotics.com / www.ifirobotics.com.tar / www.ifirobotics.com / app / add_cart_include.js next >
Text File  |  2010-01-08  |  6KB  |  148 lines

  1. function WindowOpen(strOperate,strTitle,intWidth,intHeight ) {
  2.     var pathname = (window.location.pathname);
  3.     window.open(strOperate,strTitle,"'toolbar=no, location=no, directories=no, status=no, menubar=no,scrollbars=no,resizable=no,width="+intWidth+",height="+intHeight+",top=0,left=0" );//+(screen.availHeight-intHeight)/2+",left="+(screen.availWidth-intWidth)/2 );
  4. }
  5.  
  6. function add_productor(prod,qty)
  7. {
  8.    var answer = confirm('Attention: The IFI Robotics line of products has been merged with the VEX Robotics Design System and relabeled VEXpro.  Please click "OK" to be redirected to the VEX website to make your purchase, otherwise click "Cancel" to remain on ifirobotics.com.');
  9.    if (answer) {
  10.       window.location = 'http://www.vexrobotics.com/products/vexpro';
  11.    } 
  12. }
  13.  
  14. function add_productor__old(id_product, quantity ) {
  15.    if (!cookies_enabled())
  16.    {
  17.       alert('You must have cookies enabled to place an order.');
  18.       return false;
  19.    }
  20.    if (document.getElementById("div_sid").innerHTML == 'divsid')
  21.    {  
  22.       var url="http://www.innovationfirst.com/cart/index.php?action=add_product_to_cart&id_product=" + id_product + "&quantity=" + quantity+"&preurl="+location.href;
  23.       location.href = url;
  24.    }
  25.    else
  26.    {  
  27.       var url="http://www.innovationfirst.com/cart/index.php?action=add_product_to_cart&id_product=" + id_product + "&quantity=" + quantity+"&sid="+document.getElementById("div_sid").innerHTML;
  28.       document.getElementById("view_frame").src = url;
  29.    }
  30. }
  31.  
  32. function add_comp_productor( aform,product_count,quantity ) {
  33.    if (!cookies_enabled())
  34.    {
  35.       alert('You must have cookies enabled to place an order.');
  36.       return false;
  37.    }
  38.  
  39.     var url_param;
  40.     url_param = "";
  41.      
  42.     for ( var i=0; i<Math.floor(product_count); i++ ) { 
  43.         if ( aform.elements["id_product_"+i] != undefined )
  44.             url_param += "&id_product_"+i+"="+aform.elements["id_product_"+i].value;
  45.         }    
  46.  
  47.    if (document.getElementById("div_sid").innerHTML == 'divsid')
  48.    {  
  49.       var url="http://www.innovationfirst.com/cart/index.php?action=add_component_product_to_cart&product_count=" + product_count+url_param+"&quantity=" + quantity+"&preurl="+location.href;
  50.       location.href = url;
  51.    }
  52.    else
  53.    {  
  54.       var url="http://www.innovationfirst.com/cart/index.php?action=add_component_product_to_cart&product_count=" + product_count+url_param+"&quantity=" + quantity+"&sid="+document.getElementById("div_sid").innerHTML;
  55.       document.getElementById("view_frame").src = url;
  56.    }
  57. }
  58.  
  59. function add_mul_comp_productor_new( aform,comps_count,comm_product_count,quantity ) {
  60.    if (!cookies_enabled())
  61.    {
  62.       alert('You must have cookies enabled to place an order.');
  63.       return false;
  64.    }
  65.  
  66.     var url_param,tmp_url_param;
  67.     url_param = "";
  68.     tmp_url_param = "";
  69.     var real_comps_count,real_comm_product_count;
  70.             
  71.     real_comps_count = 0;
  72.     for ( var i=0; i<Math.floor(comps_count); i++ ) { 
  73.         if ( aform.elements[ "comp_"+i ] != undefined )
  74.             if ( aform.elements[ "comp_"+i ].value != "-1"  ) {
  75.                 url_param += "&comp_"+i+"="+aform.elements[ "comp_"+i].value;
  76.                 real_comps_count += 1;              
  77.             } 
  78.         //url_param += "&comp_"+i+"="+aform.elements[ "comp_"+i].value;
  79.     
  80.          } 
  81.                                                                 
  82.     real_comm_products_count = 0;      
  83.              
  84.     for ( var i=0; i<Math.floor(comm_product_count); i++ ) { 
  85.         if ( aform.elements[ "comm_id_product_"+i ] != undefined )
  86.             if ( aform.elements[ "comm_id_product_"+i ].value != "-1"  ) {
  87.                 tmp_url_param += "&comm_id_product_"+real_comm_products_count+"="+aform.elements[ "comm_id_product_"+i ].value;
  88.                 real_comm_products_count += 1;              
  89.             }    
  90.     }    
  91.     url_param += "&comps_count="+real_comps_count+"&comm_products_count="+real_comm_products_count+tmp_url_param+"&quantity="+quantity;
  92.     
  93.    if (document.getElementById("div_sid").innerHTML == 'divsid')
  94.    {  
  95.       var url="http://www.innovationfirst.com/cart/index.php?action=add_mul_comp_productor_new"+url_param+"&preurl="+location.href;
  96.       location.href = url;
  97.    }
  98.    else
  99.    {  
  100.       var url="http://www.innovationfirst.com/cart/index.php?action=add_mul_comp_productor_new"+url_param+"&sid="+document.getElementById("div_sid").innerHTML;
  101.       document.getElementById("view_frame").src = url;
  102.    }
  103. }
  104.  
  105. function add_mul_comp_productor( aform,comps_count,comm_product_count,quantity ) {
  106.  
  107.    if (!cookies_enabled())
  108.    {
  109.       alert('You must have cookies enabled to place an order.');
  110.       return false;
  111.    }
  112.     var url_param,tmp_url_param;
  113.     url_param = "";
  114.     tmp_url_param = "";
  115.     var real_comp_product_count,real_comm_product_count;
  116.     
  117.     for ( var i=0; i<Math.floor(comps_count); i++ ) { 
  118.         real_comp_product_count = aform.elements[ "comp_"+i+"_product_count"].value;
  119.         url_param += "&comp_"+i+"_product_count="+real_comp_product_count;
  120.        
  121.         for ( var j=0; j<Math.floor(real_comp_product_count); j++ ) { 
  122.             if ( aform.elements[ "comp_"+i+"_id_product_"+j ] != undefined )
  123.                 url_param += "&comp_"+i+"_id_product_"+j+"="+aform.elements[ "comp_"+i+"_id_product_"+j ].value;
  124.         }    
  125.     } 
  126.  
  127.     real_comm_products_count = 0;               
  128.     for ( var i=0; i<Math.floor(comm_product_count); i++ ) { 
  129.         if ( aform.elements[ "comm_id_product_"+i ] != undefined )
  130.             if ( aform.elements[ "comm_id_product_"+i ].value != "-1"  ) {
  131.                 tmp_url_param += "&comm_id_product_"+real_comm_products_count+"="+aform.elements[ "comm_id_product_"+i ].value;
  132.                 real_comm_products_count += 1;              
  133.             }    
  134.     }    
  135.     url_param += "&comps_count="+comps_count+"&comm_products_count="+real_comm_products_count+tmp_url_param+"&quantity="+quantity;
  136.     
  137.    if (document.getElementById("div_sid").innerHTML == 'divsid')
  138.    {  
  139.       var url="http://www.innovationfirst.com/cart/index.php?action=add_mul_comp_productor"+url_param+"&preurl="+location.href;
  140.       location.href = url;
  141.    }
  142.    else
  143.    {  
  144.       var url="http://www.innovationfirst.com/cart/index.php?action=add_mul_comp_productor"+url_param+"&sid="+document.getElementById("div_sid").innerHTML;
  145.       document.getElementById("view_frame").src = url;
  146.    }
  147. }
  148.