var agt=navigator.userAgent.toLowerCase();
var is_win2k = ((agt.indexOf("windows nt 5.0")!=-1));

//Default value
var zoomRate = 20;			//Screen Up/Down Rate
var maxRate = 200;			//Max Rate
var minRate = 100;			//Min Rate
var fontColorIndex = "";	//fontColorIndex Defalut('')
var bgColorIndex = "";		//fontColorIndex Defalut('')

//control Setting//
if (!ENV_NaviOnImagePath){var ENV_NaviOnImagePath=""; }
if (!ENV_NaviOnffImagePath){var ENV_NaviOnffImagePath="";}
if (!ENV_NaviOnText){var ENV_NaviOnText=""; }
if (!ENV_NaviOffText){var ENV_NaviOffText=""; }

var otder_browser = "F";

// coment // 
var comment1_kor = "NetLight는 Internet  Explorer 에서만 지원합니다.";
var comment1_eng = "NetLight is only compatibale with Internet  Explorer.";
var comment2_kor = "음성서비스중일때만 동작합니다.";
var comment2_eng = "NetLight works with Voice-service.";
// File Info
var SpacePath = "child/";
var wavSpacePath = "/child/";
var ENV_LicenseKey;
var ENV_LicenseType;
//

var ENV_ConfigFilePath;
if(NetLightSpec=="6C7981EE") ENV_ConfigFilePath = SpacePath  + "NetLight2/Config_Kor.js";
else ENV_ConfigFilePath = SpacePath  + "NetLight2/Config_Kor_main.js";

var SpaceLangIndex		= ENV_ConfigFilePath.indexOf("_");
var SpaceLang			= ENV_ConfigFilePath.substring((SpaceLangIndex+1),(SpaceLangIndex+4));

var objecTag;
//fucntion code//
var Hk_VolumeUp_F	= GetHotKeyHiWord(Hk_VolumeUP);
var Hk_VolumeDown_F = GetHotKeyHiWord(Hk_VolumeDown);
var Hk_SpeedUp_F	= GetHotKeyHiWord(Hk_SpeedUp);
var Hk_SpeedDown_F	= GetHotKeyHiWord(Hk_SpeedDown);
var Hk_ZoomIn_F		= GetHotKeyHiWord(Hk_ZoomIn);
var Hk_ZoomOut_F	= GetHotKeyHiWord(Hk_ZoomOut);

//event code//
var Hk_VolumeUp_Code	= GetHotKeyLowWord(Hk_VolumeUP); 
var Hk_VolumeDown_Code	= GetHotKeyLowWord(Hk_VolumeDown); 
var Hk_SpeedUp_Code		= GetHotKeyLowWord(Hk_SpeedUp);
var Hk_SpeedDown_Code	= GetHotKeyLowWord(Hk_SpeedDown); 
var Hk_ZoomIn_Code		= GetHotKeyLowWord(Hk_ZoomIn);
var Hk_ZoomOut_Code		= GetHotKeyLowWord(Hk_ZoomOut);

//init  Setting.//
if (!ENV_NaviActive){var ENV_NaviActive="";}
var VoiceActive  = "stop"; //(ENV_VoiceActive) ? "start" : "stop";
var NaviActive	 = (ENV_NaviActive) ? "start" : "stop";
var VoiceVolume  = ENV_VoiceVolume;  
var VoiceSpeed	 = ENV_VoiceSpeed;
var NetLightSpec = ENV_NetLightSpec;		////1:Ent, 0:std


/********************************************************
Cookie Read
********************************************************/

function Space_ReadCookie( str )
{
  var key = str + "=";
  var key_len = key.length;
  var cookie_len = document.cookie.length;

  var i = 0;
  while ( i <= cookie_len ){
    var j = i + key_len;
    if ( document.cookie.substring( i, j ) == key ){
		var cookie_end = document.cookie.indexOf( ";", j );
		if ( cookie_end == -1 )
			cookie_end = document.cookie.length;
		return unescape( document.cookie.substring( j, cookie_end ) );
    }
    i = document.cookie.indexOf( " ", i ) + 1;

    if ( i == 0 )  break;
  }
  return "";
}
/********************************************************
Cookie Write
********************************************************/
function Space_SetCookie( key, value, term ){
	if ( term >= 0){
		var expire = new Date();  
		expire.setDate( expire.getDate() + term );
		document.cookie = key + "=" + escape( value ) + "; path=/; expires=" + expire.toGMTString() + ";";
		return;
	}
	document.cookie = key + "=" + escape( value ) + "; path=/;";
}

