﻿
/* Engine */
var LabelCounterIDs = new Array();
var LabelAuctionPriceIDs = new Array();
var LabelBidsIDs = new Array();
var LabelCurrentProductPriceIDs = new Array();
var LabelUserNameIDs = new Array();
var LabelBidTypeIDs = new Array();
var _labelLastBidsCountIDs = new Array();
var _buttonBidIDs = new Array();
var _buttonBidGrayIDs = new Array();
var _buttonSoldIDs = new Array();
var _auctionStartEndedIDs = new Array();
var _auctionPriceTimeIDs = new Array();
var _auctionPriceCounterIDs = new Array();
var DisplayType = new Array();
var LabelAuctionPriceDetailID;
var _labelUserNameID;
var _labelPlacedDetailID;
var _labelFreeBidsDetailID;
var _labelPlacedAmountDetailID;
var _labelFreeBidsAmountDetailID;
var _labelSavingAmountDetailID;
var _labelRebateAmountDetailID;
var _labelPurchaseAmountDetailID;
var _labelCustomerBidsID;
var _labelBidRobotCurrentBidsID;
var updateTimeIndex;
var updateTimeDetail;
var timerIndex;
var timerDetail;
var _currency;
var facteurToEur;
var _idAuction;
var _idsAuction;
var _guid;
var _auctionIndexUrl;
var _auctionIndexSign;
var _auctionIndexTime;
var _auctionDetailUrl;
var _auctionDetailSign;
var _auctionDetailTime;
var typeBidNormalLocalized;
var typeBidRobotLocalized;
var _lastBidsCountLocalized;
var AuctionStatusPendingLocalized;
var AuctionStatusPausedLocalized;
var AuctionStatusCompletedLocalized;
var _auctionTimerDayLocalized;

var UpdateAuctionIndexData = function() {
	var parameters = 'idsAuction=' + _idsAuction + '&guid=' + _guid + '&sign=' + _auctionIndexSign + '&time=' + _auctionIndexTime;
	
	$.ajax({
	        type: "POST",
	        url: _auctionIndexUrl,
	        data: parameters,
	        cache: false,
	        async: true,
	        success: function(data) {
                CallBackIndex(data);
	        },
	        error: function(e){
	        }
	});
}

var UpdateAuctionDetailData = function() {
    var startDate = new Date;
}

var AddAuctionIndex = function(url, idsAuction, guid, sign, time) {
	_auctionIndexUrl = url;
    _idsAuction = idsAuction;
    _guid = guid
    _auctionIndexSign = sign;
    _auctionIndexTime = time;
    
    updateTimeIndex = 1000;

    timerIndex = setTimeout("UpdateAuctionIndexData()", updateTimeIndex);
}

var AddAuctionDetail = function(url, idAuction, guid, sign, time) {
	_auctionDetailUrl = url;
    _idAuction = idAuction;
    _guid = guid;
    _auctionDetailSign = sign;
    _auctionDetailTime = time;

    updateTimeDetail = 1000;

    timerDetail = setTimeout("UpdateAuctionDetailData()", updateTimeDetail);
}

var CallBackIndex = function(result) {
    var splitResult = result.split("#");
    if (splitResult.length > 0) {
        var overTimer = 0;
        if (_guid != undefined || _guid != null || _guid != '') {
            var splitData = splitResult[0].split("|");
            overTimer = splitData[0];

            if (splitData.length == 2) {
                UpdateText(_labelCustomerBidsID, splitData[1]);
            }
        }
        else
            overTimer = splitResult[0];

        if (overTimer > 500) {
            updateTimeIndex = 1000 - 500;
        }
        else {
            updateTimeIndex = 1000 - overTimer;
        }
        updateTimeIndex = 800;
    }

    if (splitResult.length > 1) {
        for (var i = 1; i < splitResult.length; i++) {
            if (splitResult[i] != undefined && splitResult[i] != null && splitResult[i] != '') {
                UpdateAuction(splitResult[i]);
            }
        }
    }

    if (timerIndex != undefined && timerIndex != null && timerIndex != '')
        clearTimeout(timerIndex);

    timerIndex = setTimeout("UpdateAuctionIndexData()", updateTimeIndex);
}

