﻿/**
 * @作用　弹出窗体信息
 */  
function winBody(width,height,url,isMax){
        var opts = {};
        opts.id = Math.round(Math.random()*10000);
        var arr = [];
        arr.push("<table border='0' cellpadding='0' cellspacing='0' width='"+width+"'>");
        arr.push("<tr>");
        arr.push("<td width='13' height='20' style=\"background-image:url(/jjxt/style/images/dialog_lt.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_lt.png', sizingMethod='crop');\"><div style='width:13px;'></div></td>");
        arr.push("<td height='20' style=\"background-image:url(/jjxt/style/images/dialog_ct.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_ct.png', sizingMethod='crop');\"><div style=\"float:left;font-weight:bold; color:#FFFFFF; padding:9px 0 0 4px;\"><img src=\"/jjxt/style/images/icon_dialog.gif\" align=\"absmiddle\">&nbsp;</div>");
        // 关闭按钮
        arr.push("<div title=\"关闭\" style=\"position: relative;cursor:pointer; float:right; margin:4px 0 0; _margin:9px 0 0;height:17px; width:28px; background-image:url(/jjxt/style/images/dialog_closebtn.gif)\" onMouseOver=\"this.style.backgroundImage='url(/jjxt/style/images/dialog_closebtn_over.gif)'\" onMouseOut=\"this.style.backgroundImage='url(/jjxt/style/images/dialog_closebtn.gif)'\" drag='false' onClick=\"hiddenWindows();\"></div>");
        if(isMax){
        	 arr.push("<div title=\"最大化\" style=\"position: relative;cursor:pointer; float:right; margin:4px 0 0; _margin:9px 0 0;height:17px; width:28px; background-image:url(/jjxt/style/images/dialog_max.gif)\" onMouseOver=\"this.style.backgroundImage='url(/jjxt/style/images/dialog_max_over.gif)'\" onMouseOut=\"this.style.backgroundImage='url(/jjxt/style/images/dialog_max.gif)'\" drag='false' onClick=\"MaxWindows('"+url+"');\"></div>");
        }
        arr.push("</td>");
        arr.push("<td width='13' height='20' style=\"background-image:url(/jjxt/style/images/dialog_rt.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_rt.png', sizingMethod='crop');\"><div style=\"width:13px;\"></div></td>");
        arr.push("</tr>");
        arr.push("<tr drag='false'><td width='13' style=\"background-image:url(/jjxt/style/images/dialog_mlm.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_mlm.png', sizingMethod='crop');\"></td>");
        arr.push("<td align='center' valign='top'>");
        arr.push("<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>");
        arr.push("<tr id='_MessageRow_"+opts.id+"' style='display:none'>");
        arr.push("<td height='50' valign='top'><table id='_MessageTable_"+opts.id+"' width='100%' border='0' cellspacing='0' cellpadding='8' style=\" background:#EAECE9 url(/jjxt/style/images/dialog_bg.jpg) no-repeat right top;\">");
        arr.push("<tr><td width='25' height='50' align='right'><img id='_MessageIcon_"+opts.id+"' src='/jjxt/style/images/window.gif' width='32' height='32'></td>");
        arr.push("<td align='left' style='line-height:16px;'>");
        arr.push("<h5 class='fb' id='_MessageTitle_"+opts.id+"'>&nbsp;</h5>");
        arr.push("<div id='_Message_"+opts.id+"'>&nbsp;</div></td>");
        arr.push("</tr></table></td></tr>");
        arr.push("<tr><td align='center' valign='top'>");
        arr.push("<iframe id='newIframe' name='openWin"+opts.id+"' src='");  
        //打开页面加载
        arr.push("' id='_DialogFrame_"+opts.id+"' allowTransparency='true'  width='"+width+"' height='"+height+"' frameborder='0' style=\"background-color: #transparent; border:none;\"></iframe></td></tr>");
        //默认开关
        arr.push("</table></td>");
        arr.push("<td width='13' style=\"background-image:url(/jjxt/style/images/dialog_mrm.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_mrm.png', sizingMethod='crop');\"></td></tr>");
        arr.push("<tr><td width='13' height='13' style=\"background-image:url(/jjxt/style/images/dialog_lb.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_lb.png', sizingMethod='crop');\"></td>");
        arr.push("<td style=\"background-image:url(/jjxt/style/images/dialog_cb.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_cb.png', sizingMethod='crop');\"></td>");
        arr.push("<td width='13' height='13' style=\"background-image:url(/jjxt/style/images/dialog_rb.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_rb.png', sizingMethod='crop');\"></td>");
        arr.push("</tr></table>");
        return arr;
}


