//お気に入りに追加の関数
function addBookmark(title,url) {
	if(document.all){
		window.external.AddFavorite(url, title);
	} else if(window.sidebar){
		window.sidebar.addPanel(title, url, "");
	} else if(window.opera && window.print){
		return true;
	}
}


$(function(){

//
//social buttons
//
$("#toolButtons")

	// use jquery.socialbutton-1.7.1.js
	.find(".btn_facebookShare").socialbutton('facebook_share', {button:'button', text:'シェア', locale: 'ja_JP'}).end()
	.find(".btn_mixiCheck").socialbutton('mixi_check', {key:'1f590d12b39632bd006308113e66b0e1ca06b11a'}).end()
	.find(".btn_tweet").socialbutton('twitter', {button: 'none'}).end()
	.find(".btn_facebookLike").socialbutton('facebook_like', {button: 'button_count', locale: 'ja_JP'}).end()
	
	// add bookmark
	.find(".btn_addFavorites").each(function(){
		var title = document.title;
		var url   = location.href;
		if(jQuery.browser.msie){
			$(this).click(function(){
				window.external.AddFavorite(url, title);
				return false;
			});
		}else if(jQuery.browser.mozilla){
			$(this).click(function(){
				window.sidebar.addPanel(title, url, "");
				return false;
			});
		}else if(jQuery.browser.opera){
			$(this)
				.attr("href", url)
				.attr("rel", "sidebar")
				.attr("title", title)
			.end();
		}else{
			$(this).hide();
		}
	})
.end();


//
//voice
//
$("#itemVoiceImages img")
	.hide()
	.each(function(i){
		var $img = $(this);
		var thumb = new Image();
		thumb.src = $img.attr("src");
		$(document.createElement("span"))
			.appendTo("#itemVoiceNav")
			.append(thumb)
			.click(function(){
				$(this).siblings().removeClass("active");
				$(this).addClass("active");
				$img.siblings().hide();
				$img.show();
			});
	});
$("#itemVoiceNav span").eq(0).click();

//
// set #suggesets colums same height
//
(function(){
var prop = ($.browser.msie && $.browser.version === "6.0")? "height" : "minHeight";

//suggests内の高さ調整
var maxRow = 0;
var cols = [];
$("#suggests")
	.children()
		.each(function(i){
			cols[i] = $(this).find(".items").children();
			maxRow = (cols[i].length > maxRow)? cols[i].length : maxRow;
		});

for(var i = 0; i < maxRow; i++){
	var maxHeight = 0;
	var myHeight = 0;
	for(var j = 0; j < cols.length; j++){
		myHeight = cols[j].eq(i).height();
		if(myHeight > maxHeight){
			maxHeight = myHeight;
		}
	}
	for(var j = 0; j < cols.length; j++){
		 cols[j].eq(i).css(prop, maxHeight + "px");
	}
}
})();

});

//google
   var GuideSentence = 'キーワードを入力';
   function ShowFormGuide(obj) {
      // 入力案内を表示
      if( obj.value == '' ) {
         obj.value = GuideSentence;
         obj.style.color = '#808080';
      }
   }
   function HideFormGuide(obj) {
      // 入力案内を消す
      if( obj.value == GuideSentence ) {
         obj.value='';
         obj.style.color = '#000000';
      }
   }



