var PP = PP ? PP : new Object();

PP.Size = function (idPrefix, sizeTotal) {
    var size_v = new Array(sizeTotal);
    for(i=0; i<size_v.length; i++) { size_v[i] = '../images/size_off_'+(i+1)+'.gif'; }

    function persist(index) {
       for(i=0; i<size_v.length; i++) {
           size_v[i] = '../images/size_off_'+(i+1)+'.gif';
           var a = $(idPrefix + 'size_'+(i+1));
           if (a) { a.src=size_v[i]; }
       }
       size_v[index]='../images/size_'+(index+1)+'.gif';
        $(idPrefix + 'size_'+(index+1)).src=size_v[index];
    }

    this.onmouseout = function (index) {
        $(idPrefix + 'size_' + (index + 1)).src = size_v[index];
    };
    this.onmouseover = function (index) {
        $(idPrefix + 'size_' + (index + 1)).src = '../images/size_' + (index + 1) + '.gif';
    };
    this.onclick = function (index) {
        persist(index);
        return false;
    };
};

PP.Colour = function (idPrefix, colourTotal) {
    var swatch_v = new Array(colourTotal);
    for(i=0; i<swatch_v.length; i++) { swatch_v[i] = '../images/swatch_off_'+(i+1)+'.gif'; }

    function persist(index) {
       for(i=0; i<swatch_v.length; i++) {
           swatch_v[i] = '../images/swatch_off_'+(i+1)+'.gif';
           var a = $(idPrefix + 'swatch_'+(i+1));
           if (a) { a.src=swatch_v[i]; }
       }
       swatch_v[index]='../images/swatch_on_'+(index+1)+'.gif';
        $(idPrefix + 'swatch_'+(index+1)).src=swatch_v[index];
    }

    this.onmouseout = function (index) {
        $(idPrefix + 'swatch_' + (index + 1)).src = swatch_v[index];
    };
    this.onmouseover = function (index) {
        $(idPrefix + 'swatch_' + (index + 1)).src = '../images/swatch_on_' + (index + 1) + '.gif';
    };
    this.onclick = function (index) {
        persist(index);
        return false;
    };
};