/**
 * @作用　弹出窗体信息
 */  
function winBodyNoClose(width,height,url,isMax){
        var opts = {};
        opts.id = Math.round(Math.random()*10000);
        var arr = [];
        arr.push("<table border='0' cellpadding='0' cellspacing='0' width='"+width+"'>");
        arr.push("<tr>");
        arr.push("<td width='13' height='20' style=\"background-image:url(/jjxt/style/images/dialog_lt.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_lt.png', sizingMethod='crop');\"><div style='width:13px;'></div></td>");
        arr.push("<td height='20' style=\"background-image:url(/jjxt/style/images/dialog_ct.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_ct.png', sizingMethod='crop');\"><div style=\"float:left;font-weight:bold; color:#FFFFFF; padding:9px 0 0 4px;\"><img src=\"/jjxt/style/images/icon_dialog.gif\" align=\"absmiddle\">&nbsp;</div>");
        // 关闭按钮
       // arr.push("<div title=\"关闭\" style=\"position: relative;cursor:pointer; float:right; margin:4px 0 0; _margin:9px 0 0;height:17px; width:28px; background-image:url(/jjxt/style/images/dialog_closebtn.gif)\" onMouseOver=\"this.style.backgroundImage='url(/jjxt/style/images/dialog_closebtn_over.gif)'\" onMouseOut=\"this.style.backgroundImage='url(/jjxt/style/images/dialog_closebtn.gif)'\" drag='false' onClick=\"hiddenWindows();\"></div>");
        if(isMax){
        	 arr.push("<div title=\"最大化\" style=\"position: relative;cursor:pointer; float:right; margin:4px 0 0; _margin:9px 0 0;height:17px; width:28px; background-image:url(/jjxt/style/images/dialog_max.gif)\" onMouseOver=\"this.style.backgroundImage='url(/jjxt/style/images/dialog_max_over.gif)'\" onMouseOut=\"this.style.backgroundImage='url(/jjxt/style/images/dialog_max.gif)'\" drag='false' onClick=\"MaxWindows('"+url+"');\"></div>");
        }
        arr.push("</td>");
        arr.push("<td width='13' height='20' style=\"background-image:url(/jjxt/style/images/dialog_rt.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_rt.png', sizingMethod='crop');\"><div style=\"width:13px;\"></div></td>");
        arr.push("</tr>");
        arr.push("<tr drag='false'><td width='13' style=\"background-image:url(/jjxt/style/images/dialog_mlm.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_mlm.png', sizingMethod='crop');\"></td>");
        arr.push("<td align='center' valign='top'>");
        arr.push("<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>");
        arr.push("<tr id='_MessageRow_"+opts.id+"' style='display:none'>");
        arr.push("<td height='50' valign='top'><table id='_MessageTable_"+opts.id+"' width='100%' border='0' cellspacing='0' cellpadding='8' style=\" background:#EAECE9 url(/jjxt/style/images/dialog_bg.jpg) no-repeat right top;\">");
        arr.push("<tr><td width='25' height='50' align='right'><img id='_MessageIcon_"+opts.id+"' src='/jjxt/style/images/window.gif' width='32' height='32'></td>");
        arr.push("<td align='left' style='line-height:16px;'>");
        arr.push("<h5 class='fb' id='_MessageTitle_"+opts.id+"'>&nbsp;</h5>");
        arr.push("<div id='_Message_"+opts.id+"'>&nbsp;</div></td>");
        arr.push("</tr></table></td></tr>");
        arr.push("<tr><td align='center' valign='top'>");
        arr.push("<iframe id='newIframe' name='openWin"+opts.id+"' src='");  
        //打开页面加载
        arr.push("' id='_DialogFrame_"+opts.id+"' allowTransparency='true'  width='"+width+"' height='"+height+"' frameborder='0' style=\"background-color: #transparent; border:none;\"></iframe></td></tr>");
        //默认开关
        arr.push("</table></td>");
        arr.push("<td width='13' style=\"background-image:url(/jjxt/style/images/dialog_mrm.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_mrm.png', sizingMethod='crop');\"></td></tr>");
        arr.push("<tr><td width='13' height='13' style=\"background-image:url(/jjxt/style/images/dialog_lb.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_lb.png', sizingMethod='crop');\"></td>");
        arr.push("<td style=\"background-image:url(/jjxt/style/images/dialog_cb.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_cb.png', sizingMethod='crop');\"></td>");
        arr.push("<td width='13' height='13' style=\"background-image:url(/jjxt/style/images/dialog_rb.png) !important;background-image: none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/jjxt/style/images/dialog_rb.png', sizingMethod='crop');\"></td>");
        arr.push("</tr></table>");
        return arr;
}


