/**
 * @(#)kaywon.js  1.0, 2005-03-21
 * @author        zzang
 * @description   Web ÆäÀÌÁö¿¡ °øÅëÀ¸·Î »ç¿ëÇÒ JavaScript
 */

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 popupPageAll(lcoation, target, state) {
  var popupWin = window.open("about:blank",target,state);
  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_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_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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.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 searchForm(){
		var frm = document.frmList;
		frm.submit();
	}
	
	function fncPopupShowImages(modelNm){
		var winPdt;
		
		winPdt = window.open("/common/popup/product_image.asp?model_nm=" + modelNm, "winProductImages", "menubar=no,resizable=no,scrollbars=no,sptatus=no,titlebar=no,toolbar=no, width=770, height=550,top=0,left=0", "")	//width=770,height=550
		winPdt.focus();
	}
	
	function fncPopupVR(modelNm){
		var winPdt;
		
		winPdt = window.open("/product/vr/vr_" + modelNm + ".asp", "winProductImages", "menubar=no,resizable=no,scrollbars=no,sptatus=no,titlebar=no,toolbar=no, width=770, height=550,top=0,left=0", "")	//width=770,height=550
		winPdt.focus();
	}
	
	//½ºÅ©·¦
	function fncMyZipel(CAT_NO, model_nm, Title) {
		window.open("/common/popup/bookmark_do.asp?CatNo="+CAT_NO+"&BookMarkUrl=/product/style/interior_view.asp?model_nm="+model_nm+"&Title="+Title,"MyZipelPopup","width=520,height=342,0");
	}

	//ÇÁ¸°Æ®
	function fncPrint() {
		window.open("/common/popup/page_print.asp","PrintPopup","width=700,height=800,0")
	}
	
	function searchModel(){
		document.location.href=('modern_view.asp?model_nm='+document.frmList.smodel_nm.value);
	}

	//ÀÎÅ×ÀÌ·¯½ºÅ¸ÀÏ ³¡


	//¸ð´ø½ºÅ¸ÀÏ ½ÃÀÛ - fncMd.......·Î ½ÃÀÛÇÏµµ·Ï ÇÔ¼ö¸íÀ» ¸¸µç´Ù.

	function fncMdSearchForm(){
		var frm = document.frmList;
		frm.submit();
	}
	
	function fncMdPopupShowImages(modelNm){
		var winPdt;
		
		winPdt = window.open("/common/popup/product_image.asp?model_nm=" + modelNm, "winProductImages", "menubar=no,resizable=no,scrollbars=no,sptatus=no,titlebar=no,toolbar=no, width=770, height=550,top=0,left=0", "")	//width=770,height=550
		winPdt.focus();
	}
	
	function fncMdPopupVR(modelNm){
		var winPdt;
		
		winPdt = window.open("/product/vr/vr_" + modelNm + ".asp", "winProductImages", "menubar=no,resizable=no,scrollbars=no,sptatus=no,titlebar=no,toolbar=no, width=770, height=550,top=0,left=0", "")	//width=770,height=550
		winPdt.focus();
	}
	
	//½ºÅ©·¦
	function fncMdMyZipel(CAT_NO, model_nm, Title) {
		window.open("/common/popup/bookmark_do.asp?CatNo="+CAT_NO+"&BookMarkUrl=/product/style/modern_view.asp?model_nm="+model_nm+"&Title="+Title,"MyZipelPopup","width=520,height=342,0");
	}

	//ÇÁ¸°Æ®
	function fncMdPrint() {
		window.open("/common/popup/page_print.asp","PrintPopup","width=700,height=800,0")
	}
	
	function fncMdSearchModel(){
		document.location.href=('modern_view.asp?model_nm='+document.frmList.smodel_nm.value);
	}

	//¸ð´ø½ºÅ¸ÀÏ ³¡
/****************************************************************/