//displayEmailApplyDiv
function displayShareProfileDiv(element)
{
	var	sendWrapperA = GEById('shareProfileWrapperContent');
	var	sendWrapperAX = findX(sendWrapperA);
	var	sendWrapperAY = findY(sendWrapperA);
		
	element.blur();
	
	//GEById('screenMask').style.display = 'inline';
	lbstart();
	GEById('shareProfileFormWrapper').style.display = '';

	cleanUpShareProfileMessages();	

	sendWrapperA.style.marginLeft = (findXscreen(400)+ 'px');
	sendWrapperA.className = 'shareProfileMainContent';
	sendWrapperA.style.marginTop = (findY(element)+ 29 + 'px');
}

function cleanUpShareProfileMessages()
{
	GEById('shareProfileMessageText').style.display = 'none';
	GEById('shareProfileErrorMessage').style.display = 'none';
	GEById('shareProfileUpdateSettingsErrorMessage').style.display = 'none';
}

	
//hideApplySendWrapper
function hideShareProfileDiv(element)
{
	var	sendWrapperA = GEById('shareProfileWrapperContent');
	element.blur();
	
	if(sendWrapperA)
	{
		//Hide the Apply Email Div and the screen mask.\n");
		sendWrapperA.className = 'shareProfileMainContent shareProfileShow';
		//GEById('screenMask').style.display = 'none';
		lbend();
	}
}

//submitEmailClient
function submitShareProfileClient()
{
	GEById('shareProfileCloseContainer').style.display = 'none';
	GEById('shareProfileFormWrapper').style.display = 'none';
	GEById('shareProfileMessageText').innerHTML = 'Sending E-mail(s)...';
	GEById('shareProfileMessageText').style.display = '';
	pwBeginCallServerFunction('submitShareProfileServer', 'handleShareJobsResponse', '', false);
}

function handleShareJobsResponse(pwRsCallbackResponse)
{
    cleanUpShareProfileMessages();
		
	switch(pwRsCallbackResponse.data)
	{
		case 'success':
			GEById('shareProfileFormWrapper').style.display = 'none';
			GEById('shareProfileMessageText').innerHTML = 'E-mail sent.';
			GEById('shareProfileMessageText').style.display = '';
			break;

		case 'badEmail':
			GEById('shareProfileErrorMessage').innerHTML = 'Please check that the e-mails are valid.';
			GEById('shareProfileErrorMessage').style.display = '';
			GEById('shareProfileFormWrapper').style.display = '';
			break;
			
		case 'error':
			GEById('shareProfileErrorMessage').innerHTML = 'An error has occurred and we have been notified. Please try again later.';
			GEById('shareProfileErrorMessage').style.display = '';
			GEById('shareProfileFormWrapper').style.display = '';
			break;
	}
	
	GEById('shareProfileCloseContainer').style.display = '';
}

	//submitEmailClient
	function submitUpdateSettingsClient()
	{
		pwBeginCallServerFunction('submitUpdateSettingsClient', 'handleUpdateSettingsResponse', '', false);
	}