/********************************************************
IsInstalled
********************************************************/
function IsInstalled(){
	if ( window.ActiveXObject ) {
		try {
		var objInstall = new ActiveXObject("NetLightCOM_OCX_2.0.1");
		ret = objInstall.IsInstall;
			return true;
		} catch (e) {
			return false;
		}
		return false;
	} 
}
/********************************************************
KeyCode
********************************************************/
function GetHotKeyHiWord ( nHotKey ){
	
	nHotKey = nHotKey >> 16;
	// SHIFT
	if ( (nHotKey & 0x01) == 0x01 ) return 16;
	// CONTROL
	if ( (nHotKey & 0x02) == 0x02 ) return 17;
	// ALT
	if ( (nHotKey & 0x04) == 0x04 ) return 18;
	
	return 0;
}

/********************************************************
KeyCode
********************************************************/
function GetHotKeyLowWord ( nHotKey ){
	return nHotKey & 0xffff;
}
/********************************************************
Key Control Event 
********************************************************/
function KeyCtrl(value){
	var KeyCode = false;  //alert(value);
	if (value ==  "18"){
		KeyCode	= (window.event) ? event.altKey		: e.altKey;
	}else if (value == "17"){
		KeyCode	= (window.event) ? event.ctrlKey	: e.ctrlKey;
	}else if (value == "16"){
		KeyCode	= (window.event) ? event.shiftKey	: e.shiftKey;
	}
	return KeyCode;
}
/********************************************************
domain Check 
********************************************************/

if ( CompareDomain( "uni.uilib.net", document.domain )!= -1){
	ENV_LicenseKey = "BB2391FCF252B941EAB834E5787E0A1AADA8CD7D9BAB6323EDCB090C28A64FB6";	 
	ENV_LicenseType = "1";
}
if ( CompareDomain( "www.uilib.net", document.domain )!= -1){
	ENV_LicenseKey = "BB2391FCF252B941EAB834E5787E0A1AADA8CD7D9BAB6323EDCB090C28A64FB6";	 
	ENV_LicenseType = "1";
}
if ( CompareDomain( "ucl.uilib.net", document.domain )!= -1){
	ENV_LicenseKey = "BB2391FCF252B941EAB834E5787E0A1AADA8CD7D9BAB6323EDCB090C28A64FB6";	 
	ENV_LicenseType = "1";
}

/********************************************************
domain Check Function. 
********************************************************/
function CompareDomain( targetDomain, CurDomain ){
	return CurDomain.lastIndexOf( targetDomain, CurDomain )
}
	

/********************************************************
/*objectTag*/
/********************************************************/

objectTag="<object id=\"DynamicNetLightCOM\" codebase=\"/child/NetLight2/NetLightCOM.CAB#version="+ENV_CAB_Version+"\" classid=\"CLSID:361C609B-6CF3-4487-A6AB-0705343B53FC\" STYLE=\"width:0px;height:0px\">";
objectTag+= "<param name=\"ConfigFilePath\" value=\""+ENV_ConfigFilePath+"\" />";
objectTag+= "<param name=\"LicenseKey\" value=\""+ENV_LicenseKey+"\" />";
objectTag+= "<param name=\"LicenseType\" value=\""+ENV_LicenseType +"\" />";
objectTag+= "</object>";
/*ControlbarVisible 여기에 삽입해야 할듯*/
/* VoicePlayer */

