var path = "http://media.rockstargames.com/rockstar/local_data/US/"; var plus0 = path + 'img/dropdownmenu/plus0.png????'; var plus1 = path + 'img/dropdownmenu/plus1.png'; var minus0 = path + 'img/dropdownmenu/minus0.png'; var minus1 = path + 'img/dropdownmenu/minus1.png'; var plus_small0 = path + 'img/dropdownmenu/small/plus0.png????'; var plus_small1 = path + 'img/dropdownmenu/small/plus1.png'; var minus_small0 = path + 'img/dropdownmenu/small/minus0.png'; var minus_small1 = path + 'img/dropdownmenu/small/minus1.png'; function overDropDown(selector, resetdisplay) { var display = $('#' + selector.attr('menu_content')); var selector_img = selector.children('.selector_img'); if (!resetdisplay) { display.stop(true, true); } if (display.attr('selected') == 0) { img = plus_small1; } else { img = minus_small1; } //alert(display.attr('selected')); var cssProp = { 'background-image': 'url(' + img + ')' }; selector_img.css(cssProp); } function outDropDown(selector) { var display = $('#' + selector.attr('menu_content')); var selector_img = selector.children('.selector_img'); if (display.attr('selected') == 0) { img = plus_small0; } else { img = minus_small0; } var cssProp = { 'background-image': 'url(' + img + ')' }; selector_img.css(cssProp); display.animate({opacity: 1}, 1000).attr('selected', 0).slideUp(100); } function clickDropDown(selector) { var display = $('#' + selector.attr('menu_content')); display.attr('selected', 1); display.slideDown(100); overDropDown(selector, true); } function registerDropdowns() { $('.dropdown_selector').each(function(){ var display = $('#' + $(this).attr('menu_content')); var selector = $(this); if ($(this).attr('bound') != 1) { $(this).bind('mouseenter', function() { overDropDown($(this)); }); $(this).bind('mouseleave', function() { outDropDown($(this)); }); $(this).bind('click', function() { clickDropDown($(this)); }); display.bind('mouseenter', function() { overDropDown(selector); }); display.bind('mouseleave', function() { outDropDown(selector); }); display.attr('selected', 0); selector.mouseleave(); $(this).attr('bound', 1); } }); }