
function WebMaster()
{
  this.emailAddress="";
  this.firstName="";
  this.lastName="";
  this.userName="";
  this.accountNumber=0;
  this.valid=false;
  this.create=WebMaster_Create;
  this.getUserId=WebMaster_getUserID;
}  


function WebMaster_Create(emailAddr,fName,lName)
{
  if (WebMaster_Create.arguments.length != 3)
    throw new Error(0xbaad0005,"Metoda Create wymaga 3 argumentów");
  this.emailAddress=emailAddr;
  this.firstName=fName;
  this.lastName=lName;
  this.userName=fName+lName;
  this.accountNumber=Math.round(Math.random()*1000)+(Math.round(Math.random()*1000)+1000);
  this.valid=true;
  WebMaster.prototype.toString=WebMaster_toString;
}

function WebMaster_getUserID()
{
  return this.accountNumber;
}

function WebMaster_toString()
{
  return "#"+this.accountNumber.toString();
}

var wm=new WebMaster;
try
{
  wm.create("email","first","last");
  WScript.Echo(wm);
} 
catch (e)
{
  WScript.Echo("Błąd: #" + 
    (0x0000ffff & e.number) + 
    " : " + e.description);
  wm.valid=false;
}
finally
{
  if(wm.valid)
    WScript.Echo("Sucessfully created a new WebMaster Object");
  else
    WScript.Echo("Obiekt WebMaster NIE został utworzony!");  
}

