try {
	if( navigator.appVersion.indexOf("MSIE 6",0) != -1) document.execCommand('BackgroundImageCache', false, true); 
} catch(e) {} 



var flag_selecter = false;
var timer_selecter;

$(document).ready(function(){
	var ua = $.browser;
	
	$("#headercontact a:not(.current)").hover(
		function () {	$(this).css({opacity:0,background:'url(./images/navi.gif) no-repeat -776px -74px'}).animate({opacity:1},{queue:false,duration:'fast'});
		},function () {	$(this).animate({opacity:0},{queue:false,duration:'fast'}); }
	);
	$("#headerdownload a:not(.current)").hover(
		function () {	$(this).css({opacity:0,background:'url(./images/navi.gif) no-repeat -833px -99px'}).animate({opacity:1},{queue:false,duration:'fast'});
		},function () {	$(this).animate({opacity:0},{queue:false,duration:'fast'}); }
	);
	$("#n01 a:not(.current)").hover(
		function () {	$(this).css({opacity:0,background:'url(./images/navi.gif) no-repeat -153px -74px'}).animate({opacity:1},{queue:false,duration:'fast'});
		},function () {	$(this).animate({opacity:0},{queue:false,duration:'fast'}); }
	);
	
	
	$("#n02 a:not(.current,#subnavi li a)").hover(
		function () {	$(this).css({opacity:0,background:'url(./images/navi.gif) no-repeat -230px -74px'}).animate({opacity:1},{queue:false,duration:'fast'});
		},function () {	$(this).animate({opacity:0},{queue:false,duration:'fast'}); }
	);
	
	$("#n03 a:not(.current)").hover(
		function () {	$(this).css({opacity:0,background:'url(./images/navi.gif) no-repeat -343px -74px'}).animate({opacity:1},{queue:false,duration:'fast'});
		},function () {	$(this).animate({opacity:0},{queue:false,duration:'fast'}); }
	);
	$("#n04 a:not(.current)").hover(
		function () {	$(this).css({opacity:0,background:'url(./images/navi.gif) no-repeat -456px -74px'}).animate({opacity:1},{queue:false,duration:'fast'});
		},function () {	$(this).animate({opacity:0},{queue:false,duration:'fast'}); }
	);
	$("#n05 a:not(.current)").hover(
		function () {	$(this).css({opacity:0,background:'url(./images/navi.gif) no-repeat -563px -74px'}).animate({opacity:1},{queue:false,duration:'fast'});
		},function () {	$(this).animate({opacity:0},{queue:false,duration:'fast'}); }
	);
	$("#n06 a:not(.current)").hover(
		function () {	$(this).css({opacity:0,background:'url(./images/navi.gif) no-repeat -667px -74px'}).animate({opacity:1},{queue:false,duration:'fast'});
		},function () {	$(this).animate({opacity:0},{queue:false,duration:'fast'}); }
	);
	
	
	$("#subnavi").hide();
	$("#n02").hover(
		function () {
			$("#subnavi").show();
			flag_selecter = true;
			selecterTimerOff();
		},
		function () { timer_selecter = setTimeout(selecterTimerOn, 320); }
	);
	
	
	$("#s01 a:not(.current)").hover(
		function () {	$(this).css({opacity:0,background:'url(./images/subnavi.gif) no-repeat -204px 0'}).animate({opacity:1},{queue:false,duration:'fast'});
		},function () {	$(this).animate({opacity:0},{queue:false,duration:'fast'}); }
	);
	$("#s02 a:not(.current)").hover(
		function () {	$(this).css({opacity:0,background:'url(./images/subnavi.gif) no-repeat -204px -31px'}).animate({opacity:1},{queue:false,duration:'fast'});
		},function () {	$(this).animate({opacity:0},{queue:false,duration:'fast'}); }
	);
	$("#s03 a:not(.current)").hover(
		function () {	$(this).css({opacity:0,background:'url(./images/subnavi.gif) no-repeat -204px -62px'}).animate({opacity:1},{queue:false,duration:'fast'});
		},function () {	$(this).animate({opacity:0},{queue:false,duration:'fast'}); }
	);
	$("#s04 a:not(.current)").hover(
		function () {	$(this).css({opacity:0,background:'url(./images/subnavi.gif) no-repeat -204px -93px'}).animate({opacity:1},{queue:false,duration:'fast'});
		},function () {	$(this).animate({opacity:0},{queue:false,duration:'fast'}); }
	);
	$("#s05 a:not(.current)").hover(
		function () {	$(this).css({opacity:0,background:'url(./images/subnavi.gif) no-repeat -204px -124px'}).animate({opacity:1},{queue:false,duration:'fast'});
		},function () {	$(this).animate({opacity:0},{queue:false,duration:'fast'}); }
	);
	
});

function selecterTimerOn() {
	if (flag_selecter){
		$("#subnavi").fadeOut("fast");
		flag_selecter = false;
	}
}
function selecterTimerOff() {
	clearTimeout(timer_selecter);
}

function SetEvents() {
	
	//クラス名から要素を取得
	this.getElementsByClassName = function(className,tagName){
		var i, j, eltClass;
		var elems = [];
		if(!tagName) tagName = '*';
		var objAll = document.getElementsByTagName(tagName);
		
		for (i = 0; i < objAll.length; i++) {
			eltClass = objAll[i].className.split(/\s+/);
			for (j = 0; j < eltClass.length; j++) {
				if (eltClass[j] == className) {
					elems.push(objAll[i]);
					break;
				}
			}
		}
		
		return elems;
	}
	
	//イベント登録
	this.addEvent = function(e, type, handler) {
		if (e.addEventListener) {
			e.addEventListener(type, handler, false);
		} else { //win ie
			e.attachEvent('on' + type, handler);
		}
	}
}


function rollover() {
	var elems = [];
	elems = setEvents.getElementsByClassName('rollover','img');
	elems = elems.concat(setEvents.getElementsByClassName('rollover','input'));
	
	var e;
	for(var i = 0, l = elems.length; i < l; i++) {
		e = elems[i];
		
		var temp = new Image();
		e.src.match(/(\.gif|\.jpg|\.png)$/);
		temp.src = e.src.replace(RegExp.$1, '-over' + RegExp.$1);
		e.onmouseover = function() {
			this.src.match(/(\.gif|\.jpg|\.png)$/);
			this.src = this.src.replace(RegExp.$1, '-over' + RegExp.$1);
		}
		e.onmouseout = function() {
			this.src.match(/(\.gif|\.jpg|\.png)$/);
			this.src = this.src.replace('-over' + RegExp.$1, RegExp.$1);
		}
	}
}

var setEvents = new SetEvents();

setEvents.addEvent ( window,'load',function() {
	rollover();
} );
