var preWin='main';

function MM_swapImgRestore() {
  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_preloadImages() {
  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) {
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() {
  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 open_cau(sub_url){
	openWin=window.open(sub_url,'cau','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=450,height=220');
	openWin.focus();
}

function open_fileup(sub_url){
	openWin=window.open(sub_url,'fup','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=480,height=530');
	openWin.focus();
}

function open_myf(sub_url){
	openWin=window.open(sub_url,'myf','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=430');
	openWin.focus();
}
function open_myf2(sub_url){
	openWin=window.open(sub_url,'myf','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=540,height=560');
	openWin.focus();
}
function open_ds(sub_url){
	openWin=window.open(sub_url,'dst','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=300,height=400');
	openWin.focus();
}

function open_dls(sub_url){
	openWin=window.open(sub_url,'dls','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=450,height=400');
	openWin.focus();
}

function open_fd(sub_url){
	openWin=window.open(sub_url,'fd','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=400');
	openWin.focus();
}

//2007/05/25 ADD START 
function open_fd2(sub_url){
	openWin=window.open(sub_url,'fd','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=415,height=400');
	openWin.focus();
}
//2007/05/25 ADD END

function open_reg(sub_url){
	openWin=window.open(sub_url,'reg','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=600');
	openWin.focus();
}

function open_pst(sub_url){
	openWin=window.open(sub_url,'myf','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=700,height=430');
	openWin.focus();
}

function open_cal(sub_url){
	openWin=window.open(sub_url,'cal','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=300,height=220');
	openWin.focus();
}

function open_inf(sub_url){
	openWin=window.open(sub_url,'inf','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=430');
	openWin.focus();
}

// フォーカスつけ
function dofocus(obj){
        obj.select();
        cngColor(obj,true);
}

// フォーカスなし
function doblur(obj){
        cngColor(obj,false);
}

// いろつけ
function cngColor(obj,bfocus){
        if (bfocus){
                obj.style["backgroundColor"]="EEEEEE";
        }else{
                obj.style["backgroundColor"]="white";
        }
}

// 日付フォーマットチェック
function cngDateFormat(obj) {
	//
	var txt = trim(obj.value);
	var len = jstrlen(txt);
	var sYear, sMonth, sDay;
	var sSplit;
	
	// 空白の場合
	if (len == 0) {
		return true;
	}
	
	// 全部数字？など日付の整合性チェック
	if(txt.match(/^[0-9]{4}\/[0-9]{1,2}\/[0-9]{1,2}$/)!=null){
		//
		sSplit = txt.split("/");
		sYear  = sSplit[0];
		sMonth = (sSplit[1].length==1)?"0" + sSplit[1]:sSplit[1];
		sDay   = (sSplit[2].length==1)?"0" + sSplit[2]:sSplit[2];		
		//
		obj.value = sYear + "/" + sMonth + "/" + sDay;
		var iMonth = parseInt(sMonth,10);
		var iDay = parseInt(sDay,10);
 	
 		if(iMonth < 1 || iMonth > 12) {
 			obj.style["backgroundColor"]="FF99CC";
 			return false;
 		}
		if(iDay < 1 || iDay > 31){
			obj.style["backgroundColor"]="FF99CC";
			return false;
		} 				
	} else if(txt.match(/^[0-9]{8}$/)!=null){
		//
		sYear  = txt.substr(0,4);
		sMonth = txt.substr(4,2);
		sDay   = txt.substr(6,2);

		obj.value = sYear + "/" + sMonth + "/" + sDay;
				
		var iMonth = parseInt(sMonth,10);
		var iDay = parseInt(sDay,10);
 	
 		if(iMonth < 1 || iMonth > 12) {
 			obj.style["backgroundColor"]="FF99CC";
 			return false;
 		}
		if(iDay < 1 || iDay > 31){
			obj.style["backgroundColor"]="FF99CC";
			return false;
		} 		

	}else{
		// 文字列エラー
		obj.style["backgroundColor"]="FF99CC";
		return false;
	}
	
	return true;
}

// 文字列のトリム
function trim(str) {
	return str.replace(/^\s+|\s+$/g, "")
}

// 文字数の判定
function jstrlen(str) {
	var len, i;
	len = 0;
	str = escape(str);
	for (i = 0; i < str.length; i++, len++) {
		if (str.charAt(i) == '%') {
			if (str.charAt(++i) == 'u') {
			i += 3;
			len++;
		}
			i++;
		}
	}
	return len;
}

// ブラウザバージョンチェック
function vercheck(IEversion,NNversion) {
	if ((navigator.appName.indexOf("Microsoft") >= 0)
		&&(IEversion != 0)
		&&(IEversion <= parseFloat(navigator.appVersion))) {
		return true
	} else {
		if ((navigator.appName.indexOf("Netscape") >= 0)
			&&(NNversion != 0)
			&&(NNversion <= parseFloat(navigator.appVersion))) {
			return true
		} else {
			return false
		}
	}
}

// スタイルシート取込み
// if (navigator.userAgent.indexOf("Win") >= 0) {
// 	if (vercheck(1,0)) {
// 		document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="/css/win_ie.css">')
// 	} else {
// 		document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="/css/wn_nn.css">')
// 	}
// } else {
// 	document.write('<LINK REL="stylesheet" TYPE="text/css" HREF="/css/mac.css">')
// }

	//右上側にポップアップ画面を表示するため
	//ヘルプに使用する
	function viewToRightUp(sub_url, hol, vrt, winname){
		var status = "'titlebar=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+hol+",height="+vrt+"'";
		openWin=window.open(sub_url, winname, status);
		
		//screen.availHeight
		openWin.moveTo(screen.availWidth-hol, 0);
		openWin.focus();
	}
	
//半角項目を変換するメソッドです。
//
var sw=1;
function Fulltohalf(strVal)
{

	han = "0123456789-!#$%&'()*+,-./:;<=>?@[]^_`{|}~｡､･｢｣.,-+ABCDEFGHIJKLMNOPQRSTUVWXYZｱｲｳｴｵｶｷｸｹｺｻｼｽｾｿﾀﾁﾂﾃﾄﾅﾆﾇﾈﾉﾊﾋﾌﾍﾎﾏﾐﾑﾒﾓﾔﾕﾖﾗﾘﾙﾚﾛﾜｦﾝｱｲｳｴｵｶｷｸｹｺｻｼｽｾｿﾀﾁﾂﾃﾄﾅﾆﾇﾈﾉﾊﾋﾌﾍﾎﾏﾐﾑﾒﾓﾔﾕﾖﾗﾘﾙﾚﾛﾜｦﾝｧｧｨｨｩｩｪｪｫｫｯｯｬｬｭｭｮｮabcdefghijklmnopqrstuvwxyz";
	zen = "０１２３４５６７８９―！＃＄％＆’（）＊＋，ー．／：；＜＝＞？＠［］＾＿｀｛｜｝?。、・「」．，－＋ＡＢＣＤＥＦＧＨＩＪＫＬＭＮＯＰＱＲＳＴＵＶＷＸＹＺアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンあいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをんぁァぃィぅゥぇェぉォっッゃャゅュょョａｂｃｄｅｆｇｈｉｊｋｌｍｎｏｐｑｒｓｔｕｖｗｘｙｚ";

	han2 = "ｶﾞｷﾞｸﾞｹﾞｺﾞｻﾞｼﾞｽﾞｾﾞｿﾞﾀﾞﾁﾞﾂﾞﾃﾞﾄﾞﾊﾞﾋﾞﾌﾞﾍﾞﾎﾞﾊﾟﾋﾟﾌﾟﾍﾟﾎﾟｶﾞｷﾞｸﾞｹﾞｺﾞｻﾞｼﾞｽﾞｾﾞｿﾞﾀﾞﾁﾞﾂﾞﾃﾞﾄﾞﾊﾞﾋﾞﾌﾞﾍﾞﾎﾞﾊﾟﾋﾟﾌﾟﾍﾟﾎﾟｳﾞ";
	zen2 = "がぎぐげござじずぜぞだぢづでどばびぶべぼぱぴぷぺぽガギグゲゴザジズゼゾダヂヅデドバビブベボパピプペポヴ";
	str = "";

	for (i=0; i<strVal.length; i++){

		c = strVal.charAt(i);
		n = zen.indexOf(c,0);
		if (n >= 0){
			c = han.charAt(n);
		}
		n = zen2.indexOf(c,0);
		if (n >= 0){
			n = n * 2;
			c = han2.charAt(n);
			c += han2.charAt(n + 1);
		}
			str += c;
	}
	return str;
}
	
	
	
	//何も動作させたくない場合に使用する
	function donothing(){}