/*+++++++++++++++++++++++++++++++++++
+ module.js 1.2     2008/11/11
+
+ Copyright(c) 1977-2008 Okada Takeshi
+ All rights reserved.
+
+ このファイルはaflja_initialize.phpより読み込みされ設置
+
+ 基本的に内部で使用
+ HTML内に使用する場合は、cssQuely(クラスイベント)に関連づけて使用する
+
+++++++++++++++++++++++++++++++++++*/


/*+++++++++++++++++++++++++++++++
+ HTTP_USER_AGENTのチェック (aflja_initialize.phpで設定)
+++++++++++++++++++++++++++++++++
 ブラウザチェック   →  HTTP_USER_AGENT["browser"].match(/IE/i)
 バージョンチェック →  HTTP_USER_AGENT["majorver"] < 8

 aflja_initialize.phpで設定されたHTTP_USER_AGENT
   HTTP_USER_AGENT = {};
   HTTP_USER_AGENT["parent"]   = "{$USER_AGENT["parent"]}";
   HTTP_USER_AGENT["browser"]  = "{$USER_AGENT["browser"]}";
   HTTP_USER_AGENT["version"]  = "{$USER_AGENT["version"]}";
   HTTP_USER_AGENT["majorver"] = "{$USER_AGENT["majorver"]}";
   HTTP_USER_AGENT["minorver"] = "{$USER_AGENT["minorver"]}";
   HTTP_USER_AGENT["platform"] = "{$USER_AGENT["platform"]}";
   [0 or 1]
   isFirefox   = {$isFirefox};
   isMozilla   = {$isMozilla};
   isOpera     = {$isOpera};
   isSafari    = {$isSafari};
   isChrome    = {$isChrome};
   isIE        = {$isIE};
   isIE5       = {$isIE5};
   isIE6       = {$isIE6};
   isIE7       = {$isIE7};
   is_IE7      = {$is_IE7};
   isIE8       = {$isIE8};
*/
if (!HTTP_USER_AGENT["browser"]) { alert("not found HTTP_USER_AGENT"); }
if (!$("AFLJA")){ alert("Not Found AFLJA"); }//AFLJA = $("AFLJA");



/*********************************
* グローバル変数 g_変数名;
*********************************/
g_zIndex = 1000; // zIndex



/*+++++++++++++++++++++++++++++++
+ Stringクラス拡張
+++++++++++++++++++++++++++++++++
 空白スペースを取り除く
    .trim();
 HTMLエスケープ アンエスケープを行う
    .escHTML();   [testing <b>escHTML</b>' → 'testing &lt;b&gt;unescHTML&lt;/b&gt;']
    .unescHTML()  ['testing &lt;b&gt;unescHTML&lt;/b&gt;' → 'testing <b>escHTML</b>']
 URLエンコードを行う
    .urlEncode();
 URL使用可能文字のみ返す
    .isURL ();
 TEL・数字使用可能文字のみ返す
    .toTEL();     [数字-以外削除]
    .toNUM();     [数字以外削除]
 JSON形式かどうか確認する
    .isJSON();
 文字列を URL文字列 へ     url_string = utf.URLencode(string);[Chara.js]
    .URLencode();
 URL文字列 から文字列へ。  string = utf.URLdecode( url_string );[Chara.js]
    .URLdecode();
*/

String.prototype.trim     = function() { return this.replace(/^\s+|\s+$/g,""); } // public ():String
String.prototype.urlEncode= function() { return encodeURIComponent(this); } // public ():String
String.prototype.toTEL    = function() { return this.replace(/[^0-9-]/gi,""); } // public ():String
String.prototype.toNUM    = function() { return this.replace(/[^0-9]/gi,""); } // public ():String
String.prototype.URLencode= function() { return utf.URLencode(this); } // public ():String
String.prototype.URLdecode= function() { return utf.URLdecode(this); } // public ():String
String.prototype.escHTML  = function() { // public ():String
    var i,e = { "&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"},t = this;
    for (i in e) t = t.replace(new RegExp(i,"g"),e[i]); return t; }
String.prototype.escesc  = function() { // public ():String
    var i,e = { "\\":"\\\\"},t = this;
    for (i in e) t = t.replace(new RegExp(i,"g"),e[i]); return t; }
String.prototype.unescHTML = function(){ // public ():String
    var i,e={ "&lt;":"<","&gt;":">","&amp;":"&","&quot;":'"' },t = this;
    for (i in e) t=t.replace(new RegExp(i,"g"),e[i]); return t; }
