// S : window.onload Function
function onLoadAdd(f,types) {
	var evtFnc = window[types];
	if(typeof evtFnc != 'function'){
		window[types] = function(){eval(f);}
	}else{
		var setFnc = function(){eval(f);}
		window[types] = function(){
			if(evtFnc){
				evtFnc();	
			}
			try{
				setFnc();
			}catch(err){
				//	
			}
		}
	}
}
// E : window.onload Function


// S : head, title -> Msg
function TagTitle(){
	var titleMsg = "¢Æ C'real English ¢Æ";
	document.title =titleMsg;
}
// E : head, title -> Msg

// S : quick menu function
function initMoving(target, position, topLimit, btmLimit) { //[target : Element -> ID ],[position : start Top],[topLimit : start Top safe],[btmLimit : target heightArg]
    if (! document.getElementById(target)){ 
		return false;
	}

	var obj = document.getElementById(target);
    obj.initTop = position;
    obj.topLimit = topLimit;
    obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;
	//btmLimit -> 150;
	//alert(document.documentElement.scrollHeight - btmLimit);
	//alert(document.documentElement.clientHeight);
    obj.style.position = "absolute";
    obj.top = obj.initTop;
    obj.left = obj.initLeft;

	
    if (typeof(window.pageYOffset) == "number") {
        obj.getTop = function() {
            return window.pageYOffset;
        }
    }else if (typeof(document.documentElement.scrollTop) == "number"){
        obj.getTop = function() {
            return document.documentElement.scrollTop;
        }
    }else{
        obj.getTop = function() {
            return 0;
        }
    }

    if (self.innerHeight){
        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)
}
// E : quick menu function


// S : flash file obj
function flashWrite(url,w,h,id,bg,vars,win){// flashWrite(ÆÄÀÏ°æ·Î, °¡·Î, ¼¼·Î, ¾ÆÀÌµð, ¹è°æ»ö, º¯¼ö, À©µµ¿ì¸ðµå)

	// ÇÃ·¡½Ã ÄÚµå Á¤ÀÇ
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value=' "+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src=' "+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	// ÇÃ·¡½Ã ÄÚµå Ãâ·Â
	//alert(flashStr);
	document.write(flashStr);

}
// E : flash file obj


// S : ·Î±×ÀÎ ±âº»°ª ÃÊ±âÈ­ ½ÃÅ°±â
function frmValue(obj,type,ufocus){
	if(type == "1"){ // ¾ÆÀÌµð
		if(ufocus == "in"){
			obj.className = "txt subback";
		}else{
			if(obj.value.length == 0){
				obj.className = "txt uid";
			}
		}
	}else{ // ºñ¹Ð¹øÈ£

		if(ufocus == "in"){
			obj.className = "txt subback";
		}else{
			if(obj.value.length == 0){
				obj.className = "txt upw";
			}
		}
	}

	//alert(obj.className);
}
// E : ·Î±×ÀÎ ±âº»°ª ÃÊ±âÈ­ ½ÃÅ°±â




//S : ¾ÆÀÌµð Æä½º¿öµå Ã£±â ÆË¾÷
function search_pop(){
	window.open('/member/search.asp','searchPop','width=500,height=300,top=20,left=100,menubar=no,toolbar=no,location=no,scrollbars=no,resizable=no');
}
//E : ¾ÆÀÌµð Æä½º¿öµå Ã£±â ÆË¾÷


function chatopen(){
	window.open('http://www.u-enai.com/Customer/index.asp?Natinal=ko','realPop','width=620, height=400,top=20,left=100,menubar=no,toolbar=no,location=no,scrollbars=no,resizable=no');
}

//function remoteopen(){
//	window.open('http://pro.i-doctor.co.kr/~avalon/agent/','remotePop','width=620, height=400,top=20,left=100,menubar=no,toolbar=no,location=no,scrollbars=no,resizable=no');
//}
function remoteopen(){
	window.open('http://ezh.kr/avalon/','_blank');
}

function footer_pop(url, name){
	window.open(url,name,'width=700,height=450,top=100,left=100,menubar=no,toolbar=no,location=no,scrollbars=no,resizable=no');
}
