﻿function $(e){
    return top.document.getElementById(e);
}

function CreatDiv2(toUid){
    if (GetCookieValue("User", "Uid") != null && GetCookieValue("User", "Uid") != "") {
        //外框
        var _d1 = top.document.createElement("div");
        _d1.id = "_d1";
        _d1.style.position = "absolute";
        _d1.style.width = "600px";
        _d1.style.height = "500px";
        _d1.style.backgroundImage = "url(/newGreet/images/dzh_bg.gif)";
        _d1.style.left = "25%";
        _d1.style.top = "30%";
        _d1.style.zIndex = "1001";
        var cDiv = top.document.createElement;
        top.document.body.appendChild(_d1);
        //头部
        var _d2 = cDiv("div");
        _d2.id = "_d2";
        _d2.style.color = "white";
        _d2.style.fontWeight = "bold";
        _d2.style.padding = "3px";
        _d2.style.height = "15px";
        _d1.appendChild(_d2);
        //主题
        var _d3 = cDiv("div");
        _d3.style.styleFloat = "left";
        _d3.style.fontSize = "12pt";
        _d3.style.padding = "15px 0px 0px 20px";
        _d3.innerHTML = "打招呼";
        //关闭
        var _d4 = cDiv("div");
        _d4.style.styleFloat = "right";
        _d4.style.cursor = "hand"
        _d4.style.padding = "16px 20px 0px 20px";
        _d4.innerHTML = "<img src='/newGreet/images/DF_my_gb.gif' alt='关闭'>";
        _d4.onclick = function(){
            //移除对象,背景
            top.document.body.removeChild($("maskdiv"));
            _d1.parentNode.removeChild(_d1);
        }
        _d2.appendChild(_d3);
        _d2.appendChild(_d4);
        //内容
        var _d5 = cDiv("div");
        _d5.style.padding = "12px 0px 0px 5px";
        _d1.appendChild(_d5);
        var frm = cDiv("iframe");
        frm.id = "iframelist";
        frm.setAttribute('frameborder', '0', 0);
        frm.style.width = "590px";
        frm.style.height = "430px";
        frm.src = "http://www.liehunwang.com/newGreet/Step1.aspx?ToUid=" + toUid;
        _d5.appendChild(frm);
        //reloadfrm();
    }
    else {
        CreatDiv3(toUid);
    }
}

function CreatDiv5(toUid, dw, dh, fw, fh, url, title){
    if (GetCookieValue("User", "Uid") != null && GetCookieValue("User", "Uid") != ""){
        //外框
        var _d1 = top.document.createElement("div");
        _d1.id = "_d1";
        _d1.style.position = "absolute";
        _d1.style.width = "600px";
        _d1.style.height = "500px";
        _d1.style.backgroundImage = "url(/newGreet/images/dzh_bg.gif)";
        _d1.style.left = "35%";
        _d1.style.top = "15%";
        _d1.style.zIndex = "1001";
        var cDiv = top.document.createElement;
        top.document.body.appendChild(_d1);
        //头部
        var _d2 = cDiv("div");
        _d2.id = "_d2";
        _d2.style.color = "white";
        _d2.style.fontWeight = "bold";
        _d2.style.padding = "3px";
        _d2.style.height = "15px";
        _d1.appendChild(_d2);
        //主题
        var _d3 = cDiv("div");
        _d3.style.styleFloat = "left";
        _d3.style.fontSize = "12pt";
        _d3.style.padding = "15px 0px 0px 20px";
        _d3.innerHTML = title;
        //关闭
        var _d4 = cDiv("div");
        _d4.style.styleFloat = "right";
        _d4.style.cursor = "hand"
        _d4.style.padding = "16px 20px 0px 20px";
        _d4.innerHTML = "<img src='/newGreet/images/DF_my_gb.gif' alt='关闭'>";
        _d4.onclick = function(){
            //移除对象,背景
            top.document.body.removeChild($("maskdiv"));
            _d1.parentNode.removeChild(_d1);
        }
        _d2.appendChild(_d3);
        _d2.appendChild(_d4);
        //内容
        var _d5 = cDiv("div");
        _d5.style.padding = "12px 0px 0px 5px";
        _d1.appendChild(_d5);
        var frm = cDiv("iframe");
        frm.id = "iframelist";
        frm.setAttribute('frameborder', '0', 0);
		frm.style.Scrolling = "no";
        frm.style.width = "590px";
        frm.style.height = "430px";
        frm.src = url;
        _d5.appendChild(frm);
        //reloadfrm();
    }
    else {
        CreatDiv3(toUid);
    }
}

