
// 플레시 스크립트
function setEmbed() {
  var obj = new String;
  var parameter = new String;
  var embed = new String;
  var html = new String;
  var allParameter = new String;
  var clsid = new String;
  var codebase = new String;
  var pluginspace = new String;
  var embedType = new String;
  var src = new String;
  var width = new String;
  var height = new String;

  this.init = function( getType , s ,w , h ) {
    if ( getType == "flash" ) {
      clsid = "D27CDB6E-AE6D-11cf-96B8-444553540000";
      codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0";
      pluginspage = "http://www.macromedia.com/go/getflashplayer";
      embedType = "application/x-shockwave-flash";
    }
    /* type 추가
    else if ( ) {
    }
    */
    parameter += "<param name='movie' value='"+ s + "'>\n";
    parameter += "<param name='quality' value='high'>\n";	
	parameter += "<param name='menu' value='false'>\n";
	parameter += "<param name='allowScriptAccess' value='always'>\n";
	parameter += "<param name='swliveconnect' value='true'>\n";

    src = s;
    width = w;
    height = h;
  }

  this.parameter = function( parm , value ) {
    parameter += "<param name='"+parm +"' value='"+ value + "'>\n";
    allParameter += " "+parm + "='"+ value+"'";
  }

  this.show = function() {
    if ( clsid ) {
      obj = "<object classid=\"clsid:"+ clsid +"\" codebase=\""+ codebase +"\" width='"+ width +"' height='"+ height +"'>\n";
    }

    embed = "<embed src='" + src + "' pluginspage='"+ pluginspage + "' type='"+ embedType + "' width='"+ width + "' height='"+ height +"'"+ allParameter +" allowScriptAccess=\"always\" swliveconnect=\"true\"></embed>\n";

    if ( obj ) {
      embed += "</object>\n";
    }

    html = obj + parameter + embed;
    document.write( html );
  }
}


// 마우스오버아웃
function imgOver(imgEl) { imgEl.src = imgEl.src.replace(".gif", "on.gif"); }
function imgOut(imgEl) { imgEl.src = imgEl.src.replace("on.gif", ".gif"); }


// 마우스오버
function listOver (Obj,BGColor) {
	Obj.style.backgroundColor = '#eaf6e5';
}
function listOut (Obj,BGColor) {
	Obj.style.backgroundColor = BGColor;
}


// 탭방식의 리스트
function tabOn(tabid,a) {
  for (i=1;i<=10;i++) {
    if(i<10){inn="0"+i;} else {inn=""+i;}
    tabMenu = document.getElementById("tab"+tabid+"m"+i);
    tabContent = document.getElementById("tab"+tabid+"c"+i);
    if (tabMenu) { //객체가존재하면
      if (tabMenu.tagName=="IMG") { tabMenu.src = tabMenu.src.replace("on.gif", ".gif"); } //이미지일때
      if (tabMenu.tagName=="A") { tabMenu.className=""; } //앵커일때
    }
    if (tabContent) { tabContent.style.display="none"; }
  }
  if(a<10){ann="0"+a;} else {ann=""+a;}
  tabMenu = document.getElementById("tab"+tabid+"m"+a);
  tabContent = document.getElementById("tab"+tabid+"c"+a);
//  alert(tabMenu.tagName);
  if (tabMenu) { //객체가존재하면
    if (tabMenu.tagName=="IMG") { tabMenu.src = tabMenu.src.replace(".gif", "on.gif"); } //이미지일때
    if (tabMenu.tagName=="A") { tabMenu.className="on"; } //앵커일때
  }
  if (tabContent) { tabContent.style.display="block"; }
  tabMore = document.getElementById("tab"+tabid+"more");
}



