// 탭뷰
function tab1(item,num)
{
 var str="";
 for(i=1; i<=num; i++){
  if(i<10) str = "tab1_"+i;
  else str = "tab1_"+i;
  document.getElementById(str).style.display = "none";
 }
 document.getElementById(item).style.display = "";
}

// 탭뷰
function tab2(item,num)
{
 var str="";
 for(i=1; i<=num; i++){
  if(i<10) str = "tab2_"+i;
  else str = "tab2_"+i;
  document.getElementById(str).style.display = "none";
 }
 document.getElementById(item).style.display = "";
}

// 토글메뉴
function ShowContent(MenuName, ShowMenuID) {
	var i=1;
	while(document.getElementById(MenuName + i)){
		var menu=document.getElementById(MenuName + i).style;
		
		if ( i == ShowMenuID ) {
		
			if (menu.display=="block")
			{
				menu.display="none";
			} else {
				menu.display="block";
			}
		} else {
			menu.display="none";
		}
	i++;
	
	}
}

// FAQ
function faq(MenuName, ShowMenuID) {
	var i=1;
	while(document.getElementById(MenuName + i)){
		var menu=document.getElementById(MenuName + i).style;
		
		if ( i == ShowMenuID ) {
		
			if (menu.display=="block")
			{
				menu.display="none";
			} else {
				menu.display="block";
			}
		} else {
			menu.display="none";
		}
	i++;
	
	}
}

// Show Hide
function show(item,num)
{
 var str="";
 for(i=1; i<=num; i++){
  str = "item_"+i;
 document.getElementById(item).style.display = "";
}}
function hide(item,num)
{
 var str="";
 for(i=1; i<=num; i++){
  str = "item_"+i;
 document.getElementById(item).style.display = "none";
}}

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 showHide() {//v6.0
  var i,p,v,obj,args=showHide.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; }
}

// 팝업 설정
function pcenter_s_yes(theURL, name,  width, height ){
  var x = (screen.width) ? (screen.width-width)/2 : 0;
  var y = (screen.height) ? (screen.height-height)/2 : 0;  
  var pop = window.open(theURL,name,"toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+width+",height="+height+",left="+x+",top="+y);
  //pop.focus;
}

function pcenter_s_no(theURL, name,  width, height ){
  var x = (screen.width) ? (screen.width-width)/2 : 0;
  var y = (screen.height) ? (screen.height-height)/2 : 0;  
  var pop = window.open(theURL,name,"toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+width+",height="+height+",left="+x+",top="+y);
  //pop.focus;
}

// Fly Quick
function initRpMoving4Main( target, topPosition, topLimit, btmLimit ) {
    if ( ! target  )
    return false;
    var obj = target;
    obj.initTop = topPosition;
    obj.topLimit = topLimit;
    obj.bottomLimit = document.documentElement.scrollHeight  - btmLimit;
    obj.style.position = "absolute";
    obj.top  = obj.initTop;
    obj.left  = obj.initLeft;
    obj.style.top  = obj.top + "px";
    obj.getTop =  function() {
        if ( document.documentElement.scrollTop ) {
            return document.documentElement.scrollTop;
        }
        else if ( window.pageYOffset ) {
            return window.pageYOffset;
        }
        else {
            return 0;
        }
    }
    obj.getHeight =  function() {
        if ( self.innerHeight ) {
            return self.innerHeight;
        }
        else if( document.documentElement.clientHeight ) {
            return document.documentElement.clientHeight;
        }
        else {
            return 500;
        }
    }
    obj.move =  setInterval( function() {
        pos = obj.getTop() + 200; // for Ie 7 , delete 10
        if ( pos > obj.bottomLimit )
        pos = obj.bottomLimit
        if ( pos < obj.topLimit )
        pos = obj.topLimit
        interval = obj.top - pos;
        obj.top =  obj.top - interval / 3;
        obj.style.top =  obj.top + "px";
    }
    , 30 )
}

function addLoadEvent(func){
  var oldonload = window.onload;
  if(typeof window.onload != "function"){
    window.onload = func;
    } else {
      window.onload = function(){
      oldonload();
      func();
    }
  }
} 

//YOON, SUN SANG(ssaeju@naver.com)
function stripeTables(){
  if (!document.getElementById) return false; // DOM호환 브라우저인지 체크
  if (!document.getElementsByTagName) return false;
  var tables = new Array;
  tables[0] = document.getElementById("list1");
  tables[1] = document.getElementById("list2");
  tables[2] = document.getElementById("list3");
  for (var i = 0; i < tables.length; i++) {
    if (tables[i] != null) {
      var rows = tables[i].getElementsByTagName("tr");
      for (var j = 0; j < rows.length; j++) {
        if (tables[i].id == "list1") {
          if (j % 2 == 1) {
            rows[j].style.backgroundColor = "#ffc";
          }
        } else if (tables[i].id == "list2") {
          if (j % 2 == 1) {
            rows[j].style.backgroundColor = "#ccc";
          }
        } else if (tables[i].id == "list3") {
          if (j % 2 == 1) {
            rows[j].style.backgroundColor = "#656";
          }
        }
      }
    }
  }
}
addLoadEvent(stripeTables);

//YOON, SUN SANG(ssaeju@naver.com)
//GNB
var source;
function dEI(elementID){
	return document.getElementById(elementID);
}
function onTopNavi(viewNum, num){
	for(var i = 1; i < num; i++){
		var onList=dEI("item"+i);
		var onImg=onList.getElementsByTagName("img").item(0);
		if(i==viewNum){
			onList.className="on";
			var ImgCheck = onImg.src.substring(onImg.src.length-3, onImg.src.length);
			if (ImgCheck!="on.gif") {
				onImg.src = onImg.src.replace("off.gif", "on.gif");
			}
		}else{
			onList.className="";
				if (ImgCheck="on.gif") {
				onImg.src = onImg.src.replace("on.gif", "off.gif");
			}
		}
	}
}
