function selectOn(boxID){
	var selectBox = document.getElementById(boxID);

	if(selectBox.style.display!="block"){
	selectBox.style.display="block";
	}else{
		selectBox.style.display="none";
	}
}

function LayerPopupClose(IdName) {
	var objName = document.getElementById(IdName);
	objName.style.display = "none";
	lightBoxclose();
	try{
		if(removeSelectFix) 
			{
				removeSelectFix(IdName);
			}
		}
	catch(a){}	
}

function LayerPopupMousePoint(obj) {
	var objName = document.getElementById(obj);
	if ( objName.style.display == "block" ) {
	} else {
		lightBox();

		objName.style.display = "block";
	}
	try{
		if(selectFix) 
			{
				selectFix(obj);
			}
		}
	catch(a) {}	
}



<!--[if lte IE 6.0]>
function selectFix(divID) {
	var tar = document.getElementById(divID);
	var tarWidth = tar.offsetWidth;
	var tarHeight = tar.offsetHeight;
	var tarTop = tar.offsetTop;
	var tarLeft = tar.offsetLeft;
	var coverID = divID + "_cover";
	if (document.getElementById(coverID)) return false;
		var cover = document.createElement("iframe");
			tar.parentNode.insertBefore(cover,tar);
			cover.setAttribute("id",coverID);
		
		if (!document.getElementById(coverID)) return false;
		
		var obj = document.getElementById(coverID);
			obj.setAttribute("frameborder",0);
			obj.style.position = "absolute";
			obj.style.top = tarTop + "px";
			obj.style.left = tarLeft + "px";
			obj.style.width = tarWidth-10 + "px";
			obj.style.height = tarHeight-10 + "px";
}

function removeSelectFix(divID) {
	var tar = document.getElementById(divID);
	var obj = document.getElementById(divID + "_cover");

	if (!obj) return false;
		tar.parentNode.removeChild(obj);  
}
<!--[endif]-->




//레이어 팝엽
function openLayer(IdName){
	//alert(IdName);
	var pop = document.getElementById(IdName);
	if ( pop.style.display == "block" ) {
	} else {
		

		pop.style.display = "block";
	}
	try{
		if(selectFix) 
			{
				selectFix(IdName);
			}
		}
	catch(a) {}	
}


//레이어 팝엽 닫기
function closeLayer(IdName){
	var pop = document.getElementById(IdName);
	pop.style.display = "none";
	try{
		if(removeSelectFix) 
			{
				removeSelectFix(IdName);
			}
		}
	catch(a){}	
}

function ctdnm(){
	/* 컨텐츠 다운로드 아이템 컨트롤 */
	var downConCount = 0;//추가가 증가값
	var downRCCount = 0;//등록된 다운로드 컨텐츠 개수
	var downContentList = new Array();

	this.addItem=function(itemValue)
	{		
		/* 컨텐츠 아이템 추가 */
		for(iTemp=0;iTemp<=downConCount;iTemp++)
		{		
			if(downContentList[iTemp] == "" || downContentList[iTemp] == undefined)
			{
				downContentList[iTemp] = itemValue;
				downRCCount++;
				iTemp = downConCount + 1;
			}			
		}
		downConCount++;
	};	
	this.delItem=function(itemValue)
	{
		/* 컨텐츠 아이템 제거 */
		for(iTemp=0;iTemp<=downConCount;iTemp++)
		{		
			if(downContentList[iTemp] == itemValue)
			{
				downContentList[iTemp] = "";
				downRCCount--;
				return false;
			}
		}
	};
	this.createValue=function()
	{
		/* 다운로드 컨텐츠 리스트 구성 */
		return downContentList.join(",");
	};
	this.callDownLoad=function(selected)
	{
		if(selected == undefined)
		{
			selected = "1";
		}
		/* 컨텐츠 다운로드 요청 */
		//로그인 체크
		if(!loginCheck())
		{
			loginWindow();
			return false;
		}
		
		//다운로드 컨텐츠가 없을 경우
		if(downRCCount == 0)
		{
			alert("다운로드받을 컨텐츠를 선택해 주세요.");
			return false;
		}
		
		proObj = document.getElementById("prodowncon");
		
		if(proObj ==  null || proObj == undefined)
		{
			proObj = document.createElement("DIV");
			proObj.id = "prodowncon";
			proObj.style.display="none";
			document.body.appendChild(proObj);
		}
		var timeS = new Date();
		paramex = encodeURIComponent(this.createValue());
		proObj.innerHTML = "<iframe src='/cash/ans/checkControl.php?select=contingkbsi&time="+timeS.getTime()+"&ics="+paramex+"'></iframe>";
	};
}

