function openWindow(url,width,height) {
	win = window.open(url,"win_"+(new Date()).getTime(), "status=no, scrollbars=yes, resizable=yes, width=" + width + ", height=" + height);
	win.focus();
}
function openWindowFix(url,width,height) {
	win = window.open(url,"win_"+(new Date()).getTime(), "status=no, scrollbars=no, resizable=yes, width=" + width + ", height=" + height);
	win.focus();
}
function openWindowMax(url) {
	win = window.open(url,"maxWindow", "status=no, scrollbars=yes, resizable=yes, width=" + (screen.width-10) + ", height=" + (screen.height-60));
	win.focus();
}
function openWindowCenter(url,width,height) {
	win = window.open(url,"win_"+(new Date()).getTime(), "status=no, scrollbars=yes, resizable=yes, width=" + width + ", height=" + height);
	win.moveTo((screen.width-width)/2,(screen.height-height)/2);
	win.focus();
}
function openWindowLeft(url,width,height,left,top) {
        win = window.open(url,"win_"+(new Date()).getTime(), "status=no, scrollbars=no, resizable=yes, width=" + width + ", height=" + height + ", left="+left+", top="+top);
        win.focus();
}
function resizeWindow(url,width,height) {
	self.location.href=url;
	window.resizeTo(width,height);
}
function refixWindow() {
	window.resizeTo(document.body.scrollWidth+9,document.body.scrollHeight+58);
}
function refixIframe(iframeNm) {
	parent.document.getElementById(iframeNm).height = document.body.scrollHeight;	
	//iframe.resizeTo(document.body.scrollWidth,document.body.scrollHeight);
}
function fullScreen(url) {
	openWindowMax(url);
}
function redirectUrl(url) {
	self.location = url;
}
function getFileSize(fn) {
	if (navagator.appName.indexOf('Microsoft') != -1) {
		var fs = new ActiveXObject('Scripting.FileSystemObject');
		var f = fs.GetFile(fn);
		return f.length();
	} else {	// netsacpe
		var f = new java.io.File(fn);
		netscape.security.PrivilegeManager.enablePrivilege('UniversalFileRead');
		return f.length();
	}
}
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-1; 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 call_flash(url, width,height) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'" id=ShockwaveFlash1>')
	document.write('<param name="movie" value="'+url+'" />')
	document.write('<param name="quality" value="high" />')
	document.write('<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>')
	document.write('</object>')
}

function call_flash_tp(url, width,height) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'" id=ShockwaveFlash1>')
	document.write('<param name="movie" value="'+url+'" />')
	document.write('<param name="quality" value="high" />')
	document.write('<param name="wmode" value="transparent" />')
	document.write('<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>')
	document.write('</object>')
}

function enterCheck() {
	if(event.keyCode == 13){
		login();
	}
}

function login() {
	var host = self.location.host;
	var formid = document.form.id;

	if (host == "academy.dongjak.go.kr") {
		formid = document.form.mid;
	} else if (host == "edu.evermbc.com") {
		formid.value = formid.value.toLowerCase();
		document.form.pwd.value = document.form.pwd.value.toLowerCase();
	}
	if (formid.value.length <= 0) {
		formid.focus();
		return;
	}
	document.form.submit();
}
function testSpeed() {
	window.open('http://academy.evermbc.com/mediashell/Testline.html','streaming', 'width=700, height=450, left=0, top=0, menubar=no, directories=no,resizable=no,status=no,scrollbars=no') ;
}

function setCookie( name, value, expiredays ) {
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function getCookie(name) {
	if (document.cookie.length>0) {
		c_start=document.cookie.indexOf(name + "=")
		if (c_start!=-1) { 
			c_start=c_start + name.length+1 
			c_end=document.cookie.indexOf(";",c_start)
			if (c_end==-1) c_end=document.cookie.length
			return unescape(document.cookie.substring(c_start,c_end))
		} 
	}
	return ""
}

function openPopup(formField, url, w, h) {
	var isPop = getCookie(formField)
	if (isPop == "") {
		openWindowFix(url,w,h);
	}
}

function openPopup2(formField, url, w, h, l, t) {
	var isPop = getCookie(formField)
	if (isPop == "") {
		openWindowLeft(url,w,h,l,t);
	}
}

function popCookie(formField) {
	if (formField.checked) {
		setCookie(formField.value,'T',1);
  		self.close();
	} else {
		self.close();	
	}
}

function setMarquee(content,w,h) {
	document.write("<marquee width='"+w+"' height='"+h+"' loop='infinite' direction='up' scrollamount='1' scrolldelay='50'>");
	document.write(content);
	document.write("</marquee>");
}

function mouseX(evt) {
	if (evt.pageX) return evt.pageX;
	else if (evt.clientX)
		return evt.clientX + (document.documentElement.scrollLeft ?
		document.documentElement.scrollLeft :
   		document.body.scrollLeft);
	else return null;
}
function mouseY(evt) {
	if (evt.pageY) return evt.pageY;
	else if (evt.clientY)
		return evt.clientY + (document.documentElement.scrollTop ?
		document.documentElement.scrollTop :
		document.body.scrollTop);
	else return null;
}
function nullCheck(formField) {
	if (formField.value.length < 1) {
		alert('ÇÊ¼ö ÀÔ·ÂÇÊµåÀÔ´Ï´Ù.');
		formField.focus();
		return true;
	} else {
		return false;
	}
}
