/* ÀÏ¹ÝÈ¸¿ø È¸¿ø°¡ÀÔ ½Ç¸íÀÎÁõ Å¸ÀÔ ¼±ÅÃ */
function certificationTypeSelect(sel) {
	var certificationType1 = document.getElementById("certificationType1");
	var certificationType2 = document.getElementById("certificationType2");
	
	var certificationTip = document.getElementById("certificationTip");
	var certificationTip2 = document.getElementById("certificationTip2");
	
	var certificationBtn1 = document.getElementById("certificationBtn1");
	var certificationBtn2 = document.getElementById("certificationBtn2");
	
	if (sel == '1'){
		certificationType1.style.display = '';
		certificationType2.style.display = 'none';
		certificationTip.style.display = '';
		certificationTip2.style.display = '';
		certificationBtn1.style.display = '';
		certificationBtn2.style.display = 'none';
	}
	else if (sel == '2'){
		certificationType1.style.display = 'none';
		certificationType2.style.display = '';
		certificationTip.style.display = 'none';
		certificationTip2.style.display = 'none';
		certificationBtn1.style.display = 'none';
		certificationBtn2.style.display = '';
	}
}

/* popup */
function openWin(url, name, w, h, s, e) {
	var ex = null;
	try {
		ex = e || window.event;
		ex.returnValue = false;
	}catch(excp){
	}
	
    var features = 'width=' + w + ', height=' + h + ', scrollbars=' + s + ', resizable=no';
    popWin = window.open(url, name, features);
}

/* popup close */
function popClose() {
	window.close();
}

//image rollover rollout
function Over(imgName) {
	imgName.src = imgName.src.replace(/(_on.gif|.gif)$/i, "_on.gif");
	imgName.src = imgName.src.replace(/(_on.jpg|.jpg)$/i, "_on.jpg");
}
function Out(imgName) {
	imgName.src = imgName.src.replace(/(_on.gif|.gif)$/i, ".gif");
	imgName.src = imgName.src.replace(/(_on.jpg|.jpg)$/i, ".jpg");
}
function OverEx(imgName, src) {
	imgName.src = src;
}
function OutEx(imgName, src) {
	imgName.src = src;
}

/*quick menu*/
function initMoving(target, position, topLimit, btmLimit) {
	if (!target)
		return false;

	var obj = target;
	obj.initTop = position;
	obj.topLimit = topLimit;
	obj.bottomLimit = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight) - btmLimit - obj.offsetHeight;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;

	if (typeof(window.pageYOffset) == "number") {	//WebKit
		obj.getTop = function() {
			return window.pageYOffset;
		}
	} else if (typeof(document.documentElement.scrollTop) == "number") {
		obj.getTop = function() {
			return Math.max(document.documentElement.scrollTop, document.body.scrollTop);
		}
	} else {
		obj.getTop = function() {
			return 0;
		}
	}

	if (self.innerHeight) {	//WebKit
		obj.getHeight = function() {
			return self.innerHeight;
		}
	} else if(document.documentElement.clientHeight) {
		obj.getHeight = function() {
			return document.documentElement.clientHeight;
		}
	} else {
		obj.getHeight = function() {
			return 500;
		}
	}

	obj.move = setInterval(function() {
		if (obj.initTop > 0) {
			pos = obj.getTop() + obj.initTop;
		} else {
			pos = obj.getTop() + obj.getHeight() + obj.initTop;
			//pos = obj.getTop() + obj.getHeight() / 2 - 15;
		}

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit;
		if (pos < obj.topLimit)
			pos = obj.topLimit;

		interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 30)
}

/* flash height controll */
//chgHeight
function chgHeight(n) {
//	alert(n);
	layer01 = document.getElementById("selectCommunity");
	layer02 = document.getElementById("searchType");
	swf_name = document.getElementById("topFlash");
	swf_name2 = document.getElementById("topFlash2");
	if(n == "open"){
		if(layer01){
			layer01.style.visibility = "hidden";
		}
		if(layer02){
			layer02.style.visibility = "hidden";
		}
		swf_name.style.height ="227px";
		swf_name2.style.height ="227px";
	}else{
		if(layer01){
			layer01.style.visibility = "visible";
		}
		if(layer02){
			layer02.style.visibility = "visible";
		}
		swf_name.style.height ="70px";
		swf_name2.style.height ="70px";
	}
}

