/*
Title : JVW 1.0 / Basis JS
Version : 1.0.1
Copyright 2010 Buchi

History
	2010/11/26 1.0.1 リリース
*/




//// Environment


/*
checkBrowser(language, browser)

	language
		en | ja
	browser
		Explorer:4 | Explorer:5 | Explorer:6 | Netscape:4 | Netscape:6 | Netscape:7 | Wazilla:1 |...

	Result
		Alert | None
*/

function checkBrowser(language, browser){

	var targetBrowser;
	var browserVersion2;

	targetBrowser = new Array();
	targetBrowser = browser.split(":");
//	browserVersion2 = getBrowserData("Version").substring(0, 1);
	browserVersion2 = parseInt(getBrowserData("Version"));

	if(targetBrowser[0] == getBrowserData("Name")){
		if(targetBrowser[1] == browserVersion2){
			if(language == "en"){
				alert(targetBrowser[0] + " " + browserVersion2 + " is not supporting.");
			}
			else if(language == "ja"){
				alert(targetBrowser[0] + " " + browserVersion2 + " はサポートしていません。");
			}
			else{
				document.write("Error > alertEnvironment > language");
			}
		}
	}
}


/*
openEnabledFile(os, browser, version, file)

	os
		All | Linux | Mac OS | Windows
	browser
		All | Explorer | Firefox | Netscape |...
	version
		(Integer)
	file
		(URL)

	Result
		Process
*/

function openEnabledFile(os, browser, version, file){
	if(os == "All" || os == getBrowserData("OS")){
		if(browser == "All" || browser == getBrowserData("Name")){
			if(version == "All" || version == getBrowserData("Version")){
				location.href = file;
			}
		}
	}
}


/*
	showEnvironment(mode);

		mode
			All | Screen | Window | Navigator | Browser

		Result
			Table
*/

function showEnvironment(mode){
	if(mode == "All"){
		showScreenEnvironment();
		showWindowEnvironment();
		showNavigatorEnvironment();
		showBrowserEnvironment();
	}
	else if(mode == "Screen"){
		showScreenEnvironment();
	}
	else if(mode == "Window"){
		showWindowEnvironment();
	}
	else if(mode == "Navigator"){
		showNavigatorEnvironment();
	}
	else if(mode == "Browser"){
		showBrowserEnvironment();
	}
	else{
		document.write("Error > showEnvironment > mode");
	}
}


/*
getBrowserData(mode)

	mode
		OS | Name | Version
//		 | Name_Version

	Result
		String
*/

function getBrowserData(mode){

	var osName = "unknown";
	var browserName = "unknown";
	var browserVersion = navigator.appVersion;

	if(navigator.platform.indexOf("Linux") >= 0){
		osName = "Linux";
	}
	else if(navigator.platform.indexOf("Mac") >= 0){
		osName = "Mac OS";
	}
	else if(navigator.platform.indexOf("Win") >= 0){
		osName = "Windows";
	}

	if(navigator.appName.indexOf("NetFront") >= 0){
		browserName = "NetFront";
		browserVersion = navigator.appVersion;
	}
	else if(navigator.appName.indexOf("Konqueror") >= 0){
		browserName = "Konqueror";
		browserVersion = navigator.userAgent.substring((navigator.userAgent.indexOf("Konqueror") + 11), (navigator.userAgent.indexOf("Konqueror") + 11) + 1); //Unchecked
	}
	else if(navigator.appName.indexOf("Opera") >= 0){
		browserName = "Opera";
		browserVersion = navigator.appVersion.substring(0, 4); //Unchecked
	}
	else if(navigator.appName.indexOf("Explorer") >= 0){
		if(navigator.userAgent.indexOf("Opera") >= 0){
			browserName = "Opera";
			browserVersion = navigator.userAgent.substring((navigator.userAgent.indexOf("Opera") + 6), (navigator.userAgent.indexOf("Opera") + 6) + 4); //Unchecked
		}
		else if(navigator.userAgent.indexOf("iCab") >= 0){
			browserName = "iCab";
			browserVersion = navigator.userAgent.substring((navigator.userAgent.indexOf("iCab") + 7), (navigator.userAgent.indexOf("iCab") + 7) + 5); //Unchecked
		}
		else{
			browserName = "Explorer";
			browserVersion = navigator.userAgent.substring((navigator.userAgent.indexOf("MSIE") + 5), (navigator.userAgent.indexOf("MSIE") + 5) + 3); //Unchecked
		}
	}
	else if(navigator.appName.indexOf("Netscape") >= 0){
		if(navigator.userAgent.indexOf("Opera") >= 0){
			browserName = "Opera";
			browserVersion = navigator.userAgent.substring((navigator.userAgent.indexOf("Opera") + 6), (navigator.userAgent.indexOf("Opera") + 6) + 4); //Checked
		}
		else if(navigator.userAgent.indexOf("Firefox") >= 0){
			browserName = "Firefox";
			browserVersion = navigator.userAgent.substring((navigator.userAgent.indexOf("Firefox") + 8), (navigator.userAgent.indexOf("Firefox") + 8) + 3); //Unchecked
		}
		else if(navigator.userAgent.indexOf("wazilla") >= 0){
			browserName = "Wazilla";
			browserVersion = navigator.userAgent.substring((navigator.userAgent.indexOf("rv") + 3), (navigator.userAgent.indexOf("rv") + 3) + 3); //Checked
		}
		else if(navigator.userAgent.indexOf("Shiira") >= 0){
			browserName = "Shiira";
			browserVersion = "unknown"; //Unchecked
		}
		else if(navigator.userAgent.indexOf("Safari") >= 0){
			if(navigator.userAgent.indexOf("Shiira") >= 0){
				browserName = "Shiira";
				browserVersion = navigator.userAgent.substring((navigator.userAgent.indexOf("Shiira") + 7), (navigator.userAgent.indexOf("Shiira") + 7) + 5); //Unchecked
			}
			else{
				browserName = "Safari";
				browserVersion = "unknown"; //Unchecked
			}
		}
		else if(navigator.userAgent.indexOf("Chimera") >= 0){
			browserName = "Chimera";
			browserVersion = navigator.userAgent.substring((navigator.userAgent.indexOf("Chimera") + 8), (navigator.userAgent.indexOf("Chimera") + 8) + 3); //Unchecked
		}
		else if(navigator.userAgent.indexOf("DreamPassport") >= 0){
			browserName = "DreamPassport";
			browserVersion = navigator.userAgent.substring((navigator.userAgent.indexOf("DreamPassport") + 14), (navigator.userAgent.indexOf("DreamPassport") + 14) + 3); //Unchecked
		}
		else{
			browserName = "Netscape";
//			browserVersion = navigator.userAgent.substring((navigator.userAgent.indexOf("Netscape") + 8), (navigator.userAgent.indexOf("Netscape") + 8) + 5); //Unchecked
			if(navigator.appVersion.substring(0, 3) == "5.0"){
				if(navigator.userAgent.substring((navigator.userAgent.indexOf("Netscape") + 8), (navigator.userAgent.indexOf("Netscape") + 8) + 1) == 6){
					browserVersion = navigator.userAgent.substring((navigator.userAgent.indexOf("Netscape") + 10), (navigator.userAgent.indexOf("Netscape") + 10) + 5); //Unchecked
				}
				else if(navigator.userAgent.substring((navigator.userAgent.indexOf("Netscape") + 9), (navigator.userAgent.indexOf("Netscape") + 9) + 1) == 7){
					browserVersion = navigator.userAgent.substring((navigator.userAgent.indexOf("Netscape") + 9), (navigator.userAgent.indexOf("Netscape") + 9) + 4); //Unchecked
				}
				
			}
			else{
				browserVersion = navigator.appVersion.substring(0, 4);
			}
		}
	}
	else{
		browserName = "unknown";
	}
	if(mode == "OS"){
		return osName;
	}
	else if(mode == "Name"){
		return browserName;
	}
	else if(mode == "Version"){
		return browserVersion;
	}
/*
	else if(mode == "Name_Version"){
		return browserName + " " + browserVersion;
	}
*/
	else{
		document.write("Error > getBrowserData > mode");
	}
}


