<%@ page contentType="text/html; charset=GBK" session="false"%>
<%@ taglib uri="/cmsTag" prefix="cms"%>

<HTML>
   <HEAD>

      <base target="_self" />

      <script type="text/javascript" src="../common/js/jquery-1.5.1.min.js"></script>
      <script type="text/javascript" src="../javascript/imagePreviewd.js"></script>

      <link rel="stylesheet" type="text/css" href="../../style/default/main.css" />
      <script>  
         if("true"==="${param.fromFlow}")
         {
         	var paramMap = new Array();
         	
       		paramMap["imgSiteFile"]="${param.imgSiteFile}";
       		paramMap["imgWebUrl"]="${param.imgWebUrl}"; 
       		paramMap["type"]="${param.imageSourceType}"; 
            //paramMap["width"]=document.getElementById("width").value
            //paramMap["height"]=document.getElementById("width").value;
            
           
            window.returnValue=paramMap;
            window.close();        
         }
         else
         {     
            var maxWidth = 200;
            var maxHeight = 170;
            window.name="editorUploadForm";
         }
      </script>

   </HEAD>
   <BODY>
      <form id="editorUploadForm" name="editorUploadForm" target="editorUploadForm" method="post" enctype="multipart/form-data">
         <table border=0 cellpadding=0 cellspacing=5 id=tabDialogSize>
            <tr>
               <td>
                  <table border=0 cellpadding=0 cellspacing=5 align=center>
                     <tr valign=top>
                        <td width="60%">

                           <table border=0 cellpadding=0 cellspacing=0 align=center width="100%">
                              <tr>
                                 <td>
                                    <fieldset>
                                       <legend>
                                          <span class="STYLE1">图片源</span>
                                       </legend>
                                       <table border=0 cellpadding=5 cellspacing=0 width="100%">
                                          <tr>
                                             <td>

                                                <table border=0 cellpadding=0 cellspacing=2 width="100%">
                                                   <tr>
                                                      <td noWrap width="20%">
                                                         <input type=radio id="imageSourceTypeWeb" name="imageSourceType" value="s" onclick="javascript:changeSource('site');" checked>
                                                         <label id='labelSite'>
                                                            <span class="STYLE1">本地</span>
                                                         </label>
                                                         :
                                                      </td>
                                                      <td noWrap width="80%">
                                                         <input size='30' type="file" id='imgSite' name='imgSite' class="f_input" onchange="previeImg(this,'site');">

                                                      </td>
                                                   </tr>
                                                   <tr>
                                                      <td noWrap width="20%">
                                                         <input type=radio id="imageSourceTypeWeb" name="imageSourceType" onclick="javascript:changeSource('web');" value="w">
                                                         <label id='labelWeb' disabled='true'>
                                                            <span class="STYLE1">网络</span>
                                                         </label>
                                                         :
                                                      </td>
                                                      <td noWrap width="80%">
                                                         <input type=text class="f_input" id='imgWeb' name='imgWeb' style='width:100%' size=30 value='' onpropertychange="previeImg(this,'web');" disabled='true'>
                                                      </td>

                                                   </tr>

                                                </table>

                                             </td>
                                          </tr>
                                       </table>
                                    </fieldset>
                                 </td>
                              </tr>
                              <tr>
                                 <td height=5></td>
                              </tr>
                              <tr>
                                 <td>
                                    <fieldset>
                                       <legend>
                                          <span class="STYLE1">图片属性</span>
                                       </legend>
                                       <table border=0 cellpadding=5 cellspacing=0 width="100%">
                                          <tr>
                                             <td>

                                                <table border=0 cellpadding=0 cellspacing=2 width="100%">

                                                   <tr>
                                                      <td noWrap width="20%" class="title_td">
                                                         解说文字:
                                                      </td>
                                                      <td noWrap width="80%" colspan=4>
                                                         <input type=text id=d_alt size=10 value="" style="width:100%" class="f_input">
                                                      </td>
                                                   </tr>

                                                   <tr>
                                                      <td noWrap width="20%" class="title_td">
                                                         边框粗细:
                                                      </td>
                                                      <td noWrap width="29%">
                                                         <input class="f_input" style="width:80px" type=text id=d_border size=10 value="">
                                                      </td>
                                                      <td width="2%">
                                                      <td noWrap width="20%" class="title_td">
                                                         对齐方式:
                                                      </td>
                                                      <td noWrap width="29%">
                                                         <select id=d_align size=1 style="width:80px">
                                                            <option value='' selected>
                                                               默认
                                                            </option>
                                                            <option value='left'>
                                                               左对齐
                                                            </option>
                                                            <option value='right'>
                                                               右对齐
                                                            </option>
                                                            <option value='top'>
                                                               顶部
                                                            </option>
                                                            <option value='middle'>
                                                               中部
                                                            </option>
                                                            <option value='bottom'>
                                                               底部
                                                            </option>
                                                            <option value='absmiddle'>
                                                               绝对居中
                                                            </option>
                                                            <option value='absbottom'>
                                                               绝对底部
                                                            </option>
                                                            <option value='baseline'>
                                                               基线
                                                            </option>
                                                            <option value='texttop'>
                                                               文本顶部
                                                            </option>
                                                         </select>
                                                      </td>
                                                      </td>

                                                   </tr>



                                                   </tr>
                                                   <tr>
                                                      <td noWrap width="20%" class="title_td">
                                                         图片宽度:
                                                      </td>
                                                      <td noWrap width="29%">
                                                         <input class="f_input" class="f_input" style="width:80px" type=text id=d_width size=10 value="" maxlength=4>
                                                      </td>
                                                      <td width="2%">
                                                         &nbsp;
                                                      </td>
                                                      <td noWrap width="20%" class="title_td">
                                                         图片高度:
                                                      </td>
                                                      <td noWrap width="29%">
                                                         <input class="f_input" style="width:80px" type=text id=d_height size=10 value="" maxlength=4>
                                                      </td>
                                                   </tr>

                                                   <tr>
                                                      <td noWrap width="20%" class="title_td">
                                                         上下间距:
                                                      </td>
                                                      <td noWrap width="29%">
                                                         <input class="f_input" style="width:80px" type=text id=d_vspace size=10 value="" maxlength=2>
                                                      </td>
                                                      <td width="2%">
                                                         &nbsp;
                                                      </td>

                                                      <td noWrap width="20%" class="title_td">
                                                         左右间距:
                                                      </td>
                                                      <td noWrap width="29%">
                                                         <input class="f_input" style="width:80px" type=text id=d_hspace size=10 value="" maxlength=2>
                                                      </td>
                                                   </tr>


                                                </table>

                                             </td>
                                          </tr>
                                       </table>
                                    </fieldset>
                                 </td>
                              </tr>
                           </table>


                        </td>
                        <td width="40%" height="100%">

                           <fieldset style="height:100%">
                              <legend>
                                 <span class="STYLE1">预览</span>
                              </legend>
                              <table border=0 cellpadding=0 cellspacing=2 width="220" height="200" valign=top>
                                 <tr>
                                    <td colspan=2 bgcolor=#FFFFFF align=center valign=middle id=tdPreview height="100%">
                                       <div id='imgDiv' />
                                    </td>
                                 </tr>
                                 <%--<tr>
											<td id=tdPreviewSize></td>
											<td align=right>
												<input type=button id=btnPreivew onclick="previewAction()" value="刷新">
											</td>
										</tr>
									--%>
                              </table>
                           </fieldset>

                        </td>
                     </tr>

                  </table>


               </td>
            </tr>
         </table>
      </form>
      <center>
         <button type="button" id="save" onclick="javascript:submitImg();">
            <img src="../../core/style/default/images/add-act.png" alt="" />
            确认
         </button>
         &nbsp;&nbsp;&nbsp;
         <button type="button" onclick="window.close();">
            <img src="../../core/style/default/images/reset-act.png" alt="" />
            取消
         </button>
      </center>
      <div id="divProcessing" style="width:200px;height:30px;position:absolute;left:220px;top:100px;display:none">
         <table border=0 cellpadding=0 cellspacing=1 bgcolor="#000000" width="100%" height="100%">
            <tr>
               <td bgcolor=#3A6EA5>
                  <marquee align="middle" behavior="alternate" scrollamount="5">
                     <font color=#FFFFFF>...图片上传中...请等待...</font>
                  </marquee>
               </td>
            </tr>
         </table>
      </div>
   </body>
