$.top = {
	"init":function(){
		$("#new_box").hide();
		$.ajax({
			url : "./remote/remote_index_new.html",
			dataType : "html",
			success : function(data){
				$("#new_box").html(data);
				$("#new_box").animate({
					height:'show'
				},500);
				$("#new_loading").hide();
			},
			error : function(data){
				$("#new_box").html("準備中");
			}
		});
	}
}

$.banner = {
	"init":function(depth){
		var $img = $("img",$("#banner"));
		$img.each(function(){
			var src = $(this).attr("src");
			$(this).attr("src","../"+src);
		});
	
	}
}

$.menu = {
	"depth":1,
	"cats":['dvd','video','cd','cassette','inst','chinsukou','eat','cosme'],
	"req_url":"remote/remote_menu.html",
	"init":function(category){
		if(this.depth != 1){
			this.req_url = "../"+this.req_url;
			$.banner.init(this.depth);
		}
		for(var i = 0 ; this.cats[i]; i++){
			$("#m_"+this.cats[i]).attr("href","javascript:$.menu.show('"+this.cats[i]+"')");
			if(category == this.cats[i]){
				$.menu.show(this.cats[i]);
			}else{
				$("#m_"+this.cats[i]).attr("href","javascript:$.menu.show('"+this.cats[i]+"')");
			}
		}
	},
	"show":function(category){
		var $target = $("#menu_"+category);
		$target.animate({
			opacity:'show'
		},100);
		if($.menu.depth != 1){
			$target.html('<li class="loading"><img src="../images/loading_w.gif" /></li>');
		}else{
			$target.html('<li class="loading"><img src="images/loading_w.gif" /></li>');
		}
		$("#m_"+category).attr("href","javascript:$.menu.hidden('"+category+"')");
		$.ajax({
			url : this.req_url+"?cat="+category,
			dataType : "html",
			success : function(data){
				$('.loading',$target).hide();
				$target.hide();
				$target.html(data);
				if($.menu.depth != 1){
					$a = $("a",$target);
					$a.each(function(){
						var href = $(this).attr("href");
						$(this).attr("href","../"+href);
					});					
				}
				$target.animate({
					opacity:'show'
				},300);
			},
			error : function(data){
				
			}
		});
	},

	"hidden":function(category){
		$("#menu_"+category).animate({
			opacity:'hide'
		},100);
		$("#m_"+category).attr("href","javascript:$.menu.reshow('"+category+"')");
	},
	
	"reshow":function(category){
		$("#menu_"+category).animate({
			opacity:'show'
		},300);
		$("#m_"+category).attr("href","javascript:$.menu.hidden('"+category+"')");
	}
}