function chkLogin(toUid, url){
    //如果没有登录
    if (GetMyCookies("jgyUserID") != null && GetMyCookies("jgyUserID") !="") {
        window.location.href = url;
    }
    else {
        ShowMask();
        CreatDiv3(toUid);
    }
}

function CreatDiv3(toUid){
    //外框
    var _d1 = top.document.createElement("div");
    _d1.id = "_d1";
    _d1.style.position = "absolute";
    _d1.style.width = "400px";
    _d1.style.height = "344px";
    _d1.style.backgroundImage = "url(/newLogin/images/dzh_bg_dr.gif)";
    _d1.style.left = (document.body.clientWidth - 600) / 2 + document.body.scrollLeft;
    _d1.style.top = (document.body.clientHeight - 850) / 2 + document.body.scrollTop;
    _d1.style.zIndex = "1001";
    var cDiv = top.document.createElement;
    top.document.body.appendChild(_d1);
    //头部
    var _d2 = cDiv("div");
    _d2.id = "_d2";
    _d2.style.color = "white";
    _d2.style.fontWeight = "bold";
    _d2.style.padding = "3px";
    _d2.style.height = "15px";
    _d1.appendChild(_d2);
    //主题
    var _d3 = cDiv("div");
    _d3.style.styleFloat = "left";
    _d3.style.fontSize = "12pt";
    _d3.style.padding = "15px 0px 0px 20px";
    _d3.innerHTML = "提示信息";
    //关闭
    var _d4 = cDiv("div");
    _d4.style.styleFloat = "right";
    _d4.style.cursor = "hand"
    _d4.style.padding = "16px 20px 0px 20px";
    _d4.innerHTML = "<img src='/newLogin/images/DF_my_gb.gif' alt='关闭'>";
    _d4.onclick = function(){
        //移除对象,背景
        top.document.body.removeChild($("maskdiv"));
        _d1.parentNode.removeChild(_d1);
    }
    _d2.appendChild(_d3);
    _d2.appendChild(_d4);
    //内容
    var _d5 = cDiv("div");
    _d5.style.padding = "12px 0px 0px 5px";
    _d1.appendChild(_d5);
    var frm = cDiv("iframe");
    frm.id = "iframelist";
    frm.setAttribute('frameborder', '0', 0);
    frm.setAttribute('scrolling', 'no');
    frm.style.width = "390px";
    frm.style.height = "280px";
    frm.src = "http://www.liehunwang.com/newLogin/LoginQuick.html?ToUid=" + toUid;
    _d5.appendChild(frm);
    //reloadfrm();
}

//显示灰色背景并遮住屏幕
function ShowMask(){
    var sWidth, sHeight;
    sWidth = document.body.offsetWidth;
    if (screen.availHeight > top.document.body.scrollHeight) {
        sHeight = screen.availHeight; //少于一屏
    }
    else {
        sHeight = top.document.body.scrollHeight; //多于一屏 
    }
    //创建遮罩背景 
    var maskObj = top.document.createElement("div");
    maskObj.setAttribute('id', 'maskdiv');
    maskObj.style.position = "absolute";
    maskObj.style.top = "0";
    maskObj.style.left = "0";
    maskObj.style.background = "#777";
    maskObj.style.filter = "Alpha(opacity=20);";
    maskObj.style.opacity = "0.3";
    maskObj.style.width = sWidth + "px";
    maskObj.style.height = sHeight + "px";
    maskObj.style.zIndex = "1000";
    top.document.body.appendChild(maskObj);
}

//function reloadfrm(){
    //window.frames["iframelist"].location.reload();
//}


