var httpRequest = null;
function link()
	{
		document.form_ask.action = "http://www.nl.go.kr/ask/";
		document.form_ask.lib_id.value = "146008";
		document.form_ask.lib_name.value = "담양공공도서관";
		
		document.form_ask.target="mashup";
		document.form_ask.submit();
	} 
function getXMLHttpRequest(){
     if(window.ActiveXObject){
        try{
                return new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
                try{
                        return new ActiveXObject("Microsoft.XMLHTTP");
                }catch(e1){
                        return(null);
                }
        }
     }else if(window.XMLHttpRequest){
           return new XMLHttpRequest();
     }else{
           return null;
     }
}

function load(url){
     httpRequest = getXMLHttpRequest();
     httpRequest.onreadystatechange = viewMessage;
     httpRequest.open("GET", url, true);
     httpRequest.send(null);
}

function openGPIN(){
        wWidth = 350;
		wHight = 100;
		wX = (window.screen.width - wWidth) / 2;
		wY = (window.screen.height - wHight) / 2;
		var w = window.open("/G-PIN/AuthRequest.php?page=1", "GPIN","directories=no,toolbar=no,left="+wX+",top="+wY+",width="+wWidth+",height="+wHight);
}

function trim(str){ 
 //정규 표현식을 사용하여 화이트스페이스를 빈문자로 전환
 str = str.replace(/^\s*/,'').replace(/\s*$/, ''); 
 return str; //변환한 스트링을 리턴.
} 

function OnTopMenu(num){
	try{
		for(var i=1; i<=5; i++) {
				if(i==num) {
					document.getElementById("navi"+i).className="on top_menu";
					document.getElementById("subNavi"+i).style.display="block";
				}
				else {
					document.getElementById("navi"+i).className="top_menu";
					document.getElementById("subNavi"+i).style.display="";
				}
		}
	}catch(ex) {
		alert(ex);
	}
}

function main_navi(idx){
		for(var i=1; i<=2; i++) {
				if(i==idx) {
					document.getElementById('main_navi'+i).className="on";
					document.getElementById('main_navi'+i).style.display="block";
					document.getElementById('main_subnavi'+i).style.display="block";
					document.getElementById('main_more'+i).style.display = "block";
				}
				else {
					document.getElementById('main_navi'+i).className="";
					document.getElementById('main_navi'+i).style.display="";
					document.getElementById('main_subnavi'+i).style.display="none";
					document.getElementById('main_more'+i).style.display = "none";
				}
		}
}
function site(obj) {
if(document.getElementById(obj).value != '')
window.open(document.getElementById(obj).value,'_blank');
}

function new_open(sURL,nW,nH){
  var status = 'width='+nW+',height='+nH+',left=50,top=250,toolbar=no,resizable=yes';
   window.open(sURL,'nShow',status);
}
/*화면확대*/
var nowzoom = 100; 
function zoom(chk)
{
	switch(chk)
	{
		case 'up' : 
			if(nowzoom<200)
			{
				nowzoom=nowzoom+10; //25%씩 커짐
			}
			else alert('최대크기화면입니다.');
		break;
		case 'down':
			if(nowzoom>60)
			{
				nowzoom=nowzoom-10; //25%씩 작아짐
			} 
			else alert('최소크기화면입니다.');
		break;
		case 'none':
			nowzoom=100; break; //기본 100% 로..
	}
	
	document.getElementById("wrap").style.zoom=nowzoom+"%";

}
/*글씨확대*/
var size_now1 = 9;
var size_now2 = 11;//기본글씨
function font_size(chk,sw)
{
	
	switch(chk)
	{
		case 'up' : 
			if(size_now1 <20)
			{
				size_now1=size_now1+1;
			}
			else alert('최대글자크기입니다..');
			if(size_now2 <22)
			{
				size_now2=size_now2+1;
			}
			else alert('최대글자크기입니다..');
		break;
		case 'down':
			if(size_now1 >1)
			{
				size_now1=size_now1-1;
			} 
			else alert('최소글자크기입니다..');
			if(size_now2 >3)
			{
				size_now2=size_now2-1;
			} 
			else alert('최소글자크기입니다..');
		break;
		case 'none':
			size_now1=9; size_now2 = 11; break;
	}
	document.getElementById("wrap").style.fontSize= size_now1+"pt";
	document.getElementById("subNavi1").style.fontSize= size_now1+"pt";
	document.getElementById("subNavi2").style.fontSize= size_now1+"pt";
	document.getElementById("subNavi3").style.fontSize= size_now1+"pt";
	document.getElementById("subNavi4").style.fontSize= size_now1+"pt";
	document.getElementById("subNavi5").style.fontSize= size_now1+"pt";
	if(sw==0)
	{
		document.getElementById("month").style.fontSize= size_now2+"pt";
	}
}
function sub_bg(chk){
	 var sub_l = document.getElementById("snb").offsetHeight;
	 var sub_r = document.getElementById("sub_container").offsetHeight+chk;
	 var sub_height=0;
	 if(sub_l<400 && sub_r<400){
		 sub_height=400+"px";
	 }else{
		 if(sub_l>sub_r) sub_height=sub_l+"px";
		 else sub_height=sub_r+"px";
	 }
	 document.getElementById("snb").style.height = sub_height;
	 document.getElementById("sub_container").style.height = sub_height;
	 document.getElementById("sub_content").style.height = sub_height;
}



