$(function(){

	//現在居るファイル名	   
	var currentFile = location.href.split('/').pop();
	
	//ua取得
	var ua = navigator.userAgent;
	
	/* ウィンク効果 */
	$("#sidecolumn a img").hover(function(){
		$(this).css("opacity", "0.2");
		$(this).css("filter", "alpha(opacity=20)");
		$(this).fadeTo("slow", 1.0);
	});


	//fancybox
	try{
		$("div.abc a,div.wysiwyg a").fancybox({
			'zoomOpacity' : true,
			'overlayShow' : false,
			'zoomSpeedIn' : 500,
			'zoomSpeedOut' : 500
			
		});
	}catch(e){
	}

	$("#agree_2_1 tr:nth-child(odd)").css("background", "#F1F0F4");

	/* slimbox */
	try{
	$("#works div a").slimbox({/* Put custom options here */}, null, function(el) {
		return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
	});
	}catch(e){
	}

	//rollover	
	$("a img").each(function(){
		var imgSrc = $(this).attr('src');
		//smartRollover
		if(imgSrc.match(/(.*)_off(\..*)/)){
			var repSrc = RegExp.$1+'_on'+RegExp.$2;
			$(this).hover(function(){
				$(this).attr('src',repSrc);
				$(this).css({opacity: '1',filter: 'alpha(opacity=100)'});
			},function(){
				$(this).attr('src',imgSrc);
			});
		}
	});

	//submit押した感 & ウィンクorsmartrollover
	$('input[type=image]').mousedown(function(){
		$(this).css({position:'relative',top:'1px',left:'1px'});
	}).mouseup(function(){
		$(this).css({position:'static'});
	}).mouseout(function(){
		$(this).css({position:'static'});
	})
	
	  /* ウィンク版 　
	  .hover(function(){
		$(this).css({opacity:0.2});
		$(this).fadeTo('slow',1.0); */
		
	  /* smartrollover版　*/
	  .hover(function(){
		$(this).attr('src',$(this).attr('src').replace(/^(.*)_off.(.*)$/,'$1_on.$2'));
	},function(){
		$(this).attr('src',$(this).attr('src').replace(/^(.*)_on.(.*)$/,'$1_off.$2'));
	});


	/* 未使用js
	//classが、'nav'で終わるulの、最後のliに、'last'クラスを付ける
	$('ul[class$="nav"]').each(function(){
		$('li:last',this).addClass('last');
	});
	
	//classが、'list'で終わるulの、偶数の要素に、'even'クラスを付ける
	$('ul[class$="list"] li:nth-child(even)').addClass('even');
	
	//classが、'table'で終わるテーブルの、偶数trに、'even'クラスを付ける
	$('table[class$="table"] tr:nth-child(even)').addClass('even');
		
	//#footerコピーライトの年を動的に書き換え
	var year = new Date().getFullYear();
	$('#footer address span').text(year);
	
	//flatHeights設定 http://www.akatsukinishisu.net/itazuragaki/js/i20070801.html
	/*var sets = [], temp = [];
    $('ul#thumbnail > li').each(function(i) {
        temp.push(this);
        if (i % 3 == 2) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);*/

    /* 各組ごとに高さ揃え */
    /*$.each(sets, function() {
        $(this).flatHeights();
    });*/


	/*
 	if(ua.indexOf('IE 6') > -1 || ua.indexOf('IE 7') > -1){
		//サムネールを内包する、.table-cell内で、display:table-cell;vertical-align:middle;のように表示する
		$('.table-cell').each(function(){
			var x = $('img',this).width();
			var y = $('img',this).height();
			if(x > y){
				$(this).css({display:'block'});
				var boxY = $(this).height();
				var rePadding = Math.floor((boxY - y) / 2);
				var reHeight = boxY - rePadding;
				$(this).css({paddingTop:rePadding+'px',height:reHeight+'px'});
			}
		});
	}
	*/
	
	/* クロスブラウザなゼブラテーブル 
	$("#news dl:nth-child(even)").css("background", "#F0EFF1");
	*/

});

