/////////////////////////////////////////////////////////////////////
// Left Menu Settings
var g_menu = new Array();
g_menu[1] = new Array();
g_menu[1]['text'] = 'Overview';
g_menu[1][1] = new Array();
g_menu[1][1]['text'] = 'About quanp.on';
g_menu[1][1][1] = {'text' : 'Functions of quanp.on', 'no' : 1};
g_menu[1][1][2] = {'text' : 'Recommended Environment', 'no' : 2};
g_menu[1][1][3] = {'text' : 'Supported File Types', 'no' : 3};
g_menu[1][2] = new Array();
g_menu[1][2]['text'] = 'Descriptions of Screens<br /> (Before Starting to Use)';
g_menu[1][2][1] = {'text' : 'Place Map', 'no' : 4};
g_menu[1][2][2] = {'text' : 'Place View', 'no' : 5};
g_menu[1][2][3] = {'text' : 'File View', 'no' : 6};
g_menu[1][2][4] = {'text' : 'Controller', 'no' : 7};
g_menu[1][2][5] = {'text' : 'Toolbar', 'no' : 15};
g_menu[1][3] = new Array();
g_menu[1][3]['text'] = 'About Installation';
g_menu[1][3][1] = {'text' : 'Downloading quanp.on', 'no' : 8};
g_menu[1][3][2] = {'text' : 'Installing quanp.on', 'no' : 9};
g_menu[1][3][3] = {'text' : 'Uninstalling quanp.on', 'no' : 10};
g_menu[1][3][4] = {'text' : 'Confirming Version Information', 'no' : 11};
g_menu[2] = new Array();
g_menu[2]['text'] = 'Saving and Managing Files<br />-quanp memory-';
g_menu[2][1] = new Array();
g_menu[2][1]['text'] = 'How to Login';
g_menu[2][1][1] = {'text' : 'Logging In', 'no' : 1};
g_menu[2][1][2] = {'text' : 'Logging In Using Shared Computer', 'no' : 2};
g_menu[2][1][3] = {'text' : 'Using Offline', 'no' : 3};
g_menu[2][2] = new Array();
g_menu[2][2]['text'] = 'Saving Files <br />(Uploading)';
g_menu[2][2][1] = {'text' : 'Uploading by Drag & Drop', 'no' : 4};
g_menu[2][2][2] = {'text' : 'Uploading Specified Files/Folders', 'no' : 5};
g_menu[2][2][3] = {'text' : 'Uploading Files by Right-clicking in Windows', 'no' : 42};
g_menu[2][2][4] = {'text' : 'Automatic Upload', 'no' : 6};
g_menu[2][3] = new Array();
g_menu[2][3]['text'] = 'Managing Uploaded Files';
g_menu[2][3][1] = {'text' : 'Changing the File Name', 'no' : 7};
g_menu[2][3][2] = {'text' : 'Adding a Comment and Tags to a File', 'no' : 8};
g_menu[2][3][3] = {'text' : 'Printing a File', 'no' : 9};
g_menu[2][3][4] = {'text' : 'Downloading Files', 'no' : 10};
g_menu[2][3][5] = {'text' : 'Opening with the Default Application', 'no' : 11};
g_menu[2][3][6] = {'text' : 'Arranging the File Order', 'no' : 12};
g_menu[2][3][7] = {'text' : 'Copying or Moving to Place', 'no' : 13};
g_menu[2][3][8] = {'text' : 'Deleting Files', 'no' : 14};
g_menu[2][3][9] = {'text' : 'Copying, Moving, or Deleting All Files in a Place', 'no' : 15};
g_menu[2][3][10] = {'text' : 'Viewing File in Full Screen/Viewing Slideshow', 'no' : 41};
g_menu[2][7] = new Array();
g_menu[2][7]['text'] = 'Sending Files';
g_menu[2][7][1] = {'text' : 'Sending Files', 'no' : 44};
g_menu[2][7][2] = {'text' : 'Confirming the File Sending History', 'no' : 45};
g_menu[2][4] = new Array();
g_menu[2][4]['text'] = 'Searching Files';
g_menu[2][4][1] = {'text' : 'Viewing Recently Updated Files', 'no' : 16};
g_menu[2][4][2] = {'text' : 'Keyword Search', 'no' : 17};
g_menu[2][4][3] = {'text' : 'Advanced Search', 'no' : 18};
g_menu[2][4][4] = {'text' : 'Tag Search', 'no' : 43};
g_menu[2][4][5] = {'text' : 'Searching for Files with the Same Author', 'no' : 19};
g_menu[2][4][6] = {'text' : 'Searching for Files with the Same Extension', 'no' : 20};
g_menu[2][4][7] = {'text' : 'Searching for Files with the Same Tags', 'no' : 21};
g_menu[2][5] = new Array();
g_menu[2][5]['text'] = 'Managing Places and Layers';
g_menu[2][5][1] = {'text' : 'Creating a New Place', 'no' : 22};
g_menu[2][5][2] = {'text' : 'Changing the Place Properties', 'no' : 23};
g_menu[2][5][3] = {'text' : 'Moving a Place', 'no' : 24};
g_menu[2][5][4] = {'text' : 'Deleting a Place', 'no' : 25};
g_menu[2][5][5] = {'text' : 'Creating a New Layer', 'no' : 26};
g_menu[2][5][6] = {'text' : 'Changing the Layer Properties', 'no' : 27};
g_menu[2][5][7] = {'text' : 'Moving a Layer', 'no' : 28};
g_menu[2][5][8] = {'text' : 'Deleting a Layer', 'no' : 29};
g_menu[2][6] = new Array();
g_menu[2][6]['text'] = 'Configuring the Options';
g_menu[2][6][1] = {'text' : 'Configuring quanp.on', 'no' : 30};
g_menu[2][6][2] = {'text' : 'Configuring the Network Settings', 'no' : 31};
g_menu[2][6][10] = {'text' : 'Changing the Member Information', 'no' : 32};
g_menu[2][6][3] = {'text' : 'Adjusting the Window Size', 'no' : 33};
g_menu[2][6][4] = {'text' : 'Setting the Thumbnail Image', 'no' : 34};
g_menu[2][6][5] = {'text' : 'Changing the Place Background', 'no' : 35};
g_menu[2][6][6] = {'text' : 'Setting the Place Icon', 'no' : 36};
g_menu[2][6][7] = {'text' : 'Setting the User Icon', 'no' : 37};
g_menu[2][6][8] = {'text' : 'Setting the Desktop Background', 'no' : 38};
g_menu[2][6][9] = {'text' : 'Increasing the Number of Files Displayed in 3D View', 'no' : 39};
g_menu[3] = new Array();
g_menu[3]['text'] = 'Sharing Files<br />-quanp share-';
g_menu[3][1] = new Array();
g_menu[3][1]['text'] = 'Before Starting to Use';
g_menu[3][1][1] = {'text' : 'About quanp share', 'no' : 1};
g_menu[3][2] = new Array();
g_menu[3][2]['text'] = 'Managing Share Places as an Owner';
g_menu[3][2][1] = {'text' : 'Creating a Share Place', 'no' : 2};
g_menu[3][2][2] = {'text' : 'Changing the Access Permission of a Share Place', 'no' : 3};
g_menu[3][2][3] = {'text' : 'Disabling Sharing for Share Place', 'no' : 4};
g_menu[3][2][4] = {'text' : 'Deleting a Share Place', 'no' : 5};
g_menu[3][3] = new Array();
g_menu[3][3]['text'] = 'Joining Share Places as a Member';
g_menu[3][3][1] = {'text' : 'Joining a Share Place Invited to', 'no' : 6};
g_menu[3][3][3] = {'text' : 'Joining a Share Place Invited to (if you are a non-quanp user)', 'no' : 8};
g_menu[3][3][2] = {'text' : 'Unsubscribing from a Share Place Invited to', 'no' : 7};

