//  stdbaloon.js  
//
// *** NOTICE *** 
//   Kanji must not be included.  In some version of IE, Kanji is parsed as SJIS.
//   For Opera, after updating this file, disk cash shoud be cleared by the Edit-Option menu.
//
//  COPYRIGHT (C) Masayuki Sonobe 2002
//  Programmed by Masayuki Sonobe on 2002. 7.14
//--------------------

//----*** laod other javascrpt files Start ***----//

	document.write('<scr' + 'ipt type="text/javascript" src="/jquery.min.js"></scr' + 'ipt>');
	document.write('<scr' + 'ipt type="text/javascript" src="/kf_thumbnail.js"></scr' + 'ipt>');

//----*** laod other javascrpt files End ***----//


//----*** Sonobelab Part Begin ***----//
function showLayer(x, y, m, bgc){
// argument x:   integer  left top x position of the baloon
// argument y:   integer  left top y position of the baloon
// argument m:   string   baloon message (HTML). SPAN tag is inhibited
// argument bgc; string   background color in the baloon. ex1. red ex2. #a0a000

	net_msg = m;
	net_msg = net_msg.replace(/\<[^\>]+\>/g,'');
	net_msg = net_msg.replace(/\&nbsp\;/g,' ');

	msg = "\<TABLE BGCOLOR="+bgc+" CELLSPACING=2 CELLPADDING=5 BORDER=2\>\<TR\>\<TD\>\<FONT COLOR=#000055 SIZE=3 style='font-size:11pt;'\> "+m+" \</FONT\>\</TD\>\</TR\>\</TABLE\>";

	if(x < 10) {
		x = 10;
	}
	if(y < 10) {
		y = 10;
	}

	_bro=(window.opera?4:(document.all?3:(document.getElementById?1:(document.layers?2:0))));
		 // _bro: Kind of the Browser: 1=NN6+,  2=NN4,  3=IE,  4=Op,  0=others

	if (_bro == 4 || _bro == 1) {
		return;		// suppress layer if NN6+ or Opera
	}

  if(navigator.appVersion.charAt(0)>=4 && (navigator.appName).indexOf("Netscape") != -1){
	document.layers['layer1'].document.write(msg);
	document.layers['layer1'].document.close();
	if(x < 20) {
		x = 20;
	}
	document.layers['layer1'].left = x;
	document.layers['layer1'].top  =  y;
	document.layers['layer1'].visibility="show";
  }
  if(navigator.appVersion.charAt(0)>=4 && (navigator.appVersion).indexOf("MSIE") != -1){
	layer1.innerHTML = msg;
	layer1.style.left = x+document.body.scrollLeft;
	layer1.style.top  = y+document.body.scrollTop;
	layer1.style.visibility = 'visible';
	layer1.style.filter = 'alpha(opacity=86)';
  }
}

//--------------------
function hideLayer(){

	_bro=(window.opera?4:(document.all?3:(document.getElementById?1:(document.layers?2:0))));
		 // _bro: Kind of the Browser: 1=NN6+,  2=NN4,  3=IE,  4=Op,  0=others

	if (_bro == 4 || _bro == 1) {
		window.status = net_msg; // output the baloon message in the status
		return;		// suppress layer if NN6+ or Opera
	}

	if(navigator.appVersion.charAt(0)>=4 && (navigator.appName).indexOf("Netscape") != -1){
	   document.layers['layer1'].visibility="hide";
	}
	if(navigator.appVersion.charAt(0)>=4 && (navigator.appVersion).indexOf("MSIE") != -1){
	   layer1.style.visibility = 'hidden';
	}
}

//----------------------------------------------------------------------
function jspr(mesg, lineno) {

// *** NOTICE *** 
//   jspr(expression, lineno) is OK. However, if local var
// is included (e.g. var declaration is used in Netscape JavaScript),
// evaluation here does not work, so the value displayed will be incorrect.

	openwin1('jsprWindow');
	dt = new Date();
	hh = dt.getHours();
	mm = dt.getMinutes();
	ss = dt.getSeconds();
	var jspr_count;

	if (mm < 10) {
		mm = "0"+mm;
	}

	if (ss < 10) {
		ss = "0"+ss;
	}

	mesg_disp = mesg+"{"+eval(mesg)+"}";
//	debug_window.document.open();

	debug_window.document.write("<font size='2' color='#909000' face='New Times Roman' style='font-size: 9pt;'>"+hh+":"+mm+":"+ss+"</font><font size='2' color='#000050' face='Courier New,New Times Roman' style='background-color: #f7ffff; font-size: 12pt;'> &nbsp;"+mesg_disp+"</font> &nbsp;<font size='2' color='#909000' style='font-size: 11pt;'>line{"+lineno+"}</font><br>\n\n");
	debug_window.scrollTo(0,99999);
//	debug_window.document.close();	// HARMFULL! (old contents cleared)
	debug_window.focus();
	return;
}