/**
 * @作用　获取浏览器当前页面的宽以控制弹出窗体宽
 */  
function getMinW(width){
    var nowWidth = document.body.clientWidth-60;
    if((parseInt(width)+parseInt(60))>=document.body.clientWidth) width = nowWidth;
    return width;
}
/**
 * @作用　获取浏览器当前页面的高以控制弹出窗体高
 */  
function getMinH(height){
    var nowHeight = document.body.clientHeight-38;
    if((parseInt(height)+parseInt(38))>=document.body.clientHeight) height = nowHeight;
    return height;
}
/**
 * @作用　获取浏览器当前页面的宽以控制弹出窗体宽
 */  
function getTopMinW(width){
    var nowWidth = top.document.body.clientWidth-16;
    if((parseInt(width)+parseInt(16))>=top.document.body.clientWidth) width = nowWidth;
    return width;
}
/**
 * @作用　获取浏览器当前页面的高以控制弹出窗体高
 */  
function getTopMinH(height){
    var nowHeight = top.document.body.clientHeight-30;
    if((parseInt(height)+parseInt(30))>=top.document.body.clientHeight) height = nowHeight;
    return height;
}
/**
 * @作用　隐藏下拉框，以解决下拉框优先度太高的问题
 */  
function _displaySelect(){
    var selects = document.getElementsByTagName("select");//整个页面的所有下拉框
    var objWindow = document.getElementById("WindowDIV");//$("WindowDIV");
    var DIVselects = objWindow.getElementsByTagName("select");//整个弹出层的所有下拉框
    for(var i=0;i<selects.length;i++){
        if(selects[i].style.visibility||selects[i].style.visibility=='inherit'){
            selects[i].style.visibility="";
        } else {
            selects[i].style.visibility="hidden";
            for(var j=0; i<DIVselects.length; j++){
                DIVselects[j].style.visibility="";
            }
        }
    }
}
/**
 * @作用　隐藏下拉框，以解决下拉框优先度太高的问题
 */  
function _displaySelect_type(type){
    var selects =null; 
    var objWindow =null; 
    if(type=='1')
    {
        selects=parent.document.getElementsByTagName("select");//整个页面的所有下拉框
        objWindow=parent.document.getElementById("WindowDIV");//$("WindowDIV");
    }
    else if(type=='2')
    {
        selects=parent.parent.document.getElementsByTagName("select");//整个页面的所有下拉框
        objWindow=parent.parent.document.getElementById("WindowDIV");//$("WindowDIV");
    }
    
    var DIVselects = objWindow.getElementsByTagName("select");//整个弹出层的所有下拉框
    for(var i=0;i<selects.length;i++){
        if(selects[i].style.visibility||selects[i].style.visibility==''){
            selects[i].style.visibility="";
        }else{
            selects[i].style.visibility="hidden";
            for(var j=0; i<DIVselects.length; j++){
                DIVselects[j].style.visibility="";
            }
        }
    }
}
/**
 * @作用　隐藏下拉框，以解决下拉框优先度太高的问题
 */  
