function FN(number, nLeadingZeroCount)
{
	var sResult = number.toString();
	var i = nLeadingZeroCount - sResult.length;
	while( i-- > 0 )
		sResult = "0"+sResult;
	return sResult;
}

function ReplaceAll(sSource, sFind, sReplace)
{
	var nPos = -sReplace.length, s = sSource;
	while( (nPos = s.indexOf(sFind, nPos+sReplace.length))!=-1 )
		s = s.substring(0, nPos)+sReplace+s.substring(nPos+sFind.length);
	return s;
}

function SetCookie(sName, sValue, nExpiresTime)
{
	var dtExpiry = new Date();
	dtExpiry.setTime(dtExpiry.getTime()+nExpiresTime);
	document.cookie = sName + "=" + sValue + ";path=/;expires=" + (nExpiresTime ? dtExpiry.toGMTString() : "0");
}

function sh(sHelpFile)
{
	window.open(sHelpFile, "HelpSlon",
		"width="+(Math.round(screen.width/2)).toString()+",height="+(Math.round(screen.height*7/10)).toString()+",resizable,scrollbars");
	return false;
}

function rnd()
{
	return (new Date()).getTime() - 1102080000000;
}

function encodeWin1251(s)
{
	var i, n, r = "";

  for(i=0; i<s.length; i++){
    n = s.charCodeAt(i);
    if( n>=0x410 && n<=0x44F )
    	n -= 0x350;
    else if( n==0x401 )
    	n = 0xA8;
    else if( n==0x451 )
    	n = 0xB8;
    if( n<=0xFF )
      r += String.fromCharCode(n);
  }
  return ReplaceAll(escape(r), "+", "%2B");
}

function ma(obj)
{
	if( obj.className.charAt(obj.className.length-1)!='A' ){
		obj.className += "A";
		window.status = obj.title;
	}
	return true;
}

function mo(obj)
{
	if( obj.className.charAt(obj.className.length-1)=='A' ){	
		obj.className = obj.className.substring(0, obj.className.length-1);
		window.status = "";
	}
	return true;
}

function fa(){ return ma(this); }
function fo(){ return mo(this); }

