﻿
function $()
{
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++)
	{
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}

function OpenPopUpReturnFalse(url, width, height)
{
    var options = "location=no, status=no, menubar=no, resizable=no, toolbar=no, scrollbars=yes, height=" + height + ", width=" + width;
    window.open(url, "popup", options);
    return false;
}

function ChangeLocation(whichPage)
{
    window.location = whichPage;
}

/*******************/    
/* Utility Methods */
/*******************/
function IsNullOrEmpty(stringValue)
{
    return ((stringValue == null) || (stringValue == ""));
}
/*******************/
/*******************/
/*******************/

/**********************************/
/* For use on the Occupation Grid */
/**********************************/

//this will be called anytime one of our Radio Buttons in our grid is checked 
function SetRadioButtonChecked()
{
    document.getElementById("radioButtonChecked").value = "1";
}

//this will be called when we click the final button (Match me by [whatever])
function WasOccupationSelected()
{
        var wasChecked = true;
        if (document.getElementById("radioButtonChecked").value == "") {
            wasChecked = false;
            alert("Please select a occupation before continuing.");
        }
        return wasChecked;
}
/**********************************/
/**********************************/
/**********************************/

/************************************/
/* For use on the Subject Area Grid */
/************************************/
function WasSubjectAreaSelected()
{
    var somethingChecked = false;
    var totalChecks = 0;
    
    //CheckBoxIDs is an array that is created in the Pre_Render method of the SubjectAreaGrid control
    if (CheckBoxIDs != null)
    {
        for (var counter = 0; counter < CheckBoxIDs.length; counter++)
        {
            var checkBox = document.getElementById(CheckBoxIDs[counter]);
            if (checkBox.checked)
            {
                totalChecks = totalChecks + 1;
                somethingChecked = true;
            }
        }
        
        if (totalChecks == 0)
        {
            alert("Please select a subject area before continuing.");
        }
    }
    return somethingChecked;
}
/************************************/
/************************************/
/************************************/