﻿new function() {

	var blankImgURI = 'http://www.assist-ad.com/img/blank.gif';

	/* ============================================================================== colorRows - 'rowTint'
		Automatic coloured rows | Bite Size Standards
		http://bitesizestandards.com/bites/automatic-coloured-rows
	*/
	colorRows = function() {
		var myTR = document.getElementsByTagName('tr');
		for (var i=0;i<myTR.length;i++) {
			if (i%2) {
				myTR[i].className = 'rowTint';
			}
		}
	}

	/* ============================================================================== initRollovers - 'imgover'
		Standards Compliant Rollover Script
		Author : Daniel Nolan
		http://www.bleedingego.co.uk/webdev.php
	*/

	initRollovers = function() {
		if (!document.getElementById) return
	
		var aPreLoad = new Array();
		var sTempSrc;
		var aImages = document.getElementsByTagName('img');

		for (var i = 0; i < aImages.length; i++) {		
			if (aImages[i].className == 'imgover') {
				var src = aImages[i].getAttribute('src');
				var ftype = src.substring(src.lastIndexOf('.'), src.length);
				var hsrc = src.replace(ftype, '_o'+ftype);

				aImages[i].setAttribute('hsrc', hsrc);
			
				aPreLoad[i] = new Image();
				aPreLoad[i].src = hsrc;
			
				aImages[i].onmouseover = function() {
					sTempSrc = this.getAttribute('src');
					this.setAttribute('src', this.getAttribute('hsrc'));
				}	
			
				aImages[i].onmouseout = function() {
					if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
					this.setAttribute('src', sTempSrc);
				}
			}
		}
	}

	/* ============================================================================== createBlankLink - 'blankLink'
		Author : Yanagi
		Editor : Toki
		Date   : 2007-04-19
	*/
	createBlankLink = function(){
		var allLink = document.getElementsByTagName('a');
		for(i=0; i<allLink.length; i++){
			if (allLink[i].className == 'blankLink'){

				allLink[i].target = '_blank';

				var orgTitle = allLink[i].title;
				allLink[i].title = orgTitle + ' : 新しいウィンドウで開きます';
			}
		}	
	}

	/* ============================================================================== clearInputStyles
		Author : Wakasugi
		Date   : 2007-06-07

	function clearInputStyles() {
		var allInput = document.getElementsByTagName("input");
		for (i=0; i<=allInput.length; i++) {
			var checkInput = allInput[i];
			var checkType = checkInput.getAttributeNode("type").value;

			if ((checkType == "checkbox") || (checkType == "radio")) {
				checkInput.style.backgroundColor = "transparent";
				checkInput.style.border = "none";
			}
		}
	}
	*/

	function addEvent(elm,listener,fn){
		try{
			elm.addEventListener(listener,fn,false);
		}catch(e){
			elm.attachEvent("on"+listener,fn);
		}
	}

	addEvent(window,"load",colorRows);
	addEvent(window,"load",initRollovers);
	addEvent(window,"load",createBlankLink);
	//addEvent(window,"load",addlink);

} // end of new function

function hover() {
	var tagLi = document.getElementById("col-b").getElementsByTagName("li");
	for(var i=0; i<tagLi.length; i++) {
		if(tagLi[i].className == "hover") {
			if(document.documentElement.getAttribute("style")==document.documentElement.style) {
				tagLi[i].setAttribute("onmouseover",new Function("bgChange(this)"));
				tagLi[i].setAttribute("onmouseout",new Function("bgFix(this)"));
			}
			else {
				tagLi[i].setAttribute("onmouseover","bgChange(this)");
				tagLi[i].setAttribute("onmouseout","bgFix(this)");
			}
		}
	}
	
	var tagP = document.getElementById("col-b").getElementsByTagName("p");
	for(var i=0; i<tagP.length; i++) {
		if(tagP[i].className == "hover") {
			if(document.documentElement.getAttribute("style")==document.documentElement.style) {
				tagP[i].setAttribute("onmouseover",new Function("bgChange(this)"));
				tagP[i].setAttribute("onmouseout",new Function("bgFix(this)"));
			}
			else {
				tagP[i].setAttribute("onmouseover","bgChange(this)");
				tagP[i].setAttribute("onmouseout","bgFix(this)");
			}
		}
	}
	
	var tagDd = document.getElementById("col-b").getElementsByTagName("dd");
	for(var i=0; i<tagDd.length; i++) {
		if(tagDd[i].className == "hover") {
			if(document.documentElement.getAttribute("style")==document.documentElement.style) {
				tagDd[i].setAttribute("onmouseover",new Function("bgChange(this)"));
				tagDd[i].setAttribute("onmouseout",new Function("bgFix(this)"));
			}
			else {
				tagDd[i].setAttribute("onmouseover","bgChange(this)");
				tagDd[i].setAttribute("onmouseout","bgFix(this)");
			}
		}
	}
}

function bgChange(tagLi) {
	if (tagLi.getElementsByTagName("a")[0].style.filter){
		var filter = tagLi.getElementsByTagName("a")[0].style.filter;
		var filterA = filter.replace('.png",sizingMethod="scale")','_o.png",sizingMethod="scale")');
		tagLi.getElementsByTagName("a")[0].style.filter = filterA;
	}
}

function bgFix(tagLi) {
	if (tagLi.getElementsByTagName("a")[0].style.filter){
		var filter = tagLi.getElementsByTagName("a")[0].style.filter;
		var filterA = filter.replace('_o.png",sizingMethod="scale")','.png",sizingMethod="scale")');
		tagLi.getElementsByTagName("a")[0].style.filter = filterA;
	}
	var id = tagLi.id;
	var length = id.length;
	var idT = id.substr(0,length-1);
}

function screenClose (){
	document.getElementById('screen').style.display = "none";
	document.getElementById('l-hyogo').style.display = "none";
	document.getElementById('l-osaka').style.display = "none";
}

function displayDiv(local) {
	var divL = document.getElementById(local);
	var divScreen = document.getElementById("screen");
	divScreen.style.display="block";
	/*
	divL.style.display = "block";
	if(document.height){
		divL.style.width=document.width+"px";
		divL.style.height=document.height+"px";
		new Rico.Effect.FadeTo(local, 1.0, 10, 4);
	}
	else{
		divL.style.width=document.body.clientWidth+"px";
		divL.style.height=document.body.clientHeight+"px";
		new Rico.Effect.FadeTo(local, 1.0, 10, 4);
	}
	*/
	if(document.height){
		divL.style.left=(document.width-640)/2+"px";
		divScreen.style.width=document.width+"px";
		divScreen.style.height=document.height+"px";
		new Rico.Effect.FadeTo(local, 1.0, 10, 3);
		new Rico.Effect.FadeTo('screen', 1.0, 10, 3);
	}
	else{
		divL.style.left=(document.body.clientWidth-640)/2+"px";
		divScreen.style.width=document.body.clientWidth+"px";
		divScreen.style.height=document.body.clientHeight+"px";
		new Rico.Effect.FadeTo(local, 1.0, 10, 4);
		new Rico.Effect.FadeTo('screen', 0.6, 10, 4);
	}
	divL.style.display = "block";
}

function addlink() {
	if(document.getElementsByTagName("body")[0].className!=="top") {
		document.getElementById("mi03").innerHTML='<a href="http://entry.popura-k.com" title="家庭教師アルバイトぽぷら">ぽぷらで家庭教師の先生がしたい！登録はこちら</a>';
	}
}