function flash_load(swf,w,h,fname){
str  = '' 
str += '<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 width='+w+' height='+h+' id='+fname+'>'
str += '<param name=movie value=/fla/'+swf+'>'
str += '<param name=quality value=high>'
str += '<param name=wmode value=transparent>'
str += '<embed src=/fla/'+swf+' quality=high pluginspage=http://www.macromedia.com/go/getflashplayer type=application/x-shockwave-flash width='+w+' height='+h+' name='+fname+'></embed>' 
str += '</object>'

document.write( str );
}

/*********************************** 2005-04-18 유현우 내용추가 시작****************************************/
function Link(num){ 
	switch (num)
	{
		case 0: document.location.href="/index.asp";//홈
			break;
		case 1: document.location.href="/e_index.asp";//영문 javascript:alert('공사중 입니다')
			break;
		case 2: document.location.href="/c_index.asp";//중문 javascript:alert('Under Construction')
			break;
		case 3: document.location.href="/sitemap.asp";//사이트맵
			break;
		case 4: document.location.href="mailto:sales@recycleland.co.kr";//Contact us
 			break;

		/************* 회사소개 카테고리 ***************/
		case 11: document.location.href="/company/greeting.asp";//인사말
			break;
		case 12: document.location.href="/company/history.asp";//회사연혁
			break;
		case 13: document.location.href="/company/business.asp";//회사비전
			break;
		case 14: document.location.href="/company/location.asp";//오시는 길
			break;

		/************* 제품소개 카테고리 ***************/
		case 21: document.location.href="/product/product_list.asp";//제품소개
			break;

		/************* 고객센터 카테고리 ***************/
		case 31: document.location.href="/customer/request.asp";//재고 및 구매문의
			break;

		/************* 커뮤니티 카테고리 ***************/
		case 41: document.location.href="/community/bbs/index.asp?s=notice";//공지사항
			break;
		case 42: document.location.href="/community/bbs/index.asp?s=free";//자유게시판
			break;
	}
}	

/**********************스크롤메뉴 시작**********************/
var stmnLEFT = 870; // 스크롤메뉴의 좌측 위치
var stmnGAP1 = 65 // 페이지 헤더부분의 여백
var stmnGAP2 = 30; // 스크롤시 브라우저 상단과의 여백
var stmnBASE = 85 // 스크롤메뉴 초기 시작위치
var stmnActivateSpeed = 100; // 움직임을 감지하는 속도 (숫자가 클수록 늦게 알아차림)
var stmnScrollSpeed = 8; // 스크롤되는 속도 (클수록 늦게 움직임)

function RefreshStaticMenu()
{
		var stmnStartPoint, stmnEndPoint, stmnRefreshTimer;

		stmnStartPoint = parseInt(FloatMenu.style.top, 10);
		stmnEndPoint = document.body.scrollTop + stmnGAP2;
		if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1;

		if ( stmnStartPoint != stmnEndPoint ) {
				stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 );
				FloatMenu.style.top = parseInt(FloatMenu.style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount );
				stmnRefreshTimer = stmnScrollSpeed;
		}
								 else {
				stmnRefreshTimer = stmnActivateSpeed;
		}

		setTimeout ("RefreshStaticMenu();", stmnRefreshTimer);
}

function InitializeFloatMenu()
{
		FloatMenu.style.top = document.body.scrollTop + stmnBASE;
		RefreshStaticMenu();
		FloatMenu.style.left = stmnLEFT;
}
/**********************스크롤메뉴 끝**********************/



//화면 정가운데에 이미지크기에 맞는 새 창 여는 스크립트
winObj=null; // 초기화
function openPhoto(imgname)
{
	img = new Image();
	img.src=imgname; 
	draw();
}
				 
