	var timeTerm=1;
	var widthTerm=20;
	var active =false;
	var screenWidth = 500 ;
	var moveBtn=0;
	var maxPageNum=0;
	
	
	//¼±ÅÃ ÆäÀÌÁö °è»ê
	var movePage=5;
	var totalPage=0;
	var script_msg="";
	
	var ViewLayer="";
	var DocLayer="";
	
	var NowLeft=0;

	//¹Ì¸®º¸±â ¼³Á¤
	var PreviewMax = 3;	

	function NewLeft(){
		var choise_btn = ((moveBtn-1) *movePage)+1;
		
		
		if(moveBtn > 0){
			choiseDoc(choise_btn, script_msg, totalPage);
			if(!active){
				moveBtn--;
				NowLeft=0;
				moveSliding("right");	
			}
			moveBtnStatus();
		}
		
		
		
	}
	function NewRight(){
		
		var choise_btn = ((moveBtn+1) *movePage)+1;
		
		if(moveBtn < maxPageNum){
			choiseDoc(choise_btn, script_msg, totalPage);
			if(!active){
				moveBtn++;
				NowLeft=0;
				moveSliding("left");	
				
			}
			moveBtnStatus();
		}
	}
	
	function moveBtnStatus(){
		//ÀÌÀüº¸±â ¾øÀ½
		if(moveBtn ==0){
			document.getElementById('prev_btn').src="/images/report/view/bt_prev_off.gif";
			if(moveBtn == maxPageNum){
				document.getElementById('next_btn').src="/images/report/view/bt_next_off.gif";
			}else{
				document.getElementById('next_btn').src="/images/report/view/bt_next_on.gif";
			}
		}else{
			document.getElementById('prev_btn').src="/images/report/view/bt_prev_on.gif";
			if(moveBtn == maxPageNum){
				document.getElementById('next_btn').src="/images/report/view/bt_next_off.gif";
			}else{
				document.getElementById('next_btn').src="/images/report/view/bt_next_on.gif";
			}
		}
	}
	
	function moveSliding(option){
		
		//ÀÌµ¿ºÎºÐ
		if(option =="left"){
			DocLayer.style.marginLeft  = (parseInt(DocLayer.style.marginLeft) - widthTerm) + "px";	
		}else{
			DocLayer.style.marginLeft  = (parseInt(DocLayer.style.marginLeft) + widthTerm) + "px";
		}
		
		
		//°è»êºÎºÐ
		NowLeft = NowLeft + widthTerm;
		
		if(NowLeft >= screenWidth){
			active = false;
			clearTimeout(my_timedProcess);
			return;
		}else{
			try{
				active = true;	
				var my_timedProcess = setTimeout("moveSliding('"+option+"')", timeTerm);
				
			}catch(e){
				active = false;
			}
		}
	}
	
	function setFirstPage(type){
		
		if(type == "sero"){
			document.getElementById("detail1").style.background ="url('/images/report/view/bg_doc_on.gif')";
			document.getElementById("chose1").style.background ="url('/images/report/view/bg_choise_on.gif')";
		}else{
			document.getElementById("garo_detail1").style.background ="url('/images/report/view/bg_doc_garo_on.gif')";
			document.getElementById("garo_chose1").style.background ="url('/images/report/view/bg_choise_on.gif')";
		}
		
	}
	
	function openBlog(no){
		window.open("/report/pop_myblog.html?no="+no, "myblog", "scrollbars=no,width=576,height=372");
	}
	
function change_link(form){
	var uid = new Date().getTime();
	if(form.url.selectedIndex !=0){
		window.open(form.url.options[form.url.selectedIndex].value, uid, ""); 
	}
}




//·¹ÀÌ¾î
function showHelpLayer(obj){

	document.getElementById(obj).style.display = "block";
}

function closeHelpLayer(obj){
	document.getElementById(obj).style.display = "none";
}


