var windowReference = null;
function AddCandidate()
{
	ShowWindow("AdminCandidatePopup.aspx");
	return false;
}
function ViewCandidate(candidateID)
{
	ShowWindow("AdminCandidatePopup.aspx?id=" + candidateID);
}
function AddUser()
{
	ShowWindow("ClientManageUsersPopup.aspx");
	return false;
}
function UpdateUser(userID)
{
	ShowWindow("ClientManageUsersPopup.aspx?id=" + userID);
	return false;
}
function AddNote(candidateID)
{
	ShowWindow("NotesPopup.aspx?ID=" + candidateID);
}
function AddNoteForVacancy(vacancyID)
{
	ShowWindow("VacancyNotesPopup.aspx?ID=" + vacancyID);
}
function AddClientNote(candidateID)
{
	ShowWindow("ClientNotesPopup.aspx?ID=" + candidateID);
}
function ManageVacancyDocuments(statusValue, clientValue, consultantValue, vacancyID)
{
	ShowWindow("ManageDocumentsPopup.aspx?sv=" + statusValue + "&cv=" + clientValue + "&rcv=" + consultantValue + "&ID=" + vacancyID);
}
function SendVacancyDetails(vacancyID)
{
	ShowWindow("VacancyEmailPopup.aspx?ID=" + vacancyID);
}
function Notify(candidateID, vacancyID)
{
	ShowWindow("InterviewNotificationPopup.aspx?cid=" + candidateID + "&vid=" + vacancyID);
}
function ClientRequestAction(vacancyID, candidateID)
{
	ShowWindow("ClientRequestActionPopup.aspx?vid=" + vacancyID + "&cid=" + candidateID);
}
function ShowHelp(page)
{
	ShowWindow("../AdminPages/HelpPopup.aspx?page=" + page);
}
function ShowUsers(clientID)
{
	ShowWindow("AdminClientUsersPopup.aspx?ID=" + clientID);
}
function ShowEmails(vacancyID)
{
	ShowWindow("VacancyEmailsPopup.aspx?ID=" + vacancyID);
}
function EmailCandidate(candidateID, vacancyID)
{
	ShowWindow("EmailCandidatePopup.aspx?cid=" + candidateID + "&vid=" + vacancyID);
}
function EmailClient(clientID, vacancyID)
{
	ShowWindow("EmailClientPopup.aspx?ID=" + clientID + "&vid=" + vacancyID);
}
function EmailCV(clientID, vacancyID, candidateID)
{
	ShowWindow("EmailCVPopup.aspx?ID=" + clientID + "&vid=" + vacancyID + "&cid=" + candidateID);
}
function ShowTestResults()
{
	ShowWindow("ClientSkillsTestingPopup.aspx");
}
function AddContractor()
{
	ShowWindow("ContractorPopup.aspx");
	return false;
}
function ViewContractor(contractorID)
{
	ShowWindow("ContractorPopup.aspx?id=" + contractorID);
}
function AddNoteForContractor(contractorID)
{
	ShowWindow("ContractorNotesPopup.aspx?ID=" + contractorID);
}
function EmailContractor(contractorID)
{
	ShowWindow("ContractorEmailPopup.aspx?id=" + contractorID);
}
function AddIssue()
{
	ShowWindow("AdminIssuePopup.aspx");
	return false;
}
function ViewIssue(issueID)
{
	ShowWindow("AdminIssuePopup.aspx?id=" + issueID);
}
function AddNoteForIssue(issueID)
{
	ShowWindow("AdminIssueNotesPopup.aspx?ID=" + issueID);
}
function AddTask()
{
	ShowWindow("AdminTaskPopup.aspx");
	return false;
}
function ViewTask(taskID)
{
	ShowWindow("AdminTaskPopup.aspx?id=" + taskID);
}
function AddClient()
{
	ShowWindow("AdminClientPopup.aspx");
	return false;
}
function AddVacancy()
{
	ShowWindow("AdminVacancyPopup.aspx");
	return false;
}
function CreateContact(clientID)
{
	ShowWindow("AdminCreateContactPopup.aspx?cid=" + clientID);
	return false;
}
function AddNoteForUser(userID)
{
	ShowWindow("AdminUserNotesPopup.aspx?ID=" + userID);
}
function EmailClientContact(userID)
{
	ShowWindow("EmailClientContactPopup.aspx?ID=" + userID);
}
function ShowClientPlacements(clientID)
{
	ShowWindow("AdminClientPlacements.aspx?id=" + clientID);
	return false;
}
function ManageClientDocuments(clientID)
{
	ShowWindow("ManageClientDocumentsPopup.aspx?ID=" + clientID);
}
function AddNoteForClient(clientID)
{
	ShowWindow("AdminClientNotesPopup.aspx?ID=" + clientID);
}
function CallbackClientContact(userID)
{
	ShowWindow("CallbackClientContactPopup.aspx?ID=" + userID);
}
function UpdateKeyContact(userID, clientID)
{
    ShowWindow("AdminUpdateKeyContactPopup.aspx?id=" + userID + "&cid=" + clientID);
    //return false;
}
function UpdateSecContact(clientID, firstName, lastName)
{
    ShowWindow("AdminUpdateSecContactPopup.aspx?cid=" + clientID + "&fname=" + firstName + "&lname=" + lastName);
    //return false;
}
function EmailSecContact(clientID, firstName, lastName)
{
    ShowWindow("EmailClientContactPopup.aspx?cid=" + clientID + "&fname=" + firstName + "&lname=" + lastName);
}
function CallbackSecContact(clientID, firstName, lastName)
{
    ShowWindow("CallbackClientContactPopup.aspx?cid=" + clientID + "&fname=" + firstName + "&lname=" + lastName);
}
function ShowExclusiveTerms()
{
	ShowWindow("ExclusivePopup.aspx");
}
function ShowNonExclusiveTerms()
{
	ShowWindow("NonExclusivePopup.aspx");
}
function ShowLITETerms()
{
    ShowWindow("../LookingToHire/LITETermsPopup.aspx");
}
function CourtesyUpdate(vacancyID)
{
    ShowWindow("CourtesyUpdatePopup.aspx?vid=" + vacancyID);
}
function ShowJobDescription()
{
    ShowWindow("AdminJobDescriptionPopup.aspx");
}
function AddNewsStory()
{
    ShowWindow("AdminNewsStoryPopup.aspx");
    return false;
}
function ViewNewsStory(newsStoryID)
{
    ShowWindow("AdminNewsStoryPopup.aspx?id=" + newsStoryID);
}
function ReminderEmail(vacancyID)
{
    ShowWindow("AdminReminderPopup.aspx?ID=" + vacancyID);
}
function ViewRegistration(documentFileName)
{
    ShowWindow("RegistrationPopup.aspx?file=" + documentFileName);
}
function AddRegDocNote(documentFileName)
{
    ShowWindow("RegDocNotesPopup.aspx?file=" + documentFileName);
}
function AddNoteForSecContact(clientUserID)
{
    ShowWindow("AdminContactNotesPopup.aspx?ID=" + clientUserID);
}
function UpdateIssueAction(issueID)
{
    ShowWindow("AdminIssueActionPopup.aspx?id=" + issueID);
}
function StopContractor(contractorID)
{
    ShowWindow("ContractorStopPopup.aspx?id=" + contractorID);
}
function ShowAddresses(clientID)
{
    ShowWindow("AdminClientAddressesPopup.aspx?ID=" + clientID);
}
function ShowWindow(url)
{
	var leftPosition, topPosition, strOptions;
	leftPosition = (screen.width / 2) - 350;
	topPosition = (screen.height / 2) - 400;
	strOptions = "left=" + leftPosition + ",top=" + topPosition + ",width=700,height=750,scrollbars=yes,location=no,menubar=no,resizable=yes,toolbar=no,status=yes";
	
	if (windowReference  && !windowReference.closed)
	{
		windowReference.location.href = url;
		windowReference.focus();
	}
	else
		windowReference = window.open(url, "", strOptions);
	return false;
}
function ClosePopup()
{
	if (windowReference  && !windowReference.closed)
		windowReference.close();
}
function PrintPage()
{
    // Hide the buttons first...
	var printButton = document.forms[0].elements["btnPrint"];
	if (printButton)
		printButton.style.display = "none";
	var closeButton = document.forms[0].elements["btnClose"];
	if (closeButton)
		closeButton.style.display = "none";
	// ...then print...
	window.print();
	// ...then show the buttons...
	if (printButton)
		printButton.style.display = "inline";
	if (closeButton)
		closeButton.style.display = "inline";
}
function CheckAccept(source, args)
{
    /*var acceptBox = document.getElementById("chkAccept");
    if (acceptBox.checked == true)
        args.IsValid = true;
    else
        args.IsValid = false;*/
    args.IsValid = false;
    var inputFields = document.getElementsByTagName("input");
    var inputField = null;
    for (var i = 0; i < inputFields.length; i++)
    {
        inputField = inputFields[i];
        if (inputField.type == "checkbox")
        {
            if (inputField.id.indexOf("chkAccept") > -1)
            {
                if (inputField.checked == true)
                    args.IsValid = true;
            }
        }    
    }
}
function ShowAnswer(questionNumber)
{
	var spanQ = null;
	if (document.all)
		spanQ = document.all("spanQ" + questionNumber);
	else
		spanQ = document.getElementById("spanQ" + questionNumber);
	spanQ.outerHTML = 
		"<span id='spanQ" + questionNumber + "' style='cursor:pointer'>" +
			"<IMG src='images/Minus.gif' onclick='HideAnswer(" + questionNumber + ")'/>" +
		"</span>";
	var spanA = null;
	if (document.all)
		spanA = document.all("divA" + questionNumber)
	else
		spanA = document.getElementById("divA" + questionNumber);
	spanA.style.display = "block";
}
function HideAnswer(questionNumber)
{
	var spanQ = null;
	if (document.all)
		spanQ = document.all("spanQ" + questionNumber);
	else
		spanQ = document.getElementById("spanQ" + questionNumber);
	spanQ.outerHTML = 
		"<span id='spanQ" + questionNumber + "' style='cursor:pointer'>" +
			"<IMG src='images/Plus.gif' onclick='ShowAnswer(" + questionNumber + ")'/>" +
		"</span>";
	var spanA = null;
	if (document.all)
		spanA = document.all("divA" + questionNumber)
	else
		spanA = document.getElementById("divA" + questionNumber);
	spanA.style.display = "none";
}