function _displaySelect_OpenwinType(type){
    var selects =null; 
    var objWindow =null; 
    if(type=='1')
    {
        selects=opener.document.getElementsByTagName("select");//整个页面的所有下拉框
        objWindow=opener.document.getElementById("WindowDIV");//$("WindowDIV");
    }
    else if(type=='2')
    {
        selects=opener.opener.document.getElementsByTagName("select");//整个页面的所有下拉框
        objWindow=opener.opener.document.getElementById("WindowDIV");//$("WindowDIV");
    }
    
    var DIVselects = objWindow.getElementsByTagName("select");//整个弹出层的所有下拉框
    for(var i=0;i<selects.length;i++){
        if(selects[i].style.visibility||selects[i].style.visibility==''){
            selects[i].style.visibility="";
        }else{
            selects[i].style.visibility="hidden";
            for(var j=0; i<DIVselects.length; j++){
                DIVselects[j].style.visibility="";
            }
        }
    }
}
/**
 * @作用　增、删、改、查弹出层
 * @param url 弹出页面的url
 * @param type 弹出层的类型
 * @param width 弹出层的宽
 * @param height 弹出层的高
 */
function openWin_par(url,type,width,height){ 
    var dm = document.forms[0].dm.value;
    if(type=="add"){    
        url=url + "&type=" + type;      
    }
    else if(type=='modify' || type == "check"){
        if(dm==''||dm==null||dm=='null'){
            alert('请先选择记录！');
            return false;
        }
        else{
            createID(dm);
            url=url + "&type=" + type;// + "&tableID=" + dm;
        }
    }
    else if(type=='del'||type=='cease'||type=='use'){
        if(dm==''){
            alert('请先选择记录！');
            return false;
        }
        else{
            var msg=''
            if(type=='del'){
                msg='删除';
            } else if (type=='cease'){
                msg='停用';
            } else {
                msg='启用';
            }
            if(type=='del'|| type=='cease'||type=='use'){
                if(!confirm('本操作将'+msg+'已经选择的记录，确定要继续吗？')){
                    return false;
                }
            }
            createID(dm);
            //url=url + "&tableID=" + dm;
        }
    }   
    else if(type=='upload'){
        url=url + "&type=" + type;
    }
    openWindows(url,width,height);//调用弹出层
}
/**
 * @作用　增、删、改、查弹出层(checkbox多选)
 * @param url 弹出页面的url
 * @param objTr chekbox的id
 * @param type 弹出层的类型
 * @param width 弹出层的宽
 * @param height 弹出层的高
 */
function openWin_par_check(url,objTr,type,width,height) {
    var check_id = new Array;
    var r=0;
    for(var i=0;i<document.getElementsByName(objTr).length;i++){
        if(document.getElementsByName(objTr)[i].checked){
            var haha=document.getElementsByName(objTr)[i].value;
            check_id[r]=document.getElementsByName(objTr)[i].value;
            r++;
        }
    }
    if(type=='modify' || type == "check" || type =='msfjck' || type=="qxsb"){
        if(check_id==''){
            alert('请先选择记录！');
        }
        else{
            createID(check_id);
            url=url + "&type=" + type;// + "&tableID=" +  check_id;
            openWindows(url,width,height);//调用弹出层
        }
    }
    else if(type=='del' || type=='create' || type == 'fb'||type=='cease'||type=='use' || type == 'sb' || type == 'cxsb'){
        if(check_id==''){
            alert('请先选择一条记录！');
        }
        else{
            var msg=''
            if(type=='del'){
                msg='删除';
            } else if (type=='cease'){
                msg='停用';
            } else {
                msg='启用';
            }
            if(type=='del'|| type=='cease'||type=='use'){
                if(!confirm('本操作将'+msg+'已经选择的记录，确定要继续吗？')){
                    return false;
                }
            }
            createID(check_id);
            url=url  + "&type=" + type;//+ "&tableID=" +  check_id;
            document.forms[0].action = url;
            document.forms[0].submit();
        }
    }
} 
/**
 * @作用　增、删、改、查弹出层(checkbox单选)
 * @param url 弹出页面的url
 * @param objTr chekbox的id
 * @param type 弹出层的类型
 * @param width 弹出层的宽
 * @param height 弹出层的高
 */