</html>
<script language="javascript">
//保持兼容
//onpropertychange(document.getElementById('imgWeb'),previeImg,'web',null);


 document.getElementById('labelSite').disabled=false;
 document.getElementById('imgSite').disabled=false; 
 document.getElementById('labelWeb').disabled=true;
 document.getElementById('imgWeb').disabled=true;
 
 

 
function changeSource(type)
{
    if('site' == type)
    {
     
      //alert('ok');
      document.getElementById('labelSite').disabled=false;
      document.getElementById('imgSite').disabled=false;
      
      document.getElementById('labelWeb').disabled=true;
      document.getElementById('imgWeb').disabled=true;
      
      previeImg(document.getElementById('imgSite'),'site');
      
      $('.imgP').remove();
    
      return false;
    }
    
    if('web' == type)
    {  
      document.getElementById('labelWeb').disabled=false;
      document.getElementById('imgWeb').disabled=false;
      
      document.getElementById('labelSite').disabled=true;
      document.getElementById('imgSite').disabled=true;
      
      //FF不需要此操作
      if (!document.getElementById('imgSite').files )
      {
     	 removeDIVimgFilter();
      }
      
      $('.imgP').remove();
     
      return false;
    }
}


function submitImg()
{
   if(document.getElementById("imgSite").value=='' && document.getElementById("imgWeb").value=='')
   {
      alert("当前没有选择任何图片源");
      return;
   }

   document.getElementById("divProcessing").style.display='';
   
   
   
   
   //清空file
  //if(document.getElementById("imageSourceType").value!=1)
   //{
   //   document.getElementById("imgSite").outerHTML = document.getElementById("imgSite").outerHTML;
  // }
   
   document.editorUploadForm.action='../../content/editorUploadImage.cmd';

    document.editorUploadForm.submit();

    //document.getElementById("divProcessing").style.display='none';

}




 </script>
