///////////////////////////////////   CTS   //////////////////////////////////////////

			/**  ** ** Loading topnav from XML starts here ** **  **/
			/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

			var xmlDoc;
			var hostname=window.location.hostname;
			var isEspanol = false;
			// get a reference to the hostname unsullied by https or "build"
			//var nonSecNonToolsPath = (!secureURIfound) ? getCurrentSiteForPromos() : nonSecurePath;
			var nonSecNonToolsPath = "";
			var IE = document.all?true:false;

/**  Opening XML document  */
// This function imports XML using xmlPath and creates an XML Object for
// implementing DOM and extracting the data from XML.
function importXMLRaw(){
	if (document.implementation && document.implementation.createDocument)
	{
		xmlDoc = document.implementation.createDocument("", "", null);
		xmlDoc.onload = createTopNav;
	}
	else if (window.ActiveXObject)
	{
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.onreadystatechange = function () {
			if (xmlDoc.readyState == 4)
				createTopNav();
		};
 	}
	else
	{
		return;
	}

	// xmlPath holds the path of the xml file.
	//var xmlPath = nonSecNonToolsPath+"/../../sav/xml/non-flash/nonFlash.xml";
	var xmlPath = nonSecNonToolsPath+"xml/non-Flash/nonFlash.xml";
	xmlDoc.load(xmlPath);
}

				// Implements XML load using jQuery
	function importXML() {
					//alert("in importXML");
					if (currentURI.indexOf('http://stage.build.infiniti.com') > -1){
						var xmlPath = "http://stage.build.infiniti.com/ngstcms_infiniti/js/non-flash/nonFlash.xml";
					}else if (currentURI.indexOf('http://build.infiniti.com') > -1){
						var xmlPath = "http://build.infiniti.com/ngstcms_infiniti/js/non-flash/nonFlash.xml";
					}else if (currentURI.indexOf('secure.infiniti.com') > -1){
						var xmlPath = "https://secure.infiniti.com/xml/non-flash/nonFlash.xml";
					}else if (currentURI.indexOf('qa1.infiniti.com') > -1 || currentURI.indexOf('qa2.infiniti.com') > -1){
            var xmlPath = "xml/non-Flash/nonFlash.xml";
					}else{
						var xmlPath = nonSecNonToolsPath+"xml/non-Flash/nonFlash.xml";
					}

					if (typeof jQuery != 'undefined') {
						jQuery.ajax({url: xmlPath, async: false, dataType: "xml",
							error: function (o, status, error) {if (typeof(console) != 'undefined') console.log("o: " + o + "\nstatus: " + status + "\nerror: " + error);},
							success: function (data, status) {xmlDoc = data; createTopNav(); }
						});
					} else {
						importXMLRaw();
					}
	}

				/** Topnav is a constructor to hold attributes of each menu item*/
				function topnavitem(name,source,href,disabled,imgPath,border,bordercolor){
					this.name = name;
					this.source = source;
					this.href = href;
					this.disabled = disabled;
					this.imgPath = imgPath;
					this.border = border;
					this.bordercolor = bordercolor;
				}

				function vehicle_ds(name, imgPath)
				{	
					this.name = name;
					this.imgPath = imgPath ;
				}

				// set to resolve Safari bug
				varMenuComplete = false;
				//var vehicleImgArray = new Array(new Array(50),new Array(50));
				var vehicleImgArray = new Array();

				/*for (i=0; i <30; i++)
				{
					vehicleImgArray[i]=new Array(30)
				}*/

				/** Creates top navigator using data from XML sheet */
				function createTopNav(){
					if (varMenuComplete==true){
						return;
					}
					var menus = xmlDoc.getElementsByTagName("menu");
					var no_of_menus = menus.length;
					jQuery("#gTopNav").html("");
					jQuery("#gTopNavExternal").html("");
					for(var i=0; i<menus.length; i++)
					{
						var iframeWidth=0;
						var iframeHeight=0;
						var menuitems = menus[i].childNodes;
						var no_of_items = menus[i].childNodes.length;
						var topnavarray = new Array(no_of_items);
						var j=0;
						if (menus[i].childNodes[j].nodeType != 1)
							j++;
						if(menus[i].childNodes[j].firstChild.nodeValue=="iframe"){
							iframeWidth = menus[i].childNodes[j].getAttribute("width");
							iframeHeight=  menus[i].childNodes[j].getAttribute("height");
							j++;
							if (menus[i].childNodes[j].nodeType != 1)
								j++;
						}
						//Added
						/*if(i!==0)
						{
							var markerDiv = document.createElement('div');
							markerDiv.id="markerDiv"+i;
							var markerImg = document.createElement('img');
							markerImg.src = "xml/img/non-Flash/headerNav/marker.gif";
							markerDiv.appendChild(markerImg);
							markerDiv.style.position = "relative";
							markerDiv.style.top = 45;
							document.getElementById('gTopNav').appendChild(markerDiv);
						}*/
						topnavarray[0] = new topnavitem(menus[i].childNodes[j].firstChild.nodeValue,menus[i].childNodes[j].getAttribute("src"),menus[i].childNodes[j].getAttribute("href"),menus[i].childNodes[j].getAttribute("disabled"));
						j++;
						for( ; j<no_of_items; j++)
						{
							if (menus[i].childNodes[j].nodeType != 1)
								continue;
							menus[i].childNodes[j].getAttribute("order");
							topnavarray[menus[i].childNodes[j].getAttribute("order")] = new topnavitem(menus[i].childNodes[j].firstChild.nodeValue,menus[i].childNodes[j].getAttribute("src"),menus[i].childNodes[j].getAttribute("href"),menus[i].childNodes[j].getAttribute("disabled"),menus[i].childNodes[j].getAttribute("imgPath"),menus[i].childNodes[j].getAttribute("border"),menus[i].childNodes[j].getAttribute("border-color"));
							//vehicleImgArray[k][l] = topnavarray[menus[i].childNodes[j].getAttribute("order")].imgPath;
						}
						createmenu(topnavarray,iframeWidth,iframeHeight);
					}
					jQuery("a[@href=null]").removeAttr("href");
					jQuery("#gTopNav > div").css("float", "left");
					jQuery("#gTopNav *").css("z-index", "370");
					jQuery("#gTopNav > div > div").css("position","absolute");
					//jQuery("#gTopNav > div > div > div").css({width:"170px",borderBottom:"1px solid #A1A1A1"});
					jQuery("#gTopNav > div > div").hide();
					jQuery("#gTopNav > div > iframe").hide();
					jQuery("#gTopNav > div").hover(function(){showMenu(jQuery(this).attr("ID"),jQuery("#"+jQuery(this).attr("ID") +">"+" div").attr("ID"));},function(){hideMenu(jQuery(this).attr("ID"),jQuery("#"+jQuery(this).attr("ID") +">"+" div").attr("ID"));});
					jQuery("#gTopNav > div > div > div > a > img").css("cursor","pointer");
					jQuery("#gTopNav > div > div > div > div > a > img").css("cursor","auto");
					//jQuery("#gTopNav > div > a > img ").each(function() {setOverSrc(this)});
					var nissan_logo = document.getElementById("imgnissan_logo");
					setOverSrc(nissan_logo);
					document.getElementById("nissan_logo").style.position="absolute";
					document.getElementById("nissan_logo").style.top="10px";
					document.getElementById("nissan_logo").style.left="0px";
					jQuery("#gTopNav > div > div > div > a > img ").each(function() {setOverSrc(this)});
					//jQuery("#gtopnav > div > div > div > div> a >img").css("z-index","370");
					jQuery("#gTopNav > div > a > img ").css("z-index", "300");
					jQuery("#gTopNav > div > div > div").hover(function(){
								var vehSrc = "";
								var element = this.childNodes[0].childNodes[0];
								if(element.id)
								{
									//alert("id is: "+element.id);
									for(var i=0; i<vehicleImgArray.length; i++)
									{
										if(vehicleImgArray[i].name == this.id && vehicleImgArray[i].imgPath!='')
										{
											vehSrc = vehicleImgArray[i].imgPath;
										}
									}
									//alert("disabled: "+topnavarray[0].disabled+" topnavarray: "+topnavarray[0].name);
									if(vehSrc!='')
									{
										vehicleDiv = document.createElement("div");
										vehicleDiv.id = "vehicleDiv";
										var imgDiv = document.createElement("img");
										imgDiv.id="img_vehicle";
										//imgDiv.src="xml/img/non-Flash/vehicles/versa_vehicle.png";
										//imgDiv.src = "img/sav_global_nav/car_flyouts/sav_global_nav_flyout_versa.jpg";
										imgDiv.src = vehSrc;
										jQuery(imgDiv).hover(
											function(){
												var temp = element.src;
												var newStr = temp.replace(".jpg","_on.jpg");
												element.src = newStr;
											},
											function(){
												var temp = element.src;
												var newStr = temp.replace("_on.jpg",".jpg");
												element.src = newStr;
											});

										vehicleDiv.style.position = "absolute";
										if(IE)
										{
											var top1 = (jQuery("#"+(this.id)).offset().top)-94;
										}
										else
										{
											var top1 = (jQuery("#"+(this.id)).offset().top)-87;
										}

			//alert("id is:"+this.id+"top1:"+top1+"Offset:"+jQuery("#"+(this.id)).offset()+"top:"+jQuery("#"+(this.id)).offset().top);
										vehicleDiv.style.left = "147px";
										vehicleDiv.style.top = top1+"px";
										vehicleDiv.style.zIndex="400";
										if(element.id == "imgFrontier")
										{
											vehicleDiv.style.top = "-4px";
											//alert("inside");
										}
										vehicleDiv.appendChild(imgDiv);
										//(this.parentNode).parentNode.appendChild(vehicleDiv);
										this.appendChild(vehicleDiv);
									}
								}
							}
							,function(){
								try
								{
									this.removeChild(vehicleDiv);
									//(this.parentNode).parentNode.removeChild(vehicleDiv);
									//alert("Node: "+(vehicleDiv.id));
									//jQuery(vehicleDiv).css("display","none");

								}
								catch (e)
								{
									return;
								}	

							});

						currentLocation1 = window.location;
						if(String(currentLocation1).indexOf("espanol") != -1)
							isEspanol = true;
						else
							isEspanol = false;
						if(isEspanol)
						{
							jQuery("#see_all_vehicles").css({position:"absolute",left: "278px",top:"42px"});
							jQuery("#cars").css({position:"absolute",left: "417px", top:"42px" });
							jQuery("#suvs").css({position:"absolute",left: "556px", top:"42px" });
							jQuery("#trucks").css({position:"absolute",left: "690px", top:"42px" });
							jQuery("#future").css({position:"absolute",left: "813px", top:"42px" });
							/*if(String(currentLocation1).indexOf("index") != -1)
							{
								alert("in esponal");
								document.getElementById('imgsee_all_vehicles').src = "/img/sav_redesign/sav_globalnav_top/spanish/es_see_all_veh_selected.gif";
							}*/
						}
						else
						{
							jQuery("#see_all_vehicles").css({position:"absolute",left: "278px",top:"42px"});
							jQuery("#cars").css({position:"absolute",left: "379px", top:"42px" });
							jQuery("#suvs").css({position:"absolute",left: "473px", top:"42px" });
							jQuery("#trucks").css({position:"absolute",left: "607px", top:"42px" });
							jQuery("#future").css({position:"absolute",left: "698px", top:"42px" });
							/*if(String(currentLocation1).indexOf("index") != -1)
							{
								alert("in english");
								document.getElementById('imgsee_all_vehicles').src = "/img/sav_redesign/sav_globalnav_top/see_all_veh_selected.gif";
							}*/
						}
					if(isEspanol)
						createEsFooter();
					else
						createFooter();
					varMenuComplete = true;

					/*if(String(currentLocation1).indexOf("index") != -1)
					{
						document.getElementById('imgsee_all_vehicles').src = "/img/sav_redesign/sav_globalnav_top/see_all_veh_selected.gif";
					}*/
				}

				// This function creates menu for each item in the topNav depending on no. of menuitems
				// provided in the nonFlash.xml.
				function createmenu(menuarray,iframeWidth,iframeHeight)
				{
					var menuheaderdiv = imageanchordiv(menuarray[0].name,menuarray[0].source,menuarray[0].href,menuarray[0].disabled);
					var itemdiv = document.createElement("div");
					itemdiv.id = menuarray[0].name+"items";
					var fixdiv = document.createElement("div");
					fixdiv.id = menuarray[0].name+"items1";
					var itemiframe = document.createElement("iframe");
					itemiframe.id = menuarray[0].name+"itemsiframe";
					jQuery(itemiframe).css({width:iframeWidth, height:iframeHeight});
					for(var k=1; k<menuarray.length && menuarray[k]!=null; k++){
						//alert("name: "+menuarray[k].name +"imgPath: "+menuarray[k].imgPath);
						vehicleImgArray.push(new vehicle_ds(menuarray[k].name,menuarray[k].imgPath));
						var menuImageDiv = imageanchordiv(menuarray[k].name,menuarray[k].source,menuarray[k].href,menuarray[k].disabled);

						if(menuarray[k].border!=null ){
							jQuery(menuImageDiv).css({borderBottomWidth:menuarray[k].border, borderColor:menuarray[k].bordercolor, borderBottomStyle:"solid"});
						}

						itemdiv.appendChild(menuImageDiv);
					}

					fixdiv.innerHTML=itemdiv.innerHTML;
					menuheaderdiv.appendChild(itemdiv);
					menuheaderdiv.appendChild(fixdiv);
					menuheaderdiv.appendChild(itemiframe);
			
					// If gTopNav exists then menu is appended to gTopNav, else it's appended to gTopNavExternal.
					if(document.getElementById("gTopNav")){
						document.getElementById("gTopNav").appendChild(menuheaderdiv);
					}else if(document.getElementById("gTopNavExternal")){
						document.getElementById("gTopNavExternal").appendChild(menuheaderdiv);
					}

				}

				// This function creates an anchor tag for every menuItem in the menu.
				// It takes three parameters: 1) the name of the div for each menuItem,
				// 2) source which is the path of the image and
				// 3) href which is the set as link for anchor tag.
				function imageanchordiv(divname,source,href,disabled){
					var vehicleDiv;
					var img = document.createElement("img");
					img.id="img"+divname;
					//img.src = "http://"+hostname+"/"+source;
					img.src = source;
					var a = document.createElement("a");
					if(href=="null"){
						jQuery(a).removeAttr("href");
					}else{
						//a.setAttribute("href",nonSecNonToolsPath+"/"+href);
						a.setAttribute("href",nonSecNonToolsPath+href);
						a.setAttribute("color","#FFFFFF");
					}

					//Added for checking the disablity condition
					if(disabled == "true"){
						var divDisabled = document.createElement("div");
						divDisabled.id = divname+"1";

						var div = document.createElement("div");
						div.id = divname;
						//div.style.background="url('xml/img/non-Flash/dropDownMenus/menu_bkp.png')";

						a.appendChild(img);
						div.appendChild(a);
						divDisabled.appendChild(div);
						return divDisabled;
					}
					else
					{
						var div = document.createElement("div");
						div.id = divname;
						//div.style.background="url('xml/img/non-Flash/dropDownMenus/menu_bkp.png')";

						a.appendChild(img);
						div.appendChild(a);
						return div;
					}
					
				}