function openWin_par_check_single(url,objTr,type,width,height) {
    var check_id = new Array;
    var r=0;
    for(var i=0;i<document.getElementsByName(objTr).length;i++){
        if(document.getElementsByName(objTr)[i].checked){
            var haha=document.getElementsByName(objTr)[i].value;
            check_id[r]=document.getElementsByName(objTr)[i].value;
            r++;
        }
    }
    if(type=='modify' || type == "check"){
        if(check_id.length<1){
            alert('请选择一条记录！');
        }else if(check_id.length>1){
            alert('该操作只允许单个操作!');
        }
        else{
            createID(check_id);
            url=url + "&type=" + type;// + "&tableID=" +  check_id;
            openWindows(url,width,height);//调用弹出层
        }
    }
    else if(type=='del' || type=='create'||type=='cease'||type=='use'){
        if(check_id.length!=1){
            alert('请选择一条记录！');
        }
        else{
            var msg=''
            if(type=='del'){
                msg='删除';
            } else if (type=='cease'){
                msg='停用';
            } else {
                msg='启用';
            }
            if(type=='del'|| type=='cease'||type=='use'){
                if(!confirm('本操作将'+msg+'已经选择的记录，确定要继续吗？')){
                    return false;
                }
            }
            createID(check_id);
            url=url  + "&type=" + type;//+ "&tableID=" +  check_id;
            document.forms[0].action = url;
            document.forms[0].submit();
        }
    }
} 
/**
 * @作用　弹出层
 * @param url 弹出页面的url
 * @param width 弹出层宽
 * @param height 弹出层高
 */
function openWindows(url,width,height){
/*
 * 美丽的弹出窗
*/
    var oldHeight=height;
    width=getMinW(width);
    height=getMinH(height);
    var html="<iframe src=\""+url+"\" width=\"100%\" height=\"100%\"></iframe>"
    var objWindow = document.getElementById("WindowDIV");//$("WindowDIV");
    var objLock = document.getElementById("LockWindows");//$("LockWindows");//这个是用于在IE下屏蔽内容用
    //$('#WindowDIV').corners();
    objWindow.style.display='block';
    objWindow.style.width = width+"px";
    objWindow.style.height = height+"px";
    objLock.style.display="block";      
    objLock.style.width=document.body.clientWidth+"px";
    objLock.style.height=document.body.clientHeight+"px";
    objLock.style.minWidth=document.body.clientWidth+"px";
    objLock.style.minHeight=document.body.clientHeight+"px";
    // 将弹出层居中
    objWindow.style.left=(document.body.offsetWidth-width)/2+"px";
    if((parseInt(oldHeight)+parseInt(38))>=document.body.clientHeight){
    	objWindow.style.top=document.documentElement.scrollTop-2+"px";
    } else {
    	objWindow.style.top=(document.documentElement.scrollTop+document.body.offsetHeight-height-70)/2+"px";
    }
    if(null==document.getElementById('closeWin')){
        var arr = winBody(width,height,url,false);
        objWindow.innerHTML=arr.join('');
    } 
    //TODO
    _displaySelect();
    var frame = document.getElementsByTagName('iframe');
    var frameName=document.getElementById('newIframe').name;
    document.forms[0].target=frameName;
    code_save(url);
    document.forms[0].target="";
    return true;
}

function openWindowsNoClose(url,width,height){
/*
 * 美丽的弹出窗
*/
    var oldHeight=height;
    width=getMinW(width);
    height=getMinH(height);
    var html="<iframe src=\""+url+"\" width=\"100%\" height=\"100%\"></iframe>"
    var objWindow = document.getElementById("WindowDIV");//$("WindowDIV");
    var objLock = document.getElementById("LockWindows");//$("LockWindows");//这个是用于在IE下屏蔽内容用
    //$('#WindowDIV').corners();
    objWindow.style.display='block';
    objWindow.style.width = width+"px";
    objWindow.style.height = height+"px";
    objLock.style.display="block";      
    objLock.style.width=document.body.clientWidth+"px";
    objLock.style.height=document.body.clientHeight+"px";
    objLock.style.minWidth=document.body.clientWidth+"px";
    objLock.style.minHeight=document.body.clientHeight+"px";
    // 将弹出层居中
    objWindow.style.left=(document.body.offsetWidth-width)/2+"px";
    if((parseInt(oldHeight)+parseInt(38))>=document.body.clientHeight){
    	objWindow.style.top=document.documentElement.scrollTop-2+"px";
    } else {
    	objWindow.style.top=(document.documentElement.scrollTop+document.body.offsetHeight-height-70)/2+"px";
    }
    if(null==document.getElementById('closeWin')){
        var arr = winBodyNoClose(width,height,url,false);
        objWindow.innerHTML=arr.join('');
    } 
    //TODO
    _displaySelect();
    var frame = document.getElementsByTagName('iframe');
    var frameName=document.getElementById('newIframe').name;
    document.forms[0].target=frameName;
    code_save(url);
    document.forms[0].target="";
    return true;
}

