function SwapImage(Name, Num) {
		document [Name].src = option [Num].src;
}

function ExitWorkArea(sExitPage, bPrompt) {
	if (bPrompt) {
		if (confirm("Any changes made will not be saved.\n\nAre you sure you want to exit?")){
			top.location.href=sExitPage;
		}
	}
	else {
		top.location.href=sExitPage;
	}
}

function ReloadTop() {
	var bParentExists = top.opener;
	if (bParentExists != undefined) {
		top.opener.location.reload(true);
	}
}

function ReloadWindow() {
	var bParentExists = window.opener;
	if (bParentExists != undefined) {
		window.opener.location.reload(true);
	}
}

function CancelWindow() {
	self.close();
}

function PopUpWindow (url, hWind, nWidth, nHeight, nScroll, nResize) {
	var cToolBar = "toolbar=0,location=0,directories=0,status=" + nResize + ",menubar=0,scrollbars=" + nScroll + ",resizable=" + nResize + ",width=" + nWidth + ",height=" + nHeight;
	var popupwin = window.open(url, hWind, cToolBar);
}

function PreviewWindow(url) {
	location.href=url;
	//var cToolBar = "toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1";
	//var popupwin = window.open(url, "Preview", cToolBar);
}

function VerifyPassword(cPassword, cRetype) {
	var cTrimPwd = cPassword;
	var cRetypePwd = cRetype;
	cTrimPwd = cTrimPwd.replace(" ","");
	if (cTrimPwd.length == 0) {alert ("Please enter a password."); return false;}
	else if (cPassword != cRetypePwd) {alert ("Your password could not be confirmed."); return false;}
	return true;
}

function DisplayWarning(obj, sMsg) {
	if (obj.checked){
		bContinue = confirm (sMsg);
		if (!bContinue) { obj.checked = false;}
	}
}

function VerifyDate (MM1, DD1, YY1, MM2, DD2, YY2) {
	bReturn = CheckDate("Open", YY1, MM1, DD1);
	if (!bReturn) {return false;}
	else return CheckDate("Close", YY2, MM2, DD2);
}

function CheckDate (strDate, nYear, nMonth, nDay) {
	if ((nYear == 0) || (nMonth == 0) || (nDay == 0)) {
		alert (nMonth  + "/" + nDay + "/" + nYear +" is an invalid \"" + strDate + "\" date.");
		return false;
	}
	else if (nYear != 0 && nMonth != 0 && nDay != 0) {
		if (nMonth == 2){
			if ((nYear % 4) != 0){
				if(nDay > 28) {
					alert (nMonth  + "/" + nDay + "/" + nYear +" is an invalid \"" + strDate + "\" date.");
					return false;
				}
			} 
            else if  ((nYear % 400) == 0){
				 if(nDay > 29){
					alert (nMonth  + "/" + nDay + "/" + nYear +" is an invalid \"" + strDate + "\" date");
					return false;
				 }						 
			}
			else if ((nYear % 100) == 0){
				 if(nDay > 28 ){
					alert (nMonth  + "/" + nDay + "/" + nYear +" is an invalid \"" + strDate + "\" date");
					return false;
				 }
			}
            else{
				if (nDay > 29){
					alert (nMonth  + "/" + nDay + "/" + nYear +" is an invalid \"" + strDate + "\" date");
					return false;
				} 
			}
		}
		else if ((nMonth == 4)||(nMonth == 6)||(nMonth == 9)||(nMonth == 11)){
			if (nDay > 30){
				alert (nMonth  + "/" + nDay + "/" + nYear +" is an invalid \"" + strDate + "\" date");
				return false;
			} 
		}
	}

	if (strDate == "Open") {
		var dToday = new Date();
		dOpen = new Date(nYear, nMonth - 1, nDay);
		if (dOpen <= dToday){
			alert ("You must pick an open date past today.");
			return false;
		}
	} 
	else {
		dClosed = new Date(nYear, nMonth - 1, nDay);
		if (dClosed < dOpen){
			alert ("You must pick a close date that is past the open date.");
			return false;
		}
	}
	return true;
}

function Move(sDir, objList, objOrder) {
	if (objList.selectedIndex != null) {
		nSelIndex = objList.selectedIndex;
		sSelValue = objList[nSelIndex].value;
		sSelText = objList[nSelIndex].text;
		if (sDir == "up" && nSelIndex > 0) {
			sSwitchValue = objList[nSelIndex -1].value;
			sSwitchText = objList[nSelIndex - 1].text;
			objList[nSelIndex].value = sSwitchValue;
			objList[nSelIndex].text = sSwitchText;
			objList[nSelIndex - 1].value = sSelValue;
			objList[nSelIndex - 1].text = sSelText;
			objList[nSelIndex - 1].selected = true;
		}
		else if (sDir == "dn" && nSelIndex < (objList.length - 1)) {
			sSwitchValue = objList[nSelIndex + 1].value;
			sSwitchText = objList[nSelIndex +  1].text;
			objList[nSelIndex].value = sSwitchValue;
			objList[nSelIndex].text = sSwitchText;
			objList[nSelIndex + 1].value = sSelValue;
			objList[nSelIndex + 1].text = sSelText;
			objList[nSelIndex + 1].selected = true;
		}
	}
	objOrder.value = "";
	for (i = 0; i < objList.length; i++) {
		objOrder.value = objOrder.value + objList[i].value;
		if (i < (objList.length - 1)) {
			objOrder.value = objOrder.value + ",";
		}
	}
}

function PopUpWindowFull (url, hWind, nWidth, nHeight, nResize) {
			var cToolBar = "toolbar=yes,location=yes,directories=yes,resizable=1,status=" + nResize + ",menubar=yes,scrollbars=yes,width=" + nWidth + ",height=" + nHeight
			var popupwin = window.open(url, hWind, cToolBar);
		}
		
function MenuPopUpWindow (url, hWind, nWidth, nHeight, nScroll, nResize) {
			var cToolBar = "toolbar=0,location=0,directories=0,status=" + nResize + ",menubar=0,scrollbars=" + nScroll + ",resizable=" + nResize + ",width=" + nWidth + ",height=" + nHeight
			var popupwin = window.open(url, hWind, cToolBar);
		}