var CallBackIndexErreur = function(error) {
}

var CallBackDetail = function(result) {
    var splitResult = result.split("#");
    if (splitResult.length > 0) {
        var overTimer = 0;
        if (_guid != undefined && _guid != null && _guid != '') {
            var splitData = splitResult[0].split("|");

            overTimer = splitData[0];

            if (splitData.length == 10) {
                UpdateText(_labelCustomerBidsID, splitData[1]);
                UpdateText(_labelPlacedDetailID, splitData[2]);
                UpdateText(_labelFreeBidsDetailID, splitData[3]);
                UpdateText(_labelPlacedAmountDetailID, splitData[4]);
                UpdateText(_labelFreeBidsAmountDetailID, splitData[5]);
                UpdateText(_labelSavingAmountDetailID, splitData[6]);
                UpdateText(_labelRebateAmountDetailID, splitData[7]);
                UpdateText(_labelPurchaseAmountDetailID, splitData[8]);
                UpdateText(_labelBidRobotCurrentBidsID, splitData[9]);                
            }
        }
        else
            overTimer = splitResult[0];

        if (overTimer > 500) {
            updateTimeDetail = 1000 - 500;
        }
        else {
            updateTimeDetail = 1000 - overTimer;
        }
        updateTimeIndex = 800;
    }

    if (splitResult.length > 1) {
        if (splitResult[1] != undefined && splitResult[1] != null && splitResult[1] != '') {
            UpdateAuction(splitResult[1]);
        }
    }

    if (timerDetail != undefined && timerDetail != null && timerDetail != '')
        clearTimeout(timerDetail);

    timerDetail = setTimeout("UpdateAuctionDetailData()", updateTimeDetail);
}

var CallBackDetailErreur = function(error) {
}