//--------------------
function openwin1(targetName){
	// REFERENCE: http://game.gr.jp/js-ml/samples/200102/openerTest.html
	isIE3Mac = false;
	jspr_init_for_is();

	if(! win_closed(window.debug_window)) {

//**********if(typeof(debug_window) != 'undefined'  && !debug_window.closed) {

			// the window is open now
		debug_window.focus();
		return;
	}
	debug_window = window.open('',targetName
					 ,"width=400,height=500,resizable,scrollbars=yes,toolbar=yes,menubar=yes,status=yes");

	var subwinhtm = "<html><META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=euc-jp'>\n<head><title>jspr window</title></head><body>\n"
					+"<form>"
					+"  <input type='button' value='Close'"
					+"         onclick='self.close()'>"
					+"</form>\n\n";

	debug_window.document.write(subwinhtm);
	debug_window.focus();
	debug_window.document.title = targetName;
}

//----------------------------------------------------------------------
function win_closed(winVar) {
	// REFERENCE: http://game.gr.jp/js-ml/samples/200102/openerTest.html and add 'opera' item
 
	var ua = navigator.userAgent;

	if( !!winVar )
		if( ( ua.indexOf('Gecko')!=-1 || ua.indexOf('MSIE 4')!=-1 || ua.indexOf('opera')!=-1)
			&& ua.indexOf('Win')!=-1 ) 
			return winVar.closed;
		else return typeof winVar.document  != 'object';
	else return true;
	}

//--------------------
function window_open_s(x, y, z) {

	if (!isIE3Mac && is.opera) {
		;
	} else {
		if (typeof(ParaWindowPointer) == "object" && !ParaWindowPointer.closed) {
			ParaWindowPointer.close();
		}
	}

	if (!isIE3Mac && is.nav2) {
		ParaWindowPointer = window.open("", y, z);
		ParaWindowPointer.document.location = x;

	} else {
		ParaWindowPointer = window.open(x, y, z);
	}

	return(true);
}

//--------------------
function jspr_Is()
// Cf. -- in English --  http://www.mozilla.org/docs/web-developer/sniffer/browser_type_oo.html
// Cf. -- in Japanese --  http://moz.skillup.jp/docs/web-developer/sniffer/browser_type_oo.html
// Ultimate client-side JavaScript client sniff. Version 3.03
// (C) Netscape Communications 1999.  Permission granted to reuse and distribute.
{
    var agt=navigator.userAgent.toLowerCase();

    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    this.nav2 = (this.nav && (this.major == 2));
    this.nav3 = (this.nav && (this.major == 3));
    this.nav4 = (this.nav && (this.major == 4));
    this.nav4up = (this.nav && (this.major >= 4));
    this.navonly      = (this.nav && ((agt.indexOf(';nav') != -1) ||
                          (agt.indexOf('; nav') != -1)) );
    this.nav6 = (this.nav && (this.major == 5));
    this.nav6up = (this.nav && (this.major >= 5));

    this.ie     = ((agt.indexOf('msie') != -1) && (agt.indexOf('opera') == -1));
    this.ie3    = (this.ie && (this.major < 4));
    this.ie4    = (this.ie && (this.major == 4) && (agt.indexOf('msie 4')!=-1) );
    this.ie4up  = (this.ie  && (this.major >= 4));
    this.ie5    = (this.ie && (this.major == 4) && (agt.indexOf('msie 5.0')!=-1) );
    this.ie5_5  = (this.ie && (this.major == 4) && (agt.indexOf('msie 5.5') !=-1));
    this.ie5up  = (this.ie  && !this.ie3 && !this.ie4);
    this.ie5_5up =(this.ie && !this.ie3 && !this.ie4 && !this.ie5);
    this.ie6    = (this.ie && (this.major == 4) && (agt.indexOf('msie 6.')!=-1) );
    this.ie6up  = (this.ie  && !this.ie3 && !this.ie4 && !this.ie5 && !this.ie5_5);

    this.opera = (agt.indexOf('opera') != -1);
}

//--------------------
function jspr_init_for_is() {
//var help_is;
	jspr_isIE3Mac = false;
// this section is designed specifically for IE3 for the Mac

if ((navigator.appVersion.indexOf("Mac")!=-1) && (navigator.userAgent.indexOf("MSIE")!=-1) && 
(parseInt(navigator.appVersion)==3))
       jspr_isIE3Mac = true;
else   jspr_is = new jspr_Is(); 
}

//--------------------
//----*** Sonobelab Part End ***----//

