document.onkeydown = enterKey;

	function enterKey(){
	 var key = event.keyCode;
		//alert(key);
		
		if( key == "72" ){  //h home이동
			location.href='http://www.samsunglions.com';
		}
		if( key == "49" ){  //1 메인
			location.href='/textmode/main.asp';
		}
		if( key == "50" ){  //2 라이온즈 소식
			location.href='/textmode/board_news/board.asp?mN=news&pN=list&bC=0&cate=A&subCate=A1&numB=1';
		}
		if( key == "51" ){  //3 프레스 센터
			location.href='/textmode/board_news/board.asp?mN=news&pN=list&bC=0&cate=A&subCate=A2&numB=2';
		}
		if( key == "52" ){  //4 일정표
			location.href='/textmode/m_schedule/schedule_list.asp';
		}

		if( key == "53" ){  //5 이용 도움말
			location.href='/textmode/guide.asp';
		}

		if( key == "107" ){  //+ 키 
			fontPlus();
		}

		if( key == "109" ){  //- 키
			fontMinus();
		}
		
	}
	
	
	var fontSize = 120;
	var fontColorIndex = 0;
	var bgColorIndex = 0;
	
	inputHeight = new Array();
	
	inputHeight[0] = 20;
	inputHeight[1] = 22;
	inputHeight[2] = 24;
	inputHeight[3] = 26;
	inputHeight[4] = 28;	
	
	inputFont = new Array();
	
	inputFont[0] = 16;
	inputFont[1] = 18;
	inputFont[2] = 20;
	inputFont[3] = 22;
	inputFont[4] = 24;	
	
	butFont = new Array();
	
	butFont[0] = 14;
	butFont[1] = 16;
	butFont[2] = 18;
	butFont[3] = 20;
	butFont[4] = 24;		
	
	tableWidth = new Array();
	
	tableWidth[0] = 760;
	tableWidth[1] = 1000;
	tableWidth[2] = 1500;
	tableWidth[3] = 1800;
	tableWidth[4] = 2300;
		
	fontColor = new Array();
	
	fontColor[0] = "000000";
	fontColor[1] = "ffff00";
	fontColor[2] = "ffffff";
	fontColor[3] = "2222ff";
	fontColor[4] = "ff0000";
	fontColor[5] = "ff66ff";
	fontColor[6] = "00ff66";
	
	bgColor = new Array();
	
	bgColor[0] = "ffffff";
	bgColor[1] = "000000";
	bgColor[2] = "2222ff";
	bgColor[3] = "ff2222";
	bgColor[4] = "ff66ff";
	bgColor[5] = "22ff22";	

	var style;
	
	function fontPlus() { 
		if (fontSize < 280) {
			fontSize = fontSize + 40; 
			setFaceSize(); 
			table_width();
		} 
	}
	
	function fontMinus() { 
		if (fontSize > 120) {
			fontSize = fontSize - 40; 
			setFaceSize();
			table_width(); 
		} 
	}
	
	function fontColorSet(param) {
		if ( param >= 0 && param <= 6 ) {
			fontColorIndex = param;
			setFaceColor();
		}
	}
	
	function bgColorSet(param) {
		if ( param >= 0 && param <= 5 ) {
			bgColorIndex = param;
			setFaceBackground();
		}
	}	
	
	function table_width()
	{
		tbl_total.width = tableWidth[((fontSize-80)/40)];
	}
	
	function setFaceSize(){
		style = " td { font-family:dotum; line-height:150%; color: #" + fontColor[fontColorIndex] + "; font-size:" + fontSize + "%}  ";
		style = style +  " th { font-family:dotum; line-height:150%; color: #" + fontColor[fontColorIndex] + "; font-size:" + fontSize + "%}  ";
		style = style + "	 a { font-family:dotum; color: #" + fontColor[fontColorIndex] + "; text-decoration: none}  ";
		style = style + "	 A:hover { font-family:dotum; color: #" + fontColor[fontColorIndex] + "; text-decoration: underline}  ";
		style = style + "	 .w { font-family:dotum; color: #ffffff}  ";	
		style = style + " .title { FONT-WEIGHT: bold; line-height:150%; background-color: #" + bgColor[bgColorIndex] + "; font-size:" + (fontSize+60) + "%; FONT-FAMILY:Arial}  ";						
		style = style + "	 .bgc { font-family:dotum; background-color: #" + bgColor[bgColorIndex] + " }  ";
		style = style + " .bb { background-repeat:no-repeat; background-position:top left} ";
		style = style + " TEXTAREA{color:black; background-color:white; border:1px #333333 solid} ";
		style = style + "hr {height:1px; border:1px #ccc solid} ";
	
		if ( fontSize > 120 )
		{
			style = style + "	 .input1 { font-family:dotum; border:1 solid #333333; color: #" + fontColor[fontColorIndex] + "; height: "+inputHeight[((fontSize-120)/40)]+"px; width: 200px; font-size:" + inputFont[((fontSize-120)/40)] + "px}  ";
			style = style + "	 .but1 { font-family:dotum; border:1 solid #595959; background-color:#E6E6E6; color: #111111; height: "+inputHeight[((fontSize-120)/40)]+"px; width: 70px; font-size:" + butFont[((fontSize-120)/40)] + "px}  ";
			style = style + "	 .but2 { font-family:dotum; border:1 solid #595959; background-color:#E6E6E6; color: #111111; height: "+inputHeight[((fontSize-120)/40)]+"px; width: 100px; font-size:" + butFont[((fontSize-120)/40)] + "px}  ";
			style = style + "	 .choice1 { font-family:dotum; color: #111111; height: "+inputHeight[((fontSize-120)/40)]+"px; width: 200px; font-size:" + butFont[((fontSize-120)/40)] + "px}  ";
		}
		else
		{
			style = style + "	 .input1 { font-family:dotum; background-color:#FFFFFF; border:1 solid #333333; color: #111111}  ";
			style = style + "	 .but1 { font-family:dotum; border:1 solid #595959; background-color:#E6E6E6; color: #111111}  ";
			style = style + "	 .but2 { font-family:dotum; border:1 solid #595959; background-color:#E6E6E6; color: #111111}  ";
			style = style + "	 .choice1 { font-family:dotum; color: #111111}  ";
		}
		
//		for(i=0;i<document.styleSheets.length;i++)
//			document.styleSheets[i].cssText= style;
		document.styleSheets[0].cssText= style;
		
		SetCookie("sitefontsize",fontSize,"","/","");
	}
	
	function setFaceColor(){
		style = " td { font-family:dotum; line-height:150%; color: #" + fontColor[fontColorIndex] + "; font-size:" + fontSize + "%}  ";				
		style = style + "	 a { font-family:dotum; color: #" + fontColor[fontColorIndex] + "; text-decoration: none}  ";
		style = style + "	 A:hover { font-family:dotum; color: #" + fontColor[fontColorIndex] + "; text-decoration: underline}  ";
		style = style + "	 .w { font-family:dotum; color: #ffffff}  ";	
		style = style + " .title { FONT-WEIGHT: bold; line-height:150%; color: #" + fontColor[fontColorIndex] + "; background-color: #" + bgColor[bgColorIndex] + "; font-size:" + (fontSize+60) + "%; FONT-FAMILY:Arial}  ";						
		style = style + "	 .bgc { font-family:dotum; background-color: #" + bgColor[bgColorIndex] + " }  ";
		style = style + " .bb { background-repeat:no-repeat; background-position:top left} ";
		style = style + " TEXTAREA{color:black; background-color:white; border:1px #333333 solid} ";
		style = style + "hr {height:1px; border:1px #ccc solid} ";

		if ( fontSize > 120 )
		{
			style = style + "	 .input1 { font-family:dotum; border:1 solid #333333; color: #111111; height: "+inputHeight[((fontSize-120)/40)]+"px; width: 200px; font-size:" + inputFont[((fontSize-120)/40)] + "px}  ";
			style = style + "	 .but1 { font-family:dotum; border:1 solid #595959; background-color:#E6E6E6; color: #111111; height: "+inputHeight[((fontSize-120)/40)]+"px; width: 70px; font-size:" + butFont[((fontSize-120)/40)] + "px}  ";
			style = style + "	 .but2 { font-family:dotum; border:1 solid #595959; background-color:#E6E6E6; color: #111111; height: "+inputHeight[((fontSize-120)/40)]+"px; width: 100px; font-size:" + butFont[((fontSize-120)/40)] + "px}  ";
			style = style + "	 .choice1 { font-family:dotum; color: #111111; height: "+inputHeight[((fontSize-120)/40)]+"px; width: 200px; font-size:" + butFont[((fontSize-120)/40)] + "px}  ";
		}
		else
		{
			style = style + "	 .input1 { font-family:dotum; background-color:#FFFFFF; border:1 solid #333333; color: #111111}  ";
			style = style + "	 .but1 { font-family:dotum; border:1 solid #595959; background-color:#E6E6E6; color: #111111}  ";
			style = style + "	 .but2 { font-family:dotum; border:1 solid #595959; background-color:#E6E6E6; color: #111111}  ";
			style = style + "	 .choice1 { font-family:dotum; color: #111111}  ";
		}
		
//		for(i=0;i<document.styleSheets.length;i++)
//			document.styleSheets[i].cssText= style;
		document.styleSheets[0].cssText= style;
		
		SetCookie("sitefontcolor",fontColorIndex,"","/","");
	}
	
	function setFaceBackground(){
		style = " td { font-family:dotum; line-height:150%; color: #" + fontColor[fontColorIndex] + "; font-size:" + fontSize + "%}  ";				
		style = style + "	 a { font-family:dotum; color: #" + fontColor[fontColorIndex] + "; text-decoration: none}  ";
		style = style + "	 A:hover { font-family:dotum; color: #" + fontColor[fontColorIndex] + "; text-decoration: underline}  ";
		style = style + "	 .w { font-family:dotum; color: #ffffff}  ";	
		style = style + " .title { FONT-WEIGHT: bold; line-height:150%; color: #" + fontColor[fontColorIndex] + "; background-color: #" + bgColor[bgColorIndex] + "; font-size:" + (fontSize+60) + "%; FONT-FAMILY:Arial}  ";						
		style = style + "	 .bgc { font-family:dotum; background-color: #" + bgColor[bgColorIndex] + " }  ";
		style = style + " .bb { background-repeat:no-repeat; background-position:top left} ";
		style = style + " TEXTAREA{color:black; background-color:white; border:1px #333333 solid} ";
		style = style + "hr {height:1px; border:1px #ccc solid} ";

		if ( fontSize > 120 )
		{
			style = style + "	 .input1 { font-family:dotum; border:1 solid #333333; color: #111111; height: "+inputHeight[((fontSize-120)/40)]+"px; width: 200px; font-size:" + inputFont[((fontSize-120)/40)] + "px}  ";
			style = style + "	 .but1 { font-family:dotum; border:1 solid #595959; background-color:#E6E6E6; color: #111111; height: "+inputHeight[((fontSize-120)/40)]+"px; width: 70px; font-size:" + butFont[((fontSize-120)/40)] + "px}  ";
			style = style + "	 .but2 { font-family:dotum; border:1 solid #595959; background-color:#E6E6E6; color: #111111; height: "+inputHeight[((fontSize-120)/40)]+"px; width: 100px; font-size:" + butFont[((fontSize-120)/40)] + "px}  ";
			style = style + "	 .choice1 { font-family:dotum; color: #111111; height: "+inputHeight[((fontSize-120)/40)]+"px; width: 200px; font-size:" + butFont[((fontSize-120)/40)] + "px}  ";
		}
		else
		{
			style = style + "	 .input1 { font-family:dotum; background-color:#FFFFFF; border:1 solid #333333; color: #111111}  ";
			style = style + "	 .but1 { font-family:dotum; border:1 solid #595959; background-color:#E6E6E6; color: #111111}  ";
			style = style + "	 .but2 { font-family:dotum; border:1 solid #595959; background-color:#E6E6E6; color: #111111}  ";
			style = style + "	 .choice1 { font-family:dotum; color: #111111}  ";
		}
		
		
//		for(i=0;i<document.styleSheets.length;i++)
//			document.styleSheets[i].cssText= style;
		document.styleSheets[0].cssText= style;
		
		SetCookie("sitebgcolor",bgColorIndex,"","/","");
	}

	function setFontCookie(){
		//return;
		//DeleteCookie("sitefontsize","/","")
		if(GetCookie("sitefontsize") == null)
		{
			fontSize = 120;
		}
		else
		{
			fontSize= GetCookie("sitefontsize");
		}
			
		if(GetCookie("sitefontcolor") == null)
			fontColorIndex = 0;
		else
			fontColorIndex= GetCookie("sitefontcolor");	
			
		if(GetCookie("sitebgcolor") == null)
			bgColorIndex = 0;
		else
			bgColorIndex= GetCookie("sitebgcolor");		
			
		if (fontSize==0)
		{
			fontSize = 120;
		}
		
		table_width();
			
		fontSize = fontSize * 1;
		//alert(fontSize)	;
		setFaceSize();	
	}
	
	function SetCookie (name,value,expires,path,domain) { 
		document.cookie = name + "=" + escape (value) + 
		((expires) ? "; expires=" + expires.toGMTString() : "") + 
		((path) ? "; path=" + path : "") + 
		((domain) ? "; domain=" + domain : ""); 
	}
	
	function GetCookie (name) { 
		var arg = name + "=";
		var alen = arg.length;
		var clen = document.cookie.length;
		var i = 0;
		while (i < clen) {
			var j = i + alen;
			if (document.cookie.substring(i, j) == arg)
			 return getCookieVal (j); 
			i = document.cookie.indexOf(" ", i) + 1; 
			if (i == 0) break;
		} 
		return null;
	} 
	
	function getCookieVal (offset) {
		var endstr = document.cookie.indexOf (";", offset); 
		if (endstr == -1)
			endstr = document.cookie.length;
		return unescape(document.cookie.substring(offset, endstr));
	} 
	
	function DeleteCookie (name,path,domain) { 
		if (GetCookie(name)) { 
			document.cookie = name + 
			"=" +((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			"; expires=Thu, 01-Jan-70 00:00:01 GMT"; 
		} 
	} 
	
	function ChangeFontColor(theForm)
	{
		if(theForm.ColorIndex.selectedIndex != 0) {
			fontColorSet(theForm.ColorIndex.selectedIndex-1);
		}
	}
	
	function ChangeBgColor(theForm)
	{
		if(theForm.BgColorIndex.selectedIndex != 0) {
			bgColorSet(theForm.BgColorIndex.selectedIndex-1);
		}
	}
			
	