//global
path = "";
var rootPath = "";
var siteEmail = "info@jredison.com"

// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/**
 * 함 수 명 : GetObject()
 * 기    능 : 개체 가져오기
 * 파라미터 : ObjectId -> ELEMENT ID
 * 작 성 일 : 2006.01.10, 이지미디어, 정원광
 *
 */
function GetObject(ObjectId) {
 if (document.getElementById && document.getElementById(ObjectId)) {
  return document.getElementById(ObjectId);
 } else if (document.getElementByName && document.getElementByName(ObjectId)) {
  return document.getElementByName(ObjectId);
 } else if (document.all && document.all(ObjectId)) {
  return document.all(ObjectId);
 } else if (document.layers && document.layers[ObjectId]) {
  return document.layers[ObjectId];
 } else {
  return false;
 }
}

function IsValue(v) {
	
	if (v != null && v != "" && v != "undefined") {
		return true;
	} else {
		return false;
	}
}

/*
*	button css 이동위함
*	@param : t - formchk, ay 자동폼검사를 할것 인가 y 한다.
*/
function submitGo(t,ay) {
		/* auto Form Chk */
		if (ay == 'y') {
				return validate(t.form);
		}
	
		t.form.submit();
}

/*		
*		submitGo2
*		@param	: frm , of , ob
*		return	: boolean
*/
function submitGo2(frm,of,ob) {
	
	var obEcho
	if (ob == "desc") {
		obEcho = "";
	} else {
		obEcho = "desc";
	}
		frm.of.value=of;
		frm.ob.value=obEcho;
		frm.submit();
}


function urlGo(url) {
		location.href=url;
}

/*		
*		idChk
*		param	: v (검사값)
*		return	: boolean
*/

function idChk(str) {
	var i;

	if(str.charAt(i) >= 'ㄱ' && str.charAt(i) <= 'ㅎ' || str.charAt(i) >= 'ㅏ' && str.charAt(i) <= 'ㅣ' || str.charAt(i) >= '가' && str.charAt(i) <= '항'){
		alert('Input the English');
		return false;
	}
}


/*		
*		filterValue
*		param	: v (검사값)
*		return	: var
*/
function filterValue (v) {
	
	filterStr = "'--/*";		// 필터링(여과) 될 데이타 입력

	var i;
	var rtnVal = "";

		for (i = 0; i < v.length; i++) {
			var strV = v.charAt(i);
			if (filterStr.indexOf(strV) == -1) rtnVal += strV;
		}

		return rtnVal;
}

/*		
*		filterChk - 함수 검증 끝나지 않음
*		param	: v (검사값)
*		return	: var 
*/
function filterChk (v) {
	
	filterStr = "'-/*";		// 필터링(여과) 될 데이타 입력

	var i;
	var returnVal = "n";

		for (i = 0; i < v.length; i++) {
			var strV = v.charAt(i);
			if (filterStr.indexOf(strV) == -1) {
				
			} else {
				alert("not Input the '"+filterStr+"'");
				returnVal = "y";
			}
		}

		if (returnVal == "y")	{
			alert(returnVal);
			return false;
		} else {
			return;
		}
}

/*		
*		replaceAll - 함수 검증 끝나지 않음
*		param	: searchStr (바뀔문자열) , replaceStr (바꿀문자열)
*		return	: this 
*/
String.prototype.replaceAll = function( searchStr, replaceStr )
{
var temp = this;

temp = temp.replace( /searchStr/g, replaceStr );

return temp;
}




// 체크박스 전체선택
var check = 1;
function checkAll(frm) {
	if (check) {
		for (var i = 0; i < frm.length; i++) {
			if (frm[i].type == "checkbox") {
				if (frm[i].checked)
					continue;
				else
					frm[i].checked = true;
			}
		}
		check = 0;
	} else {
		for (var i = 0; i < frm.length; i++) {
			if (frm[i].type == "checkbox") {
				if(frm[i].checked) frm[i].checked = false;
				else continue;
			}
		}
		check = 1;
	}
	return false;
}

