	var search_number = 0;
	var data_n_url = new Array();
	var ado_player_js = '';

	var inner_search = function(seq)
	 {
		 if( $("id_f_keyword_" + seq).value == '' ) {
			  alert('请输入关键词后，点击[搜索]按钮。');
			 return false;
		 }
		 else
		{
			toolbar_set(seq,'search');
			var onload_script = 'search_onload_script('+seq+')';



			//get_page($("ly_work_space_box_" + seq), data_n_url[seq] + 'data_inner_search_bin.html?f_keyword='+encodeURI($("id_f_keyword_" + seq).value)+'&number=' + search_number , false, onload_script);

			var xmlHttp = new Ajax.Request(data_n_url[seq] + "data_inner_search_bin.html", {
			method: 'post',
			parameters: {f_keyword:encodeURI($("id_f_keyword_" + seq).value),number:search_number},
			onComplete: function( transport ) {

				var data = transport.responseXML.getElementsByTagName("data");

				var html = data.item(0).getElementsByTagName("html").item(0).firstChild.data;
				var script_code = data.item(0).getElementsByTagName("script_code").item(0).firstChild.data;

				$("ly_work_space_box_" + seq).innerHTML = html;
				if(string_trim(script_code))
					exec_script(script_code);

				exec_script(onload_script);
			},
			onFailure: function(){
				alert('暂时与服务器连接出现问题。');
			}
			});


		 }
	 }

	var search_onload_script = function(seq){

		toolbar_set(seq,"search");

		//버튼존이 존재하는 경우에만 처리
		if($("btn_zone_" + seq)){
			if($("id_limit_" + seq)) $("btn_zone_" + seq).hide();
			else $("btn_zone_" + seq).show();
		}
	}


	var ok_submit = function(flag,seq){

		 if( flag == 'next' ) {
			 if( parseInt($("id_next_num_" + seq).value) >= 10000 ) {
				 $("id_inner_search_content_err_msg_" + seq).innerHTML = '<p style="color:red" align=center>没有更多的搜索结果。</font>';
				 try
				 {
					 $("btn_zone_" + seq).hide();
				 }
				 catch (e){}

			 return false;
			 } else {
				 search_number = $("id_next_num_" + seq).value;
			 }
		 } else if( flag == 'prev' ) {
			 if( parseInt($("id_prev_num_" + seq).value) < 0 ) {
				 $("id_inner_search_content_err_msg_" + seq).innerHTML = "<div style=\"width:90%;color:red;padding:30px;\"><center>这是文件的第一页。</center></div>";
			 return false;
			 } else {
				 search_number = $("id_prev_num_" + seq).value;
			 }
		 }
		 else
			return false;

		 inner_search(seq);
		 return false;
	 }


var sendmail_process = function(seq){
	document.sForm.p.value = "MIL";
	get_page_formsend($("ly_work_space_box_" + seq), data_n_url[seq]+"process.html",document.forms['sForm'],false,false);
}

var toolbar_set = function(seq,btn){

	if(btn == '')
		Effect.Fade($("ly_work_space_" + seq));
	else if($("ly_work_space_" + seq).getStyle("display") != "block")
		Effect.Appear($("ly_work_space_" + seq));

	$("ly_work_space_" + seq).name = btn;

	if($("btn_scrap_" + seq))
	if(btn == 'scrap')	$("btn_scrap_" + seq).className = "menu_sel";
	else	$("btn_scrap_" + seq).className = "menu";
	
	if($("btn_abuse_" + seq))
	if(btn == 'abuse')	$("btn_abuse_" + seq).className = "menu_sel";
	else	$("btn_abuse_" + seq).className = "menu";

	if($("btn_mail_" + seq))
	if(btn == 'mail')	$("btn_mail_" + seq).className = "menu_sel";
	else	$("btn_mail_" + seq).className = "menu";

	if($("btn_sets_" + seq))
	if(btn == 'sets')	$("btn_sets_" + seq).className = "menu_sel";
	else	$("btn_sets_" + seq).className = "menu";

	if($("btn_groups_" + seq))
	if(btn == 'groups')	$("btn_groups_" + seq).className = "menu_sel";
	else	$("btn_groups_" + seq).className = "menu";
	
	if($("btn_guest_pass_" + seq))
	if(btn == 'guest_pass')	$("btn_guest_pass_" + seq).className = "menu_sel";
	else	$("btn_guest_pass_" + seq).className = "menu";
	
	if($("btn_playlists_" + seq))
	if(btn == 'playlists')	$("btn_playlists_" + seq).className = "menu_sel";
	else	$("btn_playlists_" + seq).className = "menu";

	if($("btn_rotate_" + seq))
	if(btn == 'rotate')	$("btn_rotate_" + seq).className = "menu_sel";
	else	$("btn_rotate_" + seq).className = "menu";
}


