
var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isNS = navigator.appName == "Netscape";

function changeInterview(filename) {
	document.location.href = filename;
}

function ShowFlash(obj,strMediaURL,obj_width,obj_height)
{
	var myObjectElement = document.createElement('<embed src="' + strMediaURL + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + obj_width + '" height="' + obj_height + '"></embed>');
	obj.appendChild(myObjectElement);
}

function fnc_newsview(pkid){
	NewWindow=window.open('/news/news_view.jsp?txt_pkid='+pkid, 'win_login', 'resizable=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,top=0,left=0,width=520,height=400');
}

function fnc_login(){
	NewWindow=window.open('/Members/login.jsp', 'win_login', 'resizable=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,top=0,left=0,width=330,height=328');
}
function fnc_contactus(){
	NewWindow=window.open('/Utility/contactus.jsp', 'win_contactus', 'resizable=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,top=0,left=0,width=500,height=530');
}

function fnc_iosystem(){
	NewWindow=window.open('/iosystem/index.jsp', 'win_iosystem', 'resizable=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,top=0,left=0,width=900,height=610');
}

function fnc_imagePopup(intMenuNo, productNo){
	NewWindow=window.open('/product/product_imageviewer.jsp?intMenuNo='+intMenuNo+'&productno='+productNo, 'win_product', 'resizable=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,top=0,left=0,width=800,height=540');
}

function fnc_printPopup(){
	NewWindow=window.open('/product/product_print.jsp', 'win_productprint', 'resizable=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,top=0,left=0,width=680,height=750');
}

function fnc_printBoardPopup(title){
	NewWindow=window.open('/include/popup/board_print.jsp?title='+title, 'win_boardprint', 'resizable=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,top=0,left=0,width=800,height=780');
}

function PopUpWindowOpen(surl, popupwidth, popupheight)
{
	Top = (window.screen.availHeight - popupheight) / 2;
	Left = (window.screen.availWidth - popupwidth) / 2;
	if (Top < 0) Top = 0;
	if (Left < 0) Left = 0;
	Future = "fullscreen=no,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,left=" + Left + ",top=" + Top + ",width=" + popupwidth + ",height=" + popupheight;
	PopUpWindow = window.open(surl, "PopUpWindow", Future);
	PopUpWindow.focus();
}


function nycmImageViewer(vFileName, vFileCount)
{
	var fileLink = "/images/runningmate/nycm/gallery/" + vFileName + "_" + vFileCount + ".jpg";
	PopUpWindowOpen("/runningmate/nycmImageViewer.jsp?fileName=" + fileLink, 650, 677);
}

function PopUpWindowOpenScroll(surl, popupwidth, popupheight)
{
	Top = (window.screen.availHeight - popupheight) / 2;
	Left = (window.screen.availWidth - popupwidth) / 2;
	if (Top < 0) Top = 0;
	if (Left < 0) Left = 0;
	Future = "fullscreen=no,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,left=" + Left + ",top=" + Top + ",width=" + popupwidth + ",height=" + popupheight;
	PopUpWindow = window.open(surl, "PopUpWindow", Future);
	PopUpWindow.focus();
}

// ?????? ?????????????? ???????? ????
function PopUpWindowOpenScrollForSystem(surl)
{
	var popupwidth = 900;
	var popupheight = 600;
	
	Top = (window.screen.availHeight - popupheight) / 2;
	Left = (window.screen.availWidth - popupwidth) / 2;
	if (Top < 0) Top = 0;
	if (Left < 0) Left = 0;
	Future = "fullscreen=no,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,left=" + Left + ",top=" + Top + ",width=" + popupwidth + ",height=" + popupheight;
	PopUpWindow = window.open(surl, "PopUpWindow", Future);
	PopUpWindow.focus();
}


function PopUpWindowOpenScroll2(surl, popupwidth, popupheight, winname)
{
	Top = (window.screen.availHeight - popupheight) / 2;
	Left = (window.screen.availWidth - popupwidth) / 2;
	if (Top < 0) Top = 0;
	if (Left < 0) Left = 0;
	Future = "fullscreen=no,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,left=" + Left + ",top=" + Top + ",width=" + popupwidth + ",height=" + popupheight;
	PopUpWindow = window.open(surl, winname, Future);
	PopUpWindow.focus();
}

