
//----------------------------
//  ループ回数の最大値を返す
//----------------------------
function loot_init( digitsChange  ){
	var keta = 0; 
	if(digitsChange == 'ON'){  
		keta = 6 + document.calc.ketasu.selectedIndex * 4; 
	} 
	else{ 
		keta = 10;
	} 		
	var loop_limit = 0; 
	if(keta == 6){ loop_limit = 501;} 
	else if(keta == 10){loop_limit = 401;} 
	else if(keta == 14){loop_limit = 301;} 
	else if(keta == 18){loop_limit = 201;} 
	else if(keta <= 30){loop_limit = 101;} 
	else if(keta <= 42){loop_limit = 51;} 
	else if(keta <= 50){loop_limit = 21;} 
	return loop_limit;
}


function repaintMenu(libname, lang){
	var charset = "Shift_JIS";
	if(lang == "en"){
		charset = "utf-8";
	}
	var jump = "/has10/Menu.cgi?path=" + libname + '&deleteyn=yes&lang=' + lang + "&charset=" + charset;
	location.href = jump;
}

//----------------------------
//  外部テーブル( 一次元 )
//----------------------------
function getOutTable(tablenam, selectedIndex, isOnLoad, itemnames, lang) {
	var req = window.XMLHttpRequest ? new XMLHttpRequest() : (function() {
		try      { return new ActiveXObject('Msxml2.XMLHTTP');    }
		catch(e) { return new ActiveXObject('Microsoft.XMLHTTP'); }
	})();
	req.onreadystatechange = function() {
		switch (req.readyState) {
			case 1: // Open
			case 2: // Sent
			case 3: // Receiving
				break;
			case 4: // Loaded
				if(req.status == 200){
					var text = req.responseText;
					valueAr = text.split(',');	
					if(valueAr == ''){
						;//alert('指定された文字列は外部テーブルに存在しません');
					}
					else{
						itemAr = itemnames.split(',');
						for( i = 0; i < itemAr.length; i++){
							if(itemAr[i] == '' || itemAr[i] == null){
								continue;
							}
							if(isOnLoad == 1 && document.getElementById('var_'.concat(itemAr[i])).value != '' ){

							}
							else{
								document.getElementById('var_'.concat(itemAr[i])).value = valueAr[i+2];
							}
						}
						nextFocus();
					}
				}
				return;
	    }
	};
	req.open('GET', 'TableFile.cgi?&type=0&table=' + tablenam + '&selectedIndex=' + selectedIndex + '&lang=' + lang + '&rand=' + Math.floor(Math.random() * 10) , true);
	req.send(null);
}

//-------------------------------------------------
//  外部テーブル( 2次元で1次元しか使わない場合)
//--------------------------------------------------
function getOutTable2_1only(tablenam, firstSecondRet, selectedIndex, isOnLoad, lang){
	var req = window.XMLHttpRequest ? new XMLHttpRequest() : (function() {
		try      { return new ActiveXObject('Msxml2.XMLHTTP');    }
		catch(e) { return new ActiveXObject('Microsoft.XMLHTTP'); }
	})();
	req.onreadystatechange = function() {
		switch (req.readyState) {
			case 1: // Open
			case 2: // Sent
			case 3: // Receiving
				break;
			case 4: // Loaded
				if(req.status == 200){
					var text = req.responseText;
					valueAr = text.split(',');	
					if(valueAr == ''){
							; //	alert('指定された文字列は外部テーブルに存在しません');
					}
					else{
					
						itemAr = firstSecondRet.split(',');
						for( i = 3; i < itemAr.length; i++){
							var item = itemAr[i].split('|')[1];						
							if(item == '' || item == null){
								continue;
							}
							if(isOnLoad == 1 && document.getElementById('var_'.concat(item)).value != '' ){

							}
							else{
								document.getElementById('var_'.concat(item)).value = valueAr[i-3];
							}
						}
						nextFocus();
					}
				}
				return;
	    }
	};
	req.open('GET', 'TableFile.cgi?&type=3&table=' + tablenam + '&firstSecondRet=' + firstSecondRet + '&selectedIndex=' + selectedIndex + '&lang=' + lang + '&rand=' + Math.floor(Math.random() * 10) , true);
	req.send(null);
}

