//2011/11/10 andsystem takemura Edit no-009 Valign表示/非表示
var TEXT_VALIGM_NO009_CANCELID = 1;

//矩形クラス用の位置定数
	var LEFT_TOP = 0;
	var CENTER = 1;
	var RIGHT_BOTTOM = 2;
	var RIGHT_TOP = 3;
	var LEFT_BOTTOM = 4;
	var CENTER_TOP = 5;
	var LEFT_MIDDLE = 6;
	var RIGHT_MIDDLE = 7;
	var CENTER_BOTTOM = 8;
	//画像ボタン(ロールオーバーとセレクト状態を別の画像にしたい場合)
    function ImageButton(orig,over,select) {
    this.on = new Image();
    this.off = new Image();
    this.over = new Image();
    this.select = new Image();
    this.orig = new Image();
    this.on.src = over;
    this.off.src = orig;
    this.over.src = over;
    this.select.src = select;
    this.orig.src = orig;
    }
    //画像の入れ替え
    function swapImage(imgid,imgsrc) {
    $(imgid).src = imgsrc;
    }
    //マウスアクション処理関数
    function imgMouseOut(btn) {
        swapImage('btn' + btn,eval('ImgBtn' + btn).off.src);
    }
    function imgMouseIn(btn) {
        swapImage('btn' + btn,eval('ImgBtn' + btn).on.src);
    }
    //ボタン選択効果処理関数
    function imgSelect(btn) {
        swapImage('btn' + btn,eval('ImgBtn' + btn).select.src);
        eval('ImgBtn' + btn).on.src = eval('ImgBtn' + btn).select.src;
        eval('ImgBtn' + btn).off.src = eval('ImgBtn' + btn).select.src;
    }
    function imgDeselect(btn) {
        swapImage('btn' + btn,eval('ImgBtn' + btn).orig.src);
        eval('ImgBtn' + btn).on.src = eval('ImgBtn' + btn).over.src;
        eval('ImgBtn' + btn).off.src = eval('ImgBtn' + btn).orig.src;
    }
    function isUndef(v) {
    	return (typeof v == "undefined");
    }
    //urlへpostDataをAjaxで通信後にfuncを実行する。
    function AjaxPostData(url,postData,func) {
    	var ajax = new Ajax.Request(
                url,
                {
                    method: 'post',
                    parameters: postData,
                    onComplete: func,
                    onFailure : function( e )  {
//                    alert("Ajax通信に失敗しました。<url>"+url+"</url><msg>" + e.responseText + "</msg>");
                  },
                  onException : function( transport, ex )  {
//                	  alert("Ajax例外が発生しました。<url>"+url+"</url><msg>" + ex.message + "</msg>");
                  }                });
    }
    function GetUrlDocument(url,func) {
		var ifrm = document.createElement('iframe');
		ifrm.style.width = 0;
		ifrm.style.height = 0;
		document.body.appendChild(ifrm);
		ifrm.src = url;
		ifrm.afterLoaded = func;
		Event.observe(ifrm,"load",function(e){
			this.afterLoaded(this.contentWindow.document);
			document.body.removeChild(this);
		});
    }
    //form で指定されたHTMLフォームをURLにサブミットしてページを切り替える。
    function callNextURL( form , URL , target ,method){
    	form.action = URL;
    	form.method = method;
    	form.target = target;
    	form.submit();
    }
    //targetのウィンドウをURLに切り替える。
    function nextURL( URL , target){
    	var win = window.open(URL , target);
    }

    //srcで指定された画像を読み込み終了後にonloadで指定された関数を実行する。
    //（onloadには引数として読み込まれた画像が送られる。画像のloaded属性にはtrueが設定される。）
    function preLoadImage(src,onload) {
    	this.src = src;
        this.img = new Image();
        this.img.loaded = false;
        this.img.error = false;
        this.img.abort = false;
        this.img.error_cnt = 0;

        this.img.onerror = function (e) {
//        	prompt("画像読み込み失敗",this.src);
        	this.error = true;
        	this.error_cnt++;
        };
        this.img.onabort = function (e) {
        	this.abort = true;
        };
        this.img.onload = function (e) {
        	this.loaded = true;
        	onload(this);
        };
        this.img.loadStart = (new Date()).getTime();
        this.img.src = src;
    }
    //座標系クラス（座標計算、ベクトル演算を実装）
    function Vector(x,y) {
    	this.x = 0;
    	this.y = 0;
    	if (x != undefined) {
    	this.x = x;
    	}
    	if (y != undefined) {
    	this.y = y;
    	}
    	//引数vをベクトルとして加算
    	this.plusVector = function(v) {
    		this.x += v.x;
    		this.y += v.y;
    	}
    	//引数vをベクトルとして加算したものをオブジェクトとして返す。
    	this.getPlusVector = function(v)
    	{
    		ret = new Vector(this.x,this.y);
    		ret.plusVector(v);
    		return ret;
    	}
    	//引数vをベクトルとして減算
    	this.minusVector = function(v)
    	{
    		this.x -= v.x;
    		this.y -= v.y;
    	}
    	this.getMinusVector = function(v)
    	{
    		ret = new Vector(this.x,this.y);
    		ret.minusVector(v);
    		return ret;
    	}
    	//引数vとx要素同士、y要素同士を乗算

    	this.mulVector = function(v)
    	{
    		this.x *= v.x;
    		this.y *= v.y;
    	}
    	this.getMulVector = function(v)
    	{
    		ret = new Vector(this.x,this.y);
    		ret.mulVector(v);
    		return ret;
    	}
    	//引数vとのx要素同士、y要素同士を除算
    	this.devVector = function(v)
    	{
    		this.x /= v.x;
    		this.y /= v.y;
    	}
    	this.getDevVector = function(v)
    	{
    		ret = new Vector(this.x,this.y);
    		ret.devVector(v);
    		return ret;
    	}
    	//引数sをスカラーとして乗算
    	this.mulScalar = function(s)
    	{
    		this.x *= s;
    		this.y *= s;
    	}
    	//引数sをスカラーとして除算
    	this.devScalar = function(s)
    	{
    		this.x /= s;
    		this.y /= s;
    	}
    	this.getMulScalar = function(s)
    	{
    		ret = new Vector(this.x,this.y);
    		ret.mulScalar(s);
    		return ret;
    	}
    	//引数vの座標を自身から見た相対ベクトルとして返す。
    	this.getRelativeVector = function(v)
    	{
    		ret = new Vector(this.x,this.y);
    		ret.minusVector(v);
    		ret.mulScalar(-1);
    		return ret;
    	}
    	//Y軸に反転
    	this.flip = function()
    	{
    		this.x = -this.x;
    	}
    	//X軸に反転
    	this.flop = function()
    	{
    		this.y = -this.y;
    	}
    	//鏡像反転
    	this.traverse = function()
    	{
    		var p = this.x;
    		this.x = this.y
    		this.y = p;
    	}
    	//直角回転
    	this.rotate90 = function()
    	{
    		var p = this.x;
    		this.x = this.y
    		this.y = -p;
    	}
    	this.rotate180 = function()
    	{
    		this.x = -this.x;
    		this.y = -this.y;
    	}
    	this.rotate270 = function()
    	{
    		var p = this.x;
    		this.x = -this.y
    		this.y = p;
    	}
    	//任意角度で回転
    	this.rotate = function(rot)
    	{
    		if (rot == 90) {
    			this.rotate90();
    		} else if (rot == 180) {
    			this.rotate180();
    		} else if (rot == -90 || rot == 270) {
    			this.rotate270();
    		} else {
    			var th = rot * 2.0* Math.PI/360;
    			var c = Math.cos(th);
    			var s = Math.sin(th);
    			var retx = this.x*c - this.y*s;
    			var rety = this.y*c + this.x*s;
    			this.x = retx;
    			this.y = rety;
    		}
    	}
    	//原点との距離
    	this.getAbsolute = function(){
    		return Math.sqrt(this.x*this.x + this.y*this.y);
    	}
    	//内積
    	this.getInnerProduct = function(v){
    		return this.x*v.x + this.y*v.y;
    	}
    	//引数ベクトルとのなす角のコサイン
    	this.getCosine = function(v){
    		return this.getInnerProduct(v)/(this.getAbsolute()*v.getAbsolute());
    	}

    	//デバッグ用に座標をアラートする
    	this.alert = function() {
    		alert(this.x + "," + this.y);
    	}
    	//cssスタイル文字列として返す。
    	this.getStyle = function() {
    		return ("left:" + this.x + ";top:" + this.y + ";");
    	}
    }
  //矩形クラス、(x,y):基準座標、(w,h):幅高、ord_point:(0～8までの数値で基準座標の指示する点を指定する)
  //ord_point詳細(0:左上、1:中心、2：右下、3:右上,4:左下,5:上中、6:左中、7:右中、8:下中)または{x,y}(x:0～1y:0～1)形式も可
  function RectBox(x,y,w,h,ord_point) {
      	this.width = w;
      	this.height = h;
      	obj_wh = new Vector(w,h);
      	p = new Vector(x,y);
      	//ord_pointより実際の左上座標を計算する。
      	if (typeof ord_point == "object") {
      		v = new Vector(-ord_point.x,-ord_point.y);
      	} else {
  	    	if (ord_point == undefined) {
  	    		v = new Vector();
  	    	} else if (ord_point == CENTER) {
  	    		v = new Vector(-0.5,-0.5);
  	    	} else if (ord_point == RIGHT_BOTTOM) {
  	    		v = new Vector(-1,-1);
  	    	} else if (ord_point == RIGHT_TOP) {
  	    		v = new Vector(-1,0);
  	    	} else if (ord_point == LEFT_BOTTOM) {
  	    		v = new Vector(0,-1);
  	    	} else if (ord_point == CENTER_TOP) {
  	    		v = new Vector(-0.5,0);
  	    	} else if (ord_point == LEFT_MIDDLE) {
  	    		v = new Vector(0,-0.5);
  	    	} else if (ord_point == RIGHT_MIDDLE) {
  	    		v = new Vector(-1,-0.5);
  	    	} else if (ord_point == CENTER_BOTTOM) {
  	    		v = new Vector(-0.5,-1);
  	    	} else {
  	    		v = new Vector();
  	    	}
      	}
      	v.mulVector(obj_wh);
      	p.plusVector(v);
      	this.left = p.x;
      	this.top = p.y;
      	//矩形を右下に(x,y)だけ移動させる。
      	this.move = function (x,y) {
      		this.left += x;
      		this.top += y;
      	}
      	//自身のクローンオブジェクを返す。
      	this.getClone = function () {
      		return new RectBox(this.left,this.top,this.width,this.height);
      	}
      	//自身を(x,y)の位置にord_pointをあわせて移動する。
      	this.moveTo = function (x,y,ord_point) {
      		obj_wh = new Vector(this.width,this.height);
      		p = new Vector(x,y);
          	if (typeof ord_point == "object") {
          		v = new Vector(-ord_point.x,-ord_point.y);
          	} else {
  	    		if (ord_point == undefined) {
  	    			v = new Vector();
  	    		} else if (ord_point == CENTER) {
  	    			v = new Vector(-0.5,-0.5);
  	    		} else if (ord_point == RIGHT_BOTTOM) {
  	    			v = new Vector(-1,-1);
  	    		} else if (ord_point == RIGHT_TOP) {
  	    			v = new Vector(-1,0);
  	    		} else if (ord_point == LEFT_BOTTOM) {
  	    			v = new Vector(0,-1);
  	    		} else if (ord_point == CENTER_TOP) {
  	    			v = new Vector(-0.5,0);
  	    		} else if (ord_point == LEFT_MIDDLE) {
  	    			v = new Vector(0,-0.5);
  	    		} else if (ord_point == RIGHT_MIDDLE) {
  	    			v = new Vector(-1,-0.5);
  	    		} else if (ord_point == CENTER_BOTTOM) {
  	    			v = new Vector(-0.5,-1);
  	    		} else {
  	    			v = new Vector();
  	    		}
          	}
      		v.mulVector(obj_wh);
      		p.plusVector(v);
      		this.left = p.x;
      		this.top = p.y;
      	}
      	//自身を(x,y)の位置にord_pointをあわせて移動したオブジェクトを反す。
      	this.getMoveTo = function (x,y,ord_point) {
      		var ret = this.getClone();
      		ret.moveTo(x,y,ord_point);
      		return ret;
      	}
      	//矩形内のord_pointの座標をvectorとして返す。
      	this.getPoint = function (ord_point) {
      		obj_wh = new Vector(this.width,this.height);
      		p = new Vector(this.left,this.top);
          	if (typeof ord_point == "object") {
          		v = new Vector(ord_point.x,ord_point.y);
          	} else {
  	    		if (ord_point == undefined) {
  	    			v = new Vector();
  	    		} else if (ord_point == CENTER) {
  	    			v = new Vector(0.5,0.5);
  	    		} else if (ord_point == RIGHT_BOTTOM) {
  	    			v = new Vector(1,1);
  	    		} else if (ord_point == RIGHT_TOP) {
  	    			v = new Vector(1,0);
  	    		} else if (ord_point == LEFT_BOTTOM) {
  	    			v = new Vector(0,1);
  	    		} else if (ord_point == CENTER_TOP) {
  	    			v = new Vector(0.5,0);
  	    		} else if (ord_point == LEFT_MIDDLE) {
  	    			v = new Vector(0,0.5);
  	    		} else if (ord_point == RIGHT_MIDDLE) {
  	    			v = new Vector(1,0.5);
  	    		} else if (ord_point == CENTER_BOTTOM) {
  	    			v = new Vector(0.5,1);
  	    		} else {
  	    			v = new Vector();
  	    		}
          	}
      		v.mulVector(obj_wh);
      		p.plusVector(v);
      		return p;
      	}
      	//矩形をord_pointを維持したまま指定した幅高にリサイズする。
      	this.resizeTo = function (w,h,ord_point) {
      		obj_wh = new Vector(this.width,this.height);
      		p = this.getPoint(ord_point);
//      		p = new Vector(ord_pt.x,ord_pt.y);
//          	if (typeof ord_point == "object") {
//          		v = new Vector(ord_point.x,ord_point.y);
//          	} else {
//  	    		if (ord_point == undefined) {
//  	    			v = new Vector();
//  	    		} else if (ord_point == CENTER) {
//  	    			v = new Vector(0.5,0.5);
//  	    		} else if (ord_point == RIGHT_BOTTOM) {
//  	    			v = new Vector(1,1);
//  	    		} else if (ord_point == RIGHT_TOP) {
//  	    			v = new Vector(1,0);
//  	    		} else if (ord_point == LEFT_BOTTOM) {
//  	    			v = new Vector(0,1);
//  	    		} else if (ord_point == CENTER_TOP) {
//  	    			v = new Vector(0.5,0);
//  	    		} else if (ord_point == LEFT_MIDDLE) {
//  	    			v = new Vector(0,0.5);
//  	    		} else if (ord_point == RIGHT_MIDDLE) {
//  	    			v = new Vector(1,0.5);
//  	    		} else if (ord_point == CENTER_BOTTOM) {
//  	    			v = new Vector(0.5,1);
//  	    		} else {
//  	    			v = new Vector();
//  	    		}
//          	}
//      		v.mulVector(obj_wh);
//      		p.plusVector(v);
      		var ret = new RectBox(p.x, p.y,w,h,ord_point);
      		this.left = ret.left;
      		this.top = ret.top;
      		this.width = ret.width;
      		this.height = ret.height;

//      		this.moveTo(p.x, p.y, ord_point);
      	}
      	//ord_pointを維持したまま指定した幅高にリサイズしたものを返す。（ord_pointを共有する幅高(w,h)の矩形と同義）
      	this.getSubRect = function (w,h,ord_point) {
      		pt = this.getPoint(ord_point);
      		obj_wh = new Vector(w,h);
      		return new RectBox(pt.x,pt.y,w,h,ord_point);
      	}
      	//自身を指定した幅高に収まる最大の矩形としてord_pointと縦横比を維持してリサイズする。
      	this.getInsideRect = function (w,h,ord_point) {
      		pt = this.getPoint(ord_point);
      		this_wh = new Vector(this.width,this.height);
      		obj_wh = new Vector(w,h);
      		d = this_wh.getDevVector(obj_wh);
      		mag = (d.x < d.y?d.x:d.y);
      		return new RectBox(pt.x,pt.y,mag*w,mag*h,ord_point);


      	}
      	//自身を指定した幅高を覆う最小の矩形としてord_pointと縦横比を維持してリサイズする。
      	this.getCoveredRect = function (w,h,ord_point) {
      		pt = this.getPoint(ord_point);
      		this_wh = new Vector(this.width,this.height);
      		obj_wh = new Vector(w,h);
      		d = this_wh.getDevVector(obj_wh);
      		mag = (d.x > d.y?d.x:d.y);
      		return new RectBox(pt.x,pt.y,mag*w,mag*h,ord_point);


      	}
      	//自身を指定した倍率でord_pointと縦横比を維持してリサイズする。
      	this.resizeBy = function (r,ord_point) {
      		obj_wh = new Vector(this.width,this.height);
      		p = new Vector(this.left,this.top);
          	if (typeof ord_point == "object") {
          		v = new Vector(ord_point.x,ord_point.y);
          	} else {
  	    		if (ord_point == undefined) {
  	    			v = new Vector();
  	    		} else if (ord_point == CENTER) {
  	    			v = new Vector(0.5,0.5);
  	    		} else if (ord_point == RIGHT_BOTTOM) {
  	    			v = new Vector(1,1);
  	    		} else if (ord_point == RIGHT_TOP) {
  	    			v = new Vector(1,0);
  	    		} else if (ord_point == LEFT_BOTTOM) {
  	    			v = new Vector(0,1);
  	    		} else if (ord_point == CENTER_TOP) {
  	    			v = new Vector(0.5,0);
  	    		} else if (ord_point == LEFT_MIDDLE) {
  	    			v = new Vector(0,0.5);
  	    		} else if (ord_point == RIGHT_MIDDLE) {
  	    			v = new Vector(1,0.5);
  	    		} else if (ord_point == CENTER_BOTTOM) {
  	    			v = new Vector(0.5,1);
  	    		} else {
  	    			v = new Vector();
  	    		}
          	}
      		v.mulVector(obj_wh);
      		p.plusVector(v);
      		this.width *= Math.sqrt(r);
      		this.height *= Math.sqrt(r);
      		this.moveTo(p.x, p.y, ord_point);
      	}
      	//自身のcssスタイル文字列を返す。
      	this.getStyle = function () {
      		return ("left:" + this.left + "px;top:" + this.top + "px;width:" + this.width + "px;height:" + this.height + "px;");
      	}
      	//引数の矩形が完全に内側にあれば真を返す。
      	this.isInside = function (rbox) {
      		return this.left <= rbox.left &&
      		this.top <= rbox.top &&
      		rbox.left + rbox.width <= this.left + this.width &&
      		rbox.top + rbox.height <= this.top + this.height;
      	}
      	//引数の点が内側にあれば真を返す。
      	this.isInnerPoint = function (x,y) {
      		return this.left <= x &&
      		this.top <= y &&
      		x <= this.left + this.width &&
      		y <= this.top + this.height;
      	}
      	//引数の矩形を左上が(0,0)、右下が(1,1)として計算した相対座標を返す。
      	this.getRelativePoint = function (x,y) {
      		var ret = new Vector((x - this.left)/this.width,(y - this.top)/this.height);
      		return ret;
      	}
      	//引数の矩形を左上が(0,0)、右下が(1,1)として計算した相対矩形を返す。
      	this.getRelativeRect = function (rbox) {
      		var ret = new RectBox((rbox.left - this.left)/this.width,(rbox.top - this.top)/this.height,rbox.width/this.width,rbox.height/this.height);
      		return ret;
      	}
      	//引数の相対矩形（上記）を絶対矩形にして返す。
      	this.getRectFromRelative = function (rbox) {
      		var ret = new RectBox(rbox.left*this.width+this.left,rbox.top*this.height+this.top,rbox.width*this.width,rbox.height*this.height);
      		return ret;
      	}
      	//HTMLオブジェクトに矩形のスタイルをコピーする。
      	this.copyStyleTo = function (obj) {
      		obj.style.position = "absolute";
      		obj.style.left = this.left + "px";
      		obj.style.top = this.top + "px";
      		obj.style.width = this.width + "px";
      		obj.style.height = this.height + "px";
      	}
      	//自身の矩形情報を持ち、引数のidを指定したdivオブジェクトを返す。
      	this.createDivBox = function (id) {
      		var ret = document.createElement("div");
      		ret.setAttribute("id", id);
      		this.copyStyleTo(ret);
      		return ret;
      	}
//      	p.alert();
      }
      //divオブジェクトを元にRectBoxを作成
  	function createRectBox(divBox) {
      	if (typeof divBox.style != "undefined") {
      	return new RectBox(
      			divBox.style.left.replace("px","")-0,
      			divBox.style.top.replace("px","")-0,
      			divBox.style.width.replace("px","")-0,
      			divBox.style.height.replace("px","")-0
      			);
      	}
      }
      //vectorを基準座標としてRectBoxを作成
      function createVectorBox(width,height,vector,ord_point) {
  		return new RectBox(vector.x,vector.y,width,height,ord_point);
  	}
      //二つの座標で囲まれたRectBoxを作成
      function createVectorsBox(vector0,vector1) {
      var l = (vector0.x < vector1.x?vector0.x:vector1.x);
      var t = (vector0.y < vector1.y?vector0.y:vector1.y);
      var w = vector1.x - vector0.x;
      w = (w<0?-w:w);
      var h = vector1.y - vector0.y;
      h = (h<0?-h:h);
  		return new RectBox(l,t,w,h,0);
  	}
    //tミリ秒停止する。（砂時計化する可能性がある）
    function wait(t) {
    	d = (new Date()).getTime();
    	while ((d + t) > (new Date()).getTime()) {
    	}
    	return;
    }
    //divの子要素を全て削除する。
    function clearChildren(div) {
        for(var i = div.childNodes.length - 1; i >= 0 ; i--) {
        	div.removeChild(div.childNodes[i]);
        }
    }
    var winPopup;
    function popup_open(msg) {
		if (!winPopup || winPopup.closed) {
	    	var w = 50;
	    	var h = 50;
			var openLeft = (screen.width -w) / 2;
			if (screen.availHeight < h) {
				var scrollbar = "scrollbars=yes";
				var height = (screen.availHeight-30);
			var width = 1000;
				var openTop = 0;
			} else {
				var scrollbar = "scrollbars=yes";
//				var height = 702;
//				var width = 1000;
				var openTop = (screen.availHeight - h) / 2;
			}
			winPopup = window.open("","popup","width="+w+",height="+h+",left=" + openLeft + ",top=" + openTop + ",resizable=yes,status=no,directories=no,menubar=no,toolbar=no,scrollbars=yes");
		} else {
			winPopup.focus();
			winPopup.document.clear();
		}
		winPopup.document.write(msg);
    }
    //オブジェクトの属性を全て文字列として返す。
    function getObjProperties(obj,noCrLf) {
    	var prop = "";
        for(var i in obj) {
        	if (typeof obj[i] != "undefined") {
        		if (!noCrLf || noCrLf != 1) {
        			prop += i+":" + obj[i] + "\n,";
        		} else {
        			prop += i+":" + obj[i] + ",";
        		}
        	}
        }
        return "{" + prop.replace(/\n/g,"<br>\n") + "}";
    }
    //重複しない乱数文字列を作成
    function getDummyString() {
        var dt = new Date();
        var yy = dt.getFullYear();
        var mm = dt.getMonth() + 1;
        var dd = dt.getDay();
        var hh = dt.getHours();
        var nn = dt.getMinutes();
        var ss = dt.getSeconds();
        var sss = dt.getMilliseconds();

        var ret = "";
        var rnd = Math.random();

        ret = yy + "-" + mm + "-" + dd + "-" + hh + "-" + nn + "-" + ss + "-" + sss*rnd;

        return ret;
    }
    function getSessionId() {
    	var cookie = document.cookie;
    	cookie = cookie.replace(/;\ /g,"&");
    	var h = cookie.parseQuery();
    	return h.PHPSESSID;

    }
    //ブラウザの描画領域の幅高を返す。
    function getBrowserWidth() {
        if ( window.innerWidth ) { return window.innerWidth; }
        else if ( document.documentElement && document.documentElement.clientWidth != 0 ) { return document.documentElement.clientWidth; }
        else if ( document.body ) { return document.body.clientWidth; }
        return 0;
    }
    function getBrowserHeight() {
        if ( window.innerHeight ) { return window.innerHeight; }
        else if ( document.documentElement && document.documentElement.clientHeight != 0 ) { return document.documentElement.clientHeight; }
        else if ( document.body ) { return document.body.clientHeight; }
        return 0;
    }
    function getWindowHeight() {
        if ( top.height  ) { return top.height; }
        else if ( top.document.documentElement && top.document.documentElement.clientHeight != 0 ) { return top.document.documentElement.clientHeight; }
        else if ( top.document.body ) { return top.document.body.clientHeight; }
        return 0;
    }
    //bodyから見た要素の絶対位置を持つ矩形を返す。
	function getAbsOffset(ele) {
//		showDebug(ele.parentNode.nodeName,"L668");
//		showDebug(ele.parentNode == document.body,"L669");
		if (ele.parentNode == document.body && ele.style.position == "absolute") return createRectBox(ele);

		var ret = new RectBox(ele.offsetLeft,ele.offsetTop,ele.offsetWidth,ele.offsetHeight);
		ele = ele.parentNode;
		while(typeof ele.parentNode != "undefined" && typeof ele.offsetLeft != "undefined" ) {
			ret.left += ele.offsetLeft;
			ret.top += ele.offsetTop;
			ele = ele.parentNode;
		}
		return ret;
	}
	//指定した幅高を持つswfをロードする。
	function flash_loading(swf,width,height){

	    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="loading" align="middle">');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<param name="wmode" value="transparent" />');
		document.write('<param name="allowFullScreen" value="false" />');
		document.write('<param name="movie" value="'+swf+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" />   <embed src="'+swf+'" quality="high" bgcolor="#000000" width="'+width+'" height="'+height+'" name="loading" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');

	}
	//配列からneedleと一致する要素を検索してインデックスを返す。
	function array_search(needle,heystack) {
		if (!IsArray(heystack)) return null;
		for (var i = 0; i < heystack.length;i++) {
			if (heystack[i] == needle) return i;
		}
		return null;
	}
	//配列であれば真
	function IsArray(array)
	{
	  return !(
	    !array ||
	    (!array.length || array.length == 0) ||
	    typeof array !== 'object' ||
	    !array.constructor ||
	    array.nodeType ||
	    array.item
	  );
	}
	function isNumeric(num) {
		return (typeof num != "undefined" && !isNaN(num));
	}
	function NaNZero(num,zero) {
		return (isNumeric(num)?num:(zero?zero:0));
	}
	function zerofunc(f) {
		return (f && typeof f == "function"?f:function(e){});
	}
	function getUrlParameter() {
		var getparm = location.search.replace("?", "");
		var h = getparm.parseQuery();
		return h;
	}
	function createHiddenElement(name,value) {
		var ret = document.createElement("input");
		ret.setAttribute("type","hidden");
		ret.setAttribute("id",name);
		ret.name = name;
		ret.setAttribute("value",value);
		return ret;
	}

	function roundP(val,p) {
		pp = Math.pow(10,p);
		return Math.round(val*pp)/pp;
	}