var UpdateAuction = function(data) {
    var splitData = data.split("|");
    var idAuction = splitData[0];
    var counter = splitData[1];
    var auctionPrice = splitData[2];

    if (splitData[5] == 2) {
        UpdateText(LabelCounterIDs[idAuction], GetDisplayTime(counter));
    }

    UpdateText(LabelAuctionPriceIDs[idAuction], _currency + ' ' + auctionPrice);
    if (DisplayType[idAuction] == "3")
        UpdateText(LabelAuctionPriceDetailID, _currency + ' ' + auctionPrice);

    var bidsInner = "";
    var productPriceBidsInner = "";
    var userNameBidsInner = "";
    var typeBidsInner = "";

    splitBids = splitData[3].split(";");
    if (splitBids.length > 0) {
        switch (DisplayType[idAuction]) {
            case "1":
                {
                    for (var i = 0; i < splitBids.length; i++) {
                        var splitCustomerAuctionBid = splitBids[i].split("/");
                        if (splitCustomerAuctionBid[1] != undefined) {
                            bidsInner += (i + 1) + " - " + String.Limit(splitCustomerAuctionBid[1], 14);
                            bidsInner += "<br/>";
                        }
                    }
                    UpdateText(LabelBidsIDs[idAuction], bidsInner);
                    break;
                }
            case "2":
                {
                    var splitCustomerAuctionBid = splitBids[0].split("/");
                    if (splitCustomerAuctionBid[1] != undefined) {
                        bidsInner = String.Limit(splitCustomerAuctionBid[1], 10);
                        bidsInner += "<br/>";
                    }
                    UpdateText(LabelBidsIDs[idAuction], bidsInner);
                    break;
                }
            case "3":
                {
                    var splitCustomerAuctionBid = splitBids[0].split("/");
                    if (splitCustomerAuctionBid[1] != undefined) {
                        bidsInner = String.Limit(splitCustomerAuctionBid[1], 7);
                        bidsInner += "<br/>";
                    }
                    UpdateText(_labelUserNameID, bidsInner);

                    bidsInner = "";

                    for (var i = 0; i < splitBids.length; i++) {
                        var splitCustomerAuctionBid = splitBids[i].split("/");
                        if (splitCustomerAuctionBid[0] != undefined && splitCustomerAuctionBid[0] != '') {
                            if (i == 0) productPriceBidsInner += "<b>";
                            productPriceBidsInner += _currency + ' ' + splitCustomerAuctionBid[0] + "<br/>";
                            if (i == 0) productPriceBidsInner += "</b>";
                        }
                        if (splitCustomerAuctionBid[1] != undefined && splitCustomerAuctionBid[1] != '') {
                            if (i == 0) userNameBidsInner += "<b>";
                            userNameBidsInner += String.Limit(splitCustomerAuctionBid[1], 7) + "<br/>";
                            if (i == 0) userNameBidsInner += "</b>";
                        }
                        if (splitCustomerAuctionBid[2] != undefined && splitCustomerAuctionBid[2] != '') {
                            if (i == 0) typeBidsInner += "<b>";
                            switch (splitCustomerAuctionBid[2]) {
                                case "1":
                                    typeBidsInner += typeBidNormalLocalized;
                                    break;
                                case "2":
                                    typeBidsInner += typeBidRobotLocalized;
                                    break;
                            }
                            if (i == 0) typeBidsInner += "</b>";
                            typeBidsInner += "<br/>";
                        }
                    }
                    UpdateText(LabelCurrentProductPriceIDs[idAuction], productPriceBidsInner);
                    UpdateText(LabelUserNameIDs[idAuction], userNameBidsInner);
                    UpdateText(LabelBidTypeIDs[idAuction], typeBidsInner);
                    UpdateText(_labelLastBidsCountIDs[idAuction], String.Format(_lastBidsCountLocalized, splitData[6]));
                    break;
                }
            case "4":
                {
                    break;
                }
        }
    }
	
    if (splitData[4] == 1) {
    	$('#' + LabelCounterIDs[idAuction]).highlightFade({speed:1000,start:'#ff0000',end:'#ffffff'});
    }

    // pending
    if (splitData[5] == 1) {
        if (_buttonBidIDs[idAuction] != undefined && _buttonBidIDs[idAuction] != null && _buttonBidIDs[idAuction] != '')
        	document.getElementById(_buttonBidIDs[idAuction]).style.display = 'none';
        if (_buttonBidGrayIDs[idAuction] != undefined && _buttonBidGrayIDs[idAuction] != null && _buttonBidGrayIDs[idAuction] != '')
        	document.getElementById(_buttonBidGrayIDs[idAuction]).style.display = '';
        if (_buttonSoldIDs[idAuction] != undefined && _buttonSoldIDs[idAuction] != null && _buttonSoldIDs[idAuction] != '')
        	document.getElementById(_buttonSoldIDs[idAuction]).style.display = 'none';
        if (_auctionStartEndedIDs[idAuction] != undefined && _auctionStartEndedIDs[idAuction] != null && _auctionStartEndedIDs[idAuction] != '')
        	document.getElementById(_auctionStartEndedIDs[idAuction]).style.visibility = 'visible';
        UpdateText(LabelCounterIDs[idAuction], AuctionStatusPendingLocalized);
    }

    // started
    if (splitData[5] == 2) {
        if (_buttonBidIDs[idAuction] != undefined && _buttonBidIDs[idAuction] != null && _buttonBidIDs[idAuction] != '')
        	document.getElementById(_buttonBidIDs[idAuction]).style.display = '';
        if (_buttonBidGrayIDs[idAuction] != undefined && _buttonBidGrayIDs[idAuction] != null && _buttonBidGrayIDs[idAuction] != '')
        	document.getElementById(_buttonBidGrayIDs[idAuction]).style.display = 'none';
        if (_buttonSoldIDs[idAuction] != undefined && _buttonSoldIDs[idAuction] != null && _buttonSoldIDs[idAuction] != '')
	        document.getElementById(_buttonSoldIDs[idAuction]).style.display = 'none';
        if (_auctionStartEndedIDs[idAuction] != undefined && _auctionStartEndedIDs[idAuction] != null && _auctionStartEndedIDs[idAuction] != '')
            document.getElementById(_auctionStartEndedIDs[idAuction]).style.visibility = 'hidden';
        if (_auctionPriceTimeIDs[idAuction] != undefined && _auctionPriceTimeIDs[idAuction] != null && _auctionPriceTimeIDs[idAuction] != '')
            document.getElementById(_auctionPriceTimeIDs[idAuction]).style.display = '';
        if (_auctionPriceCounterIDs[idAuction] != undefined && _auctionPriceCounterIDs[idAuction] != null && _auctionPriceCounterIDs[idAuction] != '')
            document.getElementById(_auctionPriceCounterIDs[idAuction]).style.display = 'none';    
    }

    // paused
    if (splitData[5] == 3) {
        if (_buttonBidIDs[idAuction] != undefined && _buttonBidIDs[idAuction] != null && _buttonBidIDs[idAuction] != '')
	        document.getElementById(_buttonBidIDs[idAuction]).style.display = 'none';
        if (_buttonBidGrayIDs[idAuction] != undefined && _buttonBidGrayIDs[idAuction] != null && _buttonBidGrayIDs[idAuction] != '')
        	document.getElementById(_buttonBidGrayIDs[idAuction]).style.display = '';
        if (_buttonSoldIDs[idAuction] != undefined && _buttonSoldIDs[idAuction] != null && _buttonSoldIDs[idAuction] != '')
	        document.getElementById(_buttonSoldIDs[idAuction]).style.display = 'none';
        if (_auctionStartEndedIDs[idAuction] != undefined && _auctionStartEndedIDs[idAuction] != null && _auctionStartEndedIDs[idAuction] != '')
            document.getElementById(_auctionStartEndedIDs[idAuction]).style.visibility = 'hidden';
        UpdateText(LabelCounterIDs[idAuction], AuctionStatusPausedLocalized);
    }

    // completed
    if (splitData[5] == 4) {
        if (_buttonBidIDs[idAuction] != undefined && _buttonBidIDs[idAuction] != null && _buttonBidIDs[idAuction] != '')
	        document.getElementById(_buttonBidIDs[idAuction]).style.display = 'none';
        if (_buttonBidGrayIDs[idAuction] != undefined && _buttonBidGrayIDs[idAuction] != null && _buttonBidGrayIDs[idAuction] != '')
	        document.getElementById(_buttonBidGrayIDs[idAuction]).style.display = 'none';
        if (_buttonSoldIDs[idAuction] != undefined && _buttonSoldIDs[idAuction] != null && _buttonSoldIDs[idAuction] != '')
	        document.getElementById(_buttonSoldIDs[idAuction]).style.display = '';
        if (_auctionStartEndedIDs[idAuction] != undefined && _auctionStartEndedIDs[idAuction] != null && _auctionStartEndedIDs[idAuction] != '')
            document.getElementById(_auctionStartEndedIDs[idAuction]).style.visibility = 'visible';
        UpdateText(LabelCounterIDs[idAuction], AuctionStatusCompletedLocalized);
        UpdateText(_auctionStartEndedIDs[idAuction], splitData[8]);
    }
}

