// Removes leading and ending whitespaces
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); };

String.prototype.removeWhiteSpaces = function() { return this.replace(/\s/g, ''); };
String.prototype.removeTirets = function() { return this.replace(/-/g, ''); };

function ExplodedGencodToGencod(ExplodedGencodField,GencodField)
{
  ExplodedGencodValue=document.getElementById(ExplodedGencodField).value;
  ExplodedGencodValue=ExplodedGencodValue.removeWhiteSpaces().removeTirets();
  if (ExplodedGencodValue!='')
    {
      document.getElementById(GencodField).value=ExplodedGencodValue;
    };
}

function ADMOptMenuShow(AnId)
{
    var elems = document.getElementsByTagName('div');
    for(i=0; i<elems.length; i++)
      {
        if(elems[i].className == 'ADMOptMenuDiv') 
          {
            elems[i].style.display='none'; 
            elems[i].style.visibility='hidden';
          }
      }
    elems = document.getElementsByTagName('span');
    for(i=0; i<elems.length; i++)
      {
        if(elems[i].className == 'ADMOptMenuShow') 
          {
            elems[i].style.display='block'; 
            elems[i].style.visibility='visible';
          }
      }
    var anElem=document.getElementById(AnId); 
    anElem.style.display='block'; 
    anElem.style.visibility='visible'; 
    anElem=document.getElementById(AnId+'_Show'); 
    anElem.style.display='none'; 
    anElem.style.visibility='hidden'; 
}

function ADMOptMenuHide(AnId)
{
    var anElem=document.getElementById(AnId); 
    anElem.style.display='none'; 
    anElem.style.visibility='hidden'; 
    anElem=document.getElementById(AnId+'_Show'); 
    anElem.style.display='block'; 
    anElem.style.visibility='visible'; 
}