var add_sets = function(m,seq){
	var sf = document["setForm_"+seq];
	var msg = "把这份文件增加到\n\n文件夹";
	var cut = 0;

	if(m == 'new'){

		if($("id_newset_"+seq).value != ''){
			msg += "“" + $("id_newset_"+seq).value + "”";
			sf['setname[0]'].value = $("id_newset_"+seq).value;
			cut++;
		}else{
			alert('请输入文件夹名。');
			return false;
		}

	}else{

		for(i=1;;i++){
			if(sf['setname['+i+']']){
				if(sf['setname['+i+']'].checked){
					if(cut > 0) msg += ", \n";

					msg += "“" + sf['setname['+i+']'].value + "”";
					cut++;
				}
			}else break;
		}
	}

	msg += '吗？';

	if(cut > 0){

		if(confirm(msg)){
				var xmlHttp = new Ajax.Request(data_n_url[seq] + "process.html", {
				method: 'post',
				postBody: Form.serialize(sf),
				onComplete: function( transport ) {
					alert('增加到文件夹好了。');
					location.reload();
				},
				onFailure: function(){
					alert('暂时与服务器连接出现问题。');
				}
				});
		}
	}
	else{
		alert('请选择文件夹。');
		return false;
	}
}

	var add_group = function (hcgroup_seq, v_permission, hcgroup_name,seq){
		var msg = "";

		if(permission == "private"){
			if(v_permission == "private"){
				// private -> private group
				true_script = "add_group_process('"+hcgroup_seq+"','"+hcgroup_name+"','"+seq+"');";
				msg = "把您的私人文件\n"
					+"发送到非公开圈子。\n"
					+"非公开圈子“"+hcgroup_name+"”的成员可以浏览、下载、抓取和点评这份文件。\n"
					+"好吗？";
			}
			else if(v_permission == "anyone" || v_permission == "invite"){ //public
				// private -> public group

				true_script = "add_group_process('"+hcgroup_seq+"','"+hcgroup_name+"','"+seq+"');alert('这份文件的公开设定更新为公开。');";

				msg = "把您的私人文件发送到公开圈子。\n"
						+"从现在开始这份文件将设定为公开将被所有人浏览、下载、抓取和点评这份文件。\n"
						+"好吗？";
			}
		}else if(permission == "contact"){
			if(v_permission == "private"){
				//contact -> private group
				true_script = "add_group_process('"+hcgroup_seq+"','"+hcgroup_name+"','"+seq+"');";
				msg = "把您的好友文件\n"
					+"发送到非公开圈子。\n"
					+"非公开圈子“"+hcgroup_name+"”的成员可以浏览、下载、抓取和点评这份文件。\n"
					+"好吗？";
			}
			else if(v_permission == "anyone" || v_permission == "invite"){ //public
				// contact -> public group

				true_script = "add_group_process('"+hcgroup_seq+"','"+hcgroup_name+"','"+seq+"');alert('这份文件的公开设定更新为公开。');";
				msg = "把您的好友文件发送到公开圈子。\n"
						+"从现在开始这份文件将被所有人浏览、下载、抓取和点评这份文件。\n"
						+"好吗？";
			}
		}
		else if(permission == "sale"){
			if(v_permission == "private"){
			// on sale -> private group
				true_script = "add_group_process('"+hcgroup_seq+"','"+hcgroup_name+"','"+seq+"');";
				msg = "把您的销售中文件发送到非公开圈子。\n"
					+"非公开圈子“"+hcgroup_name+"”的成员可以浏览、下载、抓取和点评这份文件。\n"
					+"好吗？";
			}
			else if(v_permission == "anyone" || v_permission == "invite"){ //public
			// on sale -> public group
				true_script = "add_group_process('"+hcgroup_seq+"','"+hcgroup_name+"','"+seq+"');";
				msg = "把您的销售中文件发送到公开圈子。\n"
					+"把这份文件在“"+hcgroup_name+"”圈子内销售。\n"
					+"好吗？"
			}
		}

		if(msg != ""){
			if(confirm(msg)){
				eval(true_script);
			}
		}else{
			add_group_process(hcgroup_seq,hcgroup_name,seq);
		}
	}

	var add_group_process = function(hcgroup_seq,hcgroup_name,seq){

		var xmlHttp = new Ajax.Request(data_n_url[seq] + "process.html?hcgroup_seq="+hcgroup_seq+"&p=ADDGROUP", {
		onComplete: function( transport ) {

			arr = transport.responseText.split(",");
			if(arr[0] == "true"){

				alert('发送到圈子“"'+hcgroup_name+'"“完了。');

				location.reload();
			}
		},
		onFailure: function(){
			alert('暂时与服务器连接出现问题。');
		}
		});
	}


	var scrap = function (ly,form,seq){
		var xmlHttp = new Ajax.Request(data_n_url[seq] + 'process.html', {
			method: 'post',
			postBody: Form.serialize(document.forms[form]),
			onComplete: function( transport ) {
				ly.innerHTML = transport.responseText;
			},
			onFailure: function(){
				alert('暂时与服务器连接出现问题。');
			}
		});
	}
	
	var abuse_report = function(m,seq,data_n_url){	
		var sf = document["abuseForm_"+seq];
		var msg = '';
		var cnt = 0;
	
		for(i=0;;i++){
			if(sf['abuseItem['+i+']']){
				if(sf['abuseItem['+i+']'].checked){
					cnt++;
				}
			}else break;
		}
		msg = '确认报告的理由？';
	
		if(cnt > 0){
	
			if(confirm(msg)){
					var xmlHttp = new Ajax.Request(data_n_url + "process.html", {
					method: 'post',
					postBody: Form.serialize(sf),
					onComplete: function( transport ) {
						var retMsg = transport.responseText;
						if(retMsg == 'OK') {
							alert('这些意见反馈已经登录。\n\n经过审查，我们会处理。\n\n谢谢您。');
							$('btn_work_space_close_'+seq).onclick();
						} else {
							alert('报告失败。\n\n请稍后再尝试。');
						}
						//location.reload();
					},
					onFailure: function(){
						alert('暂时与数据库连接出现问题。');
					}
					});
			}
		}
		else{
			alert('请选择报告的原因。');
			return false;
		}
	}

