//* image rollover *//
function overImg( obj ) {
    obj.src = obj.src.replace( 'off.gif', 'over.gif' );
}
function outImg( obj ) {
    obj.src = obj.src.replace( 'over.gif', 'off.gif' );
}
function tabChange(obj,num,imgId,total) {
	for (i=1; i<=total; i++)    {
		var imgIds = document.getElementById(imgId+i);
		var imgSrc = imgIds.getAttribute("src");
		if (i==num)    {
			document.getElementById(obj+i).style.display = '';
			imgIds.setAttribute("src",imgSrc.replace("_off","_on"));
		}
		else {
			document.getElementById(obj+i).style.display = 'none';
			imgIds.setAttribute("src",imgSrc.replace("_on","_off"));
		}
	}
}
//getFlash
function getFlash(swfName,wt,ht,id,t){
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+wt+'" height="'+ht+'" id="'+id+'">');
    document.write('<param name="movie" value="'+swfName+'">');
    document.write('<param name="quality" value="high">');
    if (t != 0)    {
        document.write('<param name="wmode" value="transparent">');
    }
    document.write('<param name="allowScriptAccess" value="always">');
    document.write('<embed src="'+swfName+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" width="'+wt+'" height="'+ht+'" allowScriptAccess="sameDomain" id="'+id+'"></embed></object>');
}
//2009-03-06
function picturView(){
	var wrap = document.getElementById("picturView");
	var Viewarea = wrap.getElementsByTagName("img")[0];
	var thumb_list = wrap.getElementsByTagName("ul")[0].getElementsByTagName("li");
	this.copyObj;
	for(var i=0; i<thumb_list.length; i++){
		var Aobj = thumb_list[i].childNodes[0];
		Aobj.onclick=function(){
			var ank = this.parentNode;
			if(ank.className=="on-c") return false;
			else if(ank.className=="end"){
				ank.className = ank.className + " on-c";
				Viewarea.src=ank.childNodes[0].childNodes[0].src.replace(".gif","_big.jpg");
				clear(ank);
			}else{
				ank.className="on-c";
				Viewarea.src= ank.childNodes[0].childNodes[0].src.replace(".gif","_big.jpg");
				clear(ank);
			}
			return false;
		}
		Aobj.onmouseover = Aobj.onclick;
		Aobj.onfocus = Aobj.onclick;
	}
	this.clear = function(obj){
		for(var i=0; i<thumb_list.length; i++){
			if(thumb_list[i]!=obj && thumb_list[i].className.indexOf("on-c") != -1){
				if(thumb_list[i].className.indexOf("end") != -1) thumb_list[i].className="end";
				else thumb_list[i].className="";
			}
		}
	}
}

// cookie
function getCookie(name){
  var cname = name + "=";
  var dc = document.cookie;
  if (dc.length > 0) {
    begin = dc.indexOf(cname);
    if (begin != -1) {
      begin += cname.length;
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
        return unescape(dc.substring(begin, end));
    }
  }
  return null;
}
function setCookie(name, value, expires, path, domain, secure) {
  document.cookie = name + "=" + escape(value) +
  ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
  ((path == null) ? "" : "; path=" + path) +
  ((domain == null) ? "" : "; domain=" + domain) +
  ((secure == null) ? "" : "; secure");
}
function delCookie (name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path == null) ? "" : "; path=" + path) +
    ((domain == null) ? "" : "; domain=" + domain) + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
    document.location.reload();
}
var firstCall = true;
function changeFontsize(fSize, increment, where) {
	if (firstCall) {
		firstCall = false;
		if (increment != "") {
			changeFontsize('12', '', where);
		}
	}
	if (document.getElementsByTagName) {
	var getElement = where && document.getElementById(where).getElementsByTagName("*") || document.getElementsByTagName("*");
	var eachElement, currentFontSize, fontIncrease, newFontSize;
	for (i=0; i<getElement.length; i++) {
		eachElement = getElement[i];
		if (increment != "") {
			currentFontSize = parseInt(eachElement.style.fontSize);
			fontIncrease = parseInt(increment);
			newFontSize = currentFontSize + fontIncrease;
		}
		else if (fSize != "") {
			newFontSize = parseInt(fSize);
		}
		if (getElement[i].tagName == "LI") {
			eachElement.style.lineHeight = Math.round(newFontSize*1.2) + "px";
		} else {
			eachElement.style.lineHeight = Math.round(newFontSize*1.4) + "px";
		}
		if( newFontSize <= 9 ) {
			newFontSize = 9;
		} else if( newFontSize >= 15){
			newFontSize = 15;
		}

		switch(getElement[i].tagName) {
			case "H2":
				eachElement.style.fontSize = (newFontSize+13) + "px"; break;
			case "H3":
				eachElement.style.fontSize = (newFontSize+6) + "px"; break;
			case "H4":
				eachElement.style.fontSize = (newFontSize+4) + "px"; break;
			case "H5":
				eachElement.style.fontSize = (newFontSize+1) + "px"; break;
			case "H6":
				eachElement.style.fontSize = (newFontSize+1) + "px"; break;
			default :
				eachElement.style.fontSize = newFontSize + "px";
		}

		setCookie('fontSize', newFontSize);
	}
	}
}


