$(document).ready(function () { newsTabs(); customCss(); hyundaiModelInfoTabs(); hyundaiModelSpecificationsTabs(); expandTabs(); contractTabs(); lightBoxClose(); prepareHyundaiPage(); hyundaiModelHighlight(); prepareSpecsPage(); initiateSpecsStyles(); loadChevrons(); hideFlashForMobile(); $("ul.tab-menu li.tabnav").click(function () { return tabClicked($(this)); }); $("img.feature-list-img").click(function () { return specsLightbox($(this), true); }); $("img.icon-magnify").click(function () { var _this = $(this).parent().find('img.feature-list-img'); return specsLightbox(_this, true); }); $("img.feature-list-img-rel").click(function () { return specsLightbox($(this), false); }); }); function hideFlashForMobile() { var windowWidth = $(window).width(); if (windowWidth < 970) { console.log("should hide"); $('#page_feature').html(''); $('#aspnetForm').css('background', 'none'); } }
function loadChevrons() { var this_ = $('.home-new-widget .mainItem dl dt a span'); var this_HTML = $(this_).html(); $(this_).html(this_HTML + "<span class='chevronRight'></span>"); $('.home-new-widget .subItem dl dt a span').each(function () { var this_ = $(this); var this_HTML = $(this_).html(); $(this_).html(this_HTML + "<span class='chevronRight'></span>"); }); }
function AdminBoolean() { if ($(".edit-buttons").length > 0) { return false; } else { return true; }; }
function tabClicked(tab) { clearLightBoxes(); $("div.specs-list").hide(); $("div.hcv-specs-list").hide(); tab.show(); $("ul.tab-menu li").removeClass("current"); tab.addClass("current"); $(".specs-list").hide(); $(".hcv-specs-list").hide(); var activeTab = tab.find("a").attr("href"); $(activeTab).show(); return false; }
function specsLightbox(lbimg, sourceLocation) {
    var pageHeight = $(document).height(); var pageWidth = $(window).width(); var pagePosition = $(window).scrollTop(); var windowHeight = $(window).height(); var windowWidth = $(window).width(); clearLightBoxes(); if (sourceLocation == true) { var imageUrl = lbimg.attr("src"); } else { var imageUrl = lbimg.attr("rel"); }
    $("body").append("<div class=\"simple_overlay\"> <div class=\"close\"></div><img class=\"lightbox-image\" alt=\"\" src=\"" + imageUrl + "\"></div>"); $(".simple_overlay").css("display", "none"); $('.lightbox-image').load(function () { $(".simple_overlay").css('top', windowHeight / 2 + (pagePosition) - $(".simple_overlay").height() / 2); $(".simple_overlay").css('left', windowWidth / 2 - $(".simple_overlay").width() / 2); $(".simple_overlay").fadeIn("fast"); }); lightBoxClose();
}
function lightBoxClose() { $("div.close").click(function () { $(".simple_overlay").remove(); }); }
function clearLightBoxes() { $(".simple_overlay").remove(); }
function customCss() { $(".CMLevel1Selected").after("<div class=\"outer\"></div>"); $(".CMLevel1Selected").before("<div class=\"inner\"></div>"); $("ul.horizontal li:nth-child(2)").addClass("shadow"); $("div.sub-navigation table").hide(); }
function hideAllNews() { $(".home-new-widget div.mainItem").hide(); $(".home-new-widget div.allsubItems .subItem:nth-child(1n)").hide(); $(".home-new-widget div.allsubItems .subItem:nth-child(2n)").hide(); $("ul.newsTabs li").removeClass('current'); }
function newsTabs() { hideAllNews(); $("ul.newsTabs li.t1").addClass('current'); $(".home-new-widget div.mainItem").show(); $("ul.newsTabs li.t1").click(function () { hideAllNews(); $("ul.newsTabs li.t1").addClass('current'); $(".home-new-widget div.mainItem").show(); }); $("ul.newsTabs li.t2").click(function () { hideAllNews(); $("ul.newsTabs li.t2").addClass('current'); $(".home-new-widget div.allsubItems .subItem:first-child").show(); }); $("ul.newsTabs li.t3").click(function () { hideAllNews(); $("ul.newsTabs li.t3").addClass('current'); $(".home-new-widget div.allsubItems .subItem:nth-child(2n)").show(); }); }
function prepareHyundaiPage() { if (AdminBoolean()) { $('div.collapse').hide(); $('.specs-list').hide(); $('.hcv-specs-list').hide(); $('.specs-list:first-child').show(); $('.hcv-specs-list:first-child').show(); $(".specs-tbl tr:nth-child(odd)").addClass('odd'); $(".specs-tbl-b tr:nth-child(odd)").addClass('odd'); $(".hcv-specs-tbl tr:nth-child(odd)").addClass('odd'); $(".hcv-specs-tbl-b tr:nth-child(odd)").addClass('odd'); correctTableWidths(); } }
function correctTableWidths() { $(".specs-tbl td + td[colspan='3']").css("width", "auto"); $(".specs-tbl td[colspan='2']").css("width", "auto"); $(".specs-tbl-b td:nth-child(1)").css("width", "191px"); $(".specs-tbl-b td:nth-child(2)").css("width", "53px"); $(".specs-tbl-b td:nth-child(3)").css("width", "53px"); $(".specs-tbl-b td:nth-child(4)").css("width", "auto"); $(".specs-tbl-b td:nth-child(5)").css("width", "auto"); }
function hyundaiModelInfoTabs() { $("div.panes ul li h4").click(function () { var checkTab = $(this).siblings(); clearLightBoxes(); if ((checkTab.is('div.collapse')) && (checkTab.is(':visible'))) { $(this).siblings().slideUp(); $(this).parent().removeClass("openTab"); var expandedCounter = 0; $(this).parents('.specs-list').find('li.openTab').each(function () { expandedCounter++; }); if (expandedCounter == 0) { $(this).parents('.specs-list').find('a.switchContract').removeClass('switchContract'); $(this).parents('.specs-list').find('a.switch').addClass('switchExpand'); $(this).parents('.specs-list').find('a.switch span').replaceWith("<span class=\"expandOpen\"></span>"); expandTabs(); contractTabs(); } } else { $(this).parent().addClass("openTab"); $(this).siblings().slideDown(); var totalNumberOfSections = 0; var expandedCounter = 0; $(this).parents('.specs-list').find('h4.expand').each(function () { totalNumberOfSections++; }); $(this).parents('.specs-list').find('li.openTab').each(function () { expandedCounter++; }); if (totalNumberOfSections == expandedCounter) { $(this).parents('.specs-list').find('a.switchExpand').removeClass('switchExpand'); $(this).parents('.specs-list').find('a.switch').addClass('switchContract'); $(this).parents('.specs-list').find('a.switch span').replaceWith("<span class=\"expandClose\"></span>"); expandTabs(); contractTabs(); } } }); }
function prepareSpecsPage() { $(".specs-tbl td:nth-child(1)").addClass('row-title'); $(".specs-tbl td:nth-child(2)").addClass('specTblCol2'); $(".specs-tbl td:nth-child(3)").addClass('specTblCol3'); $(".specs-tbl td:nth-child(4)").addClass('specTblCol4'); $(".specs-tbl-b td:nth-child(1)").addClass('row-title'); $(".specs-tbl-b td:nth-child(2)").addClass('specTblCol2'); $(".specs-tbl-b td:nth-child(3)").addClass('specTblCol2'); $(".specs-tbl-b td:nth-child(4)").addClass('specTblCol3'); $(".specs-tbl-b td:nth-child(5)").addClass('specTblCol4'); $(".hcv-specs-tbl td:nth-child(1)").addClass('row-title'); $(".hcv-specs-tbl-b td:nth-child(1)").addClass('row-title'); }
function initiateSpecsStyles() { $(".tabSubNav #colHeading13").addClass('currentColTab'); $("#specList1 td.specTblCol4").addClass('selectedCol'); $("#specList1 td[colspan='3']").addClass('selectedCol'); $("#specList1 td[colspan='2']").addClass('selectedCol'); $(".tabSubNav.tableItems-threeColumn #colHeading12").addClass('currentColTab'); $(".tabSubNav.tableItems-threeColumn #colHeading22").addClass('currentColTab'); $(".tabSubNav #colHeading112").addClass('currentColTab'); $("#specList1 .tableItems-oneTab td.specTblCol2").addClass('selectedCol'); $("#specList1 .tableItems-oneTab td.specTblCol3").addClass('selectedCol'); $(".tabSubNav #colHeading23").addClass('currentColTab'); $("#specList2 td.specTblCol4").addClass('selectedCol'); $("#specList2 td[colspan='3']").addClass('selectedCol'); $("#specList2 td[colspan='2']").addClass('selectedCol'); $("#specList1 .tableItems-threeColumn td.specTblCol3").addClass('selectedCol'); $("#specList2 .tableItems-threeColumn td.specTblCol3").addClass('selectedCol'); }
function setSpecsTbl(tabPage, tabColumnNumber) { $("#specList" + tabPage + " .specs-tbl tr td").removeClass('selectedCol'); $("#specList" + tabPage + " .specs-tbl-b tr td").removeClass('selectedCol'); $("#specList" + tabPage + " ul.tabSubNav li").removeClass('currentColTab'); tabColumnNumberCorrected = tabColumnNumber - 1; $(".tabSubNav #colHeading" + tabPage + tabColumnNumberCorrected).addClass('currentColTab'); $("#specList" + tabPage + " td.specTblCol" + tabColumnNumber).addClass('selectedCol'); if (tabColumnNumberCorrected == 2) { $("#specList" + tabPage + " td[colspan='3']").addClass('selectedCol'); $("#specList" + tabPage + " td + td[colspan='2']").addClass('selectedCol'); } else if (tabColumnNumberCorrected == 3) { $("#specList" + tabPage + " td[colspan='3']").addClass('selectedCol'); $("#specList" + tabPage + " td + td[colspan='2']").addClass('selectedCol'); } else if (tabColumnNumberCorrected == 4) { $("#specList" + tabPage + " td + td + td[colspan='2']").addClass('selectedCol'); $("#specList" + tabPage + " td[colspan='3']").addClass('selectedCol'); } }
function setSpecsTblTwoColumns(tabPage, tabColumnNumber1, tabColumnNumber2) {
    $("#specList" + tabPage + " .specs-tbl tr td").removeClass('selectedCol'); $("#specList" + tabPage + " .specs-tbl-b tr td").removeClass('selectedCol'); $("#specList" + tabPage + " ul.tabSubNav li").removeClass('currentColTab'); tabColumnNumberCorrected = tabColumnNumber1 - 1; $(".tabSubNav #colHeading" + tabPage + tabColumnNumberCorrected).addClass('currentColTab'); $("#specList" + tabPage + " td.specTblCol" + tabColumnNumber1).addClass('selectedCol'); if (tabColumnNumberCorrected == 2) { $("#specList" + tabPage + " td[colspan='3']").addClass('selectedCol'); $("#specList" + tabPage + " td + td[colspan='2']").addClass('selectedCol'); } else if (tabColumnNumberCorrected == 3) { $("#specList" + tabPage + " td[colspan='3']").addClass('selectedCol'); $("#specList" + tabPage + " td + td[colspan='2']").addClass('selectedCol'); } else if (tabColumnNumberCorrected == 4) { $("#specList" + tabPage + " td + td + td[colspan='2']").addClass('selectedCol'); $("#specList" + tabPage + " td[colspan='3']").addClass('selectedCol'); }
    tabColumnNumberCorrected = tabColumnNumber2 - 1; $(".tabSubNav #colHeading" + tabPage + (tabColumnNumber1 - 1) + (tabColumnNumber2 - 1)).addClass('currentColTab'); $("#specList" + tabPage + " td.specTblCol" + tabColumnNumber2).addClass('selectedCol'); if (tabColumnNumberCorrected == 2) { $("#specList" + tabPage + " td[colspan='3']").addClass('selectedCol'); $("#specList" + tabPage + " td + td[colspan='2']").addClass('selectedCol'); } else if (tabColumnNumberCorrected == 3) { $("#specList" + tabPage + " td[colspan='3']").addClass('selectedCol'); $("#specList" + tabPage + " td + td[colspan='2']").addClass('selectedCol'); } else if (tabColumnNumberCorrected == 4) { $("#specList" + tabPage + " td + td + td[colspan='2']").addClass('selectedCol'); $("#specList" + tabPage + " td[colspan='3']").addClass('selectedCol'); } 
}
function hyundaiModelHighlight() { $("li#colHeading11").click(function () { setSpecsTbl(1, 2); }); $("li#colHeading12").click(function () { setSpecsTbl(1, 3); }); $("li#colHeading13").click(function () { setSpecsTbl(1, 4); }); $("li#colHeading21").click(function () { setSpecsTbl(2, 2); }); $("li#colHeading22").click(function () { setSpecsTbl(2, 3); }); $("li#colHeading23").click(function () { setSpecsTbl(2, 4); }); $("li#colHeading112").click(function () { setSpecsTblTwoColumns(1, 2, 3); }); }
function hyundaiModelSpecificationsTabs() { $("div#specPanes #tableItems h4.expand").click(function () { var checkTab = $(this).next(); if ((checkTab.is('div.collapse')) && (checkTab.is(':visible'))) { $(this).next('.collapse').slideUp(); $(this).removeClass("openTab"); var expandedCounter = 0; $(this).parents('.specs-list').find('h4.openTab').each(function () { expandedCounter++; }); if (expandedCounter == 0) { $(this).parents('.specs-list').find('a.switchContract').removeClass('switchContract'); $(this).parents('.specs-list').find('a.switch').addClass('switchExpand'); $(this).parents('.specs-list').find('a.switch span').replaceWith("<span class=\"expandOpen\"></span>"); expandTabs(); contractTabs(); } } else { $(this).addClass("openTab"); $(this).next('.collapse').slideDown(); var totalNumberOfSections = 0; var expandedCounter = 0; $(this).parents('.specs-list').find('h4.expand').each(function () { totalNumberOfSections++; }); $(this).parents('.specs-list').find('h4.openTab').each(function () { expandedCounter++; }); if (totalNumberOfSections == expandedCounter) { $(this).parents('.specs-list').find('a.switchExpand').removeClass('switchExpand'); $(this).parents('.specs-list').find('a.switch').addClass('switchContract'); $(this).parents('.specs-list').find('a.switch span').replaceWith("<span class=\"expandClose\"></span>"); expandTabs(); contractTabs(); } } }); $("div#specPanes #hcv-tableItems h4.expand").click(function () { var checkTab = $(this).next(); if ((checkTab.is('div.collapse')) && (checkTab.is(':visible'))) { $(this).next('.collapse').slideUp(); $(this).removeClass("openTab"); } else { $(this).addClass("openTab"); $(this).next('.collapse').slideDown(); } }); }
function expandTabs() { $('.switch').bind('mouseover', function () { $(this).addClass('switchHovered'); }); $('.switch').bind('mouseout', function () { $(this).removeClass('switchHovered'); }); clearLightBoxes(); $("span.expandOpen").click(function () { $(this).parent().removeClass("switchExpand"); $(this).parent().addClass("switchContract"); $(this).parent().parent().find("div.collapse").slideDown(); $(this).parent().parent().find("ul.expandparent li").addClass("openTab"); $(this).parent().parent().find("div#tableItems h4.expand").addClass("openTab"); $(this).parent().parent().find("div#hcv-tableItems h4.expand").addClass("openTab"); $(this).replaceWith("<span class=\"expandClose\"></span>"); contractTabs(); return false; }); }
function contractTabs() { $("span.expandClose").click(function () { $(this).parent().removeClass("switchContract"); $(this).parent().addClass("switchExpand"); $(this).parent().parent().find("div.collapse").slideUp(); $(this).parent().parent().find("ul.expandparent li").removeClass("openTab"); $(this).parent().parent().find("div#tableItems h4.expand").removeClass("openTab"); $(this).parent().parent().find("div#hcv-tableItems h4.expand").removeClass("openTab"); $(this).replaceWith("<span class=\"expandOpen\"></span>"); expandTabs(); return false; }); }
function insertFlashBanner(xmlSrc, swfSrc) { flashvars.bannerUrl = swfSrc; flashvars.configUrl = xmlSrc; embedSwfSrc = "/MultiMediaFiles/Cars/ix35/" + swfSrc; var params = {}; params.menu = "false"; params.wmode = "transparent"; params.base = "/MultiMediaFiles/Cars/ix35"; var attributes = {}; attributes.id = "bannerContainer"; swfobject.embedSWF("/MultiMediaFiles/Cars/ix35/BannerContainer.swf", "bannerContainer", "960", "370", "9.0.0", "/MultiMediaFiles/Cars/ix35/expressInstall.swf", flashvars, params, attributes); }
function switchFlash(xmlSrc, swfSrc) { if ((swfSrc == flashvars.bannerUrl) && (xmlSrc == flashvars.configUrl)) { } else { insertFlashBanner(xmlSrc, swfSrc); }; }; function insertFlashBanner_i45(xmlSrc, swfSrc) { flashvars.bannerUrl = swfSrc; flashvars.configUrl = xmlSrc; embedSwfSrc = "/MultiMediaFiles/Cars/i45/" + swfSrc; var params = {}; params.menu = "false"; params.wmode = "transparent"; params.base = "/MultiMediaFiles/Cars/i45"; var attributes = {}; attributes.id = "bannerContainer"; swfobject.embedSWF("/MultiMediaFiles/Cars/i45/BannerContainer.swf", "bannerContainer", "960", "370", "9.0.0", "/MultiMediaFiles/Cars/ix35/expressInstall.swf", flashvars, params, attributes); }
function switchFlash_i45(xmlSrc, swfSrc) { if ((swfSrc == flashvars.bannerUrl) && (xmlSrc == flashvars.configUrl)) { } else { insertFlashBanner_i45(xmlSrc, swfSrc); }; }; function insertFlashBanner_hd(xmlSrc, swfSrc) { flashvars.bannerUrl = swfSrc; flashvars.configUrl = xmlSrc; embedSwfSrc = "/MultiMediaFiles/trucks/hd/" + swfSrc; var params = {}; params.menu = "false"; params.wmode = "transparent"; params.base = "/MultiMediaFiles/trucks/hd"; var attributes = {}; attributes.id = "bannerContainer"; swfobject.embedSWF("/MultiMediaFiles/trucks/hd/BannerContainer.swf", "bannerContainer", "960", "370", "9.0.0", "/MultiMediaFiles/Cars/ix35/expressInstall.swf", flashvars, params, attributes); }
function switchFlash_hd(xmlSrc, swfSrc) { if ((swfSrc == flashvars.bannerUrl) && (xmlSrc == flashvars.configUrl)) { } else { insertFlashBanner_hd(xmlSrc, swfSrc); }; };
