// nvIR.js 1.0.1 / 2010-03-10
// www.synck.com

var nvIRObj = new Object();
nvIRObj.pulldown = null;

// Image Directory path
// http://www.synck.com/images/ -> /images/
nvIRObj.imageRoot = "http://www.marunamigiken.com/images/";

function nvIR_onload(){
	var d = window.document;
	var aObjects = d.getElementsByTagName("a");
	for (i=0;i<aObjects.length;i++) {
		if(aObjects[i].className == "nvIR"){
			aObjects[i].style.backgroundImage = 'url('+nvIRObj.imageRoot+aObjects[i].id+'.gif)';
			aObjects[i].style.display = "block";
			aObjects[i].style.textIndent = "-5000px";
			aObjects[i].style.height = aObjects[i].rel + "px";
			if(location.href.replace("index.html","").split(document.domain)[1] == aObjects[i].href.replace("index.html","").split(document.domain)[1])
				aObjects[i].style.backgroundPosition = "0px "+((aObjects[i].rel*2)*-1)+"px";
			else if(location.href.replace("index.html","").split(document.domain)[1] != "/" && location.href.replace("index.html","").split(document.domain)[1].indexOf(aObjects[i].href.replace("index.html","").split(document.domain)[1]) > -1)
				aObjects[i].style.backgroundPosition = "0px "+((aObjects[i].rel*2)*-1)+"px";
		}
	}
	$("a.nvIR").mouseover(function(){
		nvIR_over(this);
	});
	$("a.nvIR").mouseout(function(){
		nvIR_out(this);
	});
	$("a.nvIR").click(function(){
		nvIR_out(this);
	});
}
function nvIR_over(obj){
	var d = window.document;
	if(obj.href != location.href && location.href.replace("index.html","").split(document.domain)[1].indexOf(obj.href.replace("index.html","").split(document.domain)[1]) == -1)
		obj.style.backgroundPosition = "0px "+((obj.rel)*-1)+"px";
	if(nvIRObj.pulldown != null && nvIRObj.pulldown != obj.id && obj.id.indexOf(nvIRObj.pulldown) == -1)
		nvIR_hide_pulldown(nvIRObj.pulldown);
	if(d.getElementById("pd_"+obj.id+"_navigator")){
		nvIRObj.pulldown = obj.id;
		d.getElementById("pd_"+obj.id+"_navigator").style.display = "block";
		if(d.getElementById("pd_"+obj.id+"_background"))
			d.getElementById("pd_"+obj.id+"_background").style.display = "block";
	}
}
function nvIR_out(obj){
	if(obj.href != location.href && location.href.replace("index.html","").split(document.domain)[1].indexOf(obj.href.replace("index.html","").split(document.domain)[1]) == -1)
		obj.style.backgroundPosition = "0px 0px";
}
function nvIR_hide_pulldown(id){
	var d = window.document;
	if(d.getElementById("pd_"+id+"_navigator"))
		d.getElementById("pd_"+id+"_navigator").style.display = "none";
	if(d.getElementById("pd_"+id+"_background"))
		d.getElementById("pd_"+id+"_background").style.display = "none";
}
$(document).ready(nvIR_onload);