function openHaveMaxWindows(url,width,height){
/*
 * 美丽的弹出窗（带最大化）
*/
    var oldHeight=height;
    width=getMinW(width);
    height=getMinH(height);
    var html="<iframe src=\""+url+"\" width=\"100%\" height=\"100%\"></iframe>"
    var objWindow = document.getElementById("WindowDIV");//$("WindowDIV");
    var objLock = document.getElementById("LockWindows");//$("LockWindows");//这个是用于在IE下屏蔽内容用
    objWindow.style.display='block';
    objWindow.style.width = width+"px";
    objWindow.style.height = height+"px";
    objLock.style.display="block";      
    objLock.style.width=document.body.clientWidth+"px";
    objLock.style.height=document.body.clientHeight+"px";
    objLock.style.minWidth=document.body.clientWidth+"px";
    objLock.style.minHeight=document.body.clientHeight+"px";
    // 将弹出层居中
    objWindow.style.left=(document.body.offsetWidth-width)/2+"px";
    if((parseInt(oldHeight)+parseInt(38))>=document.body.clientHeight){
    	objWindow.style.top=document.documentElement.scrollTop-2+"px";
    } else {
    	objWindow.style.top=(document.documentElement.scrollTop+document.body.offsetHeight-height-70)/2+"px";
    }
    if(null==document.getElementById('closeWin')){
    	var arr = winBody(width,height,url,true);
        objWindow.innerHTML=arr.join('');
    } 
    _displaySelect();
    var frame = document.getElementsByTagName('iframe');
    var frameName=document.getElementById('newIframe').name;
    document.forms[0].target=frameName;
    code_save(url);
    document.forms[0].target="";
    return true;
}

function MaxWindows(url){
	var oldHeight='800';
    var width=getTopMinW('2000');
    var height=getTopMinH('1000');
    var html="<iframe src=\""+url+"\" width=\"100%\" height=\"100%\"></iframe>"
    var objWindow = top.document.getElementById("WindowDIV");//$("WindowDIV");
    var objLock = top.document.getElementById("LockWindows");//$("LockWindows");//这个是用于在IE下屏蔽内容用
    objWindow.style.display='block';
    objWindow.style.width = width+"px";
    objWindow.style.height = height+"px";
    objLock.style.display="block";      
    objLock.style.width=top.document.body.clientWidth+"px";
    objLock.style.height=top.document.body.clientHeight+"px";
    objLock.style.minWidth=top.document.body.clientWidth+"px";
    objLock.style.minHeight=top.document.body.clientHeight+"px";
    // 将弹出层居中
    objWindow.style.left=((top.document.body.offsetWidth-width)-28)/2+"px";
    if((parseInt(oldHeight)+parseInt(30))>=top.document.body.clientHeight){
    	objWindow.style.top=top.document.documentElement.scrollTop-6+"px";
    } else {
    	objWindow.style.top=(top.document.documentElement.scrollTop+top.document.body.offsetHeight-height-40)/2+"px";
    }
    if(null==top.document.getElementById('closeWin')){
        var arr = winBody(width,height,url,false);
        objWindow.innerHTML=arr.join('');
    } 
    top._displaySelect();
    var frame = top.document.getElementsByTagName('iframe');
    var frameName=top.document.getElementById('newIframe').name;
    top.document.forms[0].target=frameName;
    top.document.forms[0].action = url;
    top.document.forms[0].submit();
    top.document.forms[0].target="";
    hiddenWindows();
    return true;
}

/**
 * @作用　旧弹出层
 * @param url 弹出页面的url
 * @param width 弹出层宽
 * @param height 弹出层高
 */