function draw()
{
	if(img.complete == false) 
	{
		setTimeout("draw()", "100");
		return;
	}
				 
	width=img.width //+ 20; //이미지 너비값
	height=img.height// + 25; //이미지 높이 값
					 
	var attr ="width="+width + ",height="+height
					 
	 // 윈도우를 열고 이미지 출력.
	if(winObj != null && winObj.closed == false) 
	{ 
		winObj.close(); 
	}
					 
	winObj = window.open("","imgwindow",attr + ',top=135' + ',left=100' );
	winObj.document.open()
	winObj.document.write("<html><head>")
	winObj.document.write("<script>")
	winObj.document.write("var width = screen.width;")
	winObj.document.write("var height = screen.height;")
	winObj.document.write("var leftpos = width/2-" + img.width/2 + ";")
	winObj.document.write("var toppos = height/2-" + img.height/2 +  ";")
	winObj.document.write("self.moveTo(leftpos, toppos);")
	winObj.document.write("</script>")
	winObj.document.write("<title>행복을 이어주는 기업 - 대한해운</title>")
	winObj.document.write("</head><body style='margin:0'>")
	winObj.document.write("<img src=" + img.src + " style='cursor: hand;'" + " onClick='self.close()' onfocus='blur();' alt='이미지를 클릭하시면 현재창을 닫습니다'")
	winObj.document.write("</body><html>")
	winObj.document.close()
}  

/*********************************** 2005-04-18 유현우 내용추가 끝****************************************/

// 체크박스 전체선택
var check = true;
function checkAll(frm) {
	if (check) {
		for (i = 0; i < frm.length; i++) {
			if (frm[i].type == "checkbox") {
				if (frm[i].checked) {
					continue;
				}else {
					frm[i].checked = true;
				}
			}
		}
		check = false;
	} else {
		for (i = 0; i < frm.length; i++) {
			if (frm[i].type == "checkbox") {
				if(frm[i].checked) { frm[i].checked = false; }
				else { continue; }
			}
		}
		check = true;
	}
	return false;
}

// 체크박스 값 넘기기
function getCheckbox(Frm, Mod, Message) {
	var Tmp = "";
	var Idk = false;

	for (var i = 0; i < Frm.length; i++) {
		if (Frm[i].type != "checkbox") {
			continue;
		}

		if (Frm[i].checked) {
			Tmp += Frm[i].value + " ";
			Idk = true;
		}
	}

	if (Idk == true) {
		if (Mod.indexOf("delete") != -1) {
			var Cfm = confirm("선택하신 내용을 삭제하시겠습니까?");
		} else {
			if (Message != null) {
				var Cfm = confirm("선택하신 내용의 상태를 '" + Message + "'(으)로 변경하시겠습니까?");
			} else {
				var Cfm = confirm("선택하신 내용의 상태를 변경하시겠습니까?");
			}
		}

		if (Cfm) {
			Frm.n.value = Tmp.substr(0, Tmp.length - 1);
			Frm.m.value = Mod;
			Frm.submit();
		} else {
			return;
		}
	} else {
		window.alert('실행할 내용을 선택하세요');
		return;
	}
	return false;
}

// 숫자만 입력
function onlyNmber() {
	if (event.keyCode < 48 || event.keyCode > 57) {
		event.returnValue = false;
	}
}	

// 연도 출력
function getYears(sel, kind) {
	todayDate = new Date();
	var nowYear = todayDate.getFullYear();

	document.write("<select name=\"mfYear\">");
	for (var i = nowYear + 5; i >= 1950; i--) {
		document.write("<option value=\"" + i + "\"");
		if ((kind == "new" && i == nowYear) || (kind == "edit" && i == sel)) {
			document.write(" selected");
		}
		document.write(">" + i + "</option>");
	}
	document.write("</select>");
}

//폼 값 공란체크 후 경고 메시지 띄우기 
function isCkeckBlank(frm, message) {
	if (!frm.value) {
		window.alert(message + "을(를) 입력하세요");
		frm.focus();
		return false;
	}
	return true;
}

