<!--
var Browser = new Object();
Browser.isMozilla = (typeof document.implementation != 'undefined') 
									&& (typeof document.implementation.createDocument != 'undefined') 
									&& (typeof HTMLDocument!='undefined');
Browser.isIE = window.ActiveXObject ? true : false;
Browser.isFirefox = (navigator.userAgent.toLowerCase().indexOf("firefox")!=-1);
Browser.isSafari = (navigator.userAgent.toLowerCase().indexOf("safari")!=-1);
Browser.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
Browser.isiPhone = (navigator.userAgent.toLowerCase().indexOf("iphone")!=-1);


var _EVENT_CODE = {};
_EVENT_CODE.key_insert = 45;
_EVENT_CODE.key_home = 36;
_EVENT_CODE.key_pageup = 33;
_EVENT_CODE.key_delete = 46;
_EVENT_CODE.key_end = 35;
_EVENT_CODE.key_pagedown = 34;
_EVENT_CODE.key_backspace = 8;
_EVENT_CODE.key_tab = 9;
_EVENT_CODE.key_space = 0;
_EVENT_CODE.key_alt = 229;
_EVENT_CODE.key_ctrl = 25;
_EVENT_CODE.key_enter = 13;
if (Browser.isiPhone) {
	_EVENT_CODE.key_enter = 10;
}


var Domain = "intranet.nextreaming.com";

function getObject(str) {
	return document.getElementById(str);
}

function getObjects(str) {
	return document.getElementsByName(str);
}


//window name confirm (present popup window check)
function isWinName(name, url) {
	var domain = "http://" + Domain;

	if(url == "" || url == null) url = domain;
	if(eval("parent." + name) == null) {
		alert("different url");
		document.location.href = url;
	}
}


// byte check
function strByte(iStr) {
	var Str;
	var StrLength = 0;
	var StrOne;
	var strByte;
	strByte = 0;
	Str = new String(iStr);
	StrLength = Str.length;
	
	for (var i = 0; i < StrLength; i++) {
		StrOne = Str.charAt(i);
		if (escape(StrOne).length > 4) {
			strByte += 2;
		}else if (StrOne != '\r') {
			strByte++;
		}
	}
	
	return strByte;
}

//ÅëÈ­
function strCurrency(str) {
	var strLen = str.length;
	var strCurrency = true;

	for (var i = 0; i < strLen; i++) {
		if ((str.charAt(i) >= '0' && str.charAt(i) <= '9') || str.charAt(i) == ',') {
			continue;
		} else {
			strCurrency = false;
		}
	}
	
	return strCurrency;
}

/*
	numeral check
	- corrent : true
	- wrong : false
*/
function strNumeral(str, isPoint) {
	//¼Ò¼öÁ¡ ÀÔ·Â¿©ºÎ
	if (!isPoint || typeof(isPoint) == "undefined") isPoint = "";
	
	var strLen = str.length;
	var strNumeral = true;

	for (var i = 0; i < strLen; i++) {
		if (str.charAt(i) >= '0' && str.charAt(i) <= '9') {
			continue;
		} else if ((isPoint != "" && str.charAt(i) == isPoint) || str.charAt(i) == '-') {
			continue;
		} else {
			strNumeral = false;
		}
	
	}
	
	return strNumeral;
}

// english check
function strEnglish(str) {
	var strLen = str.length;
	var strEnglish;
	
	for (var i=0; i<strLen; i++) {
		if (str.charAt(i) >= 'a' && str.charAt(i) <= 'z') {
			continue;
		} else if (str.charAt(i) >= 'A' && str.charAt(i) <= 'Z') {
			continue;
		} else {
			strEnglish = false;
		}
	}
	
	return strEnglish;
}

// input english or numeral check
function strEnglishNumeral(str) {
	var strLen = str.length;
	var strEnglishNumeral;
	
	for (var i=0; i<strLen; i++) {
		if (str.charAt(i) >= '0' && str.charAt(i) <= '9') {
			continue;
		} else if (str.charAt(i) >= 'a' && str.charAt(i) <= 'z') {
			continue;
		} else if (str.charAt(i) >= 'A' && str.charAt(i) <= 'Z') {
			continue;
		} else {
			strEnglishNumeral = false;
		}
	}
	
	return strEnglishNumeral;
}


