
window.name='main';

//°¡¿îµ¥ popup
function CPopup_Window(purl,pname,pwidth,pheight,ptoolbar,plocation,pstatus,pmenubar,pscrollbars,presizable) {
	var window_left = (screen.width - pwidth) / 2;
	var window_top = (screen.height - pheight) / 2;
	winprops = 'top='+window_top+',left='+window_left+',height='+pheight+',width='+pwidth+',toolbar='+ptoolbar+',location='+plocation+',status='+pstatus+',menubar='+pmenubar+',scrollbars='+pscrollbars+',resizable='+presizable;
	win = window.open(purl, pname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
//0,0ÁÂÇ¥¿¡ popup
function LPopup_Window(purl,pname,pwidth,pheight,ptoolbar,plocation,pstatus,pmenubar,pscrollbars,presizable) {
	var window_left = 0;
	var window_top = 0;
	pwidth = pwidth - 10;
	pheight = pheight - 25;
	
	winprops = 'top='+window_top+',left='+window_left+',height='+pheight+',width='+pwidth+',toolbar='+ptoolbar+',location='+plocation+',status='+pstatus+',menubar='+pmenubar+',scrollbars='+pscrollbars+',resizable='+presizable;
	win = window.open(purl, pname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

// ¸ð´ÞÃ¢
function Modal_Window(purl,pname,ptop,pleft,pwidth,pheight,phelp,presizable,pstatus,pscroll,pcenter) { 
	if(pcenter=="yes"){
		var pleft = (screen.width - pwidth) / 2;
		var ptop = (screen.height - pheight) / 2;
	}
winprops = 'dialogTop:'+ptop+'px; dialogLeft:'+pleft+'px; dialogWidth:'+pwidth+'px;dialogHeight:'+pheight+'px; help:'+phelp+'; resizable:'+presizable+'; status:'+pstatus+'; scroll:'+pscroll+'; center:'+pcenter+';';
showModalDialog(purl, pname, winprops); 
} 

//auto tab ex) onkeyup="autoTab(this,6,event);"
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
if(isNN)document.captureEvents(Event.KEYPRESS);

function autoTab(input,len, e){
   var keyCode = (isNN)?e.which:e.keyCode;  
   var filter = (isNN)?[0,8,9]:[0,8,9,16,17,18,37,38,39,40,46];
   if(input.value.length >= len && !containsElement(filter,keyCode)){
    input.value = input.value.slice(0,len);
    input.form[(getIndex(input)+1)%input.form.length].select();
}

function containsElement(arr, ele){
    var found = false, index = 0;
    while(!found && index < arr.length)
      if(arr[index]==ele)
        found = true;
      else
        index++;
    return found;
}

function getIndex(input){
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index==-1)
		if (input.form[i] == input)index = i;
	    else i++;
		return index;
	}
	return true;
}