// 체크박스 값 넘기기
function getCheckbox(frm, mod, message,t,aUrl) {
	var tmp = "";
	var i;
	var idk = false;

	//첫번째 체크 박스는 전체 선택 혹은 전체 해제 용이므로 시작을 1부터 한다. 2007-03-19 고재필 
	for (i = 1; i < frm.length; i++) {
		if (frm[i].type != "checkbox")
			continue;
		if (frm[i].checked) {
			tmp += frm[i].value + ",";
			idk = true;
		}
	}

	var confirmMsg = "";

	if (message) {
			confirmMsg = message + " 내용을 일괄 실행 하시겠습니까?";
	} else {
			confirmMsg = "선택하신 내용을 일괄 실행 하시겠습니까?";
	}

	if (idk == true) {
	
		if (confirm(confirmMsg)) {
			
			if (aUrl != "") {
				frm.action = aUrl;
			}
			
			//물음표가 있으면 쿼리스트링분기가 되어서 넘어온거
			if (frm.action.indexOf("?") > 0) {
				frm.action = frm.action + "&t="+t+"&n="+tmp.substr(0, tmp.length - 1)
			} else {
				frm.action = frm.action + "?t="+t+"&n="+tmp.substr(0, tmp.length - 1)
			}

			frm.submit();
		
		}
			
	} else {
		window.alert('실행할 내용을 선택하세요');
		return;
	}
	return false;
}


/*
	------------------------------------------------------------------------------------------
*/

// 날짜(연도)
function yearList(y,t) {

var type;
var startYear;
var lastYear;
var todayDate;
	
todayDate = new Date();

	//파라미터가 있으면 해당 타입으로...
	if (IsValue(t)) {
		type	=	t;
	}

startYear		= 1950;
lastYear		= todayDate.getFullYear() + 1;

//과거 날짜 출력
if (type == "past") {
		lastYear = todayDate.getFullYear();
} else if (type == "future") {
		startYear = todayDate.getFullYear();
		lastYear = todayDate.getFullYear()+10;
}



	if (y == null) {
		//var nowYear = todayDate.getFullYear();
		var nowYear = "";
	} else {
		var nowYear = y;
	}

	for (var i = lastYear; i >= startYear; i--) {
		document.write("<option value='" + i + "'");
		if (i == nowYear) {
			document.write(" selected");
		}
		document.write(">" + i + " year</option>");
	}
}

// 날짜(월)
function monthList(m) {
	todayDate = new Date();

	if (m == null) {
		//var nowMonth = todayDate.getMonth() + 1;
		var nowMonth = "";
	} else {
		var nowMonth = m;
	}

	for (var i = 1; i <= 12; i++) {
		if (i < 10) {
			var n = "0" + i;
		} else {
			var n = i;
		}

		document.write("<option value='" + n + "'");
		if (i == nowMonth) {
			document.write(" selected");
		}
		document.write(">" + n + " month</option>");
	}
}

// 날짜(일)
function dayList(d) {
	todayDate = new Date();

	if (d == null) {
		//var nowDay = todayDate.getDate();
		var nowDay = "";
	} else {
		var nowDay = d;
	}

	for (var i = 1; i <= edateMonth(todayDate.getFullYear(), todayDate.getMonth() + 1); i++) {
		if (i < 10) {
			var n = "0" + i;
		} else {
			var n = i;
		}

		document.write("<option value='" + n + "'");
		if (i == nowDay) {
			document.write(" selected");
		}
		document.write(">" + n + " day</option>");
	}
}

// 날짜(시간)
function hourList(h) {
	todayDate = new Date();

	if (h == null) {
		var nowHour = todayDate.getHours();
	} else {
		var nowHour = h;
	}

	for (var i = 0; i <= 23; i++) {
		if (i < 10) {
			var n = "0" + i;
		} else {
			var n = i;
		}

		document.write("<option value='" + n + "'");
		if (i == nowHour) {
			document.write(" selected");
		}
		document.write(">" + n + "시</option>");
	}
}

// 날짜(분)
function minuteList(m) {
	todayDate = new Date();

	if (m == null) {
		var nowMinute = todayDate.getMinutes();
	} else {
		var nowMinute = m;
	}

	for (var i = 0; i <= 59; i++) {
		if (i < 10) {
			var n = "0" + i;
		} else {
			var n = i;
		}

		document.write("<option value='" + n + "'");
		if (i == nowMinute) {
			document.write(" selected");
		}
		document.write(">" + n + "분</option>");
	}
}

