function switchDetailImage (anchor, inviteName) {
   var mainImage = document.getElementById('invite_detail_image');
   var buttonImage = anchor.firstChild;
   var imageNumber = buttonImage.src.match(/view\d_/)[0].match(/\d/);
   mainImage.src = mainImage.src.replace(new RegExp(inviteName + "(\\d)"), inviteName + imageNumber);
}

function ColorSet (colorData)
{
    this.colorData = colorData;
    this.index = 0;
}


ColorSet.prototype =
{
    'next' : function ()
    {
        this.index = (this.index >= (this.colorData.length - 1))
            ? 0
            : this.index + 1;
        this.display();
    },

    'previous' : function ()
    {
        this.index = (this.index <= 0)
            ? this.colorData.length - 1
            : this.index - 1;
        this.display();
    },

    'display' : function ()
    {
        document.getElementById('colorImage').src = this.colorData[this.index].url;
        document.getElementById('colorName').innerHTML = this.colorData[this.index].name;
    }

};