function dp(string){
  number = string.length - string.indexOf('.');
  if (string.indexOf('.') == -1)
    return string + '.00';
  if (number == 1)
    return string + '00';
  if (number == 2)
    return string + '0';
  if (number > 3)
    return string.substring(0,string.length-number+3);
  return string;
}
var HelpIconFile  = "help.jpg";		
var FormFrameName = "principal";	
var GestForm = new Object();		
var ShowClearSelection = false;		
var ShowZeroQte = false;		
var ShowPageTotal = false;			
var ShowSectionTotal = false;			
var DontShowBorder = false;			
var CurrentCoeff = 0;				
var DiscountList = new Array()	
var NbDiscountList = 0;			
var MyLng = new OveramFormLanguage();

function OveramFormLanguage (){
  this.Item = "";
  this.Features = "";
  this.Quantity = "";
  this.Price = "";
  this.YourPrice = "";
  this.Total = "";
  this.PageTotal = "";
  this.SubTotal = "";
  this.Currency = "";
  this.Discount = "";
  this.NextPage = "";
  this.Terminate = "";
  this.BuyNow = "";
  this.ClearSelection = "";
  this.PreviousPage = "";
  this.Shipping = "";
  this.Country = "";
  this.States = "";
  this.PrefShipping = "";
  this.ShippingPrice = "";
  this.ClearConfirmation = "";
  this.NothingToBuy = "";
  this.LinkArticle = "";
}
function OveramForm(_EndPage, _MaxPage, _FormFrameName, _HelpIconFile, _ShowZeroQte, _ShowPageTotal, _ShowSectionTotal, _ShowClearSelection, _DontShowBorder){
  this.SysReady = false;			
  this.Content = new Array();			
  this.NbItem = 0;				
  this.Currency = new Array();		
  this.NbCurrency = 0;				
  this.Page = 1;					
  this.Actif = false;				
  this.CurrentCurrency = 0;			
  this.TotalDiscount = 0;			
  this.Total = 0;					
  this.TotalUS = 0;				
  this.STotal = 0;
  this.Poids = 0;
  this.EndPage = _EndPage;
  this.DLink = null;
  GestForm = this;	
  if (_ShowClearSelection) ShowClearSelection = true;		
  if (_FormFrameName) FormFrameName = _FormFrameName;
  if (_HelpIconFile) HelpIconFile = _HelpIconFile;
  if (_ShowZeroQte) ShowZeroQte = true;
  if (_ShowSectionTotal) ShowSectionTotal = true;
  if (_ShowPageTotal) ShowPageTotal = true;
  if (_DontShowBorder) DontShowBorder = true;
  this.MaxPage = (_MaxPage) ? _MaxPage : 1;
  this.Shipping = new FraisPorts(FormFrameName);    
  this.PageInfo = new Array();
  for (var i = 0; i < this.MaxPage; i++) {
    this.PageInfo[i] = new Object();
    this.PageInfo[i].Titre = null;
    this.PageInfo[i].Image = null;
  }
  this.CreateDL = CreateDL;
  this.AddCurrency = AddCurrency;
  this.AddDiscount = AddDiscount;
  this.AddS = AddSection;
  this.AddL = AddLigne;
  this.AddI = AddItem;
  this.AddC = AddChild;
  this.AddH = AddHelp;
  this.AddDL = AddDL;
  this.GoNextPage = GoNextPage;
  this.GoPreviousPage = GoPreviousPage;
  this.GoToPage = GoToPage;
  this.WritePage = WritePage;
  this.AddCountry = AddCountry;
  this.AddStates = AddStates;
  this.AddShipping = AddShipping;
  this.AddPrice = AddPrice;
  this.AddPageInfo = AddPageInfo;
  this.Refresh = Refresh;
  this.Select = Select;
  this.SetQte = SetQte;
  this.Calculate = Calculate;
  this.HelpClick = HelpClick;
  this.ClearSelection = ClearSelection;
}
function AddCountry (C,E){ this.Shipping.AddCountry(C,E); }
function AddStates (S,E){ this.Shipping.AddStates(S,E); }
function AddShipping (M,E){ this.Shipping.AddShipping(M,E); }
function AddPrice (C,S,M,P,BP,PR1,R1,PR2,R2,PR3,R3){ this.Shipping.AddPrice(C,S,M,P,BP,PR1, R1, PR2, R2, PR3, R3); }
function AddPageInfo (_Page, _Titre, _Image){
  with(this){
    if ((_Page < 1) || (_Page > MaxPage)) return;
    PageInfo[_Page - 1].Titre = _Titre;
  }
}
function CreateDL (_ShowTop, _ShowBottom, _MaxCol){

  if (this.DLink != null) return;
  this.DLink = new DirectLink (_ShowTop, _ShowBottom, _MaxCol);
}
function AddDL (_Page, _Etiquette, _ImgOff, _ImgOn){
  if (this.DLink == null) return;
  this.DLink.AddDL (_Page, _Etiquette, _ImgOff, _ImgOn);
}
function HelpClick(_SectionName, _LigneName){
  with (this){
    for (var i = 0; i < NbItem; i++) {
      if (Content[i].Name == _SectionName) {
        Content[i].HelpClick (_LigneName);
        break;
      }
    }
  }
}
function ClearSelection(){
  with(this){
    if (window.confirm(MyLng.ClearConfirmation) == false) return;
    CurrentCurrency = 0;
    TotalDiscount = 0;	
    Total = 0;
    TotalUS = 0;
    STotal = 0;
    Poids = 0;
    for (var i = 0; i < NbItem; i++) Content[i].ClearSelection();
    eval('frames.'+ FormFrameName + '.location = frames.'+ FormFrameName + '.location');
  }
}
function Refresh (){
  with (this){
    if (Page <= MaxPage){
      for (var i = 0; i < NbItem; i ++) Content[i].Refresh(Page);
      if (CurrentCurrency != 0) eval ('frames.' + FormFrameName + '.document.GLOBAL.CURRENCY.value='+ CurrentCurrency);
      Total = (TotalUS - TotalDiscount) * CurrentCoeff; 
      Calculate ();
    } 
    if (Page == (MaxPage + 1)){
      Shipping.Refresh (Currency);
      eval ('frames.' + FormFrameName + '.document.RECAPITULATIF.LOCATION.value=\"' + Shipping.Country[Shipping.CurrentCountry].Etiquette + ';' + Shipping.States[Shipping.CurrentState].Etiquette +'\"');
      eval ('frames.' + FormFrameName + '.document.RECAPITULATIF.SHIPPING.value=\"' + Shipping.Method[Shipping.CurrentMethod].Etiquette + '\"');
      eval ('frames.' + FormFrameName + '.document.RECAPITULATIF.SHIPPINGPRICE.value=\"' + dp("" + Shipping.TotalUS) + '\"');
    }
    Actif = true;
  }
}
function AddCurrency (_Etiquette, _Coeff){
  with (this){
    Currency[NbCurrency] = new Object;
    Currency[NbCurrency].Etiquette = _Etiquette;
    Currency[NbCurrency++].Coeff = _Coeff;
    if (CurrentCoeff == 0) CurrentCoeff = _Coeff;
  }
}
function AddDiscount (_Qte, _Coeff){

    DiscountList[NbDiscountList] = new Object();
    DiscountList[NbDiscountList].Qte = _Qte;
    DiscountList[NbDiscountList++].Coeff = (_Coeff > 1) ? _Coeff / 100 : _Coeff;
}
function SetQte (_SectionName, _Qte){

  with (this){
    for (var i = 0; i < NbItem; i++) {
      if (Content[i].Name == _SectionName) {
        Content[i].SetQte (_Qte);
        break;
      }
    }
  }
}
function AddChild(_SectionName, _LigneName, _ChildSection){
  with (this){
    for (var i = 0; i < NbItem; i++) {
      if (Content[i].Name == _SectionName) {
        Content[i].AddChild (_LigneName, _ChildSection);
        break;
      }
    }
  }
}
function AddHelp(_SectionName, _LigneName, _Link, _Titre, _Width, _Height, _Top, _Left, _ImgHelp){

  with (this){
    for (var i = 0; i < NbItem; i++) {
      if (Content[i].Name == _SectionName) {
        Content[i].AddHelp (_LigneName, _Link, _Titre, _Width, _Height, _Top, _Left, _ImgHelp);
        break;
      }
    }
  }
}
function Select(_SectionName, _LigneName){
  var i;
  with (this){
    if (Actif == false) return;
    Actif = false;

    if (Page == (MaxPage + 1)){
      Shipping.Select(Currency);
      Actif = true;
      eval ('frames.' + FormFrameName + '.document.RECAPITULATIF.LOCATION.value=\"' + Shipping.Country[Shipping.CurrentCountry].Etiquette + ';' + Shipping.States[Shipping.CurrentState].Etiquette +'\"');
      eval ('frames.' + FormFrameName + '.document.RECAPITULATIF.SHIPPING.value=\"' + Shipping.Method[Shipping.CurrentMethod].Etiquette + '\"');
      eval ('frames.' + FormFrameName + '.document.RECAPITULATIF.SHIPPINGPRICE.value=\"' + dp("" + Shipping.TotalUS) + '\"');
      return;
    }
    if ((_LigneName == null) && (_SectionName == null)){
      var NewCurrency = eval ('frames.' + FormFrameName + '.document.GLOBAL.CURRENCY.value');
      if (Currency[NewCurrency].Coeff == -1){
        eval ('frames.' + FormFrameName + '.document.GLOBAL.CURRENCY.value=' + CurrentCurrency);
      } else{
        CurrentCurrency = NewCurrency;
        CurrentCoeff = Currency[CurrentCurrency].Coeff;
      }
      Refresh();
      return;      
    }
    for (i = 0; i < NbItem; i++) {
      if (Content[i].Name == _SectionName) {
        Content[i].Select (_LigneName);
        break;
      }
    }
    Calculate();
    Actif = true;
  }
}
function Calculate (){
  with (this){
    TotalDiscount =0;
    TotalUS = 0;
    Poids = 0;
    STotal = 0;
    for (i = 0; i < NbItem; i++){
      TotalDiscount += Content[i].TotalDiscount;
      TotalUS += Content[i].TotalUS;
      Poids += Content[i].Poids;
      STotal += (Page == Content[i].Page) ? Content[i].TotalUS : 0;
    }
    Total = (TotalUS - TotalDiscount) * CurrentCoeff;
    eval ('frames.' + FormFrameName + '.document.GLOBAL.TOTAL.value=\"' + dp("" + Total) + '\"');
    eval ('frames.' + FormFrameName + '.document.GLOBAL.DISCOUNT.value=\"' + dp("" + (TotalDiscount * CurrentCoeff)) + '\"');
    if (ShowPageTotal) eval ('frames.' + FormFrameName + '.document.GLOBAL.STOTAL.value=\"' + dp("" + (STotal * CurrentCoeff)) + '\"');
  }
}
function GoNextPage(){
  with (this){
    Actif = false;
    if (++Page > MaxPage){
      if (TotalUS == 0) Page = 1;
    }
     if (SysReady) eval('frames.'+ FormFrameName + '.location = frames.'+ FormFrameName + '.location');
  }
}
function GoPreviousPage(){
  with (this){
    Actif = false;
    if (--Page < 1) Page = MaxPage;
    if (SysReady) eval('frames.'+ FormFrameName + '.location = frames.'+ FormFrameName + '.location');
  }
}
function GoToPage(_Page){
  with (this){
    Actif = false;
    Page = _Page;
    if ((_Page == MaxPage + 1) && (TotalUS == 0)){
      if (SysReady) window.alert(MyLng.NothingToBuy);
      Page = 1;
    }
    if (_Page < 1) Page = 1;
    if (_Page > MaxPage + 1) Page = MaxPage;
    if (SysReady) eval('frames.'+ FormFrameName + '.location = frames.'+ FormFrameName + '.location');
  }
}
function AddSection (_Name, _Etiquette, _Page, _ShowSubTotal){

  with (this){
    for (var i = 0; i < NbItem; i ++) if (Content[i].Name == _Name) return;
      Content[NbItem ++] = new SectionForm (_Name, _Etiquette, _Page, _ShowSubTotal);
  }
}
function AddLigne (_SectionName, _Name, _Etiquette, _MaxQte, _Poids){
  with (this){
    for (var i = 0; i < NbItem; i++){
      if (Content[i].Name == _SectionName){
        Content[i].AddLigne (_Name, _Etiquette, _MaxQte,_Poids);
        break;
      }
    }
  }
}
function AddItem (_SectionName, _LigneName, _Content, _Price, _Poids, _Link, _Misc){
  with (this){

    for (var i = 0; i < NbItem; i++){
      if (Content[i].Name == _SectionName){
        Content[i].AddItem (_LigneName, _Content, _Price, _Poids, _Link, _Misc);
        break;
      }
    }
  }
} 