var GetDisplayTime = function(counter) {
    var days = Math.floor(counter / 86400);
    var hours = 0;
    if (counter >= 86400) {
        hours = Math.floor((counter % 86400) / 3600);
    }
    else {
        hours = Math.floor(counter / 3600);
    }
    var minutes = Math.floor(((counter % 86400) % 3600) / 60);
    var secs = ((counter % 86400) % 3600) % 60;

    if (hours < 10) {
        hours = "0" + hours;
    }
    if (minutes < 10) {
        minutes = "0" + minutes;
    }
    if (secs < 10) {
        secs = "0" + secs;
    }

    if (counter >= 86400) {
        return days + _auctionTimerDayLocalized + " " + hours + ":" + minutes + ":" + secs;
    }
    else {
        return hours + ":" + minutes + ":" + secs;
    }
}

var UpdateText = function(id, value) {
    if (id != undefined && id != null && id != '') {
        var obj = document.getElementById(id);
        if (obj != undefined && obj != null) {
            document.getElementById(id).innerHTML = value;
        }
    }
}

String.Limit = function(value, limitCount) {
    value = value.toLowerCase();
    if (value.length <= limitCount) return value;
    return value.substring(0, limitCount) + "...";
}

String.Format = function(text) {

    //check if there are two arguments in the arguments list
    if (arguments.length <= 1) {
        //if there are not 2 or more arguments there's nothing to replace
        //just return the original text
        return text;
    }

    //decrement to move to the second argument in the array
    var tokenCount = arguments.length - 2;

    for (var token = 0; token <= tokenCount; token++) {
        //iterate through the tokens and replace their placeholders from the original text in order
        text = text.replace(new RegExp("\\{" + token + "\\}", "gi"),
        arguments[token + 1]);
    }
    
    return text;
}

