﻿// ======================================================================
// 
// JavaScript
// 
// ======================================================================

// アクセス解析
(function () {
/* -------------------------------------------------------------------
* URL of acclog.cgi
* ----------------------------------------------------------------- */
var acclog_cgi_url = '/cgi-bin/acc/acclog.cgi';

/* ---------------------------------------------------------------- */
create_beacon();
function create_beacon() {
	var img = document.createElement("img");
	img.src = acclog_cgi_url + "?referrer=" + document.referrer + "&width=" + screen.width + "&height=" + screen.height + "&color=" + screen.colorDepth + "&epoch=" + new Date().getTime();
}
})();



// HTML5対応
var isMSIE = /*@cc_on!@*/false;
if (isMSIE) {
    document.write("<script type=\"text/javascript\" src=\"http://www.shiro-ari.com/js/html5.js\"></script>");
}



// ドロップダウンナビ
document.write("<script type=\"text/javascript\" src=\"http://www.shiro-ari.com/js/droppy.js\"></script>");
$(function(){
	$('#navi').droppy({speed:100});

	$('#navi ul li img').hover(
		function() {
			$(this).stop().animate({"opacity": "0.6"}, "fast");
		},
		function() {
			$(this).stop().animate({"opacity": "0"}, "fast");
		}
	);
});



// ページ内リンク　スライドスクロール
// IE6以下以外で動作（http://queensryche.blog41.fc2.com/blog-entry-588.html）
if (typeof document.documentElement.style.maxHeight != "undefined") {
	document.write("<script type=\"text/javascript\" src=\"http://www.shiro-ari.com/js/slidescroll.js\"></script>");
}



// sNavi下線CSS
$(function(){
//	$('#sNavi dl#info dd:last').addClass('last');
	$('#sNavi ul#rank li:last').addClass('last');
//	$('#sNavi #news ul li:last').addClass('last');
});



// SmartRollover
(function(onLoad) {
	try {
		window.addEventListener('load', onLoad, false);
	} catch (e) {
		window.attachEvent('onload', onLoad);
	}
})(function() {
	var tags = ["img","input"];
	for( var i=0, len=tags.length; i<len; i++ ) {
		var over = function() { this.src = this.src.replace('_off.', '_on.'); };
		var out	= function() { this.src = this.src.replace('_on.', '_off.'); };
		var el = document.getElementsByTagName(tags[i]);
		for (var j=0, len2=el.length; j<len2; j++) {
			var attr = el[j].getAttribute('src');
			if (!el[j].src.match(/_off\./)&&attr) continue;
			el[j].onmouseover = over;
			el[j].onmouseout = out;
		}
	}
});



$(function(){
	// jQueryHover
	$("img.jqHover").hover(
		function() {
			$(this).stop().animate({"opacity": "0.6"}, "fast");
		},
		function() {
			$(this).stop().animate({"opacity": "1"}, "fast");
		}
	);

	$("img.jqHover2").hover(
		function() {
			$(this).stop().animate({"opacity": "0"}, "fast");
		},
		function() {
			$(this).stop().animate({"opacity": "1"}, "fast");
		}
	);

	// 一行おきに行の色を変更
	$("table.stripe tr:nth-child(odd)").addClass("odd");
});



// WindowOpen
function subwin(url, winName, option){
	win = window.open(url, winName, option);
	win.focus();
}



// PreLoad
var images_ary = new Array(
	'img/spacer.gif', 'img/mk_list.gif'
);
function preLoad(imgAry) {
	var imgMax = imgAry.length;
	var images = new Array(imgMax);
	for (var i=0; i<imgMax; i++) {
		images[i] = new Image();
		images[i].src = imgAry[i];
	}
}
window.onload = function() {
	preLoad(images_ary);
}



// 前のページへ戻る
function back() {
	history.back();
}

