

//±ÔÁ¦°³Çõ,¿©¼º³ó¾÷ÀÎ,ÇØ¿Ü³ó¾÷

var etcNum = 1;



function goEtcPreNext(num) {
        var temp = 7;
	var comm;

	etcNum++;

	if(etcNum >= temp ) etcNum = 1;

	for(i=1 ; i < temp+1; i++) {

		comm = document.getElementById("etcsite" + i);

		if(etcNum > i ) {

			comm.style.display = "none";

		} else if(i < etcNum+ 2 ) {

			comm.style.display = "block";

		} else {

			comm.style.display = "none";

		}

	}

}



function startEtcBanner() {

	goEtcPreNext(etcNum);

}



setInterval("startEtcBanner();", 3000);



//È«º¸°ü

var prNum = 1;



function goPrPreNext(num) {

	prNum = prNum + num;

	if(prNum <= 0 ) prNum = 1;

	if(prNum >= 2 ) prNum = 2;

	var pr;

	for(i=1 ; i < 4; i++) {

		pr = document.getElementById("prMulti_" + i);

		if(prNum > i ) {

			pr.style.display = "none";

		} else if(i < prNum + 2  ) {

			pr.style.display = "block";

		} else {

			pr.style.display = "none";

		}

	}

}







//ÆË¾÷°ü¸®

var popup_waitingtime=7000;		// ¸ØÃß´Â ½Ã°£

var popup_num = 1;				// ÃÊ±â ÆË¾÷

var popup_length = 4;			// ÆË¾÷ °¹¼ö  <!-- [11/06]  ¿©±â ¼ýÀÚ °íÃÄ¼­ ¾²¼¼¿ä.

//¹Ì´Ï°ø°¨ 
var gong_waitingtime=3000;
var gong_num = 1;
var gong_length = 2;

// ½ºÅ©·Ñ ½ÃÀÛ

function startPopup()

{ 
var kid = setInterval("popup_num_img();", popup_waitingtime);

if(popup_length == 1){
	clearInterval(kid);
}

}

//¹Ì´Ï°ø°¨
function startGong()

{ 
 setInterval("gong_div();", gong_waitingtime);


}

function gong_div(){

	if(gong_num == gong_length) {
		gong_num = 1;
		document.getElementById('mdiv2').style.display = "none";
				document.getElementById('mdiv1').style.display = "block"; 
	
	}	else {
		document.getElementById('mdiv1').style.display = "none";
				document.getElementById('mdiv2').style.display = "block"; 
		gong_num++;
	}
}



function popup_num_img(){

	if(popup_num == popup_length) popup_num = 1;

	else popup_num++;

	

	for(var i=1 ; i <= popup_length ; i++){

		if(i == popup_num && popup_length != 1){
				document.getElementById('popup_num'+(i)).src = document.getElementById('popup_num'+(i)).src.replace('.gif','_on.gif');

				document.getElementById('popup_layer'+(i)).style.display = "block";

		}else{				

			document.getElementById('popup_num'+(i)).src = document.getElementById('popup_num'+(i)).src.replace('_on.gif','.gif');

			document.getElementById('popup_layer'+(i)).style.display = "none"; 

		}

	} 

}

 

function popup(num){

	popup_num = num-1;   

	popup_num_img();

}





var bannerLayerObj, bannerListObj;

var totalHeight, listHeight;

var waitTF = true;												// ÇÑÁÙ¸¶´Ù ½¬±âÀ§ÇÑ Ã¼Å©º¯¼ö

var bannerWaitingTime = 10000;									// ÇÑÁÙ¸¶´Ù ½¬´Â ½Ã°£

var waitingTime = 50; 											// À§·Î ¿Ã¶ó°¡´Â ¼Óµµ

var b_num = 0;

var direction = -1;

 

function bannerRoll(){

	if(waitTF == true){				

		if(direction == -1 && b_num == (totalHeight-listHeight)*(direction)){

			bannerListObj.style.top = listHeight+"px";

			b_num = listHeight;

		}else if(direction == 1 && b_num == 0){

			bannerListObj.style.top = totalHeight*(-1) + "px";

			b_num = totalHeight*(-1); 

		} 

		

		if(direction == -1 && b_num > (totalHeight-listHeight)*(direction)){

			b_num--;			

			bannerListObj.style.top = b_num+"px";

		}else if(direction == 1 && b_num < 0 ){

			b_num++;			

			bannerListObj.style.top = b_num+"px";

		}

		

		if(

			(b_num < 0 && ((b_num*-1) % listHeight) == 0) 

			|| (b_num > 0 && (b_num % listHeight) == 0) 

			|| b_num == (totalHeight-listHeight)*(direction) 

			|| b_num == 0 

		){

			waitTF = false;

			setInterval("waitTF=true", bannerWaitingTime);

		}

	}

} 



function bannerUp(){ 

	direction = -1;

}



function bannerDown(){

	direction = 1;

}



function bannerMouseOver(){ 

	waitTF = false;

}



function bannerMouseOut(){ 

	waitTF = true;

} 



function startBanner(){

	bannerLayerObj = document.getElementById("bannerLayer");	// ¹è³Ê ·¹ÀÌ¾î

	bannerListObj = document.getElementById("bannerList");		// ¹è³Ê ¸®½ºÆ®

	totalHeight = document.getElementById("bannerLayer").scrollHeight;					// ¹è³Ê¸®½ºÆ® ÀüÃ¼ ³ôÀÌ

	listHeight = document.getElementById("bannerLayer").clientHeight;					// ¹è³Ê¸®½ºÆ® ÇÑÁÙ ¸®½ºÆ®



	if(waitTF == true){

		setInterval("bannerRoll();", waitingTime);

	}

}



function npHide(){ // ·¹ÀÌ¾î¸¦ °¨Ãß´Â ÇÔ¼ö

	document.getElementById("newpop").style.display="none";

	document.getElementById("newpop01").style.display="none";

}









// ½ÃÀÛ

window.onload = function () {

	//¾Ë¸²ÆÇ 

	startPopup();

	

	//ÇÏ´Ü ¹è³Ê

	startBanner();
	
	//¹Ì´Ï°ø°¨
	startGong();

	

	//Äü¸Þ´º

	//qMenu = new QuickMenu(document.getElementById("quick_menu"), 95, 95);	

	//qMenu.InitializeStaticMenu();

}