// 날짜(초)
function secondList(s) {
	todayDate = new Date();

	if (s == null) {
		var nowSecond = todayDate.getSeconds();
	} else {
		var nowSecond = s;
	}

	for (var i = 0; i <= 59; i++) {
		if (i < 10) {
			var n = "0" + i;
		} else {
			var n = i;
		}

		document.write("<option value='" + n + "'");
		if (i == nowSecond) {
			document.write(" selected");
		}
		document.write(">" + n + "sec</option>");
	}
}

// 윤년 구하기
function checkLeapYear(y) {
	if ((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0 && y % 4000 != 0)) {
		return true;
	} else {
		return false;
	}
}

// 해당 월의 마지막 날짜 구하기
function edateMonth(y, m) {
	edate = new Array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

	if (m == 2) {
		if (checkLeapYear(y)) {
			return 29;
		} else {
			return 28;
		}
	} else {
		return edate[m];
	}
}

// 달 바꾸기
function monthChange(sel) {
	for (var i = 1; i <= 12; i++) {
		if (i < 10) {
			var n = "0" + i;
		} else {
			var n = i;
		}

		sel.options[i] = new Option(n + " month", n);
	}
}

// 날짜 바꾸기
function dateChange(sel, y, m) {
	if (m.substr(0, 1) == "0") {
		m = m.substr(1, m.length);
	}

	var edate = edateMonth(y, m);

	for (var i = sel.length - 1; i > 0; i--) {
		sel.options[i] = null;
	}

	for (var i = 1; i <= edate; i++) {
		if (i < 10) {
			var n = "0" + i;
		} else {
			var n = i;
		}

		sel.options[i] = new Option(n + " day", n);
	}
}



// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//총 add 수
var trFormNum = 0;
/*
* form_add
*	@@num@@ 값이 있으면 해당, 폼갯수대로 치환해준다.
*  @param : docId - 추가될 바운더리
*  @param : addRow - 추가될 row Html
*/
function form_add(docId, addRow) {

		trFormNum = trFormNum + 1;	//1늘려줌
		var ORow = GetObject(docId).insertRow(); 

		ORow.onmouseover = function(){ GetObject(docId).clickedRowIndex = this.rowIndex };

		 var OCell1 = ORow.insertCell();
		 OCell1.innerHTML = GetObject(addRow).innerHTML.replace(/@@num@@/g,trFormNum);

		 document.recalc();
}

/*
*	form_del
*  @param : docId - 열 삭제될 바운더리
*  @param : idx - 삭제될 바운더리네 row idx
*/
function form_del(docId,trId) {
		
		
		//idx - 지정 idx (rows 값이 있으면 그걸 지운다.
		var tbl = GetObject(docId);
	
		var iLen = tbl.rows.length;

		if (trId != null) {
				
				tbl.deleteRow(tbl.clickedRowIndex);
				
		} else {
				
				tbl.deleteRow(iLen -1);

		}
}

// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//			checkFormat
//			@param :	 v = 검사할 파일 네임 (확장자 포함) , t = image - 이미지, audio - 음성, movie - 영상 , doc - 문서
//			@return : ture or false
//
// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function checkFormat(v,t) {

//소문자로 통일
v	= v.toLowerCase();
t	= t.toLowerCase();

var imageExt	= "bmp,jpg,jpeg,gif,scr,jp2,png,wmf,pic,swf";
var audioExt		= "wma,mp2,mp3,wav,mid,cda,asx,ogg";
var movieExt	= "avi,mpg,mpeg,asf,wmv,mov,m3u";
var docExt		= "txt,doc,hwp,pdf,htm,html,ppt,gul,url,xml";

imageExtArr		=		imageExt.split(",");
audioExtArr		=		audioExt.split(",");
movieExtArr		=		movieExt.split(",");
docExtArr			=		docExt.split(",");

//객체로 생성해줌
var arrObj = eval(t + "ExtArr");
var j=0;

			for (j=0;j < arrObj.length; j++) {		

					if (v.indexOf("."+arrObj[j]) != -1 ) {
							return true;
					}	
			}
			return false;
}




