<!doctype html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="renderer" content="webkit"> 
  <title>修改logo</title>
  <link type="text/css" rel="Stylesheet" href="/admin/drag/css/drag.frame.css">
  <link type="text/css" rel="Stylesheet" href="/admin/drag/fonts/iconfont.css">
  
  <style>
  	.logo{ padding:15px;float:left;border:1px solid #e5e5e5;}
  	.logo img{display:block;margin:0 auto; overflow:hidden;}
  </style>
  
</head>
<body>
   
   	
    <div class="drag-setupBox">
    
        <div class="box" id="tab-box">
           
            <div class="drag-tableStyle" style="padding:0px 30px;">
                <div style="margin-top:30px"><div class="drag-tips"><i class="drag-font drag-i-tuli"></i>您可按Ctrl+Z进行撤销</div></div>
                <table width="100%" cellpadding="0" cellspacing="0">
                    
                    <tr>
                    	<td class="td-tit">logo预览</td>
                        <td><div class="logo"><img src="" id="logo" /></div></td>
                    </tr>
                    <tr>
                    	<td class="td-tit">logo地址</td>
                        <td class="band-button"><input name="" type="button" class="drag-btn-vice" value="选择图片" onclick="SelectFiles('logo')"><input name="logoUrl" type="text" class="textbox" id="logoUrl"></td>
                    </tr>
                    <tr>
                    	<td class="td-tit">logo大小</td>
                        <td class="td-textbox">
                            <div class="inputInTex"><font>宽</font><input name="width" type="text" class="textbox integer" maxlength="3" value="0"></div>
                            <div class="inputInTex"><font>高</font><input name="height" type="text" class="textbox integer" maxlength="3" value="0"></div>
                        </td>
                    </tr>    
                    <tr>
                    	<td class="td-tit">logo描述</td>
                        <td class="td-textbox"><input name="logoAlt" type="text" class="textbox"></td>
                    </tr>    
                </table>
            </div><!--drag-tableStyle-->
		</div>
       
        <div class="drag-buttonBox"><span class="d-inline-block"><div class="drag-btn-main" onClick="determine()">确定修改</div><div class="drag-btn-gray" onClick="parent.closeWindow(window.name)">取消</div></span></div>

	</div>
    
	<script src="/admin/drag/js/utils.js"></script>
	<script>utils.loadJs(['jquery','judge','nicescroll'])</script>
   
	<script>
		
		//选择图片
  	  function SelectFiles(FieldID) {
		 top.popup.open({
				title:'选择文件', //窗口标题
				area: ['800', '500'], //窗口大小 宽×高
				drag:false, //是否支持拖动
				shade:0.1, //灰色遮罩层透明度
				scrollbar:false,//是否允许页面滚动
				zIndex:11000000,
				url:'../Include/SelectFile.aspx?fieldID=' + FieldID + '&showtype=vision',//指向链接
		});
	 };

	 //选择图片返回值
    top.SelectImgBack = function(Src,FieldID,WindowName){
        document.getElementById(FieldID+'Url').value = Src;
        document.getElementById(FieldID).src = Src;
        top.closePopup(WindowName);
        
    };


	var tabHeight = $(window).height()-$('.drag-buttonBox').outerHeight();
	$('#tab-box').height(tabHeight);
	
	$("#tab-box").niceScroll({  
		cursorcolor:"rgba(0,0,0,0.3)",  
		cursoropacitymax:1,  
		touchbehavior:false,  
		cursorwidth:"7px",  
		cursorborder:"0", 
		cursorborderradius:"10px"  
	}); 
	

	var logoUrl = parent.styleContent[0];
	var logoAlt = parent.styleContent[1];
	var logoWidth = parent.styleContent[2];
	var logoHeight = parent.styleContent[3];
	
	if(logoUrl){
		$('input[name="logoUrl"]').val(logoUrl);
		$('#logo').width(logoWidth).height(logoHeight).attr('src',logoUrl)
	};
	if(logoAlt){
		$('input[name="logoAlt"]').val(logoAlt);
	};
	if(logoWidth){
		$('input[name="width"]').val(logoWidth);
	};
	if(logoHeight){
		$('input[name="height"]').val(logoHeight);
	};
	
	$('input[name="logoUrl"]').keyup(function(){
		$('#logo').attr('src',$(this).val());
	});
	
	$('input[name="width"]').integer();
	$('input[name="height"]').integer();
	
	$('input[name="width"]').keyup(function(){
		$('#logo').width($(this).val())
	});
	$('input[name="height"]').keyup(function(){
		$('#logo').height($(this).val())
	});
	
	
	//返回结果
	function determine(){
		var logoUrl = $('input[name="logoUrl"]').val();
		var logoWidth = $('input[name="width"]').val();
		var logoHeight = $('input[name="height"]').val();
		var logoAlt = $('input[name="logoAlt"]').val();
		
		parent.$moduleObject.find('[drag-mark="true"]').html('<img src="'+logoUrl+'" alt="'+logoAlt+'" style="width:'+logoWidth+'px;height:'+logoHeight+'px;" />');
		
		var labelName = utils.getUrlParameter().labelName;
		
		parent.staticLabel.Save(labelName,window.name);
		
	};
	
		

    </script>


</body>
</html>