$(function(){
	var boxWidth = $('#btn-box').width();
	var btnWidth = $('#frist-width').width();
	$('#btn-one').css('width',boxWidth+'px');
	var lHeight=document.body.scrollHeight ;
	var headerheight=$('#headbox').height();
	$('#l-h').css('height',lHeight-headerheight+'px');

	/*页面左侧导航*/
	$(window).scroll(function(){
		if($(window).scrollTop()>=56){
			$('.left-box').css({
				position: 'fixed',
				width: '209',
				top:'0'
			});
		}
		if($(window).scrollTop()<=100){
			$('.left-box').css({
				position: 'static'
			});
		}
	});

	/*兑换码管理清空*/
	$('.empty').click(function(event) {
		$('.selectmr').attr('value','#7bd148');
		$('.dateinput').attr('value','');
	});

	/*日历插件*/
	$('.datepicker').datepicker({autoclose:true});

	


	/*商家封面添加*/
	$('form').on('click', '.addimg',function(event) {
		$(this).remove();
		var add="<button class='addimg'><i class='fa fa-plus-square'></i></button>"
		var str="<a href='javascript:void(0)' class='deleteimg' style='margin-left:10px;'>删除</a>"
		$(".addimgbox").append($(".shaopupload1").first().clone(true).append(add).append(str));
		if($('.addimgbox').children('.shaopupload1').length==4){
			$(".addimgbox").children().last().find('.addimg').attr('disabled',true);
		}
	});

	$('form').on('click','.deleteimg', function(event) {
		$('.addimg').attr('disabled',false);
		$(this).parent('.shaopupload1').parent('.addimgbox').prev().append($('.addimg'));
		$(this).parent('.shaopupload1').remove();
	});

	



	$('.form-grouppwd small').eq(1).css('top',-8);
	$('.form-grouppwd small').eq(2).css('top',16);

	/*页面底部*/
	function getHeight(){
		var heightH=$('.pwd-h').height();	
		$( ".pwd-b" ).css('height',(heightH-80)+ 'px');
	}
	getHeight();
	window.onresize=function(){  
                getHeight();
    }


    /*点击选定再点击取消*/
    $('.equity-days span').click(function(event) {
    	if($(this).hasClass('equity-active')){
    		$(this).removeClass('equity-active');
    	}else{
    		$(this).addClass('equity-active');
    	}
    });
    /*点击选定再点击取消*/
    $('.equity-weeks span').click(function(event) {
    	if($(this).hasClass('equity-active')){
    		$(this).removeClass('equity-active');
    	}else{
    		$(this).addClass('equity-active');
    	}
    });



    /*清除高级权益已选*/
    $('.senior-button').click(function(event) {
    	$('.equity-weeks').hide();
    	$('.equity-days').hide();
    	var val=$('input:radio[name="optionsRadios"]:checked');
    	if(val){
    		val.next().next().show();
    		val.next().next().children('span').removeClass('equity-active active');
    	}
    	$('.registerdate .datepicker').val('');
    	$('.registerdate .equity-textarea').val('');
    	$('.form-field-erae').hide();
    	$('.form-field-date1').hide();
    	$('.form-field-date').hide();
    });



});