/* 	######################
	if a page needs a js variable, it can define it in its own js file and use it here.
	pages that dont define it, will set it to empty string, thanks to the next declarations...
	######################
*/
if (typeof vehicle == "undefined") var vehicle = "";
if (typeof site == "undefined") var site = "";
if (typeof menuType == "undefined") var menuType = "";
if (typeof superCat == "undefined") var superCat = "";
if (typeof superItem == "undefined") var superItem = "";
if (typeof modelId == "undefined") var modelId = "";

/* 	######################
	hash of uri's and corresponding flash replacement values
	######################
*/

var URIs = new Array();
URIs['/mediumduty/index.jsp'] = new Array("gPageWrapper","/mediumduty/flash/homepage/homeStage_gmc.swf","1000","800","smenu=" + menuType + "&site=" + site + "");
URIs['/mediumduty/' + brand + '/' + vehicle + '/index.jsp'] = new Array("gContent","/mediumduty/flash/vehicleHome/modelPages.swf","840","790","brand=" + brand + "&section=masthead&site=" + site + "");
URIs['/mediumduty/' + brand + '/' + vehicle + '/colors.jsp'] = new Array("gContent","/mediumduty/flash/vehicleHome/modelPages.swf","840","790","brand=" + brand + "&section=colors&site=" + site + "");
URIs['/mediumduty/' + brand + '/' + vehicle + '/configuration.jsp'] = new Array("gContent","/mediumduty/flash/vehicleHome/modelPages.swf","840","790","brand=" + brand + "&section=masthead&site=" + site + "");
URIs['/mediumduty/' + brand + '/' + vehicle + '/features.jsp'] = new Array("gContent","/mediumduty/flash/vehicleHome/modelPages.swf","840","790","brand=" + brand + "&section=masthead&site=" + site + "");
URIs['/mediumduty/' + brand + '/' + vehicle + '/engines.jsp'] = new Array("gContent","/mediumduty/flash/vehicleHome/modelPages.swf","840","790","brand=" + brand + "&section=masthead&site=" + site + "");
URIs['/mediumduty/' + brand + '/' + vehicle + '/photos360.jsp'] = new Array("gContent","/mediumduty/flash/vehicleHome/modelPages.swf","840","790","brand=" + brand + "&section=gallery&site=" + site + "");
URIs['/mediumduty/' + brand + '/' + vehicle + '/safety.jsp'] = new Array("gContent","/mediumduty/flash/vehicleHome/modelPages.swf","840","790","brand=" + brand + "&section=masthead&site=" + site + "");
URIs['/mediumduty/currentoffers/index.jsp'] = new Array("pFlashMap","/mediumduty/flash/currentOffers/currentOffers.swf","839","428","brand=" + brand);
URIs['/mediumduty/popup/' + brand + '/' + superCat + '.jsp'] = new Array("gContent","/mediumduty/flash/divisional/superpop.swf","605","580","brand=" + brand + "&superCat=" + superCat + "&site=" + site + "&superItem=gspMenu" + superItem);

URIs['/mediumduty/modelSelector.jsp'] = new Array("pModelSelectorContent","/mediumduty/flash/allvehicles/modelselector.swf","615","655","");

URIs['/mediumduty/' + brand + '/' + vehicle + '/locate.jsp'] = new Array("gContent","/mediumduty/flash/locate.swf","840","790","brand=" + brand + "&site=" + site + "&section=masthead&modelId=" + modelId + "&year=2007");

/* 	######################
	flash replacement
	######################
*/
if(URIs[uri] != undefined && useFlash == "Y"){
	// if flash is present && uri is listed above && and we want to use flash, replace flash
	var replaceNode = getElemRefs(URIs[uri][0]);
	var swfName = URIs[uri][1];
	var width = URIs[uri][2];
	var height = URIs[uri][3];
	var params = URIs[uri][4];
	
	var bgColor = "#000000";
	if (uri == "/mediumduty/currentoffers/index.jsp") bgColor="#2C2F38";
	
	if (typeof(lcId) != "undefined") {
		if (lcId != null) { 
			params += "&lcId="+ lcId;
		}
	}

	//sIFR.replaceElement(named({nWidth:width,nHeight:height,oNodeRef: replaceNode, sFlashSrc:swfName, sColor:"#FFFFFF", sLinkColor:"#000000", sBgColor:bgColor, sHoverColor:"#CCCCCC", nPaddingTop:0, nPaddingBottom:0, sFlashVars:params}));
	var so = new SWFObject(swfName, "flashReplaced", width, height, "8", bgColor);
	so.addVariable("allowscriptaccess", "always");
	
	if (params) {
		var pp = params.split("&");
		for (var q = 0; q < pp.length; q++) so.addVariable(pp[q].split("=")[0], pp[q].split("=")[1]);
	}
	so.addVariable("txtCount", 1);
	var ihtml = sIFR.myInnerHTML(replaceNode);
	ihtml = ihtml.split("\"").join(escape("\""));
	ihtml = ihtml.split("&").join(escape("&"));
	
	so.addVariable("txt0", ihtml);
	so.addParam("align","top");
	so.addParam("scale","noorder");
	so.addParam("salign","left");
	so.addParam("wmode","transparent");
	
	so.write(replaceNode.id);
	
} else if( (uri.indexOf( brand + '/' + vehicle ) > -1) && (brand != "")){
	
	var obj = getElemRefs("gContent");
	obj.className = "noFlash";
}
else{
	// otherwise, make XHTML display:block (with a special case for homepage
		if(uri == '/mediumduty/index.jsp') {
			document.getElementById('gNav').style.display = 'block';
			document.getElementById('gContent').style.display = 'block';
		}
	
		 else {
			document.getElementById('gXHTMLContent').style.display = 'block';
		}
}

if (uri == "/mediumduty/currentoffers/index.jsp") document.getElementById('gXHTMLContent').style.display = 'block';