/**
 *  jQuery Plugin highlightFade (jquery.offput.ca/highlightFade)
 *  (c) 2006 Blair Mitchelmore (offput.ca) blair@offput.ca
 */
/**
 * This is version 0.7 of my highlightFade plugin. It follows the yellow fade technique of Web 2.0 fame
 * but expands it to allow any starting colour and allows you to specify the end colour as well.
 *
 * For the moment, I'm done with this plug-in. Unless I come upon a really cool feature it should have
 * this plug-in will only receive updates to ensure future compatibility with jQuery.
 *
 * As of now (Aug. 16, 2006) the plugin has been written with the 1.0.1 release of jQuery (rev 249) which
 * is available from http://jquery.com/src/jquery-1.0.1.js
 *
 * A note regarding rgb() syntax: I noticed that most browsers implement rgb syntax as either an integer 
 * (0-255) or percentage (0-100%) value for each field, that is, rgb(i/p,i/p,i/p); however, the W3C 
 * standard clearly defines it as "either three integer values or three percentage values" [http://www.w3.org/TR/CSS21/syndata.html] 
 * which I choose to follow despite the error redundancy of the typical behaviour browsers employ.
 *
 * Changelog:
 *
 *    0.7:
 *        - Added the awesome custom attribute support written by George Adamson (slightly modified)
 *        - Removed bgColor plugin dependency seeing as attr is customizable now...
 *    0.6:
 *        - Abstracted getBGColor into its own plugin with optional test and data retrieval functions
 *        - Converted all $ references to jQuery references as John's code seems to be shifting away
 *          from that and I don't want to have to update this for a long time.
 *    0.5:
 *        - Added simple argument syntax for only specifying start colour of event
 *        - Removed old style argument syntax
 *        - Added 'interval', 'final, and 'end' properties
 *        - Renamed 'color' property to 'start'
 *        - Added second argument to $.highlightFade.getBGColor to bypass the e.highlighting check
 *    0.4:
 *        - Added rgb(%,%,%) color syntax
 *    0.3:
 *        - Fixed bug when event was called while parent was also running event corrupting the
 *          the background colour of the child
 *    0.2:
 *        - Fixed bug where an unspecified onComplete function made the page throw continuous errors
 *        - Fixed bug where multiple events on the same element would speed each subsequent event
 *    0.1:
 *        - Initial Release
 * 
 * @author          Blair Mitchelmore (blair@offput.ca)
 * @version         0.5
 */
jQuery.fn.highlightFade = function(settings) {
	var o = (settings && settings.constructor == String) ? {start: settings} : settings || {};
	var d = jQuery.highlightFade.defaults;
	var i = o['interval'] || d['interval'];
	var a = o['attr'] || d['attr'];
	var ts = {
		'linear': function(s,e,t,c) { return parseInt(s+(c/t)*(e-s)); },
		'sinusoidal': function(s,e,t,c) { return parseInt(s+Math.sin(((c/t)*90)*(Math.PI/180))*(e-s)); },
		'exponential': function(s,e,t,c) { return parseInt(s+(Math.pow(c/t,2))*(e-s)); }
	};
	var t = (o['iterator'] && o['iterator'].constructor == Function) ? o['iterator'] : ts[o['iterator']] || ts[d['iterator']] || ts['linear'];
	if (d['iterator'] && d['iterator'].constructor == Function) t = d['iterator'];
	return this.each(function() {
		if (!this.highlighting) this.highlighting = {};
		var e = (this.highlighting[a]) ? this.highlighting[a].end : jQuery.highlightFade.getBaseValue(this,a) || [255,255,255];
		var c = jQuery.highlightFade.getRGB(o['start'] || o['colour'] || o['color'] || d['start'] || [255,255,128]);
		var s = jQuery.speed(o['speed'] || d['speed']);
		var r = o['final'] || (this.highlighting[a] && this.highlighting[a].orig) ? this.highlighting[a].orig : jQuery.curCSS(this,a);
		if (o['end'] || d['end']) r = jQuery.highlightFade.asRGBString(e = jQuery.highlightFade.getRGB(o['end'] || d['end']));
		if (typeof o['final'] != 'undefined') r = o['final'];
		if (this.highlighting[a] && this.highlighting[a].timer) window.clearInterval(this.highlighting[a].timer);
		this.highlighting[a] = { steps: ((s.duration) / i), interval: i, currentStep: 0, start: c, end: e, orig: r, attr: a };
		jQuery.highlightFade(this,a,o['complete'],t);
	});
};

