$(function(){
	setSearchFormStyle();
	setCommentFormStyle();
	setCodeStyle();
})

//设置代码全宽显示
function setCodeStyle(){
	var full = $('#full');
	//判断是否需要全宽显示
	if(full.length > 0 && full.val() == 'true'){
		$('.wp_syntax').hover(
			function(){
				$(this).css({
					'z-index': 1001,
					position: 'relative'
				}).animate({'width':'980px'},'300');
			},
			function(){
				$(this).animate({'width':'650px'},'300');
			}
		)
	}
}

//设置评论样式
function setCommentFormStyle(){
	var comment_val = "有神马说神马！";
	var author_val = '昵称：';
	var email_val = '邮箱：';
	var comment = $('#comment');
	var author = $('#author');
	var email = $('#email');
	comment.val(comment_val);
	author.val(author_val);
	email.val(email_val);

	comment.focus(function(){
		if(comment.val() === comment_val){
			comment.val('');
		}
		comment.addClass('focus');
	}).blur(function(){
		if(comment.val() === ''){
			comment.val(comment_val);
		}
		comment.removeClass('focus');
	})
	author.focus(function(){
		if(author.val() === author_val){
			author.val('');
		}
		author.addClass('focus');
	}).blur(function(){
		if(author.val() === ''){
			author.val(author_val);
		}
		author.removeClass('focus');
	})
	email.focus(function(){
		if(email.val() === email_val){
			email.val('');
		}
		email.addClass('focus');
	}).blur(function(){
		if(email.val() === ''){
			email.val(email_val);
		}
		email.removeClass('focus');
	})
	
}

//设置搜索表单样式
function setSearchFormStyle(){
	var search_keys = $('#search_keys');
	search_keys.focus(
		function(){
			if($(this).val() === '你懂的'){
				$(this).val('');
			}
			$(this).css({
				border:'2px solid #4282C4'
			});
		}
	).blur(
		function(){
			if($(this).val() === ''){
				$(this).val('你懂的');
			}
			$(this).css({
				border:'2px solid #DCE8F3'
			});
		}
	)
}