function checkFormatEcho(v,t) {

//소문자로 통일
v	= v.toLowerCase();
t	= t.toLowerCase();

var imageExt	= "bmp,jpg,jpeg,gif,scr,jp2,png,wmf,pic,swf";
var audioExt		= "wma,mp2,mp3,wav,mid,cda,asx,ogg";
var movieExt	= "avi,mpg,mpeg,asf,wmv,mov,m3u";
var docExt		= "txt,doc,hwp,pdf,htm,html,ppt,gul,url,xml";

imageExtArr		=		imageExt.split(",");
audioExtArr		=		audioExt.split(",");
movieExtArr		=		movieExt.split(",");
docExtArr			=		docExt.split(",");

//객체로 생성해줌
var arrObj = eval(t + "ExtArr");
var j=0;

			for (j=0;j < arrObj.length; j++) {		

					if (v.indexOf("."+arrObj[j]) != -1 ) {
							return;
					}	
			}
			alert("입력하신 파일은 선택하신 파일타입 형식이 아닙니다");
}




//일반 온클릭 혹은 마우스 오버의 경우
//06-07-09 고재필 
function preImg_url(url,imgid) {

 document.images[imgid].style.display = "none";
 document.images[imgid].style.display = "";
 document.images[imgid].src = url.src;

 }

//자동 비율 맞추기 2006-06-28 고재필
function imgsizeAuto(v,max,type) {
				
		if (type == null || type == "") { type  = "h"; }

				if (type == "w" && v.width > max)	{
								v.width = max;
				} else if (type != "w" && v.height > max) {
								v.height = max;			
				} 

				v.style.display = '';
		
}

//자동 비율 맞추기 2006-06-28 고재필
function imgSizeFix(v,w,h) {
		
		try {
				if (v.width > w)	{
						v.width = w;
				}
				
				if (v.height > h) {
						v.height = h;			
				} 

				v.style.display = '';

		}	catch (e) {
				try {
						imgSizeFix(v,w,h);
				}
				catch (e) {
						imgSizeFix(v,w,h);
				}
		}
}

//가로 세로내에서 맞추기 2006-06-28 고재필
function imgsizeSquare (v,max) {
		
		if ( v.height > max || v.width > max)	{
						
						if (v.height > v.width) {
							v.height = max;
						} else {
							v.width = max;
						}
		}
}



//이미지 파일 새창 여는 스크립트
// 2006-06-29 고재필 수정, 기존 소스 두개 파라미터에서 한개로 수정 및 이미지 여백 남김
	winObj=null;	// 초기화
	function imgPopup(v) {
		img = new Image();
		img.src=v.src;	
		//v.style.cursor = 'pointer';
		draw();
	}

	function draw()
	{
		if(img.complete == false) 
		{
			setTimeout("draw()", "100");
			return;
		}
		
	width=img.width + 5; //이미지 너비값
	height=img.height + 42; //이미지 높이 값

	var attr ="width="+width + ",height="+height

	// 윈도우를 열고 이미지 출력.
	if(winObj != null && winObj.closed == false) 
	{	winObj.close();	}
	winObj = window.open("","imgwindow",attr + ',top=160' + ',left=200, resizable=0, scrollbars =0' );
	winObj.document.open()
	winObj.document.write("<html><body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>")

	winObj.document.write("<table height='100%' align='left' cellpadding=0 cellspacint=0 border=0 align=center valign=middle>")
	winObj.document.write("<tr><td>")
	winObj.document.write("<table cellpadding='0' cellspacing='0' style='background:url("+adminRootPath+"/images/pop_zoom_01_bg.gif) repeat-x;'><tr>")
	winObj.document.write("<td align='center'><img src='"+adminRootPath+"/images/pop_zoom_01.gif'></td>")
	winObj.document.write("<td width='100%'></td>")
	winObj.document.write("<td><img src='"+adminRootPath+"/images/pop_zoom_02.gif'></td>")
	winObj.document.write("</tR></table>")	
	winObj.document.write("</td></tr>")	
	winObj.document.write("<tr><td valign='top'><img alt='이미지를 클릭 하시면 현재창을 닫습니다' src=" + img.src + " style='cursor: hand;'" + " onClick='self.close()'")
	winObj.document.write("</td></tr></table>")

	winObj.document.write("<body><html>")
	winObj.document.close()
	}	
	
	function aviPopup(v) {
				
		// 윈도우를 열고 이미지 출력.	
		winObjavi = window.open("","aviwindow",attr + ',top=160' + ',left=200, resizable=0' );
		winObjavi.document.open()
		winObjavi.document.write("<html><body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>")

		winObjavi.document.write("<table height='100%' cellpadding=0 cellspacint=0 border=0 align=center valign=middle><tr><td>")
		winObjavi.document.write("<embed src='" + avi.src + "'")
		winObjavi.document.write("</td></tr></table>")

		winObjavi.document.write("<body><html>")
		winObjavi.document.close()
	}



 /**
 * Title : flashWrite
 * Description : flash write
 *
 * @author gggl.ko
 *
 * @param s,w,h,d,bg,t,f,l
 * 
 * @return event
 * 
 */

