/*
Copyright(C) Harry 2008 All Rights Reserved.
Not to be reused without permission.
Created by Harry, UI group, IT department.
Last modified by Harry IT department. 2008/05/26
*/

var Harry = {
    JsPath: '/GoldenWeb/Js/', CssPath: 'js/', frmObj: null, clickObj: null,
    String: {}, AOBJ: {} 
}
Harry.Base = new function() {
    this.isFloat = false; //iframe是否显示浮动层 false 显示控件,true浮动层
    //获取字符串长度-----------------------------------------------------------------------------------------------------------------------------------------
    this.GetStringLength = function(str) {
        var endvalue = 0;
        var sourcestr = new String(str);
        var tempstr;
        for (var strposition = 0; strposition < sourcestr.length; strposition++) {
            tempstr = sourcestr.charAt(strposition);
            if (tempstr.charCodeAt(0) > 255 || tempstr.charCodeAt(0) < 0) {
                endvalue = endvalue + 2;
            }
            else {
                endvalue = endvalue + 1;
            }
        }
        return (endvalue);
    }
    this.Rnd = function() {
        var now = new Date();
        return now.toString();
    }
    //设置事件
    this.SetEvent = function(obj, name, mothed) {
        if (this.IsIE()) {
            obj.attachEvent(name, Function(mothed))//IE中
        }
        else {
            obj.setAttribute(name, mothed);
        }
    }
    //设置css
    this.SetCss = function(obj, cssName) {
        if (this.IsIE()) {
            obj.className = cssName;
        }
        else {
            obj.setAttribute("class", cssName, 0);
        }
    }
    //返回指定ID对象------------------------------------------------------------------------------------------------------------------------------------------
    this.$ID = function(id) {
        return document.getElementById ? document.getElementById(id) : null;
    };
    //返回指定Name对象
    this.$Name = function(name) {
        return document.getElementsByTagName ? document.getElementsByTagName(name) : new Array()
    };
    //是否ie--------------------------------------------------------------------------------------------------------------------------------------------------
    this.IsIE = function() {
        if (document.all) {
            return true;
        }
        return false;
    }
    //-------------------------------------------------------------------------------------------------------------------------------------------------------
    this.GetCookie = function(Name) {
        var search = Name + "=";
        if (document.cookie.length > 0) {
            offset = document.cookie.indexOf(search);
            if (offset != -1) {
                offset += search.length;
                end = document.cookie.indexOf(";", offset);
                if (end == -1) end = document.cookie.length;
                return unescape(document.cookie.substring(offset, end));
            }
            else return ('');
        }
        else return ('');
    }

    this.SetCookie = function(name, value) {
        var today = new Date();
        var expires = new Date();
        expires.setTime(today.getTime() + 1000 * 60 * 60 * 24 * 365);
        document.cookie = name + "=" + value + ";path=/" + "; expires=" + expires.toGMTString();
    }
    //加载js文件------------------------------------------------------------------------------------------------------------------------------------------
    this.LoadJS = function(path, id) {
        var oHead = document.getElementsByTagName('HEAD').item(0);
        var n = document.createElement("script");
        n.type = "text/javascript";
        n.id = id;
        n.src = path;
        oHead.appendChild(n);

    };
    //加载css------------------------------------------------------------------------------------------------------------------------------------------
    this.LoadCSS = function(css) {
        //没有对绝对路径做出设置	 	
        var head = document.getElementsByTagName('HEAD').item(0);
        var style = document.createElement('link');

        if (css.substring(0, 4) == "http")
            style.href = css;
        else
            n.src = Harry.JsPath + css;

        style.rel = 'stylesheet';
        style.type = 'text/css';

        style.setAttribute("href", css);
        style.setAttribute("rel", "stylesheet");
        style.setAttribute("type", 'text/css');
        head.appendChild(style);
    }
    //取js "？"号后部分---------------------------------------------------------------------------------------------------------------------------------
    this.GetJSPar = function(jsID) {
        var jsObj = this.$ID(jsID);
        var jss = jsObj.src.split('?');
        if (jss.length > 1)
            return jss[1];
        return "";
    }
    //得到对象相对X距离---------------------------------------------------------------------------------------------------------------------------------
    this.GetX = function() {
        var obj = Harry.clickObj;
        if (!obj) return 0;
        var x = obj.offsetLeft;
        while (obj = obj.offsetParent) x += obj.offsetLeft;
        return x;
    }
    //得到对象相对Y距离
    this.GetY = function(sp) {
        var obj = Harry.clickObj;
        if (!obj) return 0;
        var y = obj.offsetTop + obj.offsetHeight + 1;
        while (obj = obj.offsetParent) y += obj.offsetTop;
        //alert(y);
        return y;
    }

    //创建iframe------------------------------------------------------------------------------------------------------------------------
    this.CreateIframe = function(name) {
        if (name == undefined)
            name = "harryiframe";
        var iframeObj;
        iframeObj = document.createElement("iframe");
        iframeObj.id = name;
        iframeObj.name = name;
        iframeObj.style.position = "absolute";
        iframeObj.scrolling = "no";
        iframeObj.setAttribute("frameborder", "0", 0);
        iframeObj.style.zindex = 500;
        document.body.appendChild(iframeObj);
        Harry.frmObj = iframeObj;
        return Harry.frmObj;
    }
    this.CloseIframe = function() {
        Harry.frmObj.style.display = "none";
        //Harry.clickObj=null;
        this.isFloat = false;
    }

    //设置iframe值
    this.ShowIframe = function(str, sp, obj) {
        if (Harry.frmObj == undefined) this.CreateIframe();
        Harry.frmObj.style.display = "block";
        if (str == undefined) { this.SetIframeValue(""); this.ShowIframeLayer(); this.isFloat = true; return; } else { this.isFloat = false; };
        this.SetIframeValue(str);
        Harry.frmObj.style.width = "100px";
        Harry.frmObj.style.height = "100px";
        Harry.frmObj.style.filter = "alpha(opacity=100)";
        Harry.frmObj.style.MozOpacity = 100 / 100; //调透明度		
        var w, h;
        w = harryiframe.document.body.scrollWidth;
        h = harryiframe.document.body.scrollHeight;

        var x = this.GetX();
        var y = this.GetY("bottom");
        var Cobj = null;
        var scwh = this.GetPageSize();
        var docWidth = scwh[0]; //文档宽
        if (sp == "left") //左角显示
            x = x - w;
        else if (sp == "right")//右角显示
            x = x + w + this.clickObj.style.width;

        //wrp, 08.11.11 ，传入文本框对象，修改列表框的定位问题；
        if (obj != null) {
            CXobj = obj;
            CYObj = obj;
            x = obj.offsetLeft;
            while (CXobj = CXobj.offsetParent) x += CXobj.offsetLeft;

            y = obj.offsetTop + obj.offsetHeight + 2;
            while (CYObj = CYObj.offsetParent) y += CYObj.offsetTop;
        }
        //--------------------------------------------------

        Harry.frmObj.style.left = x + "px";
        Harry.frmObj.style.top = y + "px";

        Harry.frmObj.style.width = w + "px";
        Harry.frmObj.style.height = h + "px";
    }
    this.GetContentDoc = function() {
        var ifrm = (Harry.frmObj.contentWindow) ? Harry.frmObj.contentWindow : (Harry.frmObj.contentDocument.document) ? Harry.frmObj.contentDocument.document : Harry.frmObj.contentDocument;
        return ifrm;
    }
    //向iframe输入内容 私有
    this.SetIframeValue = function(str) {
        str = "<html><body  style='margin:0px;'>" + str + "</body></html>";
        var ifrm = this.GetContentDoc();
        if (ifrm.document.body != null) {
            //ifrm.document.body.innerHTML=str;			
            //return;	
        }

        ifrm.document.open();
        ifrm.document.writeln(str);
        ifrm.document.close();
    }
    //私有
    this.ShowIframeLayer = function() {
        var scwh = this.GetPageSize();
        Harry.frmObj.style.filter = "alpha(opacity=30)";
        Harry.frmObj.style.MozOpacity = 30 / 100; //调透明度
        Harry.frmObj.style.left = "0px";
        Harry.frmObj.style.top = "0px";
        Harry.frmObj.style.width = scwh[0] + "px";
        Harry.frmObj.style.height = scwh[1] + "px";
    }
    //-------------------------------------------------------------------------------------------------------------------------------------------
    //字符串转数组
    this.GetArray = function(str, v) {
        var mArray = new Array();
        if (str == null)
            return mArray;
        var dls = str.split('|');

        mArray.length = 0;
        var tempArray = null;
        var j = 0;
        for (var i = 0; i < dls.length; i++) {
            if (mArray.length > this.ListCount) break;
            tempArray = dls[i].split(',');

            if (v == "") {
                mArray[j] = new Array(tempArray[0], tempArray[1], tempArray[2]);
                j++;
            }
            else {
                if (tempArray[1].indexOf(v) >= 0 || tempArray[2].indexOf(v) >= 0) {
                    mArray[j] = new Array(tempArray[0], tempArray[1], tempArray[2]);
                    j++;
                }
            }
        }

        return mArray;

    }

    //LoadHttp------------------------------------------------------------------------------------------------------------------------------
    AjaxRequestObj = null;
    this.GetHttpRequest = function() {
        if (window.ActiveXObject)//ie
        {
            return new ActiveXObject("Microsoft.XMLHTTP");
        }
        else if (window.XMLHttpRequest)//firfox
        {
            return new XMLHttpRequest();
        }
        else {
            alert("浏览器不支持ajax功能");
        }
        return null;
    }
    this.LoadHttp = function(url, data, func) {

        if (AjaxRequestObj == null) AjaxRequestObj = this.GetHttpRequest();
        var method = data ? "POST" : "GET";
        if (AjaxRequestObj != null) {
            var asy = func == undefined ? false : true;
            var rStr = null;
            AjaxRequestObj.open(method, url, asy);
            AjaxRequestObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            if (asy) {
                AjaxRequestObj.onreadystatechange = function() {
                    if (AjaxRequestObj.readyState == 4 && AjaxRequestObj.responseText) {
                        func(AjaxRequestObj.responseText);
                    }
                }
                AjaxRequestObj.send(data);
            }
            else {
                AjaxRequestObj.send(data);
                return AjaxRequestObj.responseText;
            }
        }
    }
    //----------------------------------------------------------------------------------------------------------------------------------------------------
    this.GetScrollTop = function() {
        var scrollTop = 0;
        if (document.documentElement && document.documentElement.scrollTop) {
            scrollTop = document.documentElement.scrollTop;
        }
        else if (document.body) {
            scrollTop = document.body.scrollTop;
        }
        return scrollTop;
    }
    this.GetPageSize = function() {

        var xScroll, yScroll;

        if (window.innerHeight && window.scrollMaxY) {
            xScroll = document.body.scrollWidth;
            yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
            xScroll = document.body.scrollWidth;
            yScroll = document.body.scrollHeight;
        } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
            xScroll = document.body.offsetWidth;
            yScroll = document.body.offsetHeight;
        }

        var windowWidth, windowHeight;
        if (self.innerHeight) { // all except Explorer
            windowWidth = self.innerWidth;
            windowHeight = self.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
            windowWidth = document.documentElement.clientWidth;
            windowHeight = document.documentElement.clientHeight;
        } else if (document.body) { // other Explorers
            windowWidth = document.body.clientWidth;
            windowHeight = document.body.clientHeight;
        }

        // for small pages with total height less then height of the viewport
        if (yScroll < windowHeight) {
            pageHeight = windowHeight;
        } else {
            pageHeight = yScroll;
        }

        // for small pages with total width less then width of the viewport
        if (xScroll < windowWidth) {
            pageWidth = windowWidth;
        } else {
            pageWidth = xScroll;
        }
        arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight)
        return arrayPageSize;
    }
    //------------------------------------------------------------------------------------------------------------------------------------------------------
    this.ScreenClean = function() {
        var objDiv = this.$ID("winpopdiv");
        if (objDiv) {
            objDiv.style.display = "none";
            this.CloseIframe();
        }

    }
    function SetBooker() {
        var vvv = WebControl_AirCustomerInfoMidDown.GetBooker().value.toString();
        //将此处代码抽化为了一个功能函数DisplayReceiver(vvv) Author:YueBing Dong Date:2009.02.16
        DisplayReceiver(vvv);
    }
    //************************************乘机人信息，选择完乘机人后，更新页面文本框的数据  Author:YueBing Dong Date:2009.02.16
    function SetBookerVer2() {
        var vvv = WebControl_AirCustomerInfoMidDownVer2.GetBooker().value.toString();
        //为联系人信息初始化
        DisplayReceiver(vvv);
    }

    //Add by zy 2009-6-9 复用的SetBookerVer2，用于实现CCBC、腾讯、SOHU等并行系统的联系人列表
    function SetBookerVerControl(control) {
        var vvv = control.GetBooker().value.toString();
        //为联系人信息初始化
        DisplayReceiver(vvv);
    }


    function SetBookerPreSale() {
        var vvv = WebControl_PreTicketControl_AirCustomerInfoMidDown.GetBooker().value.toString();
        DisplayReceiver(vvv);

    }

    //初始化联系人,乘机人信息页面使用[选择联系人]
    function DisplayReceiver(vvv) {
        if (vvv == '' | typeof (vvv) == 'undefined') {
            return;
        }
        var booker = vvv.split('|');
        //alert(booker[0]);typeof (pasname) == 'undefined'

        if (typeof (booker[0]) != 'undefined' & booker[0] != '') {
            document.getElementById("tb_BondPerson").value = booker[0];
        }
        else
            document.getElementById("tb_BondPerson").value = ''


        if (typeof (booker[1]) != 'undefined' & booker[1] != '') {
            document.getElementById("tb_phone").value = booker[1];
        }
        else
            document.getElementById("tb_phone").value = '';
        //Author:YueBingDong Date:2009.04.08 ---Start---
        if (typeof (booker[2]) != 'undefined' & booker[2] != '') {

            if (booker[2].indexOf('-') >= 0) {
                var telArray = booker[2].split('-');
                document.getElementById("tb_telG").value = telArray[0];
                document.getElementById("tb_telN").value = telArray[1];
            }
            else {
                document.getElementById("tb_telG").value = '';
                document.getElementById("tb_telN").value = booker[2];
            }
        }
        else
            document.getElementById("tb_telN").value = '';

        if (typeof (booker[3]) != 'undefined' & booker[3] != '') {
            if (booker[3].indexOf('-') >= 0) {
                var faxArray = booker[3].split('-');
                document.getElementById("tb_faxG").value = faxArray[0];
                document.getElementById("tb_faxN").value = faxArray[1];
            }
            else {
                document.getElementById("tb_faxG").value = '';
                document.getElementById("tb_faxN").value = booker[3];
            }
        }
        else
            document.getElementById("tb_faxN").value = '';
        //---End---
        if (typeof (booker[4]) != 'undefined' & booker[4] != '') {
            document.getElementById("tb_email").value = booker[4];
        }
        else
            document.getElementById("tb_email").value = '';

        if (typeof (booker[5]) != 'undefined' & booker[5] != '') {
            document.getElementById("tb_postcode").value = booker[5];
        }
        else
            document.getElementById("tb_postcode").value = '';

        if (typeof (booker[6]) != 'undefined' & booker[6] != '') {
            document.getElementById("tb_add").value = booker[6];
        }
        else
            document.getElementById("tb_add").value = '';

        if (typeof (booker[7]) != 'undefined' & booker[7] != '') {
            document.getElementById("txtPepole").value = booker[7];
        }
        else
            document.getElementById("txtPepole").value = '';
    }
    //*********************************************************************
    this.ScreenCleanX = function(flg) {
        var objDiv = this.$ID("winpopdiv");
        if (objDiv) {
            objDiv.style.display = "none";
            this.CloseIframe();
            //alert(WebControl_AirCustomerInfoMidDown.GetBooker().value.toString());
            //eval(flg.toString());
            if (flg.toString() == "1") {
                SetBooker();
            }
            if (flg.toString() == "2") {
                location.reload();
            }
            //新版的乘机人信息控件 Ver2.0 Author:YueBing Dong Date:2009.02.16
            if (flg.toString() == "3") {
                SetBookerVer2();
            }
            if (flg.toString() == "4") {
                SetBookerPreSale();
            }
        }

    }


    //Add by zy 2009-6-9 复用的ScreenCleanX，用于实现CCBC、腾讯、SOHU等并行系统的联系人列表
    this.ScreenCleanXControl = function(control, flg) {
        var objDiv = this.$ID("winpopdiv");
        if (objDiv) {
            objDiv.style.display = "none";
            this.CloseIframe();
            //alert(WebControl_AirCustomerInfoMidDown.GetBooker().value.toString());
            //eval(flg.toString());
            if (flg.toString() == "1") {
                SetBooker();
            }
            if (flg.toString() == "2") {
                location.reload();
            }
            //新版的乘机人信息控件 Ver2.0 Author:YueBing Dong Date:2009.02.16
            if (flg.toString() == "3") {
                SetBookerVerControl(control);
            }
            if (flg.toString() == "4") {
                SetBookerPreSale();
            }
        }

    }

    //弹出窗口---------------------------------------------------------------------------------------------------------------------------------------------
    this.WinPop = function(content, title, w, h, bottom) {
        if (bottom != undefined) this.ShowIframe();

        var objDiv = this.$ID("winpopdiv");
        if (title != "") {
            title = "<div id='titlediv' class='winpop'><table border='0px' width='100%' cellpadding='0' cellspacing='0'><tr><td >" + title + "</td><td width='20px'><div class='winpopx' onclick='Harry.Base.ScreenClean();'>X</div></td></tr></table></div>";
        }
        var outC = "<div style='border:1px solid #CCCCCC; background-color:#FFFFFF; width:" + w + "px; height:" + h + "px;'>" + title + "<div style='padding:5px;'>" + content + "</div></div>";

        if (!objDiv) {
            objDiv = document.createElement("div");
            objDiv.style.zIndex = "550";
            objDiv.id = "winpopdiv";
            objDiv.style.position = "absolute";
            document.body.appendChild(objDiv);
        }
        var scwh = this.GetPageSize();
        if (w == 0 && h == 0) {
            objDiv.style.left = this.GetX() + "px";
            objDiv.style.top = this.GetY() + "px";
        }
        else {
            objDiv.style.left = scwh[0] / 2 - w / 2 + "px";
            objDiv.style.top = (scwh[3] / 2 + this.GetScrollTop() - h / 2) + "px";
        }
        objDiv.innerHTML = outC;
        objDiv.style.display = "block";
        if (title != "")
            this.MoveDiv("winpopdiv", "titlediv");

    }
    //空白
    this.WinPopBlank = function(content, title, w, h, bottom) {
        if (bottom != undefined) this.ShowIframe();
        var objDiv = this.$ID("winpopdiv");
        if (title != "") {
            title = "<div id='titlediv' style='height:18px; background-color:#fcaf17;width:99%; border-bottom:1px solid #E0C921; font-weight:bold; font-size:14px; padding-top:1px; padding-left:5px;'><table border='0px' width='100%' cellpadding='0' cellspacing='0'><tr><td style='color:black;'>" + title + "</td><td width='20px'><div style='border:1px solid #CCCCCC;text-align:center;margin:0 0 0 0;background-color:#005344;cursor:pointer;color:white;' onclick='Harry.Base.ScreenClean();'>X</div></td></tr></table></div>";
        }
        var outC = "<div style='border:1px solid #CCCCCC; background-color:#FFFFFF; width:" + w + "px; height:" + h + "px;'>" + title + "<div style='padding:5px;'>" + content + "</div></div>";

        if (!objDiv) {
            objDiv = document.createElement("div");
            objDiv.style.zIndex = "550";
            objDiv.id = "winpopdiv";
            objDiv.style.position = "absolute";
            document.body.appendChild(objDiv);
        }
        var scwh = this.GetPageSize();
        if (w == 0 && h == 0) {
            objDiv.style.left = this.GetX() + "px";
            objDiv.style.top = this.GetY() + "px";
        }
        else {
            objDiv.style.left = scwh[0] / 2 - w / 2 + "px";
            objDiv.style.top = (scwh[3] / 2 + this.GetScrollTop() - h / 2) + "px";
        }
        objDiv.innerHTML = outC;
        objDiv.style.display = "block";
        if (title != "")
            this.MoveDiv("winpopdiv", "titlediv");

    }
    //浦发
    this.WinPopBlankPF = function(content, title, w, h, bottom) {
        if (bottom != undefined) this.ShowIframe();
        var objDiv = this.$ID("winpopdiv");
        if (title != "") {
            title = "<div id='titlediv' class='winpop'><table border='0px' width='100%' cellpadding='0' cellspacing='0'><tr><td>" + title + "</td><td width='20px'><div class='winpopx' onclick='Harry.Base.ScreenClean();'>X</div></td></tr></table></div>";
        }
        var outC = "<div style='border:1px solid #CCCCCC; background-color:#FFFFFF; width:" + w + "px; height:" + h + "px;'>" + title + "<div style='padding:5px;'>" + content + "</div></div>";

        if (!objDiv) {
            objDiv = document.createElement("div");
            objDiv.style.zIndex = "550";
            objDiv.id = "winpopdiv";
            objDiv.style.position = "absolute";
            document.body.appendChild(objDiv);
        }
        var scwh = this.GetPageSize();
        if (w == 0 && h == 0) {
            objDiv.style.left = this.GetX() + "px";
            objDiv.style.top = this.GetY() + "px";
        }
        else {
            objDiv.style.left = scwh[0] / 2 - w / 2 + "px";
            objDiv.style.top = (scwh[3] / 2 + this.GetScrollTop() - h / 2) + "px";
        }
        objDiv.innerHTML = outC;
        objDiv.style.display = "block";
        if (title != "")
            this.MoveDiv("winpopdiv", "titlediv");

    }
    //Add by zy 2009-7-22 解决ICBC中登录窗口位置问题
    this.WinPopBlankICBC = function(content, title, w, h, top, bottom) {
        if (bottom != undefined) this.ShowIframe();

        var objDiv = this.$ID("winpopdiv");
        if (title != "") {
            title = "<div id='titlediv' style='height:18px; background-color:#fcaf17;width:99%; border-bottom:1px solid #E0C921; font-weight:bold; font-size:14px; padding-top:1px; padding-left:5px;'><table border='0px' width='100%' cellpadding='0' cellspacing='0'><tr><td style='color:black;'>" + title + "</td><td width='20px'><div style='border:1px solid #CCCCCC;text-align:center;margin:0 0 0 0;background-color:#005344;cursor:pointer;color:white;' onclick='Harry.Base.ScreenClean();'>X</div></td></tr></table></div>";
        }
        var outC = "<div style='border:1px solid #CCCCCC; background-color:#FFFFFF; width:" + w + "px; height:" + h + "px;'>" + title + "<div style='padding:5px;'>" + content + "</div></div>";

        if (!objDiv) {
            objDiv = document.createElement("div");
            objDiv.style.zIndex = "550";
            objDiv.id = "winpopdiv";
            objDiv.style.position = "absolute";
            document.body.appendChild(objDiv);
        }
        var scwh = this.GetPageSize();
        if (w == 0 && h == 0) {
            objDiv.style.left = this.GetX() + "px";
            objDiv.style.top = this.GetY() + "px";
        }
        else {
            objDiv.style.left = scwh[0] / 2 - w / 2 + "px";
            //objDiv.style.top = (scwh[3] / 2 + this.GetScrollTop() - h / 2) + "px";
//            objDiv.style.position = "absolute"; 
            objDiv.style.top = top + "px";
        }
        objDiv.innerHTML = outC;
        objDiv.style.display = "block";
        if (title != "")
            this.MoveDiv("winpopdiv", "titlediv");

    }

    this.WinPopX = function(content, title, w, h, bottom, flg) {
        if (bottom != undefined) this.ShowIframe();
        var objDiv = this.$ID("winpopdiv");
        if (title != "") {
            if (flg.toString() != "0")
                title = "<div id='titlediv' style='height:18px; background-color:#fcaf17;width:99%; border-bottom:1px solid #E0C921; font-weight:bold; font-size:14px; padding-top:1px; padding-left:5px;'><table border='0px' width='100%' cellpadding='0' cellspacing='0'><tr><td style='color:black;'>" + title + "</td><td width='20px'><div style='border:1px solid #CCCCCC;text-align:center;margin:0 0 0 0;;background-color:#005344;cursor:pointer;color:white;' onclick='Harry.Base.ScreenCleanX(" + flg + ");'>X</div></td></tr></table></div>";
            else
                title = "<div id='titlediv' style='height:18px; background-color:#fcaf17;width:99%; border-bottom:1px solid #E0C921; font-weight:bold; font-size:14px; padding-top:1px; padding-left:5px;'><table border='0px' width='100%' cellpadding='0' cellspacing='0'><tr><td style='color:black;'>" + title + "</td><td width='20px'><div style='border:1px solid #CCCCCC;text-align:center;margin:0 0 0 0;;background-color:#005344;cursor:pointer;color:white;' onclick='Harry.Base.ScreenClean();'>X</div></td></tr></table></div>";
        }
        var outC = "<div style='border:1px solid #CCCCCC; background-color:#FFFFFF; width:" + w + "px; height:" + h + "px;'>" + title + "<div style='padding:5px;'>" + content + "</div></div>";

        if (!objDiv) {
            objDiv = document.createElement("div");
            objDiv.style.zIndex = "550";
            objDiv.id = "winpopdiv";
            objDiv.style.position = "absolute";
            document.body.appendChild(objDiv);
        }
        var scwh = this.GetPageSize();
        if (w == 0 && h == 0) {
            objDiv.style.left = this.GetX() + "px";
            objDiv.style.top = this.GetY() + "px";
        }
        else {
            objDiv.style.left = scwh[0] / 2 - w / 2 + "px";
            objDiv.style.top = (scwh[3] / 2 + this.GetScrollTop() - h / 2) + "px";
        }
        objDiv.innerHTML = outC;
        objDiv.style.display = "block";
        if (title != "")
            this.MoveDiv("winpopdiv", "titlediv");

    }

    //Add by zy 2009-6-9 复用的WinPopX，用于实现CCBC、腾讯、SOHU等并行系统的联系人列表
    this.WinPopXControl = function(content, control, title, w, h, bottom, flg) {
        if (bottom != undefined) this.ShowIframe();
        var objDiv = this.$ID("winpopdiv");
        if (title != "") {
            if (flg.toString() != "0")
                title = "<div id='titlediv' class = 'winpop'><table border='0px' width='100%' cellpadding='0' cellspacing='0'><tr><td >" + title + "</td><td width='20px'><div class='winpopx' onclick='Harry.Base.ScreenCleanXControl(" + control + "," + flg + ");'>X</div></td></tr></table></div>";
            else
                title = "<div id='titlediv' class = 'winpop'><table border='0px' width='100%' cellpadding='0' cellspacing='0'><tr><td >" + title + "</td><td width='20px'><div class='winpopx' onclick='Harry.Base.ScreenClean();'>X</div></td></tr></table></div>";
        }
        var outC = "<div style='border:1px solid #CCCCCC; background-color:#FFFFFF; width:" + w + "px; height:" + h + "px;'>" + title + "<div style='padding:5px;'>" + content + "</div></div>";

        if (!objDiv) {
            objDiv = document.createElement("div");
            objDiv.style.zIndex = "550";
            objDiv.id = "winpopdiv";
            objDiv.style.position = "absolute";
            document.body.appendChild(objDiv);
        }
        var scwh = this.GetPageSize();
        if (w == 0 && h == 0) {
            objDiv.style.left = this.GetX() + "px";
            objDiv.style.top = this.GetY() + "px";
        }
        else {
            objDiv.style.left = scwh[0] / 2 - w / 2 + "px";
            objDiv.style.top = (scwh[3] / 2 + this.GetScrollTop() - h / 2) + "px";
        }
        objDiv.innerHTML = outC;
        objDiv.style.display = "block";
        if (title != "")
            this.MoveDiv("winpopdiv", "titlediv");

    }

    //移动div--------------------------------------------------------------------------------------------------------------------------------------------------
    this.MoveDiv = function(objid, clickobj) {
        div_obj = this.$ID(objid);
        click_div = this.$ID(clickobj);
        offsetX = 0;
        offsetY = 0;
        div_obj.style.position = "absolute";
        click_div.style.cursor = "move";
        var move = false;
        click_div.onmousemove = function(e) {
            e = e ? e : window.event;
            if (e.button != 1 || !move) return false;
            var top = e.clientY; //?e.clientY:e.pageY;
            var left = e.clientX; //?e.clientX:e.pageX;
            div_obj.style.left = left - offsetX;
            div_obj.style.top = top - offsetY;
            return false;
        }
        click_div.onmousedown = function(e) {
            move = true;
            //document.addEventListener("mousemove",mousemovefunction,true);
            //document.removeEventListener("mousemove",mousemovefunction,true);
            click_div.setCapture();
            e = e ? event : window.event;
            var x = e.clientX; //?e.clientX:e.pageX;
            var y = e.clientY; //?e.clientY:e.pageY;
            offsetY = y - parseInt(div_obj.style.top);
            offsetX = x - parseInt(div_obj.style.left);
        }
        click_div.onmouseup = function() {
            move = false;
            click_div.releaseCapture();
        }
    }

    //移动div结束------------------------------------------------------------------------------------------------------------------------------------------------
    //--------------------
    this.Init = function() {
        var otherjs = this.$ID("basejs").src;
        if (otherjs.indexOf('?') > 0) {
            otherjs = otherjs.split('?')[1];
            otherjs = otherjs.split(',');
            for (var i = 0; i < otherjs.length; i++) {
                this.LoadJS(Harry.JsPath + otherjs[i] + ".js", "temp" + i);
            }
        }
    }
    //------------------------------------------------------------------------------------------------------------------------------------------------
}
Harry.Base.Init();
function DocumentOnClick(e) {

}
function DocumentMousedown(e) {
    e = window.event || e;
    var srcElement = e.srcElement || e.target;

    if (srcElement != Harry.clickObj) {
        if (Harry.frmObj == null)
            Harry.Base.CreateIframe();

        if (!Harry.Base.isFloat) {
            Harry.Base.CloseIframe();
            Harry.clickObj = srcElement;
        }
    }
}
if (document.all) {
    document.attachEvent('onmouseup', DocumentMousedown)//IE中 

}
else {
    document.addEventListener('mouseup', DocumentMousedown, false); //firefox
}