function showLov(targetCodeId, targetDescId, queryId, conditionFieldId_1, colName1, colName2) {
	var width = '400';
	var height = '600';
	var criteria1 = document.getElementById(conditionFieldId_1).value;	
	var destination = '../../common/public/lov.jsp?targetCodeId=' + targetCodeId + '&targetDescId=' + targetDescId + '&queryId=' + queryId + '&criteria1=' + criteria1 + '&colName1=' + colName1 + '&colName2=' + colName2;

	window.open(destination,'LOV','height=' + height + ',width=' + width + ',toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no');

	/*
	if (window.showModalDialog) {
		window.showModalDialog(destination,"name","dialogWidth:" + width + "px;dialogHeight:" + height + "px");
	} else {
		window.open(destination,'name','height=' + height,'width=' + width,'toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');
	}
	*/	
}

function highlightLovRows(tableId) {
    var previousClass = null;
    var table = document.getElementById(tableId); 
    var tbody = table.getElementsByTagName("tbody")[0];
    var rows;
    if (tbody == null) {
        rows = table.getElementsByTagName("tr");
    } else {
        rows = tbody.getElementsByTagName("tr");
    }

    // add event handlers so rows light up and are clickable    
    for (i=0; i < rows.length; i++) {
    	if (isOdd(i)) {
	    	rows[i].className='odd';
	        rows[i].onmouseover = function() { this.className='odd over'; };
	        rows[i].onmouseout = function() { this.className='odd'; };
	    } else {
   	    	rows[i].className='even';
	        rows[i].onmouseover = function() { this.className='even over'; };
	        rows[i].onmouseout = function() { this.className='even'; };
		}	

        rows[i].onclick = function() { selectLine(this.getElementsByTagName("td")[0].innerHTML, this.getElementsByTagName("td")[1].innerHTML); };
    }    
}

function selectLine(code, description) {
	var targetCodeId = document.getElementById('targetCodeId').value;
	var targetDescId = document.getElementById('targetDescId').value;
		
	var targetCodeObj = opener.document.getElementById(targetCodeId);
	var targetDescObj = opener.document.getElementById(targetDescId);	
	
	targetCodeObj.value = code;
	targetDescObj.value = description;	
	window.close();
}

function isEven(x) { 
   	return (x%2)?false:true; 
}

function isOdd(x) { 
	return !isEven(x); 
}    