//-----------------------------------------
//   2段階の1番目の項目が選択されたら
//   2番目のリストを表示しなおす
//-----------------------------------------
function getOutTable2_1(tablenam, firstValue , firstSecondRet, firstItem, secondItem, secondArea, lang){

	var req = window.XMLHttpRequest ? new XMLHttpRequest() : (function() {
		try      { return new ActiveXObject('Msxml2.XMLHTTP');    }
		catch(e) { return new ActiveXObject('Microsoft.XMLHTTP'); }
	})();
	req.onreadystatechange = function() {
		switch (req.readyState) {
			case 1: // Open
			case 2: // Sent
			case 3: // Receiving
				break;
			case 4: // Loaded
				if(req.status == 200){
					var text = req.responseText;
					document.getElementById(secondArea).innerHTML = text;
				}
				getOutTable2_2(tablenam, firstSecondRet,  firstItem, secondItem, lang)
				return;
	    }
	};
	req.open('GET', 'TableFile.cgi?type=1&table=' + tablenam + '&firstSecondRet=' + firstSecondRet + '&firstValue=' + firstValue + '&firstItem=' + firstItem + '&secondItem=' + secondItem + '&lang=' + lang +'&rand=' + Math.floor(Math.random() * 10) , true);
	req.send(null);
}


//-----------------------------------------
//   2番目の項目が選択されたら
//   他の項目にセットする
//-----------------------------------------
function getOutTable2_2(tablenam, firstSecondRet, firstItem, secondItem, lang){
	var fsv = firstSecondRet.split(',');

	if(fsv.length > 3){
		var fsv2 = new Array(0);
		for (var j = 0; j < fsv.length; j++){
			if(fsv[j].indexOf('|') != -1){
				fsv2.push(fsv[j]);
			}
		}
		var req = window.XMLHttpRequest ? new XMLHttpRequest() : (function() {
			try      { return new ActiveXObject('Msxml2.XMLHTTP');    }
			catch(e) { return new ActiveXObject('Microsoft.XMLHTTP'); }
		})();
		
		req.onreadystatechange = function() {
			switch (req.readyState) {
				case 1: // Open
				case 2: // Sent
				case 3: // Receiving
					break;
				case 4: // Loaded
					if(req.status == 200){
						var ans = req.responseText.split(',');
						if(ans == ''){ return;}
						for (var j = 0; j < fsv2.length; j++){
							var items = fsv2[j].split('|');
							var item = items[1];
							if( ans[j] == 'undefined'){
								ans[j]='';	
							}
							if(document.getElementById('var_'.concat(item)) != null){
								document.getElementById('var_'.concat(item)).value = ans[j];
							}
						}
					}
					return;
		    }
		}

		var firstname  = document.getElementById(firstItem).options[document.getElementById(firstItem).selectedIndex].text;
		var secondname = document.getElementById(secondItem).options[document.getElementById(secondItem).selectedIndex].text;
		first = urlEncode(firstItem);// UTF-8にエンコードしている。
		second = urlEncode(secondItem);// UTF-8にエンコードしている。
		req.open('GET', 'TableFile.cgi?type=2&table=' + tablenam + '&firstSecondRet=' + firstSecondRet + '&first=' + firstname +  '&second=' + secondname + '&lang=' + lang + '&rand=' + Math.floor(Math.random() * 10) , true);
		req.send(null);					
	}
}

//----------------------------
//  アンケートのスクロール
//----------------------------
var amax = 635;
var amin = 40;
var i = amin;
function zoom_on(){
	tid=setInterval('kakudai();',10);
}
function zoom_off(){
	tid=setInterval('syukusyou();',10);
}
function kakudai(){
	i+=20;
	if(i<amax){
		document.getElementById('ank').style.height=i+'px';
	}
	else{
		clearInterval(tid);
	}
}