//¹®¼­ ¼±ÅÃ
function choiseDoc(val, type, max){
	
	if(type =="sero"){
		for(var i=1 ; i<=max ; i++){
			if(i == val){
				document.getElementById("detail"+i).style.background ="url('/images/report/view/bg_doc_on.gif')";
				document.getElementById("chose"+i).style.background ="url('/images/report/view/bg_choise_on.gif')";
			}else{
				document.getElementById("detail"+i).style.background ="url('/images/report/view/bg_doc_off.gif')";
				document.getElementById("chose"+i).style.background ="url('/images/report/view/bg_choise_off.gif')";
			}
		}
		
	}else{
		for(var i=1 ; i<=max ; i++){
			if(i == val){
				document.getElementById("garo_detail"+i).style.background ="url('/images/report/view/bg_doc_garo_on.gif')";
				document.getElementById("garo_chose"+i).style.background ="url('/images/report/view/bg_choise_on.gif')";
			}else{
				document.getElementById("garo_detail"+i).style.background ="url('/images/report/view/bg_doc_garo_off.gif')";
				document.getElementById("garo_chose"+i).style.background ="url('/images/report/view/bg_choise_off.gif')";
			}
		}
	}
}
//¹Ì¸®º¸±â ¿­±â
function openPreview(val, type, max, dno, auth, where){
	
	choiseDoc(val, type, max);
	if(max <= PreviewMax){
		alert('3ÆäÀÌÁö ÀÌÇÏÀÇ \nÀÚ·á´Â ·¹Æ÷Æ® ¹Ì¸®º¸±â¸¦ \nÁ¦°øÇÏÁö ¾Ê½À´Ï´Ù.');
		return;
	}
	if(auth==0 && val >= PreviewMax){
		if(confirm('3 ÆäÀÌÁö ÀÌ»óÀº ·Î±×ÀÎ ¶Ç´Â ¹«·áÈ¸¿ø°¡ÀÔ ÈÄ º¸½Ç ¼ö ÀÖ½À´Ï´Ù.')){
			top.location.href = "/member/index.html?where="+where;	
		}
		return;
	}
	if(max < PreviewMax){
		window.open("/report/data/pop_preview_no.html?dno="+dno+"&file=pageno", "preview", "width=500,height=500,scrollbars=yes");
	}else{
		window.open("/report/data/pop_preview_zoom.html?dno="+dno+"&page="+val, "preview", "width=500,height=500,scrollbars=yes");	
	}
	

}

//±¸¸ÅÈÄ±â ÀüÃ¼º¸±â
function showAllBuy(cnt){
	if(cnt <5 ){
		alert('±¸¸ÅÈÄ±â°¡ 5°Ç ¹Ì¸¸ÀÎ ÀÚ·áÀÔ´Ï´Ù.');
		return;
	}else{
		document.getElementById("buy_after_list_area_all").style.display="block";	
		document.getElementById("des_buy_more").style.display="none";	
		document.getElementById("des_buy_more_close").style.display="block";	
		
		
	}
}


//±¸¸ÅÈÄ±â ´Ý±â
function closeAllBuy(cnt){
	if(cnt <5 ){
		alert('±¸¸ÅÈÄ±â°¡ 5°Ç ¹Ì¸¸ÀÎ ÀÚ·áÀÔ´Ï´Ù.');
		return;
	}else{
		document.getElementById("buy_after_list_area_all").style.display="none";
		document.getElementById("des_buy_more_close").style.display="none";	
		document.getElementById("des_buy_more").style.display="block";	
		
	}
}

/*¿À´Ã º» ÀÚ·á*/
var MAX_TODAY_VIEW_NUM=5;

function Set_Cookie( name, value, expires, path, domain, secure ) 
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )
	{
	expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}



function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );
		
		
		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
	
		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}	

