	/* OroLogic Inc. */
function Calculate(Form)
 {  
  var PricesL3XC  = new Array(51,51,48,44,41,38,34,31,27);
  var PricesF32C  = new Array(149,149,139,129,119,109,99,89,79);
  var PricesU32C  = new Array(90,90,84,78,72,66,60,54,48);
  var PricesF24C  = new Array(249,249,229,209,189,169,149,129,109);
  var PricesU24C  = new Array(150,150,138,126,114,102,90,78,66);
  var PricesF16C  = new Array(129,129,119,109,99,89,79,69,59);
  var PricesU16C  = new Array(78,78,72,66,60,54,48,42,36);
  var PricesP16C  = new Array(379,379,379,379,379,379,379,379,379);
  var PricesQ16C  = new Array(228,228,228,228,228,228,228,228,228);
  var PricesL1XC  = new Array(44,44,41,38,34,31,27,24,21);
  var PricesP1XC  = new Array(129,129,129,129,129,129,129,129,129);
  var PricesL2XC  = new Array(85,85,78,72,65,58,51,44,38);

  var PricesL3XU  = new Array(49,49,47,43,40,37,33,30,26);
  var PricesF32U  = new Array(144,144,134,124,115,105,96,86,76);
  var PricesU32U  = new Array(87,87,81,75,70,64,58,52,47);
  var PricesF24U  = new Array(240,240,220,201,182,163,144,124,105);
  var PricesU24U  = new Array(144,144,133,121,110,98,87,75,64);
  var PricesF16U  = new Array(124,124,115,105,96,86,76,67,57);
  var PricesU16U  = new Array(75,75,70,64,58,52,47,41,35);
  var PricesP16U  = new Array(364,364,364,364,364,364,364,364,364);
  var PricesQ16U  = new Array(219,219,219,219,219,219,219,219,219);
  var PricesL1XU  = new Array(43,43,40,37,33,30,26,24,21);
  var PricesP1XU  = new Array(124,124,124,124,124,124,124,124,124);
  var PricesL2XU  = new Array(82,82,75,70,63,56,49,43,37);
  var PricesL4XU  = new Array(96,96,86,76,67,57,48,38,28);
  var PricesL4XC  = new Array(99,99,89,79,69,59,49,39,29);
  var PricesL4QU  = new Array(144,144,144,144,144,144,144,144,144);
  var PricesL4QC  = new Array(149,149,149,149,149,149,149,149,149);
  var PricesL4SU  = new Array(144,144,144,144,144,144,144,144,144);
  var PricesL4SC  = new Array(149,149,149,149,149,149,149,149,149);
  
  var Quantity    = 0;
  var Quantity2   = 0;
  var PriceIndex  = 0;
  var PriceIndex2 = 0;
  var Price       = 0;
  var Price2      = 0;
  var Msg         = "";
  var sBuyRent    = "";
    
  Quantity        = parseInt(Form.QTY.value,10);

  if (Form.PRODUCT.value == "XXX")
  {
     if (Form.LANGUAGE.value == "FR")
      alert("Veuillez sélectionner un produit valide s.v.p.");
	 else
	  alert("Please select a valid product.");
	  
	 Form.FINALRESULT.value = "";
     Form.PRODUCT.focus();     
	 return false;
  }  
  
  if (isNaN(Quantity) || Quantity < 1)
  {
     if (Form.LANGUAGE.value == "FR")
      alert("Veuillez saisir une quantité valide s.v.p.");
	 else
	  alert("Please type a valid quantity.");
	  
	 Form.FINALRESULT.value = "";
     Form.QTY.focus();
     Form.QTY.select();
	 return false;
  }
  
  Form.QTY.value = Quantity;
  PriceIndex = 0;
  Quantity2  = 2;
  
  if (Quantity >   1)  { PriceIndex = 1; Quantity2 =      5; }
  if (Quantity >   4)  { PriceIndex = 2; Quantity2 =     10; }
  if (Quantity >   9)  { PriceIndex = 3; Quantity2 =     25; }
  if (Quantity >  24)  { PriceIndex = 4; Quantity2 =     50; }
  if (Quantity >  49)  { PriceIndex = 5; Quantity2 =    100; }
  if (Quantity >  99)  { PriceIndex = 6; Quantity2 =    250; }
  if (Quantity > 249)  { PriceIndex = 7; Quantity2 =    500; }
  if (Quantity > 499)  { PriceIndex = 8; Quantity2 = 999999; }
  
  PriceIndex2 = PriceIndex + 1;
  
  if (PriceIndex2 > 8)
   PriceIndex2 = 8;
 
  if (Form.LANGUAGE.value == "FR")
   Msg = "Le prix pour "+Quantity+" licences de ";
  else
   Msg = "The price for "+Quantity+" licenses of "; 
 
  if (Form.PRODUCT.value == "F23")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "NewWayService 3 (Licences complètes)";
   else
    Msg = Msg + "NewWayService 3 (Full licenses)";
	
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesF23C[PriceIndex];
	 Price2 = PricesF23C[PriceIndex2];
   }
   else
   {
     Price  = PricesF23U[PriceIndex];   
	 Price2 = PricesF23U[PriceIndex2];   
   }
  }

  if (Form.PRODUCT.value == "F24")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "NewWayService 4 (Licences complètes)";
   else
    Msg = Msg + "NewWayService 4 (Full licenses)";
	
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesF24C[PriceIndex];
	 Price2 = PricesF24C[PriceIndex2];
   }
   else
   {
     Price  = PricesF24U[PriceIndex];   
	 Price2 = PricesF24U[PriceIndex2];   
   }
  }
  
  if (Form.PRODUCT.value == "U23")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "NewWayService 3 (Licences de mise à jour)";
   else
    Msg = Msg + "NewWayService 3 (Update licenses)";
   
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesU23C[PriceIndex];
	 Price2 = PricesU23C[PriceIndex2];
   }
   else
   {
     Price  = PricesU23U[PriceIndex];   
	 Price2 = PricesU23U[PriceIndex2];
   }
  }

  if (Form.PRODUCT.value == "U24")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "NewWayService 4 (Licences de mise à jour)";
   else
    Msg = Msg + "NewWayService 4 (Update licenses)";
   
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesU24C[PriceIndex];
	 Price2 = PricesU24C[PriceIndex2];
   }
   else
   {
     Price  = PricesU24U[PriceIndex];   
	 Price2 = PricesU24U[PriceIndex2];
   }
  }
  
  if (Form.PRODUCT.value == "F32")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "OroMailCenter 2 (Licences complètes)";
   else
    Msg = Msg + "OroMailCenter 2 (Full licenses)";
	
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesF32C[PriceIndex];
	 Price2 = PricesF32C[PriceIndex2];
   }
   else
   {
     Price  = PricesF32U[PriceIndex];   
	 Price2 = PricesF32U[PriceIndex2];   
   }
  } 

  if (Form.PRODUCT.value == "U32")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "OroMailCenter 2 (Licences de mise à jour)";
   else
    Msg = Msg + "OroMailCenter 2 (Update licenses)";
	
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesU32C[PriceIndex];
	 Price2 = PricesU32C[PriceIndex2];
   }
   else
   {
     Price  = PricesU32U[PriceIndex];   
	 Price2 = PricesU32U[PriceIndex2];   
   }
  } 

  if (Form.PRODUCT.value == "L3X")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "OroMailCenter (Licences de location)";
   else
    Msg = Msg + "OroMailCenter (Rental licenses)";
	
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesL3XC[PriceIndex];
	 Price2 = PricesL3XC[PriceIndex2];
   }
   else
   {
     Price  = PricesL3XU[PriceIndex];   
	 Price2 = PricesL3XU[PriceIndex2];   
   }
  } 
  
  if (Form.PRODUCT.value == "L2X")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "NewWayService (Licences de location)";
   else
    Msg = Msg + "NewWayService (Rental licenses)";
	
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesL2XC[PriceIndex];
	 Price2 = PricesL2XC[PriceIndex2];
   }
   else
   {
     Price  = PricesL2XU[PriceIndex];   
	 Price2 = PricesL2XU[PriceIndex2];   
   }
  } 
    

  if (Form.PRODUCT.value == "F16")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg   = Msg + "OroTimesheet 6 (Licences complètes)";
   else
    Msg   = Msg + "OroTimesheet 6 (Full licenses)";
	
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesF16C[PriceIndex];
	 Price2 = PricesF16C[PriceIndex2];
   }
   else
   {
     Price  = PricesF16U[PriceIndex];
	 Price2 = PricesF16U[PriceIndex2];
   }
  }
  
  if (Form.PRODUCT.value == "U16")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "OroTimesheet 6 (Licences de mise à jour)";
   else
    Msg = Msg + "OroTimesheet 6 (Update licenses)";
	   
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesU16C[PriceIndex];
	 Price2 = PricesU16C[PriceIndex2];
   }
   else
   {
     Price  = PricesU16U[PriceIndex];
	 Price2 = PricesU16U[PriceIndex2];
   }
  }
  
  if (Form.PRODUCT.value == "L1X")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "OroTimesheet (Licences de location)";
   else
    Msg = Msg + "OroTimesheet (Rental licenses)";
	
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesL1XC[PriceIndex];
	 Price2 = PricesL1XC[PriceIndex2];
   }
   else
   {
     Price  = PricesL1XU[PriceIndex];   
	 Price2 = PricesL1XU[PriceIndex2];   
   }
  } 
  
  
  if (Form.PRODUCT.value == "P16")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "Horodateur pour OroTimesheet 6 (Licences complètes)";
   else
    Msg = Msg + "Punch clock for OroTimesheet 6 (Full licenses)";
	
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesP16C[PriceIndex];
	 Price2 = PricesP16C[PriceIndex2];
   }
   else
   {
     Price  = PricesP16U[PriceIndex];   
	 Price2 = PricesP16U[PriceIndex2];   
   }
  }   
  
  if (Form.PRODUCT.value == "Q16")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "Horodateur pour OroTimesheet 6 (Licences de mise à jour)";
   else
    Msg = Msg + "Punch clock for OroTimesheet 6 (Update licenses)";
	
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesQ16C[PriceIndex];
	 Price2 = PricesQ16C[PriceIndex2];
   }
   else
   {
     Price  = PricesQ16U[PriceIndex];   
	 Price2 = PricesQ16U[PriceIndex2];   
   }
  } 

  if (Form.PRODUCT.value == "P1X")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "Horodateur pour OroTimesheet (Licences de location)";
   else
    Msg = Msg + "Punch clock for OroTimesheet (Rental licenses)";
	
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesP1XC[PriceIndex];
	 Price2 = PricesP1XC[PriceIndex2];
   }
   else
   {
     Price  = PricesP1XU[PriceIndex];   
	 Price2 = PricesP1XU[PriceIndex2];   
   }
  } 
  
  if (Form.PRODUCT.value == "L4X")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "LogiSales (Licences de location)";
   else
    Msg = Msg + "LogiSales (Rental licenses)";
	
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesL4XC[PriceIndex];
	 Price2 = PricesL4XC[PriceIndex2];
   }
   else
   {
     Price  = PricesL4XU[PriceIndex];   
	 Price2 = PricesL4XU[PriceIndex2];   
   }
  } 
  
  if (Form.PRODUCT.value == "L4Q")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "LogiSales - Plug-in pour QuickBooks - (Licences de location)";
   else
    Msg = Msg + "LogiSales - Plug-in for QuickBooks - (Rental licenses)";
	
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesL4QC[PriceIndex];
	 Price2 = PricesL4QC[PriceIndex2];
   }
   else
   {
     Price  = PricesL4QU[PriceIndex];   
	 Price2 = PricesL4QU[PriceIndex2];   
   }
  } 
  
  if (Form.PRODUCT.value == "L4S")
  {
   if (Form.LANGUAGE.value == "FR")
    Msg = Msg + "LogiSales - Plug-in pour Simple Comptable - (Licences de location)";
   else
    Msg = Msg + "LogiSales - Plug-in for Simply Accounting - (Rental licenses)";
	
   if (Form.CURRENCY_LONG.value == "CAD") 
   {
     Price  = PricesL4SC[PriceIndex];
	 Price2 = PricesL4SC[PriceIndex2];
   }
   else
   {
     Price  = PricesL4SU[PriceIndex];   
	 Price2 = PricesL4SU[PriceIndex2];   
   }
  } 
  
  if (Form.LANGUAGE.value == "FR")
   Msg = Msg + " est de " + Price + "$ " + Form.CURRENCY_LONG.value + " par licence, pour un total de " + Quantity*Price + "$ " + Form.CURRENCY_LONG.value + ".\r\n\r\n";
  else
   Msg = Msg + " is " + Price + "$ " + Form.CURRENCY_LONG.value + " per license, for a total of " + Quantity*Price + "$ " + Form.CURRENCY_LONG.value + ".\r\n\r\n";
   
  if (Form.LANGUAGE.value == "FR")
   sBuyRent = "d'acheter";
  else
   sBuyRent = "to buy";   
  
  if (Form.PRODUCT.value == "P1X")
  {
   if (Form.LANGUAGE.value == "FR")
   {
    Msg = Msg + "Veuillez noter que les licences de location sont valides pour un an.\r\n\r\n";
	sBuyRent = "de louer";
   }
   else
   {
    Msg = Msg + "Please note that rental licenses are valid for one year.\r\n\r\n";
	sBuyRent = "to rent";
   }
  }   

  if (Form.PRODUCT.value == "L1X")
  {
   if (Form.LANGUAGE.value == "FR")
   {
    Msg = Msg + "Veuillez noter que les licences de location sont valides pour un an.\r\n\r\n";
	sBuyRent = "de louer";
   }
   else
   {
    Msg = Msg + "Please note that rental licenses are valid for one year.\r\n\r\n";
	sBuyRent = "to rent";
   }
  }   

  if (Form.PRODUCT.value == "L2X")
  {
   if (Form.LANGUAGE.value == "FR")
   {
    Msg = Msg + "Veuillez noter que les licences de location sont valides pour un an.\r\n\r\n";
	sBuyRent = "de louer";
   }
   else
   {
    Msg = Msg + "Please note that rental licenses are valid for one year.\r\n\r\n";
	sBuyRent = "to rent";
   }
  }   
  
  if (Form.PRODUCT.value == "L3X")
  {
   if (Form.LANGUAGE.value == "FR")
   {
    Msg = Msg + "Veuillez noter que les licences de location sont valides pour un an.\r\n\r\n";
	sBuyRent = "de louer";
   }
   else
   {
    Msg = Msg + "Please note that rental licenses are valid for one year.\r\n\r\n";
	sBuyRent = "to rent";
   }
  }   
  
  if ( (Form.PRODUCT.value == "L4X") || (Form.PRODUCT.value == "L4Q") || (Form.PRODUCT.value == "L4S") )
  {
   if (Form.LANGUAGE.value == "FR")
   {
    Msg = Msg + "Veuillez noter que les licences de location sont valides pour un an.\r\n\r\n";
	sBuyRent = "de louer";
   }
   else
   {
    Msg = Msg + "Please note that rental licenses are valid for one year.\r\n\r\n";
	sBuyRent = "to rent";
   }
  }     
 
  if (Form.PRODUCT.value == "F31")
  {
   if (Form.LANGUAGE.value == "FR")
   {
    Msg = Msg + "zzz ";
    Msg = Msg + "zzz.\r\n\r\n";
   }
   else
   {
    Msg = Msg + "zzz ";
    Msg = Msg + "zzz.\r\n\r\n";
   }
  }   
   
  if (Quantity*Price >= Quantity2*Price2)
  {
   if (Form.LANGUAGE.value == "FR")
   {
    Msg = Msg + "Note: Nous vous recommandons fortement " + sBuyRent + " " + Quantity2 + " licences au lieu de " + Quantity + " licences, parce que le prix total sera moins élevé ou du moins égal. ";
    Msg = Msg + "Ainsi, il vous en coûterait " + Quantity2*Price2 + "$ " + Form.CURRENCY_LONG.value + " pour " + Quantity2 + " licences, au lieu de " + Quantity*Price + "$ " + Form.CURRENCY_LONG.value + " pour " + Quantity + " licences.";
   }
   else
   {
    Msg = Msg + "Note that we strongly recommend you " + sBuyRent + " " + Quantity2 + " licenses instead of " + Quantity + " licenses, because the total price will be lower or at least equal. ";
    Msg = Msg + "By this way, the total price would be " + Quantity2*Price2 + "$ " + Form.CURRENCY_LONG.value + " for " + Quantity2 + " licenses, instead of " + Quantity*Price + "$ " + Form.CURRENCY_LONG.value + " for " + Quantity + " licenses.";
   }
  }
   
  Form.FINALRESULT.value = Msg;
  Form.FINALRESULT.focus;
  Form.FINALRESULT.select;
  return true;
 }
 
