﻿function bookmarksite(title, url) {
    if (document.all)
        window.external.AddFavorite(url, title);
    else if (window.sidebar)
        window.sidebar.addPanel(title, url, "");                
}
var c = 1;
var t;
function stopTime(n) {
    c = n;
    setgg();
    clearTimeout(t);
}
function xxkover(name, title, len) {
    var top = "";
    if (title == null || title.length < 1) {
        title = "xxk";
        top = title.substring(0, title.length-1);
    }
    if (len == null || len.length < 1) {
        len = 6;
    }
    for (var i = 1; i < len; i++) {
        if (name == title + i) {
            document.getElementById(title + i).style.display = "block";
            document.getElementById(top + i).style.backgroundImage = "url(../image/bg3.jpg)";
        } else {
        document.getElementById(title + i).style.display = "none";
        document.getElementById(top + i).style.backgroundImage = "none";
        }
    }
}
var kfdivtent = '\
        <div id="ke_con" onmousedown="move(\'kefu\')">\
            <b></b>\
            <div id="kf_Con_1">\
                <div>\
                    <h3>联系客服</h3>\
                    <a id="kf_Top_2_2" onclick="close_kf()" onmouseover="close_over(this)" onmouseout="close_out(this)"></a>\
                </div>\
                <ul onmouseover="this.style.backgroundColor=\'#BFD7A5\';" onmouseout="this.style.backgroundColor=\'#FFFFFF\';">\
                            <li class="kf_li1"><img src="http://www.qididai.com/image/kf/kf9.jpg"/></li>\
                            <li class="kf_li2"><a href="javascript:void(0);" onclick="window.open(\'http://www.qididai.com/chat/chat.aspx\',\'\',\'height=630, width=880,top=200, left=200\')">在线客服</a></li>\
                            <li class="kf_li3" style="padding:0px;"><a href="javascript:void(0);" onclick="window.open(\'http://www.qididai.com/chat/chat.aspx\',\'\',\'height=630, width=880,top=200, left=200\')"><div class="kfbt">联系客服</div></a></li>\
                       </ul>\
                         <ul onmouseover="this.style.backgroundColor=\'#BFD7A5\';" onmouseout="this.style.backgroundColor=\'#FFFFFF\';"> \
                            <li class="kf_li1"><img src="http://www.qididai.com/image/kf/kf1.jpg" /></li>\
                            <li class="kf_li2"><a target="_self" href="tencent://message/?uin=406460357&Site=企地带&Menu=yes">客服QQ</a></li>\
                            <li class="kf_li3" style="padding:0px;"><a target="_self" href="tencent://message/?uin=406460357&Site=跳台网&Menu=yes"><div class="kfbt">客服QQ</div></a></li>\
                        </ul>\
                        <ul onmouseover="this.style.backgroundColor=\'#BFD7A5\';" onmouseout="this.style.backgroundColor=\'#FFFFFF\';">\
                            <li class="kf_li1"><img src="http://www.qididai.com/image/kf/kf4.jpg" /></li>\
                            <li class="kf_li2">客服信箱</li>\
                            <li class="kf_li3">kefu001#qididai.com(把#改成@)</li>\
                        </ul>\
                        <ul onmouseover="this.style.backgroundColor=\'#BFD7A5\';" onmouseout="this.style.backgroundColor=\'#FFFFFF\';">  \
                            <li class="kf_li1"><img src="http://www.qididai.com/image/kf/kf5.jpg" /></li>\
                            <li class="kf_li2">客服热线</li>\
                            <li class="kf_li3">拨打客服热线400-678-6733</li>\
                          </ul>\
                        <ul onmouseover="this.style.backgroundColor=\'#BFD7A5\';" onmouseout="this.style.backgroundColor=\'#FFFFFF\';">\
                            <li class="kf_li1"><img src="http://www.qididai.com/image/kf/kf6.jpg" /></li>\
                            <li class="kf_li2"><a href="msnim:chat?contact=qididaikefu@live.cn">MSN</a></li>\
                            <li class="kf_li3" style="padding:0px;"><a href="msnim:chat?contact=qididaikefu@live.cn"><div class="kfbt">MSN留言</div></a></li>\
                          </ul>\
            </div>\
            <em></em>\
        </div>'