togather = function(){
	this.template_img = new Array(15);
	this.template_title = new Array(15);
	this.template_tno = new Array(15);
	this.template_key =1;
	
	togather.prototype.setPptValue = function(img, title, tno, key){
		this.template_img[key] = img;
		this.template_title[key] = title;
		this.template_tno[key] = tno;
	}
	
	togather.prototype.changeTPPage = function(type){
		
		if(type =="prev"){
			if(this.template_key == 1){
				return false;
			}else{
				var key = ((parseInt(this.template_key)-2) *3);
				this.changeAttribute(key);
				this.template_key--;		
			}
		}else{
			if(this.template_key == 5){
				return false;
			}else{
				var key = (parseInt(this.template_key) *3);
				//alert(key);
				this.changeAttribute(key);
				
				this.template_key++;		
			}
		}
		document.getElementById("tp_now_page").innerHTML = this.template_key;
	}
	
	togather.prototype.changeAttribute = function(key){
		
		var tmp=0;
		var tmp2=0;
		for(var i=0 ; i<3 ; i++){
			tmp = parseInt(key)+parseInt(i);
			tmp2 = parseInt(i) + 1;
			document.getElementById("link1_" + tmp2).href = "/template/view.html?tno="+this.template_tno[tmp];
			document.getElementById("link2_" + tmp2).href = "/template/view.html?tno="+this.template_tno[tmp];
			document.getElementById("img_" + tmp2).src = this.template_img[tmp] ;
			document.getElementById("title_" + tmp2).innerHTML=  this.template_title[tmp] ;
		}
	}
	
	
	this.cover_img = new Array(15);
	this.cover_title = new Array(15);
	this.cover_vno = new Array(15);
	this.cover_key =1;
	
	togather.prototype.setCoverValue = function(img, title, tno, key){
		this.cover_img[key] = img;
		this.cover_title[key] = title;
		this.cover_vno[key] = tno;
	}
	
	togather.prototype.changeCoverPage = function(type){
		
		if(type =="prev"){
			if(this.cover_key == 1){
				return false;
			}else{
				var key = ((parseInt(this.cover_key)-2) *5);
				this.changeCoverAttribute(key);
				this.cover_key--;		
			}
		}else{
			if(this.cover_key == 5){
				return false;
			}else{
				var key = (parseInt(this.cover_key) *5);
				//alert(key);
				this.changeCoverAttribute(key);
				
				this.cover_key++;		
			}
		}
		document.getElementById("cv_now_page").innerHTML = this.cover_key;
	}
	
	togather.prototype.changeCoverAttribute = function(key){
		
		var tmp=0;
		var tmp2=0;
		for(var i=0 ; i<5 ; i++){
			tmp = parseInt(key)+parseInt(i);
			tmp2 = parseInt(i) + 1;
			document.getElementById("c_link1_" + tmp2).href = "/cover/view.html?vno="+this.cover_vno[tmp];
			document.getElementById("c_link2_" + tmp2).href = "/cover/view.html?vno="+this.cover_vno[tmp];
			document.getElementById("c_img_" + tmp2).src = this.cover_img[tmp] ;
			document.getElementById("c_title_" + tmp2).innerHTML=  this.cover_title[tmp] ;
		}
	}
}

togather_a = new togather();

function chk_cbqnaFrm(cbfrm) {
	if (!cbfrm.title.value || cbfrm.title.value == "¿äÃ»Á¦¸ñÀ» 50ÀÚ ÀÌ³»·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä.") {
		alert("¿äÃ»Á¦¸ñÀ» 50ÀÚ ÀÌ³»·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		cbfrm.title.value="";
		cbfrm.title.focus();
		return false;
	}

	return;
}

function chk_byte(obj,str_max)
{

   var ls_str     = obj.value; // ÀÌº¥Æ®°¡ ÀÏ¾î³­ ÄÁÆ®·ÑÀÇ value °ª
   var li_str_len = ls_str.length;  // ÀüÃ¼±æÀÌ

   // º¯¼öÃÊ±âÈ­
   var li_max      = str_max; // Á¦ÇÑÇÒ ±ÛÀÚ¼ö Å©±â
   var i           = 0;  // for¹®¿¡ »ç¿ë
   var li_byte     = 0;  // ÇÑ±ÛÀÏ°æ¿ì´Â 2 ±×¹Ü¿¡´Â 1À» ´õÇÔ
   var li_len      = 0;  // substringÇÏ±â À§ÇØ¼­ »ç¿ë
   var ls_one_char = ""; // ÇÑ±ÛÀÚ¾¿ °Ë»çÇÑ´Ù
   var ls_str2     = ""; // ±ÛÀÚ¼ö¸¦ ÃÊ°úÇÏ¸é Á¦ÇÑÇÒ¼ö ±ÛÀÚÀü±îÁö¸¸ º¸¿©ÁØ´Ù.

   for(i=0; i< li_str_len; i++)
   {
      // ÇÑ±ÛÀÚÃßÃâ
      ls_one_char = ls_str.charAt(i);

      // ÇÑ±ÛÀÌ¸é 2¸¦ ´õÇÑ´Ù.
      if (escape(ls_one_char).length > 4)
      {
         li_byte = li_byte+2;
      }
      // ±×¿ÜÀÇ °æ¿ì´Â 1À» ´õÇÑ´Ù.
      else
      {
         li_byte++;
      }

      // ÀüÃ¼ Å©±â°¡ li_max¸¦ ³ÑÁö¾ÊÀ¸¸é
      if(li_byte <= li_max)
      {
         li_len = i + 1;
      }
   }
   
   // ÀüÃ¼±æÀÌ¸¦ ÃÊ°úÇÏ¸é
   if(li_byte > li_max)
   {
      alert( "¿äÃ»Á¦¸ñÀ» 50ÀÚ ÀÌ³»·Î ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
      ls_str2 = ls_str.substr(0, li_len);
      obj.value = ls_str2;
      
   }
   obj.focus();   
}