﻿////////////////////////////////////////////////////////////////////////////////////
// flash 연동 관련 function
////////////////////////////////////////////////////////////////////////////////////
//
// Flash Grid Component 동작 개괄
//
// 1. flash가 로딩이 완료되면 flash ==> script dataGridLoadOk() 호출
// 2. 로딩 직후 Object 태그의 param에서 flashVars속성의 requestUrl이 존재하면 flash ==> script flash_enc() 호출
// 3. 로딩 직후 Object 태그의 param에서 flashVars속성의 requestUrl이 존재하지 않으면 멈춤
// 4. 전송 버튼을 클릭 시에 flashDataGridSend()를 호출하면 flash ==> script flash_enc() 호출
////////////////////////////////////////////////////////////////////////////////////

// Flash Grid load 완료 여부
var isFlashGridLoadOk = false;

// Flash Grid 작업중 여부
var isFlashGridWorkingOk = false;

// flashLoad(파일경로, 가로, 세로, 아이디, 배경색, 변수, 윈도우모드)
function flashLoad(url,w,h,id,bg,vars,win) {

	win = "transparent";
	
	// 플래시 코드 정의
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<param name='base' value='.'>"+
	"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' base='.' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	// 플래시 코드 출력
	document.write(flashStr);
	
	//Flash의 ExternalInterface가 Form Tag내에서 오류나는 버그를 해결하는 코드     
	eval("window." + id + " = document.getElementById('" + id + "');");

}

/***************************************
* FAQ 
***************************************/
function FAQ(id) {
var bx = document.getElementById(id);
if (bx.style.display == "block")
{
  bx.style.display="none";
} else
  {
    bx.style.display="block";
  }
}

/***************************************
* RSS ClipBoard 복사
***************************************/
function fncCopy2ClipBoard(argText)
{
  window.clipboardData.setData('Text', argText);
  alert('RSS가 복사되었습니다.\n이제 RSS리더 프로그램에 입력하세요..');
}

/***************************************
* 스크롤 탑 버튼
***************************************/
function gotop(){
  document.body.scrollTop=0;
}

/***************************************
* 페이지 focus blur
***************************************/
function bluring(){
  if (event.srcElement!=null) {
    if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
  }
}
document.onfocusin=bluring;

/***************************************
* 이미지 롤오버 ex) <img src="url" onmouseover="menuOn(this);" onmouseout="menuOut(this);"  />
***************************************/
function menuOn(imgEl)
{
  imgEl.src = imgEl.src.replace(".gif", "_on.gif");
}

function menuOut(imgEl)
{
  imgEl.src = imgEl.src.replace("_on.gif", ".gif");
}



/***************************************
* OPENER url 바꾸기
***************************************/
function opener_url(url)
{
  opener.location=url;
}


function eventPop()
{
 // window.open('/EventPop/071022/071022_pop.html','_blink','width=560,height=746,top=0, left=0,scrollbars=no,toolbar=no');
}

/***************************************
* 팝업 띄우기 - opwin();
***************************************/
function opwin(url, width, height){
 var arg = "width=" + width + ", height=" + height +", scrollbars=no, status=no, toolbars=no, resizable = no";
 var win = window.open(url, '', arg);
 if (win !=null) win.focus();
}

/***************************************
* 팝업 화면 중앙에 띄우기 - Win_pop();
***************************************/
function popWin(newwin,w,h,s){
  window.open(newwin,'','width='+w+',height='+h+',resizable=no,scrollbars='+s+',toolbars=no');
}

