
//
//
//
function NormEncodeString(str)
{
    var newstr = str.replace(/\,/g, '{semi}');
    newstr = newstr.replace(/\ /g,  '{spc}');
    newstr = newstr.replace(/\?/g,  '{qmark}');
    newstr = newstr.replace(/\*/g,  '{wild}');
    newstr = newstr.replace(/\+/g,  '{plus}');
    newstr = newstr.replace(/\"/g,  '{quot}');
    newstr = newstr.replace(/\'/g,  '{apos}');
    newstr = newstr.replace(/\&/g,  '{amp}');
    newstr = newstr.replace(/\n/g,  '{nline}');

    return newstr;
}

//
//
// To samo co NormEncodeString, ale zamienia cudzyslów i apostrof na spacje
// (jest to konieczne dla certyfikatów)
function NormEncodeCertString(str)
{
    var newstr =    str.replace(/\"/g, '');
    newstr = newstr.replace(/\'/g, '');
	
	newstr = NormEncodeString(newstr)
    return newstr;
}


function OpenWindow(url, param, width, height)
{
//    if(window.showModalDialog)
//        window.showModalDialog(url, param, //'dialogWidth:'+width+'px;dialogHeight:'+height+'px;center:yes;resizable:no;scroll:yes;help:no;status:1;edge:sunken');
//    else
    {
        height = height-29;
        window.open(url,'bookmark','width='+width+',height='+height+',resizable=no,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no');
    }        
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
   { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
      {
         IsNumber = false;
      }
   }
   return IsNumber;
}