//¼ýÀÚ·Î º¯È¯ÇÏ¿© ¸®ÅÏ
function doChangeInt(_value) {
	//var _re = /[^0-9]/g;
	return parseInt(_value.replace(/[^0-9|-]/g, ''));
}

//¼ýÀÚ¸¦ ±Ý¾× Ãµ´ÜÀ§·Î º¯È¯ ÈÄ ¸®ÅÏ
function doChangePrice(_value) {
	var _price = doChangeInt(_value.toString());
	var _isSign = false;
	if (_price < 0) {
		_price = -(_price);
		_isSign = true;
	}
	
	_price = _price.toString();
	
	var _priceLength = _price.length;
	var _result = "";
	
	for (var i = 0; i < _priceLength; i++) {
		if (i % 3 == 0 && i != 0) {
			_result = ',' + _result;
		}
		
		_result = _price.charAt(_priceLength - (i + 1)) + _result;
	}
	
	if (_isSign) {
		_result = '-' + _result;
	}
	
	return _result;
}

function isKey(_e) {
if (!_e || typeof(_e) == "undefined") _e = event;

	//Tab:9, <-:37, ->:39, ¡è:38, ¡é:40, shift:16
	if (_e.keyCode == 9 || _e.keyCode == 16 || _e.keyCode == 37 || _e.keyCode == 38 || _e.keyCode == 39 || _e.keyCode == 40) {
		return false;
	} else {
		return true;
	}
}

/*
	mail form check (xxx@xxx.xxx....) 
	- wrong = false
	- corrent = true
*/
function mailCheck(mail) {
	var mailCheck = false;

	if(mail != "") {
		//mc	=/(\w+)@(\w+)\.(\w+)/
		//mc	=/^(.+)@(.+)$/
		mc = /(\w+)@(.+)\.(\w+)/
		if(mc.test(mail) == true) {
			mailCheck = true;
		}
	}

	return mailCheck;
}


/*
	search => special character control
 */
function isQuery(str) {
	var bool = true;

	if(str.indexOf("\'") != -1
				|| str.indexOf("\"") != -1
				|| str.indexOf("&") != -1
				|| str.indexOf("|") != -1
				|| str.indexOf("<") != -1
				|| str.indexOf(">") != -1) {
		bool = false;
	}
	return bool;
}


//space remove
function space(str) {
	var strlen = str.length;
	var temp = "";
	var cnt = 0;

	for(i = 0; i < strlen; i++) {
		if(str.charAt(i) != " ") {
			cnt = cnt + 1;
			temp = temp + str.charAt(i);
		}
	}

	if(cnt != 0) str = temp;

	return str;
}

//left trim
function ltrim(str) {
	var strlen = str.length;
	var temp = "";
	
	for(i = 0; i < strlen; i++) {
		if(str.charAt(i) == " ") {
		} else {
			temp = str.substring(i, strlen);
			break;
		}
	}
	
	return temp;
}

//¼¼·Î¾²±â (ºê¶ó¿ìÁ®°¡ IE°¡ ¾Æ´Ï¸é ¹®ÀÚº°<br>Ãß°¡)
function doHorizontalToVertical(_str) {
	var _returnStr = "";
	
	if (Browser.isIE) {
		_returnStr = _str;
	} else {
		var _strLength = 0;
		_strLength = _str.length;
		for (var i = 0; i < _strLength; i++) {
			_returnStr += _str.charAt(i) + "<br>";
		}
	}
	return _returnStr;
}

