var isIE = (navigator.appName == "Microsoft Internet Explorer");

function bevitel_csakszam(e) 
{

 var Key = e.keyCode;
 if (Key == 0) {Key = e.which}
 if ((Key >= 48 && Key <= 57) || Key == 8 || Key == 9 || Key == 37 || Key == 38 || Key == 39 || Key == 11 || Key == 12 || Key == 46) 
 return true;
 return false;

}


function getCursorPos(el)
{ 
   var sel, rng, r2, i=-1; 
   if(document.selection && el.createTextRange) 
   { 
      sel=document.selection; 

      if(sel)
      { 
         r2=sel.createRange(); 
         rng=el.createTextRange(); 
         rng.setEndPoint("EndToStart", r2); 
         i=rng.text.length; 
      } 
   } 
   return i; 
} 

function autoTab(input,len)
{
 if (isIE)
 {
   if(input.value.length >= len && getCursorPos(input) == len)
   {
    input.value = input.value.slice(0, len);
    input.form[(getIndex(input)+1) % input.form.length].focus(); 
   }
 } else {
           if(input.value.length >= len )
           {
               input.value = input.value.slice(0, len);
               input.form[(getIndex(input)+1) % input.form.length].focus(); 
           }

        }

function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}



return true;
}


function richtextdiv(whichLayer)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
if (style2.display == "none") {style2.display = "block";}  else {style2.display = "none";}
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
if (style2.display == "none") {style2.display = "block";}  else {style2.display = "none";}
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
if (style2.display == "none") {style2.display = "block";}  else {style2.display = "none";}
}
}





  function stripLeadingZeroes(input)
  {
    s = parseInt(input);
    if((s.length > 1) && (s.substr(0,1) == "0"))
      return s.substr(1);
    else
      return s;
  }

  function getMonthNum(abbMonth)
  {
    var arrMon = new Array("Jan","Feb","Mar","Apr","May","Jun",
          "Jul","Aug","Sep","Oct","Nov","Dec");
    for(i=0; i<arrMon.length; i++)
    {
      if(abbMonth == arrMon[i])
        return i+1;
    }
return;
}
  function getHonapNum(abbMonth)
  {
    var arrMon = new Array("Jan","Feb","Mar","Apr","Maj","Jun",
          "Jul","Aug","Sze","Okt","Nov","Dec");
    for(i=0; i<arrMon.length; i++)
    {
      if(abbMonth == arrMon[i])
        return i+1;
    }
}
  function getHonapNev(i)
  {
    i--;
    var arrMon = new Array("Jan","Feb","Mar","Apr","Maj","Jun",
          "Jul","Aug","Sze","Okt","Nov","Dec");
     return arrMon[i]

  }

  function timeToHuman(ertek)
  {
    s = ertek;
    s = s.replace(':',' ');
    s = s.replace(':',' ');
    s = s.replace('-',' ');
    s = s.replace('-',' ');
    s = s.replace(':',' ');
    s = s.replace(':',' ');
    arrDateStr = s.split(' ');

    return arrDateStr[0]+'-'+(getHonapNev(arrDateStr[1]))+'-'+arrDateStr[2]+' '+arrDateStr[3]+':'+arrDateStr[4]+':'+arrDateStr[5];
  }

  function humanToTime(ertek)
  {
    s = ertek;
    s = s.replace(':',' ');
    s = s.replace(':',' ');
    s = s.replace('-',' ');
    s = s.replace('-',' ');
    s = s.replace(':',' ');
    s = s.replace(':',' ');
    arrDateStr = s.split(' ');
    var humDate = new Date(Date.UTC(arrDateStr[0],
          stripLeadingZeroes(getHonapNum(arrDateStr[1])-1),
          stripLeadingZeroes(arrDateStr[2]),
          stripLeadingZeroes(arrDateStr[3]),
        stripLeadingZeroes(arrDateStr[4]),
          stripLeadingZeroes(arrDateStr[5]) ));


//    return  (humDate.getTime()/1000.0);
return arrDateStr[0]+'-'+(getHonapNum(arrDateStr[1]))+'-'+arrDateStr[2]+' '+arrDateStr[3]+':'+arrDateStr[4]+':'+arrDateStr[5];
//return ertek;
  }