var add_new_playlist = function(seq){
	var sf = document["playlistForm_"+seq];
	var msg = "把这份文件增加到播放表";
	var cut = 0;
	var new_playlist_name = $("id_newplaylist_"+seq).value;

	if($("id_newplaylist_"+seq).value != ''){
		msg += "“" + $("id_newplaylist_"+seq).value + "”吗？";
		sf['playlist_name'].value = new_playlist_name;
		cut++;
	}else{
		alert('请输入播放表名。');
		return false;
	}

	if(cut > 0){

		if(confirm(msg)){
				var xmlHttp = new Ajax.Request(data_n_url[seq] + "process.html", {
				method: 'post',
				postBody: Form.serialize(sf),
				onComplete: function( transport ) {

					var rtnVal = transport.responseText;

					if( rtnVal > 0 ){ //success
						alert('增加到播放表好了。');
						location.reload();
					}
					else if( rtnVal == -3 ){
						alert('已有此播放表名。请尝试其他播放表名。');
						$("id_newplaylist_"+seq).select();
					}
					else if( rtnVal == -2 ){
						alert('建立播放表“'+ new_playlist_name +'”完成。增加此文件至播放表失败。');
						get_page($("ly_work_space_box_" + seq), data_n_url[seq] + "choose_playlists.html", false, '');

						//location.reload();
					}
					else if( rtnVal == -1 ){
						alert('建立播放表失败。');
						$("id_newplaylist_"+seq).select();
					}
					else{
						alert('暂时与服务器连接出现问题。');
					}
				},
				onFailure: function(){
					alert('暂时与服务器连接出现问题。');
				}
				});
		}
	}
	else{
		alert('请选择播放表。');
		return false;
	}
}

var add_playlist = function(playlist_docs_seq, v_permission, playlist_name,seq){
	var msg = '';

	//현재 자료의 permission별 처리
	if(permission == 'private'){
		if(v_permission == 'private'){
			// private -> private playlist
			true_script = "add_playlist_process('"+playlist_docs_seq+"','"+playlist_name+"','"+seq+"');";
			msg = "把这份文件增加到播放表"
				+"“"+playlist_name+"”"
				+"吗？";
		}
		else if(v_permission == 'public'){
			// private -> public playlist
			true_script = "add_playlist_process('"+playlist_docs_seq+"','"+playlist_name+"','"+seq+"');";
			msg = "您把非公开文件增加到播放表“"+playlist_name+"”,\n"
				+"其他用户通过这个播放表也可以查看您的文件,\n"
				+"确认要增加吗?"
		}
		else if(v_permission == 'contact'){
			// private -> contact playlist
			true_script = "add_playlist_process('"+playlist_docs_seq+"','"+playlist_name+"','"+seq+"');";
			msg = "您把非公开文件增加到播放表“"+playlist_name+"”,\n"
				+"其他用户通过这个播放表也可以查看您的文件,\n"
				+"确认要增加吗?"
		}
		
	}
	else if(permission == 'public'){
		if(v_permission == 'private'){
			// public -> private playlist
			true_script = "add_playlist_process('"+playlist_docs_seq+"','"+playlist_name+"','"+seq+"');";
			msg = "把这份文件增加到播放表"
				+"“"+playlist_name+"”"
				+"吗？";
		}
		else if(v_permission == 'public'){
			// public -> public playlist
			true_script = "add_playlist_process('"+playlist_docs_seq+"','"+playlist_name+"','"+seq+"');";
			msg = "把这份文件增加到播放表"
				+"“"+playlist_name+"”"
				+"吗？";
		}
		else if(v_permission == 'contact'){
			// public -> contact playlist
			true_script = "add_playlist_process('"+playlist_docs_seq+"','"+playlist_name+"','"+seq+"');";
			msg = "把这份文件增加到播放表"
				+"“"+playlist_name+"”"
				+"吗？";
		}
	}
	else if(permission == 'sale'){
		if(v_permission == 'private'){
			// sale -> private playlist
			true_script = "add_playlist_process('"+playlist_docs_seq+"','"+playlist_name+"','"+seq+"');";
			msg = "把这份文件增加到播放表"
				+"“"+playlist_name+"”"
				+"吗？";
		}
		else if(v_permission == 'public'){
			// sale -> public playlist
			true_script = "add_playlist_process('"+playlist_docs_seq+"','"+playlist_name+"','"+seq+"');";
			msg = "把这份文件增加到播放表"
				+"“"+playlist_name+"”"
				+"吗？";
		}
		else if(v_permission == 'contact'){
			// sale -> contact playlist
			true_script = "add_playlist_process('"+playlist_docs_seq+"','"+playlist_name+"','"+seq+"');";
			msg = "把这份文件增加到播放表"
				+"“"+playlist_name+"”"
				+"吗？";
		}
	}
	else if(permission == 'contact'){
		if(v_permission == 'private'){
			// contact -> private playlist
			true_script = "add_playlist_process('"+playlist_docs_seq+"','"+playlist_name+"','"+seq+"');";
			msg = "把这份文件增加到播放表"
				+"“"+playlist_name+"”"
				+"吗？";
		}
		else if(v_permission == 'public'){
			// contact -> public playlist
			true_script = "add_playlist_process('"+playlist_docs_seq+"','"+playlist_name+"','"+seq+"');";
			msg = "您把非公开文件增加到播放表“"+playlist_name+"”,\n"
				+"其他用户通过这个播放表也可以查看您的文件,\n"
				+"确认要增加吗?"
		}
		else if(v_permission == 'contact'){
			// contact -> contact playlist
			true_script = "add_playlist_process('"+playlist_docs_seq+"','"+playlist_name+"','"+seq+"');";
			msg = "您把非公开文件增加到播放表“"+playlist_name+"”,\n"
				+"其他用户通过这个播放表也可以查看您的文件,\n"
				+"确认要增加吗?"
		}
	}


	if(msg != ""){
		if(confirm(msg)){
			eval(true_script);
		}
	}else{
		add_playlist_process(playlist_docs_seq,playlist_name,seq);
	}
}