document.write('<object id="VoicePlayer" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" style="display: none; visibility: hidden;width:0px;height:0px;" VIEWASTEXT><param name="FileName" value=""></param><param name="AutoStart" value="False"></param><param name="AnimationAtStart" value="0"></param><param name="AutoSize" value="0"></param><param name="ShowControls" value="0"></param><param name="ShowPositionControls" value="0"></param><param name="ShowStatusBar" value="0"></param><param name="ShowDisplay" value="0"></param></object>');

/* HotKey */
if (window.ActiveXObject){
document.onkeydown = KeyPressOK;
}
function KeyPressOK(){
	var KeyID	= (window.event) ? event.keyCode	: e.keyCode;					//IE,FireFox Event
	if (!window.ActiveXObject) {
			if (KeyID == 120 || KeyID == 122 || KeyID == 123){
				alert(comment1_kor);	
				if(SpaceLang == "Kor")	{ alert(comment1_kor);	}
				else					{ alert(comment1_eng);	}
			}
		return;
	}
	
	/*HotKey Volum,Speed,Screen,reset*/
	if(KeyCtrl(Hk_VolumeUp_F) && (KeyID==Hk_VolumeUp_Code))		{	NetReader("VolumUp");}		// alt Or ctrl Or shift +  : Voice Volum Up
	if(KeyCtrl(Hk_VolumeDown_F) && (KeyID==Hk_VolumeDown_Code))	{	NetReader("VolumDown");}	// alt Or ctrl Or shift +  : Voice Volum Down
	if(KeyCtrl(Hk_SpeedUp_F) && (KeyID==Hk_SpeedUp_Code))		{	NetReader("SpeedUp");}		// alt Or ctrl Or shift +  : Voice Speed Up	
	if(KeyCtrl(Hk_SpeedDown_F) && (KeyID==Hk_SpeedDown_Code))	{	NetReader("SpeedDown");}	// alt Or ctrl Or shift +  : Voice Speed Down
	if(KeyCtrl(Hk_ZoomIn_F) && (KeyID==Hk_ZoomIn_Code))			{	NetReader("ZoomUp");}		// alt Or ctrl Or shift +  : Screen Up
	if(KeyCtrl(Hk_ZoomOut_F) && (KeyID==Hk_ZoomOut_Code))		{	NetReader("ZoomDown");}		// alt Or ctrl Or shift +  : Screen Down

	if(KeyCtrl("17") && event.keyCode == 120){ //  F9 :HelpPlayer
		event.keyCode = 0;
		if(NetLightSpec=="6C7981EE") {
			VoicePlayer.FileName = wavSpacePath+"NetLight2/wav/"+SpaceLang+"_tts_help_Ent.wav";
		}else{
			VoicePlayer.FileName = wavSpacePath+"NetLight2/wav/"+SpaceLang+"_tts_help_Std.wav";
		}
		setTimeout( "VoicePlayer.play();", 1500);	
		return false;
	}
	
	if(KeyCtrl("17")&& event.keyCode == 123){ //  F12 : Voice On/Off
		event.keyCode = 0;
		if( typeof(DynamicNetLightCOM) == "undefined" ){
			if (Space_ReadCookie("VoiceStart") == "stop") Space_SetCookie("VoiceStart", "start" , 365);
		}
		if( typeof(DynamicNetLightCOM) != "undefined" ){
			if (Space_ReadCookie("VoiceStart") == "start"){
				VoicePlayer.FileName = wavSpacePath+"NetLight2/wav/"+SpaceLang+"_tts_stop.wav";
				setTimeout( "VoicePlayer.play();", 1500);		
				f_VoiceStart("stop");
			}else{
				VoicePlayer.FileName = wavSpacePath+"NetLight2/wav/"+SpaceLang+"_tts_start.wav";
				setTimeout( "VoicePlayer.play();", 1500);		
				f_VoiceStart("start");
			}
		}else{
			f_objectInsert("voice"); //COM onload
		}
		return false;			
	}

	if(NetLightSpec=="6C7981EE") {

		if( KeyCtrl("17") && event.keyCode == 122){ // F11 : Navi On/Off
			event.keyCode = 0; 
			if(NetLightSpec=="6D7981EE") return;
			if( typeof(DynamicNetLightCOM) == "undefined" ){
				if (Space_ReadCookie("NaviStart") == "stop" || Space_ReadCookie("NaviStart") == ""){
					Space_SetCookie("NaviStart", "start" , 365);
					Space_SetCookie("VoiceStart", "start" , 365);
				}
			}
			if( typeof(DynamicNetLightCOM) != "undefined" ){
				if (Space_ReadCookie("NaviStart")=="start"){
					VoicePlayer.FileName = wavSpacePath+"NetLight2/wav/"+SpaceLang+"_tts_navistop.wav";
					setTimeout( "VoicePlayer.play();", 1500);
					f_NaviStart("stop");
				}else{
					VoicePlayer.FileName = wavSpacePath+"NetLight2/wav/"+SpaceLang+"_tts_navistart.wav";
					setTimeout( "VoicePlayer.play();", 1500);
					f_NaviStart("start");
				}
			}else{
				f_objectInsert("");
			}
			return false;
		}

	}
}

