function restrictCharCode(start, end, str) {
	var returnVal = "";
	
	//for each character
	for (var i = 0; i < str.length; i++) {
		//if within acceptable range
		if (str.charCodeAt(i) >= start && str.charCodeAt(i) <= end) {
			returnVal += str.charAt(i);
		}
	}

	return returnVal;
}

function trackAction(myAction){
	//restrict to ASCII
	myAction = restrictCharCode(0,127, myAction);
	
	if(myAction.substr(0,1) != '/'){
		myAction = '/'+myAction;
	}
	//alert(myAction);
	
	//Google Analytics Method
	if(HappyMealConfig.GoogleAnalytics.enabled){
		//alert('GA track '+myAction);
		urchinTracker(myAction);
	}
	
	//Web Trends Method
	if(HappyMealConfig.WebTrends.enabled){
		var myWTAction	= escape(myAction).split('/').join('_');
		if(myWTAction.substr(0,1) == '_')
			myWTAction	= myWTAction.substr(1,myWTAction.length-1);
		myWTAction		= myWTAction.split('__').join('_');
		myWTAction	= escape(myWTAction);
		var myWTPath	= myAction;

		dcsMultiTrack("DCS.dcsuri", myWTPath, "WT.ti", myWTAction);
	}
	
	//Page Request Method
	//var myURL = '/'+HappyMealLocale+'/tracking.html#'+myAction;
	//silentPageRequest(myURL);
}

function silentPageRequest(myURL){
	loadXMLDoc(myURL);
}
function loadXMLDoc(url){
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("GET", url, true);
        req.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange;
            req.open("GET", url, true);
            req.send();
        }
    }
}
function processReqChange(){
    // only if req shows "complete"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
            // ...processing statements go here...
        } else {
            // uh oh bad things happened
        }
    }
}