/***************************************
* 팝업 화면 중앙에 띄우기 - Win_pop();
***************************************/
function Win_pop(newwin,w,h,s) { // newwin:url, w:가로사이즈, h:세로사이즈, s:스크롤 여부(yes or no)
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  winprops = 'width='+w+',height='+h+',top='+wint+',left='+winl+',resizable=yes,scrollbars='+s+',toolbars=no,status=no,menu=no';
  win = window.open(newwin, "_blank", winprops)
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function Win_pop2(url, winName, w, h, s) { // newwin:url, w:가로사이즈, h:세로사이즈, s:스크롤 여부(yes or no)
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  winprops = 'width='+w+',height='+h+',top='+wint+',left='+winl+',resizable=no,scrollbars='+s+',toolbars=no,status=no,menu=no';
  win = window.open(url, winName, winprops)
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}


/***************************************
* 이미지로 바로 팝업띄우기
****************************************/
function view(what) {
  window.open("/Common/Html/ImageView.html?src="+what,'','scrollbars=yes,status=no,toolbar=no,resizable=0,location=no,menu=no,width=10,height=10');
//  var imgwin = window.open("",'WIN','scrollbars=yes,status=no,toolbar=no,resizable=0,location=no,menu=no,width=10,height=10');
//  imgwin.focus();
//  imgwin.document.open();
//  imgwin.document.write("<html>\n");
//  imgwin.document.write("<head>\n");
//  imgwin.document.write("<title>IMAGE VIEW</title>\n");
//  imgwin.document.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=euc-kr\">\n");
//
//  imgwin.document.write("<sc"+"ript>\n");
//  imgwin.document.write("function resize() {\n");
//  imgwin.document.write("pic = document.il;\n");
//
//  imgwin.document.write(" var imgw = eval(pic).width; ");
//  imgwin.document.write("  if (eval(pic).width > 800){ eval(pic).width = 800\n "); //800px보다크면 800으로
//  imgwin.document.write(" } else if(eval(pic).width < 800){ eval(pic).width = eval(pic).width\n} "); //800px보다작으면 원래크기로
//
//  imgwin.document.write(" if (eval(pic).height) { var name = navigator.appName\n");
//  imgwin.document.write("  if (name == 'Microsoft Internet Explorer') { myHeight = eval(pic).height + 40; myWidth = eval(pic).width + 10;\n");
//  imgwin.document.write("  } else { myHeight = eval(pic).height + 9; myWidth = eval(pic).width; }\n");
//  imgwin.document.write("  clearTimeout();\n");
//  imgwin.document.write("  var height = screen.height;\n");
//  imgwin.document.write("  var width = screen.width;\n");
//  imgwin.document.write("  var leftpos = width / 2 - myWidth / 2;\n");
//  imgwin.document.write("  var toppos = height / 2 - myHeight / 2; \n");
//  imgwin.document.write("  self.moveTo(leftpos, toppos);\n");
//  imgwin.document.write("  if (myWidth > width) { myWidth = width; }\n");
//  imgwin.document.write("  self.resizeTo(myWidth, myHeight+50);\n");
//  imgwin.document.write("}else setTimeOut(resize(), 100);}\n");
//  imgwin.document.write("</sc"+"ript>\n");
//
//  imgwin.document.write("</head>\n");
//  imgwin.document.write('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF">\n');
//  imgwin.document.write('내용보기\n');
//
//  imgwin.document.write("<img border=\"0\" src=\""+what+"\" name=il onload='resize();' style='cursor:pointer' onclick='window.close();'>\n");
//
//  imgwin.document.write("</body>\n");
//  imgwin.document.write("</html>\n");
//  imgwin.document.close();
}

/***************************************
* MOVIE  컨트롤 관련
***************************************/

function mplay(){ //PLAY
  document.getElementById('mdefault').style.display='block';
  document.getElementById('mplayer').play();
}
function mplayon(){ //PLAY
  document.getElementById('mplayer').play();
}
function mpause(){ //PAUSE
  document.getElementById('mplayer').pause();
}
function mstop(){ //STOP
  document.getElementById('mplayer').stop();
}




//MOVIE
function playMedia(objID, objSource, objWidth, objHeight, objStyle)
{
  document.write('<OBJECT id="' + objID + '" name="' + objID + '" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ');
  document.write('WIDTH="' + objWidth + '" HEIGHT="' + objHeight + '" ' + objStyle + '>');

  for (var i=0; i<paramInfo.length; i++) {
    document.write('<PARAM NAME="' + paramInfo[i][0] + '" VALUE="'+ paramInfo[i][1] +'">');
  }
  document.write('<embed src="' + objSource + '" width="' + objWidth + '" height="' + objHeight + '" ' + objStyle + '>');
  document.write('</OBJECT>');
}

function playMovie(objID, objSource, objWidth, objHeight, objStyle)
{
  document.write('<embed src="' + objSource + '" width=' + objWidth + ' height=' + objHeight + ' id=' + objID + ' type="application/x-mplayer2" ' + objStyle + '></embed>');
}




// 아이프레임 높이 문제
function resizeFrame(iframeObj){
        var innerBody = iframeObj.contentWindow.document.body;
        oldEvent = innerBody.onclick;
        innerBody.onclick = function(){ resizeFrame(iframeObj, 1);oldEvent; };
        var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
        iframeObj.style.height = innerHeight;
        var innerWidth = innerBody.scrollWidth + (innerBody.offsetWidth - innerBody.clientWidth);
        iframeObj.style.width = innerWidth;
        if( !arguments[1] )        /* 특정 이벤트로 인한 호출시 스크롤을 그냥 둔다. */
                this.scrollTo(1,1);
}
// tab script
var temp=1;
  function ChangeLayer(n) {
    var LIobj = document.getElementById("TAB_menu").getElementsByTagName("li");
	for(var i = 1; i <= LIobj.length; i++) {
		img = document.getElementById('tab'+i);
		if ( n == i ) {
			//img.src = "/images/news/faqTab_0"+i+"_on.gif";
			img.src = img.src.replace(i+".gif", i+"_on.gif");
		} else {
			//img.src = "/images/news/faqTab_0"+i+".gif";
			img.src = img.src.replace(i+"_on.gif", i+".gif");
		}
	}
}
function ClickLayer(n){
    var LIobj = document.getElementById("TAB_menu").getElementsByTagName("li");
	for(var i = 1; i <= LIobj.length; i++) {
		obj = document.getElementById('tab_section'+i);
		img = document.getElementById('tab'+i);
		if ( n == i ) {
			temp = n;
			obj.style.display = "block";
			//img.src = "/images/news/faqTab_0"+i+"_on.gif";
			img.src = img.src.replace(i+".gif", i+"_on.gif");
		} else {
			obj.style.display = "none";
			//img.src = "/images/news/faqTab_0"+i+".gif";
			img.src = img.src.replace(i+"_on.gif", i+".gif");
		}
	}
}

function GoTabMenu(TabName,TabNum)
{
  var f = document.contactUsForm;
  var box = document.getElementById("tabSeq");

  box.value = TabNum;
  f.submit();
}

// stab script
var tempa=1;
  function ChangeLayerS(n) {
    var LIobj = document.getElementById("TAB_Smenu").getElementsByTagName("dd");
	for(var i = 1; i <= LIobj.length; i++) {
		img = document.getElementById('sTab'+i);
		if ( n == i ) {
			//img.src = "/images/news/faqTab_0"+i+"_on.gif";
			img.src = img.src.replace(i+".gif", i+"_on.gif");
		} else {
			//img.src = "/images/news/faqTab_0"+i+".gif";
			img.src = img.src.replace(i+"_on.gif", i+".gif");
		}
	}
}
function ClickLayerS(n){
    var LIobj = document.getElementById("TAB_Smenu").getElementsByTagName("dd");
	for(var i = 1; i <= LIobj.length; i++) {
		obj = document.getElementById('sTab0'+i);
		img = document.getElementById('sTab'+i);
		if ( n == i ) {
			tempa = n;
			obj.style.display = "block";
			//img.src = "/images/news/faqTab_0"+i+"_on.gif";
			img.src = img.src.replace(i+".gif", i+"_on.gif");
		} else {
			obj.style.display = "none";
			//img.src = "/images/news/faqTab_0"+i+".gif";
			img.src = img.src.replace(i+"_on.gif", i+".gif");
		}
	}
}


// stab script0B
var tempc=1;
  function ChangeLayerSB(n) {
    var LIobj = document.getElementById("TAB_SmenuB").getElementsByTagName("dd");
	for(var i = 1; i <= LIobj.length; i++) {
		img = document.getElementById('px5mega'+i);
		if ( n == i ) {
			//img.src = "/images/news/faqTab_0"+i+"_on.gif";
			img.src = img.src.replace(i+".gif", i+"_on.gif");
		} else {
			//img.src = "/images/news/faqTab_0"+i+".gif";
			img.src = img.src.replace(i+"_on.gif", i+".gif");
		}
	}
}
function ClickLayerSB(n){
    var LIobj = document.getElementById("TAB_SmenuB").getElementsByTagName("dd");
	for(var i = 1; i <= LIobj.length; i++) {
		obj = document.getElementById('BsTab0'+i);
		img = document.getElementById('px5mega'+i);
		if ( n == i ) {
			tempc = n;
			obj.style.display = "block";
			//img.src = "/images/news/faqTab_0"+i+"_on.gif";
			img.src = img.src.replace(i+".gif", i+"_on.gif");
		} else {
			obj.style.display = "none";
			//img.src = "/images/news/faqTab_0"+i+".gif";
			img.src = img.src.replace(i+"_on.gif", i+".gif");
		}
	}
}


// tabT script
var tempB=1;
  function ChangeLayerT(q) {
    var LIobj = document.getElementById("TAB_menuT").getElementsByTagName("dd");
	for(var z = 1; z <= LIobj.length; z++) {
		img = document.getElementById('Ttab'+z);
		if ( q == z ) {			
			img.src = img.src.replace(z+".gif", z+"_on.gif");
		} else {			
			img.src = img.src.replace(z+"_on.gif", z+".gif");
		}
	}
}
function ClickLayerT(q){
    var LIobj = document.getElementById("TAB_menuT").getElementsByTagName("dd");
	for(var z = 1; z <= LIobj.length; z++) {
		
		obj = document.getElementById('sTab_section'+z);
		img = document.getElementById('Ttab'+z);
		if ( q == z ) {
			tempB = q;
			obj.style.display = "block";
			img.src = img.src.replace(z+".gif", z+"_on.gif");
		} else {
			obj.style.display = "none";
			img.src = img.src.replace(z+"_on.gif", z+".gif");
		}
	}
}

//이미지확장자체크
function ChkImgExt(filename){
  if(filename.match(/\.(gif|jpg|jpeg|png)$/i)){
    return true;
  }else{
    return false;
  }
}

//첨부파일확장자체크
function ChkFileExt(filename){
  if(filename.match(/\.(ppt|txt|zip|pdf)$/i)){
    return true;
  }else{
    return false;
  }
}

//다음 input으로 포커스 보내기
function nextJuminInput(form,input1,input2){
  var theForm = eval("document."+form);
  var ele1 = eval("theForm."+input1);
  var ele2 = eval("theForm."+input2);

  if(ele1.value.length==6){
    ele2.focus();
    return;
  }
}