/********************************************************
ControlBar  Control 
********************************************************/
function control_function(code,value){

	switch ( code ){
		case 5100: // Voice Toggle
			f_VoiceStart("start");
			break;
		case 5101: // Voice Start
			f_VoiceStart("start");
			break;
		case 5102: // Voice Stop
			f_VoiceStart("stop");
			break;
		case 5200: // Navi Toggle
			//f_NaviStart("start");
			//break;
		case 5201: // Navi Start
			f_NaviStart("start");
			break;
		case 5202: // Navi Stop
			f_NaviStart("stop");
			break;	
		case 5501: // Zoom In
			zoomInOut("in");
			break;
		case 5502: // Zoom Out
			zoomInOut("out");
			break;
		case 5700: // Reset
			NetReader("ReSet");
			break;
		case 5601: // Font Color
			f_setFontColor(value);
			break;
		case 5602: // Bg Color
			f_setBgColor(value); 
			break;
		case 5300: // Speed
			Space_SetCookie("VoiceSpeed", value, 365 );
			break;
		case 5400: // volum
			Space_SetCookie("VoiceVolume", value, 365 );
			break;
	}
}

/********************************************************/
/* NetReader Script Code */
/********************************************************/
function NetReader(Code){
	switch ( Code ){
		case "ReSet": // Voice Toggle
			NetReSet("start");	break;			
		case "VoiceStart": // Voice Start
			f_VoiceStart("start");	break;			
		case "VoiceStop": // Voice Stop
			f_VoiceStart("stop");	break;			
		case "NaviStart": // Voice Start
			f_NaviStart("start");	break;			
		case "NaviStop": // Voice Stop
			f_NaviStart("stop");	break;			
		case "ZoomUp": // Zoom In
			zoomInOut("in");	break;			
		case "ZoomDown": // Zoom Out
			zoomInOut("out");	break;			
		case "VolumUp": // Font Color
			f_VoiceVolume("up");break;			
		case "VolumDown": // Bg Color
			f_VoiceVolume("down");	break;			
		case "SpeedUp": // Font Color
			f_VoiceSpeed("up");	break;			
		case "SpeedDown": // Bg Color
			f_VoiceSpeed("down");	break;			
		case "FontColor": // Font Color
			f_setFontColor(value);	break;			
		case "BgColor": // Bg Color
			f_setBgColor(value);	break;
	}
}
/********************************************************
VolumUp, VolumDown, SpeedUp, SpeedDown <- NetLightComment
********************************************************/
function NetLightComment(){
	if (!window.ActiveXObject) {
			if(SpaceLang=="Kor"){	alert(comment1_kor);		}
			else				{	alert(comment1_eng);	}
			if (!window.ActiveXObject) return false;
	}
	//if( Code == "VolumUp" || Code == "VolumDown" || Code == "SpeedUp" || Code == "SpeedDown" ){
	if( typeof(DynamicNetLightCOM) != "undefined" ){
			if(DynamicNetLightCOM.VoiceActive == false && DynamicNetLightCOM.NavigationActive == false){				
				if(SpaceLang=="Kor") 	alert(comment2_kor);	 
				else				 	alert(comment2_eng);		
				return false;
			}
	}else{
		if(SpaceLang=="Kor") 	alert(comment2_kor);	 
		else				 	alert(comment2_eng);	
		return false;
	}
	return true;
	//}
}
/********************************************************
objectTag insert
********************************************************/
function bodyactive(){
	var sRes = "";	
	sRes = IsInstalled();
	if(sRes){
			document.body.insertAdjacentHTML("BeforeEnd",objectTag);
	}else{
		    document.body.insertAdjacentHTML("BeforeEnd",objectTag);	
	}
}