function urlEncode(instr){
	
	var outstr = encodeURI(instr);
	outstr = outstr.replace('%EF%BD%9E','%e3%80%9C');  // # 〜 
	outstr = outstr.replace('%E2%88%A5','%e2%80%96');  // ‖
	outstr = outstr.replace('%EF%BC%8D','%e2%88%92');  // −
	outstr = outstr.replace('%EF%BF%A0','%c2%a2');	 // ¢
	outstr = outstr.replace('%EF%BF%A1','%c2%a3');     // £
	outstr = outstr.replace('%EF%BF%A2','/%c2%ac');    // ¬
	return outstr;
	
}
//----------------------------
//  レートを取得する
//----------------------------
function getRate(id , from, to, startchar, endchar, rand, isValue){
	var req = window.XMLHttpRequest ? new XMLHttpRequest() : (function() {
		try      { return new ActiveXObject("Msxml2.XMLHTTP");    }
		catch(e) { return new ActiveXObject("Microsoft.XMLHTTP"); }
	})();
	
	req.onreadystatechange = function() {
		switch (req.readyState) {
			case 1: // Open
			case 2: // Sent
			case 3: // Receiving
				break;
			case 4: // Loaded
				if(req.status == 200){
					xt = req.responseXML.documentElement.firstChild.nodeValue;
					if(isValue == 1){
						xt = Math.round(xt*100)/100; 
						if(document.getElementById(id) != null && document.getElementById(id).value == ''){ 
							document.getElementById(id).value = startchar + xt + endchar;
						}
					}
					else{
						if(document.getElementById(id) != null) {  
							document.getElementById(id).innerHTML = startchar + xt + endchar;
						}
					}
				}
		    return;
		};
	}	
	req.open('GET', 'Kawase.cgi?&from=' + from +  '&to=' + to + '&rand=' + rand , true);
	req.send(null); 
}

var parentnum = 0;
function getGoogleMapNum() { 
  return parentnum; 
} 
function googleMap(num) { 
  parentnum = num; 
  var childWindow  = window.open('http://keisan.casio.com/keisan/googleMap.html', 'Map', 'width=800,height=720,scrollbars=yes'); 
	childWindow.focus();
} 
function googleMapKyori(num) { 
  parentnum = num; 
  var childWindow  = window.open('http://keisan.casio.com/keisan/googleMapKyori.html', 'Map', 'width=800,height=720,scrollbars=yes'); 
	childWindow.focus(); 
}

//---------------------------------------
//  レフレッシュする
//---------------------------------------
function loginChg(){
	var req = window.XMLHttpRequest ? new XMLHttpRequest() : (function() {
		try      { return new ActiveXObject("Msxml2.XMLHTTP");    }
		catch(e) { return new ActiveXObject("Microsoft.XMLHTTP"); }
	})();
	req.onreadystatechange = function() {
		switch (req.readyState) {
			case 1: // Open
			case 2: // Sent
			case 3: // Receiving
				break;
			case 4: // Loaded
				if(req.status == 200){
					var loginuser = req.responseText.split("\n");
					if(document.getElementById("youkoso") != null){
						document.getElementById("youkoso").innerHTML = loginuser[0];
					}
					document.getElementById("loginout").innerHTML = loginuser[1];
					document.getElementById("userinfo").innerHTML = loginuser[2];
				}
				return;
	    }
	};

	path=window.location;
	setCookie2("loginret",path, "/");
	req.open('GET', '/dc/loginsession.php', true);
	req.send(null);
}

//---------------------------------------
//  FLASHのIEアクティブ化対応
//---------------------------------------
function flashDisp(width, height, id) {
	if (AC_FL_RunContent == 0) {
		alert('このページでは \"AC_RunActiveContent.js\" が必要です。');
	} else {
		AC_FL_RunContent(
		'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
		'width', width,
		'height', height,
		'src', id,
		'quality', 'high',
		'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
		'align', 'middle',
		'play', 'true',
		'loop', 'true',
		'scale', 'showall',
		'wmode', 'window',
		'devicefont', 'false',
		'id', id,
		'bgcolor', '#ffffff',
		'name', id,
		'menu', 'true',
		'allowFullScreen', 'false',
		'allowScriptAccess','sameDomain',
		'movie', id,
		'salign', ''
		); //end AC code
	}
}

