
var mLayer = function(ev){
	$('.m_layer').removeClass('show');
	$('.m_layer').children().removeClass('show');
	$('input').blur();
	$('html,body').css({
		'height': 'auto',
		'overflow': 'visible'
	})
	ev.preventDefault();
}
var common = {
	init: function(){
		this.mLayer();
	},

	isTrue: function(bl,fn){
		bl && fn && fn(this);
	},

	// swiper
	swiper: function(){
		var swiper = new Swiper('#swiper_1', {
	        pagination: '.swiper-pagination',
	        paginationClickable: true,
	        loop: true,
	        autoplay: 3000,
	        speed: 500,
	        eventTarget : 'container',
	        autoplayDisableOnInteraction: false
	    });
	},

	guessList: function()
	{
	    // 猜你喜欢
	    var swiper = new Swiper('#guess_list', {
	        slidesPerView: 3,
	        slidesPerGroup: 3,
	        speed: 500
	    });
	},

	// 判断是否有效点击
	isMove: function(obg,fn){
		bOk = true;

		$(obg).on('touchstart',function(){
			bOk = true;
		});

		$(document).on('touchmove',function(){
			bOk = false;
		});

		$(obg).on('touchend',function(ev){
			if(!bOk) return;
			fn(this, ev);
		});
	},

	mLayer: function(){
		this.isTrue($('.m_layer')[0],function(){
			$('.m_layer').on('touchmove',function(ev){
				ev.preventDefault();
			});			
		})

		

		this.isMove($('.m_layer'),function(_this,ev){
			mLayer(ev);
		});

		this.isMove($('.close'),function(_this,ev){
			mLayer(ev);
		});
	},

	sucLayer: function(str)
	{
		var str = str || '加入清单成功';
		var oS = str;
		$('body').append('<div class="suc_state on">'+str+'</div>');
		setTimeout(function(){
			$('.suc_state').remove();
		},1000);
	}
};

common.init();

var ComMonPopup = new Object();
ComMonPopup.PopupText = function (StringText, Switch) {
    var PopupHTML = "<div class=\"common_popup transform_popup\">" +
        "<div class=\"common_popup_text\"><p>" + StringText + "</p></div>" +
        "<div class=\"common_popup_bj\"></div>" +
        "</div>";

    $("body").prepend(PopupHTML);

    $(".common_popup_bj").on("touchstart touchend touchmove", function () {
        return false;
    });
    $(".common_popup_text").on("touchstart touchmove", function () {
        return false;
    });

    if (Switch) {
        setTimeout(function () {
            $(".common_popup").detach();
        }, 2000);
    }
};