/*******************************************************
SETUP
********************************************************/
function f_objectInsert(mode){
	var sRes = ""; 
	sRes = IsInstalled();

	if (sRes == true){
		f_ObjectInit();	//sessioncookies
	}
	if (sRes == false)
	{
		top.location.href="/child/NetLight2/ActiveX.html";
	}else{
		if (!window.ActiveXObject){
			alert(comment1_kor);
			return false;
		}else{
			document.body.insertAdjacentHTML("BeforeEnd", objectTag);
		}
	}
}

/***********************************************************
init()
***********************************************************/
function f_ObjectInit(){
	
	if (Space_ReadCookie("NetLight2COM")==""){
		Space_SetCookie("NetLight2COM", "start", -1); // Init();
	}
	//alert("net"+Space_ReadCookie("NetLight2COM"));
}
/*******************************************************
Init()
********************************************************/
function f_FontInit(){	
	if(Space_ReadCookie("fontColorIndex").length == 0){Space_SetCookie("fontColorIndex", fontColorIndex, 365);}
	if(Space_ReadCookie("bgColorIndex").length == 0){Space_SetCookie("bgColorIndex", bgColorIndex, 365);}
	if(Space_ReadCookie("zoomVal").length == 0){Space_SetCookie("zoomVal", "100%", 365);}	

	fontColorIndex = Space_ReadCookie("fontColorIndex");
	bgColorIndex = Space_ReadCookie("bgColorIndex");
	f_setFontColor(fontColorIndex);			//NetLight Com Module(Font color) 
	f_setBgColor(bgColorIndex);				//NetLight Com Module(BGColor color)
	zoomInOut("");
}