//-----------------------------------------
//  keyで指定されたクッキーを読み込む
//-----------------------------------------
function getCookie(key) {
    tmp = ' ' + document.cookie + ';';
    var xx1 = xx2 = 0;
    var len = tmp.length;
    while (xx1 < len) {
        xx2 = tmp.indexOf(';', xx1);
        var tmp2 = tmp.substring(xx1 + 1, xx2);
        xx3 = tmp2.indexOf('=');
        if (tmp2.substring(0, xx3) == key) {
            return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
        }
        xx1 = xx2 + 1;
    }
    return('');
}

//-----------------------------------------
//  keyvalue でクッキーを書き込む
//-----------------------------------------
function setCookie(key, value) {
     var tmp = key + '=' + escape(value) + '; ';
     tmp += 'expires=Tue, 31-Dec-2030 23:59:59; ';
     document.cookie = tmp;
}

function setCookie2(key, value, path) {
     var tmp = key + '=' + escape(value) + '; ';
//     var exp = new Date();
//     exp.setMonth(exp.getMonth() + 12);
//     tmp += 'expires=' + exp + '; ';
     tmp += 'expires=Tue, 31-Dec-2030 23:59:59; ';	 
	 tmp += 'path=' + path +'; ';
     document.cookie = tmp;
}


//--------------------------------------------
//  最近使ったライブラリ
//--------------------------------------------
function getUseTop10(){
	var str="";
	var dailyuse = getDailyUseLib();
	if(dailyuse.length == 0){
		return document.write('History of used library is nothing<br>');
	}
	
	str ="<table border=0 cellpadding=0 cellspacing=0>"
	for(var i = 0 ; i < dailyuse.length; i++) {
		var s = dailyuse[i].split('=');
		var pos = s[1].indexOf(":");
		if( pos != -1){
			s[1] = s[1].substring(0,pos)
		}
//		str += "<tr><td><b>" + (i+1) + ". <a href='/has10/SpecExec.cgi?id="+ s[1] + "'><font color=#007575>" + s[0] + "</font></b><a></td></tr>\n";
		str += "<tr><td>&nbsp;" + (i) + ". <a href='/has10/SpecExec.cgi?id="+ s[1] + "'>" + s[0] + "<a></td></tr>\n";

	
	}
	str += "</table>";
	return document.write(str);
}

//--------------------------------------------
//  よく使うライブラリをクッキーから読み込む
//--------------------------------------------
function getDailyUseLib(){
	var dailyuse = new Array();
	var cookie = getCookie('dailyuseen');
	if(cookie == ''){
		return dailyuse;
	}
	var ck = cookie.split(';');
	for(var j=0; j < ck.length; j++){
		dailyuse.push(ck[j]);
	}
	return dailyuse;
}

//-----------------------------------------
// よく使うライブラリをクッキーに書き込む
//-----------------------------------------
function setDailyUseLib(name, address, lang){
	if(name != "" && address != "" && lang == "en"){
		var str = name + "=" + address;
		var dailyuse = getDailyUseLib();
		if(dailyuse.length > 0){
			var j = 1;
			for(var i = 0 ; i < dailyuse.length; i++) {
				var s = dailyuse[i].split('=');
				if(s[0] != name){
					str += ";" + s[0] + "=" + s[1];
					j++;
					if(j == 10){break;}	
				}
			}
		}
		setCookie2('dailyuseen', str, '/');
	}
}


//--------------------------------------------
//  プロフィールをクッキーから読み込む
//--------------------------------------------
function getProfileCookie(){
	var profile = new Array();
	var cookie = getCookie('profile');

	if(cookie != ''){
		var ck = cookie.split(';');
		for(var j=0; j < ck.length; j++){
			profile.push(ck[j]);
		}
	}
	return profile;
}

