/*

=========================================
	Product Finder for Yokogawa.com Prototype
	scribed 2002.9.17 Hiroshi Tsukahara
	modified 2002.9.25 Hiroshi Tsukahra
	modified 2004.1.14 Tetsuya Komori @ YIC
=========================================

*/
// var gpath ="/cms/com/directURL.do?inPath=/yokogawa"
var gpath =""

function attachpfd() {
	document.write ('<table width="220" cellpadding="0" cellspacing="0" border="0">');
	for (i=1;i<=pfdlabels.length-1;i++) {
		with (document) {
			write ('<tr>');	
			write ('<td class="font3" id="d'+i+'bg" onMouseOver="pfdon\(\'d'+i+'\',\''+colors[i]+'\'\)" onMouseOut="pfdoff\(\'d'+i+'\',\'#FFFFFF\'\)" onClick="writesub(\'d\',\''+i+'\')" style="padding:2px 10px\; background-color:#FFFFFF"><a href="javascript:writesub(\'d\',\''+i+'\')" class="pfmenu"><span id="d'+i+'l">'+pfdlabels[i]+'<\/span><\/a><\/td>');
			write ('<td class="font3" id="d'+i+'abg" onMouseOver="pfdon\(\'d'+i+'\',\''+colors[i]+'\'\)" onMouseOut="pfdoff\(\'d'+i+'\',\'#FFFFFF\'\)" onClick="writesub(\'d\',\''+i+'\')" style="padding:2px 6px\; background-color:#FFFFFF"><a href="javascript:writesub(\'d\',\''+i+'\')" class="pfdarrow"><span id="d'+i+'a" style="font\-size:0.8em\; color:#FFFFFF">\&rarr\;<\/span><\/a><\/td>');
			write ('<\/tr>');
		}
	}
	document.write ('<\/table>');
}

function attachpfi() {
	document.write ('<table width="220" cellpadding="0" cellspacing="0" border="0">');
	for (n=1;n<=pfilabels.length-1;n++) {
		with (document) {
			write ('<tr>');	
			write ('<td class="font3" id="i'+n+'bg" onMouseOver="pfion\(\'i'+n+'\'\)" onMouseOut="pfioff\(\'i'+n+'\'\)" onClick="writesub\(\'i\',\''+n+'\'\)\;" style="padding:2px 10px\; background-color:#FFFFFF"><a href="javascript:writesub\(\'i\',\''+n+'\'\)" class="pfmenu"><span id="i'+n+'l">'+pfilabels[n]+'<\/span><\/a><\/td>');
			write ('<td class="font3" id="i'+n+'abg" onMouseOver="pfion\(\'i'+n+'\'\)" onMouseOut="pfioff\(\'i'+n+'\'\)" onClick="writesub\(\'i\',\''+n+'\'\)\;" style="padding:2px 6px\; background-color:#FFFFFF"><a href="javascript:writesub(\'i\',\''+n+'\')" class="pfdarrow"><span id="i'+n+'a" style="font\-size:0.8em\; color:#FFFFFF">\&rarr\;<\/span><\/a><\/td>');
			write ('<\/tr>');
		}
	}
	document.write ('<\/table>');
}

function attachsubboxes() {
	document.write ('<table width="219" cellpadding="0" cellspacing="0" border="0">');
	for (n=1;n<=60;n++) {
		with (document) {
			write ('<tr>');
			write ('<td class="font3" id="sub'+n+'"><\/td>');
			write ('<\/tr>');
		}
	}
	document.write ('<\/table>');
	boxes = new Array();
	for (i=1;i<=60;i++) {
		boxes[i] = document.all && document.all("sub"+i+"") || document.getElementById && document.getElementById("sub"+i+"");
	}
}

function writesub(cat,num) {
	if (document.styleSheets && (document.all || document.getElementById)) {
		var title = document.all("destination") || document.getElementById("destination");
		title.innerText = "Find Your Destination";
		for (i=1;i<=eval("sublabel"+cat+num).length-1;i++) {
			if(gpath+eval("sublabel"+cat+num)[i].url == "") {
				boxes[i].innerHTML = '<div id="sub'+i+'bg" style="'+eval("sublabel"+cat+num)[i].format+'" onMouseOver="pfsubon('+i+','+eval("sublabel"+cat+num)[i].colorcode+')" onMouseOut="pfsuboff('+i+','+eval("sublabel"+cat+num)[i].colorcode+')"><span id="sub'+i+'l"><span style="font\-size:0.8em\; color:#666666\; font\-weight:normal" id="sub'+i+'a">\&rarr\;<\/span>\&nbsp\;'+eval("sublabel"+cat+num)[i].label+'<\/span><\/div>';
			} else {
				if (eval("sublabel"+cat+num)[i].flag == 0) {
					boxes[i].innerHTML = '<div id="sub'+i+'bg" style="'+eval("sublabel"+cat+num)[i].format+'" onMouseOver="pfsubon('+i+','+eval("sublabel"+cat+num)[i].colorcode+')" onMouseOut="pfsuboff('+i+','+eval("sublabel"+cat+num)[i].colorcode+')"><a href="'+gpath+eval("sublabel"+cat+num)[i].url+'" class="pfmenu"><span id="sub'+i+'l"><span style="font\-size:0.8em\; color:#666666\; font\-weight:normal" id="sub'+i+'a">\&rarr\;<\/span>\&nbsp\;'+eval("sublabel"+cat+num)[i].label+'<\/span><\/a><\/div>';
				}
				if (eval("sublabel"+cat+num)[i].flag == 1) {
					boxes[i].innerHTML = '<div id="sub'+i+'bg" style="'+eval("sublabel"+cat+num)[i].format+'" onMouseOver="pfsubon('+i+','+eval("sublabel"+cat+num)[i].colorcode+')" onMouseOut="pfsuboff('+i+','+eval("sublabel"+cat+num)[i].colorcode+')"><a href="" onclick="window.open(\''+gpath+eval("sublabel"+cat+num)[i].url+'\');return(false)" class="pfmenu" target="_blank"><span id="sub'+i+'l"><span style="font\-size:0.8em\; color:#666666\; font\-weight:normal" id="sub'+i+'a">\&rarr\;<\/span>\&nbsp\;'+eval("sublabel"+cat+num)[i].label+'<\/span><\/a><\/div>';
				}
			}
		}
		for (i=eval("sublabel"+cat+num).length;i<=60;i++) {
			boxes[i].innerHTML = "";
		}
		if (currentmenu != "0") {
			var temp = currentmenu;
			currentmenu = cat+num;
			if (temp.indexOf("d") > 0) {
				var hex = "#FFFFFF";
				pfdoff(temp,hex);
			} else {
				pfioff(temp);
			}
		} else {
			currentmenu = cat+num;
		}
		if (cat == "d") {
			var hex = colors[num];
			pfdon(cat+num,hex);
		} else {
			pfion(cat+num);
		}
	}
}


