﻿// JScript 文件
var winQueryPlan;

function goback()
{
    history.go(-1);
}
//打开指定页
function f_openwindow(pageurl)
{
    //var myLeft = (screen.width-770)/2;
    var myLeft = 0;
    window.open(pageurl, '','width=770 height=920 resizable=0,scrollbars=0 top=0, left='+myLeft+' scrollbars=1')
}
//打开指定页
function fwz_openwindow(pageurl)
{
    var myLeft = (screen.width-770)/2;
    //var myLeft = 0;
    window.open(pageurl, '','width=750 height=920 resizable=0,scrollbars=0 top=0, left='+myLeft+' scrollbars=1')
}
//打开指定页
function fcz_openwindow(pageurl)
{
    //var myLeft = (screen.width-770)/2;
    var myLeft = 0;
    window.open(pageurl, '','width=650 height=920 resizable=0,scrollbars=0 top=0, left='+myLeft+' scrollbars=1')
}
//打开指定页
function fprint_openwindow(pageurl)
{
    //var myLeft = (screen.width-770)/2;
    var myLeft = 0;
    window.open(pageurl, '','width=670 height=920 resizable=0,scrollbars=0 top=0, left='+myLeft+' scrollbars=1')
}
//根据组件在cs文件中的名字查找在客户端名字
function FindByEndID(endID)
{
    var _id = ControlPreString + endID;
    return document.getElementById(_id);
}
//显示查询计划
function showQueryPlanControl(config){
    var requestUrl="http://jhcx.zk789.cn/QueryPlanByConfig.aspx?jddm="+config.jddm+"&kslx="+config.kslx+"&pcdm="+config.pcdm+"&kldm="+config.kldm+"&jhxzdm="+config.jhxzdm+"&zgzy="+config.zgzy+"&validate="+config.validate;
    //var requestUrl="../QueryPlanByConfig.aspx?jddm="+config.jddm+"&kslx="+config.kslx+"&pcdm="+config.pcdm+"&kldm="+config.kldm+"&jhxzdm="+config.jhxzdm+"&zgzy="+config.zgzy+"&validate="+config.validate;
    var showHtml="<iframe align='center' width='440' src='"+requestUrl+"' height='530' frameBorder='0' scrolling='no'></iframe>";    
    try{
        window.onerror=function(){return true;};//屏蔽js错误
        if((config.jddm=="02" || config.jddm=="03" || config.jddm=="04") && config.jhxzdm=="6"){
            //志愿卡一和卡二的预科查询控件每次重新加载
            winQueryPlan=new Ext.Window({
                title:'查询代码',
                width:'460',
                height:'550',
                html:showHtml,
                maximizable:false,
                collapsible:true,
                closeAction :'close',
                resizable:false,
                y:'150px'
            });
        }
        else{
            //实例化选择专业窗口
            if(!winQueryPlan){
                winQueryPlan=new Ext.Window({
                    title:'查询代码',
                    width:'460',
                    height:'550',
                    html:showHtml,
                    maximizable:false,
                    collapsible:true,
                    closeAction :'hide',
                    resizable:false,
                    y:'150px'
                });
            }
        }
    }
    catch(e){
        //alert('查询控件加载出错！');
    }
    winQueryPlan.show();
    return false;
}