function getProfileCookie2(cname){
	var profile = new Array();
	var cookie = getCookie('profile');
	if(cookie != ''){
		var ck = cookie.split(';');
		for(var j=0; j < ck.length; j++){
			var s = ck[j].split('=');
			if(s[0] == cname){
				return s[1];
			}	
		}
	}
	return null;
}


//-----------------------------------------
// プロフィールをクッキーに書き込む
//
//	self_month_1_12=1-12
//	self_month_jan_Dec=1-12
//	self_month_1_31=1-31
//	self_y=xxxx
//	other_month_1_12=1-12
//	other_month_jan_Dec=1-12
//	other_month_1_31=1-31
//	other_y=xxxx
//  sex=0-man,  1-female
//  weight= xxx kg 
//  height= xxx cm
//-----------------------------------------
function setProfileCookie(name, value){

	if(name != "" && value != "" ){
		var str = name + "=" + value;
		var profile = getProfileCookie();

		if(profile.length > 0){
			for(var i = 0 ; i < profile.length; i++) {
				var s = profile[i].split('=');
				if(s[0] != name){
					str += ";" + s[0] + "=" + s[1];
				}
			}
		}		

		setCookie2('profile', str, '/');
	}
}

//----------------------------
//  年月日を取得する 
//  (例）  19991231
//----------------------------
function getYYYYMMDD(){
	var dd = new Date();
	var yyyy = dd.getYear();
	var mm = dd.getMonth() + 1;
	dd = dd.getDate();
	if (yyyy < 2000) { yyyy += 1900; }
	if (mm < 10) { mm = '0' + mm; }
	if (dd < 10) { dd = '0' + dd; }
	return ('' + yyyy + mm + dd);
}

//----------------------------
//  年を取得する 
//  (例）  1999
//----------------------------
function getYYYY(){
	var yyyy = new Date().getYear();
	if (yyyy < 2000) { yyyy += 1900; }
	return (yyyy);
}		

//----------------------------
//  月を取得する 
//  (例）  12
//----------------------------
function getMM(){
	var mm = new Date().getMonth() + 1;
	if (mm < 10) { mm = '0' + mm; }			
	return (mm);
}

//----------------------------
//  日を取得する 
//  (例）  31
//----------------------------
function getDD(){
	var dd = new Date().getDate();
	if (dd < 10) { dd = '0' + dd; }		
	return (dd);
}

//----------------------------
//  時分秒を取得する 
//  (例）  115959
//----------------------------
function getHHMMSS(){
	var dd = new Date();
	var hh = dd.getHours();
	var mm = dd.getMinutes() ;
	var ss = dd.getSeconds();
	if (hh < 10) { hh = '0' + hh; }
	if (mm < 10) { mm = '0' + mm; }
	if (ss < 10) { ss = '0' + ss; }
	return ('' + hh + mm + ss);
}

//----------------------------
//  時を取得する 
//  (例）  11
//----------------------------
function getHH(){
	var dd = new Date();
	var hh = dd.getHours();
	if (hh < 10) { hh = '0' + hh; }
	return hh;
}

//----------------------------
//  分を取得する 
//  (例）1分の場合は  --> 01 と返す
//----------------------------
function getMMinit(){
	var dd = new Date();
	var mm = dd.getMinutes() ;
	if (mm < 10) { mm = '0' + mm; }
	return mm;
}

//----------------------------
//  秒を取得する 
//  (例）1秒の場合は  --> 01 と返す
//----------------------------
function getSS(){
	var dd = new Date();
	var ss = dd.getSeconds();
	if (ss < 10) { ss = '0' + ss; }
	return ss;
}

