

function AutoScroll(obj){
        $(obj).find("ul:first").animate({
                marginTop:"-25px"
        },1000,function(){
                $(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
        });
}
$(document).ready(function(){
setInterval('AutoScroll("#scrollDiv")',5000)
});




$(function(){
		   
		   
$("#msg").ajaxStart(function(){
   $("#msg input").attr( "disabled","disabled" );
 });  
$("#msg").ajaxStop(function(){
					
					$("#msg input").removeAttr("disabled")
					
					})	   
		   

var fp=$("#foot").position();
	
	$(".gotop").css({"position":"fixed",left:(fp.left+954)+"px",bottom:"50px"}).html("<a href='#top'><img src='/images/gotop.gif' border=0></img></a>");
	$(window).scroll( function() { 
							   if($(this).scrollTop()==0){
								   
								  $(".gotop")
								  
								  .fadeOut("slow");
								  
								   }else{
								 $(".gotop")
								 
								 .fadeIn("slow");
									   }
							  							   
							   
							   } );





$(".jsContainer").jscroll({ 
	W:"2px"//设置滚动条宽度	
	,Bg:"#5D0059"//设置滚动条背景图片position,颜色等
	,Bar:{  
		Bd:{Out:"#E2017B",Hover:"#fff"}//设置滚动滚轴边框颜色：鼠标离开(默认)，经过
		,Bg:{Out:"#E2017B",Hover:"#fff"}}//设置滚动条滚轴背景：鼠标离开(默认)，经过，点击
		,Btn:{  btn:false//是否显示上下按钮 false为不显示
			}//设置下按钮背景：鼠标离开(默认)，经过，点击
	
	});


});
 
 

      function _submit(){
           
		$(function(){
			$.ajax({
				   type:'POST',
				   url:'savemsg.asp',
				   data:{
					   xingming:$("#xingming").val(),
					   sex:$("input[name=sex]:checked").val(),
					   tel:$("#tel").val(),
					   qq:$("#qq").val(),
					   email:$("#email").val(),
					   area:$("#area").val(),
					   address:$("#address").val(),
					   detail:$("#detail").val()
					   },
					   error:function(){
						   alert("提交失败，请重试。");
						   },
				   success:function(result){					 

					   if (result.indexOf("感谢您的留言")!=-1){
						     document.msg.reset();
						     alert(result);
							 $.get("sendmsg.asp?isnew=ok");
						   }else{
							 alert("错误："+result);
							   }
					 
					   
					   }
				   
				   })
			})	
	
	  }
      

function check(){
	
if (document.msg.xingming.value=="")
 {
  alert('请输入你的名字！');
  document.msg.xingming.focus();
  return false;
 }
var tel=document.msg.tel.value;
telpatrn = /^[0-9]{3,}|-$/;
if (!telpatrn.test(tel)){
	alert('电话号码不正确...');
	document.msg.tel.focus();
	return false;
} 
qqpatrn = /^[0-9]{5,9}|-$/;
qq=document.msg.qq.value;
if (!qqpatrn.test(qq)){
alert('QQ号码不正确...');
document.msg.qq.focus();
return false;
} 
 
 if (document.msg.area.value=="请选择")
 {
  alert('请选择您要加盟的区域！');
  document.msg.area.focus();
  return false;
 }
   if (document.msg.address.value=="")
 {
  alert('请输入您的的详细地址！');
  document.msg.address.focus();
  return false;
 }
if (document.msg.detail.value=="")
 {
  alert('请输入您的留言信息！');
  document.msg.detail.focus();
  return false;
 }
 var em=document.msg.email.value;
 patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
	if (!patrn.test(em)){
		alert('邮箱地址格式不正确...');
		document.msg.email.focus();
		return false;
	}
	
_submit();
 }		