// JScript 文件
 function eWebEditorGetValue()
    {
        eWebEditor1.setHTML(form1.content1.value);
    }
 
  function eWebEditor()
  {
        form1.content1.value=eWebEditor1.getHTML();
  }
 
 //***************打开窗口**********************
 var sender;
 
 function GetPath(formname,id,view,objView)
 { 
    popWin("../../UploadFile/select.aspx?FormName="+ formname +"&id=" + id + "&View=" + view + "&objView=" + objView,"sender",550,500,true);
    //sender = window.open("../../UploadFile/select.aspx?FormName="+ formname +"&id=" + id,"sender","width=550,height=500,scrollbars=yes,status=no,resizable=yes,top=50"); 
 }
 
 function setPath(FormName,obj_id,p,view,objView)
 {
   //eval('var theform = document.' + FormName + ';');
   var theform = document.getElementById(FormName);
   //theform.obj_id.value = p;
  // theform.elements[id].value = p;
  theform.elements[obj_id].value = p;
  var url = location.host;
  url += p.replace("~","");
  if (view == "1")
    LoadFlash('http://'+url,'high',210,165,objView)
        //showPic(p,objView);
   sender.close();
 }
 
  function setPath_edit(FormName,obj_id,p,view,objView)
 {
   //eval('var theform = document.' + FormName + ';');
   var theform = document.getElementById(FormName);
   //theform.obj_id.value = p;
  // theform.elements[id].value = p;
  theform.elements[obj_id].value = p;
  var url = location.host;
  url += p.replace("~","");
  if (view == "1")
    LoadFlash('http://'+url,'high',210,165,objView)
        //showPic(p,objView);
 }
 //*************************************
 
 //******************为只读的框赋值**************
 function GetHid(s1,s2)
 {
//    alert(s1);
//    var obj1 = document.getElementById(s1);
//     var obj2 = document.getElementById(s2);
//     
//    obj1.value = obj2.value;
 }
 //****************
 
 
 //预览图片
function showPic(url,objView)
{      
    url = location.host + url;
    if (url.substr(url.lastIndexOf(".")).toLowerCase() == ".swf")
        document.getElementById(objView).loadMovieNum(url,0);
    else
        document.getElementById(objView).src = url;
}

//非IE对话框
function popWin(theURL,winName,theW,theH,showAsModal) 
{

    theTop = (window.screen.height-theH)/2;
    theLeft = (window.screen.width-theW)/2;
    var features = "toolbar=0,scrollbars=yes,left=" + theLeft + ",top=" + theTop + ",width=" + theW + ",height=" + theH + ",dependent";
    
    window.sender = window.open(theURL,winName,features);
    window.sender.focus();
    
    if(showAsModal)
    {
        window.CtrlsDisabled = new Array();
        DisableCtrls("INPUT;SELECT;TEXTAREA;BUTTON;A;IFRAME");
    }

    function DisableCtrls(tagNameStr){
        var arrTags = tagNameStr.split(";");
        for(var i=0;i<arrTags.length;i++){
            var arrEle = document.getElementsByTagName(arrTags[i]);
            PushToCtrlsDisabled(arrEle);
        }

        for(var i=0;i<window.CtrlsDisabled.length;i++){
            window.CtrlsDisabled[i].disabled = true;
            window.CtrlsDisabled[i].readOnly = true;
            try
            {
                document.getElementById("content1___Frame").height = 0;
            }
            catch(e)
            {
            }
        }
    }

    function PushToCtrlsDisabled(arrEle){
        for(var i=0;i<arrEle.length;i++){
            if(!arrEle[i].disabled){
                window.CtrlsDisabled.push(arrEle[i]);
            }
        }
    }
    
    window.onfocus = function(){
        if(window.sender && showAsModal){
            if(window.sender.closed == true || typeof(window.sender.closed) == "undefined"){
                for(var i=0;i<window.CtrlsDisabled.length;i++){
                    window.CtrlsDisabled[i].disabled = false;
                    window.CtrlsDisabled[i].readOnly = false;
                    try
                    {
                        document.getElementById("content1___Frame").height = 300;
                    }
                    catch(e)
                    {
                    }
                }
            }else{
                window.sender.focus();
            }
        }
    }
}

//加载编辑器
function LoadWebEdit(objEdit)
{
    var sBasePath = "../../eWebEditor/";

    var oFCKeditor = new FCKeditor(objEdit) ;
    oFCKeditor.BasePath	= sBasePath ;
    oFCKeditor.Height	= 600 ;
    oFCKeditor.ReplaceTextarea() ;
}

//加载图片或Flash
function LoadFlash(url,wmode,width,Height,objID)
{ 
    
    var filename;
    filename = url.substr(url.lastIndexOf("."));
    
    if (filename.toLowerCase() == ".swf")
        document.getElementById(objID).innerHTML = '<embed  src="' + url + '"  wmode=' + wmode + ' quality="high" pluginspage=http://www.macromedia.com/go/getflashplayer type="application/x-shockwave-flash" width="' + width +   '" height="' + Height + '"></embed>';
        //document.write('<embed id="' + objID + '" src="' + url + '"  wmode=' + wmode + ' quality="high" pluginspage=http://www.macromedia.com/go/getflashplayer type="application/x-shockwave-flash" width="' + width +   '" height="' + Height + '"></embed>');   
    else
        document.getElementById(objID).innerHTML =  '<img src="' + url + '" border="0" width="' + width + '" height="' + Height + '" />'
        //document.write('<img id="' + objID + '" src="' + url + '" border="0" width="' + width + '" height="' + Height + '" />');
//    document.close();
}