// 우측 floating
function initMoving(id,xleft,ytop) {
  target = document.getElementById(id);
  if (!target) return false;
  var obj = target;
  obj.initLeft = xleft;//절대좌표x
  obj.initTop = ytop;//절대좌표y
  obj.bottomLimit = document.documentElement.scrollHeight - 0;
  obj.topLimit = 137;

  obj.style.position = "absolute";
  obj.top = obj.initTop;
  obj.left = obj.initLeft;
  obj.style.top = obj.top + "px";
  obj.style.left = obj.left + "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() + obj.getHeight() / 2 - 310;

    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";
  }, 40)
}


/*
// 오른쪽마우스와 F5키 안먹히게 하는 방법
function keydownEvent() {
  if(event.ctrlKey == true || event.ctrlLeft == true){
	//  alert("Ctrl Key를 사용하실 수 없습니다.");
  } else if (event.button ==2) {
	//  alert("오른쪽 버튼을 사용하실 수 없습니다.");
  return;
  }
  if(event.keyCode=="116") {
    event.keyCode=0;
	event.keyCode=38;
  //  alert('F5 Key(Refresh)를 사용하실 수 없습니다.');
	event.returnValue=false; 
  }
}
function mouseEvent() {
  if(event.button ==2){
   // alert("오른쪽 버튼을 사용하실 수 없습니다.");
  return;
  }
}
document.onclick = mouseEvent;
document.ondblclick = mouseEvent;
document.onkeydown = keydownEvent;
//document.onkeypress = keydownEvent;
document.onkeyup = keydownEvent;
document.onmousedown = mouseEvent;
document.onmousesetup = mouseEvent;

*/


// 오늘하루 이창을 열지않음
function getCookie(name) {
	var nameOfCookie = name + "=";
	var x = 0;
	while ( x <= document.cookie.length ){
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) 
			endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 )
		break;
	}
	return "";
}
function setCookie_notice(name, value, expiredays){
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function startTime(){
	var time= new Date();
	hours= time.getHours();
	mins= time.getMinutes();
	secs= time.getSeconds();
	closeTime=hours*3600+mins*60+secs;
	Timer();
}
function Timer(){
	var time= new Date();
	hours= time.getHours();
	mins= time.getMinutes();
	secs= time.getSeconds();
	curTime=hours*3600+mins*60+secs
	closeTime+=60;
	if (curTime>=closeTime){
	document.getElementById('MSG_layerPopup').style.display = 'none';
	} else{
	window.setTimeout("Timer()",1000)
	document.getElementById('MSG_layerPopup').style.display = 'block';
	}
}

// 모든 카테고리 컨텐츠 보기
function totalCategoryShow(){	// 바로가기
	var Directly = document.getElementById('totalCategory').style.display;
	if (Directly=='none') {	
		document.getElementById('totalCategory').style.display='block';
		document.getElementById('category').style.display='none';
	} else {	
		document.getElementById('totalCategory').style.display='none';
		document.getElementById('category').style.display='block';
	}
}

// HD컨텐츠의 안내페이지
function HDgiude() {
	window.open ('http://cshop.diyhard.co.kr/HDgude.asp','','scrollbars=no, width=710,height=235,top=100,left=100');
}


// 메인 하단의 방송컨텐츠 링크주소
function Search_Broad1(){
		document.Broad_Info.code.value='504';
		document.Broad_Info.schMenu1.value='1';
		document.Broad_Info.schMenu2.value='0001';
		document.Broad_Info.page.value=1;
		document.Broad_Info.submit();
}
function Search_Broad2(){
		document.Broad_Info.code.value='513';
		document.Broad_Info.schMenu1.value='1';
		document.Broad_Info.schMenu2.value='0001';
		document.Broad_Info.page.value=1;
		document.Broad_Info.submit();
}
function Search_Broad3(){
		document.Broad_Info.code.value='512';
		document.Broad_Info.schMenu1.value='1';
		document.Broad_Info.schMenu2.value='0001';
		document.Broad_Info.page.value=1;
		document.Broad_Info.submit();
}