function linkURL() {
    var urlnum = selectForm.selectName.options[selectForm.selectName.selectedIndex].value;
    //var target = selectForm.selectName.options[selectForm.selectName.selectedIndex].target;

    if(urlnum == 1) url = '/home/information/history_energy.asp';
    else if(urlnum == 2) url = '/home/information/history_wheel.asp';
    else if(urlnum == 3) url = '/home/information/history_watermill.asp';
    else if(urlnum == 4) url = '/home/information/history_animaluse.asp';
    else if(urlnum == 5) url = '/home/information/history_windmill.asp';
    else if(urlnum == 6) url = '/home/information/history_energysave.asp';
    else if(urlnum == 7) url = '/home/information/history_coaluse.asp';
    else if(urlnum == 8) url = '/home/information/history_stoneoil.asp';
    else if(urlnum == 9) url = '/home/information/history_oilwar.asp';
    else if(urlnum == 10) url = '/home/information/history_comeoil.asp';
    else if(urlnum == 11) url = '/home/information/history_steam.asp';
    else if(urlnum == 12) url = '/home/information/history_watt.asp';
    else if(urlnum == 13) url = '/home/information/history_wateron.asp';
    else if(urlnum == 14) url = '/home/information/history_railway.asp';
    else if(urlnum == 15) url = '/home/information/history_caropen.asp';
    else if(urlnum == 16) url = '/home/information/history_carford.asp';
    else if(urlnum == 17) url = '/home/information/history_electric.asp';
    else if(urlnum == 18) url = '/home/information/history_riden.asp';
    else if(urlnum == 19) url = '/home/information/history_animalelec.asp';
    else if(urlnum == 20) url = '/home/information/history_energytool.asp';
	else if(urlnum == 0) url = '#';

    window.open(url, '_self', '');
}

 function isAccess(e) {

	 var keynum;
	 var ismouseClick = 1;

	 if (window.event) { //IE & Safari
		 keynum = e.keyCode;

		 //SafariÀÇ °æ¿ì ¸¶¿ì½ºÅ¬¸¯Àº keynum 0 ÀÌ ³Ñ¾î¿È
		 if (event.button == 0 || keynum == 0){
		 ismouseClick = 0;
		 }

	 } else if ( e.which ){ // Netscape/Firefox/Opera
		keynum = e.which;

		 if (keynum == 1) {
			 ismouseClick = 0;
		}
	 }

	//¸¶¿ì½º Å¬¸¯ÀÌ°Å³ª ¿£ÅÍÅ°¸¦ ´©¸¥°æ¿ì true°ª ¹ÝÈ¯
	 if ( ismouseClick == 0 || keynum == 13 ) {
		return true;
	} else {
		return false;
	 }
}

function windowclose () {
	if (/MSIE/.test(navigator.userAgent)) { 
     if(navigator.appVersion.indexOf("MSIE 8.0")>=0 || navigator.appVersion.indexOf("MSIE 7.0")>=0) {
         window.open('about:blank','_self').close();
     } else { 
        window.opener = self; 
        self.close(); 
     }  
}
}