function showTips(nm){
  var style=document.getElementById?
              document.getElementById(nm).style:(
                document.all?document.all(nm).style:(
                  document.layers?document.layers[nm]:null
                  )
              );
  if(style) style.visibility='inherit';
}

function hideTips(nm){
  var style=document.getElementById?
              document.getElementById(nm).style:(
                document.all?document.all(nm).style:(
                  document.layers?document.layers[nm]:null
                  )
              );
  if(style) style.visibility='hidden';
}

function subwin(viewpage) {
	window.open(viewpage,"radio","toolbar=no,location=no,statusbar=no,menubar=no,scrollbars=no,resizable=no,width=342,height=470");
}

function subwin_480_270(viewpage) {
	window.open(viewpage,"radio","toolbar=no,location=no,statusbar=no,menubar=no,scrollbars=no,resizable=no,width=501,height=440");
}

function subwin_480_360(viewpage) {
	window.open(viewpage,"radio","toolbar=no,location=no,statusbar=no,menubar=no,scrollbars=no,resizable=no,width=501,height=520");
}

function subwin_200_280_201_300(viewpage) {
	window.open(viewpage,"radio","toolbar=no,location=no,statusbar=no,menubar=no,scrollbars=no,resizable=no,width=201,height=280");
}

function subwin_364_200(viewpage) {
	window.open(viewpage,"radio","toolbar=no,location=no,statusbar=no,menubar=no,scrollbars=no,resizable=no,width=386,height=406");
}

function subwin_364_200_384_440(viewpage) {
	window.open(viewpage,"radio","toolbar=no,location=no,statusbar=no,menubar=no,scrollbars=no,resizable=no,width=386,height=441");
}

function subwin_364_200_384_470(viewpage) {
	var koname='Kodomo';
	var exec_param='toolbar=no,location=no,statusbar=no,menubar=no,scrollbars=no,resizable=no,width=386,height=471,top=180,left=450';
	if(kowindow){
		if(kowindow.closed == false){
			kowindow.close();
		}
	} 
	kowindow = window.open(viewpage, koname, exec_param);
}

function subwin_320_180(viewpage) {
	window.open(viewpage,"radio","toolbar=no,location=no,statusbar=no,menubar=no,scrollbars=no,resizable=no,width=342,height=390");
}

function subwinFreeSize(viewpage, page, w, h) {
	var str = 'toolbar=no,location=no,statusbar=no,menubar=no,scrollbars=no,resizable=no,width=' + w + ',height=' + h;
	window.open(viewpage, page, str);
}

/*
	textareaに文字列を挿入する。
*/
function charactorPast(obj, chrstr) {
	var target = window.opener.document.getElementById(obj);
	var pos = getAreaRange(target);

	var val = target.value;
	var range = val.slice(pos.start, pos.end);
    var beforeNode = val.slice(0, pos.start);
    var afterNode  = val.slice(pos.end);
	var insertNode;

    if (range || pos.start != pos.end) {
       	target.value = beforeNode + chrstr + ' ' + afterNode;
    }
    
    else if (pos.start == pos.end) {
       	target.value = beforeNode + chrstr + ' ' + afterNode;
    }
}

function getAreaRange(obj) {
	var pos = new Object();
	
	if (isIE) {
		obj.focus();
		var range = window.opener.document.selection.createRange();
		var clone = range.duplicate();
		
		clone.moveToElementText(obj);
		clone.setEndPoint( 'EndToEnd', range );

		pos.start = clone.text.length - range.text.length;
		pos.end   = clone.text.length - range.text.length + range.text.length;
  	}

	else if(window.getSelection()) {
		pos.start = obj.selectionStart;
		pos.end   = obj.selectionEnd;
	}

	return pos;
}
var isIE = (navigator.appName.toLowerCase().indexOf('internet explorer')+1?1:0);

