<!-- ½ºÅ©·Ñ ¹è³Ê ½ºÅ©¸³Æ® ½ÃÀÛ -->

function addLoadEvent(func){
	var oldonload = window.onload;
	
	if(typeof window.onload != 'function'){
		window.onload = func;
		
	}else{
		window.onload = function(){
			oldonload();
			func();
		}
	}
}

/* main e-mail */
function email(){
	if(!document.getElementById("mail_first")) return false;
	if(!document.getElementById("mail_end")) return false;
	if(!document.getElementById("first_btn")) return false;
	if(!document.getElementById("end_btn")) return false;
	if(!document.getElementById("input_l")) return false;
	if(!document.getElementById("input_c")) return false;
	if(!document.getElementById("input_r")) return false;
	
	var first = document.getElementById("mail_first");
	var end = document.getElementById("mail_end");
	var btn_first = document.getElementById("first_btn");
	var btn_first1 = document.getElementById("first_btn1");
	var btn_end = document.getElementById("end_btn");
	var input_l = document.getElementById("input_l");
	var input_c = document.getElementById("input_c");
	var input_r = document.getElementById("input_r");
		
	btn_first.onclick = function(){
		first.style.display = "none";
		end.style.display = "block";
	}
	btn_first1.onclick = function(){
		first.style.display = "none";
		end.style.display = "block";
	}
	btn_end.onclick = function(){
		end.style.display = "none";
		first.style.display = "block";
	}
	input_l.onfocus = function(){
		input_l.style.background = "#ebebeb none";
	}
	input_c.onfocus = function(){
		input_c.style.background = "#ebebeb none";
	}
	input_r.onfocus = function(){
		input_r.style.background = "#ebebeb none";
	}
	
}
addLoadEvent(email);

/* discography »ó¼¼ ·¹ÀÌ¾î Á¤º¸ */
function layer(){
	if(!document.getElementById("layer_list")) return false;
	if(!document.getElementById("close_btn")) return false;
	
	var btn = new Array();
	btn[0] = "album01";
	btn[1] = "album02";
	btn[2] = "album03";
	btn[3] = "album04";
	btn[4] = "album05";
	btn[5] = "album06";
	btn[6] = "album07";
	btn[7] = "album08";
	btn[8] = "album09";
	btn[9] = "album10";
	btn[10] = "album11";
	btn[11] = "album12";
	btn[12] = "album13";
	btn[13] = "album14";
	btn[14] = "album15";
	
	var layer = document.getElementById("layer_list").getElementsByTagName("span");
	var show = document.getElementById("close_btn").getElementsByTagName("a");
	
	
	for(i=0; i<layer.length; i++){
		layer[i].cont = i;
		layer[i].onclick = function(){
			for(j=0; j<layer.length; j++){
				document.getElementById(btn[j]).style.display = "none";
			}
			document.getElementById(btn[this.cont]).style.display = "block";
		}
		show[i].onclick = function(){
			this.parentNode.parentNode.style.display = "none";
		}
	}
}
addLoadEvent(layer);

/* discography album */
function btn_disco(){
	if(!document.getElementById("btn_disco")) return false;
	
	var source = document.getElementById("btn_disco").getElementsByTagName("img");
	var btn_img;
	
	function over(text){
		text.src = text.over;
		if(btn_img){
			btn_img.src = btn_img.src.replace("on.gif", "off.gif");
		}
		btn_img = text;
	}
	
	var show = new Image();
	for(i=0; i<source.length; i++){
		if(source[i].src.indexOf("off.gif") != -1){
			show[i] = source[i].src.replace("off.gif", "on.gif");
			source[i].over = show[i];
			source[i].onmouseover = function(){
				if(this.src.indexOf("on.gif") != -1){
					
				} else {
					over(this);
				}
			}
		}
	}	
}
addLoadEvent(btn_disco);

/* discography album border */
function list_bor(){
	if(!document.getElementById("list_bor")) return false;
	
	var source = document.getElementById("list_bor").getElementsByTagName("span");
	
	for(i=0; i<source.length; i++){
		if(source[i].firstChild.className == "alink"){
			source[i].firstChild.onmouseover = function(){
				this.parentNode.style.border = "1px solid #f26522";
			}
			source[i].firstChild.onmouseout = function(){
				this.parentNode.style.border = "1px solid #e4e4e4";
			}
		}
	}
}
addLoadEvent(list_bor);

/* ÆË¾÷ */
function cwin(url, w, h,idx) {
		
	if (screen.width < 1025){
		LeftPosition=0;
		TopPosition=0;
	} else {
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	window.open(url, idx, "width="+w+",height="+h+",top="+TopPosition+",left="+LeftPosition+", scrollbars=no");
}
