$(function() {
	$("#bnrArea dl").each(function(i) {
		if(i != 0) $("em", this).addClass("s");
		$(this)
			.click(function () {
				location.href = $('a', this).attr("href");
			})
			.hover(
				function () {
					showTooltip($(this));
				},
				function () {
					hideTooltip($(this));
				}
			)
	});

	blogChange();

	$("#recommend dd:first a").each( function(e){
		$(this).click( function(){
			recChange(e);
			return false;
		});
	});
	clickAble();

	/***********************************************
	* Encrypt Email script- Please keep notice intact
	* Tool URL: http://www.dynamicdrive.com/emailriddler/
	* **********************************************/
	<!-- Encrypted version of: info [at] ********.*** //-->

	var emailriddlerarray=[105,110,102,111,64,103,114,101,101,110,45,121,97,46,99,111,109]
	var encryptedemail_id42='' //variable to contain encrypted email 
	for (var i=0; i<emailriddlerarray.length; i++)
	encryptedemail_id42+=String.fromCharCode(emailriddlerarray[i])

//	document.write('<a href="mailto:'+encryptedemail_id42+'"><img src="yourimage.gif" alt="Email Us" /></a>')
	$('#mailContact a:eq(0)').attr("href", "mailto:"+encryptedemail_id42);
});

function blogChange(){
	$("#newsblog .title li").each( function(e){
		if($("#newsblog div:eq("+e+")").is(":hidden")){
			$(this).click( function(){
					showBlog(e);
				}).css("cursor","pointer");
			$("img:eq(0)", this).attr("src", $("img:eq(0)", this).attr("src").replace("_on.gif", "_off.gif")).hover(
				function () {
					$(this).attr("src", $(this).attr("src").replace("_off.", "_on."));
				},
				function () {
					$(this).attr("src", $(this).attr("src").replace("_on.", "_off."));
				}
			);
		}else {
			$(this).unbind().css("cursor","default");
			$("img:eq(0)", this).attr("src", $("img:eq(0)", this).attr("src").replace("_off.gif", "_on.gif")).unbind();
		}
	});
}
function showBlog(n){
	$("#newsblog").height($("#newsblog div:eq("+n+")").height()+ 27);
	$("#newsblog div").each( function(e){
		if(e == n){
			$(this).fadeIn();
		}else {
			$(this).hide();
		}
	});
	blogChange();
}

function showTooltip(e){
	var position = e.position();
	var b = 24;
	$("em",e)
		.stop()
		.css({'bottom':(b - 10) + 'px','opacity':0,'display':'block'})
		.animate({
			opacity: 1,
			bottom: b + 'px'
		}, 200);
}
function hideTooltip(e){
	$("em",e)
		.stop()
		.fadeOut(200);
}

var myStyle = new Array(
'<a href="#" onclick="recEnd(0); return false;">ハイアレンジ</a> / <a href="#" onclick="recEnd(1); return false;">ラン</a> / <a href="#" onclick="recEnd(2); return false;">観葉植物</a>',
'<a href="#" onclick="recEnd(3); return false;">ローアレンジ</a> / <a href="#" onclick="recEnd(4); return false;">花束</a> / <a href="#" onclick="recEnd(5); return false;">観葉植物</a>',
'<a href="#" onclick="recEnd(6); return false;">ハイアレンジ</a>',
'<a href="#" onclick="recEnd(7); return false;">ローアレンジ</a>',
'<a href="#" onclick="recEnd(8); return false;">ローアレンジ</a> / <a href="#" onclick="recEnd(9); return false;">花束</a>',
'<a href="#" onclick="recEnd(10); return false;">ローアレンジ</a>',
'<a href="#" onclick="recEnd(11); return false;">観葉植物</a> / <a href="#" onclick="recEnd(1); return false;">ラン</a>',
'<a href="#" onclick="recEnd(12); return false;">花束</a>',
'<a href="#" onclick="recEnd(13); return false;">花束</a>',
'<a href="#" onclick="recEnd(14); return false;">ハイアレンジ</a> / <a href="#" onclick="recEnd(15); return false;">花束</a>',
'<a href="#" onclick="recEnd(1); return false;">ラン</a> / <a href="#" onclick="recEnd(16); return false;">季節の鉢花</a>',
'<a href="#" onclick="recEnd(17); return false;">花束</a> / <a href="#" onclick="recEnd(7); return false;">ローアレンジ</a>',
'<a href="#" onclick="recEnd(17); return false;">花束</a>',
'<a href="#" onclick="recEnd(17); return false;">花束</a>',
'<a href="#" onclick="recEnd(10); return false;">ローアレンジ</a>',
'<a href="#" onclick="recEnd(18); return false;">ハイアレンジ</a>'
);

