// Function to limit TEXTAREA fields and display remaining character count
function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}

// JavaScript functionality to handle clicks on Mandatory and Desirable hit bars
function openPopup(CandidateId, RequirementId)
{
	var popWidth=700;
	var popHeight=500;
	var posx=screen.availWidth-30-popWidth;
	var posy=15;
	var URL="PopUp_Jobs_SkillInfo.aspx?CandidateId=" + CandidateId + "&RequirementId=" + RequirementId;
	var features =
	',directories=0'+
	',location=0'   +
	',menubar=0'   +
	',scrollbars=1'+
	',status=0'   +
	',toolbar=0'   +
	',resizable=1' +
	',width=' + popWidth +
	',height=' + popHeight +
	',screenX=' + posx +
	',screenY=' + posy +
	',top=' + posy +
	',left=' + posx;
	URL = URL.replace(/\s/,'%20');
	wind=window.open (URL, "candidateskillsinfo", features);
	wind.focus();
}

// JavaScript functionality to handle clicks on Browse jobs list
function openPopupJobDetails(RequirementId)
{
	var popWidth=700;
	var popHeight=500;
	var posx=screen.availWidth-30-popWidth;
	var posy=15;
	var URL="PopUp_Jobs_Details.aspx?RequirementId=" + RequirementId;
	var features =
	',directories=0'+
	',location=0'   +
	',menubar=0'   +
	',scrollbars=1'+
	',status=0'   +
	',toolbar=0'   +
	',resizable=1' +
	',width=' + popWidth +
	',height=' + popHeight +
	',screenX=' + posx +
	',screenY=' + posy +
	',top=' + posy +
	',left=' + posx;
	URL = URL.replace(/\s/,'%20');
	wind=window.open (URL, "candidatesjobsdetails", features);
	wind.focus();
}

// JavaScript functionality to handle click on Email icon from Job lists
function openSendMessage(ToId, FromId, RequirementId, MessageId)
{
	var popWidth=700;
	var popHeight=500;
	var posx=screen.availWidth-30-popWidth;
	var posy=15;
	var URL="PopUp_SendMessage.aspx?ToId="+ToId+"&FromId="+FromId+"&RequirementId="+RequirementId+"&LastMessageId="+MessageId;
	var features =
	',directories=0'+
	',location=0'   +
	',menubar=0'   +
	',scrollbars=0'+
	',status=0'   +
	',toolbar=0'   +
	',resizable=1' +
	',width=' + popWidth +
	',height=' + popHeight +
	',screenX=' + posx +
	',screenY=' + posy +
	',top=' + posy +
	',left=' + posx;
	URL = URL.replace(/\s/,'%20');
	wind=window.open (URL, "spotajobcandidate", features);
	wind.focus();
}

// JavaScript functionality to handle clicks on Mandatory and Desirable hit bars
function openCV(CandidateId)
{
	var popurl="PopUp_CV.aspx?CandidateId=" + CandidateId
	var features =
		',directories=1'+
		',location=0'   +
		',menubar=1'   +
		',scrollbars=1'+
		',status=1'   +
		',toolbar=1'   +
		',resizable=1'
	winpops=window.open(popurl,"spotajobcandidateCV", features);
	winpops.focus();
}


function openJD(JDFileRef)
{
	var popurl="PopUp_JD.aspx?JDFileRef=" + JDFileRef
	var features =
		',directories=1'+
		',location=0'   +
		',menubar=1'   +
		',scrollbars=1'+
		',status=1'   +
		',toolbar=1'   +
		',resizable=1'
	winpops=window.open(popurl,"spotajobjobdescription", features);
	winpops.focus();
}


function openPS(PSFileRef)
{
	var popurl="PopUp_PS.aspx?PSFileRef=" + PSFileRef
	var features =
		',directories=1'+
		',location=0'   +
		',menubar=1'   +
		',scrollbars=1'+
		',status=1'   +
		',toolbar=1'   +
		',resizable=1'
	winpops=window.open(popurl,"spotajobjobdescription", features);
	winpops.focus();
}

//JavaScript to prevent PostBack of TextBox fields when ENTER key is pressed
function TrapKBD()
{
if (event.keyCode == 13)
{
event.returnValue=false;
event.cancel = true;
}
}

// Function to limit TEXTAREA fields and display remaining character count
function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}