 jQuery(function($) {
        $("#nandu").html($("#ddlDegree").html());
        
        $("#ddlDegree").change(function(){
                var selects = $("select[name='nandu']")
                    .children("option:[value="+$("#ddlDegree")
                    .children("option:selected").val()+"]");
               for(var index=0;index<selects.size();index++){
                     selects.get(index).selected=true;
                    
               }  
        });
        
    });
   function addInsertText(html){
        var number = parseInt($('#InsertNumber').val());
        var size = $("#InsertFieldSet").children("div").size();
 
        if((size + number) >= 99){
            alert("题目最多99条,其余请分段录入！");
            return;
        }
        for(var index=0;index<number;index++){
            $("#InsertFieldSet").append(
            html);
        }
    }
    var index;
    function showEdit(e,OEvent){
        index = e;
        var panel = $('#EditContentPanel');
        showPanel(panel,OEvent);
        fck.setContent($(index).siblings("div").html());
        
    }
    
    function showPanel(panel,e){
        var maskHeight =  pointerY(e);
        var maskWidth =   pointerX(e);
        panel.css({left:maskWidth,top:maskHeight});
        panel.show();

    }
    
    function pointerX(oEvent)  
    {    
     return oEvent.pageX || (oEvent.clientX +     (document.documentElement.scrollLeft || document.body.scrollLeft));  
    } 
     
    function pointerY(oEvent) 
    {    
     return oEvent.pageY || (oEvent.clientY + (document.documentElement.scrollTop || document.body.scrollTop));  
    }
    
    function hideUpdatePanel(){
        $('#EditContentPanel').hide();
    }
    
    function okEdit(){
       var content = fck.getContent();
 
       $(index).siblings("div").html(content);
       $('#EditContentPanel').hide();
    }
    
   function CreateDomDoc()   //创建XML文档对象
   {
       var signatures = ["Msxml2.DOMDocument.5.0","Msxml2.DOMDocument.4.0","Msxml2.DOMDocument.3.0","Msxml2.DOMDocument","Microsoft.XmlDom"];
       for(var i=0;i<signatures.length;i++){
              try{
                     var domDoc = new ActiveXObject(signatures[i]);
                     return domDoc;
              }
              catch(e)
              {}
        }
        return null;
    }  
   function sendData(doc ,url){
        var isLoad = false;
           $.ajax({
               type: "POST",
               dataType:"text",
               processData:false,
               url: url,
               data:doc,
               success: function(msg){
                 isLoad=true;
                 $("#dialog-overlay").hide();
  
                 alert("已录入所有题目!");
               
               },
               error:function (XMLHttpRequest, textStatus, errorThrown) {
                    isLoad=true;
                 alert("添加失败"+textStatus +" "+errorThrown+" "+XMLHttpRequest);
                 $("#dialog-overlay").hide();
                  
               },
               beforeSend: function(XMLHttpRequest){ 
                    setTimeout(function(){
                        if(!isLoad)
                        $("#dialog-overlay").show();
                    },500); 
               }
            });

    }