// -------------------------------------------------
//                JPORTAL.js (javascript)
// -------------------------------------------------
//
// -------------------------------------------------
// confirm deletion
// -------------------------------------------------
function confirmdelete() { return BINAV_Confirm("Confirm delete of the selected item ?") }
// -------------------------------------------------
// -------------------------------------------------
// setCookie
// -------------------------------------------------
function setCookie (cookieName, cookieValue, expires, path, domain, secure) {
  path="/";
  if ( location.protocol == "https:" ) secure=true;
	
  document.cookie = 
    cookieName + '=' + cookieValue 
    + (expires ? '; EXPIRES=' + expires.toGMTString() : '')
    + (path ? '; PATH=' + path : '')
    + (domain ? '; DOMAIN=' + domain : '')
    + (secure ? '; SECURE' : '');

}
// -------------------------------------------------
// deleteCookie
// -------------------------------------------------
function deleteCookie(name) { 
	var cookie_name=name;
	setCookie(name,"");
//	document.cookie=cookie_name + "=; expires=01-Jan-70 00:00:01 GMT";
}
// -------------------------------------------------
// getCookie
// -------------------------------------------------
function getCookie(name) {
	var cookie_data;
	lower_name=name.toLowerCase();
	switch (lower_name) {
		case "midborder": 
		case "portal_css":
		case "binav_curve":
		case "binav_logo":
		case "tangent_logo":
		case "homedefault":
		case "logindefault":
		case "sql_stagearea":
			return BiNav_Cookie(lower_name); break;
		
		case "portalsession":
			return top.Session; break;

		default:
			if(document.cookie) { 
				index = document.cookie.indexOf(name);
				if (index != -1) {
					namestart = (document.cookie.indexOf("=", index) + 1);
					nameend = document.cookie.indexOf(";", index);
					if (nameend == -1) {nameend = document.cookie.length;}
					cookie_data = document.cookie.substring(namestart, nameend);
					return cookie_data;
					}
				}
			break;
	}
}
// -------------------------------------------------
// -------------------------------------------------
// -------------------------------------------------
function BiNav_Cookie(sub) {
	_ra=getCookie("BiNav_Cookie").split("~");
	for ( c=0;c<_ra.length;c++ )
		if ( _ra[c].split("|")[0].toLowerCase() == sub.toLowerCase() ) {
			return _ra[c].split("|")[1];
			break;
			}
}
// -------------------------------------------------
function Show_BiNav_Cookie(sub) {
	_ra=getCookie("BiNav_Cookie").split("~");
	strCookie="<font color=darkred><b>BINAV_COOKIE</b></font><br>";
	for ( c=0;c<_ra.length;c++ ) strCookie+="<b>&nbsp;&nbsp;"+_ra[c].split("|")[0]+"</b> = "+_ra[c].split("|")[1]+"<br>";
	return strCookie;
}
// -------------------------------------------------
// -------------------------------------------------
// -------------------------------------------------
function sendBack(msg)
{	BINAV_MsgBox(msg);
	history.back()
}
// -------------------------------------------------
// Form init function
// -------------------------------------------------
function selectField(frmName, fldName) 
{ 
document.forms[frmName].elements[fldName].focus();
}
// -------------------------------------------------
// Center Image
// -------------------------------------------------
function centerImage(image)
{
document.write('<table width=100%><tr><td align="center"><img src="'+image+'"></td></tr></table>');
}
// -------------------------------------------------
// Put Date
// -------------------------------------------------
function putdate()
{
var now=new Date();
var day=now.getDay();var nowday="";
if (day==0){nowday="Sun "}; if (day==1){nowday="Mon "}; if (day==2){nowday="Tue "};
if (day==3){nowday="Wed "}; if (day==4){nowday="Thu "}; if (day==5){nowday="Fri "};
if (day==6){nowday="Sat "};
var month=now.getMonth();
var nowmonth=""; 
if (month==0){nowmonth="Jan "}; if (month==1){nowmonth="Feb "}; if (month==2){nowmonth="Mar "};
if (month==3){nowmonth="Apr "}; if (month==4){nowmonth="May "}; if (month==5){nowmonth="Jun "};
if (month==6){nowmonth="Jul "}; if (month==7){nowmonth="Aug "}; if (month==8){nowmonth="Sep "};
if (month==9){nowmonth="Oct "}; if (month==10){nowmonth="Nov "}; if (month==11){nowmonth="Dec "};
var year=now.getYear(); var nowyear="";
if (year==99) {nowyear="1999"} else {nowyear=nowyear+2000};

return nowday+nowmonth+now.getDate()+", "+nowyear;

//  return mm+'/'+dd+'/'+yy;
}
// -------------------------------------------------
// unquote Remove quotes
// -------------------------------------------------
function unquote(obj)
{
var x=obj.value;

while (x.match(/'/)) {x=x.replace(/'/,"");}
while (x.match(/"/)) {x=x.replace(/"/,"");}
obj.value=x;
}
// -------------------------------------------------
// unquote Remove carriage returns
// -------------------------------------------------
function uncrlf(form,obj)
{
var x=form[obj].value;
x=escape(x);
while (x.match(/%09/)) { x=x.replace("%09","%20"); }
x=unescape(x);

while (x.match("\r\n")) { x=x.replace("\r\n"," "); }
while (x.match(/'/)) {x=x.replace(/'/,"");}
while (x.match(/"/)) {x=x.replace(/"/,"");}

//BINAV_MsgBox(x);

form[obj].value=x;
}
// -------------------------------------------------
// Trim spaces
// -------------------------------------------------
function trim(x) {
x=escape(x);
while (x.match(/%09/)) { x=x.replace("%09","%20"); }
x=unescape(x);
while (x.match("\r\n")) { x=x.replace("\r\n"," "); }
while (x.substring(0,1) == ' ') x = x.substring(1);
while (x.substring(x.length-1,x.length) == ' ') x = x.substring(0,x.length-1);
return x;
}
// -------------------------------------------------
// Remove carriage returns
// -------------------------------------------------
function NO_returns(x)
{
x=escape(x);
while (x.match(/%09/)) { x=x.replace("%09","%20"); }
x=unescape(x);

while (x.match("\r\n")) { x=x.replace("\r\n"," "); }
return x;
}
// -------------------------------------------------
// Remove quotes
// -------------------------------------------------
function NO_quotes(x) {
	while (x.match(/'/)) {x=x.replace(/'/,"");}
	while (x.match(/"/)) {x=x.replace(/"/,"");}
	return x;
}
// ----------------------------------------------------------------
//  Top Bar Loading Message
// ----------------------------------------------------------------
function tt_loading(onoff) {

	if (top.parent.midbar)
		if ( onoff.toLowerCase()=="off")
			top.parent.midbar.hide_Wait();
		else
			top.parent.midbar.show_Wait();
}
// ----------------------------------------------------------------
//  Top Bar EXCEL button
// ----------------------------------------------------------------
function tt_EXCEL(onoff,sql) {

if (top.parent.topbar) {
	top.parent.topbar.document.all["excel"].style.display=onoff;
	if (sql) top.parent.topbar.excel_sql=sql;
	}
}
// ----------------------------------------------------------------
function make_mmddyy(d) {

	mm=d.substr(5,2);
	dd=d.substr(8,2);
	yy=d.substr(2,2);

return mm+"/"+dd+"/"+yy;
}
// --------------------------------------------------------------------
// drop down list methods
// --------------------------------------------------------------------
// --------------------------------------------------------------------
var current_list;
var current_nList;
var current_value;
var totLists;
var Lists;
var next_option=true;
var space10="<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