/** This method Retains the menu even after moving on to menu list from menu header*/
function retainMenu(buttonID,menuID){
	jQuery("#"+menuID).show();
	jQuery("#"+buttonID+"itemsiframe").show();
}

				var menuShouldShow = new Array();
				var menuHiding = new Array();
				var menuShowing = new Array();

				/** To show menu list when mouse moves on to menu header */
				function showMenu(buttonID, menuID,alignment){
					//alert("button ID is: "+buttonID); //+" menu ID: "+menuID+" alignment: "+alignment);
					/*if(buttonID != "see_all_vehicles")
					{*/
						if(isEspanol)
						{
						  document.getElementById('imgsee_all_vehicles').src = "/img/sav_redesign/sav_globalnav_top/spanish/es_see_all_veh_rollother.gif";
						  document.getElementById('imgcars').src = "/img/sav_redesign/sav_globalnav_top/spanish/es_car_n_minivans_rollother.gif";
						  document.getElementById('imgsuvs').src = "/img/sav_redesign/sav_globalnav_top/spanish/es_crossover_suv_rollother.gif";
						  document.getElementById('imgtrucks').src = "/img/sav_redesign/sav_globalnav_top/spanish/es_trucks_rollother.gif";
						  document.getElementById('imgfuture').src = "/img/sav_redesign/sav_globalnav_top/spanish/es_furture_concepts_rollother.gif";
						}
						else
						{
						  document.getElementById('imgsee_all_vehicles').src = "/img/sav_redesign/sav_globalnav_top/see_all_veh_rollother.gif";
						  document.getElementById('imgcars').src = "/img/sav_redesign/sav_globalnav_top/car_n_minivans_rollother.gif";
						  document.getElementById('imgsuvs').src = "/img/sav_redesign/sav_globalnav_top/crossover_suv_rollother.gif";
						  document.getElementById('imgtrucks').src = "/img/sav_redesign/sav_globalnav_top/trucks_rollother.gif";
						  document.getElementById('imgfuture').src = "/img/sav_redesign/sav_globalnav_top/furture_concepts_rollother.gif";
						}
						var buttonIdObj = document.getElementById(buttonID);
						var imgObj = buttonIdObj.childNodes[0].childNodes[0];
						var src1 = imgObj.src;
						imgObj.src = src1.replace("_rollother.gif","_selected.gif");
					//}
					/*if(buttonID == "nissan_logo")
					{
						  document.getElementById('imgnissan_logo').src = "/img/sav_redesign/sav_globalnav_top/sav_nissan_logo_on.jpg";
					}*/
					//jQuery("#topBackground").css("z-index", "350");
					jQuery("#"+buttonID).css("z-index", "370");
					/*jQuery("#cars").css("z-index", "370");
					jQuery("#suvs").css("z-index", "370");
					jQuery("#trucks").css("z-index", "370");
					jQuery("#future").css("z-index", "370");*/

					/*if(src1.indexOf('_selected.gif'))//!=null)
					{
						imgObj.src = src1.replace(".gif","_selected.gif")
					}*/
					if (typeof menuShouldShow[buttonID]=='undefined') {
						menuShouldShow[buttonID] = true;
					}
					menuShouldShow[buttonID] = true;
					if (typeof menuShowing[buttonID]=='undefined') {
						menuShowing[buttonID] = false;
					}
					if (typeof menuHiding[buttonID]=='undefined') {
						menuHiding[buttonID] = false;
					}
					if (!menuShowing[buttonID] && !menuHiding[buttonID]) {
						//jQuery("#"+menuID+"1").css({zIndex: "101"});
						var temp=jQuery("#"+buttonID).offset().left + ((alignment!="horizontal")?20:(document.getElementById(buttonID).offsetWidth-1));
						var buttonTop = parseInt(jQuery("#"+buttonID).offset().top);
						var alignmentTop = ((alignment!="horizontal")?(document.getElementById(buttonID).offsetHeight):0);
						//jQuery("#"+buttonID).css("border-bottom","4px solid #C81444");
						temp = temp-20;
						//alert("left: "+temp+"top: "+(buttonTop+alignmentTop));
						jQuery("#"+menuID ).css({position:"relative",left: "0px", top: "1px"});
						jQuery("#"+menuID+"1").css({position:"absolute",left: "0px", top: "38px" });
						jQuery("#"+menuID).slideDown("fast", function() { menuShowing[buttonID] = false; if(!menuShouldShow[buttonID] && !menuHiding[buttonID]) { hideMenu(buttonID, menuID) }; } );
						jQuery("#"+menuID+"1").slideDown("fast");
						/*jQuery("#"+buttonID+"itemsiframe").css({position:"absolute",left: temp+"px", top: (buttonTop+alignmentTop), border:"none", zIndex:"99" });
						jQuery("#"+buttonID+"itemsiframe").slideDown("fast");*/
						jQuery("#"+buttonID+"itemsiframe").css({position:"absolute",left: "0px", top: "38px", border:"none", zIndex:"99" });
						jQuery("#"+buttonID+"itemsiframe").slideDown("fast");
					}
				}

				/** To hide menu list when mouse moves out of menu header or menu list */
				function hideMenu(buttonID,menuID) {
					//jQuery("#topBackground").css("z-index", "380");
					//jQuery("#see_all_vehicles").css("z-index", "99");
					jQuery("#"+buttonID).css("z-index", "300");
					/*jQuery("#cars").css("z-index", "99");
					jQuery("#suvs").css("z-index", "99");
					jQuery("#trucks").css("z-index", "99");
					jQuery("#future").css("z-index", "99");*/
					/*if(buttonID != "see_all_vehicles")
					{
						if(isEspanol)
						{
						  document.getElementById('imgsee_all_vehicles').src = "/img/sav_redesign/sav_globalnav_top/spanish/es_see_all_veh_selected.gif";
						  document.getElementById('imgcars').src = "/img/sav_redesign/sav_globalnav_top/spanish/es_car_n_minivans.gif";
						  document.getElementById('imgsuvs').src = "/img/sav_redesign/sav_globalnav_top/spanish/es_crossover_suv.gif";
						  document.getElementById('imgtrucks').src = "/img/sav_redesign/sav_globalnav_top/spanish/es_trucks.gif";
						  document.getElementById('imgfuture').src = "/img/sav_redesign/sav_globalnav_top/spanish/es_furture_concepts.gif";
						}
						else
						{
	   					  document.getElementById('imgsee_all_vehicles').src = "/img/sav_redesign/sav_globalnav_top/see_all_veh_selected.gif";
						  document.getElementById('imgcars').src = "/img/sav_redesign/sav_globalnav_top/car_n_minivans.gif";
						  document.getElementById('imgsuvs').src = "/img/sav_redesign/sav_globalnav_top/crossover_suv.gif";
						  document.getElementById('imgtrucks').src = "/img/sav_redesign/sav_globalnav_top/trucks.gif";
						  document.getElementById('imgfuture').src = "/img/sav_redesign/sav_globalnav_top/furture_concepts.gif";
						}
						var buttonIdObj = document.getElementById(buttonID);
						var imgObj = buttonIdObj.childNodes[0].childNodes[0];
						var src1 = imgObj.src;
						imgObj.src = src1.replace("_selected.gif","_rollother.gif");
						window.setTimeout(changeGlobalLinks,1000);
					} */
					window.setTimeout(changeGlobalLinks,1000);
					/*if(buttonID == "nissan_logo")
					{
						  document.getElementById('imgnissan_logo').src = "/img/sav_redesign/sav_globalnav_top/sav_nissan_logo.jpg";
					}*/
					//document.getElementById('imgsee_all_vehicles').src = "/img/sav_redesign/sav_globalnav_top/see_all_veh_selected.gif";
					document.getElementById(menuID).style.zIndex="99";
					menuShouldShow[buttonID] = false;
					if(menuShowing[buttonID] == false) {
						menuHiding[buttonID] = true;
						jQuery("#"+menuID+"1").slideUp("fast");
						jQuery("#"+menuID).slideUp("fast", function() { menuHiding[buttonID] = false; if(menuShouldShow[buttonID] && !menuShowing[buttonID]) { showMenu(buttonID, menuID) }; } );
						jQuery("#"+buttonID).css("border-bottom","2px solid #FFFFFF");
						jQuery("#"+buttonID+"itemsiframe").slideUp("fast");
					}
				}

				/** ** **  Loading topnav from XML ends here ** **  */

				/** Creates the Footer nav */
				// This function creates footernav only when footer is not created through globalNav.js
				/*function createFooter(){
				  // It's checked if globalNav.js file is included or not
				  alert("in createFooter");
					if(jQuery('script[srcdocument.getElementById=globalNav.js]').length==0) {
						document.getElementById('gFooter').innerHTML="";
						 alert("inside createFooter");
						var footer="";
						footer+='<a href="/global/index.html" target="wGlobal" id="gFooterAboutLink" style="text-decoration: none">Infiniti Worldwide</a>';
					if (detectFlash && currentURI.indexOf('/non-flash/') == -1) {
						footer += '<a href="/about/vision.html" style="text-decoration: none;font-weight:bold;">About Infiniti</a>';
						footer += '<a href="/iapps/handraiser/siteWideOptin?tool=footer.sitewide_optin" style="text-decoration: none">Join Mailing List</a>';
					}
						footer+='<a href="/iapps/contactus" style="text-decoration: none">Contact Us</a>';
						footer+='<a id="siteFeedbackLink" onclick="O_LC()" href="javascript:void(0)" style="text-decoration: none">Site Comments  </a>';
					if (detectFlash && currentURI.indexOf('/non-flash/') == -1) {
						footer += '<a href="/global/sitemap.html" style="text-decoration: none">Site Map</a>';
					}
						footer+='<a href="/global/privacy.html" style="text-decoration: none">Privacy & Legal</a> ';
						document.getElementById('gFooter').innerHTML=footer;
						document.getElementById('gFooter').style.visibility = 'visible';
					}
					removeLinks();
				}*/

				function createFooter(){
						var htmlFooter;
						document.getElementById('gFooter').innerHTML="";
						htmlFooter = "<div id='footer'><table width='955px'>";
						htmlFooter+="<tr><td height='37' align='left' class='footertext'>";
						htmlFooter+="<img src='/img/sav_redesign/joinMailing_envelope.gif' />&nbsp;&nbsp;<a href='/apps/handraiser/siteWideOptin' class='footerLinks' style='font-weight:bold;color:#222222'>JOIN MAILING LIST</a>";
						htmlFooter+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href='/buying' class='footerLinks' style='color:#858585'>BUYING</a>";
						htmlFooter+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href='/about' class='footerLinks' style='color:#858585'>ABOUT NISSAN</a>";
						htmlFooter+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href='/more-nissan-sites' class='footerLinks' style='color:#858585'>MORE NISSAN SITES</a></td>";
						htmlFooter+="<td height='37' align='right' class='footertext'>";
						htmlFooter+="<a href='/' class='footerLinks' style='color:#858585'>Home</a>";
						htmlFooter+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href='/apps/contactus' class='footerLinks' style='color:#858585'>Contact Nissan</a>";
						htmlFooter+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href='javascript:void(0)' onclick='showbox()' class='footerLinks' style='color:#858585'>Site Feedback</a>";
						htmlFooter+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href='/global/privacy.html' class='footerLinks' style='color:#858585'>Privacy & Legal</a>";
						htmlFooter+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href='/global/sitemap.html' class='footerLinks' style='color:#858585'>Site Map</a>";
						htmlFooter+="<td width='20'>&nbsp;</td></tr></table></div>";
						/*var footer="";
						footer+='<a href="/about" style="color:#C1C1C1;text-decoration: none">About Nissan</a>';
						footer+='<a href="/buying" style="color:#C1C1C1;text-decoration: none"> | Buying</a>';
						footer+='<a href="/apps/contactus" style="color:#C1C1C1;text-decoration: none"> | Contact Us</a>';
						footer+='<a href="/buying" style="color:#C1C1C1;text-decoration: none"> | Site Feedback</a>';
						footer+='<a href="/global/copyright.htm" style="color:#C1C1C1;text-decoration: none"> | Copyright</a>';
						footer+='<a href="/global/privacy.html" style="color:#C1C1C1;text-decoration: none"> | Privacy Policy</a>';
						footer+='<a href="/global/sitemap.html" style="color:#C1C1C1;text-decoration: none"> | Site Map</a>';
						footer+='<a href="/more-nissan-sites" style="color:#C1C1C1;text-decoration: none"> | More NissanSites</a>';*/

						//document.getElementById('gFooter').innerHTML=footer;
						document.getElementById('gFooter').innerHTML=htmlFooter;
						//jQuery('#gFooter').css({position:'absolute',left:'300px'});
						var left1 = jQuery("#thumbnail_container").offset().left + 15;
						var top1 = jQuery("#savBody").offset().top + document.getElementById("savBody").offsetHeight + 40;
						//alert("left: "+left1+" top1: "+top1);
						jQuery('#navFooter').css({position:'absolute',left:"20px",top:top1});
						document.getElementById('gFooter').style.visibility = 'visible';
						
						/*jQuery("#footer > table > tbody > tr > td > a").hover(function(){
								this.style.fontSize = "8.5px";
								this.style.fontWeight = "bold";
							},
							function(){
								this.style.fontSize = "10px";
								this.style.fontWeight = "normal";
							});*/
						removeLinks();
				}
				
				function createEsFooter()
				{
						var htmlFooter;
						document.getElementById('gFooter').innerHTML="";
						htmlFooter = "<div id='footer'><table width='955px'>";
						htmlFooter+="<tr><td height='37' align='left' class='footertext'>";
						htmlFooter+="<img src='/img/sav_redesign/joinMailing_envelope.gif' />&nbsp;&nbsp;<a href='/apps/espanol/handraiser/siteWideOptin' class='footerLinks' style='font-weight:bold;color:#222222'>&#218;NETE LISTA POSTAL</a>";
						htmlFooter+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href='/espanol/buying' class='footerLinks' style='color:#858585'>COMPRA</a>";
						htmlFooter+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href='/espanol/about' class='footerLinks' style='color:#858585'>ACERCA</a>";
						htmlFooter+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href='/espanol/more-nissan-sites/' class='footerLinks' style='color:#858585'>M&#193;S SITIOS NISSAN</a></td>";
						htmlFooter+="<td height='37' align='right' class='footertext'>";
						htmlFooter+="<a href='/espanol/' class='footerLinks' style='color:#858585'>Home</a>";
						htmlFooter+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href='/apps/contactus' class='footerLinks' style='color:#858585'>cont&#225;ctenos</a>";
						htmlFooter+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href='/espanol/global/copyright.html' class='footerLinks' style='color:#858585'>Propiedad</a>";
						htmlFooter+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href='/espanol/global/privacy.html' class='footerLinks' style='color:#858585'>Pol&#237;tica de privacidad</a>";
						htmlFooter+="&nbsp;&nbsp;|&nbsp;&nbsp;<a href='/espanol/global/sitemap.html' class='footerLinks' style='color:#858585'>Mapa del sitio</a>";
						htmlFooter+="<td width='20'>&nbsp;</td></tr></table></div>";

						document.getElementById('gFooter').innerHTML=htmlFooter;
						var left1 = jQuery("#thumbnail_container").offset().left + 15;
						var top1 = jQuery("#savBody").offset().top + document.getElementById("savBody").offsetHeight + 47;
						jQuery('#navFooter').css({position:'absolute',left:"20px",top:top1});
						document.getElementById('gFooter').style.visibility = 'visible';
						
						removeLinks();
					
				}

				function removeLinks(){
					if(document.getElementById('bottomLeftLink'))
					{
						document.getElementById('bottomLeftLink').innerHTML="";
						document.getElementById('bottomLeftLink').className="";
					}
					if(document.getElementById('mailBrochureHome'))
					{
						document.getElementById('mailBrochureHome').innerHTML="";
						document.getElementById('mailBrochureHome').className="";
					}
					if(document.getElementById('eBrochureHome'))
					{
						document.getElementById('eBrochureHome').innerHTML="";
						document.getElementById('eBrochureHome').className="";
					}
					if(document.getElementById('bothBrochureHome'))
					{
						document.getElementById('bothBrochureHome').innerHTML="";
						document.getElementById('bothBrochureHome').className="";
					}
				}

				// Open External swf in new window
				// Argument swfName, querystr, width and height are required, the others optional
				// Usage: <a href="#" onclick="return popExtSwf('mySwf.swf', 'a=b', 600, 400, 'myWin', 'resizeable=no,location=no')">
				// used by G Coupe NavTeq Traffic Key Feature
				function popExtSwf(swfName, querystr, width, height, title, params){
				  var features = "";
				  var myurl = '/popSwf.html?swfname=' + swfName;
				  var isSafari = (navigator.userAgent.toLowerCase().indexOf("safari") != -1);

				  if (width) {
					var winWidth = width;
					if(isSafari) winWidth += 20;    // hack to enlarge window for Safari
					features += "width=" + winWidth + ",left=" + Math.floor( (screen.width - width) / 2);
					myurl += '&width=' + width;
				  }

				  if (height) {
					var winHeight = height;
					if(isSafari) winHeight += 20;   // hack to enlarge window for Safari
					features += ",height=" + winHeight + ",top="+Math.floor( (screen.height - height) / 2);
					myurl += '&height=' + height;
				  }

				  if (querystr) {
					myurl += '&' + querystr;

					var qsSrc = getStringParam(querystr, 'src');
					if (qsSrc != '')
					  myurl += '&Model=' + qsSrc;
				  }

				  if (title) myurl += '&title=' + escape(title);
				  if (params) features += ","+params;
				  var winname = name ? name : "infiniti_ext";
				  window.open(myurl, winname, features);
				}

				function fncFixGlobalFooter(){
							var baseURL = '';
							if (location.href.indexOf('http://build.infiniti.com')==0 || location.href.indexOf('http://compare.infiniti.com')==0)
								baseURL = 'http://www.infiniti.com';
							else if (location.href.indexOf('http://stage.build.infiniti.com')==0)
								baseURL = 'http://www.stage.infiniti.com';
							if (/espanol/.test(currentURI)) {
							footerHTML = '<a href="/global/index.html" target="wGlobal" onMouseover="ddrivetip(\'En ingl&#233;s\')" onMouseout="hideddrivetip()" id="gFooterAboutLink">Infiniti Global</a>'
									+ '<a href="/about/vision.html" style="text-decoration: none;font-weight:bold;" onMouseover="ddrivetip(\'En ingl&#233;s\')" onMouseout="hideddrivetip()">Sobre Infiniti</a>'
									+ '<a href="/iapps/handraiser/siteWideOptin?tool=footer.sitewide_optin" style="text-decoration: none" onMouseover="ddrivetip(\'En ingl&#233;s\')" onMouseout="hideddrivetip()">Inscr&#237;bete en la Lista de Correos</a>'
									+ '<a href="/iapps/contactus" style="text-decoration: none" onMouseover="ddrivetip(\'En ingl&#233;s\')" onMouseout="hideddrivetip()">Cont&#225;ctanos</a>'
									+ '<a id="siteFeedbackLink" onclick="O_LC()" href="javascript:void(0)" style="text-decoration: none" onMouseover="ddrivetip(\'En ingl&#233;s\')" onMouseout="hideddrivetip()">Comentarios</a>'
									+ '<a href="/global/privacy.html" style="text-decoration: none" onMouseover="ddrivetip(\'En ingl&#233;s\')" onMouseout="hideddrivetip()">Privacidad y Legal</a>';
						  } else {
							footerHTML = '<a href="' + baseURL + '/global/index.html" target="wGlobal" id="gFooterAboutLink" style="text-decoration: none;font-weight:bold;">Infiniti Worldwide</a>';
				if  (detectFlash && currentURI.indexOf('/non-flash/') == -1) {
									footerHTML += '<a href="' + baseURL + '/about/vision.html" style="text-decoration: none;font-weight:bold;">About Infiniti</a>'
									+ '<a href="' + baseURL + '/iapps/handraiser/siteWideOptin?tool=footer.sitewide_optin" style="text-decoration: none">Join Mailing List</a>';
				}
									footerHTML += '<a href="' + baseURL + '/iapps/contactus" style="text-decoration: none">Contact Us</a>'
									+ '<a id="siteFeedbackLink" onclick="O_LC()" href="javascript:void(0)" style="text-decoration: none">Site Comments  </a>';
				if  (detectFlash && currentURI.indexOf('/non-flash/') == -1) {
									footerHTML += '<a href="' + baseURL + '/global/sitemap.html" style="text-decoration: none">Site Map</a>';
				}
									footerHTML += '<a href="' + baseURL + '/global/privacy.html" style="text-decoration: none">Privacy & Legal</a>';
						  }
							if (document.getElementById('gFooter')) {
							document.getElementById('gFooter').innerHTML = footerHTML;
							document.getElementById('gFooter').style.visibility = 'visible';
						  }
				}


				// only used on pre-sell page(s)?  uses initUFO
				function loadFlashNonFlashGlobalNav() {
				  if (hasReqestedFlashVersion) {
					// load flash global nav
					var sModel = getModelName();
					if (sModel)
						document.getElementById('gTopNav').setAttribute("ufoflashvars","model="+sModel);
					var xmlPath = trim(document.getElementById('ufoGlobalNavMovie').innerHTML).replace(/::.*:/g,'');
					var basePath = xmlPath.substring(0,xmlPath.lastIndexOf("/flash"))+"/flash";
					document.getElementById('gTopNav').setAttribute("ufobase", basePath);
					initUFO('gTopNav','ufoGlobalNavMovie');
				  } else {
					// load non-flash global nav
					addLoadEvent(alignElements);
					addLoadEvent(importXML);
				  }
				}

