/**
 * Used to set focus on the input with tabIndex of 1.
 * 
 */
function setInitialFocus() {
    var found = false;
    var i, j, element;

    // for each form in the document
    for (i = 0; i < document.forms.length; i++) {
        // for each element in each form
        for (j = 0; j < document.forms[i].length; j++) {
            // check if element has a tabIndex of 1
            if (document.forms[i].elements[j].tabIndex == 1) {
                // set focus to element
                document.forms[i].elements[j].focus();

                // set found to true to eliminate redundant loops
                var found = true;
            }

            // if found break out of the elements loop
            if (found == true)
                break;
        }

        // if found break out of the forms loop
        if (found == true)
            break;
    }
}

function doPopUp(URL,height,width) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=1,resizable=1,width="+width+",height="+height+",left = 250,top = 50');");
	} 


	var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i

	function checkmail(e){
	var returnval=emailfilter.test(e.value)
	if (returnval==false){
	alert("Please enter a valid email address.")
	e.select()
	}
	return returnval
	}