// 상품등록체크
function checkProduct(frm, cate) {
	if (isCkeckBlank(frm.name, "상품명") == false) {
		return false;
	} else if (isCkeckBlank(frm.factory, "제조회사") == false) {
		return false;
	} else if (isCkeckBlank(frm.stock, "재고수량") == false) {
		return false;
	}

	if (cate == "1") {
		if (isCkeckBlank(frm.types, "타입") == false) {
			return false;
		} else if (!frm.mfYear.value) {
			window.alert("제조년을 선택하세요");
			return false;
		}
	} else if (cate == "2") {
		if (isCkeckBlank(frm.types, "타입") == false) {
			return false;
		} else if (isCkeckBlank(frm.size, "사이즈") == false) {
			return false;
		} else if (!frm.mfYear.value) {
			window.alert("제조년을 선택하세요");
			return false;
		}
	} else if (cate == "3") {
		if (isCkeckBlank(frm.types, "타입") == false) {
			return false;
		} else if (isCkeckBlank(frm.size, "사이즈") == false) {
			return false;
		} else if (!frm.mfYear.value) {
			window.alert("제조년을 선택하세요");
			return false;
		}
	} else if (cate == "4") {
		if (isCkeckBlank(frm.agency, "통신사") == false) {
			return false;
		} else if (isCkeckBlank(frm.color, "색상") == false) {
			return false;
		}
	} else if (cate == "5") {
		if (isCkeckBlank(frm.ability, "기본사양") == false) {
			return false;
		}
	} else if (cate == "6") {
	}

//	frm.description.value = document.getElementById("editBox").html;

	if (frm.Body.value.length > 7000) {
		window.alert("제품 설명을 7000자 이하로 입력하세요");
		return false;
	}

	return true;
}

// 가운데로 새창 띄우기
function winOpenCenter(url, wname, width, height, scrl) {
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;

	if (scrl == null) {
		var scroll = "no";
	} else {
		var scroll = "yes";
	}

	window.open(url, wname, "left=" + winl + ", top=" + wint + ", scrollbars=" + scroll + ", resizable=no, width=" + width + ", height=" + height);
}

// 이미지확대
//function imgView(src, w, h) {
//	winOpenCenter('product_goods.asp?src=' + src, 'zoom', w, h);
//}

/**
 * 함 수 명 : ImageView()
 * 기    능 : 이미지 확대
 * 작 성 일 : 2007.05.28
 */
function imgView(Src, w, h) {
	var WinL = (screen.width - w) / 2;
	var WinT = (screen.height - h) / 2;

	if (screen.width > w) {
		var Width = w + 17;
	} else {
		var Width = screen.width;
	}

	if (screen.height - 80 > h) {
		var Height = h;
	} else {
		var Height = screen.height;
	}

	var mm = window.open("", "IMGVIEW", "left=" + WinL + ", top=" + WinT + ", width=" + Width + ", height=" + Height + ", scrollbars=yes");

	var doc = "<html><head><title>이미지 확대</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head><body style=\"margin:0; cursor:pointer;\" onclick=\"self.close();\"><img src=\"" + Src + "\"></body></html>";

	mm.document.write(doc);
}

// 구매문의 체크
function checkRequest(frm) {
	if (!frm.name.value) {
		window.alert("이름을 입력하세요");
		frm.name.focus();
		return false;
	} else if (!frm.company.value) {
		window.alert("회사명을 입력하세요");
		frm.company.focus();
		return false;
	} else if (/^[0-9]+$/.test(frm.Phone1.value) == false) {
		window.alert("전화번호(DDD)를 입력하세요");
		frm.Phone1.value = "";
		frm.Phone1.focus();
		return false;
	} else if (/^[0-9]+$/.test(frm.Phone2.value) == false) {
		window.alert("전화번호(국번)를 입력하세요");
		frm.Phone2.value = "";
		frm.Phone2.focus();
		return false;
	} else if (/^[0-9]+$/.test(frm.Phone3.value) == false) {
		window.alert("전화번호를 입력하세요");
		frm.Phone3.value = "";
		frm.Phone3.focus();
		return false;
	} else if (/^[0-9]+$/.test(frm.Mobile1.value) == false) {
		window.alert("휴대전화번호(서비스)를 입력하세요");
		frm.Mobile1.value = "";
		frm.Mobile1.focus();
		return false;
	} else if (/^[0-9]+$/.test(frm.Mobile2.value) == false) {
		window.alert("휴대전화번호(앞자리)를 입력하세요");
		frm.Mobile2.value = "";
		frm.Mobile2.focus();
		return false;
	} else if (/^[0-9]+$/.test(frm.Mobile3.value) == false) {
		window.alert("휴대전화번호(뒷자리)를 입력하세요");
		frm.Mobile3.value = "";
		frm.Mobile3.focus();
		return false;
	} else if (checkEmail(frm.email)) {
		window.alert("이메일의 형식이 잘못되었습니다");
		frm.email.value = "";
		frm.email.focus();
		return false;
	} else if (!frm.address.value) {
		window.alert("주소를 입력하세요");
		frm.address.focus();
		return false;
	} else if (!frm.p_name.value) {
		window.alert("제품명을 입력하세요");
		frm.p_name.value = "";
		frm.p_name.focus();
		return false;
	} else if (/^[0-9]+$/.test(frm.p_quantity.value) == false) {
		window.alert("수량을 입력하세요");
		frm.p_quantity.value = "";
		frm.p_quantity.focus();
		return false;
	} else if (!frm.message.value) {
		window.alert("문의내용을 입력하세요");
		frm.message.focus();
		return false;
	} else {
		return true;
	}
}

