// 修饰栏目  begin
KindEditor.plugin('nsybeautify', function(K) {
			var self = this, name = 'nsybeautify',lang = self.lang(name + '.');
			self.plugin.nsybeautify = {
	            edit : function() {
		            var html = [
			            '<div style="padding:20px;">',
			            //width //height
			            '<div class="ke-dialog-row">',
			            '<label for="keWidth" style="width:15px;">'+lang.width+'</label>',
			            '<input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="400" maxlength="4" /> &nbsp; ',
			            '<label for="kerecord" style="width:70px;">'+lang.record+'</label>',
			            '<input type="text" id="kerecord" class="ke-input-text ke-input-number" name="record" value="7" maxlength="4"  style="width:30px;"/> &nbsp; ',
			            '<label style="width:80px;">'+lang.title+'</label>',	
			            '<input type="text" id="keTitle" class="ke-input-text ke-input-number" name="title" value="0" maxlength="4" style="width:30px;" /> ',  
			            '</div>',
			            '<div class="ke-dialog-row">',
			            '<label style="width:120px;">'+lang.isflag+'</label>',
			            '<select id="isflag" name="isflag">',
				        '<option value="0">' +lang.no+ '</option>',
				        '<option value="1" selected="selected">' +lang.yes+ '</option>',
				        '</select> &nbsp; &nbsp; ',
			            '<label style="width:120px;">'+lang.isnew+'</label>',
			            '<select id="isnew" name="isnew">',
				        '<option value="0">' +lang.no+ '</option>',
				        '<option value="1">' +lang.yes+ '</option>',
				        '</select> &nbsp;',
				        '</div>',
				        '<div class="ke-dialog-row">', 
				        '<label style="width:120px;">'+lang.ishot+'</label>',
			            '<select id="ishot" name="ishot">',
				        '<option value="0">' +lang.no+ '</option>',
				        '<option value="1">' +lang.yes+ '</option>',
				        '</select> &nbsp; &nbsp; ',
				        '<label style="width:120px;">'+lang.istop+'</label>',
			            '<select id="istop" name="istop">',
				        '<option value="0">' +lang.no+ '</option>',
				        '<option value="1">' +lang.yes+ '</option>',
				        '</select> &nbsp; ',
				        '</div>',
			            '<div class="ke-dialog-row">',
			            '<label style="width:120px;">'+lang.isclick+'</label>',
			            '<select id="isclick" name="isclick">',
				        '<option value="0">' +lang.no+ '</option>',
				        '<option value="1">' +lang.yes+ '</option>',
				        '</select> &nbsp; &nbsp; ',
				        '<label style="width:120px;">'+lang.isdepartment+'</label>',
			            '<select id="isdepartment" name="isdepartment">',
				        '<option value="0">' +lang.no+ '</option>',
				        '<option value="1">' +lang.yes+ '</option>',
				        '</select> &nbsp; ',
				        '</div>',
				        '<div class="ke-dialog-row">',
				        '<label style="width:120px;">'+lang.ismore+'</label>',
			            '<select id="ismore" name="ismore">',
				        '<option value="0">' +lang.no+ '</option>',
				        '<option value="1" selected="selected">' +lang.moreTop+ '</option>',
				        '<option value="2">' +lang.moreBottom+ '</option>',
				        '</select> &nbsp; ',
			            '</div>',
			            '<div class="ke-dialog-row">',
				        '<label style="width:120px;">'+lang.istime+'</label>',
			            '<select id="istime" name="istime">',
				        '<option value="0">' +lang.no+ '</option>',
				        '<option value="1">' +lang.yes1+ '</option>',
				        '<option value="2">' +lang.yes2+ '</option>',
				        '<option value="3">' +lang.yes3+ '</option>',
				        '<option value="4">' +lang.yes4+ '</option>',
				        '<option value="5">' +lang.yes5+ '</option>',
				        '<option value="6">' +lang.yes6+ '</option>',
				        '<option value="7">' +lang.yes7+ '</option>',
				        '<option value="8">' +lang.yes8+ '</option>',
				        '<option value="9">' +lang.yes9+ '</option>',
				        '<option value="10">' +lang.yes10+ '</option>',
				        '<option value="11">' +lang.yes11+ '</option>',
				        '<option value="12">' +lang.yes12+ '</option>',
				        '<option value="13">' +lang.yes13+ '</option>',
				        '<option value="14">' +lang.yes14+ '</option>',
				        '<option value="15">' +lang.yes15+ '</option>',
				        '</select> &nbsp; ',
			            '</div>',
			            //修饰栏目加载
			            '<div class="ke-dialog-row">',
			             '<label style="width:120px;">'+lang.artdesign+'</label>',
			            '<select id="isartdesign" name="isartdesign">',
				        '<option value="0">' +lang.no+ '</option>',
				        '<option value="1">' +lang.yes+ '</option>',
				        '</select> &nbsp; ',
			            //'<label>'+lang.beautify+'</label>
			            '<iframe id="d_nsybeautify" name="d_nsybeautify" frameborder="0" src="../Wpedt/WpdccEditor/plugins/nsybeautify/nsyitembeautify.aspx" width="100%" height="50px" scrolling="no" ></iframe>',
			            '</div>',
			            '</div>'
		            ].join('');
		            var dialog = self.createDialog({
			            name : name,
			            width : 450,
			            title : self.lang(name),
			            body : html,
			            yesBtn : {
				            name : self.lang('yes'),
				            click : function(e) {
        						var width = widthBox.val(),record = recordBox.val(),isartdesign = isartdesignBox.val(),
        						isflag = isflagBox.val(),
        						isnew = isnewBox.val(),
        						ishot = ishotBox.val(),
        						istop = istopBox.val(),
        						ismore = ismoreBox.val(),
        						isclick = isclickBox.val(),
        						istime = istimeBox.val(),
        						isdepartment = isdepartmentBox.val(),
        						title=titleBox.val();
        						var random=K('#randomtype').val();
					            if (!/^\d*$/.test(width)) {
						            alert(self.lang('invalidWidth'));
						            widthBox[0].focus();
						            return;
					            }
					            if (record==""||record==null){
					                alert(self.lang('invalidNull'));
						            recordBox[0].focus();
					                return ;
					            }
					            if (!/^\d*$/.test(record)) {
						            alert(self.lang('invalidRecordnum'));
						            recordBox[0].focus();
						            return;
					            }
					              if (!/^\d*$/.test(title)) {
						            alert(self.lang('invalidTitle'));
						            titleBox[0].focus();
						            return;
					            }
					            var artDesignTemplateId=1;
					            var bigClassId=1;
					            var artDesignTemplateName="";
					            var bigClassName="";
					            try {
					                artDesignTemplateId = frames['d_nsybeautify'].myform.d_banner.value;
					                artDesignTemplateName=frames['d_nsybeautify'].myform.d_banner.options[frames['d_nsybeautify'].myform.d_banner.selectedIndex].text;//选中栏目的text
                                    bigClassId = frames['d_nsybeautify'].myform.d_grouping.value;
                                    bigClassName=frames['d_nsybeautify'].myform.d_grouping.options[frames['d_nsybeautify'].myform.d_grouping.selectedIndex].text;//选中栏目的text
                                }catch(e){
                                    alert("error");
                                }
                                
					            var html = "<button id=\"QXNSY2005\" name=\"200?isArtDesign="+isartdesign+"@width="+width+"@artDesignTemplateId="+artDesignTemplateId+"@bigClassId="+bigClassId+"@recordNum="+record+"@en="+isnew+"@eh="+ishot+"@et="+istop+"@em="+ismore+"@ec="+isclick+"@ert="+istime+"@ed="+isdepartment+"@ef="+isflag+"@ti="+title+"\" style=\"WIDTH: "+width+"px;\" >"+lang.show+"="+bigClassName+" "+lang.showt+"="+artDesignTemplateName+" "+lang.width+"="+width+"</button>";
					            self.insertHtml(html).hideDialog().focus();
				            }
			            }
		            }),
		            div = dialog.div,
		            widthBox = K('[name="width"]', div),
		            recordBox = K('[name="record"]', div),
		            isartdesignBox = K('[name="isartdesign"]', div),
		            isflagBox = K('[name="isflag"]',div),
		            isnewBox = K('[name="isnew"]', div),
		            ishotBox = K('[name="ishot"]', div),
		            istopBox = K('[name="istop"]', div),
		            ismoreBox = K('[name="ismore"]', div),
		            isclickBox = K('[name="isclick"]', div),
		            istimeBox = K('[name="istime"]', div),
		            isdepartmentBox = K('[name="isdepartment"]', div),
		            titleBox=K('[name="title"]',div),//自定义标题字数
		            bigclassIdBox=K('[name="d_nsybeautify"]', div); 
		            
		             //加载右键菜单
		            var img = self.plugin.getSelectedNsybeautify();
		            
			        if (img) {
				        widthBox.val(K.removeUnit(img.css('width')) ||  0);
				        
				        //读取修改参数
				        var names=img[0].name.split('?');
				        var URLParams = new Object() ;
                        var aParams =names[1].split('@') ;
                        for (i=0 ; i < aParams.length ; i++) {
	                        var aParam = aParams[i].split('=') ;
	                        URLParams[aParam[0]] = aParam[1] ;
	                    }
				        var lsisArtDesign=URLParams["isArtDesign"];
				        var lsrecordNum=URLParams["recordNum"];
				        var IsenableFlag=URLParams["ef"];
				        var lsenableNews=URLParams["en"];
				        var lsenableHot=URLParams["eh"];
				        var lsenableTop=URLParams["et"];
				        var lsenableMore=URLParams["em"];
				        var lsenableClick=URLParams["ec"];
				        var lsenableReleaseTime=URLParams["ert"];
				        var lsenableDepartment=URLParams["ed"];
				        var bigclassId=URLParams["bigClassId"];
				        var artDesignTemplateId=URLParams["artDesignTemplateId"];
				        var Title=URLParams["ti"];
				        
				        recordBox.val(lsrecordNum);//记录数
				        isartdesignBox.val(lsisArtDesign);//是否系统栏目模板
				        isflagBox.val(IsenableFlag);
				        isnewBox.val(lsenableNews);
				        ishotBox.val(lsenableHot);
				        istopBox.val(lsenableTop);
				        ismoreBox.val(lsenableMore);
				        isclickBox.val(lsenableClick);
				        istimeBox.val(lsenableReleaseTime);
				        isdepartmentBox.val(lsenableDepartment);
				        titleBox.val(Title);
				        bigclassIdBox.attr("src","../Wpedt/WpdccEditor/plugins/nsybeautify/nsyitembeautify.aspx?aId="+artDesignTemplateId+"&bigclassId="+bigclassId);
                        
			        }
			        widthBox[0].focus();
			        widthBox[0].select();
		            
	            }
	            
            };
	    self.clickToolbar(name, self.plugin.nsybeautify.edit);
		});

// 修饰栏目  end