//È­¸éÈ®´ë

	var zoomRate = 20;			// È®´ë,Ãà¼Ò Å©±âºñÀ²
	var maxRate = 300;			//ÃÖ´ëÈ®´ë·ü
	var minRate = 100;			//ÃÖ¼ÒÃà¼Ò·ü

	function Screen_GetCookie(name){
		if (document.cookie != "") {
			zoomc = document.cookie.split("; ");
			for (var i=0; i < zoomc.length; i++) {
                zoomv = zoomc[i].split("="); 
                if (zoomv[0] == name) {
				    return  unescape(zoomv[1]);
                }
			}        
		}else{
			return "";
		}
	}

	function TTS_getCookie(name)
	{
		  var Found = false;
		  var start, end;
		  var i = 0;

		  while(i <= document.cookie.length){
				start = i;
				end = start + name.length;
				if(document.cookie.substring(start, end) == name) { 
					  Found = true ;
					  break;
				}
				i++;
		  }

		  if(Found == true)
		  {
				start = end + 1;
				end = document.cookie.indexOf(";", start);
	 
				if(end < start)
					  end = document.cookie.length;

				return document.cookie.substring(start, end);
		  } 
		  return "";
	}


	function Screen_SetCookie(name,value){
		document.cookie = name + "=" + escape (value)+"; path=/; ";
	}

	function GoZoom(contentid){
		if(Screen_GetCookie("zoomVal") != null && Screen_GetCookie("zoomVal") != ""){
			document.all[contentid].style.zoom = Screen_GetCookie("zoomVal");
			currZoom=Screen_GetCookie("zoomVal");
		}
		else{
			document.all[contentid].style.zoom = '100%'; 
			currZoom = '100%';
		}
	}

	function zoomplus(contentid, how) {

		if(Screen_GetCookie("zoomVal") != null && Screen_GetCookie("zoomVal") != ""){
			document.all[contentid].style.zoom = Screen_GetCookie("zoomVal");
			currZoom=Screen_GetCookie("zoomVal");
		}
		else{
			document.all[contentid].style.zoom = '100%'; 
			currZoom = '100%';
		}
		if (((how == "plus") && (parseInt(currZoom) >= maxRate)) || ((how == "minus") && (parseInt(currZoom) <= minRate)) ) {
			return; 
		}
		if (how == "plus") {
			document.all[contentid].style.zoom = parseInt(document.all[contentid].style.zoom)+zoomRate+'%';
			//document.all["main_swf2"].style.left=100;
//			document.all["movie"].style.PixelWidth=900;
			//alert(document.all["movie"].style.width);
//			document.all["movie"].Zoom(50); 
		}
		else {
			document.all[contentid].style.zoom = parseInt(document.all[contentid].style.zoom)-zoomRate+'%'
		}
		Screen_SetCookie("zoomVal",document.all[contentid].style.zoom);
	}

	document.onkeypress = getKey;
	
	function getKey(keyStroke) {
		isNetscape2=(document.layers);
		eventChooser = (isNetscape2) ? keyStroke.which : event.keyCode;
		which = String.fromCharCode(eventChooser).toLowerCase();
		which2 = eventChooser;

		var el=event.srcElement;

		if ((el.tagName != "INPUT") && (el.tagName != "TEXTAREA"))
		{			
			if(which == "+" )
				zoomplus('zoom', 'plus');
			else if(which == "-" )
				zoomplus('zoom', 'minus');
		}
	}

//ÇÁ¸°ÅÍ
function PreviewPint() {
	var win = window.open("about:blank", "ÀÎ¼âÇÏ±â","location=no, directories=no, resizable=yes, status=no, toolbar=no, menubar=no, width=620 , height=600, scrollbars=yes");
	var doc = win.document;
	doc.open();
 	doc.write("<title>ÀÎ¼âÈ­¸é</title><style>BODY,TABLE,TR,TD,INPUT,SELECT,TEXTAREA{FONT-SIZE: 9pt;font-family:±¼¸²;}</style>");
 	doc.write(document.all["printTD"].innerHTML);
	doc.write("<script language=javascript>function blockError(){return true;}window.onerror = blockError;window.print();</script>");
 	doc.close();
 }

//È­¸é Ãà¼Ò ÇÁ¸°ÅÍ Å°Á¶ÀÛ
var PLUS_KEY = 107;   //CTRL + PLUS : ÆùÆ®Å©°Ô
var MINUS_KEY = 109; //CTRL + MINUS : ÆùÆ®ÀÛ°Ô
var T_KEY = 84;	         //CTRL + T : ¸ÞÀÎÆäÀÌÁö·ÎÀÌµ¿
var P_KEY = 80;	         //CTRL + P : ÇÁ¸°Æ®
var ENTER_KEY = 13;

function document.onkeydown() {

	var key = event.keyCode;
	var ctrlKey = event.ctrlKey;
	
	if(ctrlKey){
		if(key == PLUS_KEY) {
			zoomplus('body_zoom','plus');
		} else if(key == MINUS_KEY) {
			zoomplus('body_zoom','minus');
		} else if(key == T_KEY) {
			location.href="/index.jsp";
		} else if(key == P_KEY) {
			PreviewPint();
		} else if(key == ENTER_KEY) {
		  if (TTS_getCookie("vcms_ok") != "done") {
				accept();
		   } 
		}
	}
}

function document.body.onload() {
   //var player = document.all["VCMS_PLAYER"];
   if (TTS_getCookie("vcms_ok") != "done") {
	//	player.Filename = "/webcdc/ogg/plugin.asf";
		document.voice_img.src="/images/main/button_top3.gif"
   } else {
	    window.focus();
	//	player.Filename = "";
		document.voice_img.src="/images/main/button_top4.gif"
  }
	GoZoom("body_zoom");  //È­¸éÈ®´ë ÃÊ±â ¼¼ÆÃ ÇÔ¼ö
}

function accept() {
//	var player = document.all["VCMS_PLAYER"];
//	try {
//		player.stop();
//	} catch(e) {}
	top.location.href="/index_tts.htm";
}

function voiceimg(){

   if (TTS_getCookie("vcms_ok") != "done") {		
		top.location.href="/index_tts.htm";
   } else {
		top.location.href="/index.jsp";
  }

}