var add_playlist_process = function(playlist_docs_seq,playlist_name,seq){

	var xmlHttp = new Ajax.Request(data_n_url[seq] + "process.html?playlist_docs_seq="+playlist_docs_seq+"&p=ADDPLAYLIST", {
		onComplete: function( transport ) {

			var arr = transport.responseText.split(",");
			var retVal = transport.responseText;
			if(retVal == "true"){

				var msg = '发送到播放表“"'+playlist_name+'"“完了。';
				
				alert(msg);
				toolbar_set(seq,'');
				location.reload();
			}
			else{
				msg = '不能增加项目';
				// Does not have a item added
				alert(msg);
				toolbar_set(seq,'');
			}
		},
		onFailure: function(){
			alert('暂时与服务器连接出现问题。');
		}
		});

}

function getflashURL(seq){
	var flashURL = data_n_url[seq];
	return flashURL;
}

function timestap2formatDate(_timestamp){

var fillZeroFormat = function(num){
	return (num < 10) ? '0' + num : num;
}
var _tmpdate = new Date();
	_tmpdate.setTime(_timestamp + "000");
var _regdate_t = _tmpdate.getFullYear() + '/' + fillZeroFormat(_tmpdate.getMonth()+1) + '/' + fillZeroFormat(_tmpdate.getDate())

	return _regdate_t
}