var kf_bool = false;
var kf_obj;
function create_kf(objname, e, type,left) {
    var obj = document.getElementById(objname);
    kf_obj = obj;
    obj.innerHTML = kfdivtent;
    switch (type) {
        case "1": left = left - 100;break;
        case "2": left = parseInt(left); break;
        case "3": left = left; break;
        default: left = 900; break;
    }
    var height = e.offsetHeight;
    obj.style.left = left;
    obj.style.top = e.offsetTop + height;    
    obj.style.display = "block";
}
function close_kf() {
    kf_obj.innerHTML = "";
    kf_obj.style.display = "none";
}
function close_over(t) {
    t.style.background = "url(http://www.qididai.com/image/kf/kf-1.png) no-repeat -9px -9px";
    t.style.cursor = "hand";
}
function close_out(t) {
    t.style.background = "url(http://www.qididai.com/image/kf/kefu2.gif)";
}
//text 要输出的内容 
function showmsg(title,text) {
    var value = '<div id="msg_1"  onmousedown=\'move("msg")\'><div id="msg_1_1">【' + title + '】</div><div id="msg_1_2">' +
                '<img id="closeimage" src="/image/App_Themes/delete.gif" /></div><div id="msg_2"><div id="msg_2_1"><img src="/image/App_Themes/icon_big_info.gif"  alt=""/></div><div id="msg_2_2">'
                + text + '</div><div id="msg_2_3"><input id="closebtn" type="button" class="TreeAlertMsgbt_mouseout" value=" 确 定 "'
                    + 'onmousemove="this.className=\'TreeAlertMsgbt_mouseover\'" onmouseout="this.className=\'TreeAlertMsgbt_mouseout\'" /></div></div>';
    //下面两个固定 页面上必须得有这两个div    
    //SetdivID2("LoginControl_div2", "150", "400", value);
    //showIframe("LoginControl_div1", "LoginControl_div2", "150", "400");
    document.getElementById("msg").innerHTML = value;
    filterShow("filterDiv", "msg", 'closeimage|closebtn');
}
//通用，以完成
/*
    层的移动
*/
function move(objId) {
    //最大高度
    var maxheight = document.documentElement.clientHeight > document.documentElement.scrollHeight ? document.documentElement.clientHeight : document.documentElement.scrollHeight;
    var moveMaxHeight = maxheight - document.getElementById(objId).offsetHeight;
    var moveMaxWidth = document.documentElement.clientWidth - document.getElementById(objId).offsetWidth
    var obj = document.getElementById(objId);
    obj.onmousedown = function(e) {
        var isMove = true;
        var x, y;
        var objstyle = this.style;
        e = !e ? window.event : e;
        objstyle.cursor = "move";
        objstyle.position = "absolute";
        x = obj.offsetLeft - e.clientX;
        y = obj.offsetTop - e.clientY;
        document.onmousemove = function(e) {
            if (!isMove) return false;
            e = !e ? window.event : e;
            var nowHeight = parseInt(e.clientY + y);
            var nowWidth = parseInt(e.clientX + x);
            objstyle.left = nowWidth + "px";
            objstyle.top = nowHeight + "px";
            if (nowHeight < 0) {
                objstyle.top = "0px";
            }
            else if (nowHeight > moveMaxHeight) {
                objstyle.top = moveMaxHeight + "px";
            }
            if (nowWidth < 0) {
                objstyle.left = "0px";
            } else if (nowWidth > moveMaxWidth) {
                objstyle.left = moveMaxWidth + "px";
            }
        }
            document.onmouseup = function() {
            objstyle.cursor = "auto";
            isMove = false;
            obj.onmousedown = function() { };           
        }
    }
}
/*
    透明层，第一个为透明的层，第二个是要显示的层 ,第三个选择他关闭前面两个层如果是多个层请用" | "符号分割（引号是标注）
*/
function filterShow(objId, objId2, objId3) {
    //最大高度
    var maxheight = document.documentElement.clientHeight > document.documentElement.scrollHeight ? document.documentElement.clientHeight : document.documentElement.scrollHeight;
    var obj2 = document.getElementById(objId2);
    var obj2style = obj2.style;
    var de = document.documentElement;
    obj2style.position = "absolute";
    obj2style.display = "block";
    obj2style.left = ((de.clientWidth - obj2.clientWidth) / 2) + "px";
    obj2style.top = ((de.clientHeight - obj2.clientHeight) / 2) + "px";
    obj2style.zIndex = "10";
    var obj = document.getElementById(objId);
    var objstyle = obj.style;
    objstyle.position = "absolute";
    objstyle.left = objstyle.top = "0px";
    objstyle.width = de.clientWidth + "px";
    objstyle.height = maxheight + "px";
    objstyle.zIndex = "9";
    objstyle.backgroundColor = "#000000";
    document.all ? objstyle.filter = "alpha(opacity=50)" : objstyle.opacity = "0.5";
    objstyle.display = "block";
    obj.onclick = function() { objstyle.display = "none"; obj2style ? obj2style.display = "none" : null; }
    var objs = objId3.split('|');
    for (var i = 0; i < objs.length; i++) {
        var obj3 = document.getElementById(objs[i]);
        if (obj3) {
            obj3.onclick = function() {
                obj2style ? obj2style.display = "none" : null;
                objstyle ? objstyle.display = "none" : null;
            }
        }
    }
}