function NouvelleFenetre(NomFichier)
{
 var iLeft = (screen.width  - 540)/2;
 var iTop  = (screen.height - 400)/2;
 var ParamFin = ",left=" + iLeft + ",top=" + iTop;
  
 window.open(NomFichier,"Popup","toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=1,width=540,height=400" + ParamFin);
}

function NouvelleFenetreQT(NomFichier)
{
 var iWidth   = screen.width  - 50;
 var iHeight  = screen.height - 100;
 var iLeft    = 0;
 var iTop     = 0; 
 var ParamFin = ",width=" + iWidth + ",height=" + iHeight +",left=" + iLeft + ",top=" + iTop;
  
 window.open(NomFichier,"Popup","toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollbars=1,resizable=1" + ParamFin);
}

function InitPopup()
{
 this.focus();
 
 if (history.length == 0)
  BACKLINK.style.visibility = "hidden";
  
  
 if (window.opener == "Popupzzz" )
  BACKLINK.style.visibility = "hidden";

}

function GetQuoteOrder(Form, IsQuote)
{   
  var Quantity    = 0;
  var Msg         = "";
  
  Quantity        = parseInt(Form.QTY.value,10);

  if (Form.PRODUCT.value == "XXX")
  {
     if (Form.LANGUAGE.value == "FR")
      alert("Veuillez sélectionner un produit valide s.v.p.");
	 else
	  alert("Please select a valid product.");
	  
	 Form.FINALRESULT.value = "";
     Form.PRODUCT.focus();     
	 return false;
  }  
  
  if (isNaN(Quantity) || Quantity < 1)
  {
     if (Form.LANGUAGE.value == "FR")
      alert("Veuillez saisir une quantité valide s.v.p.");
	 else
	  alert("Please type a valid quantity.");
	  
	 Form.FINALRESULT.value = "";
     Form.QTY.focus();
     Form.QTY.select();
	 return false;
  }

  if (IsQuote == 1) {
   Msg = "https://secure.orologic.com/Estimate_Info.php"; 
   Form.action = "https://secure.orologic.com/Estimate_Info.php";
  }
  else {
   Msg = "https://secure.orologic.com/Order_Info.php";
   Form.action = "https://secure.orologic.com/Order_Info.php";
  }
 
  Form.QTY.value = Quantity;
  Form.P1QTY.value = Quantity;
  Form.P1PRO.value = Form.PRODUCT.value+"-001";
  Form.target = "_OroNewWin";
  Form.method = "post";
  
 
  if (Form.LANGUAGE.value == "FR") {
   Msg = Msg + "?Q"+Form.PRODUCT.value+"-001="+Quantity+"&LANG=FR&CURRENCY=";
  }
  else {
   Msg = Msg + "?Q"+Form.PRODUCT.value+"-001="+Quantity+"&LANG=EN&CURRENCY="; 
  }
  Form.LANG.value = Form.LANGUAGE.value;

  
	
  if (Form.CURRENCY_LONG.value == "CAD")  {
   Msg = Msg + "C";
   Form.CURRENCY.value = "C"; 
  }
  else {
   Msg = Msg + "U";
   Form.CURRENCY.value = "U"; 
  }

  Form.submit();  
  /*window.open(Msg,"_self");*/

  return true;
  
 }
 