//**************** Decline with a reason *************************
var IDS_WIN_DECLINEREASONDLG_NAME = "WBC_winDeclineReasonDlg";
//var IDS_WIN_DECLINEREASONDLG_FEATURES = "width=600,height=375,resizable,status=yes" + IDS_DEFAULT_OPEN_POSITION;
var IDS_WIN_DECLINEREASONDLG_FEATURES = "width=600,height=375,resizable,status=yes,top=50,left=300,screenY=50,screenX=50"


function CMS_openWindowDeclineReason(strDlgURL) {
	WBC_openWindowOnFocus(strDlgURL, IDS_WIN_DECLINEREASONDLG_NAME, IDS_WIN_DECLINEREASONDLG_FEATURES);
}

function CMS_saveDeclineReasonValue(strDeclineReason) {
	var pDeclineReason = document.all("NC_DeclineReason");
	if (pDeclineReason) {
		pDeclineReason.value = strDeclineReason;
	}
}
//**************** Decline with a reason *************************

//Function displays menu on mouse coordinates
function ShowMenu()
{
   //if inside radEditor don't show two context menus
   var element = window.event.srcElement;
   if (element != null)
   {
      if ((element.tagName == 'A')  | (element.tagName == 'IMG') | (element.tagName == 'IMAGE') | (element.tagName == 'TD') | (element.tagName == 'TH') | (element.tagName == 'TABLE'))
      {
         while (element != null)
         {
            if (element.id.indexOf('radEditorContainer') == 0)
            {
               return false;
            }
            element = element.parentElement;
         }
      }
   }
   // if not read-only site show Web Author context menu
	if (!(event.ctrlKey) && typeof(contextMenu) != 'undefined') {
		// set x and y coordinates of the absolutely positioned menu.
		contextMenu.style.left = event.x;	//+ window.document.body.scrollLeft;
		contextMenu.style.top = event.y;	//+ window.document.body.scrollTop;
		contextMenu.style.display = '';
		event.returnValue=false;
		return false;
		
	}
   
}

//Hide Menu
function HideMenu()
{
   if (typeof(contextMenu) != 'undefined') {
      contextMenu.style.display= 'none';
   }
}

// Selected menu selections on mousover.
function Selected(obj)
{
	obj.style.color = 'white';
	obj.style.background = 'highlight';
}

// UnSelected function is only used to undo the effects of the Selected function
// on mouseleave. 
function UnSelected(obj)
{
	obj.style.color = 'menutext';
	obj.style.background = 'white';
}

document.onclick = HideMenu;
document.oncontextmenu = ShowMenu;