/////////////////////////////////////////////////////////////////////
// Functions
//-------------------------------------------------------------------
// Create Menu
function writeMenu()	{
	document.write('<div style="width:246;height:40px;background-image:url(img/back_box_gr.gif);background-repeat: no-repeat; margin-bottom: 10px; padding: 4px;">');
	document.write('<table width="236" height="32"><tr><td style="background-color:#ffffff; margin: 0; padding: 0;" align="center" valign="middle">');
	document.write('<p><a href="guidebook_whatsnew.html">Changes in Latest Version (v3.00)</a></p>');
	document.write('</td></tr></table>');
	document.write('</div>');




	document.write('<hr noshade size="1" class="hidden" />');
	document.write('<div class="area-gry1-btm">');

	for (var no1 in g_menu) {
		if (no1 > 1)	{
			document.write('<div class="tp-spc15">');
		}
		document.write('<div class="bar-gry2 fl-left">');
		document.write('<div class="cn-g3p">');
		document.write('<h3 class="lrg">' + g_menu[no1]['text'] + '</h3>');
		document.write('</div>');
		document.write('</div>');
		if (no1 > 1)	{
			document.write('</div>');
		}
		document.write('<div class="clr"></div>');
		document.write('<div class="cn-g3p"><div class="tp-spc15">');
		document.write('<ul class="reg">');
		for (var no2 in g_menu[no1]) {
			if (no2 == 'text')	{
				continue;
			}
			var id = 'item_' + no1 + '_' + no2;
			if (no1 == g_no1 && no2 == g_no2)	{
				if (no2 > 1)	{
					document.write('<li class="ln1-spc3 tx-dkgry" id="' + id + '">' + g_menu[no1][no2]['text'] + '</li>');
				} else	{
					document.write('<li class="tx-dkgry" id="' + id + '">' + g_menu[no1][no2]['text'] + '</li>');
				}
			} else	{
				if (no2 > 1)	{
					document.write('<li class="ln1-spc3"><a href="#" id="' + id + '">' + g_menu[no1][no2]['text'] + '</a></li>');
				} else	{
					document.write('<li><a href="#" id="' + id + '">' + g_menu[no1][no2]['text'] + '</a></li>');
				}
			}
			document.write('<span id="' + id + '_block">');
			for (var no3 in g_menu[no1][no2]) {
				if (no3 == 'text')	{
					continue;
				}
				if (no1 == g_no1 && no2 == g_no2 && no3 == g_no3)	{
					document.write('<li class="tab-spc20 tx-gry">' + g_menu[no1][no2][no3]['text'] + '</li>');
				} else	{
					document.write('<li class="tab-spc20"><a href="guidebook_' + [no1] + '_' + g_menu[no1][no2][no3]['no'] + '.html">' + g_menu[no1][no2][no3]['text'] + '</a></li>');
				}
			}
			document.write('</span>');
		}
		document.write('</ul>');
		document.write('</div></div>');
		document.write('<div class="clr"></div>');
	}

	document.write('</div>');
}
//-------------------------------------------------------------------
// Open/Close Submenu
function showHide(e){
	var target_node;
	if (e.target) {
		target_node = e.target;
	} else {
		target_node = e.srcElement;
	}
	if (navigator.userAgent.indexOf("Safari/1", 0) >= 0 || navigator.userAgent.indexOf("Safari/3", 0) >= 0)	{
		target_node = e.target.parentNode;
	}
	var target_id = target_node.getAttribute("id") , block_id = target_id + "_block", block = document.getElementById(block_id);
	var show = target_node["s_h"];
	if (show==undefined)	{
		show=false;
	}
	if(show) {
		block.style.display = "none";
	} else {
		block.style.display = "block";
		var no_a = target_id.split("_"), no1 = no_a[1], no2 = no_a[2];
		var target_node2, block2;
		for (var n1 in g_menu) {
			for (var n2 in g_menu[n1]) {
				if (n2 == 'text' || (n1 == g_no1 && n2 == g_no2) || (n1 == no1 && n2 == no2))	{
					continue;
				}
				var id = 'item_' + n1 + '_' + n2;
				target_node2 = document.getElementById(id);
				block2 = document.getElementById(id + '_block');
				block2.style.display = "none";
				target_node2["s_h"] = false;
			}
		}
	}
	target_node["s_h"] = ! show;
}
//-------------------------------------------------------------------
// Event Settings
function setListenerSub(no1, no2) {
	var id = 'item_' + no1 + '_' + no2;
	listener_node = document.getElementById(id);
	var block_id = id + "_block", block = document.getElementById(block_id);
	if (no1 == g_no1 && no2 == g_no2)	{
		block.style.display ="block";
	} else	{
		listener_node.setAttribute("href","javascript:void(0)");
		addListener(listener_node,'click',showHide,false);
		block.style.display ="none";
	}
}

function setListeners(e) {
	for (var no1 in g_menu) {
		for (var no2 in g_menu[no1]) {
			if (no2 == 'text')	{
				continue;
			}
			setListenerSub(no1, no2);
		}
	}
}

function addListener(elem,eventType,func,cap) {
	if(elem.addEventListener) {
		elem.addEventListener(eventType,func,cap);
	} else if(elem.attachEvent) {
		elem.attachEvent('on' + eventType,func);
	} else {
		alert("NG");
		return false;
	}
}
//-------------------------------------------------------------------
// Layer Settings
function setLayer() {
	document.write("<style type='text/css'>");
	for (var n1 in g_menu) {
		for (var n2 in g_menu[n1]) {
			if (n2 == 'text')	{
				continue;
			}
			var id = '#item_' + n1 + '_' + n2 + '_block';
			if (n1 == g_no1 && n2 == g_no2)	{
				document.write(id + ' { display: block; }');
			} else	{
				document.write(id + ' { display: none; }');
			}
		}
	}
	document.write("</style>");
}

/////////////////////////////////////////////////////////////////////
// Process
//-------------------------------------------------------------------
setLayer();
addListener(window,'load',setListeners,false);