function pageFunObj(id, array) {
    var divid;
    for (var i = 0; i < array.length; i++) {
        divid = "p" + (i + 1);
        if (id == i) {
            $(array[i]).style.display = "block";
            $(divid).className = "pd1";
        } else {
            $(array[i]).style.display = "none";
            $(divid).className = "pd2";
        }
    }
}
var InitPage = new Array("div_zhuanti2_2_4", "div_zhuanti2_2_5", "div_zhuanti2_2_6", "div_zhuanti2_2_7");
function pageFun(id) {
    pageFunObj(id, InitPage);
}
var InitPage1 = new Array("div_zhuanti2_2_4", "div_zhuanti2_2_5");
function pageFun1(id) {
    pageFunObj(id, InitPage1);
}
function pageString(id,count) {
    var page = $("pagediv");
    page.innerHTML='<div class="pd3">共'+id+'页 '+count+'条 8条/页</div>';
    for(;id>0;id--){
        page.innerHTML += (id != 1) ? '<div id="p' + id + '" class="pd2" onclick="pageFun(' + (id - 1) + ')">' + id + '</div>' : '<div id="p1" class="pd1" onclick="pageFun(0)">1</div>';
    }
}
function pageString1(id, count) {
    var page = $("pagediv");
    page.innerHTML = '<div class="pd3">共' + id + '页 ' + count + '条 6条/页</div>';
    for (; id > 0; id--) {
        page.innerHTML += (id != 1) ? '<div id="p' + id + '" class="pd2" onclick="pageFun1(' + (id - 1) + ')">' + id + '</div>' : '<div id="p1" class="pd1" onclick="pageFun1(0)">1</div>';
    }
}
function pageString2(count) {
    var page = $("pagediv");
    for (var id=1; count >= id; id++) {
        page.innerHTML += (id != 1) ? '<div id="p' + id + '" class="pd2" onclick="pageGo(' + (id) + ')">' + id + '</div>' : '<div id="p1" class="pd1" onclick="pageGo(1)">1</div>';
    }
}

function pageGo(id) {
    var divid="p1",conid;
    var i=1;
    do {
        conid = "cont" + i;
        if (id == i) {
            $(conid).style.display = "block";
            $(divid).className = "pd1";
        } else {
            $(conid).style.display = "none";
            $(divid).className = "pd2";
        }
        i++;
        divid = "p" + (i);
    } while ($(divid));
}
//获取ID
function $(al) {
    if (document.getElementById) {
        return eval('document.getElementById("' + al + '")');
    } else if (document.layers) {
        return eval("document.layers['" + al + "']");
    } else {
        return eval('document.all.' + al);
    }
}

