﻿window.onerror = function() {
    return true
};
SWFObject = function($) {
    this.cfg = $;
    this.swfId = $.fid;
    this.asObjects = {};
    this.onLoadInit = null;
    SWFObject.instances[this.swfId] = this
};
SWFObject.prototype.load = function() {
    Utils.f(this.cfg)
};
SWFObject.prototype.getASObject = function($) {
    return this.asObjects[$.asoId]
};
SWFObject.prototype.registerASObject = function(A) {
    var _ = A.asoId,
    $ = this.swfId;
    return this.asObjects[_] = new ASObject({
        asoId: _,
        swfId: $
    })
};
SWFObject.prototype.getASObjectProperty = function($) {
    if (this.swf == null) this.swf = Utils.g(this.swfId);
    return this.swf.getASObjectProperty($)
};
SWFObject.prototype.setASObjectProperty = function($) {
    if (this.swf == null) this.swf = Utils.g(this.swfId);
    this.swf.setASObjectProperty($)
};
SWFObject.prototype.callASObjectMethod = function($) {
    if (this.swf == null) this.swf = Utils.g(this.swfId);
    return this.swf.callASObjectMethod($)
};
SWFObject.instances = {};
SWFObject.getSWFObject = function($) {
    return SWFObject.instances[$.swfId]
};
SWFObject.dispatchASObjectEvent = function(B) {
    var _ = B.swfId,
    A = B.asoId,
    F = B.type,
    E = B.data,
    C = SWFObject.getSWFObject({
        swfId: _
    }),
    $ = (A == undefined) ? C: C.getASObject({
        asoId: A
    }),
    D = "on" + F.substr(0, 1).toUpperCase() + F.substr(1);
    if ($[D] != null) $[D](E)
};
SWFObject.registerASObject = function(A) {
    var $ = A.swfId,
    _ = A.asoId,
    B = SWFObject.getSWFObject(A);
    B.registerASObject(A)
};
ASObject = function($) {
    this.swfId = $.swfId;
    this.asoId = $.asoId;
    this.swfObject = SWFObject.getSWFObject($);
    if (ASObject.instances[this.swfId] == null) ASObject.instances[this.swfId] = {};
    ASObject.instances[this.swfId][this.asoId] = this
};
ASObject.prototype.get = function($) {
    return this.swfObject.getASObjectProperty({
        asoId: this.asoId,
        property: $
    })
};
ASObject.prototype.set = function(_, $) {
    this.swfObject.setASObjectProperty({
        asoId: this.asoId,
        property: _,
        value: $
    })
};
ASObject.prototype.call = function($, _) {
    return this.swfObject.callASObjectMethod({
        asoId: this.asoId,
        method: $,
        parameters: _
    })
};
ASObject.instances = {};
Utils = {
    g: function($) {
        return document.getElementById($)
    },
    f: function(_) {
        var $ = '<e--mbed id="#{fid}" name="#{fid}" src="#{movie}" flashVars="#{flashVars}" width="#{width}" height="#{height}" align="#{align}" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" wmode="#{wmode}" scale="#{scale}" salign="#{salign}" allownetworking="#{allownetworking}" allowscriptaccess="#{allowscriptaccess}" />',
        A = '<object id="#{fid}" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="#{width}" height="#{height}" align="#{align}"><param name="movie" value="#{movie}" /><param name="flashVars" value="#{flashVars}" /><param name="wmode" value="#{wmode}" /><param name="scale" value="#{scale}" /><param name="salign" value="#{salign}" /><param name="allownetworking" value="#{allownetworking}" /><param name="allowscriptaccess" value="#{allowscriptaccess}" /></object>';
        this.g(_.cid).innerHTML = this.fm(this.b.isIE ? A: $, _)
    },
    fm: function($, _) {
        if (arguments.length) if (typeof(_) == "object") $ = $.replace(/#\{([^\{\}]+)\}/g,
        function(A, B) {
            var $ = _[B];
            if (typeof $ == "function") $ = $(B);
            return typeof($) == "undefined" ? "": $
        });
        else if (typeof(_) != "undefined") for (var A = arguments.length - 2; A > -1; A--) $ = $.replace(new RegExp("#\\{" + A + "\\}", "g"), arguments[A + 1]);
        return $
    },
    b: {
        isIE: /msie/i.test(navigator.userAgent),
        isFF: /firefox/i.test(navigator.userAgent),
        isMaxthon: (function() {
            var $ = false;
            try {
                $ = external.max_version
            } catch(_) {}
            return $
        })()
    },
    mo: function() {
        var $ = {},
        B = arguments.length;
        for (var C = 0; C < B; C++) {
            var A = arguments[C];
            for (var _ in A) {
                if ($[_] != null) continue;
                $[_] = arguments[C][_]
            }
        }
        return $
    }
};
HWR = {
    loaded: false
};
HWR.load = function(E, C, D) {
    HWR.tid = C;
    var $ = D ? ("serviceUrl=" + D) : "",
    B = {
        cid: E,
        fid: E + "_flash",
        width: 410,
        height: 290,
        movie: "http://www.baidu.com/hw/main.swf",//flash文件路径
        align: "middle",
        salign: "lt",
        wmode: "window",
        scale: "noscale",
        allowscriptaccess: "always",
        allownetworking: "all",
        flashVars: $
    },
    A = new SWFObject(B);
    HWR.so = A;
    var _;
    A.onLoadInit = function($) {
        HWR.ao = _ = A.asObjects.handWrite;
        _.onCharSelect = function($) {
            HWR._onCharSelect($["char"])
        }
    };
    A.load()
};
HWR._onCharSelect = function(A) {
    var $ = document.getElementById(HWR.tid);
    $.value += A;
    var _ = document.f.kw.value;
    document.f.kw.focus();
    document.f.kw.value = _
};
HWR.clear = function() {
    HWR.ao.call("clear", [])
};
function getFlashVersion() {
    var B = navigator;
    if (B.plugins && B.mimeTypes.length) {
        var A = B.plugins["Shockwave Flash"];
        if (A && A.description) return A.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s)+r/, ".") + ".0"
    } else if (window.ActiveXObject && !window.opera) for (var C = 10; C >= 2; C--) {
        try {
            var _ = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + C);
            if (_) {
                return C + ".0.0";
                break
            }
        } catch($) {}
    }
    return "0"
}
function addStyle(A, $) {
    var _ = document.styleSheets[0];
    if (_.addRule) _.addRule(A, $);
    else if (_.insertRule) _.insertRule(A + " { " + $ + " }", _.cssRules.length)
}