var ComponentToSend = new Array()	

ComponentToSend[1] = "laptop_model";
ComponentToSend[2] = "laptop_screen";
ComponentToSend[3] = "laptop_processor";
ComponentToSend[4] = "laptop_fsb";
ComponentToSend[5] = "laptop_harddrive";
ComponentToSend[6] = "laptop_memory";
ComponentToSend[7] = "laptop_optical";
ComponentToSend[8] = "laptop_smartbay";
ComponentToSend[9] = "laptop_raid";
ComponentToSend[10] = "laptop_graphics";
ComponentToSend[11] = "laptop_sound";
ComponentToSend[12] = "laptop_speakers";
ComponentToSend[13] = "laptop_camera";
ComponentToSend[14] = "laptop_floppy";
ComponentToSend[15] = "laptop_lan";
ComponentToSend[16] = "laptop_wifi";
ComponentToSend[17] = "laptop_modem";
ComponentToSend[18] = "laptop_bluetooth";
ComponentToSend[19] = "laptop_usbports";
ComponentToSend[20] = "laptop_firewire";
ComponentToSend[21] = "laptop_infrared";
ComponentToSend[22] = "laptop_pcmcia";
ComponentToSend[23] = "laptop_flash";
ComponentToSend[24] = "laptop_tuner";
ComponentToSend[25] = "laptop_player";
ComponentToSend[26] = "laptop_ports";
ComponentToSend[27] = "laptop_video";
ComponentToSend[28] = "laptop_audio";
ComponentToSend[29] = "laptop_keyboard";
ComponentToSend[30] = "laptop_battery";
ComponentToSend[31] = "laptop_os";
ComponentToSend[32] = "laptop_recovery";
ComponentToSend[33] = "laptop_partition";
ComponentToSend[34] = "laptop_transformer";
ComponentToSend[35] = "laptop_cord";
ComponentToSend[36] = "laptop_manual";
ComponentToSend[37] = "laptop_drivers";
ComponentToSend[38] = "laptop_bag";
ComponentToSend[39] = "laptop_weight";
ComponentToSend[40] = "laptop_dimensions";
ComponentToSend[41] = "laptop_remarks";
ComponentToSend[42] = "laptop_warranty";
ComponentToSend[43] = "laptop_pixels";
ComponentToSend[44] = "laptop_priority";
ComponentToSend[45] = "laptop_office";
ComponentToSend[46] = "laptop_account";
ComponentToSend[47] = "laptop_communic";
ComponentToSend[48] = "laptop_remote_man";
ComponentToSend[49] = "laptop_inverter";
ComponentToSend[50] = "laptop_light";
ComponentToSend[51] = "laptop_cool_pad";
ComponentToSend[52] = "laptop_replicator";
ComponentToSend[53] = "laptop_keypad";
ComponentToSend[54] = "laptop_wap";
ComponentToSend[55] = "laptop_biometrics";
ComponentToSend[56] = "laptop_soft_secu";
ComponentToSend[57] = "laptop_antivirus";
ComponentToSend[58] = "laptop_spyware";
ComponentToSend[59] = "laptop_firewall";
ComponentToSend[60] = "laptop_spam";
ComponentToSend[61] = "laptop_extra";

