﻿/*==============================================================================================

	제    목 : 특화기능 공통 자바스크립트 소스
	생 성 자 : 정태화
	생 성 일 : 2008-03-09

	--------------------------------------------------------------------------------------------
	번호    수정일      수정자	수정내용
	--------------------------------------------------------------------------------------------
	
================================================================================================*/

// 플래쉬 파일 INCLUDE
var tmpActiveObjSrc;
function addActiveObject(objName, objSrc) 
{
    var tmpObj;
    tmpObj = eval("document.all." + objName);
    tmpObj.innerHTML = "" + objSrc + "";
}

/************************************************************
 *  함수명   : IsEmptyCheckBox
 *  함수내용 : 드롭다운선택여부
 * parameter : ddlClientId
 ************************************************************/
function IsSelectedDropDown(ddlClientId)                         
{   
	var frm = document.forms[0];
	for(i=0; i< frm.length; i++)                         
	{   
		e = frm.elements[i];   
		if(e.type == 'select' && e.id.indexOf(ddlClientId) != -1)
		    if(e.selectedIndex == -1)
			    return false;                   
	}
	return true;
}
function IsCheckedCheckBox(msg)
{
    if(IsEmptyCheckBox("chk_sel"))
        return true;
    else
    {   
        alert(msg);
        return false;
    }
}

/********************************************
* 함수명    : _OpenWinCenter
* 기능      : 화면중간에 작은창 띄우기  
* parameter : url, wname, wopt     
* 옵션 : option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=600";      
********************************************/
function _OpenWinCenter(url, wname, wopt) 
{
    var newopt = "", wHeight = 0, wWidth = 0;
    if (wopt != undefined) 
    {
        var woptlist = wopt.replace(/ /g, "").split(",");
        for (var i in woptlist) 
        {
            if (woptlist[i].match(/^height=/i)) 
            {
                wHeight = parseInt(woptlist[i].substr(7),10);
                if (!isNaN(wHeight)) newopt += "top=" + Math.floor((screen.availHeight - wHeight) / 2) + ",";
            }
            
            if (woptlist[i].match(/^width=/i)) 
            {
                wWidth = parseInt(woptlist[i].substr(6),10);
                if (!isNaN(wWidth)) newopt += "left=" + Math.floor((screen.availWidth - wWidth) / 2) + ",";
            }
        }
    }
    
    return window.open(url, wname, newopt + wopt).focus();
}

/************************************************************
 *  함수명   : _CheckAll
 *  함수내용 : 체크박스체크
 * parameter : checkAllBox, chkName
 ************************************************************/
function CheckAll(checkAllBox, chkName)                         
{   
	var frm = document.forms[0];                        
	var chkState = checkAllBox.checked;
	for(i=0; i< frm.length; i++)                         
	{   
		e = frm.elements[i];   
		if(e.type=='checkbox' && e.name.indexOf(chkName) != -1)
			e.checked= chkState;                       
	}
}  

//SMS Hp 창열기
function WinSMSHp(urlSMSHp, findField1, findField2, findField3, findField4, findField5, findText, referKind)
{ 
    //alert(referKind);
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=510,height=370";
    _OpenWinCenter(urlSMSHp + "&find_field1="+findField1+"&find_field2="+findField2+"&find_field3="+findField3+"&find_field4="+findField4+"&find_field5="+findField5+"&find_text="+findText+"&refer_kind="+referKind, "WinSMSHp", option); 
}

//선택회원sms 발송하기
function WinSMSUserHp(urlSMSHp, sndUser, referKind)
{   
    var option="toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=660,height=350";
    _OpenWinCenter(urlSMSHp + "&rcv_user="+sndUser+"&refer_kind="+referKind, "WinSMSUserHp", option); 
}