/**
* @desc   :  쿠키 얻기
* @param  :  이름
* @return     : none
*/
function gf_GetCookieValue (Name)
{
	 var search = Name + "="
	 if (document.cookie.length > 0) {
	  offset = document.cookie.indexOf(search)
	  if (offset != -1) {
	   offset += search.length
	   end = document.cookie.indexOf(";", offset)
	   if (end == -1)
	    end = document.cookie.length
	   return unescape(document.cookie.substring(offset, end));
	  }
	 }
	 else{
	   return "";
	 }
}


/* ---------------------------------------------------------------------
설명	: 화면의 컨텐츠 영역을 인쇄용 새창에 표시합니다. 
사용예	: ds_ContentPrint('div_id', './css', 'default', 'page', 'sub05', '500', '600', 'yes', 'no')
		  ds_ContentPrint('div_id', './css', 'default', 'page', 'sub05')
		  ds_ContentPrint('div_id')
개발자	: 동서정보시스템 여민호(mymino@nate.com)
---------------------------------------------------------------------- */
function ds_ContentPrint(div, dir, css1, css2, css3, width, height, resizable, scrollbars,BoardCss)
{
	try{
		//기본값 설정
		if(width == null) width = '750';
		if(height == null) height = '550';
		if(resizable == null) resizable = 'yes';
		if(scrollbars == null) scrollbars = 'yes';

		//div 내 HTML 추출
		var subHTML = document.getElementById(div).innerHTML;
		
		var PrintWindow  =  window.open('', 'prints', 'toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars='+scrollbars+', resizable='+resizable+', width='+width+', height='+height); 

		//기본 HTML
		printBoxHTML	= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
		printBoxHTML	+= "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"ko\" lang=\"ko\">";
		printBoxHTML	+= "<head><title>"+document.title+" 인쇄용 화면</title>";		

		//스타일시트 추가
		if(dir != null){
			if(css1 != null) printBoxHTML	+= "<link rel=\"stylesheet\" href=\""+dir+"/"+css1+".css\" type=\"text/css\" />";
			if(css2 != null) printBoxHTML	+= "<link rel=\"stylesheet\" href=\""+dir+"/"+css2+".css\" type=\"text/css\" />";
			if(css3 != null) printBoxHTML	+= "<link rel=\"stylesheet\" href=\""+dir+"/"+css3+".css\" type=\"text/css\" />";
			if(BoardCss != "") printBoxHTML	+= "<link rel=\"stylesheet\" href=\"./xboard/xskin/"+BoardCss+"/css/style.css\" type=\"text/css\" />";
			printBoxHTML +="<script type='text/javascript' src='/script/common.js' ></script>";
			printBoxHTML +="<script type='text/javascript' src='/script/comfunction.js'></script>";


		}

		//추가 스타일시트 및 스크립트 import(환경에 맞게 수정)
		
		
		//기본 HTML
		printBoxHTML	+= "</head><body>";
		
		//컨텐츠 영역
		printBoxHTML	+= "<div id=\""+div+"\">"+subHTML+"</div>";

		//인쇄 창 스크립트
		printBoxHTML  += "<"+"script type=\"text/javascript\">";
		printBoxHTML  += "window.print();";
		printBoxHTML  += "</script>";

		//태그종료
		printBoxHTML	+= "</body></html>";	
		PrintWindow.document.write(printBoxHTML);	
		PrintWindow.location.reload();

	}
	catch(err){
		alert(err.message);
		PrintWindow.close();
	}
}


