function OmnitureParams() {
	this.pageName = ""; 
	this.channel = ""; 
	this.prop1 = "";
	this.prop2 = "";
	this.prop3 = "";
	this.hier1 = "";
	this.prop4 = "";
	this.prop5 = "";
	this.prop6 = "";
}
var delimiter = ":" ;
var delimiterReplaceChar = " " ; 

function getOmnitureParams( pageType, channel, section, category, contentType, title, contentID ) {
	var p = new OmnitureParams();

	pageType = clearInputString(pageType) ;  
	channel = clearInputString( channel );  
	section = clearInputString( section) ;  
	category =  clearInputString( category );  
	contentType = clearInputString( contentType ) ;  
	title = clearInputString( title ) ;  
	contentID = clearInputString( contentID ) ;    

	switch ( pageType ){
		case "main_page" :
			p = mainPageParams(channel, section );
		break;
		case "cat_page" :
			p = catPageParams(channel, category, contentType, title, contentID );
		break;
		case "cat_all_content_page" :
			p = catAllContentPageParams( channel, section, category,  contentType, title, contentID );
		break;
		case "cat_content_page" :
			p = catContentPageParams( channel, section, category,  title, contentID );
		break;
		default : p = null;
	}
	p.prop15 = getUserInfoString();
	p.eVar15 = s.prop21;	
	

	return p;
}
function mainPageParams(channel, section ){
	var params = new OmnitureParams();
	params.pageName = channel + delimiter + section;
	params.channel = channel ; 
	params.prop1 = "" ; 
	params.prop2 = "" ; 
	params.prop3 = "" ; 
	params.hier1 = channel + delimiter + section ; 
	params.prop4 = "" ; 
	params.prop5 = "" ; 
	params.prop6 = "" ; 	

	return params ;
}
function catPageParams(channel, category, contentType, title, contentID ){
	var params = new OmnitureParams();
	category = clearCategoryUrl( category );
	params.pageName = channel + delimiter + category;
	params.channel = channel ; 
	params.prop1 = channel + delimiter + category ; 
	params.prop2 = channel + delimiter + category ; 
	params.prop3 = channel + delimiter + category ; 
	params.hier1 = channel + delimiter + category ; 
	params.prop4 = contentType ; 
	params.prop5 = title ; 
	params.prop6 = contentID ; 	

	return params ;
}
function catAllContentPageParams( channel, section, category, contentType, title, contentID ){
	var params = new OmnitureParams();

	category = clearCategoryUrl( category );
	params.pageName = channel + delimiter + category + delimiter + section;
	params.channel = channel ; 
	params.prop1 = channel + delimiter + category ; 
	params.prop2 = channel + delimiter + category + delimiter + section ; 
	params.prop3 = channel + delimiter + category + delimiter + section; 
	params.hier1 = channel + delimiter + category + delimiter + section; 
	params.prop4 = contentType ; 
	params.prop5 = title ; 
	params.prop6 = contentID ; 	
	
	return params ; 
}
function catContentPageParams( channel, section, category, title, contentID ){
	var params = new OmnitureParams();
	category = clearCategoryUrl( category );
	var contentPageName = getContentNameBySection( section ) + " page" ; 
	params.pageName = channel + delimiter + category + delimiter + contentPageName ;
	params.channel = channel ; 
	params.prop1 = channel + delimiter + category ; 
	params.prop2 = channel + delimiter + category + delimiter + contentPageName ; 
	params.prop3 = channel + delimiter + category + delimiter + contentPageName; 
	params.hier1 = channel + delimiter + category + delimiter + contentPageName; 
	params.prop4 = getContentNameBySection(section) ; 
	params.prop5 = title ; 
	params.prop6 = contentID ; 	
	
	return params ; 
}

function getContentNameBySection( section ){
	if (section == "articles" ) return "article" ; 
	else if (section == "links") return "resource";
	else if ( section == "tips" ) return "tip";
	else if ( section == "official-announcements" || section == "press-releases" || section == "newdeliveries") return "press release";
	else if ( section == "clip" || section == "videos" || section == "comingsoon" ) return "video";
	else if ( section == "job listings" ) return "job listing";
	else if ( section == "interest-request" ) return "interest requests";
	else if ( section == "grants" ) return "grant";
	else if ( section == "alerts" ) return "alert";
	else if ( section == "events" ) return "training event";
	else if ( section == "providers" ) return "customer";
	else if ( section == "products" ) return "product";
	else if ( section == "firerescue1 team" ) return "firerescue1 team";
	else if ( section == "member submissions" ) return "member submission";
	else if ( section == "news reports") return "news report";
	else if ( section == "manufacturers" || section == "technology-providers" || section == "service-providers" || section == "distributors") return "sponsor";
}

function getUserInfoString(){
	return (!isNaN(parseInt(userID)) && parseInt(userID) > 0 ? "Logged in" : "Anonymous").toLowerCase();
}

function clearInputString(string){
	var reDelim = new RegExp(delimiter, "ig") ; 
	return ( string > "" ? string.toLowerCase().replace(reDelim, delimiterReplaceChar) : "" ) 
}

function clearCategoryUrl( url ){
	var reMinus = /-/ig
	var reSlash = /\//ig
	url = url.replace(reMinus, delimiterReplaceChar);
	url = url.replace(reSlash, delimiterReplaceChar); // replace slashes into url to spaces
	return trim(url) ; 
}
function trim(string){ return string.replace(/(^\s+)|(\s+$)/g, ""); }

