/*
 * 프로젝트명: 투자유치센터 홈페이지 개편
 * 프로그램명: 투자물건 관련
 * 작 성 자 : 정희근
 * 작 성 일 : 2008-10-15
 * 수 성 자 : 정희근
 * 수 정 일 : 2008-10-15
 *
 * 저 작 권 : Copyright (c) 2008 by PostMedia All rights Reserved
 */


//파일 다운로드
function func_download (orgFile, saveFile) {
	filefrm.ofile.value = orgFile;
	filefrm.nfile.value = "kto_item/doc/" + saveFile;
	filefrm.action = "/download.kto";
	filefrm.submit();
}

//플래시 보기
function flash_view(src, title){
    var w = 840, h = 600; 
    var winxpos = (screen.availWidth-w)/2; 
    var winypos = (screen.availHeight-(h+70))/2; 
	var url = "/kor/ktoitem.kto?func_name=showFlash&src=" + src;
	url += "&title=" + encodeURI(title);
	//var url = "/kor/images/bs/tour_investment_support/flash/"
	//url += src;
	var pop = window.open(url,'popup1', "width=" + w + ",height=" + h + ", toolbars=no, scrollbars=no, resizable=no, left="+winxpos+", top="+winypos);

	pop.focus();
}

//동영상 보기
function movie_view(ki_idx){
    //var w = 263, h = 226;
    var w = 592, h = 242; 
    var winxpos = (screen.availWidth-w)/2; 
    var winypos = (screen.availHeight-(h+70))/2; 
	var url = "/kor/ktoitem.kto?func_name=showMovie&ktoItemDTO.ki_idx=" + ki_idx;
	window.open(url,'popup2', "width="+w+",height="+h+", toolbars=no, scrollbars=no, resizable=no, left="+winxpos+", top="+winypos);
}

//이미지 확대 보기
function img_view(){
    var w = 800, h = 600;
    var winxpos = (screen.availWidth-w)/2; 
    var winypos = (screen.availHeight-(h+10))/2; 
	var url = "/kor/ktoitem.kto?func_name=showPhoto";
	url += "&path=" + document.ktoimgfrm.path.value;
	url += "&title=" + encodeURI(document.ktoimgfrm.title.value);
	url += "&memo=" + encodeURI(document.ktoimgfrm.memo.value);
	window.open(url,"popup3", "width="+w+",height="+h+", toolbars=no, scrollbars=no, resizable=no, left="+winxpos+", top="+winypos);
}

//갤러리 확대 보기
function photo_view(formidx){
    var w = 800, h = 600;
    var winxpos = (screen.availWidth-w)/2; 
    var winypos = (screen.availHeight-(h+10))/2; 
	var url = "/kor/ktoitem.kto?func_name=showPhoto";
	url += "&path=" + document.forms["photoViewFrm"+formidx].path.value;
	url += "&title=" + encodeURI(document.forms["photoViewFrm"+formidx].title.value);
	url += "&memo=" + encodeURI(document.forms["photoViewFrm"+formidx].memo.value);
	window.open(url,"popup3", "width="+w+",height="+h+", toolbars=no, scrollbars=no, resizable=no, left="+winxpos+", top="+winypos);
}


//비교검색부분 *****************************************
/** 리스트 목록 선택 3개까지만 제한 **/
function threeCheck(name,chk) {
   /*
   var obj = document.getElementsByName(""+name+"");
   var checkItem;
   checkItem=0; 
   
   for(i=0; i< obj.length;i++){   
    if(obj[i].checked==true){     
     checkItem++;     
    }
   }
   if(checkItem > 3) {
    alert("비교물건 선택은 3개까지만 가능합니다.");
    chk.checked=false;
    return;
   }
   */
}

/** 비교검색 기능_view.jsp 사용법:javascript:goView('ktoCompareDTO.lists')**/ 
function goSearch(name) {
	/** 비교할 물건 2~3개로 제한 시작 **/
	var obj = document.getElementsByName(""+name+"");
	var checkItem;
	checkItem=0; 
	for(i=0; i< obj.length;i++){   
		if(obj[i].checked==true){     
			checkItem++;     
		}
	}
   if(checkItem < 2) {
		alert("2개 이상의 물건을 선택하여주십시오.");
	    return;
   }
   if(checkItem > 3) {
    alert("비교물건 선택은 3개까지만 가능합니다.");
    return;
   }
   /** 비교할 물건 2~3개로 제한 끝 **/
	sform.func_name.value = "view";
	sform.action = "/kor/ktocompare.kto";
	sform.submit();
}
