
function sfnSetTableRowHighlight(bHighlight, bAlternating, xID)
{
	//if (!document.all) 
	//	return;
		
	var xClassRow = "clsDashboard" + (bHighlight ? "Highlighted" : "") + (bAlternating ? "Alternating" : "") + "ListItem";
	var oRow = document.getElementById(xID);

	if (oRow == null)
		return;

	oRow.className = xClassRow;
	
	for (i = 0; i < oRow.cells.length; i++)
		oRow.cells[i].className = xClassRow;

}

function sfnMoveLabel(xObjectID, xReferenceID, x, y)
{
	var oObject = document.getElementById(xObjectID);

	if (oObject == null)	
		return;
	
	var oReference = document.getElementById(xReferenceID);

	if (oReference == null)	
	{
		oObject.style.display = "none";
		return;
	}
	
	oObject.style.left = sfnGetRealLeft(oReference) + x;
	oObject.style.top = sfnGetRealTop(oReference) + y + oReference.height;
	oObject.style.width = oReference.width;
	oObject.style.position = "absolute";
	oObject.style.display = "";	
}

function sfnGetRealLeft(imgElem) {
	xPos = eval(imgElem).offsetLeft;
	tempEl = eval(imgElem).offsetParent;
  	while (tempEl != null) {
  		xPos += tempEl.offsetLeft;
  		tempEl = tempEl.offsetParent;
  	}
	return xPos;
}

function sfnGetRealTop(imgElem) {
	yPos = eval(imgElem).offsetTop;
	tempEl = eval(imgElem).offsetParent;
	while (tempEl != null) {
  		yPos += tempEl.offsetTop;
  		tempEl = tempEl.offsetParent;
  	}
	return yPos;
}

function sfnOpenFileChooser(iRosterID, iProfileID, iFieldID) {
	var xUrl = '/ArtistRoster/Admin/FileChooser.aspx?rid=' + iRosterID + '&pid=' + iProfileID + '&fid=' + iFieldID;
	sfnBox(xUrl, 420, 280);
}

function sfnMessageBoxError(xTitle, xBody, xReturn) {
	var xUrl = '/ArtistRoster/MessageBox.aspx?typ=error&ttl=' + xTitle + '&bdy=' + xBody + '&ret=' + xReturn;				
	sfnBox(xUrl, 420, 280);
}

function sfnMessageBox(xTitle, xBody, xReturn) {
	var xUrl = '/ArtistRoster/MessageBox.aspx?typ=ok&ttl=' + xTitle + '&bdy=' + xBody + '&ret=' + xReturn;				
	sfnBox(xUrl, 420, 280);
}

function sfnMessageBoxProposeChange(iRosterID, iProfileID, iAssociatedProfileID, iFieldID) {
	var xUrl = '/ArtistRoster/MessageBox.aspx?typ=propose&rid=' + iRosterID + '&pid=' + iProfileID + '&aid=' + iAssociatedProfileID  + '&fid=' + iFieldID;
	sfnBox(xUrl, 420, 280);
}

function sfnYesNoBox(xTitle, xBody, xRefType, iRefId, xRefreshOnNo) {
	var xUrl = '/ArtistRoster/MessageBox.aspx?typ=yesno&ttl=' + xTitle + '&bdy=' + xBody + '&rtp=' + xRefType + '&ref=' + iRefId;
	
	if (xRefreshOnNo == "true")
		xUrl = xUrl + "&ron=true";
		
	sfnBox(xUrl, 420, 280);
}

function sfnBox(xUrl, iWidth, iHeight) {
	var iLeft = Math.floor((screen.width - iWidth) / 2);
	var iTop = Math.floor((screen.height - iHeight) / 2);
	var parms = 'dependent=yes,top=' + iTop + ',left=' + iLeft + ',height=' + iHeight + ', width=' + iWidth + ', resizable=no, toolbar=no, titlebar=no';
	parms += ', scrollbars=no';

	var win = window.open(xUrl, (new Date()).getSeconds().toString(), parms);
	
	try {win.focus();}
	catch (e) {}
}

function sfnSelectText(xControlID) {
	try {document.getElementById(xControlID).select();} catch(ee){}
}

function sfnFocus(xControlID) {
	try {document.getElementById(xControlID).focus();sfnSelectText(xControlID);} catch(e){}
}

function sfnPrint(xUrl) {
	oPrintWin = window.open(xUrl, 'print', 'location=no,menubar=no,scrollbars=no,status=no,toolbar=no');
	//oPrintWin.print();
	//setTimeout('oPrintWin.close()',500);
	self.focus();
}

function sfnLocked() {
	sfnMessageBoxError("Field Cannot be Changed", "The field you have selected cannot be changed at this time.  " + 
		"Your account does not have the required privileges.<br><br>" + 
		"Please contact the Illinois Arts Council for further information.", "")
}

function sfnViewProfile(iRosterID, iProfileID) {
	document.location.href="ProfileView.aspx?rid=" + iRosterID + "&pid=" + iProfileID + "&ref=search";
}

function sfnClickOnEnter(xButtonID) {
	try {
		var oButton = document.getElementById(xButtonID);
		
		if (oButton == null)
			return;

		oButton.click();
	}
	catch (e) {}
}