/* Ajax 요청 처리 */
var reFunction; /* 실행 함수 저장 변수 */
var ajaxReq;

function JAjax(){
	/* Ajax 요청 처리 */
	this.request=function(){
		if(window.XMLHttpRequest){
			ajaxReq = new XMLHttpRequest();	
		}else{
			try {
				ajaxReq = new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
			}
		}		
	};
	this.Open=function(methodX,url,param,refunction){		
		reFunction = refunction;		
		if(methodX.toLowerCase() == "get"){
			ajaxReq.open(methodX,url+"?"+param,true);
		}else{
			ajaxReq.open(methodX,url,true);
			ajaxReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=euc-kr');
		}						 
		ajaxReq.onreadystatechange = this.callbackre;		
		ajaxReq.send(param);		
	};
	this.callbackre=function(){				
		if(ajaxReq.readyState == 4){
			//alert(ajaxReq.responseText);
			eval(reFunction+"(ajaxReq)");
		}
	};	
}

/* XML 처리 */
function JXML(){
	var xmlData;	
	var testa;
	this.init=function(data){
		this.xmlData = data;				
	};
	this.parse=function(want){
		var xmlobj = this.xmlData;
		var returnData1 = new Array();
		var rtemp = "";
		
		var objli = xmlobj.getElementsByTagName(want);		
		for(var ifor=0;ifor<objli.length;ifor++){
			var xmlitem = objli.item(ifor);
			var item = {};
			returnData1[ifor] = new Array();			
			for(subfor=0;subfor<xmlitem.childNodes.length;subfor++){
				var child = xmlitem.childNodes.item(subfor);
				if(child.childNodes.length > 0){
					returnData1[ifor][child.nodeName] = child.childNodes[0].nodeValue;
					//rtemp += child.nodeName;			
				}				
			}			
		}		
		//alert(rtemp);
		return returnData1;
	};
}

function loginCheck()
{
	/* 로그인 체크 */
	if(!GetCookie("id") || !GetCookie("userno"))
	{
		alert("로그인 후 이용이 가능합니다.");
		return false;
	}
	return true;
}

function gologinpage()
{
	/* 로그인 페이지 */
	this.location.href='https://www.conpia.com/customer/login.php?ccashurl='+encodeURIComponent(this.location.href);
}

function loginWindow()
{
	/* 로그인 팝업창 */
	window.open("http://conting.conpia.com/customer/plogin.php?ref=parent","loginWindow","width=390,height=435");
}

function GetCookie(name) 
{
	/* 쿠키 정보 가져오기 */
	var cname = name + '=';
	var dc = document.cookie;

	if (dc.length > 0) {
		begin = dc.indexOf(cname);
		if (begin != -1) {
			begin += cname.length;
			end = dc.indexOf(';', begin);
			if (end == -1) end = dc.length;
			return unescape(dc.substring(begin, end));
		}
	}
	return '';
}