function IsNumeric(sText) {
  var ValidChars = "0123456789";
  var IsNumber = true;
  var Char;

  if(sText==null || sText.length==0) {
    return false;
  }

  for (i = 0; i < sText.length && IsNumber == true; i++) {
    Char = sText.charAt(i);
    if (ValidChars.indexOf(Char) == -1) {
      IsNumber = false;
    }
  }
  return IsNumber;
}

				function swapHeaders(){
					for(var i=1;i<=2;i++){
						var _h=document.getElementsByTagName('h'+i);
						for(var j=0;j<_h.length;j++){
							if(/gSwap/.test(_h[j].className)){
								swapHeader(_h[j],"h{0}_{1}".format(i,j))
							}
						}
					}
				}
				addLoadEvent(swapHeaders);
				HnHeights=[22,16];

				function swapHeader(myHeader,swfID){
					if(myHeader && /h[12]/i.test(myHeader.tagName)){
						var headerN=+myHeader.tagName.replace(/h/i,'')
						var _id=swfID||'header'+(''+Math.random()).replace(".",'')
						var _ih=myHeader.innerHTML.replace(/^\s+|\s+$|[\r\n]/g,'');
						_ih=_ih.replace(/["' \t]/g,function(blah1){return escape(blah1)});
						var _d=document.createElement('div');
						myHeader.innerHTML="";
						_d.className="gNoPrint";
						_d.id=_id;
						myHeader.appendChild(_d);
						var _d=document.createElement('div');
						_d.className="gOnlyPrint";
						_d.innerHTML=unescape(_ih);
						_d.id=_id+"_text"
						myHeader.appendChild(_d);
						var _fv={}
						_fv["h{0}Text".format(headerN)]=_ih;
						_fv.param_quality="low";
						new swfoWrapper("/flash/global/h1.swf", _id, _fv, 720, HnHeights[headerN-1]);
						myHeader.style.visibility = 'visible';
					}
				}