var myType = new Array(
'<a href="gift/higharrange/tower/">タワータイプ</a> / <a href="gift/higharrange/roll/">ロールタイプ</a> / <a href="gift/higharrange/stand/">スタンドタイプ</a> / <a href="gift/higharrange/other/">アザー</a>',
'<a href="gift/orchid/phalaenopsis/">コチョウラン</a> / <a href="gift/orchid/vanda/">バンダ</a> / <a href="gift/orchid/paphio/">パフェオ</a> / <a href="gift/orchid/oncidium/">オンシジューム</a> / <a href="gift/orchid/cymbidium/">シンビジューム</a>',
'<a href="gift/plant/floor/">オンザフロアー</a>',
'<a href="gift/lowarrange/round/">ラウンドタイプ</a> / <a href="gift/lowarrange/oval/">オーバルタイプ</a> / <a href="gift/lowarrange/box/">ボックスタイプ</a> / <a href="gift/lowarrange/other/">アザー</a>',
'<a href="gift/bouquet/kyutto/">きゅっとタイプ</a>',
'<a href="gift/plant/table/">オンザテーブル</a>',
'<a href="gift/higharrange/tower/">タワータイプ</a> / <a href="gift/higharrange/stand/">スタンドタイプ</a>',
'<a href="gift/lowarrange/round/">ラウンドタイプ</a> / <a href="gift/lowarrange/box/">ボックスタイプ</a>',
'<a href="gift/lowarrange/round/">ラウンドタイプ＋キャンドル</a> / <a href="gift/lowarrange/oval/">オーバルタイプ</a>',
'<a href="gift/bouquet/fuwatto/">ふわっとタイプ</a>',
'<a href="gift/lowarrange/round/">ラウンドタイプ</a> / <a href="gift/lowarrange/oval/">オーバルタイプ</a>',
'<a href="gift/plant/table/">オンザテーブル</a> / <a href="gift/plant/floor/">オンザフロアー</a>',
'<a href="gift/bouquet/other/">アザー(赤バラ60本)</a>',
'<a href="gift/bouquet/fuwatto/">ふわっとタイプ</a> / <a href="gift/bouquet/suratto">すらっとタイプ</a>',
'<a href="gift/higharrange/tower/">タワータイプ</a> / <a href="gift/higharrange/roll/">ロールタイプ</a>',
'<a href="gift/bouquet/suratto">すらっとタイプ</a>',
'<a href="gift/season/spring/">春</a> / <a href="gift/season/summer/">夏</a> / <a href="gift/season/autumn/">秋</a> / <a href="gift/season/winter/">冬</a>',
'<a href="gift/bouquet/kyutto/">きゅっとタイプ</a> / <a href="gift/bouquet/suratto">すらっとタイプ</a>',
'<a href="gift/higharrange/tower/#natural">タワータイプ(ナチュラル)</a> / <a href="gift/higharrange/stand/#natural">スタンドタイプ(ナチュラル)</a>'
)

function recChange(n){
	$("#recommend dt:eq(1) span").show();
	$("#recommend dd:eq(1)").html(myStyle[n]).slideDown();
	$("#recommend dd:eq(0)").slideUp();
}

function clickAble(){
	$("#recommend dt:eq(0) span").show();
	$("#recommend dt:eq(0)").hover(
		function () {
			$(this).css("border","1px solid #7b705c");
			$("img:eq(0)",this).attr("src", $("img:eq(0)",this).attr("src").replace(".gif", "_on.gif"));
		},
		function () {
			$(this).css("border","1px solid #3a2920");
			$("img:eq(0)",this).attr("src", $("img:eq(0)",this).attr("src").replace("_on.gif", ".gif"));
		}
	).css("cursor","pointer").click(function () {
		//ddOpen(0);
		if($(this).next().is(":hidden")){
			$(this).next().slideDown();
		}else {
			$(this).next().slideUp();
		}
		if($("#recommend dd:eq(1)").is(":show")){
			$("#recommend dd:eq(1)").slideUp();
			$("#recommend dt:eq(1) span").hide();
		}
		if($("#recommend dd:eq(2)").is(":show")){
			$("#recommend dd:eq(2)").slideUp();
			$("#recommend dt:eq(2) span").hide();
		}
		delHover();
	});
}


function recEnd(n){
	$("#recommend dt:eq(2) span").show();
	$("#recommend dd:eq(2)").html(myType[n]).slideDown();
	$("#recommend dd:eq(1)").slideUp();
	$("#recommend dt:eq(1)").hover(
		function () {
			$(this).css("border","1px solid #7b705c");
			$("img:eq(0)",this).attr("src", $("img:eq(0)",this).attr("src").replace(".gif", "_on.gif"));
		},
		function () {
			$(this).css("border","1px solid #3a2920");
			$("img:eq(0)",this).attr("src", $("img:eq(0)",this).attr("src").replace("_on.gif", ".gif"));
		}
	).css("cursor","pointer").click(function () {
		//ddOpen(0);
		if($(this).next().is(":hidden")){
			$(this).next().slideDown();
		}else {
			$(this).next().slideUp();
		}
		if($("#recommend dd:eq(2)").is(":show")){
			$("#recommend dd:eq(2)").slideUp();
			$("#recommend dt:eq(2) span").hide();
		}
		delHover();
	});
}


function delHover(){
	$("#recommend dt:eq(1)").unbind().css("cursor","default").css("border","1px solid #3a2920");
	$("#recommend dt:eq(1) img:eq(0)").attr("src", $("#recommend dt:eq(1) img:eq(0)").attr("src").replace("_on.gif", ".gif"));
}