function flashWrite(s,w,h,d,bg,t,f,l){

	var code = "";
    code  = "<object type=\"application/x-shockwave-flash\" ";
    code +=         "classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" ";
    code +=         "codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" ";
    code +=         "width=\""+w+"\" height=\""+h+"\" id=\""+d+"\">";
    code += "<param name=\"movie\" value=\""+s+"\" />";
    code += "<param name=\"quality\" value=\"high\" />";
    code += "<param name=\"wmode\" value=\""+t+"\" />";
    code += "<param name=\"menu\" value=\"false\" />";
    code += "<param name=\"allowScriptAccess\" value=\"always\" />";
    code += "<param name=\"swliveconnect\" value=\"true\" />";
    code += "<embed src=\""+s+"\" quality=\"high\" "
    code +=        "wmode=\""+t+"\" "
    code +=        "menu=\"false\" width=\""+w+"\" height=\""+h+"\" "
    code +=        "type=\"application/x-shockwave-flash\" "
    code +=        "pluginspage=\"http://www.macromedia.com/go/getflashplayer\"> "
    code += "</embed>"
    code += "</object>"

	document.write (code);
}


 /**
 * Title : embedWrite
 * Description : flash write
 *
 * @author gggl.ko
 *
 * @param objN - 객체명 ,src - 경로 ,w - display 넓이 ,h - 높이
 * 
 * @return media play
 * 
 */
function embedWrite(objN,src,w,h) {

		var audioExt		= "wma,mp2,mp3,wav,mid,cda,asx,ogg";
		var movieExt	= "avi,mpg,mpeg,asf,wmv,mov,m3u";

		audioExtArr		=		audioExt.split(",");
		movieExtArr		=		movieExt.split(",");

		//대소문자 구분을 위해, 특정 변수로 치환
		var urlEncode	= src.toLowerCase();

		//영상 혹은 음성파일 체크
		var chkEmbed = false;

		for (var j=0;j < audioExtArr.length; j++) {		

				if (urlEncode.indexOf("."+audioExtArr[j]) != -1 ) {
						chkEmbed = true;
				}	
		}

		for (var j=0;j < movieExtArr.length; j++) {		

				if (urlEncode.indexOf("."+audioExtArr[j]) != -1 ) {
						chkEmbed = true;
				}	
		}

		//동영상 관련
		var mute		= "off";
		var pause		= "off";
		var stop		= "off";
		var display	=	"";
		var t				=	"transparent";

		if (w == 0 || h == 0 || w == "" || h == "" || chkEmbed == false ) {
			display = "none";
		}

		var	code = "<object zindex='1' classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' width="+w+" height="+h+" id='"+objN+"' style='display:"+display+";'>";
				code += "<param name='filename' value='"+src+"'>";
				code += "<param name='autostart' value='0'>";
				code += "<param name='displaymode' value='0'>";
				code += "<param name='showcontrols' value='0'>";
				code += "<param name='showaudiocontrols' value='-1'>";
				code += "<param name='showdisplay' value='0'>";
				code += "<param name='showgotobar' value='0'>";
				code += "<param name='showpositioncontrols' value='-1'>";
				code += "<param name='showstatusbar' value='0'>";
				code += "<param name='showcaptioning' value='0'>";
				code += "<param name='transparentatstart' value='0'>";
				code += "<param name='AllowChangeDisplaySize' value='true'>";
				code += "<param name='AudioStream' value='-1'>";
				code += "<param name='CurrentMarker' value='-1'>";
				code += "<param name'CurrentPosition' value='-1'>";
				code += "<param name=='Mute' value='false'>";
				code += "<param name='Volume' value='0'>";
				code += "<param name='CurrentPosition' value='10'>";

				code += "<embed zindex='1' invokeURLS='false' volume='0' loop='-1' enablecontextmenu='0' align='absmiddle' border='0' src=\""+src+"\" quality=\"high\" "
				//code +=        "wmode=\""+t+"\" "
				code +=        "menu=\"false\" width=\""+w+"\" height=\""+h+"\" "
				//code +=        "type=\"application/x-mplayer2\" "
				code +=        "  autostart=flase> "
				code += "</embed>"

				code += "</object>";

				document.write(code);
}