/*
showScreenEnvironment()

	Result
		P, Table
*/

function showScreenEnvironment(){
	document.writeln("<p><span class=\"strong\">Screen Environment<\/span><\/p>");
	document.writeln("<table summary=\"Screen Environment\">");
	document.writeln("	<tr>");
	document.writeln("		<td>Width<\/td>");
	document.writeln("		<td>(E4, N4)<\/td>");
	document.writeln("		<td>" + screen.width + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Height<\/td>");
	document.writeln("		<td>(E4, N4)<\/td>");
	document.writeln("		<td>" + screen.height + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Avail Width<\/td>");
	document.writeln("		<td>((E5), N4)<\/td>");
	document.writeln("		<td>" + screen.availWidth + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Avail Height<\/td>");
	document.writeln("		<td>((E5), N4)<\/td>");
	document.writeln("		<td>" + screen.availHeight + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Color Depth<\/td>");
	document.writeln("		<td>(E4, N4)<\/td>");
	document.writeln("		<td>" + screen.colorDepth + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Pixel Dept<\/td>");
	document.writeln("		<td>(N4)<\/td>");
	document.writeln("		<td>" + screen.pixelDepth + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Buffer Depth<\/td>");
	document.writeln("		<td>(E4)<\/td>");
	document.writeln("		<td>" + screen.bufferDepth + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Update Interval<\/td>");
	document.writeln("		<td>(E4)<\/td>");
	document.writeln("		<td>" + screen.updateInterval + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("<\/table>");
}


/*
showWindowEnvironment()

	Result
		P, Table
*/

function showWindowEnvironment(){
	document.writeln("<p><span class=\"strong\">Window Environment<\/span><\/p>");
	document.writeln("<table summary=\"Window Environment\">");
	document.writeln("	<tr>");
	document.writeln("		<td>Inner Width<\/td>");
	document.writeln("		<td>(N4)<\/td>");
	document.writeln("		<td>" + window.innerWidth + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Inner Height<\/td>");
	document.writeln("		<td>(N4)<\/td>");
	document.writeln("		<td>" + window.innerHeight + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Outer Width<\/td>");
	document.writeln("		<td>(N4)<\/td>");
	document.writeln("		<td>" + window.outerWidth + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Outer Height<\/td>");
	document.writeln("		<td>(N4)<\/td>");
	document.writeln("		<td>" + window.outerHeight + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Page X Offset<\/td>");
	document.writeln("		<td>(N4)<\/td>");
	document.writeln("		<td>" + window.pageXOffset + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Page Y Offset<\/td>");
	document.writeln("		<td>(N4)<\/td>");
	document.writeln("		<td>" + window.pageYOffset + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("<\/table>");
}


/*
showNavigatorEnvironment()

	Result
		P, Table
*/

function showNavigatorEnvironment(){
	document.writeln("<p><span class=\"strong\">Navigator Environment<\/span><\/p>");
	document.writeln("<table summary=\"Navigator Environment\">");
	document.writeln("	<tr>");
	document.writeln("		<td>User Agent<\/td>");
	document.writeln("		<td>(E3, N2)<\/td>");
	document.writeln("		<td>" + navigator.userAgent + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>App Code Name<\/td>");
	document.writeln("		<td>(E3, N2)<\/td>");
	document.writeln("		<td>" + navigator.appCodeName + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>App Name<\/td>");
	document.writeln("		<td>(E3, N2)<\/td>");
	document.writeln("		<td>" + navigator.appName + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>App Version<\/td>");
	document.writeln("		<td>(E3, N2)<\/td>");
	document.writeln("		<td>" + navigator.appVersion + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>App Minor Version<\/td>");
	document.writeln("		<td>(E4)<\/td>");
	document.writeln("		<td>" + navigator.appMinorVersion + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Platform<\/td>");
	document.writeln("		<td>(E4, N4)<\/td>");
	document.writeln("		<td>" + navigator.platform + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>CPU Class<\/td>");
	document.writeln("		<td>(E4)<\/td>");
	document.writeln("		<td>" + navigator.cpuClass + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Language<\/td>");
	document.writeln("		<td>(N4)<\/td>");
	document.writeln("		<td>" + navigator.language + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Browser Language<\/td>");
	document.writeln("		<td>(E4)<\/td>");
	document.writeln("		<td>" + navigator.browserLanguage + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>System Language<\/td>");
	document.writeln("		<td>(E4)<\/td>");
	document.writeln("		<td>" + navigator.systemLanguage + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>User Language<\/td>");
	document.writeln("		<td>(E4)<\/td>");
	document.writeln("		<td>" + navigator.userLanguage + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Cookie Enabled<\/td>");
	document.writeln("		<td>(E4, (N6))<\/td>");
	document.writeln("		<td>" + navigator.cookieEnabled + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Java Enabled<\/td>");
	document.writeln("		<td>(E4, N3)<\/td>");
	document.writeln("		<td>" + navigator.javaEnabled() + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Taint Enabled<\/td>");
	document.writeln("		<td>(E4, N3)<\/td>");
	document.writeln("		<td>" + navigator.taintEnabled() + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Online<\/td>");
	document.writeln("		<td>(E4)<\/td>");
	document.writeln("		<td>" + navigator.onLine + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("<\/table>");
	document.writeln("<table summary=\"Plug-in Environment\">");
	document.writeln("	<tr>");
	document.writeln("		<th>Type (N3)<\/th>");
	document.writeln("		<th>File Name (N3)<\/th>");
	document.writeln("		<th>Suffixes (N3)<\/th>");
	document.writeln("		<th>Description (N3)<\/th>");
	document.writeln("		<th>Enabled (N3)<\/th>");
	document.writeln("	<\/tr>");
	for(i = 0; i < navigator.plugins.length; i++){
		document.writeln("	<tr>");
		document.writeln("		<td>" + navigator.mimeTypes[i].type + "<\/td>");
		document.writeln("		<td>" + navigator.plugins[i].filename + "<\/td>");
		document.writeln("		<td>" + navigator.mimeTypes[i].suffixes + "<\/td>");
		document.writeln("		<td>" + navigator.mimeTypes[i].description + "<\/td>");
		if(navigator.mimeTypes[i].enabledPlugin){pluginEnabled = "true";}
		else{pluginEnabled = "false";}
		document.writeln("		<td>" + pluginEnabled + "<\/td>");
		document.writeln("	<\/tr>");
	}
	document.writeln("<\/table>");
}


/*
showBrowserEnvironment()

	Result
		P, Table
*/

function showBrowserEnvironment(){
	document.writeln("<p><span class=\"strong\">Browser Environment<\/span><\/p>");
	document.writeln("<table summary=\"Browser Environment\">");
	document.writeln("	<tr>");
	document.writeln("		<td>OS Name<\/td>");
	document.writeln("		<td>" + getBrowserData("OS") + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Browser Name<\/td>");
	document.writeln("		<td>" + getBrowserData("Name") + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("	<tr>");
	document.writeln("		<td>Browser Version<\/td>");
	document.writeln("		<td>" + getBrowserData("Version") + "<\/td>");
	document.writeln("	<\/tr>");
	document.writeln("<\/table>");
}




////Window


/*
openWindow(mode, file, name, size, width, height)

	mode
		Normal | Moment
	file
		(URL)
	name
		(String)
	size
		Auto | Preset01 | Preset02 | Preset03 | Preset11 | Prese12 | Preset13 | Preset14 | Preset21 | Prese22 | Preset23 | Specify
	width
		size == Specify
			(Integer)
	height
		size == Specify
			(Integer)

	Result
		Window
*/


function openWindow(mode, file, name, size, width, height){
	if(mode == "Normal"){
		if(size == "Auto"){
			window.open(file, name, "menubar=1, toolbar=1, location=1, directories=1, scrollbars=1, status=1, resizable=1")
		}
		else if(size == "Preset01"){
			window.open(file, name, "width=320, height=320, menubar=1, toolbar=1, location=1, directories=1, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset02"){
			window.open(file, name, "width=480, height=480, menubar=1, toolbar=1, location=1, directories=1, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset03"){
			window.open(file, name, "width=640, height=640, menubar=1, toolbar=1, location=1, directories=1, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset11"){
			window.open(file, name, "width=320, height=240, menubar=1, toolbar=1, location=1, directories=1, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset12"){
			window.open(file, name, "width=480, height=360, menubar=1, toolbar=1, location=1, directories=1, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset13"){
			window.open(file, name, "width=640, height=480, menubar=1, toolbar=1, location=1, directories=1, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset14"){
			window.open(file, name, "width=800, height=600, menubar=1, toolbar=1, location=1, directories=1, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset21"){
			window.open(file, name, "width=240, height=320, menubar=1, toolbar=1, location=1, directories=1, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset22"){
			window.open(file, name, "width=360, height=480, menubar=1, toolbar=1, location=1, directories=1, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset23"){
			window.open(file, name, "width=480, height=640, menubar=1, toolbar=1, location=1, directories=1, scrollbars=1, status=1, resizable=1");
		}
//		else if(size == "Specify"){
//			window.open(file, name, "menubar=1, toolbar=1, location=1, directories=1, scrollbars=1, status=1, resizable=1");
//			window.resizeTo(width, height);
//		}
		else{
			document.write("Error > openWindow > size");
		}
	}
	else if(mode == "Moment"){
		if(size == "Auto"){
			window.open(file, name, "menubar=0, toolbar=1, location=0, directories=0, scrollbars=1, status=1, resizable=1")
		}
		else if(size == "Preset01"){
			window.open(file, name, "width=320, height=320, menubar=0, toolbar=1, location=0, directories=0, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset02"){
			window.open(file, name, "width=480, height=480, menubar=0, toolbar=1, location=0, directories=0, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset03"){
			window.open(file, name, "width=640, height=640, menubar=0, toolbar=1, location=0, directories=0, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset11"){
			window.open(file, name, "width=320, height=240, menubar=0, toolbar=1, location=0, directories=0, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset12"){
			window.open(file, name, "width=480, height=360, menubar=0, toolbar=1, location=0, directories=0, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset13"){
			window.open(file, name, "width=640, height=480, menubar=0, toolbar=1, location=0, directories=0, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset14"){
			window.open(file, name, "width=800, height=600, menubar=0, toolbar=1, location=0, directories=0, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset21"){
			window.open(file, name, "width=240, height=320, menubar=0, toolbar=1, location=0, directories=0, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset22"){
			window.open(file, name, "width=360, height=480, menubar=0, toolbar=1, location=0, directories=0, scrollbars=1, status=1, resizable=1");
		}
		else if(size == "Preset23"){
			window.open(file, name, "width=480, height=640, menubar=0, toolbar=1, location=0, directories=0, scrollbars=1, status=1, resizable=1");
		}
//		else if(size == "Specify"){
//			window.open(file, name, "menubar=0, toolbar=1, location=0, directories=0, scrollbars=1, status=1, resizable=1");
//			window.resizeTo(width, height);
//		}
		else{
			document.write("Error > openWindow > size");
		}
	}
	else{
		document.write("Error > openWindow > mode");
	}
}


/*
setWindow(language, mode, confirm, xposition, yposition, width, height)

	language
		en | ja
	mode
		P(Position) | S(Size) | P_S(Position, Size) | C(Close)
	confirm,
		OFF | ON
	xposition
		mode == P || mode == P_S
			(Integer)
	ypositionY
		mode == P || mode == P_S
			(Integer)
	width
		mode == S || mode == P_S
			(Integer)
	height
		mode == S || mode == P_S
			(Integer)

	Result
		confirm == OFF
			Process()
		confirm == ON
			Confirm - Process(confirm == OK)
*/

function setWindow(language, mode, confirm, xposition, yposition, width, height){
	if(mode == "P"){
		setWindowPosition(language, confirm, xposition, yposition);
	}
	else if(mode == "S"){
		setWindowSize(language, confirm, width, height);
	}
	else if(mode == "P_S"){
		setWindowPositionAndSize(language, confirm, xposition, yposition, width, height);
	}
	else if(mode == "C"){
		closeWindow(language, confirm);
	}
	else{
		document.write("Error > setWindow > mode");
	}
}


/*
setWindowPosition(language, confirm, xposition, yposition)

	language
		en | ja
	confirm,
		OFF | ON
	xposition
		(Integer)
	ypositionY
		(Integer)

	Result
		confirm == OFF
			Process()
		confirm == ON
			Confirm - Process(confirm == OK)
*/

function setWindowPosition(language, confirm, xposition, yposition){

	var message;

	if(confirm == "ON"){
		if(language == "en"){
			message = "A window is moved to " + xposition + ", " + yposition + ".";
		}
		else if(language == "ja"){
			message = "ウィンドウを" + xposition + ", " + yposition + "に移動します。";
		}
		else{
			document.write("Error > setWindowPosition > language");
		}
		if(window.confirm(message)){
			window.moveTo(xposition, yposition);
		}
	}
	else{
		window.moveTo(xposition, yposition);
	}

}


/*
setWindowSize(language, confirm, width, height)

	language
		en | ja
	confirm,
		OFF | ON
	width
		(Integer)
	height
		(Integer)

	Result
		confirm == OFF
			Process
		confirm == ON
			Confirm - Process(confirm == OK)
*/

function setWindowSize(language, confirm, width, height){

	var message;

	if(confirm == "ON"){
		if(language == "en"){
			message = "A window is resized to " + width + ", " + height + ".";
		}
		else if(language == "ja"){
			message = "ウィンドウを" + width + ", " + height + "にリサイズします。";
		}
		else{
			document.write("Error > setWindowSize > language");
		}
		if(window.confirm(message)){
			window.resizeTo(width, height);
		}
	}
	else{
		window.resizeTo(width, height);
	}

}


/*
setWindowPositionAndSize(language, confirm, xposition, yposition, width, height)

	language
		en | ja
	confirm
		OFF | ON
	xposition
		(Integer)
	ypositionY
		(Integer)
	width
		(Integer)
	height
		(Integer)

	Result
		confirm == OFF
			Process
		confirm == ON
			Confirm - Process(confirm == OK)
*/

function setWindowPositionAndSize(language, confirm, xposition, yposition, width, height){

	var message;

	if(confirm == "ON"){
		if(language == "en"){
			message = "A window is moved to " + xposition + ", " + yposition + ", resize to " + width + ", " + height + ".";
		}
		else if(language == "ja"){
			message = "ウィンドウを" + xposition + ", " + yposition + "に移動し、" + width + ", " + height + "にリサイズします。";
		}
		else{
			document.write("Error > setWindowPositionAndSize > language");
		}
		if(window.confirm(message)){
			window.moveTo(xposition, yposition);
			window.resizeTo(width, height);
		}
	}
	else{
		window.moveTo(xposition, yposition);
		window.resizeTo(width, height);
	}

}


/*
closeWindow(language, confirm)

	language
		en | ja
	confirm,
		OFF | ON

	Result
		confirm == OFF
			Process
		confirm == ON
			Confirm - Process(confirm == OK)
*/

function closeWindow(language, confirm){

	var message;

	if(confirm == "ON"){
		if(language == "en"){
			message = "A window is closed.";
		}
		else if(language == "ja"){
			message = "ウィンドウを閉じます。";
		}
		else{
			document.write("Error > closeWindow > language");
		}
		if(window.confirm(message)){
			window.close();
		}
	}
	else{
		window.close();
	}
	
}




////File


/*
preloadImage()

	files
		(FileName1,FileName2,...)
	rank
		(Integer)

	Result
		Process
*/

function preloadImage(files, rank){

	var rank2;
	var files2;
	var images;

	if(rank == 0){
		rank2 = "./";
	}
	else{
		 rank2 = "";
		for(i = 0; i < rank; i = i + 1){
			rank2 = rank2 + "../"
		}
	}
	files2 = new Array();
	files2 = files.split(",");
	images = new Array(files2.length);
	for(i = 0; i < files2.length; i = i + 1){
		images[i] = new Image();
		images[i].src = rank2 + files[i];
	}
}


/*
showUpdateDate(language, mode, since)

	language
		en | ja
	mode
		UD(UpdateDate) | UD_UT(UpdateDate, UpdateTime) | SD_UD(SinceDate, UpdateDate) | SD_UD_UT(SinceDate, UpdateDate, UpdateTime)
	dinceDate
		(YYYYMMDD)

	Result
		String
*/

function showUpdateDate(language, mode, since){

	var sinceYear;
	var sinceMonth;
	var sinceDate;
	var update;
	var updateYear;
	var updateMonth;
	var updateDate;
	var updateHours;
	var updateMinutes;
	var updateSeconds;

	//Since
	if(mode == "SD_UD_UT" | mode == "SD_UD"){
		sinceYear = since.substring(0, 4);
		sinceMonth = since.substring(4, 6);
		sinceDate = since.substring(6, 8);
		if(language == "en"){
			if(sinceMonth == "01"){sinceMonth = "January";}
			else if(sinceMonth == "02"){sinceMonth = "February";}
			else if(sinceMonth == "03"){sinceMonth = "March";}
			else if(sinceMonth == "04"){sinceMonth = "April";}
			else if(sinceMonth == "05"){sinceMonth = "May";}
			else if(sinceMonth == "06"){sinceMonth = "June";}
			else if(sinceMonth == "07"){sinceMonth = "July";}
			else if(sinceMonth == "08"){sinceMonth = "August";}
			else if(sinceMonth == "09"){sinceMonth = "September";}
			else if(sinceMonth == "10"){sinceMonth = "October";}
			else if(sinceMonth == "11"){sinceMonth = "November";}
			else if(sinceMonth == "12"){sinceMonth = "December";}
		}
	}
	//Update
	update = new Date(document.lastModified);
	updateYear = update.getYear();
	updateMonth = update.getMonth() + 1;
	updateDate = update.getDate();
	updateHours = update.getHours();
	updateMinutes = update.getMinutes();
	updateSeconds  = update.getSeconds();
	if(updateYear < 2000){updateYear = updateYear + 1900;}
	if(updateYear < 1950){updateYear = updateYear + 100;}
	if(updateYear != 1970){
		if(navigator.userAgent.indexOf("Mac") >= 0){
			if(navigator.appName.indexOf("Explorer") >= 0){
				updateHours = updateHours - 9;
				if(updateHours == -1){updateHours = 23; updateDate = updateDate - 1;}
				else if(updateHours == -2){updateHours = 22; updateDate = updateDate - 1;}
				else if(updateHours == -3){updateHours = 21; updateDate = updateDate - 1;}
				else if(updateHours == -4){updateHours = 20; updateDate = updateDate - 1;}
				else if(updateHours == -5){updateHours = 19; updateDate = updateDate - 1;}
				else if(updateHours == -6){updateHours = 18; updateDate = updateDate - 1;}
				else if(updateHours == -7){updateHours = 17; updateDate = updateDate - 1;}
				else if(updateHours == -8){updateHours = 16; updateDate = updateDate - 1;}
				else if(updateHours == -9){updateHours = 15; updateDate = updateDate - 1;}
			}
		}
//		if(updateHours >= 24){
//			updateHours = updateHours - 24;
//			updateDate = updateDate + 1;
//		}
		if(updateMonth < 10){updateMonth = "0" + updateMonth;}
		if(updateDate < 10){updateDate = "0" + updateDate;}
		if(updateHours < 10){updateHours = "0" + updateHours;}
		if(updateMinutes < 10){updateMinutes = "0" + updateMinutes;}
		if(updateSeconds < 10){updateSeconds = "0" + updateSeconds;}
		if(language == "en"){
			if(updateMonth == "01"){updateMonth = "January";}
			else if(updateMonth == "02"){updateMonth = "February";}
			else if(updateMonth == "03"){updateMonth = "March";}
			else if(updateMonth == "04"){updateMonth = "April";}
			else if(updateMonth == "05"){updateMonth = "May";}
			else if(updateMonth == "06"){updateMonth = "June";}
			else if(updateMonth == "07"){updateMonth = "July";}
			else if(updateMonth == "08"){updateMonth = "August";}
			else if(updateMonth == "09"){updateMonth = "September";}
			else if(updateMonth == "10"){updateMonth = "October";}
			else if(updateMonth == "11"){updateMonth = "November";}
			else if(updateMonth == "12"){updateMonth = "December";}
		}
	}
	else{
		updateYear = '????';
		updateMonth = '??';
		updateDate = '??';
		updateHours = '??';
		updateMinutes = '??';
		updateSeconds  = '??';
	}
	//Show
	if(language == "en"){
		if(mode == "UD"){
			document.write(" Update " + updateDate + "." + updateMonth + "." + updateYear);
		}
		else if(mode == "UD_UT"){
			document.write(" Update " + updateDate + "." + updateMonth + "." + updateYear);
			document.write(" " + updateHours + ":" + updateMinutes + ":" + updateSeconds);
		}
		else if(mode == "SD_UD"){
			document.write("Since " + sinceDate + "." + sinceMonth + "." + sinceYear);
			document.write(" Update " + updateDate + "." + updateMonth + "." + updateYear);
		}
		else if(mode == "SD_UD_UT"){
			document.write("Since " + sinceDate + "." + sinceMonth + "." + sinceYear);
			document.write(" Update " + updateDate + "." + updateMonth + "." + updateYear);
			document.write(" " + updateHours + ":" + updateMinutes + ":" + updateSeconds);
		}
		document.write("\n");
	}
	else if(language == "ja"){
		if(mode == "UD"){
			document.write(" 更新 " + updateYear + "/" + updateMonth + "/" + updateDate);
		}
		else if(mode == "UD_UT"){
			document.write(" 更新 " + updateYear + "/" + updateMonth + "/" + updateDate);
			document.write(" " + updateHours + ":" + updateMinutes + ":" + updateSeconds);
		}
		else if(mode == "SD_UD"){
			document.write("開設 " + sinceYear + "/" + sinceMonth + "/" + sinceDate);
			document.write(" 更新 " + updateYear + "/" + updateMonth + "/" + updateDate);
		}
		else if(mode == "SD_UD_UT"){
			document.write("開設 " + sinceYear + "/" + sinceMonth + "/" + sinceDate);
			document.write(" 更新 " + updateYear + "/" + updateMonth + "/" + updateDate);
			document.write(" " + updateHours + ":" + updateMinutes + ":" + updateSeconds);
		}
		document.write("\n");
	}
	else{
		document.write("Error > showUpdateDate > language");
	}
}




////Other


/*
addFavorite(language, confirm, url, title)

	language
		en | ja
	confirm
		OFF | ON
	url
		(URL)
	title
		(String)

	Result
		confirm == OFF
			Prosess(Browser == IE) | Alert(Browser != IE)
		confirm == ON
			Confirm(Browser == IE) - Process(confirm == OK) | Alert(Browser != IE)
*/

function addFavorite(language, confirm, url, title){

	var massage;

	if((navigator.userAgent.indexOf("MSIE") >= 0) && (navigator.userAgent.indexOf("Windows") >= 0)){
		if(confirm == "ON"){
			if(language == "en"){
				message = "Do you add it in the favorite?";
			}
			else if(language == "ja"){
				message = "お気に入りに追加しますか？";
			}
			else{
				document.write("Error > addFavorite > language");
			}
			if(window.confirm(message)){
				window.external.addFavorite(url, title);
			}
		}
		else{
			window.external.addFavorite(url, title);
		}
	}
	else{
		if(language == "en"){
			message = "Please use by Internet Explorer of the Windows version.";
		}
		else if(language == "ja"){
			message = "Windows版のInternet Explorerで利用してください。";
		}
		else{
			document.write("Error > addFavorite > language");
		}
		alert(message);
	}

}


/*
showCSSForm(language, mode, csss, defaultTitle, rank, cookieName, cookiePath, cookieLife, accessKey, tabIndex)

	language
		en | ja
	mode
		Form | Button | Hidden
	csss
		(Name1):css-bin/(FileName1),(Name2):css-bin/(FileName2),...
	defaultTitle
		(String)
	rank
		(Integer)
	cookieName
		(String)
	cookiePath
		(URL)
	cookieLife
		(Integer(Days)) 
	AccessKey
		(Char)
	TabIndex
		(Integer)

	Result
		Form
*/

function showCSSForm(language, mode, csss, defaultTitle, rank, cookieName, cookiePath, cookieLife, accessKey, tabIndex){

	var selectFieldLabel;
	var selectedCSSIndex;
	var cssDatas;
	var cssDatas2;
	var cssTitles;
	var cssFiles;
	var cookieValue;
	var cookieCSSData;
	var cookieCSSTitle;
	var cookieCSSFile;

	cssDatas = new Array();
	cssDatas2 = new Array();
	cssTitles = new Array();
	cssFiles = new Array();
	cssDatas = csss.split(",");
	for(i = 0; i < cssDatas.length; i++){
		cssDatas2 = cssDatas[i].split(":");
		cssTitles[i] = cssDatas2[0];
		cssFiles[i] = cssDatas2[1];
	}
	if(language == "en"){
		selectFieldLabel = "Theme";
	}
	else if(language == "ja"){
		selectFieldLabel = "テーマ";
	}
	else{
		document.write("Error > showCSSForm > language");
	}
	if(document.cookie){
		cookieValue = getCookie(cookieName);
		if(cookieValue != null){
			cookieCSSData = new Array();
			cookieCSSData = cookieValue.split(":");
			cookieCSSTitle = cookieCSSData[0];
			cookieCSSFile = cookieCSSData[1];
		}
		else{
			cookieCSSTitle = defaultTitle;
			cookieCSSFile = "";
		}
	}
	else{
		cookieCSSTitle = defaultTitle;
		cookieCSSFile = "";
	}
	selectedCSSIndex = "";
	if(mode != "Hidden"){
		document.writeln("<form>");
		document.writeln("	<div>");
	}
	if(mode == "Form"){
		document.writeln("		<label for=\"CSSField\">" + selectFieldLabel + "<\/label>");
		document.writeln("		<select name=\"CSSField\" id=\"CSSField\" accesskey=\"" + accessKey + "\" tabindex=\"" + tabIndex + "\" onchange=\"updateCSSFromSelect('" + csss + "', '" + rank + "', '" + cookieName + "', '" + cookiePath + "', '" + cookieLife + "')\">");
		for(i = 0; i < cssDatas.length; i++){
			document.writeln("			<option value=\"" + i + "\">" + cssTitles[i] + "<\/option>");
			if(cssTitles[i] == cookieCSSTitle){
				selectedCSSIndex = i;
			}
		}
		document.writeln("		<\/select>[" + accessKey + "]");
		if(selectedCSSIndex != ""){
			document.getElementById("CSSField").selectedIndex = selectedCSSIndex;
		}
	}
	else if(mode == "Button"){
		for(i = 0; i < cssDatas.length; i++){
			document.writeln("		<input type=\"button\" value=\"" + cssTitles[i] + "\" onclick=\"updateCSS('" + cssTitles[i] + "', '" + cssFiles[i] + "', '" + rank + "', '" + cookieName + "', '" + cookiePath + "', '" + cookieLife + "')\" class=\"button\" style=\"width:96px\"/><br />");
			if(cssTitles[i] == cookieCSSTitle){
				selectedCSSIndex = i;
			}
		}
	}
	else if(mode == "Hidden"){
		
	}
	else{
		document.write("Error > showCSSForm > mode");
	}
	if(mode != "Hidden"){
		document.writeln("	<\/div>");
		document.writeln("<\/form>");
	}
	if(cookieValue != null){
		updateCSSFromCookie(cookieCSSTitle, cookieCSSFile, rank);
	}

}


function updateCSSFromCookie(title, file, rank){

	var rank2;
	var currentCSSs;

	if(rank == 0){
		rank2 = "./";
	}
	else{
		 rank2 = "";
		for(i = 0; i < rank; i = i + 1){
			rank2 = rank2 + "../"
		}
	}
	currentCSSs = document.getElementsByTagName("link");
	for(i = 0; i < currentCSSs.length; i++){
		if(currentCSSs[i].type == "text/css"){
			currentCSSs[i].href = rank2 + file;
//			currentCSSs[i].title = title;
			break;
		}
	}

}


function updateCSSFromSelect(csss, rank, cookieName, cookiePath, cookieLife){

	var datas;
	var datas2;
	var titles;
	var files;
	var title;
	var file;

	datas = new Array();
	datas2 = new Array();
	titles = new Array();
	files = new Array();
	datas = csss.split(",");
	for(i = 0; i < datas.length; i++){
		datas2 = datas[i].split(":");
		titles[i] = datas2[0];
		files[i] = datas2[1];
	}
	title = titles[parseInt(document.getElementById("CSSField").value)];
	file = files[parseInt(document.getElementById("CSSField").value)];
	updateCSS(title, file, rank, cookieName, cookiePath, cookieLife);

}


function updateCSS(title, file, rank, cookieName, cookiePath, cookieLife){

	var rank2;
	var cookieValue;
	var currentCSSs;

	if(rank == 0){
		rank2 = "./";
	}
	else{
		 rank2 = "";
		for(i = 0; i < rank; i = i + 1){
			rank2 = rank2 + "../"
		}
	}
	currentCSSs = document.getElementsByTagName("link");
	for(i = 0; i < currentCSSs.length; i++){
		if(currentCSSs[i].type == "text/css"){
			currentCSSs[i].href = rank2 + file;
//			currentCSSs[i].title = title;
			break;
		}
	}
	cookieValue = title + ":" + file;
	setCookie(cookieName, cookieValue, cookiePath, cookieLife);

}


/*
updateData(mode, target, data, rank)

	mode
		Text | InputValue | TextAreaValue | Image | LoadImage | HourImage | Select
	target
		mode == Text | Image | LoadImage | HourImage
			(Object.id)
		mode == InputValue
			(Form.id:InputField.id) | (-:InputField.id)
		mode == TextAreaValue
			(Form.id:TextArea.id) | (-:TextArea.id)
		mode == Select
			(Object.id),(Select.id)
	data
		mode == Text | InputValue | TextAreaValue
			(String)
		mode == Image | LoadImage
			(FileName)
		mode == HourImage
			(Hour1):(FileName1),(Hour2):(FileName2),...
		mode == Select
			(Name1):(FileName1),(Name2):(FileName2),...
	rank
		(Integer)

	Result
		String(mode == Text | mode == InputValue | mode == TextAreaValue) | 
		Image(mode == Image | mode == LoadImage | mode == HourImage) | 
		Form(mode == Select) - (?)
*/

function updateData(mode, target, data, rank){

	if(mode == "Text"){
		updateText(target, data);
	}
	else if(mode == "InputValue"){
		updateInputValue(target, data);
	}
	else if(mode == "TextAreaValue"){
		updateTextAreaValue(target, data);
	}
	else if(mode == "Image"){
		updateImage(target, data, rank);
	}
	else if(mode == "LoadImage"){
		updateLoadImage(target, data, rank);
	}
	else if(mode == "HourImage"){
		updateHourImage(target, data, rank);
	}
	else if(mode == "Select"){
		showSelect(target, data, rank);
	}
	else{
		document.write("Error > changeData > mode");
	}

}


function updateText(target, data){

	//if(data == null){data = "";}
	document.getElementById(target).innerHTML = data;

}


function updateInputValue(target, data){

	var target2;

	target2 = target.split(":");
	//if(data == null){data = "";}
	if(target2[0] == "-"){
		document.getElementById(target2[1]).value = data;
	}
	else{
		document.forms[target2[0]].elements[target2[0]].value = data;
	}

}


function updateTextAreaValue(target, data){

	var target2;


	target2 = target.split(":");
	//if(data == null){data = "";}
	if(TargetForm == "-"){
		document.getElementById(Target2[1]).value = data;
	}
	else{
		document.forms[Target2[0]].elements[Target2[1]].value = data;
	}

}


function updateImage(target, data, rank){

	var rank2;

	if(rank == 0){
		rank2 = "./";
	}
	else{
		rank2 = "";
		for(i = 0; i < rank; i = i + 1){
			rank2 = rank2 + "../"
		}
	}
	document.images[target].src = rank2 + data;

}


function updateLoadImage(target, data, rank){

	var rank2;

	if(rank == 0){
		rank2 = "./";
	}
	else{
		rank2 = "";
		for(i = 0; i < rank; i = i + 1){
			rank2 = rank2 + "../"
		}
	}
//	window.onload = document.images[target].src = rank2 + data;
	window.onload = function(){document.images[target].src = rank2 + data;}

}

function updateHourImage(target, datas, rank){

	var datas2;
	var datas3;
	var rank2;
	var hours
	var files;
	var result;

	if(rank == 0){
		rank2 = "./";
	}
	else{
		rank2 = "";
		for(i = 0; i < rank; i = i + 1){
			rank2 = rank2 + "../"
		}
	}
	datas2 = new Array();
	datas3 = new Array();
	hours = new Array();
	files = new Array();
	datas2 = datas.split(",");
	for(i = 0; i < datas2.length; i++){
		datas3 = datas2[i].split(":");
		hours[i] = datas3[0];
		files[i] = datas3[1];
	}
	hh = parseInt(new Date().getHours());
	for(i = 0; i < hours.length; i++){
		if(hh >= hours[i]){
			result = files[i];
			break;
		}
	}
	document.images[target].src = rank2 + result;

}


function showSelect(target, datas, rank){

	var target2;
	var datas2;
	var datas3;
	var titles
	var locations;
	var rank2;

	if(rank == 0){
		rank2 = "./";
	}
	else{
		rank2 = "";
		for(i = 0; i < rank; i = i + 1){
			rank2 = rank2 + "../"
		}
	}
	target2 = new Array();
	datas2 = new Array();
	datas3 = new Array();
	titles = new Array();
	locations = new Array();
	target2 = target.split(",");
	datas2 = datas.split(",");
	for(i = 0; i < datas2.length; i++){
		datas3 = datas2[i].split(":");
		titles[i] = datas3[0];
		locations[i] = datas3[1];
	}
	document.writeln("<form>");
//	document.writeln("	<div class=\"center\">");
	document.writeln("		<select name=\"" + target2[1] + "\" id=\"" + target2[1] + "\" onchange=\"updateImageToSelect(\'" + target2[0] + "\', \'" + target2[1] + "\', \'" + rank2 + "\')\">");
	for(i = 0; i < datas2.length; i++){
		document.writeln("			<option value=\"" + Locations[i] + "\">" + Titles[i] + "<\/option>");
	}
	document.writeln("		<\/select>");
//	document.writeln("	<\/div>");
	document.writeln("<\/form>");
}


function updateImageToSelect(target, select, rank2){
	document.getElementById(target).src = rank2 + document.getElementById(select).value;
}


/*
removeWhiteSpace(target)

	target
		(Object.id)

	Result
		Process
*/

function removeWhiteSpace(target){
	element = document.getElementById(target);
	var node = element.firstChild;
	while(node){
		var nextNode = node.nextSibling;
		if(node.nodeType == 3 && !/\S/.test(node.nodeValue)){
			element.removeChild(node);
		}
		node = nextNode;
	}
	return element;
}


/*
expandSpaceWidth(mode, target, usedWide, resultWidth)

	mode
		Integer | WindowWidth
	target
		(Object.id)
	usedWide
		(Integer)
	resultWidth
		mode == Integer
			(Integer)
		mode == WindowWidth
			-

	Result
		Process
*/

function expandSpaceWidth(mode, target, usedWide, resultWidth){

	var addWidth;

	if(mode == "Integer"){
		addWidth = resultWidth - usedWide;
	}
	else if(mode == "WindowWidth"){
		if(getBrowserData("Name") == "Explorer"){
			addWidth = document.body.clientWidth - usedWide - 39; //IETester > IE 8
		}
		else{
			addWidth = window.innerWidth - usedWide - 39; //Firefox 3.5.7
		}
	}
	else{
		document.write("Error > expandSpaceWidth > mode");
	}
	if(addWidth > 0){
		document.getElementById(target).width = addWidth;
	}
	window.onresize = function(){expandSpaceWidth(mode, target, usedWide, resultWidth);}

}


/*
expandPageHeight(target, resultOffsetBottom)

	target
		(Object.id(div))
	resultOffsetBottom
		(Integer)

	Result
		Process
*/

function expandPageHeight(target, resultOffsetBottom){

	var addHeight;

	if(document.getElementById(target).offsetTop + 1 < resultOffsetBottom){
		addHeight = resultOffsetBottom - document.getElementById(target).offsetTop + 1;
		document.getElementById(target).height = addHeight;
	}

}


/*
checkEmailAddress(target, defaultBgColor, defaultColor, errorBgColor, errorColor)

	target
		(Object.id(input))
	defaultBgColor
		(#000000 - #ffffff)
	defaultColor
		(#000000 - #ffffff)
	errorBgColor
		(#000000 - #ffffff)
	errorColor
		(#000000 - #ffffff)

	Result
		Alert(mode == Alert) | 
		Style(mode == Style)
*/

function checkEmailAddress(target, defaultBgColor, defaultColor, errorBgColor, errorColor){

	if(document.getElementById(target).value != "" && !document.getElementById(target).value.match(/.+@.+\..+/)){
	//if(!document.getElementById(target).value.match(/^[A-Za-z0-9]+[\w-]+@[\w\.-]+\.\w{2,}$/)){
		document.getElementById(target).style.backgroundColor = errorBgColor;
		document.getElementById(target).style.Color = errorColor;
	}
	else{
		document.getElementById(target).style.backgroundColor = defaultBgColor;
		document.getElementById(target).style.Color = defaultColor;
	}

}


/*
compareFormValue(target1, target2, defaultBgColor, defaultColor, errorBgColor, errorColor)

	target1
		(Object.id(input))
	target2
		(Object.id(input))
	defaultBgColor
		(#000000 - #ffffff)
	defaultColor
		(#000000 - #ffffff)
	errorBgColor
		(#000000 - #ffffff)
	errorColor
		(#000000 - #ffffff)

	Result
		?
*/

function compareFormValue(target1, target2, defaultBgColor, defaultColor, errorBgColor, errorColor){

	if(document.getElementById(target2).value != "" && document.getElementById(target1).value != document.getElementById(target2).value){
		if(errorBgColor != ""){
			document.getElementById(target1).style.backgroundColor = errorBgColor;
			document.getElementById(target2).style.backgroundColor = errorBgColor;
		}
		if(errorColor != ""){
			document.getElementById(target1).style.Color = errorColor;
			document.getElementById(target2).style.Color = errorColor;
		}
	}
	else{
		if(defaultBgColor != ""){
			document.getElementById(target1).style.backgroundColor = defaultBgColor;
			document.getElementById(target2).style.backgroundColor = defaultBgColor;
		}
		if(defaultColor != ""){
			document.getElementById(target1).style.Color = defaultColor;
			document.getElementById(target2).style.Color = defaultColor;
		}
	}

}


/*
resetForm(language, confirm, target)

	language
		en | ja
	confirm
		OFF | ON
	target
		(Form.id)

	Result
		confirm == OFF
			Process
		confirm == ON
			Confirm - Process(confirm == OK) | Confirm - None(confirm == Cancel)
*/

function resetForm(language, confirm, target){

	var message;

	if(confirm == "ON"){
		if(language == "en"){
			message = "Are the contents of form reset?";
		}
		else if(language == "ja"){
			message = "フォ-ムの内容をリセットしますか？";
		}
		else{
			document.write("Error > resetForm > language");
		}
		if(window.confirm(message)){
			window.document.forms[target].reset();
		}
	}
	else{
		window.document.forms[target].reset();
	}

}




////Common


function setCookie(name, value, path, life){

	var expires;
	var data;

	expires = new Date();
	expires.setTime(expires.getTime() + (life * 1000 * 60 * 60 * 24));
	expires = expires.toGMTString();
	data = name + "=" + escape(value) + "; path=" + path + "\; expires=" + expires + ";";
	document.cookie = data;

}


function getCookie(name){

	var datas;
	var data;

	datas = new Array();
	data = new Array();
	datas = document.cookie.split("; ");
	for(i = 0; i < datas.length; i++){
		data = datas[i].split("=");
		if(data[0] == name){
			return unescape(data[1]);
		}
	}
	return;

}