var ComponentCount = 1;
var LaptopIdentifier = "laptop_name";

function WritePage (){
  var TempTotal = 0, ToWrite = "";

  with (this){
    SysReady = true;
    if ((Page <= MaxPage) && (DLink != null)) ToWrite += DLink.WriteDL(true);
    ToWrite += "<TABLE BORDER=\"";
    ToWrite +=(DontShowBorder) ? 0 : 1;
    ToWrite +="\" CELLPADDING=\"0\" CELLSPACING=\"0\" ALIGN=\"CENTER\"><TR><TD><TABLE BORDER=\"0\">";
    if (Page > MaxPage){
      ToWrite += Shipping.WritePage(Currency, NbCurrency, Poids, CurrentCurrency);
	ToWrite += "<TR><TD COLSPAN=\"3\"><P ALIGN=\"CENTER\"><FORM NAME=\"RECAPITULATIF\" action=\"" + EndPage + "\">";
      for (var i = 0; i < NbItem; i ++){
        for (var j = 0; j < Content[i].NbItem; j ++){
          
if (Content[i].Content[j].CurrentSel.Etiquette != "") {

if (ComponentCount == "1") {


ToWrite+= "<INPUT NAME = \"" + LaptopIdentifier + "\" TYPE=\"HIDDEN\" VALUE=\"" + Content[i].Content[j].CurrentSel.Etiquette + "\">";
var ComputerUnits = Content[i].Content[j].CurrentSel.Qte;

ToWrite+= "<INPUT NAME = \"" + ComponentToSend[ComponentCount] + "\" TYPE=\"HIDDEN\" VALUE=\"" + Content[i].Content[j].CurrentSel.Etiquette + "\">";

} else {

ToWrite+= "<INPUT NAME = \"" + ComponentToSend[ComponentCount] + "\" TYPE=\"HIDDEN\" VALUE=\"" + Content[i].Content[j].CurrentSel.Etiquette + Content[i].Content[j].CurrentSel.Misc + "\">";

}
}

ComponentCount ++;


        }
      }
      for (i = 1; i <= MaxPage; i ++){
        TempTotal = 0;
        for (j = 0; j < NbItem; j ++) TempTotal += (Content[j].Page == i) ? Content[j].TotalUS : 0;
        ToWrite += "<INPUT TYPE=\"HIDDEN\" NAME=\"STPAGE " + i + "\" VALUE = \"" + dp ("" + TempTotal) + "\">";
      }

      ToWrite += "<INPUT TYPE=\"HIDDEN\" NAME=\"UNITS\" VALUE=\"" + ComputerUnits + "\">";
      ToWrite += "<INPUT TYPE=\"HIDDEN\" NAME=\"DISCOUNT\" VALUE=\"" + dp ("" + TotalDiscount) + "\">";
      ToWrite += "<INPUT TYPE=\"HIDDEN\" NAME=\"TOTAL\" VALUE=\"" + dp ("" + TotalUS) + "\">";
      ToWrite += "<INPUT TYPE=\"HIDDEN\" NAME=\"LOCATION\"><INPUT TYPE=\"HIDDEN\" NAME=\"SHIPPING\">";
      ToWrite += "<INPUT TYPE=\"HIDDEN\" NAME=\"SHIPPINGPRICE\">";
      ToWrite += "<P ALIGN=\"CENTER\"> <INPUT TYPE=\"SUBMIT\" VALUE=\"" + MyLng.Terminate + "\"> </P>";       
      ToWrite += "</FORM></P></TD></TR>";
   } else {
      ToWrite +="<TR><TD COLSPAN=\"5\">&nbsp;</TD></TR>";
      if (PageInfo[Page -1].Titre) ToWrite += "<TR><TD COLSPAN=\"5\"><P CLASS=\"TPAGE\">" + PageInfo[Page-1].Titre + "</P></TD></TR><TR><TD COLSPAN=\"5\">&nbsp;</TD></TR>";
      ToWrite +="<TR><TD><P CLASS=\"TITRE\">" + MyLng.Item + "</P></TD><TD><P CLASS=\"TITRE\">" + MyLng.Features + "</P></TD><TD><P CLASS=\"TITRE\">" + MyLng.Quantity + "</P></TD><TD><P CLASS=\"TITRE\">" + MyLng.Price + "</P></TD><TD>&nbsp;</TD></TR><TR><TD COLSPAN=\"5\">&nbsp;</TD></TR>";
      for (var i = 0; i < NbItem; i++) ToWrite += Content[i].WriteSection (Page);
      ToWrite += "<TR><TD COLSPAN=\"5\">&nbsp;</TD</TR><TR><TD COLSPAN=\"5\"><P CLASS=\"TITRE\">" + MyLng.YourPrice + "</P></TD></TR><TR><TD COLSPAN=\"5\">&nbsp;</TD</TR><FORM NAME=\"GLOBAL\">";
      if (ShowPageTotal) ToWrite +="<TR><TD COLSPAN=\"3\"><P CLASS=\"SECTOTAL\">" + MyLng.PageTotal + "</P></TD><TD COLSPAN=\"3\"><INPUT TYPE=\"TEXT\" VALUE=\"0.00\" NAME=\"STOTAL\" SIZE=\"10\"></TD></TR><TR><TD COLSPAN=\"6\">&nbsp;</TD></TR>";
      ToWrite+="<TR><TD COLSPAN=\"2\">&nbsp;</TD><TD><P CLASS=\"ETIQUETTE2\">" + MyLng.Discount + "</P></TD><TD COLSPAN=\"2\"><INPUT TYPE=\"TEXT\" NAME=\"DISCOUNT\" SIZE=\"10\" VALUE=\"0.00\"></TD></TR>"
      ToWrite += "<TR><TD><P CLASS=\"ETIQUETTE2\">" + MyLng.Currency + "</P></TD><TD><SELECT NAME=\"CURRENCY\" onchange=\"javascript:parent.GestForm.Select()\">";
      for (i = 0; i < NbCurrency; i ++) ToWrite += "<OPTION VALUE=\"" + i + "\">"+Currency[i].Etiquette +"</OPTION>";
      ToWrite+="</SELECT></TD><TD><P CLASS=\"ETIQUETTE3\">"+ MyLng.Total + "</P></TD><TD COLSPAN=\"3\"><INPUT TYPE=\"TEXT\" NAME=\"TOTAL\" SIZE=\"10\" VALUE=\"0.00\"></TD></TR>"
      ToWrite+="<TR><TD COLSPAN=\"6\">&nbsp;</TD></TR></FORM>";
      ToWrite+="<TR><TD COLSPAN=\"6\"><P ALIGN=\"CENTER\"><SPAN CLASS=\"CMDBUTTON\" ONCLICK=\"Javascript:parent.GestForm.GoPreviousPage();\">" + MyLng.PreviousPage + "</SPAN>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <SPAN CLASS=\"CMDBUTTON\" ONCLICK=\"Javascript:parent.GestForm.GoNextPage();\">" + MyLng.NextPage + "</SPAN>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <SPAN CLASS=\"CMDBUTTON\" ONCLICK=\"Javascript:parent.GestForm.GoToPage(" + (MaxPage + 1) + ");\">" + MyLng.BuyNow + "</SPAN>"
	if (ShowClearSelection) ToWrite += "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <SPAN CLASS=\"CMDBUTTON\" ONCLICK=\"Javascript:parent.GestForm.ClearSelection();\">" + MyLng.ClearSelection + "</SPAN>";
      ToWrite+="</P></TD</TR><TR><TD COLSPAN=\"6\">&nbsp;</TD></TR>";
    }
    ToWrite +="</TABLE></TD></TR></TABLE>";
    if ((Page <= MaxPage) && (DLink != null)){
      ToWrite +="<p>&nbsp;</p>"; 
      ToWrite += DLink.WriteDL(false);
    }
  }
  return ToWrite;
} 
function SectionForm (_Name, _Etiquette, _Page, _ShowSubTotal){
  this.Name = _Name;				
  this.Etiquette = _Etiquette;		
  this.Page = (_Page) ? _Page :  1;		
  this.Content = new Array();			
  this.NbItem = 0;				
  this.TotalDiscount = 0;			
  this.TotalUS = 0;			
  this.Total= 0;
  this.TotalPage = 0;
  this.Poids = 0;
  this.ShowSubTotal = (_ShowSubTotal) ? true : ShowSectionTotal;
  this.ClearSelection = SectionFormClearSelection;
  this.AddHelp = SectionFormAddHelp;
  this.AddLigne = SectionFormAddLigne;
  this.AddItem = SectionFormAddItem;
  this.WriteSection = WriteSection;
  this.Select = SectionFormSelect;
  this.AddChild = SectionFormAddChild;
  this.SetQte = SectionFormSetQte;
  this.Refresh = SectionFormRefresh;
  this.Calculate = SectionFormCalculate;
  this.HelpClick = SectionFormHelpClick;
}
function SectionFormClearSelection(){
  with (this){
    TotalDiscount = 0;
    TotalUS = 0;	
    Total= 0;
    TotalPage = 0;
    Poids = 0;
    for (var i = 0; i < NbItem; i++) Content[i].ClearSelection();
  }
}
function SectionFormHelpClick(_LigneName){
  with (this){
    for (var i = 0; i < NbItem; i++) {
      if (Content[i].Name == _LigneName) {
        Content[i].HelpClick ();
        break;
      }
    }
  }
}
function SectionFormRefresh (_Page){
  with (this){
    if (Page != _Page) return;
    for (var i = 0; i < NbItem; i++) Content[i].Refresh();

    Total = TotalUS * CurrentCoeff;
    if (ShowSubTotal) eval ('frames.' + FormFrameName + '.document.' + Name + '.STOTAL.value=\"' + dp("" + Total) +'\"');
  }
}
function SectionFormSetQte(_Qte){

  with (this){
    for (var i = 0; i < NbItem; i++) Content[i].SetQte (_Qte);
    Calculate();
  }
}
function SectionFormSelect (_Name){
  with (this){
    for (var i = 0; i < NbItem; i++) {
      if (Content[i].Name == _Name) {
        Content[i].Select ();
        break;
      }
    }
    Calculate();
  }
}
function SectionFormCalculate(){
  var info;
  with (this){
    TotalDiscount = 0;
    TotalUS = 0;
    Poids = 0;
    for (var i = 0; i < NbItem; i++){
      info = Content[i].GetSelection();
      TotalDiscount += info.Discount;
      TotalUS += info.SubTotalUS;
      Poids += info.Poids;
    }
    Total = TotalUS * CurrentCoeff;
    if (ShowSubTotal) eval ('frames.' + FormFrameName + '.document.' + Name + '.STOTAL.value=\"' + dp("" + Total) +'\"');
   }
}
function SectionFormAddLigne (_Name, _Etiquette, _MaxQte, _Poids){
  with (this){
    for (var i = 0; i < NbItem; i++) if (Content[i].Name == _Name) return;
    Content[NbItem++] = new LigneForm (Name, _Name, _Etiquette, _MaxQte, _Poids);
  }  
}
function SectionFormAddItem (_LigneName, _Content, _Price, _Poids, _Link, _Misc){
  with (this){
    for (var i = 0; i < NbItem; i++){
      if (Content[i].Name == _LigneName){
        Content[i].AddItem (_Content, _Price, _Poids, _Link, _Misc);
        break;
      }
    }
  }
}
function SectionFormAddHelp (_Name, _Link, _Titre, _Width, _Height, _Top, _Left, _ImgHelp){
  with (this){
    for (var i = 0; i < NbItem; i++) {
      if (Content[i].Name == _Name) {
        Content[i].AddHelp (_Link, _Titre, _Width, _Height, _Top, _Left, _ImgHelp);
        break;
      }
    }
  }
}
function SectionFormAddChild (_Name, _ChildSection){
  with (this){
    for (var i = 0; i < NbItem; i++) {
      if (Content[i].Name == _Name) {
        Content[i].AddChild (_ChildSection);
        break;
      }
    }
  }
}
function WriteSection (_Page){
  var ToWrite = ""

  if (this.Page == _Page) with (this){

    ToWrite += "<FORM NAME=\"" + Name + "\"><TR><TD><P CLASS=\"SUB\">"+ Etiquette + "</P></TD><TD COLSPAN=\"4\">&nbsp;</TD></TR>";

    for (var i=0; i < NbItem; i++) ToWrite += Content[i].WriteLigne();
    ToWrite += "<TR><TD COLSPAN=\"5\">&nbsp;</TD></TR>";

    if (ShowSubTotal) ToWrite += "<TR><TD COLSPAN=\"3\"><P CLASS=\"SECTOTAL\">" + MyLng.SubTotal + "</P></TD><TD><INPUT TYPE=\"TEXTE\" SIZE=\"10\" VALUE=\"0.00\" NAME=\"STOTAL\"></TD><TD>&nbsp;</TD></TR>";
    ToWrite += "</FORM>";
  }
  return ToWrite;
}
function LigneForm (_SectionName, _Name, _Etiquette, _MaxQte, _Poids){
  this.SectionName = _SectionName;		
  this.Name = _Name;				
  this.Etiquette = _Etiquette;		
  this.Content = new Array();			
  this.MaxQte = (_MaxQte) ? _MaxQte : 0;	
  this.NbItem = 0;				
  this.ImgHelp = ""
  this.CurrentSel = new Object();
  this.ChildSection = new Array();		
  this.NbChild = 0;				
  this.Link = "";				
  this.LinkTitre = "";				
  this.LinkOptions = "";			
  this.Poids = (_Poids) ? _Poids : 0;	
  this.ClearSelection = LigneFormClearSelection;
  this.AddHelp = LigneFormAddHelp; 
  this.AddChild = LigneFormAddChild;
  this.WriteLigne = WriteLigne;
  this.AddItem = LigneFormAddItem;
  this.Select = LigneFormSelect;
  this.SetQte = LigneFormSetQte;
  this.Refresh = LigneFormRefresh;
  this.GetSelection = LigneFormGetSelection;
  this.Calculate = LigneFormCalculate;
  this.HelpClick = LigneFormHelpClick;
  this.ClearSelection();
}
function LigneFormClearSelection(){
  with (this){
    this.CurrentSel.Qte = 0               
    this.CurrentSel.Item = 0;	            
    this.CurrentSel.Etiquette = ""		
    this.CurrentSel.SubTotalUS = 0;		
    this.CurrentSel.SubTotal = 0;	     
    this.CurrentSel.Discount = 0;		
    this.CurrentSel.Poids = 0;           
    this.CurrentSel.Misc = "";
  }
}
function LigneFormAddHelp (_Link, _Titre, _Width, _Height, _Top, _Left, _ImgHelp){
  with (this){
    if (_Titre.indexOf (' ') != -1) return;
    Link = _Link;
    LinkTitre = _Titre;
    ImgHelp = (_ImgHelp) ? _ImgHelp : HelpIconFile;
    if ((_Width > 0) || (_Height > 0) || (_Top >= 0) || (_Left >= null))
      LinkOptions = "scrollbars=yes,resizable=no,width=" + _Width + ",height="+ _Height + ",top=" + _Top + ",left=" + _Left;
    else
      LinkOptions = "scrollbars=yes,resizable=yes";
  }
}
function LigneFormHelpClick(){
  with (this){
    if (CurrentSel.Link != null){
      if (CurrentSel.Link != "_NoLink") window.open (CurrentSel.Link, LinkTitre, LinkOptions);
    }else{
      if (Link !="_NoLink") window.open (Link, LinkTitre, LinkOptions);
    }
  }
}
function LigneFormGetSelection(){
  return (this.CurrentSel);
}
function LigneFormRefresh(){
  with (this){
    for (var i = 0; i < NbItem; i++){

      if (CurrentSel.Item > 0) eval ('frames.' + FormFrameName + '.document.' + SectionName + '.' + Name + '.value='+ CurrentSel.Item);
      if ((MaxQte != 0) && (CurrentSel.Qte > 0)) eval ('frames.' + FormFrameName + '.document.' + SectionName + '.Qte' + Name + '.value='+ CurrentSel.Qte);
      CurrentSel.SubTotal = CurrentSel.SubTotalUS * CurrentCoeff;
      if (CurrentSel.SubTotal != 0) eval ('frames.' + FormFrameName + '.document.' + SectionName + '.Tot' + Name + '.value=\"'+ dp("" + CurrentSel.SubTotal) + '\"');
    }
  }
}
function LigneFormAddChild(_ChildSection){
  with (this){
    ChildSection[NbChild++]=_ChildSection;
  }
}
function LigneFormSetQte (_Qte){
  with (this){
    CurrentSel.Qte = _Qte;
    Calculate ();
  }
}
function LigneFormSelect (){
  var NewQte;
  with (this){
    var NewItem = eval ('frames.' + FormFrameName + '.document.' + SectionName + '.' + Name + '.value');
    if (Content[NewItem].Price != -1) {
      CurrentSel.Item = NewItem
      CurrentSel.Etiquette = Content[NewItem].Etiquette;
      CurrentSel.Link = Content[NewItem].Link;
      CurrentSel.Misc = Content[NewItem].Misc;
      if (MaxQte != 0){
        NewQte = eval ('frames.' + FormFrameName + '.document.' + SectionName + '.Qte' + Name + '.value');
        if (Content[NewItem].Price == 0){
          CurrentSel.Qte = 0;
          eval ('frames.' + FormFrameName + '.document.' + SectionName + '.Qte' + Name + '.value=0');
        } else {
          if (NewQte == 0){
            if (CurrentSel.Qte == 0) eval ('frames.' + FormFrameName + '.document.' + SectionName + '.Qte' + Name + '.value=1');
            CurrentSel.Qte = (CurrentSel.Qte == 0) ? 1 : 0;
          } else CurrentSel.Qte = NewQte;
        }
        for (var i = 0; i < NbChild; i++) GestForm.SetQte(ChildSection[i], CurrentSel.Qte);
      } else if (CurrentSel.Qte == 0) window.alert(MyLng.LinkArticle);
    } else eval ('frames.' + FormFrameName + '.document.' + SectionName + '.' + Name + '.value='+ CurrentSel.Item);
  Calculate ();
  }
}  
function LigneFormCalculate(){
  var CoeffDiscount = 0;
  with (this){
   CurrentSel.Poids = ((Content[CurrentSel.Item].Poids) ? Content[CurrentSel.Item].Poids : Poids) * CurrentSel.Qte;
    for (var i=0; i < NbDiscountList; i ++) if (CurrentSel.Qte >= DiscountList[i].Qte) CoeffDiscount = DiscountList[i].Coeff;
    CurrentSel.SubTotalUS = Content[CurrentSel.Item].Price * CurrentSel.Qte;
    CurrentSel.Discount = CurrentSel.SubTotalUS * CoeffDiscount;
    CurrentSel.SubTotal = CurrentSel.SubTotalUS * CurrentCoeff;
    eval ('frames.' + FormFrameName + '.document.' + SectionName + '.Tot' + Name + '.value=\"'+ dp("" + CurrentSel.SubTotal) + '\"');
  }
}
function LigneFormAddItem(_Etiquette, _Price, _Poids, _Link, _Misc){
  with (this){  
    Content[NbItem] = new Object();
    Content[NbItem].Etiquette = _Etiquette;
    Content[NbItem].Price = (_Price) ? _Price : 0;
    Content[NbItem].Link = _Link;
    Content[NbItem].Misc = _Misc;
    Content[NbItem++].Poids = _Poids;			
  }
}
function WriteLigne(){
  with(this){
    var ToWrite = "<TR><TD><P CLASS=\"ETIQUETTE\">" + Etiquette + "</P></TD>";
    ToWrite += "<TD><P><SELECT NAME=\"" + Name + "\" onchange=\"parent.GestForm.Select(\'" + SectionName + "\',\'" + Name + "\');\">";
    for (var i = 0; i < NbItem; i++){
      ToWrite += "<OPTION VALUE=\"" + i + "\">"+ Content[i].Etiquette + "</OPTION>";
    }
    ToWrite +="</SELECT></TD>";
    if (MaxQte == 0){
      if (!ShowZeroQte)
        ToWrite += "</P><TD><P>&nbsp;";
      else
        ToWrite +=" </P><TD><P ALIGN=\"CENTER\"><SELECT NAME=\"Qte" + Name + "\" size=\"1\"><OPTION VALUE=\"0\">*</OPTION>";
    }else {
      ToWrite += "</P><TD><P ALIGN=\"CENTER\"><SELECT NAME=\"Qte"  + Name + "\" size=\"1\" onchange=\"parent.GestForm.Select(\'" + SectionName + "\',\'" + Name + "\');\">";
      var Valid = 10;
      for (var i = 0; i <= MaxQte; i++){
        if (i > 10) Valid ++
        if ((i <= 10) || (Valid == 25)) ToWrite += "<OPTION VALUE=\"" + i + "\">"+ i + "</OPTION>";
        if (Valid == 25) Valid = 0;
      }
      ToWrite += "</SELECT>";
    }
    ToWrite +="</P></TD>";
    ToWrite +="<TD><P ALIGN=\"CENTER\"><INPUT TYPE=\"TEXT\" NAME=\"Tot" + Name +"\" SIZE=\"10\" VALUE=\"0.00\"></P></TD><TD>";
    if (Link) 
      ToWrite+="<P CLASS=\"LIEN\"><IMG SRC=\""+ ImgHelp + "\" BORDER=\"0\" ALT=\"" + LinkTitre + "\" onclick = \"javascript:parent.GestForm.HelpClick(\'" + SectionName + "\', \'" + Name + "\');\"></P>";
    else
      ToWrite+="&nbsp;"
    ToWrite+="</TD></TR>";
    return ToWrite;
  }
}  
function FraisPorts (_FormFrameName){
  this.Country = new Array();		
  this.NbCountry = 0;				
  this.States = new Array ();			
  this.NbStates = 0;				
  this.Method = new Array();    		
  this.NbMethod = 0;	        		
  this.Price = new Array();			
  this.NbPrice = 0;				
  this.FormFrameName = _FormFrameName;	
  this.CurrentCurrency = 0;			
  this.Poids = 0;					
  this.CurrentCountry = 0;			
  this.CurrentState = 0;			
  this.CurrentMethod = 0;			
  this.Total = 0;					
  this.TotalUS = 0;				
  this.AddCountry = PortAddCountry;
  this.AddStates = PortAddStates;
  this.AddShipping = PortAddMethod;
  this.AddPrice = PortAddPrice;
  this.Select = PortSelect;
  this.WritePage = PortWritePage;
  this.Refresh = PortRefresh;
  this.Valid = PortValid;
}
function PortAddCountry(_Name, _Etiquette){
  with (this){
    Country[NbCountry] = new Object();
    Country[NbCountry].Name = _Name;
    Country[NbCountry++].Etiquette = _Etiquette;
  }
}
function PortAddStates (_Name, _Etiquette){
  with (this){
    States[NbStates] = new Object();
    States[NbStates].Name = _Name;
    States[NbStates++].Etiquette = _Etiquette;
  }
}
function PortAddMethod (_Name, _Etiquette){
  with (this){
    Method[NbMethod] = new Object();
    Method[NbMethod].Name = _Name;
    Method[NbMethod++].Etiquette = _Etiquette;
  }
}
function PortAddPrice (_Country, _States, _Method, _Price, _PriceBase, _ReducPoids1, _PriceReduc1, _ReducPoids2, _PriceReduc2, _ReducPoids3, _PriceReduc3){
  with (this){
    Price[NbPrice] = new Object();
    Price[NbPrice].Country = _Country;
    Price[NbPrice].States = _States;
    Price[NbPrice].Method = _Method;
    Price[NbPrice].PriceBase = (_PriceBase) ? _PriceBase : 0;
    Price[NbPrice].ReducPoids1 = (_ReducPoids1) ? _ReducPoids1 : 0;
    Price[NbPrice].ReducPoids2 = (_ReducPoids2) ? _ReducPoids1 : 0;
    Price[NbPrice].ReducPoids3 = (_ReducPoids3) ? _ReducPoids1 : 0;
    Price[NbPrice].PriceReduc1 = (_PriceReduc1) ? _PriceReduc1 : 0;
    Price[NbPrice].PriceReduc2 = (_PriceReduc2) ? _PriceReduc2 : 0;
    Price[NbPrice].PriceReduc3 = (_PriceReduc3) ? _PriceReduc3 : 0;
    Price[NbPrice++].Price = (Price) ? _Price : 0;
  }
}
function PortRefresh(_Currency){
  with (this){
    eval ('frames.'+ FormFrameName + '.document.SHIPPING.COUNTRY.value='+CurrentCountry);   
    eval ('frames.'+ FormFrameName + '.document.SHIPPING.STATES.value='+CurrentState);
    eval ('frames.'+ FormFrameName + '.document.SHIPPING.METHOD.value='+CurrentMethod);
    eval ('frames.'+ FormFrameName + '.document.SHIPPING.CURRENCY.value='+CurrentCurrency);
    Valid (_Currency);
  }
}
function PortSelect(_Currency){
  var NewCountry, NewState, NewMethod, NewCurrency;
  with (this){
    if ((NbCountry == 0) || (NbStates == 0) || (NbMethod == 0) || (NbPrice ==0)) return;
    NewCountry = eval ('frames.'+ FormFrameName + '.document.SHIPPING.COUNTRY.value');
    if (Country[NewCountry].Name == -1){
      NewCountry = CurrentCountry;
      eval ('frames.'+ FormFrameName + '.document.SHIPPING.COUNTRY.value='+CurrentCountry);
    }
    NewState = eval ('frames.'+ FormFrameName + '.document.SHIPPING.STATES.value');
    if (States[NewState].Name == -1){
      NewState = CurrentState;
      eval ('frames.'+ FormFrameName + '.document.SHIPPING.STATES.value='+CurrentState);
    }
    NewMethod = eval ('frames.'+ FormFrameName + '.document.SHIPPING.METHOD.value');
    if (Method[NewMethod].Name == -1){
      NewMethod = CurrentMethod;
      eval ('frames.'+ FormFrameName + '.document.SHIPPING.METHOD.value='+CurrentMethod);
    }
    NewCurrency = eval ('frames.'+ FormFrameName + '.document.SHIPPING.CURRENCY.value');
    if (_Currency[NewCurrency].Coeff == -1){
      NewCurrency = CurrentCurrency;
      eval ('frames.'+ FormFrameName + '.document.SHIPPING.CURRENCY.value='+CurrentCurrency);
    }
    CurrentCurrency = NewCurrency;
    CurrentCountry = NewCountry;
    CurrentState = NewState;
    CurrentMethod = NewMethod;
    Valid(_Currency);
  }
}
function PortValid(_Currency){
  var Best = 0, LevelBest = 0;
  with (this){
    for (var i = 0; i < NbPrice; i++){
      if (Price[i].Country == Country[CurrentCountry].Name){
        Best = (LevelBest > 0) ? Best : i;
        LevelBest = (LevelBest > 0) ? LevelBest : 1;
        if (Price[i].States == States[CurrentState].Name){
          Best = (LevelBest > 1) ? Best : i;
          LevelBest = (LevelBest > 1) ? LevelBest : 2;
          if (Price[i].Method == Method[CurrentMethod].Name){
             Best = i;
             LevelBest = 3;
             break;
          }
        }
      }
    }
    if (LevelBest < 1){
      for (i = 0; i < NbCountry; i++) if (Country[i].Name == Price[Best].Country){
        CurrentCountry = i
        break;
      }     
      eval ('frames.'+ FormFrameName + '.document.SHIPPING.COUNTRY.value='+CurrentCountry);
    } 
    if (LevelBest < 2){
      for (i = 0; i < NbStates; i++) if (States[i].Name == Price[Best].States){
        CurrentState = i;
        break;
      }
      eval ('frames.'+ FormFrameName + '.document.SHIPPING.STATES.value='+CurrentState);
    }
    if (LevelBest < 3){
      for (i = 0; i < NbMethod; i++) if (Method[i].Name == Price[Best].Method){
        CurrentMethod = i;
        break;
      }
      eval ('frames.'+ FormFrameName + '.document.SHIPPING.METHOD.value='+CurrentMethod);
    } 
    TotalUS = Price[Best].Price * Poids + Price[Best].PriceBase;
    if (Poids >= Price[Best].ReducPoids1) TotalUS = TotalUS - Price[Best].PriceReduc1 * (Poids - Price[Best].ReducPoids1);
    if (Poids >= Price[Best].ReducPoids2) TotalUS = TotalUS - Price[Best].PriceReduc2 * (Poids - Price[Best].ReducPoids2);
    if (Poids >= Price[Best].ReducPoids3) TotalUS = TotalUS - Price[Best].PriceReduc3 * (Poids - Price[Best].ReducPoids3);
     Total = TotalUS * _Currency[CurrentCurrency].Coeff;
    eval ('frames.'+ FormFrameName + '.document.SHIPPING.SHIPPING.value=\"'+dp ("" + Total)+'\"');
  }
}
function PortWritePage (_Currency, _NbCurrency, _Poids, _CurrentCurrency){
  var ToWrite = "<TR><TD COLSPAN=\"3\">&nbsp;</TD></TR><TR><TD COLSPAN=\"3\"><P CLASS=\"TITRE\">" + MyLng.Shipping + "</P></TD></TR><TR><TD COLSPAN=\"3\">&nbsp;</TD></TR>";
  with (this){
    Poids = _Poids
    CurrentCurrency = _CurrentCurrency;
    ToWrite += "<FORM NAME=\"SHIPPING\"><TR><TD><P CLASS=\"ETIQUETTE2\">" + MyLng.Country + "</P></TD><TD><SELECT NAME=\"COUNTRY\" onchange=\"parent.GestForm.Select()\">";
    for (var i = 0; i < NbCountry; i++) ToWrite += "<OPTION VALUE=\"" + i + "\">"+ Country[i].Etiquette + "</OPTION>";
    ToWrite += "</SELECT></TD><TD>&nbsp;</TD></TR><TR><TD><P CLASS=\"ETIQUETTE2\">" + MyLng.States + "</P></TD><TD><SELECT NAME=\"STATES\" onchange=\"parent.GestForm.Select()\">";
    for (var i = 0; i < NbStates; i++) ToWrite += "<OPTION VALUE=\"" + i + "\">"+ States[i].Etiquette + "</OPTION>";
    ToWrite += "</SELECT></TD><TD>&nbsp;</TD></TR><TR><TD><P CLASS=\"ETIQUETTE2\">" + MyLng.PrefShipping + "</P></TD><TD><SELECT NAME=\"METHOD\" onchange=\"parent.GestForm.Select()\">";
    for (var i = 0; i < NbMethod; i++) ToWrite += "<OPTION VALUE=\"" + i + "\">"+ Method[i].Etiquette + "</OPTION>";
    ToWrite += "</SELECT></TD><TD>&nbsp;</TD></TR><TR><TD><P CLASS=\"ETIQUETTE2\">" + MyLng.Currency + "</P></TD><TD><SELECT NAME=\"CURRENCY\" onchange=\"parent.GestForm.Select()\">";
    for (var i = 0; i < _NbCurrency; i++) ToWrite += "<OPTION VALUE=\"" + i + "\">"+ _Currency[i].Etiquette + "</OPTION>";
    ToWrite += "</SELECT></TD><TD>&nbsp;</TD></TR><TR><TD><P CLASS=\"ETIQUETTE3\">" + MyLng.ShippingPrice + "</P></TD><TD><INPUT TYPE=\"TEXT\" NAME=\"SHIPPING\" SIZE=\"10\" VALUE=\"0.00\"></TD><TD</TD></TR>";
    ToWrite += "<TR><TD COLSPAN=\"3\">&nbsp;</TD></TR><TR><TD COLSPAN=\"3\"><P ALIGN=\"CENTER\"><SPAN CLASS=\"CMDBUTTON\" ONCLICK=\"Javascript:parent.GestForm.GoPreviousPage();\">" + MyLng.PreviousPage + "</SPAN></P></TD></TR><TR><TD COLSPAN=\"3\">&nbsp;</TD></TR></FORM>";
  }
  return (ToWrite);
}
function DirectLink (_ShowTop, _ShowBottom, _MaxCol){
  this.ShowTop = (_ShowTop) ? true : false;		
  this.ShowBottom = (_ShowBottom) ? true : false;	
  this.MaxCol = (_MaxCol) ? _MaxCol : 4;			
  this.Content = new Array();
  this.NbContent = 0;
  this.AddDL = DirectLinkAddDL;
  this.WriteDL = DirectLinkWriteDL;
}
function DirectLinkAddDL (_Page, _Etiquette, _ImgOff, _ImgOn){
  with (this){
    Content[NbContent] = new Object();
    Content[NbContent].Page = _Page;
    Content[NbContent].Etiquette = _Etiquette;
    if (_ImgOff){ 
      Content[NbContent].ImgOff = new Image();
      Content[NbContent].ImgOff.src = _ImgOff;
    }
    if (_ImgOn){
      Content[NbContent].ImgOn = new Image();
      Content[NbContent].ImgOn.src = _ImgOn;
    }
    NbContent++;
  }
}
function DirectLinkWriteDL (_IsTop){
  var NumCol = 1, ToWrite = "";
  with (this){
    if ((_IsTop) && (ShowTop == false)) return ToWrite;
    if ((_IsTop == false) && (ShowBottom == false)) return ToWrite;
    if (NbContent == 0) return;
    ToWrite += "<TABLE BORDER=\"0\" ALIGN=\"CENTER\" WIDTH=\"100%\"><TR>";
    for (var i=0; i < NbContent; i++){
      if (NumCol > MaxCol){
        ToWrite += "</TR><TR>";
        NumCol = 1;
      }
      if (Content[i].ImgOff == null)
        ToWrite += "<TD><P CLASS=\"DLINK\" ONCLICK=\"javascript:parent.GestForm.GoToPage(" + Content[i].Page + ");\">"+ Content[i].Etiquette + "</P></TD>";
      else{
        if (Content[i].ImgOn == null)
          ToWrite += "<TD><P CLASS=\"DLINK\" ONCLICK=\"javascript:parent.GestForm.GoToPage(" + Content[i].Page + ");\"><IMG SRC=\"" + Content[i].ImgOff.src + "\" ALT=\"" + Content[i].Etiquette + "\"></P></TD>";
        else
          ToWrite += "<TD><P CLASS=\"DLINK\" ONCLICK=\"javascript:parent.GestForm.GoToPage(" + Content[i].Page + ");\"><IMG SRC=\"" + Content[i].ImgOff.src + "\" ALT=\"" + Content[i].Etiquette + "\" ONMOUSEOUT=\"javascript:this.src=\'" + Content[i].ImgOff.src +"\';\" ONMOUSEOVER=\"javascript:this.src=\'" + Content[i].ImgOn.src +"\';\"></P></TD>";
      }
      NumCol++;
    }
  }
  ToWrite+="</TR></TABLE><P>&nbsp;</P>";
  return ToWrite;
}