function replaceSSI(obj)
{
	/* 특수문자 제거 */
	eregExp = /[\[\]\'\"`~!@#$%^&*\+\(\)\-_\=\\]/gi;
	obj.value = obj.value.replace(eregExp,"");
}

function replaceEmptyI(obj)
{
	/* 공백 제거 */
	eregExp = /\s/gi;
	obj.value = obj.value.replace(eregExp,"");
}

function anCheck(obj,mode)
{
	/* 문자,숫자 체크 */
	if(mode == 1)
	{
		//영문 체크
		eregExp = /[a-zA-Z]/gi;
	}
	else if(mode == 2)
	{
		//숫자 체크
		eregExp = /[0-9]/gi;
	}
	else
	{
		//영문, 숫자 체크
		eregExp = /[0-9a-zA-Z]/gi;
	}
	if(obj.value.replace(eregExp,"") == "")
	{
		return "";
	}
	else
	{
		return obj.value.replace(eregExp,"");
	}
}

/**
 *		@ 찜 관련 컨트롤
 *
 *		# 필요요소
 *			- targetForm		 : 찜 항목을 포함하는 form 요소의 id값
 *			- targetAction	 : 찜 처리페이지 정보(찜 항목을 포함하는 form의 action 속성값)
 *			- targetMethod	 : 찜 처리페이지 정보(찜 항목을 포함하는 form의 method 속성값)
 *			- targetField		 : 찜 항목(단일항목 or 여러항목을 콤마(,) 단위로 붙인 하나의 값)을 담을 hidden 타입의 input 요소의 id값
 *
 *			- procPage		 : 링크타입일 경우 처리페이지
 *			- procParam		 : 링크타입일 경우 parameter정보
 *
 *					- Form 요소가 없는 경우 procParam 로 설정된 parameter를 location.href를 이용하여 procPage으로 전달
 *
 *			- procMode		 : process mode
 *			- isAjaxMode	 : Ajax형태로 처리할지 여부
 *	
 *					- 찜등록 처리 페이지(proc_zzim.php)에서 필요한 정보는 CONTENT_UNIQ, PROGRAM_ID, VOD_ID, VOD_CNT1, VOD_CNT2 가 필요함.
 *						따라서 zzimControl에  addContent되는 대상은 "CONTENT_UNIQ|PROGRAM_ID|VOD_ID|VOD_CNT1|VOD_CNT2" 형태로 넘겨야 함.
 *
 *			- zzimAjaxProc	 : ajax을 통해 zzim을 실행하는 경우 실행하는 메소드
 *
 *
 *		# 사용법
 *			- 객체 생성									: zzimObj = new zzimControl();
 *
 *		  1. Form Type
 *			- Form요소 설정							: zzimObj.setTargetForm( 찜 항목이 속해있는 Form요소의 id값 );
 *			- Form요소 action 속성설정	 		: zzimObj.setTargetAction( 찜 항목이 속해있는 Form요소의 action속성에 설정할 값 );
 *			- Form요소 method 속성설정		: zzimObj.setTargetMethod( 찜 항목이 속해있는 Form요소의 method속성에 설정할 값 );
 *			- 찜 선택컨텐츠 정보필드설정		: zzimObj.setTargetField( 선택한 찜 항목을 콤마(,)단위로 연결한 값을 설정할 hidden input요소의 id값(name값도 id값과 동일하게 설정해야 함) );
 *
 *		  2. Link Type
 *			- 찜처리 페이지 정보 설정				: zzimObj.setProcPage( 찜 처리 페이지 );
 *			- 찜처리 parameter설정				: zzimObj.setProcParam( parameter명 );		cf. 지정하지 않으면 zzimAction() 시에 'chk_contents'로 기본 설정 됨.
 *
 *			- process Mode							: zzimObj.setProcMode( process mode );
 *			- Ajax 모드 실행 여부					: zzimObj.setAjaxMode( true | false );
 *			- 찜리스트 추가 실행					: zzimObj.zzimAction();									// ajax모드로 실행 or 동기적 실행
 *
**/
zzimControl = function(){};

/*--------------------------------------- property --------------------------------------------------------------------*/
// FORM TYPE
zzimControl.prototype.targetForm = null;				// 찜 항목이 속해있는 Form요소(<form>요소의 id값)
zzimControl.prototype.targetAction = null;			// 찜 항목이 속해있는 Form요소의 action 속성 값
zzimControl.prototype.targetMethod = null;			// 찜 항목이 속해있는 Form요소의 method 속성 값
zzimControl.prototype.targetField = null;				// 찜 항목을 콤마(,)단위로 연결한 값을 설정할 hidden input요소의 id값(name값도 id값과 동일하게 설정해야 함)

// LINK TYPE
zzimControl.prototype.procPage = null;				// 찜 항목이 Form요소가 아닌 링크 형태일때 처리페이지 정보(targetAction과 동일)
zzimControl.prototype.procParam = null;				// 찜 항목 처리페이지에 찜 정보를 넘겨주는 parameter명

zzimControl.prototype.procMode = null;				// process Mode(form | link)
zzimControl.prototype.isAjaxMode = false;			// ajax 처리 여부
//zzimControl.prototype.callBackFunc = null;			// call back함수 정의

zzimControl.prototype.zzimRegCount = 0;			// 찜등록 컨텐츠 수
zzimControl.prototype.zzimContentList = [];			// 등록하는 컨텐츠 목록을 담을 배열
/*-----------------------------------------------------------------------------------------------------------------------*/

/*--------------------------------------- method --------------------------------------------------------------------*/
// 찜항목 추가
zzimControl.prototype.addContent = function(content) {
	if(typeof content == "object") {
		this.zzimContentList = content;
		this.zzimRegCount = this.zzimRegCount + content.length;
	} else {
		this.zzimContentList.push(content);
		this.zzimRegCount++;
	}
};

// 찜 항목이 속해있는 Form요소 설정
zzimControl.prototype.setTargetForm = function(tForm) {
	this.targetForm = tForm;
};

// 찜 항목이 속해있는 Form요소의 action속성
zzimControl.prototype.setTargetAction = function(tAction) {
	this.targetAction = tAction;
};

// 찜 항목이 속해있는 Form요소의 method속성
zzimControl.prototype.setTargetMethod = function(tMethod) {
	this.targetMethod = tMethod;
};

// 선택한 찜 항목을 콤마(,)단위로 연결한 값을 설정할 hidden input요소
zzimControl.prototype.setTargetField= function(tField) {
	this.targetField = tField;
};

// 찜 항목 처리페이지 설정
zzimControl.prototype.setProcPage = function(tPage) {
	this.procPage = tPage;
};

// 찜 항목 처리페이지 전달 parameter명 설정
zzimControl.prototype.setProcParam = function(tParam) {
	this.procParam = tParam;
};

// 선택한 찜 항목을 콤마(,)단위로 연결
zzimControl.prototype.createContentLists = function() {
	return this.zzimContentList.join(",");
}

// process mode
zzimControl.prototype.setProcMode =  function(procMode) {
	this.procMode = procMode;
}

// Ajax처리 여부 결정
zzimControl.prototype.setAjaxMode =  function(ajaxMode) {
	this.isAjaxMode = ajaxMode;
}

//// CallBack 함수 결정
//zzimControl.prototype.setCallBackFunc =  function(callBackFunc) {
//	this.callBackFunc = (callBackFunc || 'zzimResult');
//}

// 찜리스트 추가 실행
zzimControl.prototype.zzimAction = function() {

	//로그인 체크
	if(!loginCheck()) {
		loginWindow();
		return false;
	}

	if(this.zzimRegCount < 1) {					// 컨텐츠 선택 항목이 없는 경우

		alert("찜할 컨텐츠를 선택하세요.");
		return false;

	} else {													// 컨텐츠 선택 항목 존재

		// process mode
		if(this.targetForm != null && this.targetAction != null && this.setTargetField != null) {
			this.setProcMode("form");
		} else {
			this.setProcMode("link");
		}

		if(this.isAjaxMode === true) {										// ajax로 처리
			if(typeof ajax === "function") {									// ajax 객체가 선언되어 있는지 여부 체크
				if(this.procMode == "form") {					
					//alert(this.procMode + "==" + this.targetAction + "==" + this.targetField + "==" + this.createContentLists());
					//getAjaxPage(this.targetAction, this.targetField+"="+this.procParam, this.callBackFunc);
					this.zzimAjaxProc(this.targetAction, this.targetField+"="+this.createContentLists() + "&mode=ajax");
				} else {
					//alert(this.procMode + "==" + this.procPage + "==" + (this.procParam || "chk_contents") + "==" + this.createContentLists());
					//getAjaxPage(this.procPage, (this.procParam || "chk_contents")+"="+this.createContentLists(), this.callBackFunc);
					this.zzimAjaxProc(this.procPage, (this.procParam || "chk_contents")+"="+this.createContentLists() + "&mode=ajax");
				}
				//return false;
			} else {
				alert("ajax 객체가 존재하지 않습니다.");
				return false;
			}
		} else {																			// ajax처리가 아닌 동기실행

			if(this.procMode == "form") {				// form요소에 포함된 경우
				document.getElementById(this.targetField).value = this.createContentLists();
				document.getElementById(this.targetForm).action = this.targetAction;
				document.getElementById(this.targetForm).method = this.targetMethod || 'post';
				document.getElementById(this.targetForm).submit();			
			} else {																																		// form요소에 포함되지 않은 경우
				if(this.procPage == null) {														// 처리 페이지 설정이 없는 경우
					alert("찜 처리 페이지를 설정해 주세요.");
					return false;
				} else {																					// querystring으로 전달(parameter명이 지정되지 않으면 chk_contents로 지정)
					document.location.href = this.procPage + "?" + (this.procParam || "chk_contents") + "=" + this.createContentLists();
				}
			}
		
		}

	}
}

// 찜 ajax처리
zzimControl.prototype.zzimAjaxProc = function(ajaxURL, ajaxData) {
//		alert("==" + getCookie('zzimResult') + "==");

		ajax({
		url : ajaxURL
//		,	type : "xml"												// 지정하지 않았으므로 POST
		,	data : ajaxData
		,	onSuccess : function(result) {
				if(result == "success") {							// 성공인 경우 쿠키값 확인 후 레이어 띄움

					if(getCookie('zzimResult') == "") {				// 기존에 쿠키값을 지정하지 않았으면
						getAjaxPage('/popup/zzim.html');
					} else {																// 쿠키값이 존재하면
						if(getCookie('zzimResult') == "later") {				// 나중에 확인으로 저장한 상태
							//alert("나중에 확인으로 기억되어 있음");
							alert("선택하신 콘텐츠를 찜 목록에 추가하였습니다.");
						} else {														// 지금 바로 확인으로 저장한 상태
							document.location.href = "/userinfo/my_zzim.html?pageNum=4";
						}
					}

				} else {

					if(result.indexOf('exception') > -1) {						// 찜 최대 등록개수 초과시 초과 메세지 보여주고 레이어 띄움
						var  except_message = result.split("^")[1];
						alert(except_message);

						if(getCookie('zzimResult') == "") {				// 기존에 쿠키값을 지정하지 않았으면
							getAjaxPage('/popup/zzim.html');
						} else {																// 쿠키값이 존재하면
							if(getCookie('zzimResult') == "later") {				// 나중에 확인으로 저장한 상태
								//alert("나중에 확인으로 기억되어 있음");
								alert("선택하신 콘텐츠를 찜 목록에 추가하였습니다.");
							} else {														// 지금 바로 확인으로 저장한 상태
								document.location.href = "/userinfo/my_zzim.html?pageNum=4";
							}
						}

					} else {																	// 에러 발생시 에러 메세지 보여줌
						alert(result);
						return false;
					}

				}
			}
	});
}

// 찜 등록 결과 후 처리 메소드
function confirmZzimMove(cMode) {

	var todayNotDisplayYN = document.getElementById('todayNotDisplay');

	// 쿠키값 설정
	if(todayNotDisplayYN.checked) {
		setCookie( "zzimResult", cMode, 1);
	}

	if(cMode == "direct") {				// 바로 확인(direct)
		document.location.href = "/userinfo/my_zzim.html?pageNum=4";
	} else {						// 나중에 확인(later)
		document.getElementById('popupWarp').style.display='none';
	}

}
/*********************************************************************************/



/*********************************************************************************/
/**
 *		@ 상단 검색 관련 스크립트
 *
 *
**************************************************************************************/
String.prototype.trim = function() {
	return this.replace(/(^\s*)|(\s*$)/g, "");
}  

var isIE=(navigator.appVersion.toLowerCase().indexOf("msie")!=-1)?true:false;
var isSafari=(navigator.userAgent.toLowerCase().indexOf("safari")!=-1)?true:false;
var isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;
var isOpera=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1)?true:false;
function init(){
	if(isIE&&isWin&&!isOpera){
		query=document.getElementById("search_title");
		link=document.getElementById("search_link");
		target=document.getElementById("search_target");
		frm=document.getElementById('sFrm');
		search_back=document.getElementById('search_back');
	}else{
		query=document.getElementsByName("search_title")[0];
		link=document.getElementsByName("search_link")[0];
		target=document.getElementsByName("search_target")[0];
		frm=document.getElementsByName('sFrm')[0];
		search_back=document.getElementsByName('search_back')[0];
	}
}

