$(function(){
	var pcl = "";
	var pid = "";
	//animate navi
	$("#navi li").hover(
	function(){
		pcl = $(this).attr("class");
		pid = $("body").attr("id");
	if(pcl != pid ){
		$(this).animate({"marginTop": "-=20px"}, "normal" );
	}
	},
	function(){
	if(pcl != pid ){
		$(this).animate({"marginTop": "+=20px"}, "normal" );
	}
	});
	
	//ajax form works
	if($("#mail_form").html()){ajaxform();}
	//my works
	$(".myworks_disc li img").css("opacity","0.8");
 	$(".myworks_disc li img").hover(
 		function(){$(this).fadeTo(300,1);},
 		function(){$(this).fadeTo(300,0.8);}
 	);

	//comments form
	if($("#comments-form").html()){comments_form();}
	
	//popup image cafe diary photo
	if($('a[@href$=.jpg],a[@href$=.JPG]').html()){$('a[@href$=.jpg],a[@href$=.JPG]').lightBox();}
	
	//scroll profile,works diary cafe
	$('.diary_cate1, .diary_cate2,.diary_category_wrap, .diary_monthly_wrap,.diary_search_wrap,.aboutwork_disc,.about_disc').jScrollPane();
	//shadow cafe diary
	if($('.photow').html()){
		$('.photow').dropShadow({
										left    : 2, 
	             						top     : 2, 
	            						blur    : 2, 
	            						opacity : 0.5, 
	             						swap    : false								
		});
	}
	
	//hide comment	
	if(location.search){
		ls = location.search.replace("?","#");
		if($(ls).html()){
			$('.diary_discription').jScrollPane({animateTo:true});
			$('.diary_discription')[0].scrollTo(ls);
		}else{
			$(".comment_wrap").hide();
			$('.diary_discription').jScrollPane();
		}
	}else{
		$(".comment_wrap").hide();
		$('.diary_discription').jScrollPane();
	}
	
	//show comment
	$('.post_comment').css("cursor","pointer");
	$('.post_comment').click(function(){
		$('.comment_wrap').show(function(){
			$('.diary_discription').jScrollPane({animateTo:true});
			$('.diary_discription')[0].scrollTo(".comment_wrap");
		});
	});
	
});
//ajax form
function ajaxform(){
	$('#mail_form').ajaxForm({
		target: '.contact_form'
	});
}
//ajax form
function comments_form(){
	$('#comments-form').ajaxForm({
		target: '.comment_form'
	});
}
