var modal_id = '';

$(window).scroll(function() {
	advrichPosition();
});

	$('div#menuParent').bind({
	  mouseover: function() {
		jQuery(this).find('#sub_menu_list').show();
		jQuery(this).find('#menu_list').attr('id','menu_list_selected');
	  },
	  mouseout: function() {
		jQuery(this).find('#sub_menu_list').hide();
		jQuery(this).find('#menu_list_selected').attr('id','menu_list');
	  }
	});


function modal(id) {

	if($('div#'+id).size()==1) {
   		$('div#dialogContent').append($('div#'+id));
	}

  	var width = $('#main_container').width();
  	var height = $(document).height();
  	$('div#submodal').show();
    $('div#submodal').css('height',height+'px');
    $('div#submodal').css('width',width+'px');
	offset = $(document).scrollTop()+20;
	$('div#dialog').css("top",offset+'px');
   	$('div#dialog').show();
   	$('div#'+id).show();
   	modal_id = id;
	if(jQuery.isFunction(eval(id+'_start'))) {
		eval(id + '_start' + '()');
	}
   	$("div.flashAdv").hide();

}

function modalClose() {
   	$('div#dialog').hide();
   	$('div#submodal').hide();
   	$('div#'+modal_id).hide();
	if(jQuery.isFunction(eval(modal_id+'_end'))) {
		eval(modal_id + '_end' + '()');
	}
   	modal_id = '';
   	$("div.flashAdv").show();
}

function SelectAll(id) {
	document.getElementById(id).focus();
	document.getElementById(id).select();
}

function advrichClose() {
   	$('div#advrich').remove();
}

function advrichPosition() {	var window_height = $(window).height();
	var rich_height = $('div#advrich').height();
 	var scroll = $(window).scrollTop();
 	var top = scroll + (window_height - rich_height)/2;
	if(rich_height>window_height) {
    	var top = scroll + 10;
	}
	$('div#advrich').css("top",top+'px');
}

function loading_start() {}
function loading_end() {}