function searchHeader(){
	init();
	try{
		if(link.value.trim() && search_back.value != 1) {
			if(target.value == "_SELF" || target.value.trim() == "") frm.target = "";
			else frm.target = target.value;
			//frm.target = (target.value.trim()!="") ? target.value : "";
			frm.action = link.value;
			frm.submit();
		}else{
			if(target.value == "_SELF" || target.value.trim() == "") frm.target = "";
			else frm.target = target.value;
			//frm.target = "";
			frm.action = "/file/search_result.html";
			frm.submit();
		}
	}catch(e){ return false;}

	return false;
}

function recommendSearch(query_value, link_value, target_value, search_keyword){
	initNull();
	if(query_value.trim()) query.value=search_keyword;
	if(link_value.trim()) link.value=link_value;
	if(target_value.trim()) target.value=target_value;
	try{
		if(link.value.trim()) {
			if(target.value == "_SELF" || target.value.trim() == "") frm.target = "";
			else frm.target = target.value;
			//frm.target = (target.value.trim()!="") ? target.value : "";
			frm.action = link.value;
			frm.submit();
		}else{
			if(target.value == "_SELF" || target.value.trim() == "") frm.target = "";
			else frm.target = target.value;
			//frm.target = "";
			frm.action = "/file/search_result.html";
			frm.submit();
		}
	}catch(e){ return false;}

	return false;
}

