(function($) {
	jQuery(function($) {
		$(function() {
		
//메뉴 설정
$('#nav').droppy({speed: 0});
$('#nav').parent().parent().parent().parent().css("overflow","visible");

//출석부 보이게 하기
$('.news_ticker_yellow').parent().parent().css("overflow","visible");
		
//move the image in pixel
var move = -15;

//zoom percentage, 1.2 =120%
var zoom = 1.2;

//On mouse over those thumbnail
$('.zitem').hover(function() {
	
	//Set the width and height according to the zoom percentage
	width = $('.zitem').width() * zoom;
	height = $('.zitem').height() * zoom;
	
	//Move and zoom the image
	$(this).find('img').stop(false,true).animate({'width':width, 'height':height, 'top':move, 'left':move}, {duration:200});
	
	//Display the caption
	$(this).find('div.caption').stop(false,true).fadeIn(200);
},
function() {
	//Reset the image
	$(this).find('img').stop(false,true).animate({'width':$('.zitem').width(), 'height':$('.zitem').height(), 'top':'0', 'left':'0'}, {duration:100});	

	//Hide the caption
	$(this).find('div.caption').stop(false,true).fadeOut(200);
});


//배경에서 더블클릭하면 스크롤 토글됨.
$("#cafeXeContainer").dblclick(function(e){
	if(e.pageY > ($(document).height() / 2)){
		$("html, body").animate({"scrollTop": "0px"}, 0, "easeOutQuart");
	}else{
		$("html, body").animate({"scrollTop": ($(document).height() - $(window).height())}, 0, "easeOutQuart");
	}
});

//위젯 테이블 관련
$('table.widgetTableA .title').prepend('<span style="color:#aaa;">- </span>');


//우측에 있는 손올리면 갈라지는 베너
//Custom settings
	var style_in = 'easeOutBounce';
	var style_out = 'jswing';
	var speed_in = 800;
	var speed_out = 300;	

	//Top and bottom
	var	top = $('.qitem').height() * (-1); 
	var	bottom = $('.qitem').height(); 

	$('.qitem').each(function () {

		//retrieve all the details of the image before removing it
		url = $(this).find('a').attr('href');
		img = $(this).find('img').attr('src');
		alt = $(this).find('img').attr('img');
		width = $(this).width() / 4; 
		height = $(this).height(); 
		
		//remove the image and append 4 div into it
		$('img', this).remove();
		$(this).append('<div class="bar1"></div><div class="bar2"></div><div class="bar3"></div><div class="bar4"></div>');
		
		//set the image as background image to all the bars
		$(this).children('div').css('background-image','url('+ img + ')');

		//Divide the image into 4 bars and rebuild the image
		$(this).find('div.bar1').css({top:0, left:0, width:width, height:height, backgroundPosition:'0 0' });	
		$(this).find('div.bar2').css({top:0, left:width, width:width, height:height, backgroundPosition:(width*-1) + 'px 0' });	
		$(this).find('div.bar3').css({bottom:0, left:width*2, width:width, height:height, backgroundPosition:(width*-2) + 'px 0' });	
		$(this).find('div.bar4').css({bottom:0, left:width*3, width:width , height:height, backgroundPosition:(width*-3) + 'px 0' });

	}).hover(function () {
		
		//Move those bar, 1st and 3rd move upward, 2nd and 4th move downward
		$(this).find('div.bar1').stop(false, true).animate({top:top}, {duration:speed_out, easing:style_out});	
		$(this).find('div.bar2').stop(false, true).animate({top:bottom}, {duration:speed_out, easing:style_out});	
		$(this).find('div.bar3').stop(false, true).animate({top:top}, {duration:speed_out, easing:style_out});	
		$(this).find('div.bar4').stop(false, true).animate({top:bottom}, {duration:speed_out, easing:style_out});	
				
	},
	
	function () {

		//Back to default position
		$(this).find('div.bar1').stop(false, true).animate({top:0}, {duration:speed_in, easing:style_in});	
		$(this).find('div.bar2').stop(false, true).animate({top:0}, {duration:speed_in, easing:style_in});	
		$(this).find('div.bar3').stop(false, true).animate({top:0}, {duration:speed_in, easing:style_in});	
		$(this).find('div.bar4').stop(false, true).animate({top:0}, {duration:speed_in, easing:style_in});	
	
	}).click (function () {
		
		//make the whole box clickable
		window.location = $(this).find('a').attr('href');	
	});
	
	
	//아래는 daum.net의 ip->지역정보를 이용해 레퍼러에 삽입시키는것
	$.get('/xe/?module=referer&act=procRefererLocationUpdate&location=' + t_address);	

		});
	});
}) (jQuery);


//이미지게시판 이미지 시퀜셜로 페이드 인 되게 하기 callee를 사용하기 때문에 따로 빼주어야 함. 
/*
var thumbImg = 0;
var $thumbs;
(function($) {
	jQuery(function($) {
		$(function() {
			$thumbs = $('.thumb img').hide();
		});
	});
}) (jQuery);
(function($) {
	jQuery(function($) {
		$(function() {
			$($thumbs[thumbImg++]|| []).fadeIn(300, arguments.callee);
		});
	});
}) (jQuery);
*/

//IE6,7 용 png 파일 수정용.
function setPng24(obj) { 
	obj.width=obj.height=1; 
	obj.className=obj.className.replace(/\bpng24\b/i,''); 
	obj.style.filter = 
	"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
	obj.src='';  
	return ''; 
} 
