//　this is UTF-8 document

var share = {}

share.init = function( url, title ){
	
	this.url = url;
	this.title = title;
	
	if(!document.getElementById('shareArea')) return false;
	
	var dl = document.createElement('dl');
	var dt = document.createElement('dt');
	var dd_t, dd_f;
	var img_dt, img_t, img_f;
	
	dd_t = document.createElement('dd');
	dd_f = document.createElement('dd');
	
	img_dt = new Image();
	img_t = new Image();
	img_f = new Image();
		
	dd_t.id = 'share_twitter';
	dd_f.id = 'share_facebook';
	
	img_dt.src = '/coffretdor/common/images/share_01.gif';
	img_dt.alt = '友達に教える';
	
	img_t.src = '/coffretdor/common/images/share_02.gif';
	img_t.alt = 'twitter';
	
	img_f.src = '/coffretdor/common/images/share_03.gif';
	img_f.alt = 'facebook';
	
	$(img_t).bind('click',share.twitter);
	$(img_f).bind('click',share.facebook);
	
	dt.appendChild(img_dt);
	dd_t.appendChild(img_t);
	dd_f.appendChild(img_f);
	dl.appendChild(dt);
	dl.appendChild(dd_t);
	dl.appendChild(dd_f);
	document.getElementById('shareArea').appendChild(dl);
	
}
$(function(){ share.init( location.href , document.title ) })

share.twitter = function() {
	window.open(
		'https://twitter.com/intent/tweet?text=' + encodeURIComponent(share.url) + ' ' + encodeURIComponent(share.title),
//		'https://twitter.com/intent/tweet?text=' + encodeURIComponent('http://www.kanebo-cosmetics.jp/coffretdor/') + ' ' + encodeURIComponent(share.title),

		'share',
		',width=440,height=366,toolbar=0,status=0,resizable=1,scrollbars=1'
	);
	return false;
}
share.facebook = function(){
	window.open(
		'http://www.facebook.com/share.php?u=' + encodeURIComponent(share.url),
//		'http://www.facebook.com/share.php?u=' + encodeURIComponent('http://www.kanebo-cosmetics.jp/coffretdor/'),
		'share',
		',width=640,height=440,toolbar=0,status=0,resizable=1,scrollbars=1'
	);
	return false;
}




