var $ = jQuery.noConflict();

$(document).ready(function() {
	$('#gnb1, #gnb2, #gnb3, #gnb4, #gnb5, #gnb6, #gnb7').hoverIntent(function() {
		$(this).children('.subgnb').slideDown('fast');
	}, function() {		
		$(this).children('.subgnb').slideUp('normal');
	});
});

$(document).ready(function() {
	var options = {
		mode: 'fade',
		speed: 1500,
		auto: true,
		pause: 3000
	};

	var slider = $('.aktt_tweets ul').bxSlider(options);
	var isStopped = false;

	$('.aktt_tweets').hoverIntent(function() {
		isStopped = true;
		$('.aktt_tweets ul').stop();
		slider.clearTwitInterval(this);
	}, function() {		
		if (isStopped = true) {
			isStopped = false;
			slider.fade('next');
			slider.restoreTwitInterval();
		}
	});
});

$(document).ready(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto({theme:'light_rounded'});
});

//gnb
function gnbover (value, on, This) {
	if (on!="on") {
		This.className="on";
	}
}
function gnbout (value, on, This) {
	if (on!="on") {
		This.className="off";
	}
}

//side bar
function sidedisplay (value, where) {
	for (var i=1; i<=3; i++) {
		if (i==value) {
			document.getElementById("postcont_"+where+i).style.display="";
			document.getElementById("posttab_"+where+i).className="on";
		}
		else {
			document.getElementById("postcont_"+where+i).style.display="none";
			document.getElementById("posttab_"+where+i).className="none";
		}
	}
}

//comment
function commentOn (value, This) {
	if (value=="1") {
		This.style.background="url('/wp-content/themes/neasudong/images/img_cm01_on.gif') no-repeat 11px 6px";
		This.style.backgroundColor="#e2f7ff";
	}
	else if (value=="2") {
		This.style.background="url('/wp-content/themes/neasudong/images/img_cm02_on.gif') no-repeat 11px 7px";
		This.style.backgroundColor="#e2f7ff";
	}
	else if (value=="3") {
		This.style.background="url('/wp-content/themes/neasudong/images/img_cm03_on.gif') no-repeat 11px 7px";
		This.style.backgroundColor="#e2f7ff";
	}
	else if (value=="4") {
		This.style.background="url('/wp-content/themes/neasudong/images/img_cm04_on.gif') no-repeat 10px 11px";
		This.style.backgroundColor="#e2f7ff";
		This.style.width="94%";
	}
}

function commentOut (value, This) {
	if (value=="1") {
		This.style.background="url('/wp-content/themes/neasudong/images/img_cm01.gif') no-repeat 11px 6px";
		This.style.backgroundColor="#ffffff";
	}
	else if (value=="2") {
		This.style.background="url('/wp-content/themes/neasudong/images/img_cm02.gif') no-repeat 11px 7px";
		This.style.backgroundColor="#ffffff";
	}
	else if (value=="3") {
		This.style.background="url('/wp-content/themes/neasudong/images/img_cm03.gif') no-repeat 11px 7px";
		This.style.backgroundColor="#ffffff";
	}
	else if (value=="4") {
		This.style.background="url('/wp-content/themes/neasudong/images/img_cm04.gif') no-repeat 10px 11px";
		This.style.backgroundColor="#ffffff";
	}
}

//check form
function chkForm() {
	if (document.getElementsByName("chkSearch")[0].checked==true) {
		var searchWord=document.getElementById("chkWord").value;
		window.open ('http://www.google.com/search?q='+encodeURIComponent(searchWord)+'&sourceid=ie7&rls=com.microsoft:en-US&ie=utf8&oe=utf8', 'google', '');
		return false;
	}
	else {
		return true;
	}
}

//popup layer
function closepopup() {
	document.getElementById("popuplayer").style.display="none";
}

function chkcheckbox() {
	if (document.getElementById('noticechk').checked==true) {
		notice_closeWin();
	}
	else {
		notice_closeWinNo();
	}
}

function chkcheckbox2() {
	if (document.getElementById('noticechk').checked==true) {
		document.getElementById('noticechk').checked=false;
		notice_closeWinNo();
	}
	else {
		document.getElementById('noticechk').checked=true;
		notice_closeWin();
	}
}