function submitForm(sAction, sMode)
{
	frm = document.mainFrm;
	document.mainFrm.txt_use.value = sMode;

	frm.action = sAction;
	frm.method = "post"
	
	//alert(aAction);
	//alert(sMode);

	frm.submit();
}

function submitForm2(sAction)
{
	frm = document.mainFrm;

	frm.action = sAction;

	frm.submit();
}


function popupPage(lcoation) {
  var popupWin = window.open("about:blank","","menubar=0,resizable=yes,scrollbars=yes,status=0");
  popupWin.location = lcoation;
  popupWin.focus();
}

function popupPage(lcoation, target) {
  var popupWin = window.open("about:blank",target,"menubar=0,resizable=yes,scrollbars=yes,status=0");
  popupWin.location = lcoation;
  popupWin.focus();
}

function popupPage(lcoation, target, width, height) {
  var popupWin = window.open("about:blank",target,"menubar=0,resizable=yes,scrollbars=yes,status=0,width="+width+",height="+height);
  popupWin.location = lcoation;
  popupWin.focus();
}

function logout() {
  document.moveFrm.action = "/intranet/auth/logout.jsp";
  document.moveFrm.target.value = "/intranet/index.jsp";
  document.moveFrm.submit();
}

function alertMessage(message) {
  alert(message);
}

function isNumber(value) {
  var pattern = /^[\d]+$/i;
  return pattern.test(value);
}


// checkbox ????????/????
function setCheck(theform, chk) {
    for( var i=0; i<theform.elements.length; i++) {
        var ele = theform.elements[i];
        if(ele.name == 'chk_del')
            ele.checked = chk.checked;
    }
    return;
}

// checkbox ????????/????
function revCheck(theform) {
    for( var i=0; i<theform.elements.length; i++) {
        var ele = theform.elements[i];
        if(ele.name == 'chk_del')
            ele.checked = !ele.checked;
    }
    return;
}

// checkbox ????????
function allCheck(theform) {
    for( var i=0; i<theform.elements.length; i++) {
        var ele = theform.elements[i];
        if(ele.name == 'chk_del')
            ele.checked = true;
    }
    return;
}

// checkbox ????????
function disCheck(theform) {
    for( var i=0; i<theform.elements.length; i++) {
        var ele = theform.elements[i];
        if(ele.name == 'chk_del')
            ele.checked = false;
    }
    return;
}

function evalDelete(theform) {
    var chk = theform;
    var sCount = 0;
    var bNotFound = true;

    for (var i = 0; i < chk.length;i++) {
        if (chk[i].type == "checkbox" && chk[i].name == 'chk_del')
        {
            bNotFound = false;

            if (chk[i].checked == true)
                sCount++;
        }
    }

    if (bNotFound)
    {
       alert("?????? ?????? ???????? ??????????");
       return false;
    }

    if (sCount == 0) {
       alert("?????? ?????? ???????? ??????????");
       return false;
    } else {
       if(confirm("?????????????????")) {
           return true;
       }
   }

   return false;
}
    

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function open_win(strurl) {
if (strurl != "") {
	var owin = window.open(strurl,"newwindow","");
	owin.focus();
	}
}


function setInitVal(txt)
{
    txt.value = '';
}




function MM_openBrWindow(theURL,  pkid,winName,features) {

    var openwin = window.open("about:blank",winName,features);
    document.popupFrm.txt_pkid.value = pkid;
    document.popupFrm.target = winName;
    document.popupFrm.action = theURL;
    document.popupFrm.submit();
    openwin.focus();
}


function user_login(txtUrl) {
    var openwin = window.open(txtUrl,'login','width=392,height=328, scrollbars=no, status=yes');
    openwin.focus();
}


//?????? ???????? ???????? ???????????? ?????????? ???? ????????.
function fncImgLimit(pWidth) {
	if(frmForm.userImg.width > pWidth){
		frmForm.userImg.width = pWidth;
	}
}

function top_align(){
	x = document.body.scrollLeft;
	y = document.body.scrollTop;
	step = 2;

	while((x!=0) || (y!=0)){
		scroll(x, y);
		step += (step * step / 100);
		x -= step;
		y -= step;
		if(x<0) x = 0;
		if(y<0) y = 0;
	}
	scroll(0, 0);
}