jQuery.highlightFade = function(e,a,o,t) {
	e.highlighting[a].timer = window.setInterval(function() { 
		var newR = t(e.highlighting[a].start[0],e.highlighting[a].end[0],e.highlighting[a].steps,e.highlighting[a].currentStep);
		var newG = t(e.highlighting[a].start[1],e.highlighting[a].end[1],e.highlighting[a].steps,e.highlighting[a].currentStep);
		var newB = t(e.highlighting[a].start[2],e.highlighting[a].end[2],e.highlighting[a].steps,e.highlighting[a].currentStep);
		jQuery(e).css(a,jQuery.highlightFade.asRGBString([newR,newG,newB]));
		if (e.highlighting[a].currentStep++ >= e.highlighting[a].steps) {
			jQuery(e).css(a,e.highlighting[a].orig || '');
			window.clearInterval(e.highlighting[a].timer);
			e.highlighting[a] = null;
			if (o && o.constructor == Function) o.call(e);
		}
	},e.highlighting[a].interval);
};

jQuery.highlightFade.defaults = {
	start: [255,255,128],
	interval: 50,
	speed: 400,
	attr: 'backgroundColor'
};

jQuery.highlightFade.getRGB = function(c,d) {
	var result;
	if (c && c.constructor == Array && c.length == 3) return c;
	if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))
		return [parseInt(result[1]),parseInt(result[2]),parseInt(result[3])];
	else if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))
		return [parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55];
	else if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))
		return [parseInt("0x" + result[1]),parseInt("0x" + result[2]),parseInt("0x" + result[3])];
	else if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))
		return [parseInt("0x"+ result[1] + result[1]),parseInt("0x" + result[2] + result[2]),parseInt("0x" + result[3] + result[3])];
	else
		return jQuery.highlightFade.checkColorName(c) || d || null;
};

jQuery.highlightFade.asRGBString = function(a) {
	return "rgb(" + a.join(",") + ")";
};

jQuery.highlightFade.getBaseValue = function(e,a,b) {
	var s, t;
	b = b || false;
	t = a = a || jQuery.highlightFade.defaults['attr'];
	do {
		s = jQuery(e).css(t || 'backgroundColor');
		if ((s  != '' && s != 'transparent') || (e.tagName.toLowerCase() == "body") || (!b && e.highlighting && e.highlighting[a] && e.highlighting[a].end)) break; 
		t = false;
	} while (e = e.parentNode);
	if (!b && e.highlighting && e.highlighting[a] && e.highlighting[a].end) s = e.highlighting[a].end;
	if (s == undefined || s == '' || s == 'transparent') s = [255,255,255];
	return jQuery.highlightFade.getRGB(s);
};

jQuery.highlightFade.checkColorName = function(c) {
	if (!c) return null;
	switch(c.replace(/^\s*|\s*$/g,'').toLowerCase()) {
		case 'aqua': return [0,255,255];
		case 'black': return [0,0,0];
		case 'blue': return [0,0,255];
		case 'fuchsia': return [255,0,255];
		case 'gray': return [128,128,128];
		case 'green': return [0,128,0];
		case 'lime': return [0,255,0];
		case 'maroon': return [128,0,0];
		case 'navy': return [0,0,128];
		case 'olive': return [128,128,0];
		case 'purple': return [128,0,128];
		case 'red': return [255,0,0];
		case 'silver': return [192,192,192];
		case 'teal': return [0,128,128];
		case 'white': return [255,255,255];
		case 'yellow': return [255,255,0];
	}
};