var search = function() {
    if (ID$('textTitle').value.isChinaOrNumbOrLett()) {
        window.location.href = '/search--' + ID$('textTitle').value.trim() + '.html';
        return false;
    }
    return false;
}
var inputText = function() {
    if (event.keyCode == 13) {
        return search();
    }
}
function ObindMap(x, y, z, maptitle, div) {
    var maps = new LTMaps(div);
    var point = new LTPoint(x, y);
    maps.centerAndZoom(point, z);
    var c = new LTSmallMapControl();
    maps.addControl(c);
    var point = new LTPoint(x, y); //福建3G
    var marker = new LTMarker(point);
    maps.addOverLay(marker);
    var text = new LTMapText(marker);
    text.setLabel(maptitle);
    maps.addOverLay(text);
}
function zoom(x, y, z, maptitle) {
    InncludeCss("stydiv", "http://com.qididai.com/css/photo.css");
    var map = document.createElement("div");
    map.id = "map";
    map.style.width = "794px";
    map.style.height = "578px";
    alertWin("公司地理位置", map, 800, 600);
    ObindMap(x, y, z, maptitle, 'map');
}

function InncludeCss(sid, fileUrl) {
    if ($(sid) == undefined) {
        var head = document.getElementsByTagName('HEAD').item(0);
        var style = document.createElement('link');
        style.id = sid;
        style.href = fileUrl;
        style.rel = 'stylesheet';
        style.type = 'text/css';
        head.appendChild(style);
    }
}

//解决改变分辨率的变化
var Class = function (p) {
    var c = function () {
        return (arguments[0] !== null && this.initialize && typeof (this.initialize) == "function") ?
            this.initialize.apply(this, arguments) : this;
    }; c.prototype = p; return c;
};
function extend(d, s) { for (var p in s) { d[p] = s[p]; } return d; }
function apply(o, fn) {
    var args = Array.prototype.slice.call(arguments, 2);
    return function () { return fn.apply(o, args); };
}
var texiao = new Class({
    setOptions: function (options) {
        this.options = {
            preObj: null,
            animateObj: null,
            desLeft: 1,
            speed: 5,
            timeSpacing: 15,
            finishFn: function () { }
        }; extend(this.options, options || {});
    },
    initialize: function (options) {
        this.setOptions(options);
        if (!this.options.animateObj) return;

        if (this.options.preObj)
            this.preObj = typeof this.options.preObj == "string" ? document.getElementById(this.options.preObj) : this.options.preObj;
        this.animateObj = typeof this.options.animateObj == "string" ? document.getElementById(this.options.animateObj) : this.options.animateObj;

        this.fly();
    },
    fly: function () {
        if (this.preObj) {
            this.preObj.style.position = "absolute";
        }
        if (document.all) this.animateObj.parentNode.style.position = "relative";
        this.animateObj.style.position = "relative";
        if (document.all) this.animateObj.style.filter = "alpha(opacity=0)";
        else this.animateObj.style.opacity = 0;

        this.animateObj.style.left = "510px";
        this.animateObj.style.display = "block";
        var _fly = function () {
            var currl = parseInt(this.animateObj.style.left);
            var dist = Math.round(currl / this.options.speed); if (dist < 1) dist = 1;
            this.animateObj.style.left = currl - dist + "px";
            var _opacity = this.options.desLeft / currl;
            if (_opacity < 0.1) _opacity = 0.1;
            if (document.all) {
                this.animateObj.style.filter = 'alpha(opacity=' + Math.round(_opacity * 100) + ')';
            }
            else {
                this.animateObj.style.opacity = _opacity;
            }
            if (currl <= 0) {
                if (document.all) this.animateObj.style.filter = "";
                else this.animateObj.style.opacity = "";
                clearInterval(this.animateObj.timer);
                this.options.finishFn();
                this.animateObj.style.position = "";
                this.animateObj.style.left = "";
            }
        };
        this.animateObj.timer = setInterval(apply(this, _fly), this.options.timeSpacing);
    }
});