
function ChangeTopFrame(strTitle, strHelp, strAnchor) {
if(parent.frames["Top"] != null){
	parent.frames["Top"].location = 'Topbar.aspx?title=' + escape(strTitle) + '&help=' + escape(strHelp) + '&anc=' + escape(strAnchor);}
}

function OpenWindow(strURL) {
	var remote = window.open(strURL,"Remote",'width=700,height=600,left=10,top=10,resizable=yes,scrollbars=yes,menubar=no,toolbar=no,status=no,location=no,directories=no');
}

function previewJob(lngJobID) 
{
	window.open("JobPreview.aspx?JobID=" + lngJobID, "PreviewJob", 'width=630,height=460,left=10,top=10,resizable=yes,scrollbars=yes,menubar=yes,toolbar=no,status=no,location=no,directories=no');
}

function previewForm(EFID,intFormTypeID) 
{
	var sURL = "eformsPreview.aspx?CW=1&efid=" + EFID + "&formTypeID=" + intFormTypeID
	window.open(sURL, "PreviewForm", 'width=630,height=460,left=10,top=10,resizable=yes,scrollbars=yes,menubar=yes,toolbar=no,status=no,location=no,directories=no');
}

function closeWindow(){window.close();}

function OpenCV2(Id,DocumentType, BaseUrl){var URL =  BaseUrl + "Search/OpenDocument.aspx?" + "Id=" + Id + "&dt=" + DocumentType;OpenWindow(URL);}
function OpenCV(Id,DocumentType){var URL = "Search/OpenDocument.aspx?" + "Id=" + Id + "&dt=" + DocumentType;OpenWindow(URL);}
function OpenNotes(Id, Notes){var URL = "Search/OpenDocument.aspx?" + "Id=" + Id + "&notes=" + Notes +"&dt=4";OpenWindow(URL);}
function OpenApplicantHistoryNotes(Id, Notes){var URL = "Search/OpenDocument.aspx?" + "Id=" + Id + "&notes=" + Notes +"&dt=5";OpenWindow(URL);}
function OpenNotesDocument(Id, Notes, dt){var URL = "Search/OpenDocument.aspx?" + "Id=" + Id + "&notes=" + Notes +"&dt=" + dt;OpenWindow(URL);}
function OpenIntegrationResult(Id){var URL = "Search/OpenDocument.aspx?" + "Id=" + Id + "&dt=6";OpenWindow(URL);}
//    Enum DocumentType JobApplication = 1 Registered = 2 CoverLetter = 3 Notes = 4 ApplicantHistoryNotes = 5
   

function SelectCheckBox(e) 
			{
				if (e.checked) //Check All
				{
					var iCount = 0;
					for(i=0;i<=document.forms[0].elements.length-1;i++) 
					{
						if(document.forms[0].elements[i].type=="checkbox") 
						{
							document.forms[0].elements[i].checked=true;
							iCount = iCount + 1;
						}
					}
					
					if (iCount > 21)
					{
						alert("<%=CM.BIZ.Util.JavaScriptSafeText(resources.words.you_may_only_select_a_max_of_twenty_applicants,Usr.Cultureid)%>");
						//Uncheck all except the first 20 checkboxes.  this will soon be more
						for(i=59;i<=document.forms[0].elements.length-1;i++) 
						{
							if(document.forms[0].elements[i].type=="checkbox") 
							{
								document.forms[0].elements[i].checked=false;
							}
						}	

					}
				}
				else
				{
					for(i=0;i<=document.forms[0].elements.length-1;i++) 
					{
						if(document.forms[0].elements[i].type=="checkbox") 
						{
							document.forms[0].elements[i].checked=false;
						}
					}			
				}
		}

function SelectCheckBox2(e) 
			{
				if (e.checked) //Check All
				{
					var iCount = 0;
					for(i=0;i<=document.forms[0].elements.length-1;i++) 
					{
						if(document.forms[0].elements[i].type=="checkbox") 
						{
							document.forms[0].elements[i].checked=true;
							iCount = iCount + 1;
						}
						
						if (iCount > 20)
						{
						    alert("<%=CM.BIZ.Util.JavaScriptSafeText(resources.words.you_may_only_select_a_max_of_twenty_applicants,Usr.Cultureid)%>");
						    return;
						}
					}
				}
				else
				{
					for(i=0;i<=document.forms[0].elements.length-1;i++) 
					{
						if(document.forms[0].elements[i].type=="checkbox") 
						{
							document.forms[0].elements[i].checked=false;
						}
					}			
				}
		}


		// Assess the strength of the password string and display the feedback to the specified controls.
		function AssessPasswordStrength(controlToValidate, passwordHelp, passwordStrength, minimumPasswordLength, regexNumbers, regexUppercase, regexLowercase, regexAllowedSymbols) {
		    var helpText = "";
		    var password = $(controlToValidate).val();
		    var passwordLength = password.length;

		    if (passwordLength < minimumPasswordLength)
		        helpText = minimumPasswordLength - passwordLength + " more character(s) needed.";

		    var strengthText = "";
		    var characterSetsUsed = 0;


		    var myregexp = new RegExp(regexNumbers);
		    if (myregexp.test(password))
		        characterSetsUsed += 1;

		    myregexp = new RegExp(regexUppercase);
		    if (myregexp.test(password))
		        characterSetsUsed += 1;

		    myregexp = new RegExp(regexLowercase);
		    if (myregexp.test(password))
		        characterSetsUsed += 1;

		    myregexp = new RegExp(regexAllowedSymbols);
		    if (myregexp.test(password))
		        characterSetsUsed += 1;

		    if (passwordLength >= 8 & characterSetsUsed <= 2)
		        strengthText = "Strength: Weak";
		    else if (passwordLength >= 8 & characterSetsUsed == 3)
		        strengthText = "Strength: Medium";
		    else if (passwordLength >= 8 & characterSetsUsed == 4)
		        strengthText = "Strength: Strong";


		    $(passwordHelp).html(helpText);
		    $(passwordStrength).html(strengthText);
		}
