	var modelSection = 'masthead';
	
	/*
	Inputs:
-	brand: brand name
-	trim: trim name
-	section: section name

	Outputs:
	true OR false depending on the value stored in the JSON database
	*/
	/*
	Recorre la bd de secciones y esconde o muestra dependiendo de brand y trim
	*/
	function checkSection(brand, trim) {
		vehicle = trim;
	    var show=false;
		for (var x in modelsNav[brand]["submodels"][trim]) {	
			show= displaySection(brand, trim, x);
			showSectionLink(x, show);
		}
		
	}
	
	function displaySection (brand, trim, section){
		if(modelsNav[brand]["submodels"][trim][section] == "yes")
			return true;
		else
			return false;		
	}
	
	function showSectionLink(section, show) {
		var display = show ? "block" : "none";
        document.getElementById("section_" + section).style.display = display; 
	 	//document.write(display);
	}
	
	function getFlashShell() {
		var gc = document.getElementById("gContent");
		if (gc) {
			var result = gc.firstChild;
			while (result.nodeType != 1) result = result.nextSibling;
			if (result.nodeType == 1) return result;
		}
		return null;
	}
	
	function getHybridFlashShell() {
		var gc = document.getElementById("sierraHybrid");
		if (gc) {
			var result = gc.firstChild;
			while (result.nodeType != 1) result = result.nextSibling;
			if (result.nodeType == 1) return result;
		}
		return null;
	}
	
	function getFlashShellHere(gc) {
		if (gc) {
			var result = gc.firstChild;
			while (result.nodeType != 1) result = result.nextSibling;
			if (result.nodeType == 1) return result;
		}
		return null;
	}
	
	function switchBrand(url) {
		
		var fs = getFlashShell();
		if (fs != null)	{
			if (((url.indexOf("savana") > 0) && (url.indexOf("cutaway") > 0)) && (modelSection == "colors")||
			    ((url.indexOf("canyon") > 0) && (url.indexOf("chassis") > 0)) && (modelSection == "colors")||
				((url.indexOf("canyon") > 0) && (url.indexOf("chassis") > 0)) && (modelSection == "accessories"))
				modelSection = "masthead";
				
			if(modelSection != "masthead"){
				url= url.substring(0, url.lastIndexOf('/')) + '/' + modelSection + '.jsp';
			}else {
				url=url.substring(0, url.lastIndexOf('/')) + '/index.jsp';
			}
			//alert(url);
			//fs.switchBrand(url, modelSection);
			window.open(url,"_self");
			return false;
		} else return true;
	}
	
	function switchSection(section) {
		modelSection = section;
	}

	function getPageURL() {
		var fs = getFlashShell();
		//window.alert('getPageURL fs '+fs);
		if (fs != null)	{			
			fs.setPageURL(window.document.URL);			
		}
	}
	
	function getHybridURL() {
		var fs = getHybridFlashShell();
		//window.alert('getPageURL fs '+fs);
		if (fs != null)	{			
			fs.setPageURL(window.document.URL);			
		}
	}
	
	function getHybPageURL() {
		/*var fs = getFlashShellHere(getFlashShellHere(getFlashShell()));
		if (fs != null)	{
			fs.setPageURL(window.document.URL);			
		}*/
		return window.document.URL;
	}
	
	function showPopMovie(url, data) {
		var fs = getFlashShell();
		if (fs != null)	{
			fs.showPopMovie(url, data);
		}
	}
	
	function showPopLT() {
		var fs = getFlashShell();
		if (fs != null)	{
			fs.showLetsTalkPop();
		}
	}
	
	function showWindow(url, id, params) {
		//window.alert ("Show Window!!" + url);
		window.open(url, id, params);
	}
	
	
	function changeImage(componentRout, url) {
		var fs = getFlashShell();
		if (fs != null)	{
			fs.changeImage(componentRout, url);
		}
	}
	
	
	
	/*****************************************************/
function activeItem(anchor){
	hideSections();
	anchor.parentNode.className = "selectedItem";
	anchor.blur();	
}

function hideSections() {
	var ul = document.getElementById("modelNav");
	for (var q = 0; q < ul.childNodes.length; q++) {
		if (ul.childNodes[q].nodeName == "LI") 
			ul.childNodes[q].className = "";
	}	
}





/*************************************************/