var detailDialog = 
{
	dialog :
		null,
	href :
		null,
	productName:
		null,
	setHref :
		function(href)
		{
			this.href = $('#base_url').val() + href;
		},
	setProductName :
		function(productName)
		{
			this.productName = productName;
		},
	open :
		function()
		{
			if (this.dialog == null) {
				this.dialog = $('<div>').attr('id', 'detail_dialog').addClass('dialog').dialog({
					autoOpen:false,
					modal:true,
					resizable:false,
					title:'商品詳細情報',
					position:['auto',50],
					width:550,
					buttons:{
						'閉じる':function(){
							$(this).dialog('close');
						}
					}
				}).html('');
			}
			var self = this;
			$.post(this.href, {}, function(res){
				if (self.productName) {
					self.dialog.dialog({title : self.productName});
				}
				self.dialog.html(res).dialog('open');
			})
		}
}

$(function(){
	$('input:button,input:submit').button({
		icons: {
			primary: 'btn_icon_res',
			secondary: 'btn_icon_res'
		}
	});
	$('a').click(function(){
		var params = {
			href : $(this).attr('href')
		}
		$.post($('#base_url').val() + '/index/anchor', params, function(res){});
	});
});