// biz num check
function checkBizID(bizID) {
	// bizID => numeral 10
	var checkID = new Array(1, 3, 7, 1, 3, 7, 1, 3, 5, 1);
	var i, chkSum = 0, c2, remander;

	for (i = 0; i <= 7; i++) chkSum += checkID[i] * bizID.charAt(i);
	c2 = "0" + (checkID[8] * bizID.charAt(8));
	c2 = c2.substring(c2.length - 2, c2.length);
	chkSum += Math.floor(c2.charAt(0)) + Math.floor(c2.charAt(1));
	remander = (10 - (chkSum % 10)) % 10 ;
	
	if (Math.floor(bizID.charAt(9)) == remander) return true; // OK!
	return false;
}


// rrn check
// correct : true 
// wrong: false
function checkRRN(RRN) {
	var i;
	var N_Count;
	var S_Count;

	N_Count = new Array(1,2,3,4,5,6,7,8,9,2,3,4,5);
	S_Count = new Array(12);

	for (i = 0; i < 13; i++) {
		S_Count[i] = parseInt(RRN.charAt(i));
	}
	
	var S_Sum = 0;
	for (i = 0; i < 12; i++) {
		S_Sum += N_Count[i+1] * S_Count[i];
	}
	
	var S_Nam = 11 - (S_Sum % 11);
	
	if (S_Nam > 9) {
    	S_Nam = S_Nam % 10;
	}
	
	if (S_Nam == S_Count[12]) {
		return true;
	} else {
		return false;
	}
}


//set cookie
function setCookie(_cName, _cValue, _cExpire, _cDomain, _cPath) {
	if (!_cExpire || typeof(_cExpire) == "undefined") _cExpire = "0";
	if (!_cDomain || typeof(_cDomain) == "undefined") _cDomain = "";
	if (!_cPath || typeof(_cPath) == "undefined") _cPath = "/";
	
	var _today = new Date();
	_today.setDate(_today.getDate() + parseInt(_cExpire));
	document.cookie = _cName + "=" + escape(_cValue) 
								+ "; path=" + _cPath 
								+ ((_cDomain == "") ? "" : "; domain=" + _cDomain)
								+ "; expire=" + _today.toGMTString() +";";
}


//get cookie
function getCookie(_cName) {
	var _found = false;
	var _start;
	var _end;
	var _i = 0;
	var _cookie = document.cookie;
	
	while (_i <= _cookie.length) {
		_start = _i;
		_end = _start + _cName.length;
		if (_cookie.substring(_start, _end) == _cName) {
			_found = true;
			break;
		}
		_i++;
	}
	
	if (_found) {
		_start = _end + 1;
		_end = _cookie.indexOf(";", _start);
		if (_end < _start) {
			_end = _cookie.length;
		}
		
		return _cookie.substring(_start, _end);
		
	} else {
		return "";
	}
}


//unicode
function strToUnicode(str, isKorean) {
	if (!isKorean || typeof(isKorean) == "undefined") isKorean = true;
	var txt = "";
	
	for(var i = 0; i < str.length; i++) {
		if (str.charCodeAt(i) > 127) {
			if (isKorean) {
				if ((str.charCodeAt(i) >= 12593 && str.charCodeAt(i) <= 12684) || (str.charCodeAt(i) >= 44032 && str.charCodeAt(i) <= 55203)) {
					txt += str.charAt(i);
				} else {
					txt += "&#" + str.charCodeAt(i) + ";";
				}
			} else {
				txt += "&#" + str.charCodeAt(i) + ";";
			}
		} else {
			txt += str.charAt(i);
		}
	}
	return txt;
}