function data_viewer(en_docs_url, seq, data_type, flash,slider, paper, group_url,thmb,regdate,n_url,r_url,imgwidth,imgheight,permission,file_access, page,state,ow)
{
	data_n_url[seq] = n_url;

	var isIE = "";
	var ua = navigator.userAgent;
	var MSIEOffset = ua.indexOf("MSIE ");
	if (MSIEOffset != -1) {
		isIE = "MSIE";
	}

	if(imgwidth == 0) imgwidth = 694;

	var init = function()
	{
		$('btn_work_space_close_' + seq).onclick = function(){
			toolbar_set(seq,'');
		}

		if($("btn_search_" + seq))
		$("btn_search_" + seq).onclick = function(){
			search_number=0;
			inner_search(seq);
		}

		if($("id_f_keyword_" + seq)) {

			$("id_f_keyword_" + seq).observe('keypress',function(event){
				if(event.keyCode==13){
					pos=0;
					inner_search(seq);
				}
			});
		}

		if(data_type == 'ADO')
		{
				imgwidth = imgwidth - 2;

				var flashvars = {
					playerPath: timestap2formatDate(regdate),
					playerSource: seq,
					playType: "audio",
					autoPlay: "true"
				};
				var params = {
					menu: "true",
					scale: "noScale",
					wmode:"opaque",
					bgColor: "#4b4b4b",
					allowscriptaccess:"always"
				};

				var attributes = {
				};

				ado_player_js = function() {
					swfobject.embedSWF(data_n_url[seq] + "report_screen/happySinglePlayer.swf", "flash_view_" + seq, imgwidth, "30", "10", "/images/swf/expressInstall.swf",
					flashvars, params,attributes);
				}
				$('flash_view_' + seq).hide();
		}
		else if(data_type == 'VDO')
		{
				imgwidth = imgwidth - 2;

				var flashvars = {
					playerPath: timestap2formatDate(regdate),
					playerSource: seq,
					playType: "video",
					autoPlay: "true",
					playProtocol: "http"
				};
				var params = {
					menu: "true",
					scale: "noScale",
					wmode:"opaque",
					allowFullscreen:"true",
					//wmode:"window",
					allowscriptaccess:"always"
				};

				var attributes = {
				};

				if(flash == 'y'){

					swfobject.embedSWF(data_n_url[seq] + "report_screen/happySinglePlayer.swf", "flash_view_" + seq, imgwidth, "412", "10", "/images/swf/expressInstall.swf",
					flashvars, params,attributes);
				}
				else if((flash == 'n') || (flash == 't')){
					$('flash_view_box_' + seq).className = "flash_view";
					$('flash_view_' + seq).innerHTML = '<p style="padding:100px;" align=center><a href="/help/?category=6&amp;faq_no=103"><font size="3"><b>预览图片准备中</b></font></a></p>';
					//trans_needs
				}
				else{
					$('flash_view_box_' + seq).className = "flash_view";
					$('flash_view_' + seq).innerHTML = '<p style="padding:100px;" align=center><a href=\"/help/?category=6&faq_no=104\"><font size=3><b>不能制作预览图片的视频</b></font></a></p>';
					//trans_needs
				}
		}
		else if(data_type == 'PLST')
		{
			if( $('flash_view_box_'+seq) ){
				$('flash_view_box_'+seq).setStyle({border:'none'});
			}

			$('flash_view_' + seq).innerHTML = '';

			get_playlist_view('flash_view_'+seq,seq);
		}
		else if(data_type == 'TORRENT')
		{
				var flashvars = {
					url: encodeURI(data_n_url[seq]) + "report_screen/view.xml"
				};
				var params = {
					menu: "true",
					scale: "noScale",
					wmode:"opaque",
					//wmode:"window",
					allowscriptaccess:"always"
				};

				var attributes = {
				};

				swfobject.embedSWF(data_n_url[seq] + "report_screen/torrentviewer.swf", "flash_view_" + seq, imgwidth, "250", "9", "/images/swf/expressInstall.swf",
					flashvars, params,attributes);
		}
		else if(data_type == 'ZIP')
		{
				var flashvars = {
					url: encodeURI(data_n_url[seq]) + "report_screen/view.xml"
				};
				var params = {
					menu: "true",
					scale: "noScale",
					wmode:"opaque",
					//wmode:"window",
					allowscriptaccess:"always"
				};

				var attributes = {
				};

				swfobject.embedSWF(data_n_url[seq] + "report_screen/zipviewer.swf", "flash_view_" + seq, imgwidth, "250", "10", "/images/swf/expressInstall.swf",
					flashvars, params,attributes);
		}
		else if(data_type == 'DOC')
		{
			imgwidth = imgwidth - 2;

			$('flash_view_box_' + seq).className = "flash_view";
			
			var params = {
				menu: "false",
				scale: "noScale",
				wmode:"window",
				allowscriptaccess:"always",
				allowFullScreen:'true'
			};
			
			var attributes = {
				id: "flash_view_" + seq,
				name: "flash_view_" + seq
			};

			if(permission == 'public' || permission == 'contact' || permission == 'private' || file_access > 0){
				if(imgheight == 0 || imgheight == ""){
					if(paper == 'v')	imgheight = 675;
					else imgheight = 490;
				}

				if(flash == 'y'){
						var flashvars = {
							flashURL: data_n_url[seq] + "report_screen/view.swf",
							setflashSeq:seq,
							isFileMode:"Read",
							imgheight:imgheight,
							imgwidth:imgwidth
						};

						imgwidth = '100%';
						imgheight= '100%';

//						swfobject.embedSWF( data_n_url[seq] + "report_screen/view.swf", "flash_view_" + seq, imgwidth, imgheight, "9", "/images/swf/expressInstall.swf", flashvars, params,attributes);
						//swfobject.embedSWF( data_n_url[seq] + "report_screen/preview.swf", "flash_view_" + seq, imgwidth, imgheight, "9", "/images/swf/expressInstall.swf", flashvars, params,attributes);
						swfobject.embedSWF( data_n_url[seq] + "report_screen/happyviewer.swf", "flash_view_" + seq, imgwidth, imgheight, "10", "/images/swf/expressInstall.swf", flashvars, params,attributes);
				}
				else if((flash == 'n') || (flash == 't')){
					$('flash_view_box_' + seq).className = "flash_view";
					$('flash_view_' + seq).innerHTML = '<p style="padding:100px;" align=center><a href="/help/?category=6&amp;faq_no=103"><font size="3"><b>预览图片准备中</b></font></a></p>';
				}
				else{
					$('flash_view_box_' + seq).className = "flash_view";
					$('flash_view_' + seq).innerHTML = '<p style="padding:100px;" align=center><a href=\"/help/?category=6&faq_no=104\"><font size=3><b>不能制作预览图片的文件</b></font></a></p>';
				}
			}
			else if(permission == 'sale'){
				if(slider == 'y'){

						var ZoomSize = 145;

						if(imgheight == 0 || imgheight == ""){
							if(paper == 'v'){
								if(page > 3){
									imgheight = 541;
									//imgheight = 450;
								}
								else{
									imgheight = 274;
									//imgheight = 300;
								}
							}
							else{
								if(page > 2){
									imgheight = 392;
									//imgheight = 405;
								}
								else{
									imgheight = 202;
									//imgheight = 210;
								}
							}
						}

						var flashvars = {
							flashURL: data_n_url[seq] + "report_screen/view.swf",
							setflashSeq:seq,
							isFileMode:"unRead",
							imgwidth:imgwidth,
							imgheight:imgheight,
							ZoomSize:ZoomSize
						};

						imgwidth = '100%';
						imgheight= '100%';

						//if(isIE){
							//swfobject.embedSWF(data_n_url[seq] + "report_screen/slider"+imgheight+".swf", "flash_view_" + seq, imgwidth, imgheight, "9", "/images/swf/expressInstall.swf", flashvars, params,attributes);
							swfobject.embedSWF(data_n_url[seq] + "report_screen/happyviewer.swf", "flash_view_" + seq, imgwidth, imgheight, "10", "/images/swf/expressInstall.swf", flashvars, params,attributes);
						//}
						//else{
							//swfobject.embedSWF(data_n_url[seq] + "report_screen/slider.swf", "flash_view_" + seq, imgwidth, imgheight, "9", "/images/swf/expressInstall.swf", flashvars, params,attributes);
						//}
				}
				else if((slider == 'n') || (slider == 't')){
					$('flash_view_box_' + seq).className = "flash_view";
					$('flash_view_' + seq).innerHTML = '<p style="padding:100px;" align=center><a href="/help/?category=6&amp;faq_no=103"><font size="3"><b>预览图片准备中</b></font></a></p>';
				}
				else{
					$('flash_view_box_' + seq).className = "flash_view";
					$('flash_view_' + seq).innerHTML = '<p style="padding:100px;" align=center><a href=\"/help/?category=6&faq_no=104\"><font size=3><b>不能制作预览图片的文件</b></font></a></p>';
				}
			}
		}
		else if(data_type == 'IMG')
		{
			var myW;
			if(parseInt(imgwidth) > parseInt(ow))
				myW = parseInt(ow);
			else
				myW = parseInt(imgwidth);

			$('flash_view_' + seq).innerHTML = '<IMG name="v" width="'+myW+'" id="data_img_' + seq + '" src="' + data_n_url[seq] + 'report_screen/view.jpg">';
		}
		else{
			$('flash_view_box_' + seq).className = "flash_view";
			$('flash_view_' + seq).innerHTML = '<p style="padding:100px;" align=center><a href=\"/help/?category=6&faq_no=104\"><font size=3><b>不能制作预览图片的文件</b></font></a></p>';
		}

	}

	if($("show_sets_" + seq))
	$("show_sets_" + seq).onclick = function(){

		var onload_script = 'toolbar_set('+seq+',"sets");';

		if($("ly_work_space_" + seq).name != "sets"){
			get_page($("ly_work_space_box_" + seq), data_n_url[seq] + "choose_sets.html" , false, onload_script);
			$("btn_sets_" + seq).className = "menu_sel";
		}
	}

	if($("show_groups_" + seq))
	$("show_groups_" + seq).onclick = function(){

		var onload_script = 'toolbar_set('+seq+',"groups");';

		if($("ly_work_space_" + seq).name != "groups"){
			get_page($("ly_work_space_box_" + seq), data_n_url[seq] + "choose_groups.html" , false, onload_script);
			$("btn_groups_" + seq).className = "menu_sel";
		}
	}
	
	if($("show_guest_pass_" + seq))
	$("show_guest_pass_" + seq).onclick = function(){

		var onload_script = 'toolbar_set('+seq+',"guest_pass");';

		if($("ly_work_space_" + seq).name != "guest_pass"){
			clearClipboardSWF();
			get_page($("ly_work_space_box_" + seq), "/guestpass/?docs_url=" + en_docs_url + "&data_type=doc&data_seq=" + seq, false, onload_script);
			$("btn_guest_pass_" + seq).className = "menu_sel";
		}
	}
	
	if($("show_playlists_" + seq))
	$("show_playlists_" + seq).onclick = function(){
		if(is_login){
			var onload_script = 'toolbar_set('+seq+',"playlists");';

			if($("ly_work_space_" + seq).name != "playlists"){
				get_page($("ly_work_space_box_" + seq), data_n_url[seq] + "choose_playlists.html" , false, onload_script);
				$("btn_playlists_" + seq).className = "menu_sel";
			}
		}
		else{
			location.href= LOGIN_URL + "?return_url=" + data_n_url[seq] + "?script=playlist";
		}
	}

	if($("show_mail_" + seq))
	$("show_mail_" + seq).onclick = function(){
		if(is_login){
			var onload_script = 'toolbar_set('+seq+',"mail");';

			if($("ly_work_space_" + seq).name != "mail"){

				get_page($("ly_work_space_box_" + seq), data_n_url[seq] + "sendmail.html" , false, onload_script);
				$("btn_mail_" + seq).className = "menu_sel";
			}

		}else{
			location.href= LOGIN_URL + "?return_url=" + data_n_url[seq] + "?script=mail";
		}
	}

	if($("show_rotate_" + seq))
	$("show_rotate_" + seq).onclick = function(){

		if($("ly_work_space_" + seq).name != "rotate")
		{
			toolbar_set(seq,"rotate");

			$("ly_work_space_box_" + seq).innerHTML = "<div id='ly_rotate_box_"+ seq +"' style='background-color:#FFFFFF;width:690px;height:175px;'><div id='rotate_flash_"+ seq +"' style='background-color:#FFFFFF;width:690px;height:175px;'>"
				+ loadingHTML
				+"</div>";
				+"</div>";

			var flashvars = {
					url:encodeURI(data_n_url[seq] + 'thmb.jpg'),
					s:$("data_img_" + seq).name,
					t:thmb,
					r:regdate,
					ly:"ly_rotate_box_" + seq,
					seq:seq,
					w:$("data_img_" + seq).width,
					h:$("data_img_" + seq).height,
					cs:"$('btn_work_space_close_" + seq + "').onclick();",
					okcs:"location.reload();"
				};
			var params = {
				menu: "false",
				scale: "noScale"
			};
			swfobject.embedSWF("/inc/docs/rotate/bin/Rotate.swf", "rotate_flash_" + seq, "690", "180", "10", "/images/swf/expressInstall.swf", flashvars, params);

		}
	}


	if($("delete_docs_" + seq))
	$("delete_docs_" + seq).onclick = function(){
		if(state == "good"){
			if(confirm("想要删除这份文件吗？")){
				if(HTTP_REFERER != "")
					location.href = data_n_url[seq] + "process.html?p=DEL&RETURL=" + encodeURIComponent(HTTP_REFERER);
				else
					location.href = data_n_url[seq] + "process.html?p=DEL&RETURL=/docs/" + en_docs_url + "/";
			}
		}
		else if(state == "wait"){
			alert("审批中。");
		}
		else if(state == "lock"){
			alert("阻止中。");
		}
	}

	if($("show_scrap_" + seq))
	$("show_scrap_" + seq).onclick = function(){

		if(is_login){
			var onload_script = 'toolbar_set('+seq+',"scrap");';

			if($("ly_work_space_" + seq).name != "scrap"){
				get_page($("ly_work_space_box_" + seq), data_n_url[seq] + "scrap_form.html?docs_seq=" + seq + "&group_url=" + group_url, false, onload_script);
				$("btn_scrap_" + seq).className = "menu_sel";
			}

		}else{
			location.href = LOGIN_URL + "?return_url=" + data_n_url[seq] + "?script=scrap";
		}
	}
	
	if($("show_abuse_" + seq))
	$("show_abuse_" + seq).onclick = function(){

		if(is_login){
			var onload_script = 'toolbar_set('+seq+',"abuse");';

			if($("ly_work_space_" + seq).name != "abuse"){
				get_page($("ly_work_space_box_" + seq), data_n_url[seq] + "abuse_form.html?docs_seq=" + seq + "&group_url=" + group_url, false, onload_script);
				$("btn_abuse_" + seq).className = "menu_sel";
			}

		}else{
			location.href = LOGIN_URL + "?return_url=" + data_n_url[seq] + "?script=abuse";
		}
	}

	init();
}