//플래시
function playflash(file,width,height,bgcolor,quality,name){
 document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="'+name+'">');
 document.write('<param name="movie" value="'+file+'" />');
 document.write('<param name="quality" value="'+quality+'" />');
 document.write('<param name="wmode" value="transparent" />');
 document.write('<param name="bgcolor" value="'+bgcolor+'" />');
 document.write('<embed src="'+file+'" quality="'+quality+'" wmode="transparent" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" name="'+name+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
 document.write('</object>')
}


function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
	toolbar_str = toolbar ? 'yes' : 'no';
	menubar_str = menubar ? 'yes' : 'no';
	statusbar_str = statusbar ? 'yes' : 'no';
	scrollbar_str = scrollbar ? 'yes' : 'no';
	resizable_str = resizable ? 'yes' : 'no';

	cookie_str = document.cookie;
	cookie_str.toString();

	pos_start  = cookie_str.indexOf(name);
	pos_end    = cookie_str.indexOf('=', pos_start);

	cookie_name = cookie_str.substring(pos_start, pos_end);

	pos_start  = cookie_str.indexOf(name);
	pos_start  = cookie_str.indexOf('=', pos_start);
	pos_end    = cookie_str.indexOf(';', pos_start);

	if (pos_end <= 0) pos_end = cookie_str.length;
	cookie_val = cookie_str.substring(pos_start + 1, pos_end);
	if (cookie_name == name && cookie_val  == "done")
	return;

	window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

 function OpenPopup(argSrc, argName, argWidth, argHeight, argTop, argLeft, argCenterYN, argMenubar, argToolbar, argDirectories, argScrollbars, argStatus, argLocation, argResizable, argFullscreen ){
	var properties = "width="+argWidth+",height="+argHeight;
	if(argCenterYN == 'yes') {
		var sw = screen.availWidth;
		var sh = screen.availHeight;
		var left = (sw - argWidth)/2;
		var top = (sh - argHeight)/2;
		if(argTop != null) properties += ",top="+top;
		if(argLeft != null) properties += ",left="+left;
	}else{
		if(argTop != null) properties += ",top="+argTop;
		if(argLeft != null) properties += ",left="+argLeft;
	}

	if(argMenubar != null) properties += ",menubar="+argMenubar;
	if(argToolbar != null) properties += ",toolbar="+argToolbar;
	if(argDirectories != null) properties += ",directories="+argDirectories;
	if(argScrollbars != null) properties += ",scrollbars="+argScrollbars;
	else properties += ",scrollbars=yes";
	if(argStatus != null) properties += ",status="+argStatus;
	if(argLocation != null) properties += ",location="+argLocation;
	if(argResizable != null) properties += ",resizable="+argResizable;
	if(argFullscreen != null) properties += ",fullscreen="+argFullscreen;	
	
	var openPop = window.open(argSrc,argName,properties);
}

function getCookie( name )
{
	var nameOfCookie = name + "=";
	var x = 0;
	while ( x <= document.cookie.length )
	{
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
				endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 )
			break;
	}
	return "";
}
function OnAnswer(idx){
	for(var i=1; i<9; i++){
		if(i==idx)
		document.getElementById("dl_answer"+i).style.display="block";
		else
		document.getElementById("dl_answer"+i).style.display="none";
	}
}
