///////////////////////////////////////////////////////////////////////////////
//
//
//
//
///////////////////////////////////////////////////////////////////////////////


var BALSEC_BLOGSERVERNAME			= 'contents.bals.co.jp';
var BALSEC_BLOGECDIR				= '/francfranc/ec';
var BALSEC_BLOGIMGDIR				= '/francfranc/images';
var BALSEC_TABEFFECTSPPED			= 1000; //[ms]
var BALSEC_TABLOTATIONSPEED			= 10000; //[ms]
var BALSEC_TABCONTAINER_HEIGHT		= '420px';
var BALSEC_POPUPINFOWND_DISTANCE	= 6;//[px]
var BALSEC_POPUPINFOWND_SPEED		= 500;//[ms]

///////////////////////////////////////////////////////////////////////////////
if ( typeof bals != "undefined" ) var _bals = bals;
var bals = window.bals = function(){ return this instanceof bals ? this.init() : new bals(); };

///////////////////////////////////////////////////////////////////////////////
bals.prototype = {

	///////////////////////////////////////////////////////////////////////////
	//
	//
	//
	///////////////////////////////////////////////////////////////////////////
	init: function()
	{
	},

	///////////////////////////////////////////////////////////////////////////
	//
	//	bals.history
	//
	///////////////////////////////////////////////////////////////////////////
	history: function(num)
	{
		//-------------------------------------------------------------------------
		function Record(name, url, image)
		{
			this.name	= name;
			this.url	= url;
			this.image	= image;

			this.isNull	= function()
			{
				return (
						this.name == '' || this.url == '' || this.image == '' ||
						this.name == null || this.url == null || this.image == null
					   );
			}

			this.html	= function()
			{
				if ( this.isNull() ){ return ''; }

				result =
						'<p><a href="' + this.url + '"><img src="'+ this.image +'" /></a></p>' +
						'<p><a href="' + this.url + '">'+ this.name +'</a></p>' +
						'';
				return result;
			}
		}
		//-------------------------------------------------------------------------
		function Records(num)
		{
			this.records_ = new Array(num);
			for ( i=0; i<num; i++ )
			{
				this.records_[i] = new Record( $.cookie('name_'+i), $.cookie('url_'+i), $.cookie('image_'+i) );
			}

			this.write = function()
			{
				for ( i=0; i<this.records_.length; i++ )
				{
					$.cookie('url_'+i,		this.records_[i].url,	{'path':'/'});
					$.cookie('name_'+i,		this.records_[i].name,	{'path':'/'});
					$.cookie('image_'+i,	this.records_[i].image,	{'path':'/'});
				}
			}
			this.find = function(url)
			{
				for ( i=0; i<this.records_.length; i++ )
				{
					if ( this.records_[i].url == url ) { return i; }
				}
				return -1;
			}
			this.get = function(idx)
			{
				if ( idx<0 || idx>=this.records_.length ) return new Record(null, null, null);//null object
				return this.records_[idx];
			}
			this.set = function(record)
			{
				var idx = this.find( record.url );
				if ( idx < 0 )
				{ // new
					this.pushHead( record );
				}
				else
				{
					for ( i=idx; i>0; i-- )
					{
						this.records_[i] = this.records_[i-1];
					}
					this.records_[0] = record;
				}
				this.write();
			}
			this.pushHead = function(record)
			{
				// shift
				for ( i=this.records_.length-1; i>0; i-- )
				{
					this.records_[i] = this.records_[i-1];
				}
				this.records_[0] = record;
			}
			this.swap = function( idx1, idx2 )
			{
				var temp = this.records_[idx1];
				this.records_[idx1] = this.records_[idx2];
				this.records_[idx2] = temp;
			}
			this.html = function()
			{
				var html = '';
				for ( i=0; i<this.records_.length; i++ )
				{
					html += this.records_[i].html();
				}
				return html;
			}
		}

		var records = new Records(num);

		if ( BALSEC_PAGETYPE=='goodsdetail' )
		{
			var current = new Record( $('#goodsName').text(), document.URL, $('#goodsImageMainThum').attr('src') );
			records.set(current);
		}
		$('#recentGoods').html( records.html() );

		return this;
	},

	///////////////////////////////////////////////////////////////////////////
	//
	//	bals.popupwnd
	//
	///////////////////////////////////////////////////////////////////////////
	popupwnd: new function()
	{
		this.prototype = {
			show: function(linkId, title, html, allowWidth, width)
			{
				$('.popupwnd').remove();
				this.ID_ = 'popupwnd_' + linkId;
				this.Active_ = true;

				title				= (title) ? title : '&nbsp;';
				width				= (width) ? width * 1 : 250;

				var clientWidth 	= bals.util.window.clientWidth();
				var linkLeft		= bals.util.element.getAbsoluteLeft(linkId);
				var linkTop			= bals.util.element.getAbsoluteTop(linkId);
				var linkWidth		= bals.util.element.getElementWidth(linkId);

				var hasArea			= clientWidth - linkLeft;
				var posY			= linkTop - 3;

				if ( linkLeft > width )
				{
					var lr = "right";
					var posX = linkLeft - (width + allowWidth);
					var arrowX = width;
				}
				else
				{
					var lr = "left";
					var posX = linkLeft + linkWidth + allowWidth;
					var arrowX = -allowWidth;
				}

				$('body').append(
					'<div id="'+this.ID_+'" class="popupwnd ' + lr + '" style="width:' + width + 'px">'+
						'<div class="popupwnd_arrow"></div>' +
						'<div class="popupwnd_caption">' + title + '</div>' +
						'<div class="popupwnd_body"></div>' +
					'</div>');
				$('#'+this.ID_).css({left: posX+'px', top: posY+'px'});
				$('#'+this.ID_ +' .popupwnd_arrow').css({left: arrowX+'px'});
				$('#'+this.ID_ +' .popupwnd_body').html(html);

				var THIS = this;
				$('#'+this.ID_).hover(
					function(){
						THIS.Active_ = true;
					},
					function(){
						THIS.Active_ = false;
						THIS.remove();
					}
					);
			},
			remove: function()
			{
				this.Active_ = false;

				var THIS = this;
				$('#'+this.ID_).oneTime(BALSEC_POPUPINFOWND_SPEED,function(){
					if ( !THIS.Active_ ) { $('#'+THIS.ID_).remove(); }
					});
			}
		}

		this.show		= this.prototype.show;
		this.remove		= this.prototype.remove;

		this.ID_		= '';
		this.Active_		= false;

		return this;
	},

	///////////////////////////////////////////////////////////////////////////
	//
	//	bals.util
	//
	///////////////////////////////////////////////////////////////////////////
	util: new function()
	{
		this.prototype = {
			///////////////////////////////////////////////////////////////////////////
			//
			//	bals.util.element
			//
			///////////////////////////////////////////////////////////////////////////
			element: new function()
			{
				this.prototype = {
					getElementWidth: function(objectId)
					{
						x = document.getElementById(objectId);
						return x.offsetWidth;
					},
					getAbsoluteLeft: function(objectId)
					{
						o = document.getElementById(objectId);
						oLeft = o.offsetLeft;
						while (o.offsetParent!=null)
						{
							oParent = o.offsetParent;
							oLeft += oParent.offsetLeft;
							o = oParent;
						}
						return oLeft
					},
					getAbsoluteTop: function(objectId)
					{
						o = document.getElementById(objectId);
						oTop = o.offsetTop;
						while (o.offsetParent!=null)
						{
							oParent = o.offsetParent;
							oTop += oParent.offsetTop;
							o = oParent;
						}
						return oTop
					},
					setOpacity: function(obj,value)
					{
						$(obj).css('filter','alpha(opacity='+value*100+')');
						$(obj).css('-moz-opacity',value);
						$(obj).css('opacity',value);
					}
				}
				this.getElementWidth	= this.prototype.getElementWidth;
				this.getAbsoluteLeft	= this.prototype.getAbsoluteLeft;
				this.getAbsoluteTop		= this.prototype.getAbsoluteTop;
				this.setOpacity			= this.prototype.setOpacity;
			},
			///////////////////////////////////////////////////////////////////////////
			//
			//	bals.util.window
			//
			///////////////////////////////////////////////////////////////////////////
			window: new function()
			{
				this.prototype = {
					clientWidth: function()
					{
						return self.innerWidth || 
								(document.documentElement && document.documentElement.clientWidth) ||
								document.body.clientWidth;
					}
				}
				this.clientWidth		= this.prototype.clientWidth;
			},

			///////////////////////////////////////////////////////////////////////////
			//
			//
			//
			///////////////////////////////////////////////////////////////////////////

			//-------------------------------------------------------------------------
			EscapeHtml: function(html)
			{
				html = html.replace(/>/g,"&gt;");
				html = html.replace(/</g,"&lt;");
				return html;
			},

			//-------------------------------------------------------------------------
			urlParser: function(path)
			{
				var img=new Image();
				img.src=path;
				path=img.src;
				img.src='#';
				return path;
			}
		}
		this.element	= this.prototype.element;
		this.window		= this.prototype.window;
		this.EscapeHtml	= this.prototype.EscapeHtml;
		this.urlParser	= this.prototype.urlParser;
	}
}