// --------------------------------------------------------------------
function runsql(sql) {
	strR=DB_Asp( sql );
	if (strR=="") return -1;
	SQL2Grid(strR);
	return 0;
}
// --------------------------------------------------------------------
function dropDownFn(form,view) {
	sql="select * from "+view;
	if (runsql(sql) == (-1) ) return -1;
	var rows=DB_data.length;   			// rows
	var cols=DB_data[0].length;			// cols
	for (i=0;i<rows;i++)
		Load_List(form, trim(DB_data[i][0]), trim(DB_data[i][1]) );
	form.options[0].selected=true;
	return 0;
}
// --------------------------------------------------------------------
function this_list(x) {
	nList=Number( x.name.replace("select","") );
	current_list=Lists[nList];
	current_nList=nList;
	nList=Number( x.name.replace("select","") );

	if ( next_option )
		for (n=nList+1;n<totLists;n++) Clear_List(pageform["select"+String(n)]);	
}
// --------------------------------------------------------------------
function next_list(x) {
	
	if ( current_nList != 1 && ! next_option ) return;
	if (x.value == "") return;
	nList=Number( x.name.replace("select","") );
	if ( nList+1 <= totLists ) next=Lists[nList+1];
	current_value=x.value;
	if ( next == "" ) return;
	document.all["message"].style.display="";
	setTimeout(next+"_list()",1);
}
// --------------------------------------------------------------------
// reporting area
// --------------------------------------------------------------------
function rw(t) {
	parent.DisplayArea.document.write(t+'\r');
}
// --------------------------------------------------------------------
function clear_DisplayArea(msg) {
	if ( ! msg ) msg="";
	parent.DisplayArea.document.write("<html><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+
						msg+"</html>");
	parent.DisplayArea.document.close();
}
// --------------------------------------------------------------------
// -------------------------------------------------
// Common Formatting methods
// -------------------------------------------------
// Format date field mm/dd/yy
// -------------------------------------------------
function xdate(dte) {

	if ( ! dte.match("/") ) return;
	dra=dte.split("/");

	dra[0]="00"+dra[0]; dra[0]=dra[0].substr(dra[0].length-2);
	dra[1]="00"+dra[1]; dra[1]=dra[1].substr(dra[1].length-2);
	dra[2]="00"+dra[2]; dra[2]=dra[2].substr(dra[2].length-2);
	return dra[0]+"/"+dra[1]+"/"+dra[2];
}
// ----------------------------------------------------------------
//  Date field validation
// ----------------------------------------------------------------
function y2k(number) { return (number < 1000) ? number + 1900 : number; }
// --------------------------------------------------------
function good_date (day,month,year) {
// checks if date passed is valid
// will accept dates in following format:
// isDate(dd,mm,ccyy), or
// isDate(dd,mm) - which defaults to the current year, or
// isDate(dd) - which defaults to the current month and year.
// Note, if passed the month must be between 1 and 12, and the
// year in ccyy format.

    var today = new Date();
    year = ((!year) ? y2k(today.getYear()):year);
    month = ((!month) ? today.getMonth():month-1);
    if (!day) return false
    var test = new Date(year,month,day);
    if ( (y2k(test.getYear()) == year) && (month == test.getMonth()) && (day == test.getDate()) )
        return true;
    else
        return false
}
// --------------------------------------------------------
function daysElapsed(date1,date2) {
    var difference =
        Date.UTC(y2k(date2.getYear()),date2.getMonth(),date2.getDate(),0,0,0)
       -Date.UTC(y2k(date1.getYear()),date1.getMonth(),date1.getDate(),0,0,0);
    return difference/1000/60/60/24;

//document.write(daysElapsed(new Date(2000,0,1),new Date(1999,11,31)));
}
// -------------------------------------------------
function nocomma(z)
{
x=String(z);
while (x.search(/,/)!=-1) x=x.replace(/,/,"");
return parseFloat(x) ;
}
// -------------------------------------------------
// Format Float
function xfloat(number) {
	var negative=false;
	if (number<0) { negative=true; number=number*(-1); }

	var num = new String(number);
	if(num.indexOf(".") == -1) {
		intLen = num.length;
		toEnd = intLen;
		var strLeft = new String(num.substring(0, toEnd));
		var strRight = new String("00");
	}
	else {
		pos = eval(num.indexOf("."));
		var strLeft = new String(num.substring(0, pos));
		intToEnd = num.length;
		intThing = pos + 1;
		var strRight = new String(num.substring(intThing, intToEnd));
			
		if(strRight.length > 2) {
			nextInt = strRight.charAt(2);
			if (nextInt >= 5) {
				strRight = new String(strRight.substring(0, 2));
				strRight = new String(eval((strRight * 1) + 1));
				if((strRight * 1) >= 100) {
					strRight = "00";
					strLeft = new String(eval((strLeft * 1) + 1));
				}				
				if(strRight.length <= 1) {
					strRight = new String("0" + strRight);
				}
			}
			else {
				strRight = new String(strRight.substring(0, 2));
			}
		}
		else {
			if(strRight.length != 2) {
				strRight = strRight + "0";
			}
		}
	}
	if(strLeft.length > 3) {
		var curPos = (strLeft.length - 3);
		while(curPos > 0) {
			var remainingLeft = new String(strLeft.substring(0, curPos));
			var strLeftLeft = new String(strLeft.substring(0, curPos));
			var strLeftRight = new String(strLeft.substring(curPos, strLeft.length));
			strLeft = new String(strLeftLeft + "," + strLeftRight);
			curPos = (remainingLeft.length - 3);
		}
	}

	strWhole = strLeft + "." + strRight;

// finalValue = "$" + strWhole;

	finalValue = strWhole;
	finalValue = strWhole;
	if (negative) finalValue="("+finalValue+")";
	return(finalValue);
}
// -------------------------------------------------
// -------------------------------------------------
// Format Integer
function xint(number) {
	
	var negative=false;

	number=Math.round(number);

	if (number<0) { negative=true; number=number*(-1); }

	var num = new String(number);
	if(num.indexOf(".") == -1) {
		intLen = num.length;
		toEnd = intLen;
		var strLeft = new String(num.substring(0, toEnd));
		var strRight = new String("00");
	}
	else {
		pos = eval(num.indexOf("."));
		var strLeft = new String(num.substring(0, pos));
		intToEnd = num.length;
		intThing = pos + 1;
		var strRight = new String(num.substring(intThing, intToEnd));
			
		if(strRight.length > 2) {
			nextInt = strRight.charAt(2);
			if (nextInt >= 5) {
				strRight = new String(strRight.substring(0, 2));
				strRight = new String(eval((strRight * 1) + 1));
				if((strRight * 1) >= 100) {
					strRight = "00";
					strLeft = new String(eval((strLeft * 1) + 1));
				}				
				if(strRight.length <= 1) {
					strRight = new String("0" + strRight);
				}
			}
			else {
				strRight = new String(strRight.substring(0, 2));
			}
		}
		else {
			if(strRight.length != 2) {
				strRight = strRight + "0";
			}
		}
	}
	if(strLeft.length > 3) {
		var curPos = (strLeft.length - 3);
		while(curPos > 0) {
			var remainingLeft = new String(strLeft.substring(0, curPos));
			var strLeftLeft = new String(strLeft.substring(0, curPos));
			var strLeftRight = new String(strLeft.substring(curPos, strLeft.length));
			strLeft = new String(strLeftLeft + "," + strLeftRight);
			curPos = (remainingLeft.length - 3);
		}
	}

	strWhole = strLeft;
	finalValue = strWhole;
	if (negative) finalValue="("+finalValue+")";
	return(finalValue);
}
// -------------------------------------------------
function cent(amount) {
// returns the amount in the .99 format
    amount -= 0;
    return (amount == Math.floor(amount)) ? amount + '.00' : (  (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}

// -------------------------------------------------
function report_title(t1,t2,t3,t4) {

	title_str="";
	title_str=title_str+"<center>";
	title_str=title_str+"<h3>"+t1+"<br>";
	title_str=title_str+t2+"<br>";
	title_str=title_str+t3+"</h3>";
	title_str=title_str+"<b>"+t4+"</b>";
	title_str=title_str+"</center>";

	return title_str;
}
// -------------------------------------------------
// -------------------------------------------------
// mmddyy_DateFormat - enter a date as mmddyy 
//	and convert to mm/dd/yy
// -------------------------------------------------
// -------------------------------------------------
function mmddyy_DateFormat( x ) {
	bad_date=false;
	dateval=x;
	if ( dateval.match("/") != "/" ) {
		if ( dateval.length != 6 && dateval.length != 8 ) bad_date=true;
		dv=dateval;
		dateval=dv.substr(0,2)+"/"+dv.substr(2,2)+"/"+dv.substr(4);
		}
	if ( bad_date ) return "";
	return dateval;
}
// -------------------------------------------------
function timekey2char(tk) {

	if ( tk != "" && tk != "0" ) {
		var xtk=String(tk);	
		var m=xtk.substr(4,2);
		var d=xtk.substr(6,2);
		var y=xtk.substr(2,2);
		return m+"/"+d+"/"+y;
		}
	else
		return" ";
}
// -------------------------------------------------
function char2timekey(xtk) {	

	if ( is_a_date(xtk) ) {
		tkra=xtk.split("/");
		mmx="00"+trim(tkra[0]); mm=mmx.substring(mmx.length-2);
		ddx="00"+trim(tkra[1]); dd=ddx.substring(ddx.length-2);

		yyyy=tkra[2];

		if ( Number(tkra[2]) > 20 && tkra[2].length < 4 )
			yyyy="19"+tkra[2];	
		if ( Number(tkra[2]) <= 20 && tkra[2].length < 4 )
			yyyy="20"+tkra[2];
		return yyyy+mm+dd;
		}
	else
		return xtk;
}	
// -------------------------------------------------
function is_a_date( check ) {
	dra=check.split("/");
	if ( ! good_date(dra[1],dra[0]) || isNaN(dra[2]) || ( dra[2].length != 2 && dra[2].length !=4 ) ) return false;
	return true;
}
// -------------------------------------------------
function intdiff(n1,n2) {
	return Math.round(n1)-Math.round(n2);
}
// -------------------------------------------------
function make_Zipcode(z) {
	zipc=trim(z);
	if (zipc.length > 5 ) zipc=zipc.substr(0,5)+'-'+zipc.substr(5);
	return zipc;
}
// -------------------------------------------------
// Get todays date
// -------------------------------------------------
function todays_date() {
	var date = new Date();
	var d  = date.getDate();
	var day = (d < 10) ? '0' + d : d;
	var m = date.getMonth() + 1;
	var month = (m < 10) ? '0' + m : m;
	var yy = date.getYear();
	var year = (yy < 1000) ? yy + 1900 : yy;

	return month + "/" + day + "/" + String(year).substr(2);
}
// -------------------------------------------------
// Get time now
// -------------------------------------------------
function time_now() {
	var date = new Date();
	var hh = date.getHours();
	var mm = date.getMinutes();
	var ss = date.getSeconds();

	return((hh < 10) ? '0' + hh : hh) + 
                          ':' + ((mm < 10) ? '0' + mm : mm) +
                          ':' + ((ss < 10) ? '0' + ss : ss);
}
// --------------------------------------------------------
// --------------------------------------------------------
function Modifier_DateTime() {

	return getCookie("PortalUser")+" @ "+todays_date()+" "+time_now();
}
// --------------------------------------------------------
// --------------------------------------------------------
// --------------------------------------------------------
// n=number, d=decimal places
// --------------------------------------------------------
function round (n, d) {
  n = n - 0; // force number
  if (d == null) d = 2;
  var f = Math.pow(10, d);
  n += Math.pow(10, - (d + 1)); // round first
  n = Math.round(n * f) / f;
  n += Math.pow(10, - (d + 1)); // and again
  n += ''; // force string
  return d == 0 ? n.substring(0, n.indexOf('.')) :
      n.substring(0, n.indexOf('.') + d + 1);
}
// -------------------------------------------------
function getAAS(aasvar) { 

	if ( aasvar == "" ) return "ERROR";

	var namepart=aasvar.split(".")[0];
	var datapart=aasvar.split(".")[1];

	if ( namepart == "dates" )
		for (i=0;i<top.left.AAS_dates.length;i++)
			if ( top.left.AAS_dates[i][0] == datapart ) return top.left.AAS_dates[i][1];

	if ( namepart == "user" )
		for (i=0;i<top.left.AAS_user.length;i++)
			if ( top.left.AAS_user[i][0] == datapart ) return top.left.AAS_user[i][1];

	return "ERROR";
}
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
// Generic window launching utilities

function NewWindow(url, name, features) {

	if (window[name] && !window[name].closed) window[name].close();

	if ( url == "" ) url="/binavigator/binav25/blankpage.asp";

	window[name] = window.open(url, name, features);
	window[name].focus();
}
function closeChildWindows() {
	for (var i = 0; i < closeChildWindows.arguments.length; i++) {
		if (window[closeChildWindows.arguments[i]] && !window[closeChildWindows.arguments[i]].closed)
			window[closeChildWindows.arguments[i]].close();
	}
}
// -------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------
function getRealLeft(el) {
    xPos = el.offsetLeft;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
    }
    return xPos;
}
// -------------------------------------------------------------------------------------
function getRealTop(el) {
    yPos = el.offsetTop;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
    return yPos;
}
//----------------------------------------------------------------------------------------
function Xright(obj,len) {
	return obj.substr(obj.length-len);
}
//----------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
// SELECT LIST FUNCTIONS
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
// load a select list
// ------------------------------------------------------------------------------------
function Load_List(formlist,txt,val) {	
	formlist.options[formlist.length]=new Option(txt,val); 
}
// ------------------------------------------------------------------------------------
// get selected index
// ------------------------------------------------------------------------------------
function Get_SelectedIndex(formlist, mult) {

	if (mult=="" || ! mult) {
		indx=formlist.selectedIndex;
		if ( indx == -1 ) return "";
		return indx;
		}

	retMult="";
	for ( s=0; s<formlist.length; s++ )
		if (formlist.options[s].selected)
			if (retMult.length==0) 	retMult	= String(s);
			else			retMult+=", "+String(s);

	return retMult;
}
// ------------------------------------------------------------------------------------
// get selected value
// ------------------------------------------------------------------------------------
function Get_SelectedValue(formlist, mult) {

	if (mult=="" || ! mult) {
		indx=formlist.selectedIndex;
		if ( indx == -1 ) return "";
		return trim(formlist.options[indx].value);
		}

	retMult="";
	for ( s=0; s<formlist.length; s++ )
		if (formlist.options[s].selected) {
			val=formlist.options[s].value;
			while (val.match(/,/)) { val=val.replace(","," "); }
			if (retMult.length==0) 	retMult	="'"+trim(val)+"'";
			else			retMult+=", '"+trim(val)+"'";
			}
	return retMult;
}
// ------------------------------------------------------------------------------------
// get selected text
// ------------------------------------------------------------------------------------
function Get_SelectedText(formlist, mult) {

	if (mult=="" || ! mult) {
		indx=formlist.selectedIndex;
		if ( indx == -1 ) return "";
		return trim(formlist.options[indx].text);
		}

	retMult="";
	for ( s=0; s<formlist.length; s++ )
		if (formlist.options[s].selected) {
			val=formlist.options[s].text;
			while (val.match(/,/)) { val=val.replace(","," "); }
			if (retMult.length==0) 	retMult	="'"+trim(val)+"'";
			else			retMult+=", '"+trim(val)+"'";
			}
	return retMult;
}
// ------------------------------------------------------------------------------------
// set selected 
// ------------------------------------------------------------------------------------
function Set_Selected(formlist,val) {

	if ( val != null && typeof(val) == "object" ) val=val.value;
	
	if ( typeof(val) == "number" ) {
		if ( val == null ) val=0;
		for (i=0;i<formlist.length;i++)
			if ( trim(formlist.options[i].value)==trim(val) ) {
				formlist.options[i].selected=true;
				break;
				}
		}
	else {
		if ( val == null ) val="";
		for (i=0;i<formlist.length;i++)
			if ( trim(formlist.options[i].value.toLowerCase())==trim(val.toLowerCase()) ) {
				formlist.options[i].selected=true;
				break;
				}
		}
}
// ------------------------------------------------------------------------------------
function Set_SelectedValue(formlist,val) {

	if ( val != null && typeof(val) == "object" ) val=val.value;

	if ( val == null ) val="";
	for (i=0;i<formlist.length;i++)
		if ( trim(formlist.options[i].value.toLowerCase())==trim(val.toLowerCase()) ) {
			formlist.options[i].selected=true;
			break;
			}
}
// ------------------------------------------------------------------------------------
function Set_SelectedText(formlist,val) {

	if ( val != null && typeof(val) == "object" ) val=val.value;

	if ( val == null ) val="";
	for (i=0;i<formlist.length;i++)
		if ( trim(formlist.options[i].text.toLowerCase())==trim(val.toLowerCase()) ) {
			formlist.options[i].selected=true;
			break;
			}
}
// ------------------------------------------------------------------------------------
// assign from_list -> to_list
// ------------------------------------------------------------------------------------
function Assign_FromTo(fromlist,tolist)
{	var goodadd=true;
	for (i=0; i<fromlist.length;i++)
		 if (fromlist.options[i].selected) {
		 	newtxt=fromlist.options[i].text ;
		 	newval=fromlist.options[i].value;
			fromlist.options[i].selected=false;

			goodadd=true;				
			for (j=0;j<tolist.length;j++) if (newval==tolist.options[j].value) goodadd=false;
				
			if (goodadd) tolist.options[tolist.length]= new Option(newtxt,newval);
		    	} 
}
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
function Remove_List(formlist)
{
	list_length=formlist.length;
	for (var i=formlist.options.length-1; i>=0; i--) {
		if ( formlist.options[i].selected ) formlist.options[i]=null;
		}
}
// ------------------------------------------------------------------------------------
function Clear_List(formlist) {	formlist.length=0; }
// ------------------------------------------------------------------------------------
function RemoveList_Text(formlist, txt) {

	for ( s=0; s<formlist.length; s++ )
		if (formlist.options[s].text.toLowerCase() == txt.toLowerCase()) {
			formlist.options[s]=null;
			break;
			}
}
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
function deleteOption(object,index) {
    object.options[index] = null;
}
// ------------------------------------------------------------------------------------
function addOption(object,text,value) {
    var defaultSelected = false;
    var selected = false;
    var optionName = new Option(text, value, defaultSelected, selected)
    object.options[object.length] = optionName;
    object.options[object.length-1].selected = false;
    
}
// ------------------------------------------------------------------------------------
function sortOptions_value(what) {
    var copyOption = new Array();
    for (var i=0;i<what.options.length;i++)
        copyOption[i] = new Array(what[i].value,what[i].text);

    copyOption.sort(function(a,b) { 
	if (b[0]>a[0]) { return -1}
	if (a[0]>b[0]) { return 1}
	return 0;				//	return a[0]-b[0]; 
	});

    Clear_List(what);

    for (var i=0;i<copyOption.length;i++)
        Load_List(what,copyOption[i][0],copyOption[i][1])
}
// ------------------------------------------------------------------------------------
function sortOptions_text(what) {
    var copyOption = new Array();
    for (var i=0;i<what.options.length;i++)
        copyOption[i] = new Array(what[i].value,what[i].text);

    copyOption.sort(function(a,b) { 
	if (b[1]>a[1]) { return -1}
	if (a[1]>b[1]) { return 1}
	return 0;				//	return b[1]-a[1]; 
	});

    Clear_List(what);

    for (var i=0;i<copyOption.length;i++)
        Load_List(what,copyOption[i][0],copyOption[i][1])
}
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
function Please_Wait(DOC) {
	DOC.document.write("<html><body style=font-family:verdana;font-size:8pt><br><br><br>Please Wait...</body></html>");
	DOC.document.close();
}
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
//	webLog
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
var strURL;
var version;
var xOBJTYPE;
// ------------------------------------------------------------------------------------
function webLog( obj, id, url, windowValue, windowIcon,logType ) {

	if ( logType == undefined ) logType="";
	
	xOBJTYPE=logType;
	
	setCookie("PortalObjectType",logType);
	setCookie("PortalObjectId",id);
	setCookie("PortalObjectName",obj);

	if ( ! url.match("manuallogging=") )
		if ( getCookie("PortalUser").toLowerCase() != "mspatz" )  {
			xsql="insert into "+ BINAV_CATPREFIX +"weblog (datetime,userid,object,id,session_id,object_type) "+
				" values ( getdate(),'"+getCookie("PortalUser")+"', '"+obj+"', '"+id+"', '"+top.Session+"','"+logType+"')";
			SQL_Execute( xsql );
			}

	if ( url == "" || url == null || url == "null" ) {
		BINAV_MsgBox("The link is empty...nothing to launch.");
		return;
		}

	urlRA=url.split("?");
	if ( urlRA[0] == "" || urlRA[0] == null || urlRA[0] == "null" ) {
		BINAV_MsgBox("The link is empty...nothing to launch.");
		return;
		}

	parent.topbar.render_buttons("off");
	
	if ( windowIcon == "" || windowIcon == undefined || windowIcon == null )
		parent.midbar.document.all["newwindow"].style.display="none";
	else 
		parent.midbar.document.all["newwindow"].style.display="";				

	ereport=false;
	insight=false;
	dashboard=false;
	sqlrs=false;
	if ( logType.toLowerCase() == "ereport" )   ereport=true;
	if ( logType.toLowerCase() == "insight" )   insight=true;
	if ( logType.toLowerCase() == "dashboard" ) dashboard=true;
	if ( logType.toLowerCase() == "sqlrs" ) sqlrs=true;

	strURL=url;	

	if ( strURL.match("nonavbar=true") || sqlrs ) {
		parent.parent.midbar.close_menuArea();
		parent.parent.midbar.show_midbar();
		}

	if ( strURL.match("javascript:") ) {
		if ( strURL.match("delay=true") )
			setTimeout("launch_jscript()",1000)
		else
			eval( strURL.split(":")[1] );
		return;
		}

//	if ( ereport || strURL.match("/acweb/") != null ) {
	if ( ereport ) {
		if ( getCookie("PortaleReporting_UserId") == "" ) { BINAV_MsgBox("You are not authorized to run eReports."); return; }
		ereport=true;
		strURL=location.protocol+"//"+location.hostname+strURL;
		parent.parent.midbar.close_menuArea();
		parent.parent.midbar.show_midbar();
		}

	if ( strURL.match("BINAV_Param_") ) {
		if ( ! strURL.match("manuallogging=") ) strURL=URL_Process(strURL);
		}

	if ( strURL.toLowerCase().match("binav_window.asp") ) {
		ra=strURL.toLowerCase().split("script=");
		windowScript=ra[1];
		ra=strURL.toLowerCase().split( "placement=" );
		if ( ra.length > 0 ) windowPlacement=ra[1];
		if (!windowPlacement || windowPlacement == "") 
			windowPlacement="top=150,left=300,width=400,height=400";

		NewWindow(windowScript,"pW","menubar=no,toolbar=no,resizable=yes,scrollbars=no,"+windowPlacement);
		return;
		}
	
	if ( insight ) {
// ****************************************
		if ( strURL.match("render=java") ) parent.midbar.render_buttons("on"); 
// ****************************************
		Xsql="select value from "+ BINAV_CATPREFIX +"BINAV_InsightDesigner_Properties "+
					"where object_id="+id +" and property='blox_id'";
		Fetch_Data(Xsql)
		if ( rSet.recordcount != 0 ) {
			top.left.AAS_blox=rSet("value").value;
			}
		}

	if ( dashboard ) parent.midbar.render_dashboard("on");		// *********************

	if ( windowValue == (-1) ) 
		window.open(strURL);
	else {
		if ( ereport || strURL.match("delay=true") ) {
			parent.content.location="/binavigator/binav25/BINav_Please_Wait.asp";
			setTimeout("preLaunch_strURL()",1000);
			}
		else {
			parent.content.location="/binavigator/binav25/BINav_Please_Wait.asp";
			setTimeout("preLaunch_strURL()",100);
			}
		}
}
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
function preLaunch_strURL() {

	if ( top.left.setInterval_ID != 0 ) top.left.clear_setInterval();

	strURL=trim(strURL);

	if ( ! strURL.match("random=") && xOBJTYPE != "sqlrs"  )  {
		if ( strURL.split("?").length == 1 ) 
			strURL=strURL+"?random="+String(Math.random()).substr(2,6);
		else
			strURL=strURL+"&random="+String(Math.random()).substr(2,6);
		}

	if ( strURL.toLowerCase().match("refresh=") ) {
		millisecs=Number(runarg("refresh",strURL))*1000;
		launch_strURL();
		parent.left.start_setInterval( "parent.content.location.reload(true)", millisecs );
		}
	else 
		launch_strURL();
}
// ------------------------------------------------------------------------------------
function launch_strURL() {

	strURL=strURL.replace(/\?\&/g,"?");
	
	if ( strURL.toLowerCase().match(".rox") ) {
		parent.midbar.document.all["edelivery"].style.display="none";		// *********
		parent.midbar.document.all["schedule"].style.display="none";		// *********
		}
	else
		parent.midbar.show_midbar();

	parent.content.location=strURL;
}
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
function launch_jscript() {
	eval( strURL.split(":")[1] );
}
// ------------------------------------------------------------------------------------
function URL_Process( u ) {
	qRA=u.split("?");
	if ( qRA.length != 2 ) {
//		BINAV_MsgBox("Malformed URL.");
		return u;
		}

	uRA=qRA[1].split("&");

	Xsql="select * from "+ BINAV_CATPREFIX +"binav_configuration "+
				" where application='binav_portal' and property='binav_portal_user_proc'";
	Fetch_Data(Xsql);
	if ( rSet.recordcount == 0 ) return;
	Fetch_Data("exec "+rSet("value").value+" '"+getCookie("PortalUser")+"'");
	uSet=rSet;


	Xsql="select * from "+ BINAV_CATPREFIX +"binav_configuration "+
				" where application='binav_portal' and property='binav_portal_dates_table'";
	Fetch_Data(Xsql);
	if ( rSet.recordcount == 0 ) return;
	Fetch_Data("select * from "+rSet("value").value);
	dSet=rSet;

	for (i=0;i<uRA.length;i++) {
		if ( ! uRA[i].match("BINAV_Param_") ) continue;

		if ( uRA[i].match("=") ) continue;

		if ( uRA[i].match("BINAV_Param_User_") ) {
			param=uRA[i].split("BINAV_Param_User_")[1];

			val=trim(uSet(trim(param)).value);	//			val=val.replace(/&/g,"~~~");

			u=u.replace( uRA[i], uRA[i]+"="+ escape(val) );
			}

		if ( uRA[i].match("BINAV_Param_Date_") ) {
			param=uRA[i].split("BINAV_Param_Date_")[1];

			val=trim(dSet(trim(param)).value);	//			val=val.replace(/&/g,"~~~");

			u=u.replace( uRA[i], uRA[i]+"="+ escape(val) );
			}
		if ( uRA[i].match("BINAV_Param_Server_Name") ) {
			param=uRA[i].split("BINAV_Param_Date_")[1];

			val=location.protocol+"//"+location.hostname;

			u=u.replace( uRA[i], uRA[i]+"="+ escape(val) );
			}
		}
	uSet=""; delete uSet;
	dSet=""; delete dSet;

	return u;
}
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
var fromDialog="";
var ttlDialog;
var msgDialog;
var btnDialog;
// ------------------------------------------------------------------------------------
function BINAV_MsgBox(m,b,t) {


	w=250;
	h=120;
	if ( b == undefined || b == "" ) b="OK";
	if ( t == undefined ) t="";

	while ( m.match("<BR>") ) m=m.replace("<BR>","<br>");
	ra=m.split("<br>");
	h=h+ra.length*15;
	
	wmax=250;
	for (i=0;i<ra.length;i++)
		if ( ra[i].length*7 > wmax ) wmax=ra[i].length*7;

	w=Math.min(800,wmax);
	
	bmax=0;
	ra=b.split(",");
	for (i=0;i<ra.length;i++) 
		if ( ra[i].length*10 > bmax ) bmax=ra[i].length*10;

	bmax=Math.max(60,bmax);
	if ( (bmax*ra.length)+70 > w ) w=(bmax*ra.length)+70;
	
	bstr="";
	for (i=0;i<ra.length;i++)  {
		ra[i]=ra[i].replace(" ","~");
		bstr+="<input type=button value='"+ ra[i] +"' onclick=passback_Value('"+ ra[i] +"') style=width:"+ String(bmax) +">&nbsp;";
		}
		
	ttlDialog="";			// t;
	msgDialog=m.replace("\r","<br>");
	btnDialog=bstr;

	oFeatures="dialogHeight:"+ String(h) +"px;"+
		"dialogWidth:"+ String(w) +"px;"+
		"center:yes;"+
		"edge:raised;"+
		"help:no;"+
		"resizable:yes;"+
		"scroll:no;"+
		"status:no;"+
		"unadorned:yes";
	showModalDialog("/binavigator/binav25/binav_modaldialog.asp?random="+String(Math.random()).substr(2,6),window,oFeatures);
	return fromDialog;
}
// ------------------------------------------------------------------------------------
function BINAV_Confirm(m) {
	
	yn=BINAV_MsgBox(m,"Yes,No");
	if ( yn.toLowerCase() == "yes" ) return true;
	return false;
}
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
function row_Banding(oT) {
	t=document.getElementById(oT);
	r=1
	while ( r<t.rows.length ) {
		t.rows(r).style.backgroundColor="#dedede";
		r+=2;
		}
	document.all[oT].style.display="";
}
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
function get_homepage() { 
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
	Xsql="select value from "+ BINAV_CATPREFIX +"binav_configuration "+
		"where application='binav_portal' and property='binav_version'";
	Fetch_Data(Xsql);
	if ( rSet(0).value.toLowerCase() != 'binav 3.0' ) return get_homepage_40();


	Xsql="select homeurl,admin_homeurl from "+ BINAV_USERS +" where userid='"+getCookie("PortalUser")+"'";
	Fetch_USERS(Xsql);
	userhome=rSet("homeurl").value;

	Xsql="select value from "+ BINAV_CATPREFIX +"binav_configuration where "+
			"application='binav_portal' and property='home_default'";
	Fetch_Data(Xsql);
	portalhome=rSet("value").value;	

	if ( userhome   != null && userhome   != "" ) return userhome;
	if ( portalhome != null && portalhome != "" ) return portalhome;


//	Fetch_USERS("select homeurl from "+ BINAV_USERS +" where userid='"+getCookie("PortalUser")+"'");
//	if ( rSet.recordcount == 0 ) 
//		getDefault=true;
//	else
//		if ( trim(rSet(0).value) == "" || rSet(0).value == null ) 
//			getDefault=true;
//		else {
//			id=rSet(0).value;
//			Fetch_Data("select name from "+ BINAV_CATPREFIX +"portal_objects where id="+id);
//			return id;
//			}
//		
//	if ( getDefault ) {
//		Fetch_Data("select value from "+ BINAV_CATPREFIX +"binav_configuration "+
//			" where application='binav_portal' and property='home_default'");
//		if ( rSet.recordcount == 0 ) 
//			return 0;
//		else {
//			id=rSet(0).value;
//			Fetch_Data("select name from "+ BINAV_CATPREFIX +"portal_objects where id="+id);
//			return id;
//			}
//		}
}
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------
function get_homepage_40() { 
// ------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------

	Xsql="select homeurl,admin_homeurl from "+ BINAV_USERS +" where userid='"+getCookie("PortalUser")+"'";
	Fetch_USERS(Xsql);
	userhome=rSet("homeurl").value;
	useradmin=rSet("admin_homeurl").value;

	Xsql="select admin_homeurl from "+ BINAV_ROLES +" where role='"+ top.BINAV_User_Primary_Role +"'";
	Fetch_ROLES(Xsql);
	roleadmin=rSet("admin_homeurl").value;

	Xsql="select value from "+ BINAV_CATPREFIX +"binav_configuration where "+
			"application='binav_portal' and property='home_default'";
	Fetch_Data(Xsql);
	portalhome=rSet("value").value;	

//alert("get_homepage_40"+"\r"+
//	"userhome "+userhome+"\r"+
//	"useradmin "+useradmin+"\r"+
//	"roleadmin "+roleadmin+"\r"+
//	"portalhome "+portalhome+"\r");

	if ( userhome   != null && userhome   != "" ) return userhome;
	if ( useradmin  != null && useradmin  != "" ) return useradmin;
	if ( roleadmin  != null && roleadmin  != "" ) return roleadmin;
	if ( portalhome != null && portalhome != "" ) return portalhome;
}
// --------------------------------------------------------
// --------------------------------------------------------
function BINAV_MidBar_Name(x,i) { 
// --------------------------------------------------------
// --------------------------------------------------------
	setCookie("PortalObjectName", x);
	if ( i != undefined && i != "" ) setCookie("PortalObjectId", i);
	top.midbar.show_midbar();
}
// --------------------------------------------------------
// --------------------------------------------------------
function BINAV_Webmaster() {
	r=getCookie("PortalRole").toLowerCase();
	if ( r.match("webmaster") ) return true;
	return false;
}
// --------------------------------------------------------
// --------------------------------------------------------
function BINAV_checklength(maxlen) {
	tfield=event.srcElement;
	if ( tfield.value.length > maxlen ) tfield.value=tfield.value.substr(0,maxlen);
	return true;
}
// --------------------------------------------------------
// --------------------------------------------------------
function BINAV_Calendar( putback,seed ) {
	if ( seed == null ) seed="";
	NewWindow("/binavigator/calendar/calendar.asp?putback="+putback +"&seed="+ seed,
		"WinCalendar",
		"menubar=no, toolbar=no, resizable=yes, scrollbars=no, top=100, left=150, width=450, height=330");
	
}
// --------------------------------------------------------
// --------------------------------------------------------
function BINAV_LaunchBackend_URL( u ) {
	strURL=u;
	// **********
	xOBJTYPE="";
	// **********
	parent.content.location="/binavigator/binav25/BINav_Please_Wait.asp";
	setTimeout("preLaunch_strURL()",500);
}
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
function runarg(find,xstring) {
	retval="";
	if (! xstring || xstring == "") xstring=location.search;
	if ( xstring == "" ) return "";

//	xarg=unescape(xstring).split("?")[1];
	xarg=xstring.split("?")[1];

	var each=xarg.split("&");
	var args=new Array(each.length);
	for (i=0;i<each.length;i++) {
		x=each[i].split("=");
		if (x[0]==find) { 
			val=trim(x[1]);
			val=val.replace("~~~","&");
			retval=val;
			break;
			}
		}

	if ( find.match("BINAV_Param_") ) retval=unescape(retval);

	return retval;
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
function no_Brackets(x) {
	return x.replace(/\[/g,"").replace(/\]/g,"");
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Type ahead function for select lists
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// usage:
//	<select name="states2" id="states2" size="10" onkeydown="typeAhead()">
//
// global storage object for type-ahead info, including reset() method
var typeAheadInfo = {last:0, 
                     accumString:"", 
                     delay:500,
                     timeout:null, 
                     reset:function() {this.last=0; this.accumString=""}
                    };

// function invoked by select element's onkeydown event handler
function typeAhead() {
   // limit processing to IE event model supporter; don't trap Ctrl+keys
   if (window.event && !window.event.ctrlKey) {
      // timer for current event
      var now = new Date();
      // process for an empty accumString or an event within [delay] ms of last
      if (typeAheadInfo.accumString == "" || now - typeAheadInfo.last < typeAheadInfo.delay) {
         // make shortcut event object reference
         var evt = window.event;
         // get reference to the select element
         var selectElem = evt.srcElement;
         // get typed character ASCII value
         var charCode = evt.keyCode;
         // get the actual character, converted to uppercase
         var newChar =  String.fromCharCode(charCode).toUpperCase();
         // append new character to accumString storage
         typeAheadInfo.accumString += newChar;
         // grab all select element option objects as an array
         var selectOptions = selectElem.options;
         // prepare local variables for use inside loop
         var txt, nearest;
         // look through all options for a match starting with accumString
         for (var i = 0; i < selectOptions.length; i++) {
            // convert each item's text to uppercase to facilitate comparison
            // (use value property if you want match to be for hidden option value)
            txt = selectOptions[i].text.toUpperCase();
            // record nearest lowest index, if applicable
            nearest = (typeAheadInfo.accumString > 
                       txt.substr(0, typeAheadInfo.accumString.length)) ? i : nearest;
            // process if accumString is at start of option text
            if (txt.indexOf(typeAheadInfo.accumString) == 0) {
               // stop any previous timeout timer
               clearTimeout(typeAheadInfo.timeout);
               // store current event's time in object 
               typeAheadInfo.last = now;
               // reset typeAhead properties in [delay] ms unless cleared beforehand
               typeAheadInfo.timeout = setTimeout("typeAheadInfo.reset()", typeAheadInfo.delay);
               // visibly select the matching item
               selectElem.selectedIndex = i;
               // prevent default event actions and propagation
               evt.cancelBubble = true;
               evt.returnValue = false;
               // exit function
               return false;   
            }            
         }
         // if a next lowest match exists, select it
         if (nearest != null) {
            selectElem.selectedIndex = nearest;
         }
      } else {
         // not a desired event, so clear timeout
         clearTimeout(typeAheadInfo.timeout);
      }
      // reset global object
      typeAheadInfo.reset();
   }
   return true;
}
// ------------------------------------------------------------------------------------
function getConfig(app,prop) {
	Xsql="select value from "+ BINAV_CATPREFIX+ "binav_configuration "+
			" where application='"+ app +"' and property='"+ prop +"'";
	Fetch_Data(Xsql);
	if ( rSet.recordcount == 0 )
		return "";
	else
		return rSet(0).value;
}
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
function _u_yxiRT(u,p,pmbc) {
	Fetch_Temp("select value from "+ BINAV_CATPREFIX +"binav_configuration "+
				" where application='binav_portal' and property='encrypted_passwords'");
	if ( tempSet.recordcount != 0 ) {
		if ( tempSet(0).value == "no" ) {
			Xsql="update "+ BINAV_CATPREFIX +"webuser "+
				" set password='"+ p +"' where userid='"+ u +"'";
			SQL_Execute(Xsql);
			}
		else {
			Xsql="exec "+ BINAV_CATPREFIX +"BINAV_SetPassword '"+ trim(u) +"','"+ trim(p) +"'";
			SQL_Execute(Xsql);
			}
		if ( pmbc != undefined && pmbc ) {
			Xsql="update "+ BINAV_CATPREFIX +"webuser "+
				" set password_must_be_changed=0 where userid='"+ u +"'";
			SQL_Execute(Xsql);
			}
		}
}
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
function _g_yxiRT(u,p) {
	var Xsql="select "+ BINAV_CATPREFIX +"fn_yxiRT(Reverse('"+ trim(u) +"')+'"+ trim(p) +"')";
	Fetch_Temp(Xsql);
	var xpwd=tempSet(0).value;
	return xpwd;
}
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
function BINAV_RunNow_Msg(j,s,ret) {
	strip="BINAV_RunNow_";
	pc=getCookie("PortalClient");
	if ( pc != undefined && pc != "" ) strip += pc+"_";

	eventName=j.replace(strip,"");

	if ( ret != "CD" ) {
		BINAV_MsgBox("The event "+ eventName +" has been submitted to Event Manager.<br>"+
			"The event was started at the task "+ s +".<br>"+
			"You can monitor the event's progress from the status page in Event Manager.");

		if ( parent.do_refresh_and_home != undefined )
			parent.do_refresh_and_home();
		else
			parent.location=parent.location;
		return "No";
		}

	yn=BINAV_MsgBox("The event "+ eventName +" has been submitted to Event Manager.<br>"+
			"The event was started at the task "+ s +".<br>"+
			"You can monitor the event's progress from the status page in Event Manager.<br><br>"+
			"Would you like to view the event's status now ?",
			"Yes,No");

	if ( yn.toLowerCase() == "yes") {

		Xsql="select id from "+ BINAV_CATPREFIX +"portal_objects "+
			" where url like '%eventmgr_main.asp%' and name='event manager'";
		Fetch_Temp(Xsql);
		oid=tempSet(0).value;
		uid=getCookie("PortalUser");
	
		execute="/binavigator/binav25/binav_login.asp"+
			"?object="+oid+
			"&user="+uid+
			"&showstatus=yes"+
			"&onlyjob="+j;

		setCookie("BINAV_Object_Execute",execute);

		wWidth=String(top.document.body.offsetWidth-30);
		wHeight=String(top.document.body.offsetHeight-50);

		NewWindow( execute, "wEM", 
			"top=10,left=10,"+
			"location=yes,"+
			"status=yes,"+
			"menubar=yes,"+
			"resizable=yes,"+
			"width="+ wWidth +",height="+ wHeight);

		if ( parent.do_refresh_and_home != undefined )
			parent.do_refresh_and_home();

		}
	return yn;
}
// ----------------------------------------------------------
function strip_PortalClient(x) {
	pc=getCookie("PortalClient");
	z=x.replace(pc+"_","");
	return z;
}
// ----------------------------------------------------------

// ***********************************************
// AUTHOR: WWW.CGISCRIPT.NET, LLC
// URL: http://www.cgiscript.net
// Use the script, just leave this message intact.
// Download your FREE CGI/Perl Scripts today!
// ( http://www.cgiscript.net/scripts.htm )
// ***********************************************
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
var EnableRightClick = 0;
if(isNS) 
document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
  if(EnableRightClick==1){ return true; }
  else {return false; }
}
function mousehandler(e){
  if(EnableRightClick==1){ return true; }
  var myevent = (isNS) ? e : event;
  var eventbutton = (isNS) ? myevent.which : myevent.button;
  if((eventbutton==2)||(eventbutton==3)) return false;
}
function keyhandler(e) {
  var myevent = (isNS) ? e : window.event;
  if (myevent.keyCode==96)
    EnableRightClick = 1;
  return;
}
if ( getCookie("PortalUser") != "mspatz" ) {
	document.oncontextmenu = mischandler;
	document.onkeypress = keyhandler;
	document.onmousedown = mousehandler;
	document.onmouseup = mousehandler;
	}