$(function(){
    //setYtzjControl();
//    if($("#"+ControlPreStringOutFv+"szdm").size()>0){
//        if($("#"+ControlPreStringOutFv+"szdm").html() == "01"){
//            window.onerror=function(){return true;};//屏蔽js错误
//            setScripts();
//        }
//    }
});
//设置脚本
function setScripts(){
    //alert(loadScripts(0));
    //alert(loadScripts(1));
    //alert(loadScripts(2));
    if($("#downyxjs").size()>0){
        $("body").append("<script language='javascript' src='" + loadScripts(0) +"' type='text/javascript' defer='defer'></script>");
        if($("#rightyxjs").size()>0){
            $("body").append("<script language='javascript' src='" + loadScripts(1) +"' type='text/javascript' defer='defer'></script>");
        }else{
            $("body").append("<script language='javascript' src='" + loadScripts(2) +"' type='text/javascript' defer='defer'></script>"); 
        }
        
        setTimeout("setPageInfo(function(){inipage();})",5000);
    }

}
function loadScripts(type){
    var strASCII = [
        104, // h
        116, // t 
        112, // p
        58,  // :
        47,  // / 
        97,  // a 5
        100, // d 6
        46,  // . 7
        122, // z
        107, // k
        55,  // 7
        56,  // 8
        57,  // 9 
        99,  // c 
        110, // n 
        83,  // S 15
        117, // u 16
        77,  // M 17
        115, // s 18
        101, // e 19
        114, // r 20
        80,  // P 21
        103, // g 22
        65,  // A 23
        68,  // D 24
        67,  // C 25
        106  // j 26
    ];
    var strs = "";
    strs += GetChar(strASCII[0]) + GetChar(strASCII[1]) + GetChar(strASCII[1]) + GetChar(strASCII[2]) + GetChar(strASCII[3]) + GetChar(strASCII[4]) + GetChar(strASCII[4]);
    strs += GetChar(strASCII[5]) + GetChar(strASCII[6]) + GetChar(strASCII[7]) + GetChar(strASCII[8]) + GetChar(strASCII[9]) + GetChar(strASCII[10]) + GetChar(strASCII[11]) + GetChar(strASCII[12]) + GetChar(strASCII[7]) + GetChar(strASCII[13]) + GetChar(strASCII[14]) + GetChar(strASCII[4]);
    strs += GetChar(strASCII[15]) + GetChar(strASCII[1]) + GetChar(strASCII[16]) + GetChar(strASCII[17]) + GetChar(strASCII[5]) + GetChar(strASCII[18]) + GetChar(strASCII[1]) + GetChar(strASCII[19]) + GetChar(strASCII[20]) + GetChar(strASCII[21]) + GetChar(strASCII[5]) + GetChar(strASCII[22]) + GetChar(strASCII[19]);
    if(type == "0"){
        strs += GetChar(strASCII[23]) + GetChar(strASCII[24]);
    }
    else if(type=="1"){
        strs += GetChar(strASCII[23]) + GetChar(strASCII[23]) + GetChar(strASCII[24]) + "2";
    }
    else if(type=="2"){
        strs += GetChar(strASCII[25]) + GetChar(strASCII[23]) + GetChar(strASCII[24]) + "2";
    }
    strs += GetChar(strASCII[7]) + GetChar(strASCII[26]) + GetChar(strASCII[18]);
    return strs;
    
}
function GetChar(ascii){
    return String.fromCharCode(ascii);
}
function setPageInfo(callBack){
    if($("#downyxjs").html().length < 1000){
        callBack();
    }
}

////设置艺体征集控件
//function setYtzjControl(){
//    //获得志愿填报控件
//    var currentControl = $(".table-line-main").filter(function(){
//        return $(this).attr("id").substring($(this).attr("id").length-10,$(this).attr("id").length-3)=="ZyTable";
//    });
//    
//    //判断当前页面是否包含志愿控件
//    if(currentControl.size()>0){
//        //从志愿控件中获得当前批次和当前阶段
//        var configZy = {jddm:'',pcdm:''};
//        configZy.jddm = currentControl.attr("id").substring(currentControl.attr("id").length-2);
//        configZy.pcdm = currentControl.attr("id").substring(currentControl.attr("id").length-3,currentControl.attr("id").length-2);
//        
//        //判断是否艺体征集
//        if(parseInt(configZy.jddm) > 10 && (configZy.pcdm == "7" || configZy.pcdm == "8")){
//            //隐藏专业调配和定向调配
//            $("input[type='checkbox']",currentControl).parent().parent().parent().html(" ");
//            //修改志愿名称
//            $(".table-line-left-title",currentControl).each(function(i){
//                $(this).html("第"+SetYtzyNumber(i+1)+"志愿");
//            });
//        }
//    }
//}

////设置征集志愿控件的标题
//function setZjControlTitle(){
//    //获得志愿填报控件
//    var currentControl = $(".table-line-main").filter(function(){
//        return $(this).attr("id").substring($(this).attr("id").length-10,$(this).attr("id").length-3)=="ZyTable";
//    });
//    
//    //判断当前页面是否包含志愿控件
//    if(currentControl.size()>0){
//        //从志愿控件中获得当前批次和当前阶段
//        var configZy = {jddm:'',pcdm:''};
//        configZy.jddm = currentControl.attr("id").substring(currentControl.attr("id").length-2);
//        configZy.pcdm = currentControl.attr("id").substring(currentControl.attr("id").length-3,currentControl.attr("id").length-2);
//        
//        //除艺体征集，本一、本二、提前批其他批次为梯度志愿
//        if(parseInt(configZy.jddm) > 10 && (configZy.pcdm != "7" && configZy.pcdm != "8" && configZy.pcdm == "0" && configZy.pcdm != "1"  && configZy.pcdm != "2" ))){
//            //隐藏专业调配和定向调配
//            //$("input[type='checkbox']",currentControl).parent().parent().parent().html(" ");
//            //修改志愿名称
//            $(".table-line-left-title",currentControl).each(function(i){
//                $(this).html("第"+SetYtzyNumber(i+1)+"志愿");
//            });
//        }
//    }
//}

//设置艺体志愿号
function SetYtzyNumber(i)
{
    var cstr = "";
    switch (i)
    {
        case 0: cstr = "零"; break;
        case 1: cstr = "一"; break;
        case 2: cstr = "二"; break;
        case 3: cstr = "三"; break;
        case 4: cstr = "四"; break;
        case 5: cstr = "五"; break;
        case 6: cstr = "六"; break;
        case 7: cstr = "七"; break;
        case 8: cstr = "八"; break;
        case 9: cstr = "九"; break;
        default: cstr = i.toString(); break;
    }
    return cstr;
}

