var u_cmmt_reg 				= '/cmmt_reg.do';
var u_cmmt_upt				= '/cmmt_upt.do';
var u_cmmt_del 				= '/cmmt_del.do';

function mov3(src,w,h){
	html = ''; 
	html += '	<Embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/mediaplayer/download/default.asp"  FileName="'+ src +'" width="'+ w+ '" height="'+ h+'"  SHOWCONTROLS=1 AUTOSTART=1 PlayCount=0></Embed>';
	document.write(html);
}

function swf3(img,mp3,w,h){
	html = ''; 
	html += '	<APPLET name="ptviewer" archive=/common/tourcms/ptviewer.jar  code=ptviewer.class width='+ w + ' height='+ h +' mayscript=true>';
	html += '	<PARAM name=file 		value="ptviewer:0">';
	html += '	<PARAM name=sound0		value='+ mp3 +'>';
	html += ' <PARAM name=applet0		value="{code= ptmedia.class} {file='+ mp3 +'}">	';
	html += ' <PARAM name=bar_x 		value="115">';
	html += ' <PARAM name=bar_y 		value="169">';
	html += ' <PARAM name=bar_width 	value="193">';
	html += ' <PARAM name=bar_height 	value="20">';
	html += ' <PARAM name=inits				value="ptviewer:startApplet(1)">';							   	
	html += ' <PARAM name=pano0		value="	{file='+ img +'}{pan=-45}{tilt=-50}{fov=80}{fovmax=120}{fovmin=30}{auto=0.5}">';
	html += ' </APPLET>';
	
	html += ' <embed id="pvr_mp3" name="pvr_mp3" src="'+mp3+'" autostart="true" hidden="false" />';
	document.write(html);
}

function mp3Play(){
	var obj = GetObject("pvr_mp3");
	if(!Validate.isNull(obj.getAttribute("src"))) obj.play();
	else alert("음성파일이 없습니다.");
}

function mp3Stop(){
	var obj = GetObject("pvr_mp3");
	if(!Validate.isNull(obj.getAttribute("src"))) obj.stop();
	else alert("음성파일이 없습니다.");
}

function img_popup(url){
	window.open(url, "img_popup", "status=no,  width=100, height=100, resizable=no, scrollbars=no, left=100, top=100");
}

function download(file_sn) {
	var bbs_id = document.getElementById("bbs_id").value;

	document.location.href = '/download.do?file_sn=' + file_sn + '&bbs_id=' + bbs_id + '&atcl_gb=FATI0010';
}

function chk_change (pos) {
	if(sendForm.file_chk.length > 0)	sendForm.file_chk[pos].checked=true;
	else	sendForm.file_chk.checked=true;
}

function img_resize(obj,width){
	if(obj.width > width)		obj.width = width;
}

function url_login(return_url){
	if(return_url != null && return_url != '')		SetCookie("return_url", return_url);	
  location.href='/login.do?mc=KO4515000000&pageNum=9&subNum=3';
}

function url_cmmt_reg(){
	var sendForm = document.getElementById("sendForm");  //var status = true;  if(typeof sendForm.submitHandle != Type.Undefined) status = eval("("+sendForm.submitHandle+")"); 	
  sendForm.appendChild(document.getElementById("sendFields"));
	sendForm.forward.value = GetCookie("return_url");
	sendForm.action = u_cmmt_reg;
	sendForm.submit();
}

function url_cmmt_upt(cmmt_sn){
	var sendForm = document.getElementById("sendForm");  //var status = true;  if(typeof sendForm.submitHandle != Type.Undefined) status = eval("("+sendForm.submitHandle+")"); 	
  sendForm.appendChild(document.getElementById("sendFields"));
	sendForm.forward.value = GetCookie("return_url");
  sendForm.cmmt_sn.value = cmmt_sn;
	sendForm.action = u_cmmt_upt;
	sendForm.submit();
}

function url_cmmt_del(cmmt_sn){
	var sendForm = document.getElementById("sendForm");  //var status = true;  if(typeof sendForm.submitHandle != Type.Undefined) status = eval("("+sendForm.submitHandle+")"); 	
  sendForm.appendChild(document.getElementById("sendFields"));
	sendForm.forward.value = GetCookie("return_url");
  sendForm.cmmt_sn.value = cmmt_sn;
	sendForm.action = u_cmmt_del;
	sendForm.submit();
}

// 파일 확장자 체크 
// file_path : 파일 full 경로
// chk_ext : 허용되는 파일 확장자(','로 구분)
function file_check(file_path, chk_ext){
	var result = false;
	var file_ext = file_path.substring(file_path.lastIndexOf(".")+1).toLowerCase();
	if(chk_ext=="*") result = true;
	else{
		var ext_list = chk_ext.split(",");
		for(var i=0 ; i< ext_list.length ; i++){
			if(file_ext == trim(ext_list[i]).toLowerCase()){
				result = true;
			}
		}
	}
	return result;
}
