function setUpHeader(){var a=jQuery("#wrapper");if(jQuery("#MainContainer").length){a=jQuery("#MainContainer");}jQuery("#header").insertBefore(a);jQuery('<div class="clear"></div>').insertBefore(a);jQuery("#header #nav a").each(function(){if(location.pathname.indexOf(jQuery(this).attr("href"))>-1){jQuery(this).parents("#header #nav > li").addClass("selected");}});jQuery("#header #nav > li").css("position","relative").mouseenter(function(){if(!jQuery("#page-cover").length){jQuery("body").prepend("<div id='page-cover'></div>");jQuery("#page-cover").show();}jQuery("#header #nav > li").removeClass("active");jQuery(".subnav").hide(210);jQuery(this).addClass("active").children(".subnav").slideDown(200);}).mouseleave(function(){jQuery("#header #nav > li").removeClass("active");jQuery(".subnav").hide(100);});jQuery("#header #nav > li.fad_nav").css("position","relative").hover(function(){jQuery("#page-cover").hide();},function(){jQuery("#page-cover").show();});jQuery("#header #nav").mouseleave(function(){jQuery("#page-cover").remove();});jQuery("#header #nav li:last").mouseenter(function(){jQuery("#page-cover").remove();});jQuery("#header #nav li:first > a").mouseenter(function(){jQuery(".vnav > li").removeClass("active");jQuery(".vnav .vdetails").hide();});jQuery("#header .vnav > li").mouseenter(function(b){jQuery("#header .vnav > li").removeClass("active");jQuery(this).addClass("active");if(jQuery(this).parents("#vehicles-nav").length){jQuery("#vehicles-nav").addClass("active");jQuery(".vdetails").hide();jQuery(".vdetails",this).show();}b.stopPropagation();}).mouseleave(function(){jQuery(this).removeClass("active");if(jQuery(this).parents("#vehicles-nav").length){jQuery("#vehicles-nav").removeClass("active");jQuery(".vdetails").hide();}});jQuery("#search_form").mouseenter(function(){jQuery(this).addClass("active");}).mouseleave(function(){jQuery(this).removeClass("active");});jQuery("#vehicles-nav ul.vnav > li").each(function(){var c=jQuery(this);var b=c.attr("class").split(" ")[0]+"_2012";c.find(".msrp").text(vehObj.getMSRP(b)).html(c.find(".msrp").text().replace(/\$/gi,'<span class="dollar">$</span>'));c.find(".shown").append(vehObj.getMSRPimageShown(b,"bhp"));});if(!jQuery.browser.msie){jQuery("#logo").mouseenter(function(){jQuery("#logo").animate({opacity:0.7},300,function(){});}).mouseleave(function(){jQuery("#logo").animate({opacity:1},300,function(){});});}a.css("visibility","visible");if(userData.audioPref=="on"){return;}else{userData.audioPref="on";Cookie.set("userdata",Json.toString(userData),{duration:365,path:"/"});}jQuery("#badge").mouseover(function(){jQuery("#badge").animate({backgroundPosition:"0px 0px"},50);});jQuery("#badge").mouseleave(function(){jQuery("#badge").animate({backgroundPosition:"0px -6px"},50);});}function setUpFooter(){jQuery("#footer").appendTo("body");jQuery("#subnav-shadow").appendTo("body");jQuery("#nav-shadow").appendTo("body");jQuery("#disclaimer_msrp").appendTo("#footer");jQuery.easing.custom=function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e;}if((h/=k)==1){return e+l;}if(!j){j=k*0.3;}if(g<Math.abs(l)){g=l;var i=j/4;}else{var i=j/(2*Math.PI)*Math.asin(l/g);}return g*Math.pow(2,-10*h)*Math.sin((h*k-i)*(2*Math.PI)/j)+l+e;};var a=0;var b={loadPromos:function(){if((typeof cur_vehicle!="undefined"&&cur_vehicle.length>0)&&(typeof cur_year!="undefined"&&cur_year.length>0)){promoPath="/en/"+cur_year+"/"+cur_vehicle+"/";}if(typeof promoPath=="undefined"){promoPath="/en/2012/";}if(typeof promoSection=="undefined"){promoSection=1;}jQuery.get(promoPath+"promos.xml",function(c){jQuery(c).find("section[type="+promoSection+"]").each(function(){var d=jQuery(this);var e=d.find("promos");if(e.length){jQuery(".promoswrap").append("<ul></ul>");e.find("promo").each(function(g){var h=jQuery(this);jQuery(".promoswrap ul").append("<li></li>");var f=jQuery(".promoswrap li:last");if(h.find("html").length){f.append(h.find("html").text()).addClass("html");}else{f.append('<a href="'+h.find("url").text()+'"><img src="'+h.find("image").text()+'" alt="'+h.find("alt").text()+'" /></a>');if(h.find("track").length){jQuery("a",f).attr("name",h.find("track").text());}if(h.find("cta").length){f.append('<div class="cta"><a href="'+h.find("url").text()+'"><span>'+h.find("cta").text()+"</span></a></div>");if(h.find("ctatrack").length){jQuery(".cta a",f).attr("name",h.find("ctatrack").text());}f.mouseenter(function(i){jQuery(".cta",this).slideDown(200);}).mouseleave(function(i){jQuery(".cta",this).slideUp(200);});}}if(h.find("class").length){f.addClass(h.find("class").text());}a++;});b.showPromos();}});});},showPromos:function(){jQuery(".promoswrap ul").jcarousel({easing:"custom",speed:900,scroll:3,size:a,wrap:"circular"});if(jQuery("#promos").length){jQuery("#promos").remove();}jQuery("#promo").css("visibility","visible");}};b.loadPromos();}function showDisclaimersJeep(){if(!jQuery("#secondary-footer-links #disclaimers").length){jQuery("#disclaimers").appendTo("#secondary-footer-links .last");jQuery("<div id='disclaimers-close'></div>").appendTo("#secondary-footer-links .last");}jQuery("#disclaimers-close").toggle(450).click(function(){linkTrack("footer","disclaimers-close");jQuery(this).hide(100);jQuery("#disclaimers").hide(300);});jQuery("#disclaimers").toggle(300);}function submitSearchNewInventory(c){var b=c.slice(0,4);var a=c.substr(4);linkTrack("shopping_tools_SNI",c);window.location="/bridge/inventory.html?app=newinventory&family="+a+"&zipcode=&dealerid=&year="+b+"";}function submitCapTour(c){var b=c.slice(0,4);var a=c.substr(4);linkTrack("shopping_tools_capability_tour",c);window.location="/en/"+b+"/"+a+"/capability/capability_tour/";}function submitSearch(a){a.submit();}jQuery(function(){setUpHeader();setUpFooter();});
