﻿//封面秀
function playFeng(){
   
   var mq_index_fmx=new Marquee("index_fmx",3,1,232,224,40,1000,300,52);
   $("#t_index_fmx").css("display","none");
   $("#index_fmx").show();
   $("#index_fmx .td_1").mouseover(function(){
        $(this).css("border","2px solid #f00");
   }).mouseout(function(){
        $(this).css("border","1px solid #ccc");
   });
   $("#index_fmx_pre").mouseover(function(){mq_index_fmx.Direction=2;});
   $("#index_fmx_next").mouseover(function(){mq_index_fmx.Direction=3;});
}
//财图-change
function playPic(){
    $(".change_div").hover(function(){
        $(this).find("p").show();
        $(this).css("height","65px");
    },function(){
       $(this).find("p").hide();
       $(this).css("height","22px");
    });
}

//财专栏-change
function playPic2(){
    $(".change_div").hover(function(){
        $(this).find("p").show();
        $(this).css("height","80px");
    },function(){
       $(this).find("p").hide();
       $(this).css("height","22px");
    });
}

//封面秀2
function playFeng2(){
   $("#cf_div").hide();
   var mq_main_cf=new Marquee("cf_div",0,1,190,1810,40,1000,300,52);
   $("#cf_div").show();
   $("#cf_div .fmx_05").mouseover(function(){
        $(this).css("border","2px solid #f00");
   }).mouseout(function(){
        $(this).css("border","1px solid #DDDFDE");
   });
    $("#btn_cf_next").mouseover(function(){mq_main_cf.Direction=1;});
}

//财活动-嘉宾
function playHdong(){
   $("#hdjb_pic").hide();
   var mq_hdjb=new Marquee("hdjb_pic",0,1,272,407,40,1000,300,52);
   $("#hdjb_pic").show();
}
//财活动-change
function Year_change(){
    $("#years_meeting").find("div").mouseover(function(){
        $("#years_meeting").find("div").attr("class","Meeting_ny3");
        $(this).attr("class","Meeting_ny2");
        $(".Meeting_nr").hide();
        $("#meeting_"+$(this).attr("target_index")).show();
    });
}
//财活动-拼音
function changePy(_this,index){
    $("#ul_py li").css("color","#3F3F3F");
    $(_this).css("color","#f00");
    $(".Guests_04").each(function(i,it){
        if(i<index){
            $(it).hide();
        }else{
            $(it).show();
        }
    });
}
//财活动-图片集
function PlayHdongPic(){
   $("#caihd_pics").hide();
   new Marquee("caihd_pics",3,1,643,126,40,1000,300,52);
   $("#caihd_pics").show();
}
//change 订阅份数
function checkNum(_this){
    var price=document.getElementById('hdprice').value;
    var num=_this.value;
    if(isNaN(num))
    {
	    _this.value=1;
	    _this.focus();
	    alert('请输入一个数字!');
	    return false;
    }
    if(num==""||parseInt(num)==0)
    {
        alert('至少要订阅一份!');
	    _this.value=1;
	    _this.focus();
	    return false;
    }
    document.getElementById('totalprice').innerHTML=price*num;
    document.getElementById('hdfenshu').value=num;
}
//order
function OrderPageInit(){
    $.formValidator.initConfig({formid:"form1",onerror:function(msg){alert(msg)},onsuccess:function(){
        return true;
    }});
    $("#realname").formValidator({onshow:"请输入您的真实姓名",onfocus:"真实姓名不能为空"}).inputValidator({min:1,onerror:"真实姓名不能为空,请确认"});
    $("#mobile").formValidator({onshow:"请输入您的手机号码，可以为空哦",onfocus:"您要是输入了，必须输入正确"}).inputValidator({min:11,max:11,onerror:"手机号码必须是11位的,请确认"}).regexValidator({regexp:"mobile",datatype:"enum",onerror:"您输入的手机号码格式不正确"});;
	$("#tel").formValidator({empty:true,onshow:"请输入您的联系电话，可以为空哦",onfocus:"格式例如：0577-88888888"}).regexValidator({regexp:"^[[0-9]{3}-|\[0-9]{4}-]?([0-9]{8}|[0-9]{7})?$",onerror:"您输入的联系电话格式不正确"});
    $("#email").formValidator({onshow:"请输入邮箱，可以为空哦",onfocus:"邮箱6-100个字符,输入正确了才能离开焦点"}).inputValidator({min:6,max:100,onerror:"您输入的邮箱长度非法,请确认"}).regexValidator({regexp:"^([\\w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([\\w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$",onerror:"您输入的邮箱格式不正确"});
    $("#postcode").formValidator({onshow:"请输入您的邮编，可以为空哦",onfocus:"邮编不能为空"}).inputValidator({min:1,max:6,onerror:"邮编必须是6位的,请确认"}).regexValidator({regexp:"zipcode",datatype:"enum",onerror:"您输入的邮编格式不正确"});
    $("#address").formValidator({onshow:"请输入您的地址",onfocus:"地址不能为空"}).inputValidator({min:1,onerror:"地址不能为空,请确认"});
}

//留言验证
function postMessage(){
     if($("#txtusername").val().length==0){
        alert("请输入您的昵称！");
        $("#txtusername").focus();
        return false;
    }
    if($("#txttitle").val().length==0){
        alert("请输入标题！");
        $("#txttitle").focus();
        return false;
    }
    if($("#txtcontent").val().length==0){
        alert("请输入内容！");
        $("#txtcontent").focus();
        return false;
    }
    if($("#txtcontent").val().length>500){
    	alert("留言内容不能大于500字！");
        $("#txtcontent").focus();
        return false;
    }
    if($("#vcode").val().length==0){
        alert("请输入验证码！");
        $("#vcode").focus();
        return false;
    }
    return true;
  }
