
// set default values for each parameter
var s_pageType=""
var s_prop1=""
var s_prop2=""
var s_prop3=""
var s_prop4=""
var s_prop5=""
var s_prop6=""
var s_prop7=""
var s_prop8=""
var s_prop9=""
var s_prop10=""
var s_prop11=""
var s_prop12=""
var s_prop13=""
var s_prop14=""
var s_prop15=""
var s_prop16=""
var s_prop17=""
var s_prop18=""
var s_prop19=""
var s_prop20=""
/* E-commerce Variables */
var s_campaign=""
var s_setRef=""
var s_state=""
var s_zip=""
var s_events=""
var s_products=""
var s_purchaseID=""
var s_eVar1=""
var s_eVar2=""
var s_eVar3=""
var s_eVar4=""
var s_eVar5=""
var s_eVar6=""
var s_eVar7=""
var s_eVar8=""
var s_eVar9=""
var s_eVar10=""
var s_dlrcode=""
var s_dlrdist=""
var s_dlrarea=""
var ns=""

//Begin TeamOne page naming code
function initcap(str) {
	var tempstring;
	tempstring = str.substr(0,1).toUpperCase() +
str.substring(1,str.length).toLowerCase();
	var sp = '_';
	var spacepos = tempstring.indexOf(sp);
	if (spacepos != -1) {
		tempstring = tempstring.substring(0,spacepos) + " " +
initcap(tempstring.substring(spacepos+1, tempstring.length));
	}
	return tempstring;
}


function removeStrings(str, arrayOfDrops) {
	var tempIdx, newIdx, i;

	var tempstring = str;
	for (i=0; i<arrayOfDrops.length; i++) {
		tempIdx = tempstring.indexOf(arrayOfDrops[i]);
		newIdx = tempIdx+arrayOfDrops[i].length;

		if (tempIdx > -1) {
			if (tempstring.charAt(newIdx) == " ") {
				newIdx++;
			}
			tempstring = tempstring.substr(0,tempIdx) +
tempstring.substr(newIdx,str.length);
		}
	}
	return tempstring;
}

var sectnames = new Array();
sectnames['es'] = "ES 300";
sectnames['gs'] = "GS 430/300";
sectnames['gx'] = "GX 470";
sectnames['is'] = "IS 300";
sectnames['ls'] = "LS 430";
sectnames['lx'] = "LX 470";
sectnames['rx'] = "RX 330";
sectnames['sc'] = "SC 430";
sectnames['cpo'] = "CPO";
sectnames['brochures_pda'] = "Brochures/PDA";
sectnames['warranty_vehicle_protection'] = "Warranty/Protection";
sectnames['about'] = "ABT";
sectnames['dealers'] = "DLR";
sectnames['models'] = "MDL";
sectnames['financial'] = "FIN";
sectnames['Lexusconfigapp'] = "BYL";
sectnames['Lexusowners'] = "OWN";
sectnames['espanol'] = "ESP";

var dropnames = new Array();
dropnames[0] = "Lexus ";
dropnames[1] = "Certified Pre-Owned";
dropnames[2] = "Warranty/Protection";
dropnames[3] = "http://lexus.edmunds.com -";
dropnames[4] = "http://search.lexus.com -";
dropnames[5] = "http://www.lcpo.com -";
dropnames[6] = "http://www.lexus.com -";
dropnames[7] = "http://www.lexus.com/ -";
dropnames[8] = "http://www.tristatelexus.com -";
dropnames[9] = "https://secure.lexus.com -";
dropnames[10] = "https://usalexus.programhq.com -";
dropnames[11] = "https://www.lexus.com -";

var dropdirs = new Array();
dropdirs[0] = "Lexus:Jsp:Pub:";

var temp = document.URL;

if (temp.indexOf("?") > -1) {
	temp = temp.substring(0, temp.indexOf("?"));
}

var spliturl = temp.split("/");
var pagetitle = "";
var tempTitle = "";
if (spliturl.length > 4) { 
/* 0 = http:, 1 = "" (between //), 2 = "www.lexus.com",*/
/* plus 1 for html file name which shouldn't be included */
/* start at 3 for Dev/Staging/Production, 16 for TeamSite */
	for (i = 3; i < spliturl.length-1; i++) {
		if (sectnames[spliturl[i]]) {
			pagetitle += sectnames[spliturl[i]] + ":";
		} else {
			pagetitle += initcap(spliturl[i]) + ":";
		}
	}
}

tempTitle = removeStrings(document.title, dropnames);
pagetitle = removeStrings(pagetitle, dropdirs);

s_pageName = "L:" + pagetitle + tempTitle;
s_channel = sectnames[spliturl[3]];
s_server = document.location.host;
// End TeamOne Page Naming Code 
