$(document).ready(function(){
	$("#code").click(function(){            //点击改变验证码
		//alert("haha");
		$("#code").attr("src",$("#code").attr("src")+"a");
	})
	
	$('textarea[name="msg"]').each(function() {           //控制文本域默认内容
		if($(this).html() === '') {
			$(this).html($(this).attr('title'));	
		}
		
		$(this).focus(function() {
			if($(this).html() == $(this).attr('title')) {
				$(this).html('');	
			}
		});
		$(this).blur(function() {
			if($(this).html() === '') {
				$(this).html($(this).attr('title'));	
			}
		});
		
	});
	
	$("input[name='email']").blur(function mail_test(){
		email=$(this).val();
		if(!/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(email))
		{
			 $("input[name='email']").css("background-color","#ffe1e1");
		}else{
			 $("input[name='email']").css("background-color","#ffffff");
		}
	})
	
	
	
})

window .onload =function (){
	$(".pic_box img").each(function(i){
		var box_w=$(".pic_box").width();
		var box_h=$(".pic_box").height();
		var img_w=$(this).width();
		var img_h=$(this).height();
		
		$(this).css("left",-(img_w-box_w)/2);
		$(this).css("top",-(img_h-box_h)/2);
	});
	
	$(".pic_box img").mouseover(function(){
		$(this).fadeTo(20,0.6);
		//$(this).width(150);
	}).mouseout(function(){
		$(this).fadeTo(20,1);
		//$(this).width(140);
	});
}
