//default JavaScript

function popUpWin(loc,winname,opts) {
	var popUpWindow = window.open(loc,winname,opts);
}

function selectgo(loc, tgt) {
	if (loc != "") {
		if (tgt == "new") {
			window.open(loc);
		} else {
			window.location.href = loc;
		}
	}
}

//date
function fullDate(cssparams) {
d = new Array(
"Sun.",
"Mon.",
"Tue.",
"Wed.",
"Thu.",
"Fri.",
"Sat."
);
m = new Array(
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
);

today = new Date();
day = today.getDate();
year = today.getYear();

if (year < 2000) {
	year = year + 1900;
}

end = "";
if (day == 1 || day == 21 || day == 31) {
	end = "";
}
if (day == 2 || day == 22) {
	end = "";
}
if (day == 3 || day == 23) {
	end = "";
}
day += end;

daystr = "<span";
if (cssparams != "") {
	daystr += " style=\"" + cssparams + "\"";
}
daystr += ">";
daystr += m[today.getMonth()] + " " + day + ", " + year + "</span>";
document.write(daystr);
}


//browsers by DOM variants
var IE5plus = document.getElementById && document.all;
var NS6plus = document.getElementById && !document.all;
var NS4 = document.layers;
var IE4 = document.all && !window.print;

//get the object
function SASDgetObj(whichid) {
	if (IE5plus || NS6plus) {
		return document.getElementById(whichid);
	} else if (IE4) {
		return document.all[whichid];
	} else if (NS4) {
		return document.layers[whichid];
	}
}

//change style properties
function SASDchgProp(whichid,whichprop,theval) {
var obj = SASDgetObj(whichid);
	if (NS4) {
		obj[whichprop] = theval;
	} else {
		obj.style[whichprop] = theval;
	}
}

//toggle submenu
function toggleItem(ename) {
	if (NS6plus || IE5plus) {
		subitem = document.getElementById(ename).style.display;
	} else if (IE4) {
		subitem = document.all[ename].style.display;
	}
	if (subitem == "none") {
		SASDchgProp(ename,"display","block");
	} else {
		SASDchgProp(ename,"display","none");
	}
}

//validate date for mm/dd/yyyy format
function chkDateFormat(val) {
var objRegExp = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/;
	if (!objRegExp.test(val.value)) {
		alert("Date is not in mm/dd/yyyy format - please correct.");
	}
}