//Date Format
function toDateFormatString(_D, _F) {
	var _tmp;
	
	return _F.replace(/(Y|y|m|d|h|H|i|s)/gi,
		function($1) {
			_tmp = '';
			switch($1) {
				case 'Y' : return _D.getFullYear();
				case 'y' : return _D.getFullYear().toString().substr(2);
				case 'm' : 
					_tmp = new String(_D.getMonth() + 1);
					return (_tmp.length == 1) ? '0' + _tmp : _tmp;
				case 'd' : 
					_tmp = new String(_D.getDate());
					return (_tmp.length == 1) ? '0' + _tmp : _tmp;
				case 'h' : 
					_tmp = new String((h = _D.getHours() % 12) ? h : 12);
					return (_tmp.length == 1) ? '0' + _tmp : _tmp
				case 'H' : 
					_tmp = new String(_D.getHours());
					return (_tmp.length == 1) ? '0' + _tmp : _tmp
				case 'i' : 
					_tmp = new String(_D.getMinutes());
					return (_tmp.length == 1) ? '0' + _tmp : _tmp
				case 's' : 
					_tmp = new String(_D.getSeconds());
					return (_tmp.length == 1) ? '0' + _tmp : _tmp
				case 'am' : return _D.getHours() < 12 ? 'am' : 'pm';
				case 'pm' : return _D.getHours() < 12 ? 'am' : 'pm';
			}
		}
	);
}

//Server Time
var ServerTime = {
	initialize: function(_time) {
		this.serverTimeStamp = parseInt(_time);
		this.clientTimeStamp = (new Date()).getTime();
		this.gapTimeStamp = this.serverTimeStamp - this.clientTimeStamp;
		this.DATE = null;
		//this.LOGOUT_TIME_STAMP = 0;
		//this.LOGIN_TIME = '0600';
	}, 
	
	realServerTime: function() {
		this.DATE = new Date();
		this.DATE.setTime(this.DATE.getTime() + this.gapTimeStamp);
	}, 
	
	getTimeStamp: function() {
		this.realServerTime();
		return this.DATE.getTime();
	}, 
	
	getTimeFormatString: function(_format) {
		this.realServerTime();
		return toDateFormatString(this.DATE, _format);
	},
	
	printTimeFormatString: function(_object, _format) {
		if (typeof(_object) == 'string') _object = $(_object);
		this.realServerTime();
		_object.innerHTML = toDateFormatString(this.DATE, _format);
	}
};


//index_home, loginout
var _LIMIT_LOGOUT_TIME_STAMP = 0;	//
var _LOGIN_TIME = '0600';	//0600

//·Î±×¾Æ¿ô Ãë¼Ò ³²Àº ½Ã°£ Ç¥½Ã
var _REMAINED_DATE = new Date();
function showRemainedTimeAttendanceLogout() {
	_REMAINED_DATE.setTime(_LIMIT_LOGOUT_TIME_STAMP - ServerTime.getTimeStamp());
	$("msgRemainedTime").innerHTML = '00:' + toDateFormatString(_REMAINED_DATE, 'i:s');
}

function doCheckTimeAttendanceLogout() {
	if (ServerTime.getTimeStamp() > _LIMIT_LOGOUT_TIME_STAMP) {
		try {
			$("btn_attendanceLogoutCancel").style.display = 'none';
		} catch(e) {}
			
		try {
			$("msgTime").style.display = 'none';
		} catch(e) {}
		
		doEndFn("doCheckTimeAttendanceLogout();");
		//$("msg1").innerHTML = 'ÃÊ°ú=' + ServerTime.getTimeFormatString('Y-m-d H:i:s');
		
	} else {
		//$("msg1").innerHTML = '¹Ì¸¸=' + ServerTime.getTimeFormatString('Y-m-d H:i:s');
		try {
			showRemainedTimeAttendanceLogout();
		} catch(e) {}
	}
}

function doCheckTimeAttendanceLogin(_gapHours) {
	if (!_gapHours || typeof(_gapHours) == 'undefined') _gapHours = 0;
	
	//_gapHours = 0 ÀÌ¸é ¼³Á¤µÈ ½Ã°£À¸·Î ÇÑ´Ù.
	//_gapHours <> 0 ÀÌ ¾Æ´Ï¸é _gapHours ¸¸Å­ ½Ã°£À» º¯°æÇÏ¿© ÇÑ±¹½Ã°£À¸·Î ´Ù½Ã º¯°æÇÑ´Ù.
	var _D = new Date();
	_D.setTime(ServerTime.getTimeStamp() + (-(_gapHours) * 60 * 60 * 1000));
	
	//if (ServerTime.getTimeFormatString('Hi') == _LOGIN_TIME) {
	if (toDateFormatString(_D, 'Hi') == _LOGIN_TIME) {
		doEndFn("doCheckTimeAttendanceLogin();");
		document.location.reload();
	}

	//$("msg2").innerHTML += '40ÃÊ°æ°ú=' + toDateFormatString(_D, 'Y-m-d H:i:s') + ' = ' + _LOGIN_TIME + '<br />';
}


