  /************************************************************************/
  // Variables
	XactikaCard.BALLS = 1;
	XactikaCard.CUBES = 2;
	XactikaCard.CONES = 3;
	XactikaCard.STARS	= 4;
  XactikaCard.prototype.IMAGE_HEADER = "../images/xactika_cards/medium/xactika_card_";
  XactikaCard.prototype.IMAGE_FOOTER = ".jpg";
  XactikaCard.prototype.balls  = 0;
	XactikaCard.prototype.cubes  = 0;
	XactikaCard.prototype.cones = 0;
	XactikaCard.prototype.stars   = 0;
	// Methods
	XactikaCard.getShapeText = XactikaCard_getShapeText;
	XactikaCard.prototype.getGraphicsNumber       = XactikaCard_getGraphicsNumber;
  XactikaCard.prototype.getShape                = XactikaCard_getShape;
  XactikaCard.prototype.getBalls                = XactikaCard_getBalls;
  XactikaCard.prototype.getCubes                = XactikaCard_getCubes;
  XactikaCard.prototype.getCones                = XactikaCard_getCones;
  XactikaCard.prototype.getStars                = XactikaCard_getStars;
  XactikaCard.prototype.getPoints               = XactikaCard_getPoints;
  XactikaCard.prototype.getImageURL             = XactikaCard_getImageURL;
  XactikaCard.prototype.getPaddedGraphicsNumber = XactikaCard_getPaddedGraphicsNumber;
  XactikaCard.prototype.toMyString              = XactikaCard_toMyString;
  XactikaCard.prototype.setPlayed               = XactikaCard_setPlayed;
  XactikaCard.prototype.isPlayed                = XactikaCard_isPlayed;

  /************************************************************************/
  function XactikaCard(graphicNumber)
  {
  	if ((graphicNumber < 1) || (graphicNumber > 81)) 
  	{
      alert("XactikaCard:Tried to create card with graphicNumber("+ graphicNumber +")");
  	}

  	graphicNumber--;	
  	this.balls = Math.floor(((graphicNumber%81) / 27) + 1);
  	this.cubes = Math.floor(((graphicNumber%27) / 9) + 1);
  	this.cones = Math.floor(((graphicNumber%9) / 3) + 1);
  	this.stars = Math.floor(((graphicNumber%3) / 1) + 1);
    this.played = false
  }
  
  /************************************************************************/
  function XactikaCard_getImageURL()
  {
    return this.IMAGE_HEADER + this.getPaddedGraphicsNumber() + this.IMAGE_FOOTER;
  }
  /***********************************************************************/
  function XactikaCard_getPaddedGraphicsNumber()
  {
    var text = "" + this.getGraphicsNumber();
    while (text.length < 2)
    {
      text = "0" + text;
    }
    return text;
  }
  /************************************************************************/
  function XactikaCard_getGraphicsNumber()
  {
  	var num;
  	num = (this.balls - 1) * 27;
  	num += (this.cubes - 1) * 9;
  	num += (this.cones - 1) * 3;
  	num += this.stars; //should be (Number - 1) * 1 but over all sum needs to be inc by one anyhow...
  	return num;
  }

  /************************************************************************/
  function XactikaCard_getShape(shape)
  {
    var number = 0;
    switch (shape)
    {
      case 	XactikaCard.BALLS : number = this.getBalls();break;
      case 	XactikaCard.CUBES : number = this.getCubes();break;
      case 	XactikaCard.CONES : number = this.getCones();break;
      case 	XactikaCard.STARS	: number = this.getStars();break;
    }
    return number;
  }  
  /************************************************************************/
  function XactikaCard_getShapeText(shape)
  {
  	var text = new Array (null, "balls","cubes", "cones", "stars");
    return text[shape];
  }  
  /************************************************************************/
  function XactikaCard_isPlayed()
  {
    return this.played;
  }  
  /************************************************************************/
  function XactikaCard_setPlayed(played)
  {
    this.played = played;
  }  
  /************************************************************************/
  function XactikaCard_getPoints()
  {
    return this.getBalls() + this.getCubes() + this.getCones() + this.getStars();
  }  
  /************************************************************************/
  function XactikaCard_getBalls()
  {
    return this.balls;
  }  
  /************************************************************************/
  function XactikaCard_getCubes()
  {
    return this.cubes;
  }  
  /************************************************************************/
  XactikaCard.prototype.getHighestShape = function()
  {
  	var shape = 1;
  	for (var i = 2; i < 5; i++)
  	{
  	 if (this.getShape(shape) < this.getShape(i))
  	 {
  	  shape = i;
  	 }
  	}
  	return shape;
  }
  /************************************************************************/
  XactikaCard.prototype.getLowestShape = function()
  {
  	var shape = 1;
  	for (var i = 2; i < 5; i++)
  	{
  	 if (this.getShape(shape) > this.getShape(i))
  	 {
  	  shape = i;
  	 }
  	}
  	return shape;
  }
  /************************************************************************/
  function XactikaCard_getCones()
  {
    return this.cones;
  }  
  /************************************************************************/
  function XactikaCard_getStars()
  {
    return this.stars;
  }  
  /************************************************************************/
  function XactikaCard_toMyString()
  {
  	return  "Cards[" + this.getPaddedGraphicsNumber() + "] = [ " +
            this.getBalls() + " Balls, " +
            this.getCubes() + " Cubes, " + 
            this.getCones() + " Cones, " + 
            this.getStars() + " Stars]";
  }
  
  /************************************************************************/
  /************************************************************************/