

//***********************************************************************/
function SelectedWord()
{
  //Define Functions
  this.getLastCard = SelectedWord_getLastCard;
  this.removeCard = SelectedWord_removeCard;
  this.removeAll = SelectedWord_removeAll;
  this.addCard = SelectedWord_addCard;
  this.getString = SelectedWord_getString;
  this.getSolutionString = SelectedWord_getSolutionString;
  this.getCardArray = SelectedWord_getCardArray;

  //init
  this.cardArray = new Array();
  return this;
}

//***********************************************************************/
function SelectedWord_addCard(card, place)
{
	//alert("about to push");
	this.cardArray[this.cardArray.length] = card;
}
//***********************************************************************/
function SelectedWord_removeCard(card)
{
  var newCards = new Array();
	for(var i = 0; i < this.cardArray.length; i++)
  {
  	if (this.cardArray[i] != card)
    {
    	newCards[newCards.length] = this.cardArray[i];
    }
  }
  this.cardArray = newCards;
}
//***********************************************************************/
function SelectedWord_removeAll()
{
  //this.cardArray.splice(0,this.cardArray.length);
  this.cardArray = new Array();
}
//***********************************************************************/
function SelectedWord_getLastCard()
{
  return this.cardArray[this.cardArray.length - 1];
}
//***********************************************************************/
function SelectedWord_getString()
{
	var string = "";
  for(var i = 0; i < this.cardArray.length; i++)
  {
  	string = string + this.cardArray[i].getLetter();
  }
  return string.toLowerCase();
}
//***********************************************************************/
function SelectedWord_getSolutionString()
{
  var string = "";
  for(var i = 0; i < this.cardArray.length; i++)
  {
    string = string + this.cardArray[i].getLetter() + ",";
  }
  string = string.substring(0, string.length-1) + "/";
  return string.toLowerCase();
}
//***********************************************************************/
function SelectedWord_getCardArray()
{
  return this.cardArray;
}
//***********************************************************************/
//***********************************************************************/
  