function getYMD(id){
	if(id == 'YYYYMMDD'){
		return getYYYYMMDD();
	}
	else if(id == 'YYYY'){
		return getYYYY();
	}
	else if(id == 'MM'){
		return getMM();
	}
	else if(id == 'DD'){
		return getDD();
	}
}
function getHMS(id){		
	if(id == 'HHMMSS'){
		return getHHMMSS();
	}
	else if(id == 'HH'){
		return getHH();
	}
	else if(id == 'MM'){
		return getMMinit();
	}			
	else if(id == 'SS'){
		return getSS();
	}	
}

//-------------------------------------
//  min 〜max 内のランダムな値を返す
//-------------------------------------
function getRandomFromTo(min, max){		
//		return min + Math.floor( Math.random() * (max+1) ); 
	return  new Number(min) + Math.floor( Math.random() * (max-min+1)); 
}

function getRandom(range){
	var reg = new RegExp(',');
	if( reg.test(range) ){		// 位ごとに範囲を指定
		var kurai = range.split(',');
		var i;
		var ans = 0;
		
		for (i = 0; i < kurai.length; i++) {
			var kuraiRenge = kurai[i];
			var minMax = kuraiRenge.split('|');	
			var c = getRandomFromTo(minMax[0], minMax[1]);
			ans += c * Math.pow(10,i) ;
		}
		return ans;
	}
	else{ 			  // 全体の範囲を指定
		var minMax = range.split('|');	
		return getRandomFromTo(minMax[0], minMax[1]);
	}
}