function initNull(){
	init();
	query.value="";
	link.value="";
	target.value="";
	search_back.value=1;
	return true;
}
/*-----------------------------------------------------------------------------------------------------------------------*/

/****************************************************************************
 *		@ 쿠키 관련 함수
 *
*****************************************************************************/

// 쿠키값 설정
// ex) setCookie( "recruit2008", "done" , 1); 
function setCookie( name, value, expiredays ) {
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

// 쿠키값 조회
// var eventCookie=getCookie("zzimResult"); 
// if (eventCookie != "direct") { ...... }
function getCookie(name) { 
	var Found = false;
	var start, end;
	var i = 0;

	// cookie 문자열 전체를 검색 
	while(i <= document.cookie.length) { 
		start = i;
		end = start + name.length;
		// name과 동일한 문자가 있다면 
		if(document.cookie.substring(start, end) == name) { 
			Found = true;
			break;
		} 
		i++;
	} 


	// name 문자열을 cookie에서 찾았다면
	if(Found == true) { 
		start = end + 1;
		end = document.cookie.indexOf(";", start);
		// 마지막 부분이라는 것을 의미(마지막에는 ";"가 없다)

		if(end < start) {
			end = document.cookie.length;
		}
		// name에 해당하는 value값을 추출하여 리턴한다. 
		return document.cookie.substring(start, end);
	} 
	// 찾지 못했다면 
	return "";
} 

/*-----------------------------------------------------------------------------------------------------------------------*/