function openWindow_xs(url,width,height){ 
    var objWindow = document.getElementById("WindowDIV");//$("WindowDIV");
    var objLock = document.getElementById("LockWindows");//$("LockWindows");//这个是用于在IE下屏蔽内容用
    objLock.style.display="block";  
    objLock.style.width=document.body.clientWidth+"px";
    objLock.style.height=document.body.clientHeight+"px";
    objLock.style.minWidth=document.body.clientWidth+"px";
    objLock.style.minHeight=document.body.clientHeight+"px";
// 判断输入的宽度和高度是否大于当前浏览器的宽度和高度
//    if(width>document.body.clientWidth) width = document.body.clientWidth+"px";
//    if(height>document.body.clientHeight) height = document.body.clientHeight+"px";
    width=getMinW(width);
    height=getMinH(height);
    objWindow.style.display='block';
    objWindow.style.width = width+"px";
    objWindow.style.height = height+"px";
// 将弹出层居中
    objWindow.style.left=(document.body.offsetWidth-width)/2+"px";
    objWindow.style.top=(document.body.offsetHeight-height)/2+"px";
    _displaySelect();
    window.frameName.location = url;
    return true;
}
/**
 * @作用　弹出层（首页）
 * @param url 弹出页面的url
 * @param width 弹出层宽
 * @param height 弹出层高
 */
function openWindowsIndex(url,width,height){ 
//  var html="<iframe src=\""+url+"\" width=\"100%\" height=\"100%\"></iframe>"
    var objWindow = document.getElementById("WindowDIV");//$("WindowDIV");
    var objLock = document.getElementById("LockWindows");//$("LockWindows");//这个是用于在IE下屏蔽内容用
    objLock.style.display="block";      
    objLock.style.width=document.body.clientWidth+"px";
    objLock.style.height=document.body.clientHeight+"px";
    objLock.style.minWidth=document.body.clientWidth+"px";
    objLock.style.minHeight=document.body.clientHeight+"px";
// 判断输入的宽度和高度是否大于当前浏览器的宽度和高度
//    if(width>document.body.clientWidth) width = document.body.clientWidth+"px";
//    if(height>document.body.clientHeight) height = document.body.clientHeight+"px";
//    var nowWidth = document.body.clientWidth-20;
//    var nowHeight = document.body.clientHeight-20;
//    if(width>=document.body.clientWidth) width = nowWidth;
//    if(height>=document.body.clientHeight) height = nowHeight;
    width=getMinW(width);
    height=getMinH(height);
    objWindow.style.display='block';
    objWindow.style.width = width+"px";
    objWindow.style.height = height+"px";
// 将弹出层居中
    objWindow.style.left=(document.body.offsetWidth-width)/2+"px";
    objWindow.style.top=(document.body.offsetHeight-height)/2+"px";
    _displaySelect();
    var frame = document.getElementsByTagName('iframe');
    document.forms[0].target="frameName0";
    code_save(url);
    document.forms[0].target="";
    return true;
}
/**
 * @作用　弹出层隐藏
 */
function hiddenWindows(){
    document.getElementById("LockWindows").style.display='none';
    document.getElementById("WindowDIV").style.display='none';
    //document.getElementById('if').src = '';
    _displaySelect();
}
/**
 * @作用　弹出层关闭
 * @param url 主页面的url
 */
function open_win_close(url){
    parent.document.forms[0].action=url;//刷新iframe夫窗体
    parent.document.forms[0].submit();
}
/**
 * @作用　弹出层关闭（保留原有查询数据）
 * @param search_id 查询按钮id
 */
function open_win_close_search(search_id){
    parent.document.getElementById(search_id).click();
}
/**
 * @作用　刷新本页面（保留原有查询数据）
 * @param search_id 查询按钮id
 */
function open_win_search(search_id){
    document.getElementById(search_id).click();
}
/**
 * @作用　弹出层关闭（父页面不刷新）
 * @param type 是几层弹出框
 */
