function showTop(click_id, id, ad_id) {
	
	var myVerticalSlide = new Fx.Slide(id + "_table");

	if($(id).hasClass("hidden")) {
		
		$(id).removeClass("hidden");
		
		myVerticalSlide.hide();
		
		myVerticalSlide.slideIn();

		//new Fx.Morph($(id), {'duration': 500, 'transition': Fx.Transitions.Quart.easeInOut}).start({'opacity': [0.2, 1]});

		if(id == "top" && $("ad_id1") != null) {
			
			$("ad_id1").innerHTML = ad_id;
			$("ad_id2").innerHTML = ad_id;
			$("ad_id3").innerHTML = ad_id;

			var Coords = $(click_id).getCoordinates();
			var left = Coords.left;
			var top = Coords.top;

			$(id).setStyles({'top':top, 'left':left});
		}
	}
	else {
	
		//new Fx.Morph($(id), {'duration': 500, 'transition': Fx.Transitions.Quart.easeInOut}).start({'opacity': [1, 0]});

		myVerticalSlide.slideOut();

		(function(){ myVerticalSlide.hide();
		
		$(id).addClass("hidden"); }).delay(400); //wait and execute
	}
}

function doLoad_sub_cat(form) {
				
	var intCategoryId = form.elements["ad[intCategoryId]"].options[form.elements["ad[intCategoryId]"].selectedIndex].value;
	
	if (intCategoryId) {

		form.elements["ad[intTypeId]"].disabled = true;
		
		var myJSONRemote = new Request.JSON( {
			
			url: '/add_category_type_ajax/' + intCategoryId + '/',
			method: 'post',

			onSuccess: function(resp) {

				$('intTypeId').empty();
				
				if(resp != null) {

					$each(resp, function(type_name, type_id) {

						var el = new Element('option');
						el.value = type_id;
						el.innerHTML = type_name;
						
						el.inject($('intTypeId'));
					});
				}

				form.elements["ad[intTypeId]"].disabled = false;
			}

		}).send();
	}
}