var headernav_drop_delay;
var headernav_drop_close_delay;


function headernav_drop_init() {
	$('.dropdown_enabled a').each(function(){
		$(this).bind("mouseenter", function(){
			var thisli = $(this).parent();
			var dropdown = '#'+$(thisli).attr('id')+'_dropdown';
			var button = '#'+$(thisli).attr('id');
			var pos = $(thisli).offset();    
			var eWidth = $(thisli).outerWidth();
			var mWidth = $(dropdown).outerWidth();
			var top = $('#gamepro_menu').position().top + $('#gamepro_menu').outerHeight() + 2;
			clearTimeout(headernav_drop_close_delay);
			clearTimeout(headernav_drop_delay);
			headernav_drop_delay = setTimeout(function() {
				if ($(dropdown).css('display') != 'block') {
					$('.gamepro_menu_dropdown').css({ display: 'none' });
					$(dropdown).css( { 
						position: 'absolute',
						zIndex: 5000,
						top: top
					} );
					$(dropdown).hide().fadeIn()
				}
			}, 300 );
		}).bind("mouseleave",function(){
			clearTimeout(headernav_drop_close_delay);
			clearTimeout(headernav_drop_delay);
			headernav_drop_close_delay = setTimeout(function() {
				$('.gamepro_menu_dropdown').css({ display: 'none' });
			}, 300); 
		});

		var thisli = $(this).parent();
		var dropdown = '#'+$(thisli).attr('id')+'_dropdown';
		$(dropdown).bind("mouseenter", function(){
			clearTimeout(headernav_drop_close_delay);
		}).bind("mouseleave",function(){
			clearTimeout(headernav_drop_close_delay);
			clearTimeout(headernav_drop_delay);
			headernav_drop_close_delay = setTimeout(function() {
				$('.gamepro_menu_dropdown').css({ display: 'none' });
			}, 300); 
		});
	});
}


function comment_placeholder_init() {
  function comment_focus() { 
    if($(this).val() == $(this).attr('defaultValue')) {
      $(this).val('');
      $(this).unbind('focus', comment_focus);
    }
  }
  $('.commentbox input#id_name').each(function(i) {
    $(this).attr('defaultValue', 'Name')
    $(this).val($(this).attr('defaultValue'))
  }).focus(comment_focus);
  $('.commentbox input#id_email').each(function(i) {
    $(this).attr('defaultValue', 'Email')
    $(this).val($(this).attr('defaultValue'))
  }).focus(comment_focus);
}
