function cleanArray(actual){
	var newArray = new Array();
	for(var i = 0; i<actual.length; i++){
		if (actual[i]){
			newArray.push(actual[i]);
		}
	}
	return newArray;
}

function buildOmniVars(){
	var arrPath = new Array();
	var counter = 0;
	var pageName = "glorieta";
	var fileName, i;

	arrPath = cleanArray(document.location.pathname.split("/"));

	if (arrPath.length <= 0) {
		arrPath.push("homepage");
	}
	
	for (var i=0; i<arrPath.length; i++) {
	  if (arrPath[i] != "") {
		counter++;
		pageName += ":";

		//remove everything after the dot
		pageName += arrPath[i].replace(/\.[a-zA-Z0-9]+$/,"");
		
		//props are the menu structure incrementally 
		if (counter < 5) {
		  objOmni.setVar("prop"+counter, pageName);
		}
		else if (counter == 5) { 
		  objOmni.setVar("prop15", pageName);
		}
	  }
	}

	//pageName is the entire menu structure
	if (pageName != "") {
	  objOmni.setVar("pageName", pageName);
	}

	//prop5 is the page type
	objOmni.setVar("prop5", "glorieta page view");	
	
	//channel 
	objOmni.setVar("channel", "glorieta");
}

buildOmniVars();



