function CloseWin(sReturnValue)
{
	window.returnValue = sReturnValue;
	window.close();
	return true;
}

function SendForm(cForm,sMode)
{
	var oCtrl = document.activeElement;
	if ((cForm.LastTabIndex != null) && (oCtrl != null))
		{cForm.LastTabIndex.value = oCtrl.tabIndex;}
	cForm.mode.value = sMode; 
	cForm.submit();
}

function isNumeric(x) 
{
	if (x.search) 
	 {if (x.search(/[^\d,.]/) != -1) return false;}
	return true;
}

function CheckBrowser() {
   if (navigator.appName == "Microsoft Internet Explorer")
        return 'E';
   else
        return 'N';
}

function ShowDialog(sPage,iHeight,iWidth)
{
	if (iHeight == '')
		{iHeight = 200;}
	if (iWidth == '')
		{iWidth = 300;}
		
	if(CheckBrowser()=='E')
		{
			return window.showModalDialog(sPage,"sickat",
      		"dialogHeight:"+iHeight+"px;dialogWidth:"+iWidth+"px; help:yes; scroll:yes;"+
		      "resizable:no; status:no");
		}
		else
		{
			window.location.replace(sPage);
		}
}

function MoOver(objSource,sDesc)
{
	objSource.title = sDesc;
	window.status = sDesc;
}

function MoOut(objSource,sDesc)
{
	if (sDesc == '') 
		{sDesc='Jeeves';}
	window.status = sDesc;
}

function PrintPage()
{
 window.print()
}

function ShowTextEditor(oEdit,bReadOnly,oEdit2, sCap1, sCap2)
{
 	var vReturnValue;
	var bChanged = false;
	var sEdit2;
	var iCount = 1;
	var i;
	var arrCtrls = new Array(2);
	var iReadOnly
	if (bReadOnly) 
	 {iReadOnly=1;}
	else
	 {iReadOnly=0;}
	arrCtrls[0] = oEdit;

	if (oEdit2 != null)
	{
		arrCtrls[1] = oEdit2;
		iCount = 2;
	}
	
	vReturnValue = window.showModalDialog('../include/TextEditor.asp?readonly=' + iReadOnly + '&count='+iCount+'&cap1='+StrToURL(sCap1) + '&cap2='+StrToURL(sCap2), arrCtrls );
	
 	if ( (!bReadOnly) && (vReturnValue==1) )
	 	{return true;}
	else
		{return false;};
}

function ShowCalendar(sCtrlName, sPostFunc)
{
	var window_top = (screen.height-200)/2;
	var window_left = (screen.width-300)/2;
	//window.open('../Include/Calendar.asp?Ctrl=' + escape(sCtrlName) + '&DT=' + escape(window.eval(sInputName).value), 'CalPop', 'toolbar=0,width=378,height=225');
	window.open('../Include/Calendar.asp?Ctrl=' + escape(sCtrlName) + '&Func=' + escape(sPostFunc) + '&DT=' + escape(window.eval(sCtrlName).value), 'CalPop', 'top='+window_top+' left='+window_left+' toolbar=0,width=300,height=200');
}
function OpenWindow(sUrl,iWidth,iHeight, bCenter, bScroll)
{
	
	var window_top = 0;
	var window_left = 0;
	var iScroll = 0;
	if (bScroll==true) 
	  {iScroll=1;}
	if (bCenter == true)
	{window_top = (screen.height-iHeight)/2;
	 window_left = (screen.width-iWidth)/2;
	}
	
	return window.open(sUrl, 'JvsWin', 'top='+window_top+' left='+window_left+'toolbar=0,scrollbars='+ iScroll +',resizable=1,width='+iWidth+',height='+iHeight);
}

function HideProgress()
{
  var objProgBar = document.ProgBarImg;
  if (objProgBar != null)
  {
	objProgBar.width = 0;

	var DocProgBar = document.getElementById('ProgBar');
	if (DocProgBar.style != '')
	{DocProgBar.style.display='none';}

//    document.all('ProgBar').style.display='none'
  }
}

function ResetForm(oForm)
{
 var oElement;
 for (i = 0; i < oForm.elements.length; i++)
 {
   oElement = oForm.elements[i] 
   if (oElement.type == "text")
   {
   oElement.value = '';
   }
 }
}

function GetNextTabCtrl(iCurrTabIndex,oForm)
{
 var oElement;
 var oCtrlToReturn;

 for (i = 0; i < oForm.elements.length; i++)
 	{
   	   oElement = oForm.elements[i]
	   if ((oElement.tabIndex != '') && (oElement.tabIndex > iCurrTabIndex))
   		{
			if (oCtrlToReturn != null)
			 {
			  if (oElement.tabIndex < oCtrlToReturn.tabIndex)
			    {oCtrlToReturn = oElement}
			 } 
			else
 			 {oCtrlToReturn = oElement};
	 	}
	}
 return oCtrlToReturn;
}

function SetFocus(objElement) 
{
	if (objElement != null) 
	{objElement.focus();}
}

function StrToURL(sValue)
{
 var s=escape(sValue);
 return s.replace(/\+/g,'%2B');
}

function ReplacePage(sNewPage)
{
	window.location.href = sNewPage;
}

function GetKeyPress(ev) {
	if (window.event) {
		return window.event.keyCode;
	} else if (ev) {
		return ev.which;
	}
	return null;
}

