$('.bdsharebuttonbox a.bds_more').on('click',function(){
    setInterval(function(){
        $('.bdshare_dialog_box').hide();
    },5);
})
$('.bdsharebuttonbox a.bds_weixin').on('click',function(){
    setInterval(function(){
        $('.bd_weixin_popup').css({'width':'250px','height':'295px'});
    },5);
})


$(function(){
// 导航区域显示 隐藏
function navMouseleave (id,id1){
 $(id).on({
        mouseover: function() {
           $(id1).show();
        },
        mouseleave: function() {
            $(id1).hide();
        }
    });
}
// 选项卡
function tab (name1,name2,name3){;
    $(name1).on('click',function(){
        $(name2).hide();
        var Idoption = $(this).attr(name3);
        $(name2+'['+name3+''+'='+ Idoption +']').show();
        $(this).addClass('on').siblings().removeClass('on');
    })
    $(name1).eq(0).addClass('on');
    $(name2).eq(0).show();
}




navMouseleave('.y_dhqy','.y_dhqynone');//导航区域显示 隐藏
tab('#y_lpdtpc_nav1 ul li','ul.y_lpdtpc_pc1','data-id');//楼盘首页楼盘动态
tab('.countR_box ul li','.bus_tab_box','data-id');//楼盘首页 计算结果



});
// 国内外切换
var txt = $('.y_dhqytpo').find('span').text();

// 选中效果
$.each($('.y_dhqynone a'),function(k,v){
    var that = $(this);
    var title = that.text();
    if(title == txt){
        that.addClass('on');
    }
})
// 点击事件
$('.aera_btn dl dd').on('click',function(){
    var that = $(this);
    var oid = that.attr('data-id')
    that.addClass('on').siblings().removeClass('on');
    $('.inl').hide();
    $('#'+oid).show();
})
$('.aera_btn dl dd').eq(0).click();


// 搜索页面 单独加载效果
//创建一个弹出层,width 宽度,height 高度,url
function CreatePopLayerDiv(width,height,url){

    var Iheight=$(window).height(); 
    var Iwidth =$(window).width(); 
    var heights = height || 300; 
    var widths = width || 500; 
    var Oheight= (Iheight -heights) / 2; 
    var Owidth = (Iwidth - widths) /2;
    var div ='<div id="InDiv">';
        div+='<div id="offDiv">';
        div+='<div id="Content"></div>';
        div+='</div>';
        div+='</div>';
    $(document.body).append(div); 

    if(url != ""){ 
        $("#Content").load(url); 
    } 
} 
//移除弹出层 
function RemoveDiv(){
    $("#AClose").remove(); 
    $("#HTitle").remove();
    $("#offDiv").remove(); 
    $("#InDiv").remove();
} 
function btnCloses(){ 
    RemoveDiv(); 
} 
$(function(){
    // 报名 获取弹窗
    var puicBm_title,puicBm_hid,puicBm_source,puicBm_text,puicBm_buttom;                                             //为了这些变量在其它地方用;
    $('body').on('click','.pic_jjtz',function(){
        var urlstr = window.location.href;
        var searchurl = urlstr.substring(0,urlstr.indexOf('?')+1);
        // var matchdata = urlstr.match(/\.com(\/\w+)/)[1];
        
        var $that = $(this);
        CreatePopLayerDiv(560,362,"/public/reduced");                   //添加加载页面
        parent.puicBm_title = $that.attr('data-title');//报名弹窗标题
        parent.puicBm_hid = $that.attr('data-hid');//报名楼盘id
        parent.puicBm_source = $that.attr('data-source');//报名来源ID
        parent.puicBm_text = $that.attr('data-text');//报名弹窗text
        parent.puicBm_buttom = $that.attr('data-buttom');//报名弹窗-buttom -text
    });


    //楼盘首页 楼盘列表 >> 查看地图
    $('a.y_idckdt').on('click',function(){
        var lpjwd=$(this).attr('data-jwd');
        var lptitle=$(this).attr('data-title');
        var _pointx = lpjwd.split(',')[0];
        var _pointy = lpjwd.split(',')[1];
        if (lpjwd !=='') {
            window.open('/map/details#lat='+_pointy+'&lng='+_pointx+'&zoom=13&title='+lptitle+'');
        }else{
            /*调用方法*/
            var M = {};
            if(M.dialog1){
                return M.dialog1.show();
            }
            M.dialog1 = jqueryAlert({
                'content' : '暂无相关经纬度数据',
                'closeTime' : 2000,
            })
            $than.removeAttr('disabled');
            ControlSwitch = false;                  //开关为false
            return false;
        };
        
    })


    // 侧边栏
    $(window).scroll(function (){
        var st = $(this).scrollTop();
        if(st >450){
            $('.js_yv2_rightXg').fadeIn();
        }else{
            $('.js_yv2_rightXg').fadeOut();
        }
    });
    // 返顶
    $(".js_returnTop").on('click',function(){
        $("html,body").animate({scrollTop:0},300);
    })






})






// 处理资讯详情页面的底部一个月的有效日期
var myDate = new Date;
var year = myDate.getFullYear(); //获取当前时间年份
var yue = myDate.getMonth()+1;//获取当前时间月份
if (yue<10) {
    yue= '0' + yue; 
}else if(yue == 13){
    yue = '01';
};
// 返回下个月有多少天数
function mGetDate(yue){     
    var date = new Date();     
    var year = date.getFullYear();     
    var d = new Date(year,parseInt(yue), 0);
    return d.getDate();
}
var htmltime = year + '/'+ yue + '/' +'01'+'-'+ year + '/'+ yue + '/' + mGetDate(yue);
var lpTime = year + '/'+ yue + '/' + mGetDate(yue);
var v3Time = year + '.'+ yue + '.' + mGetDate(yue);


$('.w-commonality').html('(有效期至:'+htmltime+')'); //有效期   调用方法在public.js
$('.w-attention').html('有效期至:'+htmltime);          //有效期   2019-10-6 新页面调用方法在public.js
$('body').find('.w-commonality').html('(有效期至:'+lpTime+')'); //有效期   调用方法在public.js
$('body').find('.yv2_puicTime').html('有效期至:'+v3Time); //有效期   调用方法在public.js