bals.history	= bals.prototype.history;
bals.popupwnd	= bals.prototype.popupwnd;
bals.util		= bals.prototype.util;

///////////////////////////////////////////////////////////////////////////////
//
//
//
//
///////////////////////////////////////////////////////////////////////////////
$(
	function()
	{
		function decodeJsonData( text ){
			return decodeURIComponent( text );
		};

		function showGoodsInfo(linkID, title, html)
		{
			if ( html == '' )
			{
				bals.popupwnd.remove();
			}
			else
			{
				bals.popupwnd.show(linkID, title, html, BALSEC_POPUPINFOWND_DISTANCE, 250);
			}
		}
		function hideGoodsInfo()
		{
			bals.popupwnd.remove();
		}

		function setHtml2GoodsImageOverlay(html)
		{
			if ( html=='' )
			{
				$('#goodsImageOverlayDummy').html( html );
				$('#goodsImageOverlay').html( html );
			}
			else
			{
				html = '<div style="padding:10px;">'+html+'</div>';
				$('#goodsImageOverlayDummy').html( html );
				$('#goodsImageOverlay').html( html );
			}
		}

		function emulateSelectOptionDisabled()
		{
			$('select').each( function() {
				this.select_current = new Array();
				this.onfocus = function(){ this.select_current[this.id] = this.selectedIndex; }
				this.onchange = function()
				{
					if (this.options[this.selectedIndex].disabled){ this.selectedIndex = this.select_current[this.id];}
				}
			});
		}

		// for IE6
		emulateSelectOptionDisabled();

		// HISTORY
		bals.history(4);

		// CATEGORY ACORDION
		$('#categoryMenu ul').hide();
		$('#categoryMenu > li > a').css('cursor','pointer');
		$('#categoryMenu > li > a').click(
			function(){
				if ( $(this).attr('href') )
				{
				}
				else
				{
					$('#categoryMenu ul').hide('slow');
					$(this).siblings('ul:hidden').show('slow');
					return false;
				}
			}
		);
		category_id = $('#categoryID').html();
		if ( category_id != null )
		{
			$('#categoryMenu li.categoryID_' + category_id.substr(0,4) + ' ul').show();
		}

		// RECENT ACORDION
		$('#recentSection > div > div').hide();
		$('#recentSection > div > ul > li > a').css('cursor','pointer');
		$('#recentSection > div > ul > li > a').click(
			function(){
				$('#recentSection > div > div').slideToggle('slow');
				$('#recentSection > div').toggleClass('recentOpen');
			}
		);

		// AUTOSCROLL
		$('a[href*=#]').click( function() {
			if (
				location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') &&
				location.hostname == this.hostname
				) {  
				var $target = $(this.hash);  
				$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
				if ($target.length) {
					var targetOffset = $target.offset().top - 20;
					$('html,body').animate({scrollTop: targetOffset}, 1000);
					return false;
				}
			}
		});

		//---------------------------------------------------------------------
		// toppage
		//---------------------------------------------------------------------
		if ( BALSEC_PAGETYPE=='toppage' )
		{
			// TAB関連処理
			{
				var TABIMAGEURL = 'http://' + BALSEC_BLOGSERVERNAME + BALSEC_BLOGIMGDIR + '/ec/';
				$.getJSON(
						"http://" + BALSEC_BLOGSERVERNAME + BALSEC_BLOGECDIR + '/jsonp_html.php?contents=top&callback=?',
						function( json )
						{
							json.html = decodeJsonData(json.html);
							function setTabImg(menuid, active, isnew)
							{
								$('#'+menuid+'Tab > a').css(
										'background-image',
										'url("' + TABIMAGEURL + 'menu_' + menuid + (isnew?'_new':'') + (active?'_active':'') + '.gif")'
										);
							}
							function setActiveColorBar(menuid)
							{
								$('#menuTab').css(
									'background-image',
									'url("' + TABIMAGEURL + 'menu_bg_' + menuid + '.gif")'
									);
							}
							function setActiveTab(menuid, speed)
							{
								$('#menuTab > li').each( function() {
									this.id.match(/(.+)Tab/);
									id = RegExp.$1;
									setTabImg( id, id==menuid, $('#'+id+'Tab').attr('class') == 'new' );
								});
								setActiveColorBar(menuid);
								$('#menuContainer div.tabbox').fadeOut(speed);
								$('#'+menuid+'Container').fadeIn(speed);
							}

							$('#menuTabContainer').append(json.html);

							// initialize tab images & activate tab
							$('#menuContainer')
								.css('position', 'relative')
								.css('height', BALSEC_TABCONTAINER_HEIGHT)
								;
							$('#menuContainer div.tabbox')
								.css('position', 'absolute')
								.css('top','10px').css('left','10px').css('right','10px')
								;
							$('#menuTab li')[0].id.match(/(.+)Tab/); // first Menu ID
							setActiveTab( RegExp.$1, 0 );

							// auto lotation tabs
							var activeAutoLotation = true;
							var positionAutoLotation = 0;
							var tabIDs = new Array();
							$('#menuTab > li').each( function() {
								this.id.match(/(.+)Tab/);
								tabIDs.push( RegExp.$1 );
							});
							$(this).everyTime(BALSEC_TABLOTATIONSPEED, 'autotablotation', function() {
								if ( activeAutoLotation )
								{
									positionAutoLotation = (++positionAutoLotation >= tabIDs.length) ? 0 : positionAutoLotation;
									setActiveTab( tabIDs[ positionAutoLotation ], BALSEC_TABEFFECTSPPED );
								}
							});

							// click handler
							$('#menuTab > li > a').each( function() {
								$(this).unbind("click"); // UnBind Auto Scroll
								$(this).click( function() {
									activeAutoLotation = false;
									this.href.match(/#(.+)Container/);
									setActiveTab( RegExp.$1, BALSEC_TABEFFECTSPPED );
									return false;
								});
							});
						}
					);
			}
		} // /toppage

		//---------------------------------------------------------------------
		// goodsdetail
		//---------------------------------------------------------------------
		if ( BALSEC_PAGETYPE=='goodsdetail' )
		{
			//--------------------------------------
			// Thickbox
			//--------------------------------------
			$('.goodsImageThum').each(
				function(){
					$(this).wrap(
						'<a href="'+this.src+'" class="goodsImageThumLink thickbox" title="'+$('#goodsName').text()+'"></a>'
						);
				}
			);

			var mainImageSrc = $('#goodsImageMain').attr('src');
			$('#goodsImageMain').wrap(
				'<a href="'+mainImageSrc+'" class="thickbox" title="'+$('#goodsName').text()+'"></a>'
				);
			$('.goodsImageThum').hover(
				function(){
					$('#goodsImageMain').attr('src',this.src);
				},
				function(){
					$('#goodsImageMain').attr('src', mainImageSrc);
				}
			);
			$('#goodsImageOverlayFrame').css('display','none');//オーバレイ表示領域を消す(※現在必要ない領域)
			tb_init('a.thickbox');

			//--------------------------------------
			// Goods Imformation
			//--------------------------------------
			$('#coordinationsLink').hover(
				function(){
					LISTUPMAX = 4;
					html = '';
					if ( $('img.goods_image','#coordinations').length == 0 )
					{
						html += '<p>現在、コーディネート商品はありません</p>';
					}
					else
					{
						html += '<div style="text-align:center;">';
						var i=0;
						$('img.goods_image','#coordinations').each(function(){
							if ( ++i<=LISTUPMAX ) {
								html += '<a href="' + $(this).parent().attr('href') + '">';
								html += '<img src="'+this.src+'" style="width:70px;height:70px;margin:6px;" />';
								html += '</a>';
							}
						});
						html += '</div>';
//						html += '<p style="font-size:80%">すべてのコーディネート商品を見るにはそのままクリックしてください。</p>';
					}
					showGoodsInfo( this.id, 'コーディネート商品', html );
				},
				function(){
					hideGoodsInfo();
				}
			);

			$('#articlesLink').hover(
				function(){
					LISTUPMAX = 4;
					html = '';
					if ( $('li','#articlesContainer').length == 0 )
					{
						html += '<p>現在、関連記事はありません</p>';
					}
					else
					{
						html += '<ul class="markerNone articleInfoList">';
						var i=0;
						$('li','#articlesContainer').each(function(){
							if ( ++i<=LISTUPMAX ) {
//								html += '<li>'+$('a',this).html()+'</li>';
								html += '<li>'+this.innerHTML+'</li>';
							}
						});
						html += '</ul>';
//						html += '<p style="font-size:80%">すべての関連記事を見るにはそのままクリックしてください。</p>';
					}
					showGoodsInfo( this.id, '関連記事', html );
				},
				function(){
					hideGoodsInfo();
				}
			);

			$('#commentsLink').hover(
				function(){
					LISTUPMAX = 4;
					html = '';
					if ( $('li','#commentsContainer').length == 0 )
					{
						html += '<p>現在、コメントはありません</p>';
					}
					else
					{
						html += '<ul class="markerNone commentInfoList">';
						var i=0;
						$('li','#commentsContainer').each(function(){
							if ( ++i<=LISTUPMAX ) {
//								html += '<li>'+$('a',this).html()+'</li>';
								html += '<li>'+this.innerHTML+'</li>';
							}
						});
						html += '</ul>';
//						html += '<p style="font-size:80%">すべてのコメントを見るにはそのままクリックしてください。</p>';
					}
					showGoodsInfo( this.id, 'コメント', html );
				},
				function(){
					hideGoodsInfo();
				}
			);

			$('#trackbacksLink').hover(
				function(){
					LISTUPMAX = 4;
					html = '';
					if ( $('li','#trackbacksContainer').length == 0 )
					{
						html += '<p>現在、トラックバックはありません</p>';
					}
					else
					{
						html += '<ul class="markerNone trackbackInfoList">';
						var i=0;
						$('li','#trackbacksContainer').each(function(){
							if ( ++i<=LISTUPMAX ) {
//								html += '<li>'+$('a',this).html()+'</li>';
								html += '<li>'+this.innerHTML+'</li>';
							}
						});
						html += '</ul>';
//						html += '<p style="font-size:80%">すべてのトラックバックを見るにはそのままクリックしてください。</p>';
					}
					showGoodsInfo( this.id, 'トラックバック', html );
				},
				function(){
					hideGoodsInfo();
				}
			);

			//------------------------------------------------
			// JSONP
			//------------------------------------------------
			GID = $('#goodsCode').text();
			function insertJsonpContents( json, insCntID, insNumCntID, msgY, msgN, msgYFollow, ulID, ulClass )
			{
				var ok = ( (typeof(json.records) != 'undefined') && (json.records.length > 0) );
				var numOfRecords = ok ? json.records.length : 0;

				html = '<p class="message">';
				html += ok ? msgY : msgN;
				html += '</p>';

				if ( ok ) {
					html += '<ul class="'+ulClass+'" id="'+ulID+'">';
					for ( i=0; i<numOfRecords; i++)
					{
						if ( json.records[i]['url'] != '' )
						{
							html += '<li><a href="' + 
									bals.util.EscapeHtml( decodeJsonData(json.records[i]['url']) ) +
									'">' +
									bals.util.EscapeHtml( decodeJsonData(json.records[i]['title']) ) + 
									'</a></li>';
						}
						else
						{
							html += '<li>' +
									bals.util.EscapeHtml( decodeJsonData(json.records[i]['title']) ) +
									'</li>';
						}
					}
					html += '</ul><p class="message">'+msgYFollow+'</p>';
				}
				$('#'+insCntID).html(html);
				$('#'+insNumCntID).html(
						parseInt($('#'+insNumCntID).html()) + numOfRecords
					);
			}
			{ // ARTICLES
				url = "http://" + BALSEC_BLOGSERVERNAME + BALSEC_BLOGECDIR + "/jsonp_articles.php?gid="+GID+"&callback=?";
				$.getJSON(
						url,
						function( json )
						{
							insertJsonpContents(
								json,
								'articlesContainer', 'numOfArticles',
								'',
								'関連記事はありません。', '',
								'articlesContainer', 'markerNone articleInfoList'
								);
							if ( $('li','#articlesContainer').length != 0 )
							{
								$('#articlesLink').parent().show();
							}
							else
							{
								$('#articles').hide();
							}
						}
					);
			}
			{ // COMMENTS
				url = "http://" + BALSEC_BLOGSERVERNAME + BALSEC_BLOGECDIR + "/jsonp_comments.php?gid="+GID+"&callback=?";
				$.getJSON(
						url,
						function( json )
						{
							insertJsonpContents(
								json,
								'commentsContainer', 'numOfComments',
								'',
								'コメントはありません。', '',
								'commentsContainer', 'markerNone commentInfoList'
								);
							if ( $('li','#commentsContainer').length != 0 )
							{
								$('#commentsLink').parent().show();
							}
							else
							{
								$('#comments').hide();
							}
						}
					);
			}
			{ // TRACKBACKS
				url = "http://" + BALSEC_BLOGSERVERNAME + BALSEC_BLOGECDIR + "/jsonp_trackbacks.php?gid="+GID+"&callback=?";
				$.getJSON(
						url,
						function( json )
						{
							insertJsonpContents(
								json,
								'trackbacksContainer', 'numOfTrackbacks',
								'',
								'トラックバックはありません。', '',
								'trackbacksContainer', 'markerNone trackbackInfoList'
								);
							if ( $('li','#trackbacksContainer').length != 0 )
							{
								$('#trackbacksLink').parent().show();
							}
							else
							{
								$('#trackbacks').hide();
							}
						}
					);
			}

			// NUM OF COORDINATIONS
			_numOfCoordinations = $('img.goods_image','#coordinations').length;
			$('#numOfCoordinations').html( _numOfCoordinations );
			if ( _numOfCoordinations != 0 ) { $('#coordinationsLink').parent().show(); }


			// BLOGPARTS
			{
				imgurl = bals.util.urlParser( $('#goodsImageMainThum').attr('src') );

				partsHtml = '';
				partsHtml += '<div class="francfranc_bp" style="width:240px; height:170px; margin:0;padding:0;';
				partsHtml += 	'background-color:#EEE; border:1px solid #CCC; overflow:hidden; position:relative; ">';
				partsHtml += 	'<div style="height:30px; margin:0;padding:5px 0 0 5px; background-color:#FFF; ">';
				partsHtml += 		'<p style="margin:0;padding:0;"><a href="http://www.francfranc.com/" style="margin:0;padding:0;">';
 				partsHtml += 		'<img src="http://'+location.hostname +'/img/usr/logo.gif" style="margin:2px 0 0 0;" border="0" alt="Francfranc" />';
				partsHtml += 		'</a></p>';
				partsHtml += 	'</div>';
				partsHtml += 	'<div style="padding:15px 5px 5px 10px;">';
				partsHtml += 		'<div style="float:left; margin:0; padding:0">';
				partsHtml += 			'<p style="margin:0;padding:0;"><a href="' + document.URL + '" style="margin:0;padding:0;">';
				partsHtml += 			'<img src="' + imgurl + '"';
				partsHtml += 				'width="70" height="70" border="0" style="width:70px; height:70px;';
				partsHtml += 				'margin:0;padding:0; border:1px solid #CCC;" alt="' + $('#goodsName').text() + '" />';
				partsHtml += 			'</a></p>';
				partsHtml += 		'</div>';
				partsHtml += 		'<div style="float:left; margin:0 0 0 10px; padding:0; width:135px;">';
				partsHtml += 			'<p style="margin:0;padding:0;">';
				partsHtml += 				'<a href="'+document.URL+'" style="margin:0;padding:0;font-weight:bold;font-size:12px;">' + $('#goodsName').text() + '</a></p>';
				partsHtml += 			'<p style="margin:0;padding:0;font-size:12px;">' + $('#goodsPrice').html() + '</p>';
				partsHtml += 			'<p style="margin:10px 0 0 0;padding:0;"><a href="' + document.URL + '" style="margin:0;padding:0;">';
 				partsHtml += 			'<img src="http://'+location.hostname +'/img/usr/btn_goods_detail.gif" border="0" style="margin:0;padding:0;" alt="" />';
				partsHtml += 			'</a></p>';
				partsHtml += 		'</div>';
				partsHtml += 	'</div>';
				partsHtml += 	'<div style="clear:both; height:16px; width:240; margin:0;padding:0;';
				partsHtml += 		'background-color:#FFF;text-align:center; position:absolute; bottom:0; left:0; right:0;">';
 				partsHtml += 		'<img src="http://'+location.hostname +'/img/usr/f_img_copy.gif" style="margin:2px 0 0 0;padding:0;" alt="" />';
				partsHtml += 	'</div>';
				partsHtml += '</div>';

				$('#blogpartsSample').html( partsHtml );
				$('#blogpartsHtml').html( bals.util.EscapeHtml(partsHtml) );

				$('#blogpartsHtml').click( function(){
					this.select();
				});

				if ( jQuery.browser.msie )
				{
					$('#blogpartsHtmlCopy').html('<input type="button" id="btnCopyBlogpartsHtml" class="typeBtn" value="クリップボードにコピー" />');
					$('#btnCopyBlogpartsHtml').click( function() {
						$('#blogpartsHtml').select();
						clipboardData.setData("Text", partsHtml );
					});
				}
			}

			// TRACKBACKURL
			tbURL = "http://" + BALSEC_BLOGSERVERNAME + "/cgi-bin/mt/plugins/Bals/bals-tb.cgi/goods/" + $('#goodsCode').html();
			$('#trackBackUrl').attr( 'value', tbURL );
			$('#trackBackUrl').click( function(){
				this.select();
			});
			if ( jQuery.browser.msie )
			{
				$('#trackBackUrlCopy').html('<input type="button" id="btnCopyTrackBackUrl" class="typeBtn" value="クリップボードにコピー" />');
				$('#btnCopyTrackBackUrl').click( function() {
					$('#trackBackUrl').select();
					clipboardData.setData("Text", tbURL );
				});
			}
		}// /goodsdetail
	}
);