var showPlayButton = function(){
	//to do
}

var onPlay = function(){
	if(ado_player_js != ''){
		ado_player_js();
	}

	if($('ly_play_btn')){
		$('ly_play_btn').hide();
	}
}

var openPlayer = function(_meta_title){

	var player_url = '/docs/'+docs_url+'/'+docs_seq+'/audio/'+_meta_title+'/play/';
	var player_width = screen.availWidth-10;
	var player_height = screen.availHeight-20;

	//var x = window.open(player_url,'_player_win','width='+player_width+',height='+player_height+',left=0,top=0,resizable=yes,status=no,scrollbars=no');
	var x = window.open(player_url,'_player','');
	try{x.focus();}catch(e){}
}

var get_playlist_view = function(ly,seq){
	var data;
	var xmlHttp = new Ajax.Request(data_n_url[seq] + "playlist.html?playlist_docs_seq="+seq, {
		onComplete: function( transport ) {
			
			try{
				data = transport.responseText;
			}catch(e){ data = '';}

			if(data != ''){
				$(ly).innerHTML = data;
				setTimeout( playlist_func , 1000 );
			}

		},
		onFailure: function(){
			alert('暂时与服务器连接出现问题。');
		}
		});
}


var getCookie = function(name) {
	colCookie = document.cookie.split("; ");
	for (a=0; a < colCookie.length; a++) {
		colCrumb = colCookie[a].split("=");
		if(colCrumb[0] == name)
		return unescape(colCrumb[1]);
	}
	return "";
}


