function email(one, two) {
	document.write('<a href="mailto&#58;' + one + '&#64;' + two + '">' + one + '&#64;' + two + '</A>')
}
function showHide (expandID) {
	jQuery('#'+expandID+'_hide').hide()
	jQuery('#'+expandID+'_show').show()
	jQuery('#'+expandID+'_show2').show()
	jQuery('#'+expandID+'_focus').focus()
}
function hideShow (expandID) {
	jQuery('#'+expandID+'_show').hide()
	jQuery('#'+expandID+'_show2').hide()
	jQuery('#'+expandID+'_hide').show()
}


function getCookieVal(offset) {
	var endstr = document.cookie.indexOf(";", offset);
	if (endstr == -1) {
		endstr = document.cookie.length;
	}
	return unescape(document.cookie.substring(offset, endstr));
}

function getCookie(name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg) {
			return getCookieVal(j);
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return "";
}

function getExpDate(days, hours, minutes) {
	var expDate = new Date();
	if (typeof days == "number" && typeof hours == "number" && typeof minutes == "number") {
		expDate.setDate(expDate.getDate() + parseInt(days));
		expDate.setHours(expDate.getHours() + parseInt(hours));
		expDate.setMinutes(expDate.getMinutes() + parseInt(minutes));
		return expDate.toGMTString();
	}
}

var jsen = getCookie('jsen');
if (!jsen) {
	document.cookie = "jsen=1; path=/; expires="+getExpDate(3650,0,0);
	window.location.reload();
}
function uncheckRadioButtons (oForm) {
	for ( i = 0; i < oForm.elements.length; i++ ) {
		if (oForm.elements[i].type == 'radio') {
			oForm.elements[i].checked = false;
		}
	}
}


function checkfocus (fieldjustadded) {
	if (pagefocus != null && fieldjustadded == pagefocus) {
		setFocusToPageDefault()
	}
}


function setfocus (focusFieldID) {
	var field = jQuery('#'+focusFieldID)
	if (field.size() > 0) {
		field.focus();
		focusAssigned = true;
	}
}
function setFocusToPageDefault () {
	if (pagefocus == null) return;
	if (focusAssigned) return;
	
    if (pagefocus == 'default') {
		var loginField = jQuery('#loginfield')
		if (loginField.size() > 0) {
			if (userhint != null) {
				setfocus('password')
			}
			else {
				setfocus('loginfield')
			}
		}
		else {
			setfocus('searchfield')
		}
	}
	else {
		setfocus(pagefocus)
	}
}