function embedWriteDefault(objN,src,w,h) {

		if (IsValue(src)) {
			
			var audioExt		= "wma,mp2,mp3,wav,mid,cda,asx,ogg";
			var movieExt	= "avi,mpg,mpeg,asf,wmv,mov,m3u";

			audioExtArr		=		audioExt.split(",");
			movieExtArr		=		movieExt.split(",");

			//대소문자 구분을 위해, 특정 변수로 치환
		
			
			var urlEncode	= src.toLowerCase();

			//영상 혹은 음성파일 체크
			var chkEmbed = false;

			for (var j=0;j < audioExtArr.length; j++) {		

					if (urlEncode.indexOf("."+audioExtArr[j]) != -1 ) {
							chkEmbed = true;
					}	
			}

			for (var j=0;j < movieExtArr.length; j++) {		

					if (urlEncode.indexOf("."+audioExtArr[j]) != -1 ) {
							chkEmbed = true;
					}	
			}

				if (chkEmbed == true) {

						var	code = "";

								code += "<embed id='"+objN+"' autostart=false invokeURLS='false' volume='0' loop='-1' enablecontextmenu='0' align='absmiddle' border='0' src=\""+src+"\" quality=\"high\" "
								code +=        "menu=\"false\" width=\""+w+"\" height=\""+h+"\" "
								code +=        " > "
								code += "</embed>"

								document.write(code);
				}
			}
}

/**
 * Title : embedOnOff
 * Description : 파라미터값을 통해 스톱 및 플레이
 *
 * @author gggl.ko
 *
 * @param v	 - ( 0 stop , 1 start )
 * @param btnImgObj - 이미지 객체명 - 객체를 통한 이미지 버튼 변경시, play , pause , stop 이미지 규율이 반드시 지켜져야함.
 * 
 * @return event
 * 
 */
function embedOnOff(objN,state){

//  0 연주 상태가 정의되지 않은 경우 (Undefined)
//  1 연주 정지 (Stopped)
//  2 연주 잠깐 정지 (Paused)
//  3 연주중 (Playing)
//  4 앞으로 검색 (ScanForward)
//  5 뒤로 검색 (ScanReverse)
//  6 버퍼링 (Buffering)
//  7 접속이 끝나고 서버가 데이타를 보내주기를 기다리는 상태 (Waiting)
//  8 연주 끝남 (MediaEnded)
//  9 다음 곡 준비 (Transitioning)
//10 연주 시작 준비 (Ready)
//11 재접속중 (Reconnecting)

	//btnImgObj 값이 있으면 
	var myplayer			= GetObject(objN);

				if (myplayer.PlayState < 3 && state != 2 && state != 1) {
					myplayer.Play();
					myplayer.CurrentPosition=0;
					//myplayer.PlayState = 3;

				} else if (state == 2 )	{
					myplayer.Pause();

				} else if (state == 1 )	{
					myplayer.Stop();

				}
}

/**
 * Title : SyncIframe
 * Description : Iframe 크기조절(iframe의 id 값을 넘김)
 *
 * @author gggl.ko
 *
 * @param frameId - ( frameId )
 * 
 * @return event
 * 
 */