// 이메일체크
function checkEmail(input) {
	var format = /^((\w|[\-\.])+)@((\w|[\-\.])+)\.([A-Za-z]+)$/;

	return checkFormat(input, format);
}
function checkFormat(input, format) {
	if (input.value.search(format) == -1) {
		return true;
	} else if (input.value.charAt(input.value.indexOf('@')+1) == '.') {
		return true;
	}

	return false;
}


/**
 * 함 수 명 : updateChar()
 * 기    능 : Textarea 입력가능 글자수 카운트
 * 작 성 일 : 2007.03.28 (김동균)
 *
 */
function updateChar(length_limit)
{
	var form = document.request;
	var length = calculate_msglen(form.message.value);
	textlimit.innerText = length;
	if (length > length_limit) {
		alert("최대 " + length_limit + "byte이므로 초과된 글자수는 자동으로 삭제됩니다.");
		form.message.value = form.message.value.replace(/\r\n$/, "");
		form.message.value = assert_msglen(form.message.value, length_limit);
	}
}

function calculate_msglen(message)
{
	var nbytes = 0;

	for (i=0; i<message.length; i++) {
		var ch = message.charAt(i);
		if(escape(ch).length > 4) {
			nbytes += 2;
		} else if (ch == '\n') {
			if (message.charAt(i-1) != '\r') {
				nbytes += 1;
			}
		} else if (ch == '<' || ch == '>') {
			nbytes += 4;
		} else {
			nbytes += 1;
		}
	}

   return nbytes;
}


function assert_msglen(message, maximum)
{
	var inc = 0;
	var nbytes = 0;
	var msg = "";
	var msglen = message.length;

	for (i=0; i<msglen; i++) {
		var ch = message.charAt(i);
		if (escape(ch).length > 4) {
			inc = 2;
		} else if (ch == '\n') {
			if (message.charAt(i-1) != '\r') {
				inc = 1;
			}
		} else if (ch == '<' || ch == '>') {
			inc = 4;
		} else {
			inc = 1;
		}
		if ((nbytes + inc) > maximum) {
			break;
		}
		nbytes += inc;
		msg += ch;
	}
	textlimit.innerText = nbytes;
	return msg;
}
//////////


/**
 * 함 수 명 : MoveFocus()
 * 기    능 : 포커스이동
 * 파라미터 : Num -> 입력값 사이즈, FromForm -> 현재 인풋, ToForm -> 이동할 인풋
 * 작 성 일 : 2006.01.10, 이지미디어, 정원광
 *
 */
function MoveFocus(Num, FromForm, ToForm) {
	var Str = FromForm.value.length;

	if (Str == Num) {
		ToForm.focus();
	}
}


/**
 * 함 수 명 : CheckPressNumber()
 * 기    능 : 숫자만 입력
 * 파라미터 : -
 * 작 성 일 : 2006.01.10, 이지미디어, 정원광
 *
 */
function CheckPressNumber() {
	if (event.keyCode < 48 || event.keyCode > 57) {
		event.returnValue = false;
	}
}


/**
 * 함 수 명 : CheckMailing(frm)
 * 기    능 : 메일링 체크
 * 파라미터 : -
 * 작 성 일 : 2006.01.10, 이지미디어, 정원광
 *
 */

function CheckMailing(frm) {

	if (!frm.title.value) {
		window.alert("제목을 입력하세요");
		frm.title.focus();
		return;
	} else if (!frm.body.value) {
		window.alert("내용을 입력하세요");
		frm.body.focus();
		return;
	} else {
		frm.submit();
	}
}