function addPlidUrl(u, plid) { var vars = {}, hash; var i = window.location.href.indexOf('?'); if (i == -1) { return u + '?plid=' + plid; } var vars = {}, hash, q = ''; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for (var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); if (hash[0] == 'plid') { continue; } vars[hash[0]] = hash[1]; q = '&' } return u + '?plid=' + plid + q + $.param(vars); } $(document).ready(function () { var currentPage = window.location.pathname.substring(window.location.pathname.indexOf('/') + 1).split('/'); var subCurrentPage = currentPage[1]; currentPage = currentPage[0]; $('#nav ul li').removeClass('navSelected').addClass('navButton'); $('#' + currentPage).addClass('navSelected'); if ($('#' + currentPage + 'SubnavDrop').length) { $('#' + currentPage + 'SubnavDrop').show(); } if ($('#' + currentPage).length) { var parentItem = currentPage; /*$('#' + currentPage + '-link').parent().parent().attr('id').replace('-li','');*/ $('#' + parentItem).addClass('navSelected'); } else { var parentItem = ''; } $('#nav ul li').css({ 'cursor': 'pointer' }).click(function () { if ($(this).hasClass('menuOver') == false) { window.location.href = $(this).find('a:first').attr('href'); } }); $('.menuOver').mouseover(function () { var c = $(this).attr('id'); $('#' + c + '-li').show(); }); $('.menuOver').mouseout(function () { var c = $(this).attr('id').replace('-li', ''); if (c == parentItem) { var n = 'navSelected'; } else { var n = 'navButton'; } $('#' + c).removeClass('navHover').addClass(n); $('#' + c + '-li').hide(); }); $('#rollDownMenu div').mouseover(function () { var c = $(this).attr('id').replace('-li', ''); if (c == parentItem) { var n = 'navSelected'; } else { var n = 'navHover'; } $('#' + c).removeClass('navButton').removeClass('navSelected').addClass('navHover'); $(this).show(); }); $('#rollDownMenu div').mouseout(function () { var c = $(this).attr('id').replace('-li', ''); if (c == parentItem) { var n = 'navSelected'; } else { var n = 'navButton'; } $(this).hide(); $('#' + c).removeClass('navButton').removeClass('navHover').addClass(n); }); if ($('#' + currentPage + '_' + subCurrentPage).length) { $('#' + currentPage + '_' + subCurrentPage).addClass('selected'); } $('.plid').click(function () { $(this).attr('href', addPlidUrl($(this).attr('href'), $(this).data('plid'))); }); $('.targetPopup').click(function () { window.open($(this).attr('title'), '', "scrollbars=yes,resizable=yes,menubar=yes,status=yes,toolbar=yes,personalbar=yes,location=yes,hotkeys=yes,width=860,height=535"); }); $('.targetLink').click(function () { this.target = '_blank'; }); if (!($('.midCooldeal').length)) { $('#cooldealTitle').hide(); } });