/**
 * プロトタイプと同時使用するために＄を変更する
 * $ -> j$
 *
 */
jQuery.noConflict();
var j$ = jQuery;

/**
 * ブログにjQueryを使用してHTMLを表示する
 *
 */
 
/**
/* ===== コメントランキング =====
j$(function() {
	j$('<div id="comment_ranking_column">')	.load("static/mpcrinclude/toppage/waioiranking #comment_ranking")
											.insertAfter('div#search_container');
});
 */
/**
/* ===== ご協力サイト ===== */
j$(function() {
	j$('<div id="kyousan_banner_column">')	.load("static/mpcrinclude/toppage/banner #bannercolumn")
											.insertAfter('div#pick-up_container');
});

/**
/* ===== Vila!!わいおい ===== */
j$(function() {
	j$( '<div id="vilawaioi_new">' ).html('<iframe src="http://vila.mpcr.jp/waioi" width="420" marginwidth="0" height="290" marginheight="0" scrolling="no" frameborder="0"></iframe>').prependTo('div#contents');
});

/**
/* ===== 防犯・防災 ===== */
j$(function() {
	// Ajaxによるアクセスにキャッシュを利用しない(毎回サーバにアクセス)
	j$.ajaxSetup( { cache : false } );
	
	// 半透明レイヤーと子ウインドを作成
	j$("body").append("<div id='glayLayer'></div><div id='overLayer'></div>");
	// -> クリックで非表示にする
	j$("#glayLayer").click(function(){
		j$(this).hide();
		j$("#overLayer").hide();
	});
   
   // 防犯・防災
	j$.post("static/bouhan/java.php", {default_val : 1}, function(data){
		if (data.length > 0){ 
			j$('<div id="bouhan_contents">').html(data).insertAfter('div#login');
		}
		// 全文を非表示にする
		j$("#bouhan_contents dd").hide();
		// カーソルを指に変更
		j$("#bouhan_contents dt").css("cursor","pointer");
			
		// クリック処理
		j$("#bouhan_contents dt").click(function(){
			j$("#glayLayer").show();
			j$("#overLayer").show().html("<img src='static/bouhan/img/close1.png' class='close' />"+j$("+dd",this).html()).css({
				marginTop:"-"+j$("#overLayer").height() / 2 + "px" , 
				marginLeft:"-"+j$("#overLayer").width() / 2 + "px"
			});
		
			j$("#overLayer img.close").click(function(){
				j$("#glayLayer").hide();
				j$("#overLayer").hide();
			});
			return false;
		});
	
		if(j$.browser.msie && j$.browser.version<7){
			j$(window).scroll(function(){
				j$("#glayLayer").get(0).style.setExpression("top","j$(document).scrollTop()+'px'");
				j$("#overLayer").get(0).style.setExpression("top","(j$(document).scrollTop()+j$(window).height() / 2)+'px'");
			});
		}
	});
});


j$(function(){
	// カテゴリ領域作成
	j$('<div id="category_jquery">').insertAfter('#village_list');
	category = j$('#category_container').clone();
	j$('#category_container').remove();
	j$('#category_jquery').html(category);
	
});

