function trackEvent(category,action,label,value) {
	if (category == 'pageView') {
		trackPageView(action);
	} else if (category && action) {
		//console.log(category + ', ' + action + ', ' + label + ', ' + value);
		if (action == 'Share') {
			if (label == 'Print' || label == 'Copy URL to clipboard' || label == 'Facebook' || label == 'Twitter' || label == 'Email') {
				trackPageView('sharedit');
			}
		}
		if (category != null && action != null) {
			if (label != null) {
				if (value != null) {
					//console.log(category + ', ' + action + ', ' + label + ', ' + value);
					pageTracker._trackEvent(category, action, label, value);
				} else {
					//console.log(category + ', ' + action + ', ' + label);
					pageTracker._trackEvent(category, action, label);
				}
			} else {
				//console.log(category + ', ' + action);
				pageTracker._trackEvent(category, action);
			}
		} 
	}
}

var p_welcome = false;
var p_calculator = false;
var p_facts = false;
var p_productinbasket = false;
var p_finishandshare = false;
var p_sharedit = false;

function trackPageView(stepname) {
	if (stepname == 'welcome' && p_welcome == false) {
		p_welcome = true;
		actualTrackPageView(stepname);
	} else if (stepname == 'calculator' && p_calculator == false) {
		p_calculator = true;
		actualTrackPageView(stepname);
	} else if (stepname == 'facts' && p_facts == false) {
		p_facts = true;
		actualTrackPageView(stepname);
	} else if (stepname == 'productinbasket' && p_productinbasket == false) {
		p_productinbasket = true;
		actualTrackPageView(stepname);
	} else if (stepname == 'finishandshare' && p_finishandshare == false) {
		p_finishandshare = true;
		actualTrackPageView(stepname);
	} else if (stepname == 'sharedit' && p_sharedit == false) {
		p_sharedit = true;
		actualTrackPageView(stepname);
	} 
}

function actualTrackPageView(stepname) {
	pageTracker._trackPageview("/organiccounts/"+stepname+"/");
	//console.log("/organiccounts/" + stepname + "/");
}
