/*
 HighCharts configurations
 */


// String date to UTC ("2011-12-30")

function strToUTC(dateStr) {
	var dateArr = dateStr.split('-');
	return Date.UTC(
		parseInt(dateArr[0],10),
		parseInt(dateArr[1],10)-1,
		parseInt(dateArr[2],10)
	);
}

// Config object
var HighChartsConfig = {};


// Boutiekpagina
HighChartsConfig.boutiek = function() {
	return {
		chart: {
			renderTo: '?',
			reflow: false,
			backgroundColor: null
		},
		credits: {
			enabled: false
		},
		title: {
			align: 'left',
			text: historyGraphText,
			x: 0,
			style: {
				color: '#776f67',
				fontSize: '13px'
			}
		},
		xAxis: {
			type: 'datetime',
			lineColor: '#a69d96',
			labels: {
				style: {
					color: '#a69d96'
				}
			}
		},
		yAxis: {
			title: null,
			maxZoom: 0.1,
			gridLineColor: '#9bcff6',
			gridLineDashStyle: 'ShortDash',
			labels: {
				style: {
					color: '#38bfe9'
				}
			}
		},
		tooltip: {
			formatter: function() {
				var point = this.points[0];
				return Highcharts.dateFormat('%A %B %e %Y', this.x) + ':<br/>' +
						'Value: ' + Highcharts.numberFormat(point.y, 2);
			},
			shared: true
		},
		legend: {
			enabled: false
		},
		plotOptions: {
			series: {
				marker: {
					enabled: false,
					states: {
						hover: {
							enabled: true,
							radius: 3
						}
					}
				}
			}
		},
		series: [
			{
			    name: historyGraphText,
				data: []
			}
		],

		exporting: {
			enabled: false
		}
	}
}

// Boutiekdata processor
function processBoetiekData(data){
	for (var i=0; i<data.length; i++) {
		if (typeof data[i][0] === 'string')
			data[i][0] = strToUTC(data[i][0]);
	}
	return data;
}