var setCookie = function(name, value, duration, path, domain, secure){
	var cookie = [];
	cookie.push(name+"="+escape(value));
	if(duration) {
		var date = new Date();
		date.setTime(date.getTime() + (duration*86400000));
		cookie.push("expires=" + date.toGMTString());
	}
	if(path) {
		cookie.push("path=" + path || "/");
	}
	if(domain) {
		cookie.push("domain=" + domain);
	}
	if(secure) {
		cookie.push("secure");
	}
	document.cookie = cookie.join(";");
}

//뷰어 제어관련
var viewerNs = {
	view_mode:'normal' //뷰어모드
	,tid:null //타이머
	,isIE6:(isIE && IEVersion==6)? true:false
	,normal_min_height:200 //일반뷰어최소높이
	,normal_max_height:(paper_height)? parseInt(paper_height) : 675 //일반뷰어최대높이
	,normal_min_width: (paper_width)? parseInt(paper_width) : 694 //일반뷰어최소너비
	,normal_max_width: (paper_width)? parseInt(paper_width) : 694 //일반뷰어최대너비
	,normal_gap_height:0 //일반뷰어리사이즈마진
	,normal_viewer_width:null //일반뷰어너비
	,normal_viewer_height:null //일반뷰어높이
	,expand_min_width:780 //전체화면뷰어최소너비
	,expand_min_height:400 //전체화면뷰어최소높이
	,bottom_space_height:10 //뷰어 하단 레이어 공백 높이
	,hidden_layer_lists:['header_wrapr','id_view_title','view_ico_tab','space5_1','id_cmt_area','right_area','Footer_Hspace','footer_wrap']
	,resize_layer_lists:[{id:'header_area',width:'970px'},{id:'content_wrap_R2depth02',width:'970px'}]
	,showHideLayer:function( mode ){ //레이어제어
		if(viewerNs.hidden_layer_lists.length < 1 || mode == '') return;
		for(var i=0;i<viewerNs.hidden_layer_lists.length;i++){
			if( $(viewerNs.hidden_layer_lists[i]) ) {
				$(viewerNs.hidden_layer_lists[i]).style.display = mode;
			}
		}
		return true;
	}
	,resetLayerSize:function( mode ){ //레이어사이즈제어

		if(mode == 'expand'){
			//너비 사이즈 100%로 변경 (crome, safari문제)
			for(var i=0;i<viewerNs.resize_layer_lists.length;i++){
				if( $(viewerNs.resize_layer_lists[i].id) ) {
					$(viewerNs.resize_layer_lists[i].id).setStyle({width:'100%'});
				}
			}
		}
		else if(mode == 'normal'){
			//너비 사이즈 기존 사이즈로 변경 (crome, safari문제)
			for(var i=0;i<viewerNs.resize_layer_lists.length;i++){
				if( $(viewerNs.resize_layer_lists[i].id) ) {
					$(viewerNs.resize_layer_lists[i].id).setStyle({width:viewerNs.resize_layer_lists[i].width});
				}
			}
		}
	}
};

