//화면확대
var zoomRate = 20;
var curRate = 100;
var minRate = 75;
var maxRate = 200;
 
function initZoom() {
   if(getCookie("zoomName") != null && getCookie("zoomName") != "")
   {
      curRate = getCookie("zoomName");
      if(!((curRate >=minRate)&(curRate<=maxRate)))
      {
         curRate = 100;
      }
 
      setCookie("zoomName",curRate, 1);
      document.body.style.zoom = curRate + '%';
   }
   else
   {
      document.body.style.zoom = '100%';
      curRate = 100;
      setCookie("zoomName",100, 1);
   }
}
function zoomInOut(value) {
	var browserEl = navigator.userAgent.toLowerCase();
	if(browserEl.indexOf('firefox')!=-1) { alert("익스플로러전용기능입니다. 보기메뉴 - 크기조정 - 확대/축소를 이용하세요."); }
	else if(browserEl.indexOf('opera')!=-1) { alert("익스플로러전용기능입니다. 보기메뉴 - zoom을 이용하세요."); }
	//else if(browserEl.indexOf('safari')!=-1) { alert("익스플로러전용기능입니다. 보기메뉴 - 텍스트크게/작게를 이용하세요."); }
  if (((value == "plus")&&(curRate >= maxRate))) {
	 alert("더이상 확대되지 않습니다.");
     return;
  }  
  if (((value == "minus") && (curRate <= minRate))) {
	 alert("더이상 축소되지 않습니다.");
     return;
  }  
  if (value == "plus") {
		curRate = parseInt(curRate) + parseInt(zoomRate);
  }
  else if (value == "minus") {
		curRate = parseInt(curRate) - parseInt(zoomRate);
  }
  else
  {
  	curRate = 100
  }
 	document.body.style.zoom = curRate + '%';
  setCookie("zoomName",curRate, 1);
}
function setCookie( name, value, expiredays )
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
 
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 "";
}//화면확대
var zoomRate = 20;
var curRate = 100;
var minRate = 75;
var maxRate = 200;
 
function initZoom() {
   if(getCookie("zoomName") != null && getCookie("zoomName") != "")
   {
      curRate = getCookie("zoomName");
      if(!((curRate >=minRate)&(curRate<=maxRate)))
      {
         curRate = 100;
      }
 
      setCookie("zoomName",curRate, 1);
      document.body.style.zoom = curRate + '%';
   }
   else
   {
      document.body.style.zoom = '100%';
      curRate = 100;
      setCookie("zoomName",100, 1);
   }
}
function zoomInOut(value) {
	var browserEl = navigator.userAgent.toLowerCase();
	if(browserEl.indexOf('firefox')!=-1) { alert("익스플로러전용기능입니다. 보기메뉴 - 크기조정 - 확대/축소를 이용하세요."); }
	else if(browserEl.indexOf('opera')!=-1) { alert("익스플로러전용기능입니다. 보기메뉴 - zoom을 이용하세요."); }
	//else if(browserEl.indexOf('safari')!=-1) { alert("익스플로러전용기능입니다. 보기메뉴 - 텍스트크게/작게를 이용하세요."); }
  if (((value == "plus")&&(curRate >= maxRate))) {
	 alert("더이상 확대되지 않습니다.");
     return;
  }  
  if (((value == "minus") && (curRate <= minRate))) {
	 alert("더이상 축소되지 않습니다.");
     return;
  }  
  if (value == "plus") {
		curRate = parseInt(curRate) + parseInt(zoomRate);
  }
  else if (value == "minus") {
		curRate = parseInt(curRate) - parseInt(zoomRate);
  }
  else
  {
  	curRate = 100
  }
 	document.body.style.zoom = curRate + '%';
  setCookie("zoomName",curRate, 1);
}
function setCookie( name, value, expiredays )
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
 
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 "";
}