String.prototype.toEmail  = function(){ // public ():Boolean
    var rx = new RegExp("\\w+([-+.\']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
    var matches = rx.exec(this);
    return (matches > 0) ? true : false; }
String.prototype.isJSON = function(){ // public ():Boolean
    var rx = new RegExp("^\{.+\}$");
    var matches = rx.exec(this);
    return (matches > 0) ? true : false; }		







/*+++++++++++++++++++++++++++++++++
+ デバッグ クラス
+++++++++++++++++++++++++++++++++++
 Javascript作成時 デバッグ用ウインド表示
    Debug.log(str[text:表示文字列],text[boolean:テキスト表示 or HTML表示(標準)]);
  スクリプトの処理速度計測
    Debug.time();               測定開始
    Debug.time("文字列[text]"); 測定停止
*/
// コンストラクタ
function Debug() {
    // クラス情報
    this.MODULENAME  	= "Debug";
    this.VERSION     	= 0.10; // バージョン
    this.MODULE      	= true; // モジュールの有無チェック用 Debug.MODULE
    this.TEST        	= false;// Debug.testの表示
		this.NUM					= 1; 			
}
// メソッド
Debug.prototype = {
    time : function(point) { // public (point:String):void
        var date = new Date();
        var mSec = date.getTime();
        if (!point) {
          Debug.timePoint = mSec;
        } else {
          Debug.log(point+":"+(mSec-Debug.timePoint));
        }
    },

    log : function(str, text) { // public (str:String, text:Boolean):void
			$("DEBUG_BOX").style.visibility='visible';
			if (text) {
					document.getElementById("DEBUG_LOG").insertAdjacentText("BeforeEnd",this.NUM+"&gt;" + str.escHTML() + "\n");
			} else {
					document.getElementById("DEBUG_LOG").insertAdjacentHTML("BeforeEnd",this.NUM+"&gt;" + str + "<br />");
			}
			document.getElementById("DEBUG_LOG").scrollTop = $("DEBUG_LOG").scrollHeight;
			this.NUM++;
    },

    test : function(str, text) { // デバッグ時の表示
        if(this.TEST){ this.log(str, text);}
    },
		
		alert : function(text) {
			alert(text);
    },
		//Debug.dblclick()
		dblclick : function(){
			document.getElementById("DEBUG_LOG").innerHTML='';
			document.getElementById("DEBUG_BOX").style.visibility='hidden';
			this.NUM = 1;
		}
}
Debug = new Debug();





/*++++++++++++++++++++++++++++++++
+ document.getElementById(targetID)クラス拡張
++++++++++++++++++++++++++++++++++
 $(targetID) targetID:[String|Object]
 document.getElementById(targetID); → $(targetID)
 文字列のセット
   $(targetID).setText(srcText);
   formへの値のセットは $(targetID).value = value;
 文字列の取得
   $(targetID).getText();
   formへの値の取得は value = $(targetID).value;
 ドキュメント高さ・幅・位置の取得
   var size  = $(targetID).getSize(); size.width; size.height;
   var point = $(targetID).getPoint(); point.top; point.left;
 ドキュメント高さ・幅・位置の設定
   $(targetID).setSize(width,height)
   $(targetID).setPoint(left,top);
*/

function $(targetID) { // public (targetID:String||Object):Object

    var targetObj = (typeof(targetID) == "object") ? targetID : document.getElementById(targetID);
    if (!targetObj) {
      //(typeof(targetID) == "object") ? Debug.log("$ Class Err:Not Found Object"): Debug.log("$ Class Err:Not Found Target :"+targetID);
      return null;
    }

    targetObj.getText = function() { // public ():String
        return (isFirefox || isOpera || isMozilla) ?  targetObj.textContent : targetObj.innerText;
    },

    targetObj.setText = function(srcText) { // public ():void
        if (isFirefox || isOpera || isMozilla) {
            targetObj.textContent = srcText;
        } else {
            targetObj.innerText = srcText;
        }
    },

    targetObj.getHTML = function() { return targetObj.innerHTML; }, // public ():String

    targetObj.setHTML = function(srcHTML) { targetObj.innerHTML = srcHTML; }, // public (srcHTML:String):String

    targetObj.getSize  = function(){ return {"width":targetObj.clientWidth, "height":targetObj.clientHeight} }, // public ():Object

    targetObj.getPoint = function(){ // public ():Object
        var left = 0, top = 0, tmpObj =targetObj;
        while(tmpObj){
            left += tmpObj.offsetLeft;
            top  += tmpObj.offsetTop;
            tmpObj = tmpObj.offsetParent;
        }
        return {"left":left,"top":top};
    },

    targetObj.setSize  = function(width, height) { // public (width:int, height:int):void
        targetObj.style.width  = width +"px";
        targetObj.style.height = height +"px";
    },

    targetObj.setPoint = function(left, top) { targetObj.style.left = left +"px"; targetObj.style.top = top +"px"; } // X,Y

    return targetObj;
}





/*+++++++++++++++++++++++++++++++++
+ ブラウザ情報取得 (クロスブラウザ対応)  getBrowser
+++++++++++++++++++++++++++++++++++
 ブラウザのスクロール量
   getBrowser.top();
   getBrowser.left();
 ブラウザのウインドウサイズ
   getBrowser.height();
   getBrowser.width();
 bodyサイズ
   getBrowser.bodyHeight();
   getBrowser.bodyWidth();
*/
// コンストラクタ
function getBrowser() {
    // クラス情報
    this.MODULENAME = "getBrowser";
    this.VERSION    = 1.00;
    this.MODULE     = true;
}
// メソッド
getBrowser.prototype = {
    // クライアント領域上左の座標 // int
    top    : function() { return document.documentElement.scrollTop || document.body.scrollTop; }, // public():int
    left   : function() { return document.documentElement.scrollLeft || document.body.scrollLeft; }, // public():int
    height : function() { return document.documentElement.clientHeight || document.body.clientHeight; }, // public():int
    width  : function() { return document.documentElement.clientWidth || document.body.clientWidth; }, // public():int
    bodyHeight : function() { return document.body.scrollHeight || document.documentElement.scrollHeight; }, // public():int
    bodyWidth  : function() { return document.body.scrollWidth || document.documentElement.scrollWidth; } // public():int
}
getBrowser = new getBrowser();







/*+++++++++++++++++++++++++++++++++
+ CSS情報取得/追加 css
+++++++++++++++++++++++++++++++++++
document.styleSheets[0]←リンクされた順<link rel="stylesheet" type="text/css" href="" /><!-- 0 -->
document.styleSheets.length-1 : CSSクラス用のCSS
css設定追加 （追加のみ　後記の方が適用されるため）
	onclick="css.set('.loginState','background-color:#FFBFBF;')"
  css.set('.submit','background-color:#FFBFBF;')"

css設定取得
  css.get( "div.hoge", "background" )
*/
// コンストラクタ
function css() {
    // クラス情報
    this.MODULENAME = "css";
    this.VERSION    = 1.00;
    this.MODULE     = true;
}
// メソッド
css.prototype = {
  // css設定追加 
  set : function( target, property ) {
		// <!--  CSSクラス用オブジェクト -->
		var cssStyleSheets = window.document.styleSheets[document.styleSheets.length-1] ;
		if(isIE) { //IE			
			cssStyleSheets.addRule( target, property );
		} else {    
			cssStyleSheets.insertRule( target + "{" +property+ "}", cssStyleSheets.cssRules.length );
		}
  },
    
  // get( "div.hoge", "background" )
  get : function ( target, property ) {
		var cssStyleSheets = window.document.styleSheets[document.styleSheets.length-1] ;
		var stylesheets = cssStyleSheets.rules || cssStyleSheets.cssRules;  //IE||Mozilla
		 
		for( var i = 0, len = stylesheets.length; i < len; i++ ) {
			var cssStyle = stylesheets[i];
			if( cssStyle.selectorText.toLowerCase( ) == target.toLowerCase( ) ){
			return cssStyle.style[ property ];
			}
		 }
	 
  }
  
}
css = new css();






/*++++++++++++++++++++++++++++++++
+ Eventクラス
++++++++++++++++++++++++++++++++++
 Objectにファンクションを追加 setEvent[click, mouseover, mouseout, mousedown, mouseup, mousemove]
   Event.add    (target:Object, setEvent:String, addFunction:StringFunction, useCapture:Boolean); 内容可視
   Event.attach (target:Object, setEvent:String, addFunction:Function, useCapture:Boolean);  内容不可視
   Event.observe(target:Object, setEvent:String, addFunction:Function);  this使用可能
 targetIDからファンクションを削除
   Event.del(target:Object, setEvent:String, delFunction:StringFunction); delFunctionの設定なしで全ファンクション削除
   Event.detach(target:Object, setEvent:String, delFunction:Function);
 MEMO:
   オブジェクト.addEventListener(イベント,ファンクション,[useCapture]=>追加順序？ IE以外
  false 追加した最後の物から 例1(f)+2(f)+3(f)+4(f)→実行順序 4,3,2,1 attachEvent(IE)はこれのみ
   true  優先的に実行例1(f)+2(t)+3(f)+4(t)→実行順序 2,4 |←true[FIFO] false[LIFO]→| 3,1
   useCapture  trueとfalseは別物 (attach)trueに対して(detach)falseではdetachできない[detach(true)でdetach]
   this等使用する場合は Event.observe();
   void(Event.attach(element,"mouseover",new Function("LayerBox.up('"+key+"')")));//○
   var upFunction  = new Function("LayerBox.up('"+key+"')"); void(Event.attach(element,"mouseover",upFunction));//○
   void(Event.attach(element,"mouseover",new Function("LayerBox.up(this)")));//FF○ IE×
   void(Event.observe(element,"mouseover",new Function("LayerBox.up(this)")));//○
   void(Event.attach(element,"mouseover",function(){LayerBox.up(key)}));//×
   void(Event.attach(element,"mouseover",(function(){LayerBox.up(key)})));//○×

      //Event.attach
    var setEvent    = 'mouseover';
    var addFunc = new Function('LayerBox.mouseover("'+key+'")');
    void(Event.attach(element, setEvent, addFunc));

*/
// コンストラクタ
function Event() {
  // モジュール情報
  this.MODULENAME = "Event";
  this.VERSION    = 0.10;
  this.MODULE     = true;
}
// メソッド
Event.prototype = {
    add : function(targetObj, setEvent, addFunc, useCapture) {
    // public (target:Object, setEvent:String, addFunc:String, useCapture:Boolean)
        setEvent = "on" + setEvent.replace(/on/, "");
        var getFunc = targetObj.getAttribute(setEvent) || "";
        getFunc = getFunc.toString();
        // すでにあれば追加しない
        var reg = new RegExp(escape(addFunc), "gi");
        if (escape(getFunc).match(reg)) { return; }
        // 設定されているファンクション
        if (getFunc) { // IE5.5-7用
          var sliceSTA = getFunc.indexOf("{");
          var sliceEND = getFunc.lastIndexOf("}");
          if (sliceSTA > 0 && sliceEND > 0) { getFunc = getFunc.slice(sliceSTA+1, sliceEND); }
        }
        // function追加
        if (useCapture) { getFunc = getFunc + addFunc + ";"; } else { getFunc = addFunc + ";" + getFunc; }
        // 各ブラウザ対応
        if (is_IE7){
            targetObj.setAttribute(setEvent, new Function(getFunc));
        } else {
            targetObj.setAttribute(setEvent, getFunc);
        }
    },

    del : function(targetObj, setEvent, delFunc) {
    // public (targetObj:Object, setEvent:String, delFunc:String)
        setEvent = "on" + setEvent.replace(/on/,"");
        var getFunc = targetObj.getAttribute(setEvent) || "";
        if (!getFunc) { return; }  // 空処理
        if (!delFunc) { targetObj.removeAttribute(setEvent); return; } // ファンクションの全削除
        getFunc = getFunc.toString();
        // 設定されているファンクション
        if (getFunc) { // IE5.5-7用
          var sliceSTA = getFunc.indexOf("{");
          var sliceEND = getFunc.lastIndexOf("}");
          if (sliceSTA > 0 && sliceEND > 0) { getFunc = getFunc.slice(sliceSTA+1, sliceEND); }
        }
        var reg = new RegExp(escape(delFunc + ";"),"gi");
        getFunc = unescape(escape(getFunc).replace(reg,"")); // ファンクションの削除
        // 各ブラウザ対応
        if (is_IE7) {
            targetObj.setAttribute(setEvent, new Function(getFunc));
        } else {
            targetObj.setAttribute(setEvent, getFunc);
        }
    },

    attach : function(targetObj, setEvent, addFunc, useCapture) {
    // public (targetObj:Object, setEvent:String, delFunc:String, useCapture:Boolean)
        setEvent    = setEvent.replace(/on/,"");
        if (isIE) {
            targetObj.attachEvent("on" + setEvent, addFunc);
        } else {
            targetObj.addEventListener(setEvent, addFunc, useCapture);
        }
    },

    detach : function(targetObj, setEvent, delFunc, useCapture) {
    // public (targetObj:Object, setEvent:String, delFunc:String, useCapture:Boolean)
        setEvent = setEvent.replace(/on/,"");
        if (isIE) {
            targetObj.detachEvent("on" + setEvent, delFunc);
        } else {
            targetObj.removeEventListener(setEvent, delFunc, useCapture);
        }
    },

    observe : function(targetObj, setEvent, addFunc, useCapture) {
    // public (targetObj:Object, setEvent:String, addFunc:String, useCapture:Boolean)
        setEvent = setEvent.replace(/on/,"");
        if (isIE) {
            targetObj.attachEvent("on" + setEvent, function() { addFunc.call(targetObj, window.event); } );
        } else {
            targetObj.addEventListener(setEvent, addFunc, useCapture);
        }
    }
}
Event = new Event();




/*+++++++++++++++++++++++++++++++
+ Func クラス
+++++++++++++++++++++++++++++++++
 IME制御
    Func.IME(Boolen);
 パスワード生成
    Func.rndString(uint); 初期8文字
    Func.rnd(uint)      ; 初期8文字数字
 オブジェクトの結合（追加）
    Func.extend(object1,object2);
 オブジェクト→JSON形式変換(エンコード済み)
    Func.toJSON(object1);
    object → JOSN形式 {"":"","":""}.URLencode()
  SWFの書き出し（OPERAのFLASH対策用）
   var object={"src":"","id":"","width":"","height":"","quality":"","value":"","classid":true/false};
   Func.writeSWF(object);
*/
// コンストラクタ
function Func(){
    // モジュール情報
    this.MODULENAME = "Func";
    this.VERSION    = 0.10; // バージョン
    this.MODULE     = true; // モジュールの有無チェック用 Layer.MODULE
}
// メソッド
Func.prototype = {
    IME : function(set) {
      // public (set:boolean):void
      set = (set) ? "true" : "";
      void(AJAX.IME(set));
    },

    rndString : function(len) {
      // public (len:uint):String
      var charList = "abcdefghjklmnpqrstuvwxyz";
      charList += "ABCDEFGHJKLMNPQRSTUVWXYZ";
      charList += "123456789";
      len = len || "8";
      var i;
      var password = "";
      var num = charList.length;
      for (i = 0; i < len; i++) { password += charList.charAt(Math.floor(Math.random() * num)); }
      return password;
    },

    rnd : function(len) {
      len = len || "8";
      var i;
      var password = "";
      for (i = 0; i < len; i++) { password += Math.floor(Math.random()*10); }
      return password;
    },

    extend : function(obj1,obj2) {
      // public (obj1:object,obj2:object):Object
      for (var key in obj2) { obj1[key] = obj2[key]; }
      return obj1;
    },

    writeSWF : function(object) {
      document.open();
      document.write('<object ');
      document.write('data="'+object["src"]+'" ');
      document.write('id="'+object["id"]+'" ');
      document.write('width="'+object["width"]+'" ');
      document.write('height="'+object["height"]+'" ');
      document.write('type="application/x-shockwave-flash" ');
      document.write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" ');
      if(object["classid"]){ document.write('classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');}
      document.write('>');
      document.write('<param name="movie" value="'+object["src"]+'" />');
      document.write('<param name="quality" value="'+object["quality"]+'" />');
      document.write('<param name="wmode" value="opaque" />');
      document.write('<param name="FlashVars" value="'+object["value"]+'" />');
      document.write('</object>');
      document.close();
    }
}
Func = new Func();




/*++++++++++++++++++++++++++++++++
+ eMouseクラス
++++++++++++++++++++++++++++++++++
 マウスに追従するイベント
 mousemove click mousedown mouseup mousewheel

 MOUSE_ALT表示 eMouse.alt(str[String]);
*/
// コンストラクタ
function eMouse(){
    // クラス情報
    this.MODULENAME = "eMouse";
    this.VERSION    = 0.10; // バージョン
    this.MODULE     = true; // モジュールの有無チェック用 eMouse.MODULE
    // 初期設定
    this.OFFSSET_X = 10;
    this.OFFSSET_Y = 10;
    // 変数設定
    this.x      = 0;  // マウスX位置      // eMouse.x
    this.y      = 0;  // マウスY位置      // eMouse.y
    this.downX  = 0;  // マウスダウン位置 // eMouse.downX
    this.downY  = 0;  // マウスダウン位置 // eMouse.downY
    this.upX    = 0;  // マウスアップ位置 // eMouse.upX
    this.upY    = 0;  // マウスアップ位置 // eMouse.upY
    this.dragX  = 0;  // X軸ドラッグ幅    // eMouse.dragX
    this.dragY  = 0;  // Y軸ドラッグ幅    // eMouse.dragY
}
//メソッド
eMouse.prototype = {
    // onmousemove eMouse.move
    move : function(e) { // private (e:Event):void
        eMouse.x = eMouse.getMouseX(e); // X位置
        eMouse.y = eMouse.getMouseY(e); // Y位置
        $("MOUSE_ALT").setPoint(eMouse.x + eMouse.OFFSSET_X, eMouse.y + eMouse.OFFSSET_Y);
        // eMouse.alt(eMouse.x+":"+eMouse.y);
    },
    // onclick eMouse.click
    click : function(e) {}, // private (e:Event):void
    // onmousedown eMouse.down
    down : function(e) { // private (e:Event):void
        eMouse.dragX = 0;
        eMouse.dragY = 0;
        eMouse.downX = eMouse.x; //マウスダウンX位置取得
        eMouse.downY = eMouse.y; //マウスダウンY位置取得
        Event.attach(document, "mousemove", eMouse.drag);
    },
    // onmouseup eMouse.up
    up : function(e) { // private (e:Event):void
        eMouse.upX = eMouse.x;   //マウスアップX位置取得
        eMouse.upY = eMouse.y;   //マウスアップY位置取得
        Event.detach(document, "mousemove", eMouse.drag);
    },
    // Drag eMouse.drag
    drag : function(e) { // private (e:Event):void
        eMouse.dragX = eMouse.x - eMouse.downX;  //X軸ドラッグ幅
        eMouse.dragY = eMouse.y - eMouse.downY;  //Y軸ドラッグ幅
    },
    // onmousewheel // eMouse.wheel
    wheel : function(e){ // private (e:Event):void
        if(e.wheelDelta){
          if (isOpera == 1) {
              delta = -e.wheelDelta/40; //Opera
          } else if (isChrome == 1) {
              delta = e.wheelDelta/240; //Chorome
          } else {
            delta = e.wheelDelta/120; //Safari IE
          }
        }else if (e.detail) {
          delta = -e.detail/3; //Firefox -/3
        }
        eMouse.alt("detai:"+ delta);
    },
    // MOUSE_ALT表示
    alt : function(str) { $("MOUSE_ALT").setHTML(str); }, // private (str:String):void
    // 初期表示
    writeElement : function() {
        // MOUSE_ALT // マウス右下トレース $("MOUSE_ALT") CSS
        var Childwrite  = document.createElement("div");
        Childwrite.setAttribute("id","MOUSE_ALT");
        document.body.appendChild(Childwrite);
    },
    // 初期化
    initialize : function() { // private ():void
        eMouse.writeElement(); // Element書き込み
        if (isIE) { // IE
          eMouse.getMouseX = function(e){ return getBrowser.left()+event.clientX; } // マウスX位置取得
          eMouse.getMouseY = function(e){ return getBrowser.top() +event.clientY; } // マウスY位置取得
        } else {
          eMouse.getMouseX = function(e){ return e.pageX; } // マウスX位置取得
          eMouse.getMouseY = function(e){ return e.pageY; } // マウスY位置取得
        }
        // イベント追加
        Event.attach(document, "mousemove", eMouse.move);
        Event.attach(document, "mousedown", eMouse.down);
        Event.attach(document, "mouseup", eMouse.up);
        //Event.attach(document,"click"     ,eMouse.click);
        //if(isFirefox || isMozilla){ window.addEventListener("DOMMouseScroll",eMouse.wheel,false);}//Firefox
        //else{ Event.attach(document,"mousewheel",eMouse.wheel);}//IE6- Safari Opera9
    }
}
eMouse = new eMouse();
eMouse.initialize();






/*++++++++++++++++++++++++++++++++
+ 文字エフェクト/一括エフェクト操作クラス  Effect
++++++++++++++++++++++++++++++++++
 エフェクト全般処理 On/Off
    Effect.EffectCheck();
 マウスイベントによるエフェクト 背景色 文字色
    Effect.mOverBackground([object].color[#******|null(初期設定色)])
    Effect.mOutBackground([object].color[#******|null(初期設定色)])
    Effect.mOverText([object].color[#******|null(初期設定色)])
    Effect.mOutText([object].color[#******|null(初期設定色)])
 通常利用時は
 基本的にcssQueryを使用する
 class="efectBack efectText" efectText = "#000000" efectBack = "#000000" (マウスオーバー時の色)
*/
// コンストラクタ
function Effect() {
    // クラス情報
    this.MODULENAME = "Effect";
    this.VERSION    = 0.10; // バージョン
    this.MODULE     = true; // モジュールの有無チェック用 Layer.MODULE
    // 初期設定
    this.check = true;         // 初期設定ON
    this.mOverBackgroundColor = "#D0FFD0";
    this.mOverTextColor       = "#D0FFD0";
}
// メソッド
Effect.prototype = {
    EffectCheck : function() { // public ():void
        Effect.check = !Effect.check;
        $("Effect").checked = Effect.check;
        // 追加エフェクトOn/Off処理
        SmoothScroll.effectCheck(Effect.check); // スムーススクロール
        LayerEffect.effectCheck(Effect.check);  // レイヤーアルファ
    },
    mOverBackground : function(obj, color) { // private (obj:Object, color:String):void
        obj.style.backgroundColor = (color && color.match(/^#[0-9|A-F]{6}/gi)) ? color : Effect.mOverBackgroundColor;
    },
    mOutBackground : function(obj, color) { // private (obj:Object, color:String):void
        obj.style.backgroundColor = (color && color.match(/^#[0-9|A-F]{6}/gi)) ? color : "";
    },
    mOverText : function(obj, color) { // private (obj:Object, color:String):void
        obj.style.color = (color && color.match(/^#[0-9|A-F]{6}/gi)) ? color : Effect.mOverTextColor;
    },
    mOutText : function(obj, color) { // private (obj:Object, color:String):void
        obj.style.color = (color && color.match(/^#[0-9|A-F]{6}/gi)) ? color : "";
    }
}
Effect = new Effect();



/*++++++++++++++++++++++++++++++++++
+ JSONクラス
++++++++++++++++++++++++++++++++++++
  var JSON_String=json.encode(JSON_Object);[Object]→JSON[String]
  var JSON_Object=json.decode(JSON_String);JSON[String]→[Object]
  MEMO:JSONの仕様だと文字列はダブルクオーテーションで括る
*/
function json() {
    // クラス情報
    this.MODULENAME = "json";
    this.VERSION    = 0.10; // バージョン
    this.MODULE     = true; // モジュールの有無チェック用
}
// メソッド
json.prototype = {
  //json.encode(Object);
  encode : function(JSON_Object) { //[Object]→JSON[String]
    //var myJSONText = JSON.stringify(myObject, replacer);
    return JSON.stringify(JSON_Object); // iframe safari対策
    //FLASH利用時↑コメントアウト
    if (typeof(JSON_Object) != "object") { Request.err("encode() : Not Object data"); return;}
    try {
      JSON_String = AJAX.JSON_encode(JSON_Object);
      return JSON_String;
    } catch (error) {
      Debug.log("json.encode Err:"+error);
    }
  },

  //json.decode('{"JSON":"String"}');
  decode : function(JSON_String){//JSON[String]→[Object]
    //var myObject = JSON.parse(myJSONtext, reviver);
    return JSON.parse(JSON_String); // ifarame safari対策
    //FLASH利用時↑コメントアウト
    if (typeof(JSON_String) != "string") { Request.err("decode() : Not string data"); return;}
    try {
      JSON_Object = AJAX.JSON_decode(JSON_String);
      return JSON_Object;
    } catch (error) {
      Debug.log("json.decode Err:"+error);
    }
  },

  // エラー表示
  Err : function(str) { Debug.log("json Class Err: "+ str); } // private (str:String):void
}
json = new json();
// 大文字JSONはjson2.jsで使用






/*++++++++++++++++++++++++++++++++
+ addEventListenerクラス
++++++++++++++++++++++++++++++++++
各規定のイベントから addEventListener.[MODULENAME].[addEvent] を呼び出す
例：Request.openHandler→addEventListener.Request.openHandler経由で呼び出し
addEventListener.[MODULENAME].[addEvent]を変更することで追従実行ができる
*/
// addEventListener.Requestを編集して、各動きを設定
function addEventListener(){
  //クラス情報
  this.MODULENAME = "addEventListener";
  this.VERSION    = 0.10; //バージョン
  this.MODULE     = true; //モジュールの有無チェック用 Request.MODULE
}
addEventListener.prototype = {
  //FLASHから呼び出されるイベント
  openHandler          : function(event) { Request.openHandler(event);},
  completeHandler      : function(event) { Request.completeHandler(event);},
  progressHandler      : function(event) { Request.progressHandler(event);},
  securityErrorHandler : function(event) { Request.securityErrorHandler(event);},
  httpStatusHandler    : function(event) { Request.httpStatusHandler(event);},
  ioErrorHandler       : function(event) { Request.ioErrorHandler(event);},

  upload_selectHandler            :function(event) { file_upload.selectHandler(event);},
  upload_openHandler              :function(event) { file_upload.openHandler(event);},
  upload_progressHandler          :function(event) { file_upload.progressHandler(event);},
  upload_completeHandler          :function(event) { file_upload.completeHandler(event);},
  upload_uploadCompleteDataHandler:function(event) { file_upload.uploadCompleteDataHandler(event);},
  upload_cancelHandler            :function(event) { file_upload.cancelHandler(event);},
  upload_httpStatusHandler        :function(event) { file_upload.httpStatusHandler(event);},
  upload_ioErrorHandler           :function(event) { file_upload.ioErrorHandler(event);},
  upload_securityErrorHandler     :function(event) { file_upload.securityErrorHandler(event);},



  set : function(MODULENAME){
    //イベントリスナー設定 new Function("e", MODULENAME+".ioErrorHandler(e);");
    addEventListener[MODULENAME] = {};
    addEventListener[MODULENAME].openHandler          = new Function();
    addEventListener[MODULENAME].completeHandler      = new Function();
    addEventListener[MODULENAME].progressHandler      = new Function();
    addEventListener[MODULENAME].securityErrorHandler = new Function();
    addEventListener[MODULENAME].httpStatusHandler    = new Function();
    addEventListener[MODULENAME].ioErrorHandler       = new Function();
  },

    set_upload : function(MODULENAME){
    //イベントリスナー設定 new Function("e", MODULENAME+".ioErrorHandler(e);");
    addEventListener[MODULENAME] = {};
    addEventListener[MODULENAME].selectHandler            = new Function();   
    addEventListener[MODULENAME].openHandler              = new Function(); 
    addEventListener[MODULENAME].progressHandler          = new Function();   
    addEventListener[MODULENAME].completeHandler          = new Function();
    addEventListener[MODULENAME].uploadCompleteDataHandler= new Function();   
    addEventListener[MODULENAME].cancelHandler            = new Function();
    addEventListener[MODULENAME].httpStatusHandler        = new Function();
    addEventListener[MODULENAME].ioErrorHandler           = new Function();
    addEventListener[MODULENAME].securityErrorHandler     = new Function();
  }
}
addEventListener = new addEventListener();
///////////////////////////////////////////////////////////////////////////////



/*++++++++++++++++++++++++++++++++++++++++++++++++
+ uploadクラス(ファイルの非同期読み込み FLASH)
++++++++++++++++++++++++++++++++++++++++++++++++++
[メソッド]

[イベント]
cancel    :ファイル参照ダイアログボックスをキャンセルしたとき
complete  :ダウンロードが完了、またはアップロードで HTTP ステータスコード 200 が生成された場合
httpStatus:アップロードに失敗し、HTTP ステータスコードを使用して失敗を記述することができない場合
ioError   :アップロードまたはダウンロードが失敗したとき
open      :アップロード処理またはダウンロード処理が開始するとき
progress  :ファイルのアップロード処理中またはダウンロード処理中に定期的に
securityError:
  サーバーにファイルをアップロードするか、
  呼び出し元のセキュリティサンドボックスの外部にあるサーバーからファイルを取得しようとした時
select    :ファイル参照ダイアログボックスから選択したとき
uploadCompleteData  アップロードの正常終了後、サーバーからデータを受信したとき
*/
function file_upload(){
  //クラス情報
  this.MODULENAME = "file_upload";
  this.VERSION    = "0.10beta"; //バージョン
  this.MODULE     = true; //モジュールの有無チェック用 Request.MODULE
  //[プロパティ]
}
file_upload.prototype = {

  cancelHandler : function(event){
    Debug.test("file_upload.cancelHandler");
    //addEventListener.file_upload.cancelHandler(event);
  },

  completeHandler : function(event){
    Debug.test("file_upload.completeHandler");
    //addEventListener.file_upload.completeHandler(event);
  },

  uploadCompleteDataHandler : function(event){
    Debug.test("file_upload.uploadCompleteDataHandler");
				
		//戻り値はJSON	{"cord",["",""]}			
		var data = json.decode(event.data); // JSON文字列→Object 
		var cord = data.cord;// cord:配列表記
		
		//Debug.test("data : "+ json.encode(data));
		//Debug.test("cord : "+ typeof(cord));				
		for (var script in cord){			
		 	new function(){ eval(cord[script]);}
			Debug.test("cord END : "+ cord[script]);
		}

    //addEventListener.upload.uploadCompleteDataHandler(event);
  },
  
  httpStatusHandler : function(event){
    Debug.test("file_upload.httpStatusHandler :"+ event.status);
    //addEventListener.upload.httpStatusHandler(event);
  },

  ioErrorHandler : function(event){
    Debug.log("file_upload.ioErrorHandler :" + event.text);
    //addEventListener.upload.ioErrorHandler(event);
  },

  openHandler : function(event){
    Debug.test("file_upload.openHandler");
    //addEventListener.upload.openHandler(event);
  },

  progressHandler : function(event){
    Debug.test("file_upload.progressHandler :"+ event.bytesLoaded + "/" + event.bytesTotal);
    //addEventListener.upload.progressHandler(event);
  },

  securityErrorHandler : function(event){
    Debug.log("file_upload.securityErrorHandler :"+ event.text);
    //addEventListener.upload.securityErrorHandler(event);
  },

  selectHandler : function(event){
    Debug.test("file_upload.selectHandler");
		//var src = '<img src="/common/imgico/ajax-loader2.gif" width="220" height="19" alt="img" />';
		//Layer.inner(src, "ajax-loader", {});
    //addEventListener.upload.selectHandler(event);
  },

  //イベントリスナーここまで

  // 進行中のロード操作は直ちに終了します。
  close : function() {
    //void(AJAX.Request_close());
  },
  // エラー表示
  err   : function(str)  { Debug.log("file_upload Class Err: "+ str); } // private (str:String):void}

}
//イベントリスナー設定
addEventListener.set_upload("file_upload");
file_upload = new file_upload();







/*++++++++++++++++++++++++++++++++++
+ formクラス
++++++++++++++++++++++++++++++++++++
<form id="test_regist" name="test_regist" action="/module/null.php">   
  *必須<input type="hidden" name="statement" value="test_regist" />
	
	<select name="pre" style="width:70px; overflow:auto" >
		<option selected="selected"> 連絡 </option><option> 告知 </option><option> 重要 </option>
	</select>
	<textarea name="testmsg" cols="100" rows="4" id="testmsg" style=" width:500px; height:80px; overflow-y: scroll;{-$login_bg_color-};" 		
		onfocus="Func.IME(1)">test</textarea>
	<input name="submit" type="button" class="submit" id="submit" style="width:100px"
  	onclick="sendform.set('test_regist','module_sendform.php')" value="送信" />
</form>

[メソッド]
formの内容をAJAX経由でPOSTする（テキストオンリー）Requestクラスの応用

	sendform.send(formID[String], actionFileName[String], configure[Object]):void
    formID[String]:必須
      送信するformID
    actionFileName[String]:必須
      受信するファイル
    configure:[Object]
      [Requestクラス継続]
      configure.key     :[String] リクエストkey
      [クラス内変数]
      configure.type    :0:eval 1:?

[生成されるオブジェクト]
  sendform[key] = {};
  sendform[key].formID 					:[String] 送信されるFormID
	sendform[key].actionFileName	:[String] POSTを受け取るファイル
	sendform[key].data     				:[Object] 送信されるdata
	sendform[key].configure				:[Object] configureデータ

[イベント]
open      : 処理開始
complete  : 受信したすべてのデータがデコードされて URLLoader オブジェクトの data プロパティへの格納が完了
httpStatus: HTTP 経由でデータへのアクセスを試みたときに その要求のステータスコードを検出
ioError   : 呼び出し時に致命的なエラーが発生してダウンロードが終了した場合。
progress  : ダウンロード処理を実行中にデータを受信したときに送出されます。
securityError :呼び出しによってセキュリティサンドボックスの外部にあるサーバーからデータをロードしようとすると送出			
*/
function sendform() {
    // クラス情報
    this.MODULENAME = "sendform";
    this.VERSION    = 0.10; // バージョン
    this.MODULE     = true; // モジュールの有無チェック用
}
// メソッド
sendform.prototype = {
  set : function(formID, actionFileName, configure){

		Debug.test("sendform.set :"+formID +" : "+actionFileName);

    // 引数チェック
    if (!formID) { sendform.err("set() : Not set formID"); return;}
    if (formID && !$(formID)){  Layer.err('set() Not Found $(formID) :') + formID; return;}
    if (!configure) { configure = new Object();}
    if (typeof(configure) != "object") { Layer.err("set() : Not Object configure"); return;}		
		
		// form内データのオブジェクト化		
		var data = new Object;
		var target = $(formID);
		
		for (var i = 0; i < target.length; i++) {
		
			switch(target.elements[i].type) {
			
				case "checkbox":
					if(!checkbox) {	var checkbox = new Array();	}
					if(!checkbox[target.elements[i].name]) { checkbox[target.elements[i].name] = new Array();}
			　　// チェックボックスがONの時はその値を設定する。
			　　if (target.elements[i].checked == true) {
						checkbox[target.elements[i].name].push(target.elements[i].value);	　　
					}
					data[target.elements[i].name] = checkbox[target.elements[i].name];
					break;
					
				case "radio":
			　　if (target.elements[i].checked == true) {
						data[target.elements[i].name] = target.elements[i].value;　　
					}			
					break;
					
				case "select-one":
					for(var j=0; j < target.elements[i].options.length; ++j){
						if(target.elements[i].options[j].selected == true){
							data[target.elements[i].name] = target.elements[i].options[j].value;
						}
					}				
					break;
					
				case "select-multiple":
	
					if(!select_multiple) {	var select_multiple = new Array();	}
					if(!select_multiple[target.elements[i].name]) { select_multiple[target.elements[i].name] = new Array();}
					
					for(var j=0; j < target.elements[i].options.length; ++j){
						if(target.elements[i].options[j].selected == true){
							select_multiple[target.elements[i].name].push(target.elements[i].options[j].value);	
						}
					}		
					data[target.elements[i].name] = select_multiple[target.elements[i].name];
					break;
					
				case "button":	break;
				case "submit":	break;
				case "reset" :	break;
					
				default:
					data[target.elements[i].name] = target.elements[i].value;
			}
		}
		
    // configure補正
    configure.key     = configure.key  || crc.hex(formID);
    configure.type    = configure.type || 0;//

    // クラス内変数設定(注意:サーバには送信されない)
    var key = configure.key;
    sendform[key] = new Object();
    sendform[key].formID 					= formID;
    sendform[key].actionFileName	= actionFileName;
    sendform[key].data     				= data;
    sendform[key].configure				= configure;		

    // 二重送信対策
		sendform[key].sendFlag				= sendform[key].sendFlag || false;		
    if (sendform[key].sendFlag && !configure.noCache){
      Debug.log("sendform.send():送信中　または　送信み済みです");
      return;
    }
	
		//イベントリスナー設定 / 書き換え
    //addEventListener.set("sendform");
    addEventListener.Request.openHandler     = new Function("e", "sendform.openHandler(e);");
    addEventListener.Request.completeHandler = new Function("e", "sendform.completeHandler(e);");
		
		Debug.test("sendform.data :"+json.encode(data));
    // Request.load(fileName[String], data[Object], configure[Object]);
    Request.load(actionFileName, data, configure);
		/*
		Request.load(fileName[String], data[Object], configure[Object]);
		fileName:[String]  リクエストされる URL
		data:[Object]  URLリクエストで送信されるデータオブジェクト
		configure:[Object]  configure.key[String] : リクエストkey
		*/
  },

  /*
  イベントリスナー
    event.target[Object]
    event.target.data // 読み込みソースutf-8
    event.target.configure // [Object] : Request時のconfigure[Object]情報
    event.target.configure.key  : [String] リクエストkey
  */
  // 読み込み開始前処理 Layer.requestStart
  openHandler : function(event) {
      Debug.test("sendform.openHandler");
			sendform[key].sendFlag = true; // 送信中			
      addEventListener.sendform.openHandler(event);
  },
  // 終了 Layer.requestEnd
  completeHandler : function(event) {     
      //addEventListener.Requestリセット
      addEventListener.set("Request");

      //読み込んだソース
      var src = event.target.data;
			
      // クラス内変数呼び出し
      var key = event.target.configure.key;
      var configure = sendform[key].configure;// configure

      // 二重送信対策解除
      sendform[key].sendFlag = false; // 送信完了
			
 			Debug.test("sendform.completeHandler");
			
			switch(configure.type) { // ターゲット場所設定
				case 0: 
					//戻り値はJSON	{"cord",["",""]}			
					var data = json.decode(event.target.data); // JSON文字列→Object 
					var cord = data.cord;// cord:配列表記					
					for (var script in cord){			
						new function(){ eval(cord[script]);}
						Debug.test("cord END : "+ cord[script]);
					}				
					break;
				default:  Debug.log(event.target.data);
			}
      // addEventListener実行
      addEventListener.Layer.completeHandler(event);
  },
	
  // エラー表示
  Err : function(str) { Debug.log("sendform Class Err: "+ str); } // private (str:String):void
}
addEventListener.set("sendform");
sendform = new sendform();







/*++++++++++++++++++++++++++++++++++++++++++++++++
+ Requestクラス(ファイルの非同期読み込み FLASH)
++++++++++++++++++++++++++++++++++++++++++++++++++
[メソッド]
 Flash内からjsvascriptを実行する
  Request.javascript(code);

 ファイルの読み込み
  Request.load(fileName[String], data[Object], configure[Object]);
  fileName:[String]
    リクエストされる URL
  data:[Object]
    URLリクエストで送信されるデータオブジェクト
      url_Variables.data     = data;
      url_Variables.fileName = fileName;      // [自動追加]
      url_Variables.key      = configure.key; // [自動追加]
      ↓
      [PHP]
      $POST     = json_decode($_POST["data"]); //[object]  JSON→Object
      $data     = $POST->data;      // [Object] 送信データ
      $key      = $POST->key;       // [String] 読み込みファイルkey
      $fileName = $POST->fileName;  // [String] リクエストされるファイルURL
  configure:[Object]
      configure.key[String]: リクエストkey

 ファイルの読み込み中止
    Request.close();



[生成されるオブジェクト]
  Request[key] = {};
  Request[key].flag     :[Boolean] 読み込み処理フラグ
  Request[key].fileName :[String]  ファイル名
  Request[key].data     :[Object] 送信データ
  Request[key].configure:[Object] configureデータ

[イベント]
open      : ダウンロード処理開始
complete  : 受信したすべてのデータがデコードされて URLLoader オブジェクトの data プロパティへの格納が完了
httpStatus: HTTP 経由でデータへのアクセスを試みたときに その要求のステータスコードを検出
ioError   : 呼び出し時に致命的なエラーが発生してダウンロードが終了した場合。
progress  : ダウンロード処理を実行中にデータを受信したときに送出されます。
securityError :呼び出しによってセキュリティサンドボックスの外部にあるサーバーからデータをロードしようとすると送出
*/

function Request(){
  //クラス情報
  this.MODULENAME = "Request";
  this.VERSION    = 0.10; //バージョン
  this.MODULE     = true; //モジュールの有無チェック用 Request.MODULE
  //[プロパティ]
}
Request.prototype = {
  //[読み込み]
 load :function(fileName, data, configure){
  /*
  Request.load(fileName[String], data[Object], configure[Object]);
  fileName:[String]
    リクエストされる URL
  data:[Object]
    URLリクエストで送信されるデータオブジェクト

  configure:[Object]
    configure.key[String] : リクエストkey
  */
    // 引数処理
    if (!$("AFLJA")) { Request.Err("Not Found AFLJA"); return; } // AJAX = $("AFLJA");
    if (!fileName) { Request.Err("load() : Not Set fileName"); return; }
    if (!data)      {data       = new Object();}
    if (!configure) {configure  = new Object();}
    if (typeof(data) != "object")      { Request.err("load() : Not Object data"); return;}
    if (typeof(configure) != "object") { Request.err("load() : Not Object configure"); return;}

    //configure設定
    configure.key = (configure.key) ? configure.key : crc.hex(fileName); // リクエストkey

    // クラス内変数(注意:サーバには送信されない)
    var key = configure.key;
    if (!Request[key]) { Request[key] = new Object(); }
    Request[key].fileName = fileName; // ファイル名
    Request[key].data     = data;     // 送信データ
    Request[key].configure= configure;// configureデータ

    // 読み込み中なら処理破棄
    if (Request[configure.key].flag) { return; }

    // 送信データ作成(サーバに送信されるデータ)
    var url_Variables      = new Object();
    url_Variables.data     = data;
    url_Variables.fileName = fileName;      // [追加]
    url_Variables.key      = configure.key; // [追加]

    //Debug.test("Request.load [fileName]:"+fileName);
    //Debug.test("Request.load [url_Variables] :"+json.encode(url_Variables));//[Object]→JSON[String]
    //Debug.test("Request.load [configure] :"+json.encode(configure));//[Object]→JSON[String]

    //safari対策 safari(4.05)以外はifreamからの呼び出しに対してObjectで送信できるが
    //safariだとFLASHに対して送信の際ObjectがNullになる
    //url_Variables_String = escape(json.encode(url_Variables));
    //configure_String = escape(json.encode(configure));

    //読み込み開 始
    try {
      //AJAX.Request(fileName, url_Variables_String, configure_String);
			AJAX.Request(fileName, url_Variables, configure);
			
			
/*
AJAX.Request(fileName ,url_Variables, configure)
  fileName[String]        : リクエストされる URL

  url_Variables[Object]
    url_Variables.data        : [Object] 送信データ
    url_Variables.fileName    : [String] リクエストされる URL
    url_Variables.key         : [String] リクエストkey

  configure[Object] (注意:サーバには送信されない)
    configure.key     : [String] リクエストkey
    // FLASHで使用する configure設定 (未使用)
    //configure.contentType    = "";      //[String] MIMEコンテンツタイプ
    //configure.method         = "POST";  //[String] HTTPフォーム送信メソッド GET/POST
    //configure.requestHeaders = [];      //[Array]  HTTPリクエストヘッダの配列が HTTP リクエストに追加
*/
      return key;
    } catch (error) {
      Debug.log("Unable to load Request.load : "+error);
      //addEventListener.Requestリセット
      addEventListener.set("Request");
    }

  },
  /*
  イベントリスナー
    event.target[Object]
      event.target.data // 読み込みソースutf-8
      event.target.configure // [Object] : Request時のconfigure[Object]情報
          event.target.configure.key  : [String] リクエストkey
  */
  // default
  openHandler : function(event){
    Debug.test("Request.openHandler");
    var key = event.target.configure.key;
    Request[key].flag = "LoadNow";
    addEventListener.Request.openHandler(event);
  },

  completeHandler : function(event){
    Debug.test("Request.completeHandler");
    var key = event.target.configure.key;
    Request[key].flag = "";
    addEventListener.Request.completeHandler(event);
  },

  progressHandler : function(event){
    //Debug.test("Request.progressHandler :"+ event.bytesLoaded + "/" + event.bytesTotal);
    // eMouse.alt(Layer.cache[key].fileName+":"+bytesLoaded+"/"+bytesTotal);
    //addEventListener.Request.progressHandler(event);
  },

  securityErrorHandler : function(event){
    Debug.log("Request.securityErrorHandler :"+ event.text);
    var key = event.target.configure.key;
    Request[key].flag = "";
    addEventListener.Request.securityErrorHandler(event);
    //addEventListener.Requestリセット
    //addEventListener.set("Request");
  },

  httpStatusHandler : function(event){
    Debug.test("Request.httpStatusHandler :"+ event.status);
    var key = event.target.configure.key;
    Request[key].flag = "";
    //正常読み込み終了 200
    if(event.status != "200"){ Debug.test("Request.httpStatusHandler :"+ event.status);}
    addEventListener.Request.httpStatusHandler(event);
  },

  ioErrorHandler : function(event){
    Debug.log("Request.ioErrorHandler :" + event.text);
    addEventListener.Request.ioErrorHandler(event);
    //addEventListener.Requestリセット
    //addEventListener.set("Request");
  },
  //イベントリスナーここまで

  // 進行中のロード操作は直ちに終了します。
  close : function() {
    void(AJAX.Request_close());
  },

  // Flash内からjsvascriptを実行する
  javascript  : function(code) { var func = new Function(code); return func(); },// public (cord:String):void Request.javascript
  // エラー表示
  err         : function(str)  { Debug.log("Request Class Err: "+ str); }, // private (str:String):void}
	// 初期化
  initialize : function() { // private ():void
      addEventListener.set("Request");
  }

}
//イベントリスナー設定
Request = new Request();
Request.initialize();




/*++++++++++++++++++++++++++++++++
+ Layerクラス
++++++++++++++++++++++++++++++++++
ターゲットIDレイヤーへのファイルの読み込み
Layer.onLoad(fileName[String], target[String], data[Object], configure:[Object]):void
    fileName[String]
      リクエストされる URL
    target[String]
      読み込んだファイルの挿入先
      target=null で readOnly
    data[Object]
      URL リクエストで送信されるデータオブジェクト
    configure:[Object]
      [Requestクラス継続]
      configure.key     :[String] リクエストkey
      [クラス内]
      configure.type    :[Num] 表示タイプ [0:html 1:text]
      configure.where   :[String] 追加表示場所[1-4]
        1: BeforeBegin(開始タグの前）◎ <div id="target">  ****  </div>
        2: AfterBegin（開始タグの後）   <div id="target">◎****  </div>
        3: BeforeEnd  (終了タグの前）   <div id="target">  ****◎</div>
        4: AfterEnd   (終了タグの後）   <div id="target">  ****  </div>◎
      configure.noCache:[Boolean] キャッシュ制御

ターゲットへのテキスト挿入
Layer.inner(src[String], target[String], configure[Object]) {
    src[String]
      挿入されるソース
    target[String]
      ソースの挿入先
    configure:[Object]
      configure.type[Num]       : 表示タイプ [0:html 1:text]
      configure.where[String]   : 追加表示場所[1:"BeforeBegin"/ 2:"AfterBegin"/ 3:"BeforeEnd"/ 4: "AfterEnd"
*/
// コンストラクタ
function Layer(){
    // クラス情報
    this.MODULENAME = "Layer";
    this.VERSION    = 0.10; // バージョン
    this.MODULE     = true; // モジュールの有無チェック用 Layer.MODULE
    //初期設定//
    this.BUSY_IMG   = "/module/img/radar.gif"; // BUSY_ICON
    /*
    [生成されるオブジェクト]
      Layer[key] = new Object();
      Layer[key].flag     :[Boolean] 読み込み処理フラグ
      Layer[key].fileName :[String]  ファイル名
      Layer[key].data     :[Object] 送信データ
      Layer[key].configure:[Object] configureデータ

      Layer[target] :[String] リクエストキー
    */
}
// メソッド
Layer.prototype = {
    // リクエスト前後処理
    onLoad : function(fileName, target, data, configure) {
      Debug.test("Layer.onLoad :"+fileName +" / "+target);
/*
Layer.onLoad(fileName[String], target[String], data[Object], configure:[Object]):void
    fileName[String]
      リクエストされる URL
    target[String]
      読み込んだファイルの挿入先
      target=null で readOnly
    data[Object]
      URL リクエストで送信されるデータオブジェクト
      data.key
    configure:[Object]
      [Requestクラス継続]
      configure.key     :[String] リクエストkey
      [クラス内変数]
      configure.type    :[Num] 表示タイプ [0:html 1:text]
      configure.where   :[String] 追加表示場所[1-4]
        1: BeforeBegin(開始タグの前）◎ <div id="target">  ****  </div>
        2: AfterBegin（開始タグの後）   <div id="target">◎****  </div>
        3: BeforeEnd  (終了タグの前）   <div id="target">  ****◎</div>
        4: AfterEnd   (終了タグの後）   <div id="target">  ****  </div>◎
      configure.noCache:[Boolean] キャッシュ制御
*/
    // 引数チェック
    if (!fileName) { Layer.err("onLoad() : Not set fileName"); return;}
    if (target && !$(target)){  Layer.err("onLoad() Not Found $(target) :") + target; return;}
    if (!data)      { data      = new Object();}
    if (!configure) { configure = new Object();}
    if (typeof(data) != "object") { Layer.err("onLoad() : Not Object data"); return;}
    if (typeof(configure) != "object") { Layer.err("onLoad() : Not Object configure"); return;}

    // configure補正
    configure.key     = configure.key     || crc.hex(fileName);
    configure.noCache = configure.noCache || false;
    configure.type    = configure.type    || 0;
    configure.where   = configure.where   || null;

    // 追加表示補正
    if(configure.where) { configure.noCache = true;}

    // data補正

    // クラス内変数設定(注意:サーバには送信されない)
    var key = configure.key;
    Layer[key] = new Object();
    Layer[key].fileName = fileName;
    Layer[key].target   = target;
    Layer[key].data     = data;
    Layer[key].configure= configure;

    // 二重読み込み対策 キャッシュ制御
    if (Layer[target] && !configure.noCache){
      if(Layer[target] == key){
      Debug.test("Layer.onLoad():読み込み済みです");
      return;
      }
    }

    // キャッシュ未実装


    //イベントリスナー設定 / 書き換え
    //addEventListener.set("Layer");
    addEventListener.Request.openHandler     = new Function("e", "Layer.openHandler(e);");
    addEventListener.Request.completeHandler = new Function("e", "Layer.completeHandler(e);");

    // Request.load(fileName[String], data[Object], configure[Object]);
    Request.load(fileName, data, configure);
/*
Request.load(fileName[String], data[Object], configure[Object]);
fileName:[String]
  リクエストされる URL
data:[Object]
  URLリクエストで送信されるデータオブジェクト
configure:[Object]
  configure.key[String] : リクエストkey
*/

  },

  /*
  イベントリスナー
    event.target[Object]
      event.target.data // 読み込みソースutf-8
      event.target.configure // [Object] : Request時のconfigure[Object]情報
          event.target.configure.key  : [String] リクエストkey
  */

  // 読み込み開始前処理 Layer.requestStart
  openHandler : function(event) {
      Debug.test("Layer.openHandler");
      Layer.onBusy();//Busy表示ON
      addEventListener.Layer.openHandler(event);
  },
  // 終了 Layer.requestEnd
  completeHandler : function(event) {
      Debug.test("Layer.completeHandler");
      //addEventListener.Requestリセット
      addEventListener.set("Request");
      // Busy表示OFF
      Layer.offBusy();

      //読み込んだソース
      var src = event.target.data;
	
			// クラス内変数呼び出し
      var key = event.target.configure.key;
      var target    = Layer[key].target;// 挿入先ターゲット
      var configure = Layer[key].configure;// configure

      // リードオンリー時終了
      if(!target){ return;}

      // 二重読み込み対策
      Layer[target] = key;

      // レイヤーへのファイル書きだし
      Layer.inner(src, target, configure);
      // addEventListener実行
      addEventListener.Layer.completeHandler(event);
  },

  // ターゲットへのテキスト挿入 Layer.inner
  inner : function(src, target, configure) { //
  /*
  Layer.inner(src:String, target:String, configure:Object)
  src[String]
    挿入されるソース
  target[String]
    ソースの挿入先
  configure:[Object]
    メソッド処理設定
    configure.type[Num]       : 表示タイプ [0:html 1:text]
    configure.where[String]   : 追加表示場所[1:"BeforeBegin"/ 2:"AfterBegin"/ 3:"BeforeEnd"/ 4: "AfterEnd"]
  */
    
    // エラー処理：未記入・ターゲット有無
    if (!src)   { Layer.err("Inner() : Not set src"); return; }
    if (!target){ Layer.err("Inner() : Not set target"); return; }
    if (!$(target)) { Layer.err("Inner() Not Found target : " + target); return; }
    // configure -> 変数
    if (!configure) { var configure = new Object(); }
    configure.type    = configure.type    || 0;
    configure.where   = configure.where   || null;
		
		
    switch(configure.where) { // ターゲット場所設定
        case "1": where = "BeforeBegin"; break;
        case "2": where = "AfterBegin";  break;
        case "3": where = "BeforeEnd";   break;
        case "4": where = "AfterEnd";    break;
        default:  where = null;
    }
		
		Debug.test("Layer.inner target→:"+target);

    if (configure.type===0) { // HTML代入
        if (where) {
            $(target).insertAdjacentHTML(where,src); // 追加代入
        } else {
            $(target).setHTML(src);
        }
        void(cssQueryUser.apply()); // アタッチメントイベント
    } else { // text代入
        if(where) {
            $(target).insertAdjacentText(where,src); // 追加代入(FFでは要ie_methods.js)
        } else {
            $(target).setText(src);
        }
    }
    return;
  },

  // BUSY ICON表示 : 内部処理
  onBusy : function(key) { // private (key:String):void
      if (!Layer.busyFlag) {
          Layer.busyFlag = true;
          $("BUSY_ICON").setPoint(eMouse.x + 10,eMouse.y + 10);
          $("BUSY_ICON").innerHTML = "<img src='"+Layer.BUSY_IMG+"' />";
      }
  },
  offBusy : function() { // private ():void
      Layer.busyFlag = "";
      $("BUSY_ICON").innerHTML = "";
  },

  // エラー表示
  err : function(str) { Debug.log("Layer Class Err: " + str); }, // private (str:String):void
  writeElement : function() { // private ():void
      //BUSY_ICON
      var Childwrite = document.createElement("div");
      Childwrite.setAttribute("id","BUSY_ICON");
      document.body.appendChild(Childwrite);
  },
  // 初期化
  initialize : function() { // private ():void
      Layer.writeElement();
      addEventListener.set("Layer");
  }
}
Layer = new Layer();
Layer.initialize();





/********************************
  LayerBoxクラス
*********************************
フロートレイヤーにファイルを読み込む
Ex:
 LayerBox.onLoad(fileName[String], data[Object], configure[Object]);
  fileName  :[String] リクエストURL
  data      :[Object] URLリクエストで送信されるデータ
		data.configure :[Object] 表示する際に使用される設定
  configure :[Object]設定データ
  [Layerクラス継続]
    configure.key     :[String] リクエストkey
    configure.noCache ;[Boolen] キャッシュ制御
    configure.type    :[Boolen] 表示タイプ [0:html 1:text]
    configure.where   :[Num|String] 追加表示場所[1:"BeforeBegin"/ 2:"AfterBegin"/ 3:"BeforeEnd"/ 4: "AfterEnd"]
  [LayerBox.view継続]
    configure.position:[Num] 表示場所[0:"Mouse"/ 1:"Center"/ 2:"CenterP"]
    configure.view    :[Boolen] Box強制表示 [Boolean]
  [dataに内包される]
    configure.tplFile :[String] Box表示テンプレトファイル
    configure.boxType :[Num] タブ表示種類 1:non 2:[move][close] 3:[lock][move][close]
  [自動追加/dataに内包される]
    configure.target  :[String] DIV ID target;
********************************/
//コンストラクタ
function LayerBox(){
    //クラス情報//
    this.MODULENAME    = "LayerBox";
    this.VERSION       = 0.10;
    this.MODULE        = true;
    this.TPL_VIEW      = "/module/layer_box.php"; // テンプレト表示ファイル
    this.TPL_FILE      = "module_layer_box.tpl";  // テンプレト
    this.MAX_BOX       = 6;                       // 表示最大数
    this.BOX_NUM       = [];                      // LayerBox.BOX_KEY[boxNUM] = key;
    //popup
    this.EFFECT     = true; // ポップアップ可否
    this.DELAY      = 300; // Popup delay (ms)
    /*
    [生成されるオブジェクト]
      LayerBox[key] = new Object();
      LayerBox[key].flag      :[Boolean] 読み込み処理フラグ
      LayerBox[key].configure :[Object] configureデータ
			LayerBox[key].targe     :[String] target ID name
    */
}
//メソッド
LayerBox.prototype = {
  onLoad : function(fileName, data, configure){
		// LayerBox.onLoad(fileName[String], data[Object], configure[Object]);
    Debug.test("LayerBox.onLoad :"+fileName);
    // LayerBox.onLoad(fileName[String], data[Object], configure[Object]);
    // 引数補正
    if (!fileName)  { LayerBox.err("onLoad() : Not set fileName"); return;}
    if (!data)      { data      = new Object();}
    if (!configure) { configure = new Object();}
    if (typeof(data) != "object")      { LayerBox.err("onLoad() : Not Object data"); return;}
    if (typeof(configure) != "object") { LayerBox.err("onLoad() : Not Object configure"); return;}

    // configure補正
    //[Layerクラス継続]
    configure.key     = configure.key     || crc.hex(fileName);
    configure.noCache = configure.noCache || null;
    configure.type    = configure.type    || 0;
    configure.where   = configure.where   || null;
    //[LayerBox.view継続]
    configure.position= configure.position|| 0;
    configure.view    = configure.view    || false;		// :Box強制表示 [Boolean]
    //[layerbox]
    configure.tplFile = configure.tplFile || this.TPL_FILE;
    configure.boxType = configure.boxType || 2;//[move][close]


    // 強制表示有無//読み込まれている番号を探す
    var target = "";

    //表示されていないかを検索して あれば最前面表示終了 強制表示のぞく
    if (!configure.view) { //configure.view:Box強制表示 [Boolean]
      for (var i=1; i <= LayerBox.MAX_BOX; i++) {
        if (LayerBox.BOX_NUM[i] === configure.key) {
          target = "LayerBox"+i;
          $(target).style.zIndex = g_zIndex; g_zIndex++;
          Debug.test("LayerBox.onLoad : すでに表示されています");
          return;
        }
      }
    }
    // 読み込まれていない番号を返す
    for(var i=1; i<= LayerBox.MAX_BOX; i++){
      if (!LayerBox.BOX_NUM[i]) {
          target = "LayerBox" + i;
          LayerBox.BOX_NUM[i] = configure.key;
          break;
      }
    }

    if (!target) { // 最大値Over
        LayerBox.err("LayerBoxMax Over : " + LayerBox.MAX_BOX);
        return;
    }
    void(LayerBox.create(target)); // Box作成


    // dataにリクエストURL[fileName]/表示テンプレトファイル[tplFile]/target 情報を内包		
    data.configure = new Object();
		data.configure.fileName = fileName;
		
    data.configure.target   = target;		
		data.configure.tplFile  = configure.tplFile;
		data.configure.boxType  = configure.boxType;    

    // クラス内変数(注意:サーバには送信されない)
    var key = configure.key;
    if (!LayerBox[key]) { LayerBox[key] = new Object(); }
    //LayerBox[key].fileName = fileName;  // ファイル名
    LayerBox[key].target   = target;    // ターゲット
    //LayerBox[key].data     = data;      // 送信データ
    LayerBox[key].configure= configure; // configureデータ

    //イベントリスナー設定 / 書き換え
    addEventListener.Layer.openHandler     = new Function("event", "LayerBox.openHandler(event)");
    addEventListener.Layer.completeHandler = new Function("event", "LayerBox.completeHandler(event)");

    Layer.onLoad(this.TPL_VIEW, target, data, configure);
    return target;
  },
	
  openHandler : function(event){
    Debug.test("LayerBox.openHandler");
    addEventListener.LayerBox.openHandler(event);
  },

  completeHandler : function(event){
    Debug.test("LayerBox.completeHandler");
		//addEventListener.Layerリセット
    addEventListener.set("Layer");

    LayerBox.view(event);    
    addEventListener.LayerBox.completeHandler(event);
  },

  // AltBoxの表示 LayerBox.view
  view : function(event) { // protected (key:String):void
    Debug.test("LayerBox.view");
  /*
  イベントリスナー
    event.target[Object]
      event.target.data // 読み込みソースutf-8
      event.target.configure // [Object] : Request時のconfigure[Object]情報
          event.target.configure.key  : [String] リクエストkey
  */
    //読み込んだソース
    var src = event.target.data;

    // クラス内変数呼び出し
    var key = event.target.configure.key;
    var target    = Layer[key].target;// 挿入先ターゲット
    var configure = Layer[key].configure;// configure

    // ターゲットDOMの変数化
    var element  = $(target);
    // ブラウザ譲歩取得
    var windowHeight = getBrowser.height(); // ブラウザ高さ取得
    var windowWidth  = getBrowser.width();  // ブラウザ幅取得
    var windowTop    = getBrowser.top();    // ブラウザのスクロール量
    var size         = element.getSize();
    var pageWidth    = size.width;          // ターゲット幅取得
    var pageHeight   = size.height;         // ターゲット高さ取得

    //position補正
    var position = configure.position;
    switch (position) {
      case 1 : position = "Center"; break;
      case 2 : position = "CenterP"; break;
    }
    switch (position) { // ターゲット場所設定 // default:MOUSE_ALT
      case "Center" :  // 1:Center
          var left = Math.ceil(windowWidth/2 - pageWidth/2 );
          var top  = Math.ceil(windowHeight/2 - pageHeight/2 + windowTop);
          element.setPoint(left,top);
          break;

      case "CenterP" : // 2:CenterP 中心を基準に一番広い場所
          var windowCenterH = windowTop + windowHeight / 2; // ブラウザ縦中心位置
          var windowCenterW = windowWidth / 2; // ブラウザ縦中心位置
          var left;var top;
          // eMouse.y:マウス位置=クリック位置 //ターゲットウインド場所設定 // マウス位置が中心より下↓
          left = (eMouse.x >= windowCenterW) ? eMouse.x - pageWidth -10 : eMouse.x + 10;
          top  = (eMouse.y >= windowCenterH) ? eMouse.y - pageHeight -10 : eMouse.y + 10;
          if (left < 0) { left = 0; }
          if (top  < 0) { top  = 0; }
          element.setPoint(left,top);
          break;

      default: // MOUSE_ALT
          element.setPoint(eMouse.x + 10, eMouse.y + 10); // left,top
    }

    element.style.zIndex = g_zIndex; g_zIndex++;//zIndex
    // element.style.visibility = "visible";
    LayerEffect.on(target); // エフェクト表示
  },

  create : function(boxID) { // protected (boxID:String):void
    Debug.test("LayerBox.create :"+boxID);
    var Childwrite  = document.createElement("div");
    Childwrite.setAttribute("id", boxID);
    if (is_IE7) {
        Childwrite.setAttribute("className", "LayerBox");
    } else {
        Childwrite.setAttribute("class", "LayerBox");
    }
    document.body.appendChild(Childwrite);
  },

  // removeAltBox
  remove : function(target) { // protected (boxID:String):void
    Debug.test("LayerBox.remove :"+target);
    var i = target.toNUM();
    LayerBox.BOX_NUM[i] = null;
    document.body.removeChild($(target));
    Layer[target] = null;
  },

  /*---------------------------------
   ポップアップ
  -----------------------------------
  Class:    popUp
  Syntax:
    text      ="文章[String]"
    fileName  ="fileName[String]"
    data      ="[JSON String]"
    configure ="[JSON String]"

  "click"   :[Boolen] (クリックで動作 デフォルト：null(mouseoverで動作))
  configure :設定データ
    configure.key     :[String] リクエストkey
    configure.noCache ;[Boolen] キャッシュ制御
    configure.type    :[Boolen] 表示タイプ [0:html 1:text]
    configure.where   :[Num|String] 追加表示場所[1:"BeforeBegin"/ 2:"AfterBegin"/ 3:"BeforeEnd"/ 4: "AfterEnd"]
    configure.position:[Num] 表示場所[0:"Mouse"/ 1:"Center"/ 2:"CenterP"]
    configure.view    :[Boolen] Box強制表示 [Boolean]
    configure.tplFile :[String] Box表示テンプレトファイル
    configure.boxType :[Num] タブ表示種類 1:non 2:[move][close] 3:[lock][move][close]

  Ex : <div class="popUp" text="文章" configure="{'file':'filename'}">popUp</div>
    注意：HTMLエラーは気にしない
  */
  popUp : function(element){
    //2重設定対策
    if (element.getAttribute("addEvent_popUp")) { return; }
    element.setAttribute("addEvent_popUp",true);

    var key = Func.rnd(4);

    //オブジェクト生成
    if (!LayerBox[key]) { LayerBox[key] = {}; }
    LayerBox[key].element   = element;  // [Object]

    //Event.attach
    var setEvent    = 'mouseover';
    var addFunc = new Function('LayerBox.mouseover("'+key+'")');
    void(Event.attach(element, setEvent, addFunc));

    var setEvent    = 'mouseout';
    var addFunc = new Function('LayerBox.mouseout("'+key+'")');
    void(Event.attach(element, setEvent, addFunc));

    var setEvent    = 'click';
    var addFunc = new Function('LayerBox.click("'+key+'")');
    void(Event.attach(element, setEvent, addFunc));

  },

  mouseover :  function(key) { // protected (key:String):void
    Debug.test("LayerBox.mouseover :"+key);
    clearInterval(LayerBox[key].timerID);
    LayerBox[key].timerID = setInterval("LayerBox.popView('"+key+"')", LayerBox.DELAY);
  },

  mouseout :function(key) { // protected (key:String):void
    //Debug.test("LayerBox.mouseout :"+key);
    clearInterval(LayerBox[key].timerID);
    eMouse.alt("");
    if(LayerBox[key].flag == "LOCK"){ return; } // 表示LOCK
    if(LayerBox[key].flag == "VIEW"){ // 表示中ならclose処理
      LayerBox[key].timerID = setInterval("LayerBox.close('"+key+"')",LayerBox.DELAY);
    }
  },

  click : function(key) { //
    Debug.test("LayerBox.click :"+key);
    clearInterval(LayerBox[key].timerID);
    LayerBox.popView(key);
  },

  popView :  function(key) { // protected (key:String):void
    Debug.test("LayerBox.popView :"+key);
    clearInterval(LayerBox[key].timerID);
    eMouse.alt("");
    var flag = LayerBox[key].flag || ""; // 表示状態
    Debug.test("LayerBox.popView flag:"+flag);
    if(flag == "VIEW" || flag == "LOCK"){ LayerBox.zIndex(key); return; } // 表示済み

    //引数チェック
    var element   = LayerBox[key].element;
    var text      = element.getAttribute("text") || "";
    var fileName  = element.getAttribute("fileName") || "/module/layer_box_text.php";

    var data      = element.getAttribute("data") || "{}";//[String]
    var configure = element.getAttribute("configure") || "{}";//[String]

    //[String]→[Object]
    data      = json.decode(data);
    configure = json.decode(configure);

    LayerBox[key].flag   = "VIEW"; // flag設定
    configure.key = key; // ファイルキー設定

    data.popUpText = text;
    configure.boxType = configure.boxType || 3;//[lock][move][close]
    Debug.test("LayerBox.popView [configure] :"+json.encode(configure));//[Object]→JSON[String]

    LayerBox.onLoad(fileName, data, configure);

  },


  close : function(key) { // protected (key:String):void
    Debug.test("LayerBox.close :"+key);
    clearInterval(LayerBox[key].timerID);
    LayerBox[key].flag = "";

    LayerBox.remove(LayerBox[key].target);
  },

  lock : function(key) { // protected (key:String):void
    Debug.test("LayerBox.lock :"+key);
    if(LayerBox[key].flag != "LOCK"){
      $(LayerBox[key].target+"LOCK").src = "/module/img/icon_pin.gif"
      LayerBox[key].flag = "LOCK";
    } else {
      $(LayerBox[key].target+"LOCK").src = "/module/img/icon_pin0.gif"
      LayerBox[key].flag = "VIEW";
    }
  },

  zIndex : function(key) { // protected (key:String):void
      if (LayerBox[key].flag) {
          $(LayerBox[key].target).style.zIndex = g_zIndex; g_zIndex++;
      }
  },

  // エラー表示
  err : function(str) { Debug.log("LayerBox Class Err: " + str); } // protected (str:String):void
}
LayerBox = new LayerBox();
addEventListener.set("LayerBox");







/*
* LayerEffect   【必須：Layerクラス】
*
* エフェクト処理 On/Off
*    LayerEffect.effectCheck();
* 透明0→不透明100
*    LayerEffect.on(target,alpha); target(ターゲットID),alpha(最終アルファ値)
* 透明エフェクトはレスポンス悪くなるのでなし
*/
// コンストラクタ
function LayerEffect(){
    // モジュール情報
    this.MODULENAME = "LayerEffect";
    this.VERSION    = 0.10; // バージョン
    this.MODULE     = true; // モジュールの有無チェック用 Layer.MODULE
    // 初期設定
    this.EFFECT     = true; // LayerEffect可否 // LayerEffect.EFFECT = false;
    this.ALPHA      = 100;  // 基本最終アルファ%
    this.INCREASSES = 10;   // 100 > 増加速度 > 1

    this.cache    = {};   // LayerEffect.cache[target] キャッシュ・プロパティ
}
// メソッド
LayerEffect.prototype = {
    effectCheck : function(check){ // public (check:Boolean):void
        LayerEffect.EFFECT = (check) ? true : false;
    },

    on : function(target, alpha){ // protected (target:String, alpha:uint):void
          if (!LayerEffect.EFFECT) { $(target).style.visibility = "visible"; return; } // 即表示
          LayerEffect.cache[target] = {};
          LayerEffect.cache[target].endAlpha = alpha || LayerEffect.ALPHA;  // 未記入なら最終アルファ値 不透明100
          LayerEffect.cache[target].tmpAlpha = 0; // 開始アルファ初期化 透明0
          // 透明で表示
          LayerEffect.setAlpha(target, 0);
          $(target).style.visibility = "visible";
          LayerEffect.cache[target].timerID = setInterval('void(LayerEffect.up("'+target+'"))',10);
    },
    up : function(target){ // private (target:String):void
          if (LayerEffect.cache[target].tmpAlpha < LayerEffect.cache[target].endAlpha) {
              LayerEffect.setAlpha(target,LayerEffect.cache[target].tmpAlpha);
              LayerEffect.cache[target].tmpAlpha += LayerEffect.INCREASSES;
          } else {
              clearInterval(LayerEffect.cache[target].timerID);
              LayerEffect.setAlpha(target,LayerEffect.cache[target].endAlpha);
              LayerEffect.cache[target] = {};
          }
    },
    // 初期化
    initialize : function(){ // protected ():void
        if (isIE) { // IE仕様
            LayerEffect.getAlpha = function(target) { // private (target:String):uint
              return ($(target).filters.alpha) ? $(target).filters.alpha.opacity : null;
            }
            LayerEffect.setAlpha = function(target, num, type) { // private (target:String, num:uint, type:uint):void
              num = (num === 0) ? 0 : (!num) ? 100: num;
              $(target).style.filter = "alpha(opacity=" + num + "," + type + ")";
            }
        } else {//OperaSafariFF仕様
            LayerEffect.getAlpha = function(target, num) { // private (target:String, num:uint):uint
                return parseInt($(target).style.opacity*100);
            }
            LayerEffect.setAlpha = function(target, num) { // private (target:String, num:uint):void
                num = (num == 0) ? 0 : (!num) ? 100: num;
                $(target).style.opacity = parseInt(num)*.01;
            }
        }
    }
} // LayerEffect.prototype
LayerEffect = new LayerEffect();
LayerEffect.initialize();





/*
* LayerMoveクラス
*
* 指定Div移動イベント
*   onmousedown="LayerMove.div('targetID')";
*
* Memo:
*   http://d.hatena.ne.jp/miya2000/20070306/p0 IEでウィンドウの外にドラッグした時のマウスイベントを取得する
*/
// コンストラクタ
function LayerMove(){
    //クラス情報//
    this.MODULENAME = "LayerMove";
    this.VERSION    = 0.10; // バージョン
    this.MODULE     = true; // モジュールの有無チェック用 Layer.MODULE
}
// メソッド
LayerMove.prototype = {
    div : function(target) { // public (target:String):void
        if (!$(target)) { Debug.log("LayerMove.ID() : Not Found target : " + target); return false; }
        LayerMove.target = target;
        // 初期値取得
        var point = $(target).getPoint();
        LayerMove.divX = point.left;
        LayerMove.divY = point.top;
        // ターゲットの前面表示
        $(target).style.zIndex = g_zIndex; g_zIndex++;
        Event.attach(document, "mouseup",   LayerMove.mUP);
        Event.attach(document, "mousemove", LayerMove.mMove);
        Event.attach(document, "mousedown", LayerMove.mDown);
    },
    mDown : function(e) { if (!isIE) { e.preventDefault(); } }, // private ():void // FF
    mMove : function(e) { // private ():void
        $(LayerMove.target).setPoint(LayerMove.divX + eMouse.dragX, LayerMove.divY + eMouse.dragY);
        if(isIE){ window.event.returnValue = false; } // IE
    },
    mUP : function(e) { // private ():void
        Event.detach(document, "mousemove", LayerMove.mMove);
        Event.detach(document, "mousedown", LayerMove.mDown);
        Event.detach(document, "mouseup"  , LayerMove.mUP);
    }
}
LayerMove = new LayerMove();




/*
* スムーススクロール SmoothScrollクラス
*
* エフェクト処理 On/Off
*   SmoothScroll.effectCheck();
* 移動先設定
*   SmoothScroll.to(target);            [target:最終Y値[Namber]|ID名[String]|*(一番下)|未記入(一番上)]
*   SmoothScroll.toName(targetName,n);  [targetName名[String],[n]]
*/
// コンストラクタ
function SmoothScroll(){
  // クラス情報
  this.MODULENAME = "SmoothScroll";
  this.VERSION    = 0.10;   // バージョン
  this.MODULE     = true;   // モジュールの有無チェック用 SmoothScroll.MODULE
  // 初期設定
  this.EFFECT       = true; // スムーススクロール可否
  this.MAX_SPEED    = 30;   // 最大スピード値
  this.MIN_SPEED    = 5;    // 最小スピード値
  this.MINMAX_FRAME = 25;   // 最小最大間のフレーム数(加速率)
  this.MARGIN_TOP   = 10;   // 移動後のマージントップ
  // 変数
  this.acceleration   = Math.round((this.MAX_SPEED - this.MIN_SPEED) / this.MINMAX_FRAME); // 加速度
  this.accelSlowWithe = this.MINMAX_FRAME * (this.MAX_SPEED + this.MIN_SPEED);             // 加速減速必要幅
  this.slowWithe      = this.accelSlowWithe / 2; // 減速必要幅
}
// メソッド
SmoothScroll.prototype = {
    effectCheck : function(check) { // public (check:Boolean):void
        EffectCheck.EFFECT = (check) ? true : false;
    },

    to : function(target) { // public (target:uint|String|null):void
        var targetPoint;
        if (!target) {
            targetPoint = 0;
        } else if (target == "*") {
            targetPoint = getBrowser.bodyHeight();
        } else if (typeof(target) == "number") {
            targetPoint = target;
        } else if ($(target)) {
            targetPoint = $(target).getPoint().top;
        }				
        SmoothScroll.move(targetPoint);
    },

    toName : function(target, n) { // public (target:String, n:uint):void
        var targetPoint;
        var element = document.getElementsByName(target)[n];
        if (!element) {
            targetPoint = 0;
        } else {
            var TempID = element.getAttribute("id") || "";
            if (TempID) {
                targetPoint = $(TempID).top;
            } else {
                element.setAttribute("id","tmpSmoothScrollID");
                targetPoint = $("tmpSmoothScrollID").top();
                element.removeAttribute("id");
            }
        }
        SmoothScroll.move(targetPoint);
    },

    move : function(targetPoint) { // private (targetPoint:uint):void
        // 即移動
        if (!SmoothScroll.EFFECT) { scroll(0,targetPoint); }
        // マウス処理によるスクロールキャンセル
        Event.attach(document,"mousedown" , SmoothScroll.scrollStop);
        Event.attach(document,"mousewheel", SmoothScroll.scrollStop);
        // 最下値
        var yEnd = getBrowser.bodyHeight() - getBrowser.height();
        //targetPoint値補正
        targetPoint = (targetPoint < 0) ? 0 : targetPoint;
        targetPoint = (targetPoint > SmoothScroll.MARGIN_TOP) ? targetPoint-SmoothScroll.MARGIN_TOP : targetPoint; // マージン追加
        targetPoint = (targetPoint > yEnd) ? yEnd : targetPoint;
        //移動処理不必要
        if (getBrowser.bodyHeight() < getBrowser.height()) { return false; }
        SmoothScroll.yEnd     = targetPoint;             // 最終Y値セット
        SmoothScroll.tmpY     = getBrowser.top();        // 現在Y値
        SmoothScroll.tmpSpeed = SmoothScroll.MIN_SPEED;  // スクロール速度セット

        if (SmoothScroll.yEnd <= SmoothScroll.tmpY) { // ↑方向にスクロール
            if (Math.abs(SmoothScroll.tmpY - SmoothScroll.yEnd) > SmoothScroll.accelSlowWithe) { // 減速必要幅
              SmoothScroll.slowdownPoint = SmoothScroll.yEnd + SmoothScroll.slowWithe;
            } else {
              SmoothScroll.slowdownPoint = SmoothScroll.yEnd + Math.abs(SmoothScroll.tmpY - SmoothScroll.yEnd) / 2 ;
            }
            SmoothScroll.timerID = setInterval("SmoothScroll.up()",10);
        } else {  // ↓方向にスクロール
            if (Math.abs(SmoothScroll.tmpY - SmoothScroll.yEnd) > SmoothScroll.accelSlowWithe) { // 減速必要幅
              SmoothScroll.slowdownPoint = SmoothScroll.yEnd - SmoothScroll.slowWithe;
            } else {
              SmoothScroll.slowdownPoint = SmoothScroll.yEnd - Math.abs(SmoothScroll.tmpY - SmoothScroll.yEnd) / 2 ;
            }
            SmoothScroll.timerID = setInterval("SmoothScroll.down()",10);
        }
        return;
    },
    //↑方向にスクロール
    up : function() { // private ():void
        var ScrollPoint = SmoothScroll.tmpY - SmoothScroll.tmpSpeed;//スクロールポイント先
        if (ScrollPoint > SmoothScroll.yEnd) {
            scrollTo(0,ScrollPoint);
            SmoothScroll.tmpY = Math.round(ScrollPoint);
            if (SmoothScroll.slowdownPoint < SmoothScroll.tmpY){
                SmoothScroll.tmpSpeed += SmoothScroll.acceleration; // 加速
            } else {
                SmoothScroll.tmpSpeed -= SmoothScroll.acceleration; // 減速
            }
            SmoothScroll.tmpSpeed = Math.round(SmoothScroll.tmpSpeed);
            if (SmoothScroll.tmpSpeed > SmoothScroll.MAX_SPEED) { SmoothScroll.tmpSpeed = SmoothScroll.MAX_SPEED; }
            if (SmoothScroll.tmpSpeed < SmoothScroll.MIN_SPEED) { SmoothScroll.tmpSpeed = SmoothScroll.MIN_SPEED; }
            return false;
        } else {
            SmoothScroll.scrollEnd();
        }
    },
    // ↓方向にスクロール
    down : function(){ // private ():void
        var ScrollPoint = SmoothScroll.tmpY + SmoothScroll.tmpSpeed; // スクロールポイント先
        if (SmoothScroll.yEnd > ScrollPoint) {
            scrollTo(0,ScrollPoint);
            SmoothScroll.tmpY = Math.round(ScrollPoint);
            if (SmoothScroll.slowdownPoint > SmoothScroll.tmpY) {
                SmoothScroll.tmpSpeed += SmoothScroll.acceleration; // 加速
            } else {
                SmoothScroll.tmpSpeed -= SmoothScroll.acceleration; // 減速
            }
            SmoothScroll.tmpSpeed = Math.ceil(SmoothScroll.tmpSpeed);
            if (SmoothScroll.tmpSpeed > SmoothScroll.MAX_SPEED) { SmoothScroll.tmpSpeed = SmoothScroll.MAX_SPEED; }
            if (SmoothScroll.tmpSpeed < SmoothScroll.MIN_SPEED) { SmoothScroll.tmpSpeed = SmoothScroll.MIN_SPEED; }
        }else{
            SmoothScroll.scrollEnd();
        }
    },
    // スクロール終了
    scrollEnd : function() { // private ():void
        clearInterval(SmoothScroll.timerID);
        scroll(0, SmoothScroll.yEnd);
    },
    // スクロールキャンセル
    scrollStop : function() { // private ():void
        if (SmoothScroll.timerID) { clearInterval(SmoothScroll.timerID); }
        Event.detach(document, "mousedown", SmoothScroll.scrollStop);
        Event.detach(document, "mousewheel", SmoothScroll.scrollStop);
    },
    // エラー表示 private  err(str:String):void
    err : function(str) { Debug.log("SmoothScroll Class Err: " + str); }
}
SmoothScroll = new SmoothScroll();




/*
* crypt 暗号・復号・鍵生成クラス
*/
// コンストラクタ
function Crypt(){
    //モジュール情報//
    this.MODULENAME = "Crypt";
    this.VERSION    = 0.10;
    this.MODULE     = true;
}
// メソッド
Crypt.prototype = {
  // 暗号化 Blowfish PHPではmcrypt 要blowfish.js base64.js
  // Blowfish暗号化 Crypt.encBlowfish(text,key);->base64でreturn
  encBlowfish : function(text, key){ // public (text:Sting, key:String):String[base64encode]
      var usr = {
          "data"    : text,
          "key"     : key,
          "mode"    : "cbc",
          "round"   : 16,
          "iv"      : blowfish.mkIV(),
          "pchar"   : "\0"
      };
      blowfishencrypt = blowfish.encrypt(usr);
      base64encode = base64.encode(blowfishencrypt);
      return base64encode;
  },
  // 復号化
  // Blowfish複合化 Crypt.decBlowfish(text,key);
  decBlowfish : function(text, key) { // public (text:Sting, key:String):String[blowfishdecrypt]
    // base64でエンコード・Blowfishで暗号化→復号
    text = base64.decode(text);
    var usr = {
        "data"    : text,
        "key"     : key,
        "mode"    : "cbc",
        "round"   : 16,
        "pchar"   : "\0"
    };
    blowfishdecrypt = blowfish.decrypt(usr);
    return blowfishdecrypt;
  },
  // 鍵生成
  // Crypt.clientKey(Pass,Name,TimeAUTH);
  clientKey : function(key1, key2, key3)  { // public (key1:String, key2:String, key3:String):String
      var clientKey = sha1.hex(key1);
      clientKey = sha1.hex(clientKey + key2);
      clientKey = sha1.hex(clientKey + key3);
      return clientKey;
  }
}
Crypt = new Crypt();



/*-----------------------------------
 cssQueryUser
-------------------------------------
 各種クラスにイベントを追加する
   cssQueryUser.apply(); イベント追加実行
   cssQueryUser.to にクラスイベントを追加する
*/
function cssQueryUser(){}
cssQueryUser.prototype = {
  apply : function() { // public ():void
      //イベントを追加するクラス・ID
      cssQueryUser.to(".eventMouse"); // マウスイベント
      cssQueryUser.to(".efectText");  // EfextText
      cssQueryUser.to(".efectBack");  // EfectBackground
      cssQueryUser.to(".popUp");      // ポップアップ
      cssQueryUser.to(".swapImg");    // 画像スワップ
  },
  //クラス属性を持つタグに対して処理
  to : function(targetClass){ // private (targetClass:String):void
      var element = cssQuery(targetClass);
      for (var i=0; i<element.length;i++) { void(cssQueryUser[targetClass](element[i])); }
  },

/********************************
* マウスイベント
*********************************
* Class     eventMouse
* Syntax    eventMouse = "[0]click::[1]mouseover::[2]mouseout::[3]mousedown::[4]mouseup::[5]mousemove" [StringFunction]
* Ex : <div class="eventMouse" eventMouse="function()::function()::function()::function()::function()::function()">Sample</div>
*/
  ".eventMouse" : function(element) { // private (element:Object):void
      //2重読み込み対策
      if (element.getAttribute("addEvent_eventMouse")) { return; }
      element.setAttribute("addEvent_eventMouse", true);

      if (!element.getAttribute("eventMouse")) {
          element.style.border = "2px solid #FF8686";
          element.insertAdjacentHTML("AfterEnd", '<div style="color:#FF0000">not set [eventMouse] nodeValue</div>');
          return;
      }
      if (eventMouse && !eventMouse.match(/::/)) { Event.add(element, "click", eventMouse); return; }
      var SetEvent = ["click", "mouseover", "mouseout", "mousedown", "onmouseup", "mousemove"];
      var EventMouse = eventMouse.split("::");

      for (var i=0; i < EventMouse.length; i++) {
          EventMouse[i] = EventMouse[i].trim(); // trim
          if (EventMouse[i]) {
              var AddFunction = EventMouse[i].split(";");
              //for (var j=0; j<AddFunction.length; j++) { Event.add(element,SetEvent[i],AddFunction[j]); }
              for (var j=0; j<AddFunction.length; j++) { Event.attach(element,SetEvent[i],new Function(AddFunction[j])); }
          }
      }
  },


/*******************************
* EfextText EfectBackground
********************************
* Class     efectText efectBack
* Syntax    efectText = "#000000" efectBack = "#000000" マウスオーバー時の色
*/
  ".efectText" : function(element) { // private (element:Object):void
      //2重読み込み対策
      if (element.getAttribute("addEvent_efectText")) { return; }
      element.setAttribute("addEvent_efectText",true);
      var efectText = element.getAttribute("efectText") || "";
      //void(Event.add(element,"mouseover","Effect.mOverText(this,'" + efectText + "')"));
      //void(Event.add(element,"mouseout", "Effect.mOutText(this,'" + element.style.color + "')"));
      void(Event.observe(element,"mouseover", new Function("Effect.mOverText(this,'" + efectText + "')")));
      void(Event.observe(element,"mouseout", new Function("Effect.mOutText(this,'" + element.style.color + "')")));
  },

  ".efectBack" : function(element) { // private (element:Object):void
      //2重読み込み対策
      if(element.getAttribute("addEvent_efectBack")){ return; }
      element.setAttribute("addEvent_efectBack",true);
      var efectBack = element.getAttribute("efectBack") || "";
      //void(Event.add(element,"mouseover","Effect.mOverBackground(this,'" + efectBack + "')"));
      //void(Event.add(element,"mouseout", "Effect.mOutBackground(this,'" + element.style.color + "')"));
      void(Event.observe(element,"mouseover", new Function("Effect.mOverBackground(this,'" + efectBack + "')")));
      void(Event.observe(element,"mouseout", new Function("Effect.mOutBackground(this,'" + element.style.color + "')")));
  },


/*---------------------------------
 ポップアップ
-----------------------------------
 Class:    popUp
 Syntax:
    text      ="文章[String]"
    data      ="[JSON String]"
    configure ="[JSON String]"
      "click"   :[Boolen] (クリックで動作 デフォルト：null(mouseoverで動作))
      "boxType" :[String] (デフォルト：)
      "file"    :[Boolen] (デフォルトfalse trueでlayer_box_user.phpの使用)
  Ex : <div class="popUp" text="文章" configure="{'file':'filename'}">popUp</div>
  注意：HTMLエラーは気にしない
*/
  ".popUp" : function(element) { LayerBox.popUp(element); },


/**********************************
* 画像スワップ <img class="swapImg" src="" />
***********************************
* Class     swapImg
* Syntax    swapImg = "imgsrc[String]"
* Ex : <img class="swapImg" swapImg="" src="" />
*/
  ".swapImg" : function(element) { // private (element:Object):void
      //2重読み込み対策
      if (element.getAttribute("addEvent_swapImg")) { return; }
      element.setAttribute("addEvent_swapImg",true);
      var img = element.getAttribute("swapImg");
      void(Event.observe(element,"mouseover", new Function("this.src='" + img + "'")));
      void(Event.observe(element,"mouseout", new Function("this.src='" + element.src + "'")));
  }
}
cssQueryUser = new cssQueryUser();



// [MEMO]
//void(Event.attach(element,"mouseover",new Function("LayerBox.up('"+key+"')")));//○
//var upFunction  = new Function("LayerBox.up('"+key+"')"); void(Event.attach(element,"mouseover",upFunction));//○
//void(Event.attach(element,"mouseover",new Function("LayerBox.up(this)")));//FF○ IE×
//void(Event.observe(element,"mouseover",new Function("LayerBox.up(this)")));//○
//void(Event.attach(element,"mouseover",function(){LayerBox.up(key)}));//×
//void(Event.attach(element,"mouseover",(function(){LayerBox.up(key)})));//○×

//element.setAttribute("key",key);//○
//var SetEvent    = 'mouseover';
//var AddFunction = function(){void(LayerBox.up(element));}
//void(Event.attach(element,SetEvent, AddFunction));




//***:***:***:***:***:***:***:***:***:***:***:***:***:***:***:***:***
//  AFLJA.Initialize
//***:***:***:***:***:***:***:***:***:***:***:***:***:***:***:***:***
AJAX = document.getElementById("AFLJA");
/*
* MEMO

* $(target).style.zIndex = g_zIndex;g_zIndex++;
*/

