//--
// Version: 1.0
// Author: A. Radovanovic (admin@radovanovic.com)
// Copyright 2002

// CenterWindow
// Centers window when called from the window.open:
// window.open ('Pg.html', 'WinName', CenterWindow('menu=no',200,300))

function CenterWindow (sFeatures,w,h)
{

	var winTop = (screen.availHeight - h - 50) / 2; // "magic" number 50: Windows bottom menu
	var WinLeft = (screen.availWidth - w) / 2;
	return (sFeatures + ' width=' + w + ' height=' + h + ' top=' + winTop + ' left=' + WinLeft + ' ');
}


// ToolTips library

//	CreateToolTip: creates a tooltip popup
//	Code example:
//		var loginToolTip = new Object;
//	  CreateToolTip(MyToolTip,220,140,'My toolTipText');

function CreateToolTip (oToolTip,width,height,ToolTipText)
{
	oToolTip.oPopup = window.createPopup();
	oToolTip.width = width;
	oToolTip.height = height;
	oToolTip.TipText = '<div style="backgrou#ffffcc;border:solid 1px black; font:normal 8pt arial;padding:5px;width:100%;height:100%;">' + ToolTipText + '</div>'
	return oToolTip;	
}

//	ToolTipShow / ToolTipHide: shows and hides the tooltips
//	Code example:
//		<span onmouseover="ToolTipShow(loginToolTip)" onmouseout="ToolTipHide(loginToolTip)"><img src="../Icons/Question.gif"></span>


 
function ToolTipShow(oToolTip)
{
    var lefter = event.offsetY+10;
    var topper = event.offsetX;
    oToolTip.oPopup.document.body.innerHTML = oToolTip.TipText; 
    oToolTip.oPopup.show(topper,lefter, oToolTip.width, oToolTip.height, event.srcElement);
}

function ToolTipHide(oToolTip)
{
	oToolTip.oPopup.hide ();
}

// CalendarOpen
// Purpose: opens a calendar in the file Calendar/ChooseDate.asp
// Input:
//	date1: 'Formname.DateFieldname'
//	Month, Year: 1 - 12 month number (optional, if not specified then display current date)

function CalendarOpen (date1,Month,Year)
{
	window.open('../Calendar/ChooseDate.asp?fieldID=' + date1 + '&Month=' + Month + '&Year=' + Year, 'CalendarWin', CenterWindow('directories=no location=no menubar=no resizable=no scrollbars=no status=no toolbar=no',200,220));
}

// getRadioValue
// Purpose: get radio button value
//	it can be used for checking before form submission

function getRadioValue(radioName) {
  var collection;
  collection = document.all[radioName];
  for (i=0;i<collection.length;i++) {
    if (collection[i].checked)
    return(collection[i].value);
  }
}
