// JavaScript Document

// window.onload Event
function addLoadEvent(func){
	var oldonload = window.onload;
	
	if(typeof window.onload != 'function'){
		window.onload = func;
		
	}else{
		window.onload = function(){
			oldonload();
			func();
		}
	}
}
var cur = 0;


/* quick */
function CheckUIElements(){
	var yMenuFrom, yMenuTo, timeoutNextCheck, speed;
	yMenuFrom = parseInt(document.getElementById("quick_menu").style.top, 10);
	yMenuTo = 175 + parseInt(document.documentElement.scrollTop, 10);
	timeoutNextCheck = 400;
	if(yMenuFrom == yMenuTo){
		setTimeout ("CheckUIElements()", timeoutNextCheck);
		return false;
	}else{
		speed = Math.ceil((yMenuTo - yMenuFrom) * 0.1);
		document.getElementById("quick_menu").style.top = (parseInt(document.getElementById("quick_menu").style.top, 10) + speed) + "px";
		timeoutNextCheck = 25;
		setTimeout ("CheckUIElements()", timeoutNextCheck);
		return false;
	}
}


function quick_onLoad(){
	if(!document.getElementById("quick_menu")) return false;

	var start_pos = "175";
	document.getElementById("quick_menu").style.top = start_pos + "px";
	document.getElementById("quick_menu").style.display = "block";
	CheckUIElements();
	return false;
	
}
addLoadEvent(quick_onLoad);



function img_rollover(){
	if(!document.getElementById("glover")) return false;
	var source = document.getElementById("glover").getElementsByTagName("img");
	for(i=0; i<source.length; i++){
		source[i].count = i+1;
		source[i].onmouseover = function(){
			var ant = this.src.split("/");
			var num = ant.length-1
			var tre = ant[num].slice(-7)    // µÚ¿¡¼­ 7±ÛÀÚ ÃßÃâ
			if (tre == "_on.gif")return false;	//  on ÀÌ¹ÌÁö ´Â return
			this.src = this.src.replace("_off.gif", "_on.gif");
				this.onmouseout = function(){
				this.src = this.src.replace("_on.gif", "_off.gif");
				} // end of onclick
		} // end of onclick
	}
}
addLoadEvent(img_rollover)

function img_rollover(){
	if(!document.getElementById("submenu")) return false;
	var source = document.getElementById("submenu").getElementsByTagName("img");
	for(i=0; i<source.length; i++){
		source[i].count = i+1;
		source[i].onmouseover = function(){
			var ant = this.src.split("/");
			var num = ant.length-1
			var tre = ant[num].slice(-7)    // µÚ¿¡¼­ 7±ÛÀÚ ÃßÃâ
			if (tre == "_on.gif")return false;	//  on ÀÌ¹ÌÁö ´Â return
			this.src = this.src.replace("_off.gif", "_on.gif");
				this.onmouseout = function(){
				this.src = this.src.replace("_on.gif", "_off.gif");
				} // end of onclick
		} // end of onclick
	}
}
addLoadEvent(img_rollover)


function portfolio_tab_rollover(){
	if(!document.getElementById("portfolio_tab")) return false;
	var source = document.getElementById("portfolio_tab").getElementsByTagName("img");
	for(i=0; i<source.length; i++){
		source[i].count = i+1;
		source[i].onmouseover = function(){
			var ant = this.src.split("/");
			var num = ant.length-1
			var tre = ant[num].slice(-7)    // µÚ¿¡¼­ 7±ÛÀÚ ÃßÃâ
			if (tre == "_on.gif")return false;	//  on ÀÌ¹ÌÁö ´Â return
			this.src = this.src.replace("_off.gif", "_on.gif");
				this.onmouseout = function(){
				this.src = this.src.replace("_on.gif", "_off.gif");
				} // end of onclick
		} // end of onclick
	}
}
addLoadEvent(portfolio_tab_rollover)



function chan(source){
	document.getElementById("visi_url").value = source.getAttribute("value");
}



/*   main  tab      */
function only_tab(){
	if(!document.getElementById("main_notice")) return false;
	var source = document.getElementById("main_notice").getElementsByTagName("img");
	for(i=0; i<source.length; i++){
		source[i].count = i+1;
		source[i].onmouseover = function(){

				for(j=0; j<source.length; j++){
					source[j].src = source[j].src.replace("_on", "_off");
					document.getElementById("tab_text_" + [j+1]).style.display = "none"  ;
				}
				this.src = this.src.replace("_off", "_on");
				document.getElementById("tab_text_" + [this.count]).style.display = ""  ;


			return false;
		} // end of onclick
	}
}
addLoadEvent(only_tab)


/*   FAQ     */
var onoff=0;
var re_num=5;
function faq_list(num){
	 var target = document.getElementById("opinion_bg").getElementsByTagName('ul');

	var Maxnum = target.length;

	if(re_num==num && onoff==0){

		target[num-1].getElementsByTagName('li')[1].style.display = 'none';
		onoff=1;

	}else{
		for(i=0; i<Maxnum; i++){
		target[i].getElementsByTagName('li')[1].style.display = 'none';
		}
		target[num-1].getElementsByTagName('li')[1].style.display = '';
		onoff=0;
		re_num=num;
	}
}


/* openBrWindow */
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
