var $ = jQuery.noConflict();

$(document).ready(function() {
	var options = {
		mode: 'fade',
		speed: 1500,
		auto: true,
		auto_direction: 'left',
		pause: 3000,
		controls: true,
		prev_text: '',
		next_text: '',
		width: '282',
		prev_img: '',
		next_img: '',
		ticker_direction: 'left',
		wrapper_class: 'sliding'
	};

	var slider = $('.aktt_tweets ul').bxSlider(options);
	var isStopped = false;

	$('.aktt_tweets').mouseenter(function() { 
		isStopped = true;
		$('.aktt_tweets ul').stop();
		slider.clearInterval();
	});

	$('.aktt_tweets').mouseleave(function() { 
		if (isStopped = true) {
			isStopped = false;
			slider.fade('next');
			slider.restoreInterval();
		}
	});
});

$(document).ready(function() {
	$('.category ul li').first().css({'padding-top':'17px'});
});

$(document).ready(function() {
	$('.youtube span').first().css({'padding-right':'5px'});
});

function sidedisplay (value) {
	var oldsrc="";
	var newsrc="";
	for (var i=1; i<=3; i++) {
		if (i==value) {
			document.getElementById("postcont"+i).style.display="";
			oldsrc=document.getElementById("sideimg"+i).src;
			newsrc=oldsrc.split("_");
			document.getElementById("sideimg"+i).src=newsrc[0]+"_sdtab"+i+"_on.gif";
		}
		else {
			document.getElementById("postcont"+i).style.display="none";
			oldsrc=document.getElementById("sideimg"+i).src;
			newsrc=oldsrc.split("_");
			document.getElementById("sideimg"+i).src=newsrc[0]+"_sdtab"+i+"_off.gif";
		}
	}
}

//comment
function commentOn (value, This) {
	if (value=="1") {
		This.style.background="url('/wp-content/themes/thelabh/images/img_cm01_on.gif') no-repeat 11px 6px";
		This.style.backgroundColor="#fef0e5";
	}
	else if (value=="2") {
		This.style.background="url('/wp-content/themes/thelabh/images/img_cm02_on.gif') no-repeat 11px 7px";
		This.style.backgroundColor="#fef0e5";
	}
	else if (value=="3") {
		This.style.background="url('/wp-content/themes/thelabh/images/img_cm03_on.gif') no-repeat 11px 7px";
		This.style.backgroundColor="#fef0e5";
	}
	else if (value=="4") {
		This.style.background="url('/wp-content/themes/thelabh/images/img_cm04_on.gif') no-repeat 10px 11px";
		This.style.backgroundColor="#fef0e5";
		This.style.width="94%";
	}
}

function commentOut (value, This) {
	if (value=="1") {
		This.style.background="url('/wp-content/themes/thelabh/images/img_cm01.gif') no-repeat 11px 6px";
		This.style.backgroundColor="#ffffff";
	}
	else if (value=="2") {
		This.style.background="url('/wp-content/themes/thelabh/images/img_cm02.gif') no-repeat 11px 7px";
		This.style.backgroundColor="#ffffff";
	}
	else if (value=="3") {
		This.style.background="url('/wp-content/themes/thelabh/images/img_cm03.gif') no-repeat 11px 7px";
		This.style.backgroundColor="#ffffff";
	}
	else if (value=="4") {
		This.style.background="url('/wp-content/themes/thelabh/images/img_cm04.gif') no-repeat 10px 11px";
		This.style.backgroundColor="#ffffff";
	}
}

function chk_contact() {
	var form=document.form;
	if (form.contact1.value=="") {
		alert("성함을 입력하세요.");
		form.contact1.focus();
		return false;
	}
	else if (form.contact2.value=="") {
		alert("회사 상호를 입력하세요.");
		form.contact2.focus();
		return false;
	}
	else if (form.contact4.value=="") {
		alert("핸드폰번호를 입력하세요.");
		form.contact4.focus();
		return false;
	}
	else if (form.contact5.value=="") {
		alert("이메일을 입력하세요.");
		form.contact5.focus();
		return false;
	}
	else if (form.contact6.value=="") {
		alert("제목을 입력하세요.");
		form.contact6.focus();
		return false;
	}
	else { return true; }
}