//-----------------------------------------
//  ポップアップメニュー
//-----------------------------------------
var tid;
var cgi = 'has10';

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImgRestore2(obj) { //v3.0
	MM_swapImgRestore();
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//function mouseover(item, x, cgihas10){
//	clearTimeout(tid);
// 	tid=setTimeout( "popupMenu("+ item + "," +  x + ");", 350);
//    cgi = cgihas10;
//}

function mouseoverEn(item, x, cgihas10){
	clearTimeout(tid);
 	tid=setTimeout( "popupMenuEn("+ item + "," +  x + ");", 350);
    cgi = cgihas10;
}


function mouseout(){
	clearTimeout(tid);
	tid=setTimeout( "setDisp('none');", 200);
}

function rollOver(obj, val) {
	obj.className = val;
}


function jumpUrlEn(url, cgihas10) {	
	url = url.replace("@", " ");
	location.href = '/' +  cgihas10  + '/Menu.cgi?lang=en&path=' + url;
}

// 表示モード切替
function setDisp(mode) {
	document.getElementById('submenu').style.display = mode;
}


//-----------------------------------------
//   グラフ描画
//------------------------------------------

function dispgraph(){
	document.calc.action = '/keisan/graph/php/graphForm.php'; 
	document.calc.target = '_blank'; 
	document.calc.method = 'post'; 
	document.calc.submit(); 
}

function callDispGraph(
    lang, 
	xLabel, 
	data, 
	exp, 
	title_onoff,
	gtitle,
	yname,
	xname,
	width,
	height,
	background,
	xstep,
	scale_max,
	scale_min,
	zero_memory,
	infinity,
	up_ignore,
	down_ignore,
	nonOutpuTable,	
	line_width,
	circle_size,
	spline,
	stack,
	transparent,
	stack2,
	transparent2,
	d23,
	bargap,
	regend_pos,
	rwidth,
	each){  

	filename = Math.floor(Math.random() * 123456789012) + '.png'; 
    //  同一画面のグラフ
	// POSTパラメータ   
	postData =  'filenam=' + filename;
	postData += '&lang=' + lang;
	postData += '&xLabel=' + encode(xLabel);
	postData += '&data=' + data ;
	postData += '&exp=' + exp;
	postData += '&width=' + width;
	postData += '&height=' + height;
	postData += '&titleonoff=' + title_onoff;
	postData += '&gtitle=' + gtitle;
	postData += '&yname=' + yname;
	postData += '&xname=' + xname;
	postData += '&xstep=' + xstep;
	postData += '&scale_max=' + scale_max;
	postData += '&scale_min=' + scale_min;
	postData += '&zero_memory=' + zero_memory;
	postData += '&line_width=' + line_width;
	postData += '&circle_size=' + circle_size;

	if(transparent == 'ON'){
		postData += '&transparent=0';
	}
	else{
		postData += '&transparent=1';
	}

	postData += '&stack=' + stack;
	if(transparent2 == 'ON'){
		postData += '&transparent2=0';
	}
	else{
		postData += '&transparent2=1';
	}

	postData += '&stack2=' + stack2;	
	postData += '&infinity=' + infinity;
	postData += '&up_ignore=' + up_ignore;
	postData += '&down_ignore=' + down_ignore;	

	postData += '&non_output_table=' + nonOutpuTable;
	
	postData += '&background=' + background;
	if(regend_pos == 'right'){
		postData += '&regend_pos=1';
	}
	else{
		postData += '&regend_pos=0';
	}

	postData += '&d23=' + d23;
	postData += '&rwidth=' + rwidth;
	postData += '&rheight=' + rwidth;
	postData += '&bargap=' + bargap;
	postData += '&spline=' + spline;
	postData += '&each_graph=' + each;	

	var req = window.XMLHttpRequest ? new XMLHttpRequest() : (function() {   
		try      { return new ActiveXObject('Msxml2.XMLHTTP');    }   
		catch(e) { return new ActiveXObject('Microsoft.XMLHTTP'); }   
	})();   
	req.onreadystatechange = function() {   
	switch (req.readyState) {   
		case 1: // Open   
		case 2: // Sent   
		case 3: // Receiving   
			break;   
		case 4: // Loaded   
			if(req.status == 200){
				document.getElementById('myGraph').innerHTML = "<img src='/keisan/lib/virtual/tmp/"+ filename + "' border=0><br><br>";   
			}
		return;
	    }   
	};   
	req.open('POST', '/keisan/graph/php/graph.php', true);   
	req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');  
	req.send(postData);
	
}	  



 


function encode(text){
	html = allReplace(text, '&', '%26');	 
	return  encodeURI(allReplace(html, '+', '%2B'));	 
}


function allReplace(text, s, t) {
	 while (true) { 
	     text2 = text;
		 text = text2.replace(s, t);
	 	if (text == text2) {
	  		break;  
	 	}
	}
	return text;
}





function popupMenuEn(item, x) {	
	var h = 142;
	var ua = navigator.userAgent;
	if(ua.match(/MSIE/)) {
		h=148;
	}	
	
	var submenu = document.getElementById('submenu');
	// メニュー項目
	menuItem = new Array();
	switch (item) {

	// 生活編
	case 1:
		menuItem.push('Life',   '01900000.Life');
		break;		
	// 教育編
	case 2:
		menuItem.push('Mathematics',   '05000000.Mathematics');
		menuItem.push('Science',      '06000000.Science');
		break;
	// 専門編
	case 3:
		menuItem.push('Probability Function', '07000000.Probability@Function'); // 後で@ -->ブランクに変換する
//		menuItem.push('Special5Functions',     '08000000.Special@Functions');
		menuItem.push('Special Function',     '08000000.Special@Function');
		menuItem.push('Numerical analysis',    '08500000.Numerical@analysis');
		break;
	}	
	// メニュー作成
	var layer;
	var url;
	var subject;
	layer = "<div align=left style='position:absolute;top:" + h + ";left:" + x + ";'>";
	var loop = menuItem.length / 2;
	for (i=0; i<loop; i++) {
		url = i * 2 + 1;
		subject = i * 2;
		layer += "<div id='submenu" + i + "' class='subout'";
		layer += "  onclick=jumpUrlEn('" + menuItem[url] + "','" +  cgi  + "');";
		layer += "  onmouseover=clearTimeout(tid);rollOver(this,'subover');setDisp('block');";
		layer += "  onmouseout=rollOver(this,'subout');setDisp('none');>" + menuItem[subject] + "</div>";
	}
	layer += '</div>';
	// ポップアップメニュー表示
	setDisp('block');
	submenu.innerHTML = layer;
	return true;
}