//global
/*function gChgHeight(n) {
	swf_name = document.getElementById("globalFlash");
	swf_name2 = document.getElementById("globalFlash2");
	selVS = document.getElementById("relatedSMove");
	if(n == "open"){
		swf_name.style.height ="25px";
		swf_name2.style.height ="25px";
		selVS.style.display = "";
	}else{
		swf_name.style.height ="205px";
		swf_name2.style.height ="205px";
		selVS.style.display = "none";
		alert('test');
	}
}*/
function gChgHeight(data)
{
	//alert(data);
	swf_name = document.getElementById("globalFlash");
	swf_name2 = document.getElementById("globalFlash2");
	selVS = document.getElementById("relatedSMove");
	if(data == "open"){
		selVS.style.visibility = "hidden";
		swf_name.style.height = "205px";
		swf_name2.style.height = "205px";
		//alert(selVS.style.display);
	}else{
		selVS.style.visibility = "visible";
		
		swf_name.style.height = "25px";
		swf_name2.style.height = "25px";
	}
}


function viewMission(num){
	for (i=1;i<6;i++) {
		var missionNum = document.getElementById("mission" + i);
		document.getElementById("mission" + i).style.visibility = "hidden";
	}
	document.getElementById("mission" + num).style.visibility = "visible";
}

function hideMission(){
	for (i=1;i<6;i++) {
		var missionNum = document.getElementById("mission" + i);
		document.getElementById("mission" + i).style.visibility = "hidden";
	}
}

function viewMission2(num){
	for (i=1;i<7;i++) {
		var missionNum = document.getElementById("mission" + i);
		document.getElementById("mission" + i).style.visibility = "hidden";
	}
	document.getElementById("mission" + num).style.visibility = "visible";
}

function hideMission2(){
	for (i=1;i<7;i++) {
		var missionNum = document.getElementById("mission" + i);
		document.getElementById("mission" + i).style.visibility = "hidden";
	}
}


function footPrize(List){
	var btnPre = document.getElementById("footPrPrev"); // ÀÌÀü
	var btnNext = document.getElementById("footPrNext"); // ´ÙÀ½
	
	var List = document.getElementById(List);
	var ListUl = List.getElementsByTagName("ul");
	if(ListUl.length < 2) return;
	
	// 1¹ø ¹è³Ê »©°í ¸ðµÎ °¡¸®±â
	for(var i=1; i<ListUl.length; i++) ListUl[i].style.display = "none";

	// ¹è³Êµ¹¸®±â
	var currnetBnnr = 0; // ÇöÁ¦ º¸¿©Áö°í ÀÖ´Â ¹è³Ê³Ñ¹ö
	var oldBnnr; // Àü¿¡ º¸¿©ÁÖ¾ú´ø ¹è³Ê³Ñ¹ö
	
	this.zoneLoop = function(){ // ¹è³Ê¹Ù²Ù±â
		oldBnnr = currnetBnnr;
		(currnetBnnr == ListUl.length-1) ? currnetBnnr=0 : currnetBnnr++;
		
		if(oldBnnr != undefined) ListUl[oldBnnr].style.display = "none";
		ListUl[currnetBnnr].style.display = "";
	}
	
	var zoneLoop = setInterval(this.zoneLoop, 4000);
	
	btnPre.onclick = function(){ // ÀÌÀü
		//clearInterval(zoneLoop);
		oldBnnr = currnetBnnr;
		(currnetBnnr == 0) ? currnetBnnr=ListUl.length-1 : currnetBnnr--;
		
		ListUl[oldBnnr].style.display = "none";
		ListUl[currnetBnnr].style.display = "";
	}
	btnNext.onclick = function(){ // ´ÙÀ½
		//clearInterval(zoneLoop);
		oldBnnr = currnetBnnr;
		(currnetBnnr == ListUl.length-1) ? currnetBnnr=0 : currnetBnnr++;
		
		ListUl[oldBnnr].style.display = "none";
		ListUl[currnetBnnr].style.display = "";
	}
}

