
function resizeIfr(obj, minHeight) {
	minHeight = minHeight || 10;
	try {
		var getHeightByElement = function(body) {
			var last = body.lastChild;
			try {
				while (last && last.nodeType != 1 || !last.offsetTop) last = last.previousSibling;
				return last.offsetTop+last.offsetHeight;
			} catch(e) {
				return 0;
			}
			
		}
				
		var doc = obj.contentDocument || obj.contentWindow.document;
		if (doc.location.href == 'about:blank') {
			obj.style.height = minHeight+'px';
			return;
		}
		
		//var h = Math.max(doc.body.scrollHeight,getHeightByElement(doc.body));
		//var h = doc.body.scrollHeight;
		if (/MSIE/.test(navigator.userAgent)) {
			var h = doc.body.scrollHeight;
		} else {
			var s = doc.body.appendChild(document.createElement('DIV'))
			s.style.clear = 'both';
 
			var h = s.offsetTop;
			s.parentNode.removeChild(s);
		}
		
		//if (/MSIE/.test(navigator.userAgent)) h += doc.body.offsetHeight - doc.body.clientHeight;
		if (h < minHeight) h = minHeight;
	
		obj.style.height = h + 'px';
		if (typeof resizeIfr.check == 'undefined') resizeIfr.check = 0;
		if (typeof obj._check == 'undefined') obj._check = 0;
 
//		if (obj._check < 5) {
//			obj._check++;
			setTimeout(function(){ resizeIfr(obj,minHeight) }, 200); // check 5 times for IE bug
//		} else {
			//obj._check = 0;
//		}	
	} catch (e) { 
		//alert(e);
	}
}
//링크블러가리기
function bluring(){
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;

//상단메뉴
function tm_menu(menu){ 
	fields = ['mame', 'cps', 'neogeo', 'zinc', 'sf', 'md', 'mr', 'msx',  'neo', 'sp', 'xx']; 
	for(i = 0; i < fields.length; i++){ 
		if(fields[i] == menu) eval(fields[i] + ".style.display='inline'"); 
		else eval(fields[i] + ".style.display='none'"); 
	}
}

function tm_menu_off(){ 
	fields = ['mame', 'cps', 'neogeo', 'zinc', 'sf', 'md', 'mr', 'msx', 'nin', 'neo', 'sp', 'xx']; 
	for(i = 0; i < fields.length; i++){ 
		eval(fields[i] + ".style.display='none'"); 
	}
}


//상황텍스트
function hidestatus(){ 
	window.status='에뮬맥스 - 즐거운게임세상';
	return true;
} 

//검색어
function inkey(){
	if(!document.maxs.keyword.value){
		alert('검색어를 입력해주세요.');
		document.maxs.keyword.focus();
		return false;
	}
}

//검색어 커서
function search_focus(){
	document.maxs.keyword.focus();
}

//로그인 정보
function login_check() {
	var chec=document.login;
	if ( chec.mx_id.value.length < 4 ) {
		alert('아이디를 입력해 주세요.');
		chec.mx_id.focus();
		return false;
	}
	if ( chec.mx_pass.value.length < 4 ) {
		alert('비밀번호를 입력해 주세요.');
		chec.mx_pass.focus();
		return false;
	}

	if ( chec.ssl_check.checked ) { //보안접속 체크 판별
		//보안접속을 체크했을 때의 액션
		chec.action = "https://www.emulmax.com/web/inc/login_check.php";
	} else {
		//보안접속을 체크하지 않았을 때의 액션
		chec.action = "http://www.emulmax.com/web/inc/login_check.php";
	}

	return true;
}
//로그인 정보
function login_check2() {
	var chec=document.login2;
	if ( chec.mx_id.value.length < 4 ) {
		alert('아이디를 입력해 주세요.');
		chec.mx_id.focus();
		return false;
	}
	if ( chec.mx_pass.value.length < 4 ) {
		alert('비밀번호를 입력해 주세요.');
		chec.mx_pass.focus();
		return false;
	}

	if ( chec.ssl_check.checked ) { //보안접속 체크 판별
		//보안접속을 체크했을 때의 액션
		chec.action = "https://www.emulmax.com/web/inc/login_check.php";
	} else {
		//보안접속을 체크하지 않았을 때의 액션
		chec.action = "http://www.emulmax.com/web/inc/login_check.php";
	}

	return true;
}


//아이디저장
function mb_check(ths){
	if (ths.checked == true){
		if (!confirm('아이디저장시 주의하세요!\n\n\n학교, 학원, PC방 등과 같은 컴퓨터를 공동으로 사용하는 환경에서는\n타인에게 정보가 공개될 수 있으므로\n아이디저장을 설정하지 않는 것이 좋습니다.\n\n정말로 아이디를 기억시키겠습니까?\n')) ths.checked = false;
	}
}

//이버튼
<!--
function na_restore_img_src(name, nsdoc){
	var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
	if (name == '') return;
	if (img && img.altsrc) {
		img.src    = img.altsrc;
		img.altsrc = null;
	} 
}

function na_preload_img(){ 
	var img_list = na_preload_img.arguments;
	if (document.preloadlist == null) document.preloadlist = new Array();
	var top = document.preloadlist.length;
	for (var i=0; i < img_list.length; i++) {
		document.preloadlist[top+i] = new Image;
		document.preloadlist[top+i].src = img_list[i+1];
	} 
}

function na_change_img_src(name, nsdoc, rpath, preload){ 
	var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
	if (name == '') return;
	if (img) {
		img.altsrc = img.src;
		img.src = rpath;
	} 
}
// -->


//펼침이동
<!--
function namosw_goto_byselect(sel, targetstr){
	var index = sel.selectedIndex;
	if (sel.options[index].value != '') {
		if (targetstr == 'blank') {
			window.open(sel.options[index].value, 'win1');
		}
		else {
			var frameobj;
			if (targetstr == '') targetstr = 'self';
			if ((frameobj = eval(targetstr)) != null)
			frameobj.location = sel.options[index].value;
		}
	}
}
// -->


//플래시
function flash(width,height,url) {
	var flash_tag = "";
	flash_tag = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	flash_tag +='codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ';
	flash_tag +='WIDTH="'+width+'" HEIGHT="'+height+'" >';
	flash_tag +='<param name="movie" value="'+url+'">';
	flash_tag +='<param name="quality" value="high">';
	flash_tag +='<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" ';
	flash_tag +='type="application/x-shockwave-flash"  WIDTH="'+width+'" HEIGHT="'+height+'"></embed></object>';
	document.write(flash_tag);
}
