
//
// ESTABLISH BROWSER AND PLATFORM
// ADAPTED FROM NETSCAPE WITH PERMISSION
//

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;
var redriectUrl, e;
redirectUrl = "/browser_update.html"


if (checkIt('konqueror')) {
	 browser = "Konqueror";
	 OS = "Linux";
}
else if (checkIt('safari'))  browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera'))   browser = "Opera"
else if (checkIt('webtv'))   browser = "WebTV";
else if (checkIt('icab'))    browser = "iCab"
else if (checkIt('msie'))    browser = "Internet Explorer"
else if (!checkIt('compatible')) {
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS) {
	 if (checkIt('linux'))    OS = "Linux";
	 else if (checkIt('x11')) OS = "Unix";
	 else if (checkIt('mac')) OS = "Mac"
	 else if (checkIt('win')) OS = "Windows"
	 else OS = "an unknown operating system";
}


function checkIt(string) {
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

var agt = navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

var is_nav    = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1));
var is_nav4   = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_nav5   = (is_nav && (is_major == 5));
var is_nav5up = (is_nav && (is_major >= 5));

var is_nav5dn = (is_nav && (is_major <= 5));


var is_ie    = (agt.indexOf("msie") != -1);
var is_ie4   = (agt.indexOf("msie 4")!= -1) ;
var is_ie4up = (is_ie && (is_major >= 4));
var is_ie5   = (is_ie && (is_major == 4) && (agt.indexOf("msie 5")!=-1) );
var is_ie5up = (is_ie && !is_ie4);

var is_aol   = (agt.indexOf("aol") != -1);
var is_aol4  = (is_aol && is_ie4);

var is_opera = (agt.indexOf("opera") != -1);
var is_webtv = (agt.indexOf("webtv") != -1);

var is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
var is_mac = (agt.indexOf("mac")!=-1);

var nscp4 = is_nav4
var ie4   = is_ie4
var dom1  = (is_nav5up || is_ie5up)
var is_ns622up

if (is_mac && is_ie5)  dom1 = false




function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
  document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
  if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
  obj.visibility=v; }
}



// first level navs & dropdowns

bgnav1_off = "#7C7C7C";
bgnav1_on  = "#999999";

bgnav2_off = "#999999";
bgnav2_on  = "#B5B5B5";


// static second level nav

//bgnav3_on  = "#DE0031";
bgnav3_off = "#E8E8E8";
bgnav3_on ="#969eb5";


// third level nav

bgnav4_off = "#7C7C7C";
bgnav4_on = "#2e6099";


// static second level nav

nav3_on  = "#fff";
nav3_off = "#353431";


// static second level nav

nav4_off = "#fff";
nav4_on  = "#fff";


// for DT

bgnav5_off = "#6785A7";
bgnav5_on ="#2e6099";

nav5_on = "#ffffff";
nav5_off = "#B5D3F7";

//hs add
bgnav6_on = "#ccd0de";
bgnav6_off = "#969eb5"


// follow link
// called by <TD> onClick event  
	
function follow_url(url) {
  document.location.href = url;		
}


var menunum;

// initialize menu timer
// used in DHTML menus 
menuTimer = "";
menuSelected = "";


// menu controller
// num = number concatenated to menu to = id of layer to be turned on
// ele = element to get background color changed usually "this"
// style = which background color does it get.

function menu (num,ele,style) {

  menunum = "menu" + num;
  menuClose(num);
	
  menuOpen(menunum);
  if (style != 0) slink (ele,style,num);
  setClose(false);
 
}




// open menus 

function menuOpen(menunum) {
	
  if (is_ie) {
		document.all[menunum].style.visibility='visible';		
  }
  else {
		if (is_nav5up)  document.getElementById(menunum).style.visibility = 'visible';
		else				 document.layers[menunum].visibility = 'visible';		
  }	
		
}





// highlights the related levelone nav

function slinkL1(num, level1nav) {
  
  on2 = bgnav1_on;
  setClose(false);	
  
  if (num == 2 ) {
  	   if (is_ie)           o = eval("document.all.level" + level1nav );
  	   else if (is_nav5up)  o = eval("document.getElementById('level" + level1nav + "')");
	   o.style.backgroundColor = on2;
  } 

}


// highlights the related leveltwo nav

function slinkL2(obj) {

  on2 = bgnav3_on;
  setClose(false);	

  nowOnMenu_close();	// ÇöÀç ¿­·ÁÁø 1Â÷ »ó´Ü ¸Þ´º¸¦ ´Ý´Â´Ù.

  obj.style.backgroundColor = on2;
  obj.style.cursor='hand';
  obj.style.color = '#FFFFFF';

}


// highlights the related levelthree nav

function slinkL3(obj) {

  on2 = bgnav2_on;
  setClose(false);	

  obj.style.backgroundColor = on2;
  obj.style.cursor='hand';

}

