$(document).ready(function(){
	$(".td-menu-horizontal").click(function(){ 
		var id = $(this).attr("id");
		var id = id.substr(id.length-1);
		
		if($.browser.msie){
			var w = $('#div-subitem-'+id).width();
			var h = $('#div-subitem-'+id).height();
			$(".td-subitens").find("iframe").remove();
			if($("#div-subitem-"+id).css("display") == "none"){
				$("#td-subitens-"+id).append('<iframe frameborder="0" scrolling="no" src="about:blank" style="margin-top:1px; position:absolute; width:'+w+'px; height:'+h+'px; z-index:1;"></iframe>');
			}
		}
							  
		$('.div-subitem').hide();
		$("#div-subitem-"+id).fadeIn("fast");
	});
	
	$(document.body).mousedown(function(event){
									var target = $(event.target);
									if(target.parents(".div-subitem").length == 0){
										if($.browser.msie) $(".td-subitens").find("iframe").remove();
										$('.div-subitem').fadeOut("fast");
									}
							   });
	
	/*$(".table-sub-item-menu").click(function(){ 
		if($.browser.msie) $(".td-menu-item-box").find("iframe").remove();
		$('.div-menu-item').hide();
	});*/

	$(".td-subitem").hover(function(){
		$(this).addClass("hover");
	},function(){
		$(this).removeClass("hover");
	});
	
	/*$(".table-sub-item-menu").hover(function(){
		$(this).addClass("table-sub-item-menu-hover");
	},function(){
		$(this).removeClass("table-sub-item-menu-hover");
	});*/
});