function W(_str) {
	document.write(_str);
}


//object top
function getObjectTopPosition(_this){
	if (_this.offsetParent == document.body) 
		return _this.offsetTop;
	else 
		return _this.offsetTop + getObjectTopPosition(_this.offsetParent);
}
//object left
function getObjectLeftPosition(_this){
	if (_this.offsetParent == document.body) 
		return _this.offsetLeft;
	else 
		return _this.offsetLeft + getObjectLeftPosition(_this.offsetParent);
}


function makeActiveX(_url, _id, _width, _height, _wmode, _isEmbed, _clsid, _codebase) {
	if (!_clsid || typeof(_clsid) == "undefined") 
		_clsid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
	if (!_codebase || typeof(_codebase) == "undefined")
		_codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0";
	if (!_isEmbed || typeof(_isEmbed) == "undefined")
		_isEmbed = true;
	if (!_wmode || typeof(_wmode) == "undefined")	
		_wmode = "transparent";
	
	var _object ="<object classid=\"" + _clsid + "\" codebase=\"" + _codebase + "\" id=\"" + _id + "\" width=\"" + _width + "\" height=\"" + _height + "\" VIEWASTEXT>"
							+"<param name=\"movie\" value=\"" + _url + "\">"
							+"<param name=\"quality\" value=\"high\">"
							+"<param name=\"wmode\" value=\"" + _wmode + "\">";
	
	if (_isEmbed) {
      _object +="<embed src=\"" + _url + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + _width + "\" height=\"" + _height + "\" wmode=\"" + _wmode + "\"></embed>";
  }

	_object += "</object>";
	
	W(_object);
}

//ÇÃ·¡½Ã ´ëÃ¼¿ë Ç¥½Ã
function makeActiveX2(_url, _id, _width, _height, _alt, _wmode, _isEmbed, _clsid, _codebase) {
	if (!_clsid || typeof(_clsid) == "undefined") _clsid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
	if (!_codebase || typeof(_codebase) == "undefined") _codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0";
	if (!_isEmbed || typeof(_isEmbed) == "undefined") _isEmbed = true;
	if (!_wmode || typeof(_wmode) == "undefined")	_wmode = "transparent";
	if (!_alt || typeof(_alt) == "undefined")	_alt = "";
	
	
	var _object ="<object classid=\"" + _clsid + "\" codebase=\"" + _codebase + "\" id=\"" + _id + "\" width=\"" + _width + "\" height=\"" + _height + "\" VIEWASTEXT>"
							+"<param name=\"movie\" value=\"" + _url + "\">"
							+"<param name=\"quality\" value=\"high\">"
							+"<param name=\"wmode\" value=\"" + _wmode + "\">"
							
							+"<!--[if !IE]> <-->"
							+"<object type=\"application/x-shockwave-flash\" data=\"" + _url + "\" width=\"" + _width + "\" height=\"" + _height + "\">"
							+"<param name=\"quality\" value=\"high\">"
							+"<param name=\"wmode\" value=\"" + _wmode + "\">"
							+"<div style='margin:0px; padding:0px;'>" + _alt + "</div>"
							+"</object>"
							+"<!--> <![endif]-->"

							+"</object>";
	
	W(_object);
}

function showSendProcessing(_id, _msg, _width) {
	if (!_msg || typeof(_msg) == "undefined") _msg = "";
	if (!_width || typeof(_width) == "undefined") _width = "70px";
	//if (!_height || typeof(_height) == "undefined") _height = "100%";
	
	getObject(_id).innerHTML = "<span style='width:" + _width + "; text-align:center'><img src='/images/main/loading.gif' border='0'> " + _msg + "</span>";
}

