/*
	Standards Compliant Rollover Script
	Author : Daniel Nolan
	http://www.bleedingego.co.uk/webdev.php
*/

function initRollovers() {
	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 == 'ro') {
			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);
			}
		}
	}
}

window.onload = initRollovers;

function showhide(id){
		if(document.getElementById){
			var objAry = new Array("stProductPoint01","stProductPoint02","stProductPoint03","stProductPoint04","stProductPoint05");
			for(var i = 0; i<objAry.length; i++){
				var tar = objAry[i];
				if(id == objAry[i]){
					document.getElementById(tar).style.display = "block";
				}else{
					document.getElementById(tar).style.display = "none";
				}
			}
		}
}

function mouseFukidasi(id,flg){
		if(document.getElementById){
			if(flg){
					document.getElementById(id).style.display = "block";
				}else{
					document.getElementById(id).style.display = "none";
				}
		}
}

function chgDepth(tar,flg,n){
	if(flg){
		tar.style.zIndex = 100;
	}else{
		tar.style.zIndex = n;
	}
}

function chgLesson(id){
		if(document.getElementById){
			var objAry = new Array("stKnowledgeLesson01","stKnowledgeLesson02");
			for(var i = 0; i<objAry.length; i++){
				var tar = objAry[i];
				if(id == objAry[i]){
					document.getElementById(tar).style.display = "block";
				}else{
					document.getElementById(tar).style.display = "none";
				}
			}
		}
}

var newWinW = 600;
var newWinH = 500;

function recipeOpen(src){
	var winName = "recipe";
	var features="location=no, menubar=no, status=no, scrollbars=yes, resizable=yes, toolbar=no";
	features += ", width="+newWinW;
	features += ", height="+newWinH;
	//window.open(src,winName,features);
	newWindow = window.open(src,winName,features);
	newWindow.focus();
}

function resizeWindow(){
	var windowWidth;
	var windowHeight;
	var rw;
	var rh;
	
	window.resizeTo(newWinW, newWinH);
	
	if (window.innerWidth && window.innerHeight) {
		/*windowWidth = window.innerWidth;
		windowHeight = window.innerHeight;*/
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
		
	} else if (document.body) {
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
		
	}
	if(windowWidth < newWinW){
		rw = newWinW + (newWinW - windowWidth);
	}else{
		rw = newWinW;
	}
	if(windowHeight < newWinH){
		rh = newWinH + (newWinH - windowHeight);
	}else{
		rh = windowHeight;
	}
	window.resizeTo(rw, rh);
}