/********************************************************
Page OnLoad~~ (NetLight Controlbar Init.)
********************************************************/
function f_PageInit(){
	if(Space_ReadCookie("VoiceStart").length == 0){Space_SetCookie("VoiceStart", VoiceActive , 365);}	
	if(Space_ReadCookie("NaviStart").length == 0){Space_SetCookie("NaviStart", NaviActive , 365);}	
	if(Space_ReadCookie("VoiceVolume").length == 0 ){Space_SetCookie("VoiceVolume", VoiceVolume, 365);}
	if(Space_ReadCookie("VoiceSpeed").length == 0 ){Space_SetCookie("VoiceSpeed", VoiceSpeed, 365);}

	VoiceVolume = Space_ReadCookie("VoiceVolume");
	VoiceSpeed = Space_ReadCookie("VoiceSpeed");

	var res = NetlightObjectType(NetLightCOM);
	if( res ){
		f_VoiceStart(Space_ReadCookie("VoiceStart"));
		f_NaviStart(Space_ReadCookie("NaviStart"));		
	}

	if( typeof(DynamicNetLightCOM) != 'undefined' ){	
		VoiceVolume = parseFloat(VoiceVolume);
		NetLightCOM.VoiceVolume=VoiceVolume;		//NetLight Com Module(Volume)  
		VoiceSpeed = parseFloat(VoiceSpeed);
		NetLightCOM.VoiceSpeed=VoiceSpeed;		//NetLight Com Module(Speed) 
	}	
	f_FontInit();	
}
/********************************************************
ReSet
********************************************************/
function NetReSet(){
	
	Space_SetCookie("VoiceSpeed", "3", 365);
	Space_SetCookie("VoiceVolume", "3", 365);
	Space_SetCookie("zoomVal", "100%", 7);


	if( typeof(DynamicNetLightCOM) != 'undefined' ){
		f_VoiceStart(VoiceActive);
		f_NaviStart(NaviActive);
		NetLightCOM.VoiceSpeed="3";
		NetLightCOM.VoiceVolume="3";
	}

	zoomInOut("");
	f_setBgColor("");
	f_setFontColor("");
}
/*******************************************************
Voice Setting
********************************************************/
function f_VoiceStart(str){	
	if( typeof(DynamicNetLightCOM) == "undefined" ){
		if (Space_ReadCookie("VoiceStart") == "stop") Space_SetCookie("VoiceStart", "start" , 365);
	}
	if( typeof(DynamicNetLightCOM) != 'undefined' ){
		if( str == "start" ){
			DynamicNetLightCOM.VoiceActive=true;
				document.getElementById("VoiceStart").src=ENV_VoiceOnImagePath;
				document.getElementById("VoiceStart").alt=ENV_VoiceOnText;
//				document.getElementById("VoiceStart").onclick = function() { NetReader('VoiceStop'); return false;} 
//				document.getElementById("VoiceStart").onkeypress = function() { NetReader('VoiceStop'); return false;} 
				document.getElementById("VoiceLink").onclick = function() { NetReader('VoiceStop'); return false;} 
				document.getElementById("VoiceLink").onkeypress = function() { NetReader('VoiceStop'); return false;} 

		}else if( str == "stop"){
			DynamicNetLightCOM.VoiceActive=false;			
				document.getElementById("VoiceStart").src=ENV_VoiceOffImagePath;
				document.getElementById("VoiceStart").alt=ENV_VoiceOffText;
//				document.getElementById("VoiceStart").onclick = function() { NetReader('VoiceStart'); return false;}
//				document.getElementById("VoiceStart").onkeypress = function() { NetReader('VoiceStart'); return false;}
				document.getElementById("VoiceLink").onclick = function() { NetReader('VoiceStart'); return false;}
				document.getElementById("VoiceLink").onkeypress = function() { NetReader('VoiceStart'); return false;}
			
			f_NaviStart("stop");
		}
		Space_SetCookie("VoiceStart", str, 365);
	}else{
		f_objectInsert("voice");		//
	}	
}
/*******************************************************
Navi Setting
********************************************************/
function f_NaviStart(str){
	if(NetLightSpec=="6D7981EE") {
		DynamicNetLightCOM.NavigationActive=false;
		return;
	}
	if( typeof(DynamicNetLightCOM) != 'undefined' ){
		if( str == "start" ){
			DynamicNetLightCOM.NavigationActive=true;
			if (ENV_ControlbarVisible == "6D7981EE" && ENV_NaviOnImagePath != "")
			{
				document.getElementById("NaviStart").src=ENV_NaviOnImagePath;
				document.getElementById("NaviStart").alt=ENV_NaviOnText;
//				document.getElementById("NaviStart").onclick= function(){NetReader('NaviStop'); return false;}
//				document.getElementById("NaviStart").onkeypress= function(){NetReader('NaviStop'); return false;}
				document.getElementById("NaviLink").onclick= function(){NetReader('NaviStop'); return false;}
				document.getElementById("NaviLink").onkeypress= function(){NetReader('NaviStop'); return false;}
			}else{
				
			}
			f_VoiceStart("start");
		}else if( str == "stop"){
			DynamicNetLightCOM.NavigationActive=false;
			if (ENV_ControlbarVisible == "6D7981EE" && ENV_NaviOnImagePath != "")
			{
				document.getElementById("NaviStart").src=ENV_NaviOffImagePath;
				document.getElementById("NaviStart").alt=ENV_NaviOffText
//				document.getElementById("NaviStart").onclick=function(){NetReader('NaviStart'); return false;}
//				document.getElementById("NaviStart").onkeypress=function(){NetReader('NaviStart'); return false;}
				document.getElementById("NaviLink").onclick=function(){NetReader('NaviStart'); return false;}
				document.getElementById("NaviLink").onkeypress=function(){NetReader('NaviStart'); return false;}
			}else{
			
			}
		}
		Space_SetCookie("NaviStart", str, 365);
	}else{
		f_objectInsert("navi");	//
	}	
}