function slinkL4(obj) {	// img -> image name, src-> img src

//  on2 = bgnav2_on;
  on2 = bgnav6_on;	//	¸¶¿ì½º ¿À¹ö½Ã ¹è°æ»ö
  setClose(false);	

  obj.style.backgroundColor = on2;	// Àû¿ë
  obj.style.cursor='hand';			// Ä¿¼­¸ð¾ç Àû¿ë
  obj.style.color='#000000';		// ÅØ½ºÆ® »ö»ó Àû¿ë
}





// changes the level 1 nav back to the off state
// level1nav = the # portion of the level1 nav  TD id ( "level" + level1nav ) = "leveln 
// to change

function hlinkL1 (level1nav) {

  off2 = bgnav1_off;
  
  // alert("hlinkL1-->level1nav-->"+level1nav);
  // alert("hlinkL1-->off2-->"+off2);
  
  if  (level1nav != 0) {
		if (is_ie)           o = eval("document.all.level" + level1nav );
		else if (is_nav5up)  o = eval("document.getElementById('level" + level1nav + "')");
		o.style.backgroundColor = off2;
	}	

}

function hlinkL2 (obj) {

  off2 = bgnav3_off;
  obj.style.backgroundColor = off2;
  obj.style.color = '#666666';

}


function hlinkL3 (obj) {

  off2 = bgnav2_off;
  obj.style.backgroundColor = off2;

}

function hlinkL4 (obj) {

//  off2 = bgnav2_off;
  off2 = bgnav6_off;	//	¸¶¿ì½º ¾Æ¿ô½Ã ¹è°æ»ö
  obj.style.backgroundColor = off2;
  obj.style.color = "#ffffff";
}



// changes row bgcolor on rollover

var on
var off

// show menu link highlighted
// ele = the element usually "this"
// num = the nav style 
// level1nav = which level1 element do you want to hightlight

function slink (ele, num, level1nav) {  

  on = eval("bgnav" + num + "_on");
  setClose(false);	
  slinkL1 (num, level1nav);

  nowOnMenu_remember(num);	// ÇöÀç ¿­·ÁÁø 1Â÷ »ó´Ü ¸Þ´º¸¦ ±â¾ïÇÑ´Ù.

  if (is_ie)           ele.style.backgroundColor= on;
  else if (is_nav5up)  ele.style.backgroundColor= on;
		
}



// hide menu link highlighted
// ele = the element to change (generally 'this')
// num = the nav level used to set the correct style
// level1nav = used to compute the id of the TD 

function hlink(ele, num, level1nav) {
  
  setClose(true);
  off = eval("bgnav" + num  + "_off");//alert("hlink-->off-->"+off);

  off2 = bgnav1_off ;//alert("hlink-->off2-->"+off2);
  // alert("hlink-->currsection, level1nav-->"+currsection+" ,"+level1nav);
  if (level1nav == 0) {
	   // call function to control the first level nav bg color
		hlinkL1 (level1nav);

		// change the bgcolor of "this" element back to the off state
		if (is_ie) {
			 ele.style.backgroundColor= off;	
			 ele.style.cursor='hand';
		}
		else if (is_nav5up) {
			ele.style.backgroundColor= off;	
	   }	  
  }
  
}







// begin timer to close menu

function setClose(bool){
  
  m = "menuClose()";
  
  switch(bool) {
    case true:
 		menuTimer = setTimeout(m,250);
		break;
	 case false:
		clearTimeout(menuTimer);
		break;
  }

}
function swapImg_restore(name)
{
  var nsdoc = 'document';
  var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
  if (name == '')
    return;
  if (img && img.altsrc) {
    img.src    = img.altsrc;
    img.altsrc = null;
  } 
}

function swapImg_change(name, rpath, preload)
{ 
  var nsdoc = 'document';
  var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
  if (name == '')
    return;
  if (img) {
    img.altsrc = img.src;
    img.src    = rpath;
  } 
}


// ÇöÀç ¿­·Á ÀÖ´Â 1Â÷ ¸Þ´º¸¦ ±â¾ïÇÑ´Ù.
// menu include ÆÄÀÏ¿¡ "nowOnMenuNo" °ªÀ» ÀúÀåÇÒ °ø°£ ÇÊ¿ä 
// <input type="hidden" id="nowOnMenuNo" value="">

function nowOnMenu_remember(no){
	if(no != "") {
		document.getElementById("nowOnMenuNo").value = "";
		document.getElementById("nowOnMenuNo").value = no;
	}
	else document.getElementById("nowOnMenuNo").value = "";
}

// ÇöÀç ¿­·Á ÀÖ´Â ¸Þ´º¸¦ ´Ý´Â´Ù.
function nowOnMenu_close(){
	var tmp = document.getElementById("nowOnMenuNo").value;
	if (tmp != "") menuClose(tmp);
}