﻿	function jslinks() {
	$('.bbs').html('<a href="/bbs/">報告掲示板</a>');
}

	function cgicount() {
	document.write('<img src="http://dic.sakura.ne.jp/count/count.cgi" alt="" width="0" height="0" border="0" />');
}

	function check() {
	var name = document.form1.name.value;
	var comment = document.form1.comment.value;
	var comce = document.form1.comce.value;
	var page = $("#comment-p").html();
	if (document.form1.mod) {
	var mod = document.form1.mod.value;
	var params = {name: name, comment: comment, comce: comce, mod: mod, p: page};
}	else {
	var params = {name: name, comment: comment, comce: comce, p: page};
}

	$(".com").load('http://anime.xce.jp/backend_comment.php', params);
	return false;
}

	function recheck() {
	var name = document.form1.name.value;
	var comment = document.form1.comment.value;
	var page = $("#comment-p").html();
	var params = {name: name, comment: comment, p: page};
	$(".com").load('http://anime.xce.jp/backend_comment.php', params);
}

	function comment(obj) {
	var page = obj;
	var name = document.form1.name.value;
	var comment = document.form1.comment.value;
	var params = {name: name, comment: comment, p: page};
	$(".com").load('http://anime.xce.jp/backend_comment.php', params);
}

	function video_d() {
	var ids = entry_name;
	var heights = entry_height;
	var iframe = '<iframe src="http://anime.xce.jp/data/index.php?id='+ids+'" title="'+ids+'" name="if_d" id="if_d" class="main-iframe" frameborder="0" style="height:'+heights+'px;"></iframe>';
	document.write(iframe);
}

	$(function () {

	$("#video-form").html('');

	if ($('#broad').html()) {
	$('#broad').prepend('<div id="broad-navi"><span class="broad-jump" name="all" style="color:black;text-decoration:none;cursor:default;">全表示</span></div>');
	$('#broad .sub-header').each(function(){
	var html = $(this).html();
	var name = $(this).attr('id');
	if ($('#broad-navi').html()) {
	$('#broad-navi').append(' | <span class="broad-jump" name="'+name+'">'+html+'</span>');
}
});

	$('.broad-jump').click(function(){
	var name = $(this).attr('name');
	$('.broad-jump').each(function(){
	$(this).removeAttr("style");
});
	$(this).css({"color":"black","text-decoration":"none","cursor":"default"});
	if (name != 'all') {
	$('.sub-header').each(function() {
	if (name == $(this).attr('id')) {
	$(this).css('display','');
	$(this).next().css('display','');
}	else {
	$(this).css('display','none');
	$(this).next().css('display','none');
}
});
}	else  {
	$('.sub-header').each(function() {
	$(this).css('display','');
	$(this).next().css('display','');
});
}
});

}

	$('.sim-img').parent().hover(function(){
	$(this).css("background","#cff");
}, function(){
	$(this).css("background","#fff");
});

	$('.sim-txt ').parent().toggle(function(){
	var href = $(this).children().children().attr('href');
	window.open(href);
}, function(){
	var href = $(this).children().children().attr('href');
	window.open(href);
});

	$('#cnt').before('<span id="count">&#62;&#62; 週間</span>');
	$('#count').toggle(function(){
	if (!$('#cnw').html()) {
	$('#cnt').after('<div id="cnw"></div>');
	$('#cnt').hide();
	$(this).html('&#62;&#62; 最近');
	$('#cnw').css({'height':'100px','background':'transparent url("http://anime.xce.jp/imagefile/ajax-loader.gif") no-repeat center center'});
	$('#cnw').load('/counter/count_week.php',function(){
	$('#cnw').css({'height':'150px','background':''});
	var $all = $('#cnw .all').html();
	var $today = $('#cnw .today .right').html();
	var $yesterday = $('#cnw .yesterday .right').html();
	$("#cnt .all").html($all);
	$("#cnt .today .right").html($today);
	$("#cnt .yesterday .right").html($yesterday);
/*
	if ($('#cnt .ten_million')) {
	var $countdown = 10000000 - $('#cnw .all .right').html();
	$("#cnt .ten_million .right").html($countdown);
}
*/
});
}	else {
	$(this).html('&#62;&#62; 最近');
	$('#cnt').hide();
	$('#cnw').show();
}
}, function(){
	if ($('#cnw').html()) {
	$(this).html('&#62;&#62; 週間');
	$('#cnw').hide();
	$('#cnt').show();
}
});

	$('.favorite').hover(function(){
	$(this).css("background","#cff");
}, function(){
	$(this).css("background","#fff");
});

	$('.individual-entry-archive .favorite').click(function(){
	if ($(this).children().html() == '登録') {
	var id = $(this).children().attr("id");
	location.href = 'http://anime.xce.jp/js/mark/favorite_on.php?entry='+id;
}	else {
	location.href = 'http://anime.xce.jp/favorite/';
}
});

	$('.favorite-page').click(function(){
	if ($(this).children().html() == '削除') {
	$(this).parent().css("background","#ccc");
	$(this).children().html('解除');
	$(this).children().css("color","blue");
	var id = $(this).children().attr('id');
	if ($('#favorite-ban').html()) {
	var data = $('#favorite-ban').html()+"+"+id;
	$('#favorite-ban').html(data);
}	else {
	$('#bookmark').after('<div id="favorite-ban" style="display:none;"></div>');
	$('#favorite-ban').html(id);
}
	$('#favorite-submit').html("確定");
	$('#favorite-submit').css({"color":"yellow","background":"#ccc","cursor":"pointer"});
}	else {
	var id = $(this).children().attr('id');
	var ban = $('#favorite-ban').html();
	var data = ban.replace(id,"");
	var data = data.replace(/\++/g,'+');
	var data = data.replace(/^\+/,'');
	var data = data.replace(/\+$/,'');
	$('#favorite-ban').html(data);
	$(this).parent().css("background","white");
	$(this).children().html('削除');
	$(this).children().css("color","gray");
	if (!$('#favorite-ban').html()) {
	$('#favorite-submit').html("-");
	$('#favorite-submit').css({"color":"black","background":"white","cursor":"auto"});
}
}
});

	$('#favorite-submit').click(function(){
	if ($(this).html() == '確定') {
	var data = $('#favorite-ban').html();
	var data = data.replace(/\+/g,'%2B');
	location.href = 'http://anime.xce.jp/js/mark/favorite_off.php?entry='+data;
}
});

	$(".main-index #counter").after('<h2 class="module-header">コメントフォーム</h2><div class="module-comment"><span id="comment">&#62;&#62; コメントを見る</span><div class="com"></div></div>');
	$("#comment").toggle(function(){
	$(this).next().load('http://anime.xce.jp/backend_comment.php',function(){
	$("#comment").html('&#62;&#62; コメントを閉じる');
});
}, function(){
	$(this).next().html('');
	$(this).html('&#62;&#62; コメントを見る');
});

	var header_name = [$(".ajax-header"),$(".module-header"),$(".module-caption"),$(".similar-item")];
	$(header_name).each(function(){
	this.click(function(){
	$(this).next().toggle();
});
});
});