/*******************************************************
Voice Module Volum Setting
********************************************************/
function f_VoiceVolume(mode){
	if (NetLightComment()){
		var sVol=0;
		sVol = Space_ReadCookie("VoiceVolume");	
		if( typeof(DynamicNetLightCOM) != 'undefined' ){
			if(mode=="up" && sVol<5)	sVol = parseInt(sVol)+1;
			else if(mode=="down" && sVol>1)	sVol = parseInt(sVol)-1;
			Space_SetCookie( "VoiceVolume", sVol, 1 );	//Cookie Re Setting	
			NetLightCOM.VoiceVolume = sVol;
		}
	}
}

/********************************************************
Voice Module Speed Setting
********************************************************/
function f_VoiceSpeed(mode){
	if (NetLightComment()){
		var sSpeed;
		sSpeed = Space_ReadCookie("VoiceSpeed");
		if( typeof(DynamicNetLightCOM) != 'undefined' ){
			if(mode=="up" && sSpeed < 5)	sSpeed = parseInt(sSpeed) + 1;
			else if(mode=="down" && sSpeed > 1)	sSpeed = parseInt(sSpeed) - 1;
			Space_SetCookie( "VoiceSpeed", sSpeed, 1 );	//Cookie Re Setting	
			NetLightCOM.VoiceSpeed = sSpeed;
		}
	}	
}

/********************************************************
font color
********************************************************/
function f_setFontColor(val){
	fontColorIndex = val;
	f_setFace();
	Space_SetCookie("fontColorIndex", fontColorIndex, 365);		//Font Color Save
	if( typeof(NetLightCOM) != "undefined" ){NetLightCOM.FontColor = fontColorIndex;	}//font color setting.
	
	
}

/********************************************************
Background color
********************************************************/
function f_setBgColor(val){	
	bgColorIndex = val;
	f_setFace();
	Space_SetCookie("bgColorIndex", bgColorIndex, 365);			//Background Color Save
	if( typeof(NetLightCOM) != "undefined" ){ NetLightCOM.BgColor = bgColorIndex;}	//background color setting.	
	
}

/********************************************************
Screen UP/Down
********************************************************/

function zoomInOut(how){
	if (!window.ActiveXObject){
		alert(comment1_kor);
		return false;
	}else{
			var sValue;
			if(Space_ReadCookie("zoomVal") != null && Space_ReadCookie("zoomVal") != ""){
					document.body.style.zoom = Space_ReadCookie("zoomVal")+"%";
					currZoom=Space_ReadCookie("zoomVal");
			}else{
					document.body.style.zoom = "100%"; 
					currZoom = "100%";
			}

			if ( ((how == "in") && (parseInt(currZoom) >= maxRate)) || ((how == "out") && (parseInt(currZoom) <= minRate)) ) {
				return; 
			}
			if (how == "in") {
				document.body.style.zoom = parseInt(document.body.style.zoom)+zoomRate+"%";
			}else if( how == "out" ){
				document.body.style.zoom = parseInt(document.body.style.zoom)-zoomRate+"%";
			}
			sValue = parseInt(document.body.style.zoom);	
			Space_SetCookie("zoomVal", sValue, 365);

	}
}
/*
function zoomInOut(how){
	if (!window.ActiveXObject){
		alert(comment1_kor);
		return false;
	}else{
		var sValue;
		if(Space_ReadCookie("zoomVal") != null && Space_ReadCookie("zoomVal") != "" && Space_ReadCookie("zoomVal") != "NaN"){
			document.getElementById("wrap").style.zoom = Space_ReadCookie("zoomVal")+"%";
			currZoom=Space_ReadCookie("zoomVal");
		}else{
			document.getElementById("wrap").style.zoom = "100%"; 
			currZoom = "100%";
		}

		if ( ((how == "in") && (parseInt(currZoom) >= maxRate)) || ((how == "out") && (parseInt(currZoom) <= minRate)) ) {
			return; 
		}

		if (how == "in") {
			document.getElementById("wrap").style.zoom = parseInt(document.getElementById("wrap").style.zoom)+zoomRate+"%";
		}else if( how == "out" ){
			document.getElementById("wrap").style.zoom = parseInt(document.getElementById("wrap").style.zoom)-zoomRate+"%";
		}
		sValue = parseInt(document.getElementById("wrap").style.zoom);
		
	 Space_SetCookie("zoomVal", sValue, 365);
	}
}*/

