function iGenSweep() {

   var NumState;
   var EmbState;
   var GvaState;
   
   var GvaChance = "";
   var EmbChance = "";
   
   var NumType;
   
   var NumBuff;
   
   var Num1,Num2,Num3;
   
   var initLine = '[this, "';
   
   // sprawdz ustawienia pol radio, dostosuj wyswietlanie
   
   if ( document.getElementById("iGenIfRandomO").checked ) {
      iGenShowElem("iGenRow3");
      NumState = "Own";
   } else {
      iGenHideElem("iGenRow3");
      NumState = "Random";
   }
   
   if ( document.getElementById("iGenEmbO").checked ) {
      iGenShowElem("iGenRow5");
      iGenShowElem("iGenRow5andhalf");
      iGenHideAlt("iGenRow5Alt2");
      EmbState = "Own";
   } else if ( document.getElementById("iGenEmbE").checked ) {
      iGenHideElem("iGenRow5");
      iGenHideElem("iGenRow5andhalf");
      iGenShowAlt("iGenRow5Alt2");
      EmbState = "no";
   } else {
      iGenHideElem("iGenRow5");
      iGenHideElem("iGenRow5andhalf");
      iGenHideAlt("iGenRow5Alt2");
      EmbState = "random";
   }
   
   if ( document.getElementById("iGenGvaO").checked ) {
      iGenShowElem("iGenRow7");
      iGenShowElem("iGenRow8");
      GvaState = "Own";
   } else if ( document.getElementById("iGenGvaE").checked ) {
      iGenHideElem("iGenRow7");
      iGenHideElem("iGenRow8");
      GvaState = "no";
   } 
   
   NumType = document.getElementById("iGenFonttype").value;
   
   if ( NumState == "Random" ) {
           initLine = initLine + "random";
           
           if ( NumType == "normal" ) initLine = initLine + "Normal";
           else if ( NumType == "arabic" ) initLine = initLine + "Arabic";
           else initLine = initLine + "Resi";
   } else {
      initLine = initLine + NumType;
   }   
   
   initLine = initLine + '", ';

   if ( NumState == "Own" ) {
           NumBuff = document.getElementById("iGenSetNumbers").value
           
           Num1 = (NumBuff - (NumBuff % 100))/100 ;
           
           NumBuff = NumBuff - (100*Num1);
           
           Num2 = (NumBuff - (NumBuff % 10))/10;
           
           NumBuff = NumBuff - (10*Num2)
           
           Num3 = NumBuff
           
           initLine = initLine + '[' + Num1 + ',' + Num2 + ',' + Num3 + '], ';
   }
   
   if ( EmbState == "Own" ) {
      EmbState = document.getElementById("iGenEmbOwn").value;
      EmbChance = ', ' + document.getElementById("iGenEmbChn").value + '';
   }
   
   if ( GvaState == "Own" ) {
      GvaState = document.getElementById("iGenGvaOwn").value;
      GvaChance = ', ' + document.getElementById("iGenGvaChn").value + '';
   } else {
   }
   
   initLine = initLine + '["' + EmbState + '"' + EmbChance + '], ["' + GvaState + '"' + GvaChance + ']] ';
   initLine = initLine + 'exec "\\RHS_Misc\\RHS_UN.sqs"';
   
   document.getElementById("iGenOutput").value = initLine;
}

function iGenHideElem( Elem ) {
   document.getElementById( Elem + "L" ).style.visibility = "hidden";
   document.getElementById( Elem + "R" ).style.visibility = "hidden";
}

function iGenShowElem( Elem ) {
   document.getElementById( Elem + "L" ).style.visibility = "visible";
   document.getElementById( Elem + "R" ).style.visibility = "visible";
}

function iGenHideAlt( Elem ) {
   document.getElementById( Elem ).style.visibility = "hidden";
}

function iGenShowAlt( Elem ) {
   document.getElementById( Elem ).style.visibility = "visible";
}