var resizeViewer = function( _mode, _docs_seq ) {
	if(!_docs_seq) _docs_seq = docs_seq;
	var obj = $('flash_view_box_'+_docs_seq);
	var cmtLayer = $('id_cmt_area');
	var min_width,min_height,min_height,max_height,gap_height;
	var offsets,exclude_height,scroll_top,obj_top,obj_height,new_obj_height;
	var view_width,view_height;
	var _width,_height;
	
	if(!obj) return;
	
	if(_mode == 'normal'){
		min_height = viewerNs.normal_min_height;
		max_height = viewerNs.normal_max_height;
		gap_height = viewerNs.normal_gap_height;
		
		offsets = Position.cumulativeOffset( obj ); //오브젝트의 top,left(배열)
		obj_top = offsets[1];
		obj_height = obj.offsetHeight;
		scroll_top = (document.body.scrollTop) ? document.body.scrollTop : document.documentElement.scrollTop;
		view_height = document.documentElement.clientHeight;

		new_obj_height = view_height - obj_top - gap_height; //신규오브젝트높이
		
		if(new_obj_height < min_height) new_obj_height = min_height;
		if(new_obj_height > max_height) new_obj_height = max_height;
		
		if(viewerNs.isIE6){ // ie6
			if($('flash_view_'+_docs_seq)) {
				$('flash_view_'+_docs_seq).setStyle({width: viewerNs.normal_max_width + 'px',height: new_obj_height + 'px'});
			}
		}

		if( scroll_top == 0 )
		{
			obj.setStyle({width: viewerNs.normal_max_width + 'px',height: new_obj_height + 'px'});
			if(cmtLayer) {
				cmtLayer.setStyle({'margin-top':new_obj_height + viewerNs.bottom_space_height + 'px'});
			}
		}
	}
	else if(_mode == 'expand'){
		min_width = viewerNs.expand_min_width;
		min_height = viewerNs.expand_min_height;
		view_width = document.documentElement.clientWidth;
		view_height = document.documentElement.clientHeight;

		if(viewerNs.isIE6){
			_width = document.body.parentElement.clientWidth;
			_height = document.body.parentElement.clientHeight;
			
			if( $('flash_view_'+_docs_seq) ) {
				$('flash_view_'+_docs_seq).setStyle({width:_width+'px',height:_height+'px'});
			}
			obj.setStyle({width:_width+'px',height:_height+'px'});
		}
		else{
			_width = '100%';
			_height = '100%';
			
			if(view_width < min_width){
				obj.setStyle({width:min_width+'px'});
				viewerNs.resetLayerSize('expand');
			}
			else if(view_width > min_width){
				obj.setStyle({width:_width});
			}
				
			if(view_height < min_height){
				obj.setStyle({height:min_height+'px'});
				if(cmtLayer) {
					cmtLayer.setStyle({height:min_height+'px'});
				}
			}
			else if(view_height > min_height){
				obj.setStyle({height:_height});
			}
		}
	}
	else{
		return false;
	}
	viewerNs.tid = null;
	return true;
}

var zoomViewer = function( _mode, _docs_seq ){
	if(!_docs_seq) _docs_seq = docs_seq;
	var obj = $('flash_view_box_'+_docs_seq);

	if(document.body.scrollTop) document.body.scrollTop=0;
	else if(document.documentElement.scrollTop) document.documentElement.scrollTop=0;
	
	if(_mode == 'expand' && viewerNs.view_mode=='normal'){
		//일반보기화면으로 돌아가기 위해 현재뷰어의 너비,높이 저장
		viewerNs.normal_viewer_width = obj.style.width;
		viewerNs.normal_viewer_height = obj.style.height;

		//전체화면 너비,높이,Top,Left
		var _width = '100%',_height = '100%';
		var _top=0,_left=0;
		
		if(viewerNs.isIE6){
			_width = document.body.parentElement.clientWidth;
			_height = document.body.parentElement.clientHeight;
		}
		else{
			_top='0px';
			_left='0px';
		}
		
		//관련레이어를 모두 감춘다.
		viewerNs.showHideLayer('none');
		
		//css클래스, style 조정
		obj.className='';
		if(viewerNs.isIE6){ // ie6
			if( $('flash_view_'+_docs_seq) ) {
				$('flash_view_'+_docs_seq).setStyle({left:_left,top:_top,width:_width,height:_height});
			}
		}
		obj.setStyle({left:_left,top:_top,width:_width,height:_height});
		if( !viewerNs.isIE6){
			setTimeout("resizeViewer('expand',"+_docs_seq+")",50);
		}
		window.onresize = function(){ setTimeout("resizeViewer('"+_mode+"', "+_docs_seq+")",50); };
	}
	else if(_mode == 'normal'){
		var _width = viewerNs.normal_max_width+'px';
		var _height = (viewerNs.normal_viewer_height != '') ? viewerNs.normal_viewer_height : '475px';

		//block속성 레이어 사이즈조절
		viewerNs.resetLayerSize('normal');
					
		//관련레이어를 모두 활성화시킨다.
		viewerNs.showHideLayer('block');
		
		obj.className='flash_view';

		if(viewerNs.isIE6){ // ie6
			if( $('flash_view_'+_docs_seq) ) {
				$('flash_view_'+_docs_seq).setStyle({left:'',top:'',width:_width,height:_height});
			}
		}
		obj.setStyle({left:'',top:'',width:_width,height:_height});

		//현재 창크기에 맞춰 리사이징
		setTimeout("resizeViewer('normal',"+_docs_seq+")",50);
		window.onresize = function(){ setTimeout("resizeViewer('"+_mode+"', "+_docs_seq+")",50); };
	}

	viewerNs.view_mode=_mode;
	return true;
};