function SyncIframe(frameId)
{
	try{
		
		var iframe = eval("document.frames."+frameId)
		var iHeight = iframe.document.body.scrollHeight
		var oBody	 = iframe.document.body;
		if(iHeight==0){
			iHeight = oBody.scrollHeight;			
		}
		var pFrame = document.getElementById(frameId)
		pFrame.style.height = iHeight + 10;

	}catch(e){
		//SyncIframe(frameId)
	}
}
		

/**
 * Title : CheckInArray()
 * Description : 배열안에 해당 값이 있는지 체크
 *
 * @author 2006.01.10, 이지미디어, 정원광
 *
 * @param Arr -> 기준 배열, Val -> 검색할 문자
 * 
 * @return boolean
 * 
 */
function CheckInArray(Arr, Val) {
	var Rtn;

	Rtn = false;

	for (var i = 0; i < Arr.length; i++) {
		if (Arr[i] == Val) {
			Rtn = true;
		} else {
			continue;
		}
	}

	return Rtn;
}

/**
 * Title : GetCookie()
 * Description : 쿠키 가져오기
 *
 * @author 2006.04.17, 이지미디어, 정원광
 *
 * @param Name -> 쿠키명
 * 
 * @return Sring
 * 
 */
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 '';
}


 /**
 * Title : SetCookie()
 * Description : 쿠키 굽기
 *
 * @author 2006.04.17, 이지미디어, 정원광
 *
 * @param Name -> 쿠키명, Value -> 쿠키값, ExpireDays -> 설정일
 * 
 * @return 
 * 
 */
function SetCookie(Name, Value, ExpireDays) {
	var TodayDate = new Date();

	TodayDate.setDate(TodayDate.getDate() + ExpireDays);
	document.cookie = Name + '=' + escape(Value) + '; path=/; expires=' + TodayDate.toGMTString() + ';'
}

// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


 /**
 * Title : printContents
 * Description : 해당 object 체크 하여 리턴 , 설정 된 size대로 출력한다.
 *
 * @author gggl.ko 2007-06-08
 *
 * @param obj
 * 
 * @return event
 * 
 */
function printDiv(obj,w,h) {
		
		
		if (IsValue(w) == false) {
				w = "100%";
		}

		if (IsValue(h) == false) {
				h = "100%";
		}

		var printArea = GetObject(obj).innerHTML ;

		newwin = window.open("", "_print", "width = "+w+" ,height = "+h+", top=0, left=0, scrollbars=no");

		var doc = "<html>\n"
					+	"	<head>\n"
					+	"		<title>Printables</title>\n"
					+	"		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"				
					+	"		<script language='javascript' src='/js/global.js'></script>\n"				
					+	"		<STYLE>img {border:0px;}</STYLE>\n"			
					+	"	</head>\n"
					+	"	<body style=\"margin:0;\">"
					+		printArea + ""
					+	"</body>\n"
					+	"</html>\n";
		
		newwin.document.write(doc);
		newwin.print();
		newwin.history.go(0);
		setTimeout("newwin.close()", 2000);
			
}

function printImg(imgUrl) {
		
		newwin = window.open(imgUrl, "_print", "top=0, left=0, scrollbars=no");
		newwin.print();
		newwin.history.go(0);
		setTimeout("newwin.close()", 2000);
}

//top버튼 제어(움직이는 배너)
function CheckUIElements()	{
		var yMenu1From, yMenu1To, yOffset, timeoutNextCheck;
		goTop.style.pixelLeft = 924;

		yMenu1From   = parseInt (goTop.style.top, 10);
		yMenu1To     = document.body.scrollTop + 160; 	// 위쪽 위치110

		timeoutNextCheck = 500;

		if ( yMenu1From != yMenu1To ) {
			yOffset = Math.ceil( Math.abs( yMenu1To - yMenu1From ) / 20 );
			if ( yMenu1To < yMenu1From )	yOffset = -yOffset;

			goTop.style.top = parseInt (goTop.style.top, 10) + yOffset;
			timeoutNextCheck = 10;
		}

		setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function MovePosition()	{
	try {
		// 페이지 로딩시 포지션
			goTop.style.top = document.body.scrollTop + 110; 	// 위쪽 위치110
			goTop.style.visibility = "visible";

			// initializing UI update timer
			CheckUIElements();

			return true;
	}
	catch (e) {
			return true;
	}
}