function pfdon(name,hex) {
	if (document.styleSheets && (document.all || document.getElementById)) {
		var bg = document.all && document.all(name+"bg") || document.getElementById && document.getElementById(name+"bg");
		var label = document.all && document.all(name+"l") || document.getElementById && document.getElementById(name+"l");
		var arrow_bg = document.all && document.all(name+"abg") || document.getElementById && document.getElementById(name+"abg");
		var arrow = document.all && document.all(name+"a") || document.getElementById && document.getElementById(name+"a");
		bg.style.backgroundColor = hex;
		arrow_bg.style.backgroundColor = hex;
		label.style.color = "#FFFFFF";
		label.style.textDecoration = "none";
	}
}
function pfdoff(name,hex) {
	if (document.styleSheets && (document.all || document.getElementById)) {
		var bg = document.all && document.all(name+"bg") || document.getElementById && document.getElementById(name+"bg");
		var label = document.all && document.all(name+"l") || document.getElementById && document.getElementById(name+"l");
		var arrow_bg = document.all && document.all(name+"abg") || document.getElementById && document.getElementById(name+"abg");
		var arrow = document.all && document.all(name+"a") || document.getElementById && document.getElementById(name+"a");
		if (name != currentmenu) {
			bg.style.backgroundColor = hex;
			arrow_bg.style.backgroundColor = hex;
			label.style.color = "#333333";
			label.style.textDecoration = "none";
		}
	}
}
function pfion(name) {
	if (document.styleSheets && (document.all || document.getElementById)) {
		var bg = document.all && document.all(name+"bg") || document.getElementById && document.getElementById(name+"bg");
		var label = document.all && document.all(name+"l") || document.getElementById && document.getElementById(name+"l");
		var arrow_bg = document.all && document.all(name+"abg") || document.getElementById && document.getElementById(name+"abg");
		var arrow = document.all && document.all(name+"a") || document.getElementById && document.getElementById(name+"a");
		bg.style.backgroundColor = "#CCCCCC";
		arrow_bg.style.backgroundColor="#CCCCCC";
		label.style.color="#000000";
		label.style.textDecoration = "none";
		arrow.style.color = "#333333";
		arrow.style.textDecoration = "none";
	}
}
function pfioff(name) {
	if (document.styleSheets && (document.all || document.getElementById)) {
		var bg = document.all && document.all(name+"bg") || document.getElementById && document.getElementById(name+"bg");
		var label = document.all && document.all(name+"l") || document.getElementById && document.getElementById(name+"l");
		var arrow_bg = document.all && document.all(name+"abg") || document.getElementById && document.getElementById(name+"abg");
		var arrow = document.all && document.all(name+"a") || document.getElementById && document.getElementById(name+"a");
		if (name != currentmenu) {
				bg.style.backgroundColor = "#FFFFFF";
				arrow_bg.style.backgroundColor = "#FFFFFF";
				label.style.color="#333333";
				label.style.textDecoration = "none";
				arrow.style.color="#FFFFFF";
				arrow.style.textDecoration="none";
		}
	}
}
function pfsubon(num,colorcode) {
	if (document.styleSheets && (document.all || document.getElementById)) {
		var bg = document.all("sub"+num+"bg") || document.getElementById("sub"+num+"bg");
		var label = document.all("sub"+num+"l") || document.getElementById("sub"+num+"l");
		var arrow = document.all("sub"+num+"a") || document.getElementById("sub"+num+"a");
		bg.style.backgroundColor = colors[colorcode];
		label.style.color = "#FFFFFF";
		arrow.style.color = "#FFFFFF";
		if (currentmenu.indexOf("i") >= 0) {
			var dlabel = document.all("d"+colorcode+"l");
			dlabel.style.color = colors[colorcode];
		}
		//pfdon("d"+colorcode,colors[colorcode]);
	}
}
function pfsuboff(num,colorcode) {
	if (document.styleSheets && (document.all || document.getElementById)) {
		var bg = document.all("sub"+num+"bg") || document.getElementById("sub"+num+"bg");
		var label = document.all("sub"+num+"l") || document.getElementById("sub"+num+"l");
		var arrow = document.all("sub"+num+"a") || document.getElementById("sub"+num+"a");
		bg.style.backgroundColor = "#FFFFFF";
		label.style.color = "#333333";
		arrow.style.color = "#666666";
		pfdoff("d"+colorcode,"#FFFFFF");
	}
}