function showLoading(_title, _leftPoint, _topPoint) {
	if (!_title || typeof(_title) == "undefined") _title = "Loading";
	if (!_leftPoint || typeof(_leftPoint) == "undefined") _leftPoint = 0;
	if (!_topPoint || typeof(_topPoint) == "undefined") _topPoint = 0;
	
	//document.write("<div id=\"loading_indicator\" name=\"loading_indicator\" class=\"loading_indicator\">" + _title + "...</div>");
	
	var _E2 = getObject("loading_indicator");
	
	if (!_E2 || typeof(_E2) == "undefined") {
		var _E = document.createElement("DIV");
		_E["id"] = "loading_indicator";
		_E["name"] = "loading_indicator";
		_E["class"] = "loading_indicator";
		_E.innerHTML = _title + "...";
		_E.style.position = "absolute";
		_E.style.display = "none";
		_E.style.padding = "10 5 10 30";
		_E.style.width = "150px";
		_E.style.fontWeight = "bold";
		_E.style.border = "2px solid #FF6600";
		_E.style.background = "#FFFFFF url('/images/main/loading.gif') no-repeat 5% 50%";
		document.body.appendChild(_E);
		
	} else {
		_E2.innerHTML = _title + "...";
	}
	
	/*
	var _html = "<div id=\"loading_indicator\" name=\"loading_indicator\" class=\"loading_indicator\">" + _title + "...</div>";
	document.body.innerHTML += _html;
	*/
	var _left = (screen.width / 2) - 75;
	var _top = (screen.height / 2) - 20;
	
	if (_leftPoint > 0) _left = _leftPoint;
	if (_topPoint > 0) _top = _topPoint;
	
	var _loading = getObject("loading_indicator");
	_loading.style.top = 50;
	_loading.style.left = _left;
	_loading.style.display = "block";
}

function hideLoading() {
	try {
		var _loading = getObject("loading_indicator");
		if (typeof(_loading) != "undefined") {
			_loading.style.display = "none";
		}
	} catch (_e) {
	}
}



/*
 **************************************************************************
 * image resize
 * imgW => max width
 * imgH => max height 
 * obj => image name
 */
function imgResize(imgW, imgH, obj) {
	var frm=eval("document.all." + obj);

	if(typeof(frm) != "undefined") {
		imgW = parseInt(imgW);
		imgH = parseInt(imgH);
		wid	= frm.width;
		hei	= frm.height;
		if(wid > imgW || hei > imgH) {
			var widPs = Math.round(((wid - imgW) / wid) * 100);
			var heiPs = Math.round(((hei - imgH) / hei) * 100);

			if(widPs >= heiPs) {
				var heiResize = hei - (Math.round((widPs / 100) * hei));
				frm.width = imgW;
				frm.height = heiResize;
			} else {
				var widResize = wid - (Math.round((heiPs / 100) * wid));
				frm.width = widResize;
				frm.height = imgH;
			}
//			alert(widResize+","+imgH);
		}
	}
}


/*
 * image sub resize
 * w => max width
 * h => max height
 * imgName => image name
 * num => image max num
 */
function imgSubResize(w, h, imgName, num) {
	for(var i = 0; i < num; i++) {
		var objName = imgName + i;
		var obj = eval("document.all." + objName);

		if(typeof(obj) == "object") {
			imgResize(w, h, objName);
		}
	}
}
//*************************************************************************


//----------------------------------------------------------------------
//ÀÏÁ¤ÇÑ ½Ã°£°£°ÝÀ¸·Î ÇÔ¼ö ¹Ýº¹ ½ÇÇà
var _SET_TIME = new Array();

function doStartFn(_fn, _time) {
	if (!_fn || typeof(_fn) == "undefined") _fn = "";
	if (!_time || typeof(_time) == "undefined") _time = 500;
	
	//setTimeout(_fn, _time);
	
	try {
		eval(_fn);
	} catch(e) {}
	
	_SET_TIME[_fn] = setTimeout('doStartFn("' + _fn + '", ' + _time + ')', _time);
}