/********************************************************
Background,Font Color Change
********************************************************/
function f_setFace(){
	objs_div	= document.getElementsByTagName("div");
	objs_span	= document.getElementsByTagName("span");
	objs_td		= document.getElementsByTagName("td");
	objs_a		= document.getElementsByTagName("a");
	objs_p		= document.getElementsByTagName("P");	
	objs_li		= document.getElementsByTagName("li");
	objs_dt		= document.getElementsByTagName("dt");
	objs_dd		= document.getElementsByTagName("dd");
/*
	objFrame=document.getElementsByTagName("iframe");
	
	for (i = 0 ; i < objFrame.length;i++ ){
		objFrame[i].style.allowtransparency=true;
		objFrame[i].document.body.background="transparent";
	}*/
	f_ColorControl(objs_div,3);
	f_ColorControl(objs_span,2);
	f_ColorControl(objs_td,3);		//1 : BGColor , 2: FontColor, 3 : BGColor & FontColor
	f_ColorControl(objs_a,2);	
	f_ColorControl(objs_p,2);	
	f_ColorControl(objs_li,3);
	f_ColorControl(objs_dt,3);		
	f_ColorControl(objs_dd,3);

}
/*********************************************************/
//Color(BG or Font) Control fun. 
/*********************************************************/
function f_ColorControl(objTag, strType){
	if (typeof(objTag)=='object'){
			for (i =0; i <objTag.length ; i++ ){
					if (strType!=1) objTag[i].style.color=fontColorIndex;//fontColorIndex
					if (strType!=2)	{
						if (objTag[i].id.substring(0,19)!="NetLightBlockLayer_"){
							objTag[i].style.backgroundColor=bgColorIndex;//bgColorIndex
						}
						
					}
			}
	}
}
/********************************************************
Object 
********************************************************/
function NetlightObjectType(netlight){
	if(netlight.object){
		return true;
	}else{
		return false;
	}
}

/********************************************************
NetLight - test::::
*********************************************************/
function NetLight2COM(){
	//alert(Space_ReadCookie("NetLight2COM"));
	if (Space_ReadCookie("VoiceStart")=="start") return;
	if (Space_ReadCookie("NetLight2COM")=="start"){
		if (typeof(NetLightCOM) == "undefined") {
			f_objectInsert();	
			}
	}
}

/********************************************************
Page Onload event
*********************************************************/
if (typeof window.addEventListener != "undefined"){ //W3C Event	
	if(otder_browser == "T"){
		 if(Space_ReadCookie("VoiceStart") == 'start'){   
			window.addEventListener("load", bodyactive, false);
			window.addEventListener("load", f_FontInit, false);
		 }else{
			window.addEventListener("load", f_FontInit, false);
			window.addEventListener("load", NetLight2COM, false);
		 }
		 
	}
}else if( typeof window.attachEvent != "undefined"){	// IE
	if(Space_ReadCookie("VoiceStart") == 'start'){	
		window.attachEvent("onload",bodyactive);
		window.attachEvent("onload",f_FontInit);
	}else{
		window.attachEvent("onload",f_FontInit);
		window.attachEvent("onload",NetLight2COM);
	}
}
window.onunload = clearNetEvent;
/********************************************************
Page Onunload event 
*********************************************************/
function clearNetEvent(){
	if( typeof window.detachEvent != "undefined"){	// IE
		if(Space_ReadCookie("VoiceStart") == 'start'){	
			window.detachEvent("onunload",bodyactive);
			window.detachEvent("onunload",f_FontInit);
		}else{
			window.detachEvent("onunload",f_FontInit);
		}
	}

}