function hiddenWindows_forTop(type){
    if(type=='1'){
        var opts = {};
        parent.document.getElementById("LockWindows").style.display='none';
        parent.document.getElementById("WindowDIV").style.display='none';
        //parent.document.getElementById('if').src = '';//清空iframe中的src
    }
    if(type=='2'){
        var opts = {};
        parent.parent.document.getElementById("LockWindows").style.display='none';
        parent.parent.document.getElementById("WindowDIV").style.display='none';
        //parent.parent.document.getElementById('if').src = '';//清空iframe中的src
    }
    _displaySelect_type(type);
}
function view(objTr,url,width,height){
    curr_row = objTr;
    var dm=document.getElementsByTagName("dm");
    if(navigator.appName.indexOf("Explorer") > -1){
        var id=curr_row.cells[0].innerText;
    } else {
        var id=curr_row.cells[0].textContent;
    }
    document.forms[0].dm.value = id;
    createID(id);
    url=url + "&type=modify";// + "&tableID="+ id
    //alert(url);
    openWindows(url,width,height);
}
function lockWin(){
    var objLock = document.getElementById("LockWindows");//$("LockWindows");//这个是用于在IE下屏蔽内容用
    objLock.style.display="block";      
    objLock.style.width=document.body.clientWidth+"px";
    objLock.style.height=document.body.clientHeight+"px";
    objLock.style.minWidth=document.body.clientWidth+"px";
    objLock.style.minHeight=document.body.clientHeight+"px";
    _displaySelect();
}
/**
 * @作用　弹出进度条
 */
function Loading(){ 
    var objWindow = document.getElementById("WindowDIV");//$("WindowDIV");
    var objLock = document.getElementById("LockWindows");//$("LockWindows");//这个是用于在IE下屏蔽内容用
    objLock.style.display="block";      
    objLock.style.width=document.body.clientWidth+"px";
    objLock.style.height=document.body.clientHeight+"px";
    objLock.style.minWidth=document.body.clientWidth+"px";
    objLock.style.minHeight=document.body.clientHeight+"px";
    _displaySelect();
    var tdqy_html   = "<div style=\"position:absolute;top:50%;left:40%;width:200px;height:100px; vertical-align: center;\"><img src=\"../style/standard/load.gif\"/></br><font  style=\"font-size:14px;font-weight: blod;\" color=\"red\">程序正在运行中,请稍后......</font></div>";
    var dragElement = document.getElementById('LockWindows');
    dragElement.innerHTML = tdqy_html + dragElement.innerHTML
    return true;
}
/****
  弹出窗体到最外层
***/
  function OpenTopWindow(url,height,width){
	   var oldHeight=height;
	   var html="<iframe src=\""+url+"\" width=\"100%\" height=\"100%\"></iframe>"
	   var objWindow = top.document.getElementById("WindowDIV");//$("WindowDIV");
	   var objLock = top.document.getElementById("LockWindows");//$("LockWindows");//这个是用于在IE下屏蔽内容用
	   objWindow.style.display='block';
	   objWindow.style.width = width+"px";
	   objWindow.style.height = height+"px";
	   objLock.style.display="block";      
	   objLock.style.width=top.document.body.clientWidth+"px";
	   objLock.style.height=top.document.body.clientHeight+"px";
	   objLock.style.minWidth=top.document.body.clientWidth+"px";
	   objLock.style.minHeight=top.document.body.clientHeight+"px";
	   // 将弹出层居中
	   objWindow.style.left=((top.document.body.offsetWidth-width)-28)/2+"px";
	   if((parseInt(oldHeight)+parseInt(30))>=top.document.body.clientHeight){
	   	objWindow.style.top=top.document.documentElement.scrollTop-6+"px";
	   } else {
	   	objWindow.style.top=(top.document.documentElement.scrollTop+top.document.body.offsetHeight-height-40)/2+"px";
	   }
	   if(null==top.document.getElementById('closeWin')){
	       var arr = winBody(width,height,url,false);
	       objWindow.innerHTML=arr.join('');
	   } 
	   top._displaySelect();
	   var frame = top.document.getElementsByTagName('iframe');
	   var frameName=top.document.getElementById('newIframe').name;
	   top.document.forms[0].target=frameName;
	   top.document.forms[0].action = url;
	   top.document.forms[0].submit();
	   top.document.forms[0].target="";
	   hiddenWindows();
	   return true;
	  }
