/*
* Licensed Materials - Property of IBM
* Rational ClearQuest
* Copyright IBM Corp. 2001, 2009 All Rights Reserved
*/var AD_NULL_FIELDTYPE      = '0';
var AD_SHORT_STRING        = '1';
var AD_MULTILINE_STRING    = '2';
var AD_INT                 = '3';
var AD_DATE_TIME           = '4';
var AD_REFERENCE           = '5';
var AD_REFERENCE_LIST      = '6';
var AD_ATTACHMENT_LIST     = '7';
var AD_ID                  = '8';
var AD_STATE               = '9';
var AD_JOURNAL             = '10';
var AD_DBID                = '11';
var AD_STATETYPE           = '12';
var AD_RECORDTYPE          = '13';
var AD_FLOAT               = '14';
var DATE_DELIM	= '@';
var arrowOff=new Image();
arrowOff.src="/cqweb/view/browser/images/shim.gif";
var arrowOn=new Image();
arrowOn.src="/cqweb/view/browser/images/arrow_red.gif" ;
var brow = ((navigator.appName) + (parseInt(navigator.appVersion)));
var c='.css" />';
var checked = false;
var currObj,docObj,dom, layOff, layOn, styleObj;
var globalLayer = "";
var isIE4 = 0;
var isNS4 = 0;
var isNS6 = 0;
var isNew = 0;
var l='<link rel="stylesheet" type="text/css" href="/cqweb/view/browser/common/';
var NNS4 = (document.captureEvents);//var for capture event
var snn = navigator;
var snpl = snn.platform.toLowerCase(); // not supported in NS3.0
var snua = ' ' + snn.userAgent.toLowerCase();
var snun = snn.appName.toLowerCase();
var snvpl_mac = snua.indexOf('mac') > 0;
var snvpl_unix = snua.indexOf("x11") > 0;
var snvpl_win = snua.indexOf('win') > 0;
var snvv_ie = snua.indexOf('msie') > 0;
var snvv_nn = snua.indexOf('mozilla') > 0;
var snvversion = snn.appVersion;
var snvv_safari = snua.indexOf('safari') > 0;
if(snua.indexOf('compatible') > 0) {
snnvv_nn = false;
}
if (NNS4){
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown = doMouseClick;
if (parseInt(navigator.appVersion) >= 5)
{
isNew = 1
}
else if (brow == "Netscape4")
{
isNS4 = 1;
}
else if (brow == "Microsoft Internet Explorer4")
{
isIE4 = 1;
}
else if (brow == "Netscape6")
{
isNS6 = 1;
}
if (isNS4||isIE4||isNew)
{
docObj = (isNS4) ? 'document' : 'document.all';
styleObj = (isNS4) ? '' : '.style';
}
if(snvpl_win)//windows
{
if(snvv_ie)
{
if ( (snua.indexOf('ie 5')!=-1) || (snua.indexOf('ie 5.5')!=-1) )
document.write(l+'common_base'+c);
else if( (snua.indexOf('ie 6')!=-1) || (snua.indexOf('ie 7')!=-1) || (snua.indexOf('ie 8')!=-1) )
document.write(l+'common_adv'+c);
else
{
}
}
else if (snvv_nn)
{
if (snua.indexOf("/4")!=-1)
document.write(l+'common_base'+c);
else if(snua.indexOf("/5")!=-1)
document.write(l+'common_adv'+c);
else if(snua.indexOf("/6")!=-1)
document.write(l+'common_adv'+c);
else
{
}
}
else
{
}
}
else if(snvpl_unix)//unix
{
if(snvv_ie)
{
if ( (snua.indexOf('ie 5')!=-1) || (snua.indexOf('ie 5.5')!=-1) )
document.write(l+'common_baseUNX'+c);
else if( (snua.indexOf('ie 6')!=-1) || (snua.indexOf('ie 7')!=-1) || (snua.indexOf('ie 8')!=-1) )
document.write(l+'common_advUNX'+c);
else
{
}
}
else if (snvv_nn)
{
if (snua.indexOf("/4")!=-1)
document.write(l+'common_baseUNX'+c);
else if(snua.indexOf("/5")!=-1)
document.write(l+'common_adv'+c);
else if(snua.indexOf("/6")!=-1)
document.write(l+'common_adv'+c);
else
{
}
}
else
{
}
}
else if(snvpl_mac)//mac
{
if(snvv_ie)
{
if ( (snua.indexOf('ie 5')!=-1) || (snua.indexOf('ie 5.5')!=-1) )
document.write(l+'common_base'+c);
else if( (snua.indexOf('ie 6')!=-1) || (snua.indexOf('ie 7')!=-1) || (snua.indexOf('ie 8')!=-1) )
document.write(l+'common_adv'+c);
else
{
}
}
else if ((snvv_nn)&& (!snvv_safari))
{
if (snua.indexOf("/4")!=-1)document.write(l+'common_base'+c);
else if(snua.indexOf("/6")!=-1)document.write(l+'common_advMac'+c);
else
{
}
}
else if (snvv_safari)
{
document.write(l+'common_adv'+c);
}
else
{
}
}
else//others
{
}
function bcolor(bcol,d_name)
{
if (is_ie)
{
var thestyle= eval ('document.all.'+d_name+'.style');
thestyle.backgroundColor=bcol;
}
else if (document.getElementById)
{
var thestyle= eval ('document.getElementById.'+d_name+'.style');
thestyle.backgroundColor=bcol;
}
}
function changeframe(url) {
top.checkinbottom.location.href= url
}
function checkAll(field) {
if (!checked) { // if checkboxes are not checked then check them
for (i = 0; i < field.length; i++) { // loop through the array of checkboxes & check them
field[i].checked = true;
}
checked = true;
}
}
function checkedIn(id) {
if (document.all) {
return document.all[id].style;
} else if(document.layers) {
return document.layers[id];
}
else if(document.getElementById) {
return document.getElementById(id);
}
}
function disablecapture() {
}
function doMouseClick(ev) {
}
function framedirect() {
page = document.formTopframe.newLocation.options[document.formTopframe.newLocation.selectedIndex].value;
tempIndex = page.indexOf('?');
firstURL = page.substring(0,tempIndex);
secondURL = page.substring(tempIndex + 1,page.length);
top.treeFrame.location.href = firstURL;
top.viewFrame.location.href = secondURL;
}
function MM_findObj(n, d)
{ //v4.01
if ((n=='')|| (n==null) ||(n==undefined)||(n=='undefined'))
return null;
var p,i,x;
if(!d)
d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length)
{	d=parent.frames[n.substring(p+1)].document;
n=n.substring(0,p);
}
if(!(x=d[n])&&d.all)
x=d.all[n];
for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById)
x=d.getElementById(n);
return x;
}
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_showHideLayers(id, flag)
{ //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
obj=MM_findObj(id);
if (obj != null)
{
v=flag;
if (obj.style)
{
obj=obj.style;
v = (v=='show') ? 'visible' : (v = 'hide') ? 'hidden' : v;
}
obj.visibility=v;
document.getElementById('entityPopPad').style.visibility = obj.visibility;
}
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MSframeChange() {
page = document.formBannerFrame.newLocation.options[document.formBannerFrame.newLocation.selectedIndex].value;
tempIndex = page.indexOf('?');
firstURL = page.substring(0,tempIndex);
secondURL = page.substring(tempIndex + 1,page.length);
top.middleNav.location.href = firstURL;
top.contentFrame.location.href = secondURL;
}
function open_help(helpfile) {
var winleft, wintop;
var helpleft, helptop;
var helpwidth, helpheight;
if (document.layers) {
winleft = top.screenX;
wintop = top.screenY;
}
else {
winleft = top.screenLeft;
wintop = top.screenTop;
}
helpwidth = Math.min(screen.availWidth);
helpheight = Math.min(screen.availHeight);
helpwidth=helpwidth *.6;
helpheight=helpheight *.85;
helptop = 0;
if (winleft > 20)
helpleft = 0;
else
helpleft = screen.width - helpwidth - 10;
top.open(helpfile, 'ccweb_help',
'left='+helpleft+',top='+helptop+',width='+helpwidth+',height='+helpheight+',resizable=1,scrollbars=1');
}
function popLeftMenu(evt,currElem,upChk){
var dom;
MM_showHideLayers(globalLayer, 'hide');
globalLayer = currElem;
if ((isNS4 && currElem != 0) || (isIE4 && currElem != 0) || (isNS6 && currElem != 0)){
if (isIE4) {
dom = eval('document.getElementById(currElem)' +'.style');
topVal = event.clientY;
leftVal = event.clientX;
}
else if (isNS4) {
dom = eval('document.layers[currElem]');
if ((upChk == 1) && (window.innerWidth < 670)) {
topVal = eval(evt.pageY - 50);
leftVal = eval(evt.pageX - 9);
}
else {
topVal = eval(evt.pageY - 0);
leftVal = eval(evt.pageX - 0);
}
}
}
else {
dom = document.getElementById(currElem).style;
if ((upChk == 1) && (window.innerWidth < 670)) {
topVal = eval(evt.pageY - 50);
leftVal = eval(evt.pageX - 9);
}
else {
topVal = eval(evt.pageY - 0);
leftVal = eval(evt.pageX + 10);
}
}
if(leftVal < 2) {leftVal = 2;}
if(topVal < 2) {topVal = -5;}
dom.visibility	= "visible";
dom.zIndex		= 1000;
dom.position 	= "absolute";
dom.top 		= topVal + "px";
dom.left 		= leftVal + "px";
var dom1 = document.getElementById('entityPopPad').style;
dom1.position 	= dom.position;
dom1.visibility = dom.visibility;
dom1.zIndex		= dom.zIndex - 20;
dom1.top		= dom.top;
dom1.left		= dom.left;
dom1.width		= document.getElementById(currElem).offsetWidth;
dom1.height		= document.getElementById(currElem).offsetHeight;
var cMenuElem = document.getElementById(currElem);
if (cMenuElem != null)
if (cMenuElem.childNodes[0].rows.length)
if (cMenuElem.childNodes[0].rows[0].childNodes.length > 1)
if (cMenuElem.childNodes[0].rows[0].childNodes[1].childNodes.length)
cMenuElem.childNodes[0].rows[0].childNodes[1].childNodes[0].focus();
}
function popLeftMenuSpecial(evt,currElem){
globalLayer = currElem;
if ((isNS4 && currElem != 0) || (isIE4 && currElem != 0) || (isNS6 && currElem != 0)){
if (isNS4){
dom = eval('document.layers[currElem]');
if (window.innerWidth < 600) {
topVal = eval(evt.pageY - 0);
leftVal = eval(evt.pageX - 110);
}
else {
topVal = eval(evt.pageY - 0);
leftVal = eval(evt.pageX - 0);
}
}
else if (isIE4) {
dom = eval('document.getElementById(currElem)' +'.style');
if (document.body.clientWidth < 600) {
topVal = eval(event.y+document.body.scrollTop - 0);
leftVal = eval(event.x+document.body.scrollLeft - 110);
}
else{
topVal = eval(event.y+document.body.scrollTop - 0);
leftVal = eval(event.x+document.body.scrollLeft - 0);
}
}
else {
dom = eval('document.getElementById(currElem)' +'.style');
if (window.innerWidth < 600) {
topVal = eval(evt.pageY - 0);
leftVal = eval(evt.pageX - 110);
}
else {
topVal = eval(evt.pageY - 0);
leftVal = eval(evt.pageX - 0);
}
}
if(leftVal < 2) {leftVal = 2;}
if(topVal < 2) {topVal = -5;}
dom.top = topVal;
dom.left = leftVal;
dom.display = "block";
}
}
function searchOptions(newLoc) { //Opens new page in the right frame depending on the "Advanced Search for:" selection
newPage = newLoc.options[newLoc.selectedIndex].value
if (newPage != "") {
parent.viewFrame.location.href = newPage
}
}
function showWindow(e,url) {
var x=y=0;
if (e != '') {
x = e.screenX;
y = e.screenY;
}
myWindow=window.open(url,'windowName','width=200,height=150,screenX=' + x + ',screenY=' + y + ',left=' + x + ',top=' + y);
}
function uncheckAll(field) {
if (checked) { // if checkboxes are checked then check them
for (i = 0; i < field.length; i++) { // loop through the array of checkboxes & uncheck them
field[i].checked = false;
}
checked = false;
}
}
function encodeForHTML(inString)
{
var outString = inString;
outString = replace(outString, '&', '&amp;'); // NOTE: This replace must be done first!
outString = replace(outString, '<', '&lt;');
outString = replace(outString, '>', '&gt;');
return outString;
}
function encodeForHTMLPlusQuot(inString, bEncodeSpace)
{
var outString = inString;
outString = replace(outString, '&',  '&amp;'); // NOTE: This replace must be done first!
outString = replace(outString, '<',  '&lt;');
outString = replace(outString, '>',  '&gt;');
outString = replace(outString, '\"', '&quot;');
if (bEncodeSpace)
{	outString = replace(outString, ' ', '&#160;'); // &#160; is &nbsp;
}
return outString;
}
function encodeForXML(inString)
{
var outString = inString;
outString = replace(outString, '&',  '&amp;'); // NOTE: This replace must be done first!
outString = replace(outString, '<',  '&lt;');
outString = replace(outString, '>',  '&gt;');
outString = replace(outString, '\"', '&quot;');
outString = replace(outString, '\'', '&apos;');
return outString;
}
function translateControlCharsForXMLParsing(input)
{
var ch;
var chCode;
var len 		= input.length;
var escaped 	= "";
for (var i=0; i < len; i++)
{
ch = input.charAt(i);
chCode = input.charCodeAt(i);
if (ch != '\t' && ch != '\n' && ch != '\r' && chCode <= 31 )
{
escaped += "&#x" + Dec2Hex(chCode) +";";
}
else
{
escaped += "" + ch;
}
}
return escaped;
}
function Dec2Hex(Decimal)
{
var hexChars = "0123456789ABCDEF";
var a = Decimal % 16;
var b = (Decimal - a)/16;
var hex = "" + hexChars.charAt(b) + hexChars.charAt(a);
return hex;
}
function replace(sourceString, oldString, newString)
{
var startIndex = 0;
var pos;
pos = sourceString.indexOf(oldString, startIndex);
if(pos == -1)
{
return sourceString;
}
else
{
var tempstr  = sourceString.substr(pos + oldString.length);
sourceString = sourceString.substring(startIndex, pos) + newString + replace(tempstr, oldString, newString);
}
return sourceString;
}
String.prototype.trim = function()
{
var x=this;
x=x.replace(/^\s*(.*)/, "$1");
x=x.replace(/(.*?)\s*$/, "$1");
return x;
}
Date.toCQDateFormat = function(localMillisecondsStr, appendTime)
{
var dummyDate = new Date();
var tzoInMilliseconds = dummyDate.getTimezoneOffset()*60*1000;
var gmtMilliseconds = parseInt(localMillisecondsStr) + tzoInMilliseconds;
var tempDate = new Date(gmtMilliseconds);
var dateStr = tempDate.getFullYear() + "";
var mon = tempDate.getMonth() + 1;
if (mon < 10)
{
dateStr += "-0" + mon;
}
else
{
dateStr += "-" + mon;
}
var day = tempDate.getDate() + "";
if (day < 10)
{
dateStr += "-0" + day;
}
else
{
dateStr += "-" + day;
}
var timeStr = "";
if (appendTime > 0)
{	// Returned string should include time part in "hh:mm:ss" format
var hrs			= tempDate.getHours();
if (hrs < 10)
{
timeStr += "0" + hrs;
}
else
{
timeStr += hrs;
}
var mins	= tempDate.getMinutes();
if (mins < 10)
{
timeStr += ":0" + mins;
}
else
{
timeStr += ":" + mins;
}
var seconds	= tempDate.getSeconds();
if (seconds < 10)
{
timeStr += ":0" + seconds;
}
else
{
timeStr += ":" + seconds;
}
return  dateStr + " " + timeStr;
}
return  dateStr;
}
Date.fromCQFormatToLocaleDateString = function(dateStr, dateCode, appendTime)
{
var locDateStr 	= new Array(); // This array will be returned by the function
var onlyDate	= "";
var onlyTime	= "";
var len			= 0;
var parsedDate	= "";
var parsedTime	= "";
var tempDate	= null;
var showDate	= 1;
if (dateStr == undefined || dateStr == '')
{
locDateStr[locDateStr.length] = '';
locDateStr[locDateStr.length] = '';
return locDateStr;
}
if (dateCode != undefined && dateCode != null && !isNaN(dateCode))
{
showDate	= dateCode;
}
var datetimeArray	= dateStr.split(" ");
onlyDate		= datetimeArray[0];
parsedDate      = onlyDate.split("-");
len				= dateStr.length;
if (len > 11)
{
onlyTime	= datetimeArray[1];
parsedTime	= onlyTime.split(":");
}
if (showDate != 0 			&&
parsedDate.length > 2 	&&
(appendTime == 0 || parsedTime.length < 1))
{
tempDate 	= new Date(parsedDate[0], parsedDate[1] - 1, parsedDate[2]);
}
else if (	showDate != 0 			&&
parsedDate.length > 2 	&&
appendTime == 1 		&&
parsedTime.length > 2)
{
tempDate	= new Date(	parsedDate[0], parsedDate[1] - 1, parsedDate[2],
parsedTime[0], parsedTime[1], parsedTime[2])
}
else if (	showDate == 0 			&&
parsedDate.length > 2 	&&
appendTime != 0 		&&
parsedTime.length > 2)
{
tempDate	= new Date(1970, 1, 1, parsedTime[0], parsedTime[1], parsedTime[2]);
}
if (showDate != 0 		&&
tempDate != null 	&&
!isNaN(tempDate)  	&&
(appendTime == 0 || parsedTime.length < 1))
{
if (dateCode == 1) {
locDateStr[0]   = onlyDate;
}
else {
locDateStr[0] 	= tempDate.toLocaleDateString();
}
}
else if ( 	showDate != 0 		&&
tempDate != null 	&&
!isNaN(tempDate)  	&&
appendTime == 1 )
{
if (dateCode == 1) {
locDateStr[0] 	= onlyDate + " " + onlyTime;
}
else {
locDateStr[0] 	= tempDate.toLocaleString();
}
}
else if ( 	showDate == 0 		&&
tempDate != null 	&&
!isNaN(tempDate)  	&&
appendTime == 1 )
{
locDateStr[0]		= datetimeArray[1];
}
if (tempDate == null || isNaN(tempDate))
{
locDateStr[0] = dateStr;
locDateStr[1] = '';
}
else if (tempDate != null && !isNaN(tempDate))
{	// Compute the integer version of date-time in tempDate. NOTE: It uses the Date.UTC() function
locDateStr[1] = Date.UTC(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate(), tempDate.getHours(), tempDate.getMinutes(), tempDate.getSeconds(),tempDate.getMilliseconds());
}
return locDateStr;
}
Date.isValid = function(dateStr)
{
var tempDate 	= new Date(dateStr);
var ok 			= true;
if (isNaN(tempDate))
{
ok = false;
}
return ok;
}
function createDiv (id, htmlStr)
{
var oDiv 			= document.createElement('div');
oDiv.id 			= id;
oDiv.style.display	= '';
oDiv.innerHTML 		= htmlStr;
document.body.appendChild(oDiv);
}
function constructCDATAElement(inValue)
{
var cdataStart  = '<![CDATA['; // This is the string which begins a CDATA element
var cdataEnd    = ']]>';      // This is the string which ends a CDATA element
var returnValue = '';         // The string which is returned will be constructed in this
var startIdx    = 0;          // This is the beginning of the current sub-string we will put enclose in a CDATA
var endIdx      = 0;          // This is the end of the current sub-string we will put enclose in a CDATA
var currIdx     = 0;          // This is our current location in the inValue string as we parse it into
currIdx = inValue.indexOf(']]>');
while (currIdx >= 0)
{	// There is a current segment which is delimited by a trailing cdataEnd sequence,
endIdx=currIdx+2; // The 2 is to get the "]]"
var currSegment = inValue.substring(startIdx, endIdx);
returnValue += cdataStart + currSegment + cdataEnd;
startIdx=endIdx;
var currIdx = inValue.indexOf(cdataEnd, endIdx+cdataEnd.length);
}
endIdx=inValue.length;
var currSegment = inValue.substring(startIdx, endIdx);
returnValue += cdataStart + currSegment + cdataEnd;
return returnValue;
}
function isInteger(inValue)
{	// NOTE: Performing this test is a little tricky, this works because:
return (parseInt(inValue)==inValue-0);
}
function getIFrameDocObj (ifName)
{
var ifDocObj = null;
if (ifName == null || ifName.trim() == "")
{
return ifDocObj;
}
if (snvv_ie) //ie, snvv_ie is defined in common.js
{
ifDocObj = window.frames[ifName].document;
}
else if (snvv_nn) //netscape, snvv_nn is defined in common.js
{
ifDocObj = document.getElementById(ifName).contentDocument;
}
return ifDocObj;
}
function isEnterKey (event)
{
var code = 0;
if (snvv_ie)
{
code = event.keyCode;
}
else if(snvv_nn)
{
code = event.which;
}
if (code == 13)
{
return true;
}
return false;
}
function dbidIsUnsavedNewQuery(dbid)
{	return (isNaN(dbid));
}
function getInnerText(el)
{
if (typeof el == "string")
return el;
if (typeof el == "undefined")
return el;
if (el.innerText)
return el.innerText;
var str = "";
var cNodes 	= el.childNodes;
var len 	= cNodes.length;
for (var i = 0; i < len; i++)
{
switch (cNodes[i].nodeType)
{
case 1: //ELEMENT_NODE
str += getInnerText(cNodes[i]);
break;
case 3:	//TEXT_NODE
str += cNodes[i].nodeValue;
break;
}
}
return str;
}
function contains (srcArray, val)
{
for (var i=0; i<srcArray.length; i++)
{
if (srcArray[i] == val)
{
return true;
}
}
return false;
}
function copyArray (srcArray)
{
var newArray1 = new Array();
for (var i=0; i<srcArray.length; i++)
{
newArray1[newArray1.length] = srcArray[i];
}
return newArray1;
}
function makeSelectControlHTML
(	selectAttributesString,
optionStringsArray,
bIncludeOptionValueAttr,
selectedOptionString)
{
var optionTagsArray = null;
var len = 0;
if(optionStringsArray != null)
{
len = optionStringsArray.length;
}
optionTagsArray = new Array(len);
for (var i=0; i < len; i++)
{
var currOptionString = optionStringsArray[i];
var valueAttr = '';
if (bIncludeOptionValueAttr)
{	valueAttr = ' value="'+encodeForHTMLPlusQuot(currOptionString, false)+'"';
}
var selectedAttr = '';
if ((selectedOptionString != null) && (selectedOptionString == currOptionString))
{	selectedAttr = ' selected="true"';
}
optionTagsArray[i] =
'<option'+valueAttr+selectedAttr+'>'+
encodeForHTMLPlusQuot(currOptionString, true)+
'</option>';
}
var selectHTML = '<select '+ selectAttributesString + ' >'+
optionTagsArray.join("")+
'</select>';
for (var i=0; i < optionTagsArray.length; i++)
{	optionTagsArray[i] = null;
}
optionTagsArray = null;
return selectHTML;
}
function repopulateSelectElement
(	selectElementID,
newOptionStringsArray,
bOptimizePerformance,
bIncludeOptionValueAttr,
selectedOptionString)
{
var currSelectElement = document.getElementById(selectElementID);
if (!currSelectElement)
{	return;
}
var parentDiv = currSelectElement.parentNode;
var bUseOptimizedMethod = false;
if (!bOptimizePerformance)
{	// If the caller says not to optimize, always use the "normal" method
bUseOptimizedMethod = false;
}
else
{	// Caller says to optimize
if (parentDiv.nodeName != 'DIV')
{	// We can only optimize if the parent tag is a <div>, which is not true,
bUseOptimizedMethod = false;
}
else
{	// Parent tag is a <div>, use the "optimized" method.
bUseOptimizedMethod = true;
}
}
if (!bUseOptimizedMethod)
{	//
currSelectElement.options.length = 0;
var selectedIdx = -1;
if (newOptionStringsArray != null)
{
for (var i=0; i < newOptionStringsArray.length; i++)
{	var optionString = newOptionStringsArray[i];
var newOption = null;
if (bIncludeOptionValueAttr)
{	newOption = new Option(optionString, optionString);
}
else
{	newOption = new Option(optionString);
}
currSelectElement.options[i] = newOption;
if ((selectedOptionString != null) && (selectedOptionString == optionString))
{	selectedIdx = i;
}
}
}
if (selectedIdx >= 0)
{	// Make the indicated option be selected
currSelectElement.selectedIndex = selectedIdx;
}
} // End of "Rebuild the list using the normal method"
else
{	//
var tagStartString='<select';
var currSelectElementHTML = parentDiv.innerHTML;
var attributesStartIdx = currSelectElementHTML.indexOf(tagStartString)+tagStartString.length;
var attributesEndIdx   = currSelectElementHTML.indexOf('>', attributesStartIdx);
var selectAttributesString = currSelectElementHTML.substring(attributesStartIdx, attributesEndIdx);
parentDiv.removeChild(currSelectElement);
parentDiv.innerHTML = '';
currSelectElement = null;
var newSelectHTML = makeSelectControlHTML(
selectAttributesString,
newOptionStringsArray,
bIncludeOptionValueAttr,
selectedOptionString);
parentDiv.innerHTML = newSelectHTML;
} // End of "Rebuild the list using the optimized method"
}
function findOptionInSelectControlList(htmlControl, targetValue)
{
var optionsArray = htmlControl.options;
if (optionsArray)
{
for (idx=0; idx < optionsArray.length; idx++)
{
if (optionsArray[idx].value == targetValue)
{	return idx;
}
}
}
if (optionsArray.length == 0)
{
htmlControl.options[0] = new Option(targetValue, targetValue);
return 0;
}
return -1;
}