function doEndFn(_fn) {
	if (!_fn || typeof(_fn) == "undefined") {
	} else {
		clearTimeout(_SET_TIME[_fn]);
		delete(_SET_TIME[_fn]);
	}
}
//----------------------------------------------------------------------


//----------------------------------------------------------------------
//ÇöÀç »ç¿ëÇÏÁö ¾ÊÀ½
//Intranet ¸Þ´º ºÎºÐ home ÇÁ·¹ÀÓ¿¡¼­ ¼û±â±â
function setEvent() {
	document.onmousemove = getEvent;
}


function getEvent() {
	if (event.x >= 100) {
		if (typeof(top.menu) != "undefined") {
			top.menu._HM.doExecHiddenMenu();
		}
	}
}
//----------------------------------------------------------------------


//Round
function doRound(_id, _bgcolor, _border, _mode) {
	var _E = getObject(_id);
	if (!_bgcolor || typeof(_bgcolor) == "undefined") _bgcolor = "#FFFFFF";
	if (!_border || typeof(_border) == "undefined") _border = "#D0D0D0";
	if (!_mode || typeof(_mode) == "undefined") _mode = "";
	
  var _top = document.createElement('div'); 
  		_top.style.cssText = 'display:block; overflow:hidden; height:5px;'; 
  var _bottom = document.createElement('div'); 
  		_bottom.style.cssText = 'display:block; overflow:hidden; height:5px;'; 
  //var _temp = document.createElement('div'); 
  //		_temp.setAttribute('id', 'template'); 
  		
  var _border2 = (_border) ? "; border-left:2px solid " + _border + "; border-right:2px solid " + _border : ""; 
  var _border1 = (_border) ? "; border-left:1px solid " + _border + "; border-right:1px solid " + _border : ""; 
  var _bgcolor2 = (_bgcolor) ? "; background:" + _bgcolor : ""; 
  var _bgcolor1 = (_border) ? "; background:" + _border : (_bgcolor) ? "; background:" + _bgcolor : ""; 

  var _top_r = new Array(), _bottom_r =new Array(); 
  //var _box = _E.cloneNode(true);
  //_box.style.cssText = _border1 + _bgcolor2; 
  
  for (i = 1; i <= 4; i++) { 
  	_top_r[i] = document.createElement('div');
  }

  _top_r[1].style.cssText = 'margin:0px 5px; padding:0; overflow:hidden; height:1px' + _bgcolor1; 
  _top_r[2].style.cssText = 'margin:0px 3px; padding:0; overflow:hidden; height:1px' + _border2 + _bgcolor2; 
  _top_r[3].style.cssText = 'margin:0px 2px; padding:0; overflow:hidden; height:1px' + _border1 + _bgcolor2; 
  _top_r[4].style.cssText = 'margin:0px 1px; padding:0; overflow:hidden; height:2px' + _border1 + _bgcolor2; 

  for (i = 1; i <= 4; i++) {
    if (_mode != 'bottom') {
    	_top.appendChild(_top_r[i]);
 			//_temp.appendChild(_top);
    }
    _bottom_r[i] = _top_r[i].cloneNode(true);
  }

  //_temp.appendChild(_box); 
  //_temp.appendChild(_bottom); 

  if (_mode != 'top') { 
    for (i = 4; i > 0; i--) { 
      _bottom.appendChild(_bottom_r[i]); 
    } 
  } 

  //_E.parentNode.replaceChild(_temp, _E); 
  if (_mode == 'top') {
		_E.parentNode.insertBefore(_top, _E);
	} else if (_mode == 'bottom') {
		_E.style.cssText = _border1 + _bgcolor2;
		_E.parentNode.appendChild(_bottom);
	} else {
		_E.parentNode.insertBefore(_top, _E);
		_E.style.cssText = _border1 + _bgcolor2;
		_E.parentNode.appendChild(_bottom);
	}
	
}

//-->