/**
* Window Open
* Window¼Ó¼º - ȸ鰡¿îµ¥ À§Ä¡ Çϸç scrollbar = yes, resizable=yes, status=yes, toolbar=no, menubar=no
* @param url windowÀÇ URL
* @param name WindowÀÇ ¸í
* @param widht windowÆø (Çȼ¿)
* @param height window³ôÀÌ (Çȼ¿)
* @return window object
*/
function openWindow(url, name, width, height) {
var top = screen.height / 2 - height / 2 - 50;
var left = screen.width / 2 - width / 2 ;
var win = open(url, name, 'width='+width+',height='+height+',top='+top+',left='+left+',resizable=yes,status=yes,toolbar=no,menubar=no,scrollbars=yes');
win.focus();
//return win;
}
/**
* Bubble sort function due to Javascript's sort() method of the Array
* class's bug.
* And, this function uses bubble sort algorithm for the simplicity.
*
* @param array the array to sort
* @param comfunc the comparator function
*/
function sortArray(array, cmpfunc) {
var i,j;
for (i = array.length - 1; i >= 0; i--) {
for (j = 0; j < i; j++) {
var cond;
if (cmpfunc == null )
cond = (array[j] > array[j+1]);
else
cond = cmpfunc(array[j], array[j+1]);
if (cond) {
// swap the elements
temp = array[j];
array[j] = array[j+1];
array[j+1] = temp;
}
}
}
}
/**
* Make the specified value selected in the selection object
*
* @param selectObject the object to modify the selected value
* @param value the value to be selected
* @return true : success changed, false : no data found
*/
function setSelectedIndexByValue(selectObject, value) {
if (selectObject == null)
return false;
for (var i = 0; i < selectObject.options.length; i++) {
if (selectObject.options[i].value == value) {
selectObject.selectedIndex = i;
return true;
}
}
return false
}
/**
* Returns the selected value from the selection object
* @param selectObject the selection object
*/
function getSelectedValue(select) {
if (select == null)
return null;
return select.options[select.selectedIndex].value;
}
/**
* Selection Object¿¡¼ ValueÀÇ Index Return
* @param select the selection object
* @param value °ª
* @return Index of value, -1 if there were no value in Selection Object.
*/
function getIndexByValue(select, value) {
if (select == null)
return;
for (var i = 0; i < select.options.length; i++) {
if (select.options[i].value == value)
return i;
}
return -1; // not found.
}
/**
* Selection Object¿¡ Option array Ãß°¡
* @param select the selection object
* @param option the option array
*/
function addOptionToSelect(select, option) {
//@@ ÇöÀç ÀÛ¾÷Áß Àß ¾ÈµÇ´Â ±º¿ä. ÁÁÀº ¹æ¹ý ¾øÀ»±î¿ä? sybaek.2000.1.3
select.options[select.options.length] = option;
}
/**
* Selection Object¿¡¼ Value¸¦ °¡Áö´Â optionÁ¦°Å
* @param selectObject the Selection Object
* @param value Option value to remove
* @return true : success changed, false : no data found
*/
function removeOptionByValue(selectObject, value) {
if (selectObject == null)
return false;
var index = getIndexByValue(selectObject, value);
var srcC = 0, destC = 0;
if (index == -1) return false; // not found
// else value was found, shift all elemenets which are after index
while (srcC < selectObject.options.length) {
selectObject.options[destC] = selectObject.options[srcC];
if (srcC == index) destC--;
srcC++;
destC++;
}
selectObject.options.length -= 1;
return true;
}
/**
* ³¯Â¥ µ¥ÀÌÅ͸¦ SettingÇÑ´Ù. printDateSelect()¿Í ÇÔ²² »ç¿ë
* @param select select Object ex) document.frm.p_date
*/
function mergeDateSelect(select) {
var sYear = eval('document.' + select.form.name + '.' + select.name + '_year');
var sMonth = eval('document.' + select.form.name + '.' + select.name + '_month');
var sDate = eval('document.' + select.form.name + '.' + select.name + '_date');
select.value = sYear.options[sYear.selectedIndex].value;
select.value += sMonth.options[sMonth.selectedIndex].value;
select.value += sDate.options[sDate.selectedIndex].value;
}
/**
* ³â + ¿ù + ÀÏ Tag »Ñ¸®±â
* @param selectName