// 								<script language=javascript>
//

//*****************************************************************************************************************
function classChange(obj, new_style) {
//*****************************************************************************************************************
    obj.className = new_style;
}

//*****************************************************************************************************************
function PopupUserDetailWindow(app_user_id){
//*****************************************************************************************************************
	if (app_user_id) {
		window.showModelessDialog("popup_userinfo.aspx?TargetLogonName="+app_user_id,window,"dialogWidth:370px; dialogHeight:380px");
	}
}

//*****************************************************************************************************************
function PopupUserDetailWindowFromParent(app_user_id){
//*****************************************************************************************************************
	if (app_user_id) {
		window.showModelessDialog("../popup_userinfo.aspx?TargetLogonName="+app_user_id,window,"dialogWidth:370px; dialogHeight:380px");
	}
}

//*****************************************************************************************************************
function thisQueryStringItemValue(strItemName) {
//*****************************************************************************************************************
// returns a string containing the value of the current event's named querystring item
//*****************************************************************************************************************
	var res = "";
	var myNameProp = window.event.srcElement.nameProp;
	//alert(myNameProp);
	var myParam = myNameProp.substr(myNameProp.indexOf("?")+1);
	//alert(myParam);
	var myParamList = myParam.split("&")
	//alert(myParamList.length);
	if (myParamList.length > 1) {
		for (i=0; i < myParamList.length; i++) {
			myitem = myParamList[i].split("=");
			//alert(myitem[0]);
			//alert(myitem[1]);
			if (myitem[0]==strItemName) {
				res = myitem[1];
			}
		}
	}
	else {
			myitem = myParam.split("=")
			//alert(myitem[0]);
			//alert(myitem[1]);
			if (myitem[0]==strItemName) {
				res = myitem[1];
			}
	}
	alert("Found " + strItemName + " = " + res);
	return(res);
}

function ConfirmFileDelete() {
// <a href='../DocumentDelete.aspx?document_id=<%#Container.DataItem("document_id")%><%#thisWebAppUser.strTargetUserQueryString%>'>

	
	var strURL = '../DocumentDelete.aspx?document_id=' + thisQueryStringItemValue("ID");
	var strTargetLogon = thisQueryStringItemValue("TargetLogonName")
	if (strTargetLogon) {
		strURL += "&TargetLogonName=" & strTargetLogon
	}
	var strFileName = thisQueryStringItemValue("FILENAME");
	var strPrompt = "Delete this file?";
	if (strFileName) {
		strPrompt = "Delete " + strFileName + " ? "
	}
	if (window.confirm(strPrompt)) {
		window.navigate(strURL);
	}
}

var popUp; 

//*****************************************************************************************************************
function OpenCalendar(idname, postBack)
//*****************************************************************************************************************
{
	popUp = window.open('Calendar.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=165,height=250,left=200,top=250');
}

//*****************************************************************************************************************
function SetDate(formName, id, newDate, postBack)
//*****************************************************************************************************************
{
	eval('var theform = document.' + formName + ';');
	popUp.close();
	theform.elements[id].value = newDate;
	if (postBack)
		__doPostBack(id,'');
}		

//*****************************************************************************************************************
function OneTimeSubmit(strMessageTagName)
//*****************************************************************************************************************
// hide the enclosed submit button, and show the text within the [strMessageTagName] span tags
{
	if (typeof(Page_ClientValidate) == 'function') {
		Page_ClientValidate();
	}
	if (Page_IsValid) {
		window.event.srcElement.style.visibility='hidden'; 
		window.event.srcElement.parentElement.all(strMessageTagName).style.display='inline'; 
	}
	else {
		alert('There is a problem with the form, please check all fields for proper values.');
	}	
}

//*****************************************************************************************************************
function GetContentWnd(){ 
//*****************************************************************************************************************
	return parent; 
}	

//*****************************************************************************************************************
function AddToFavorites(){	
//*****************************************************************************************************************
	var oWnd = GetContentWnd();
	window.external.addFavorite( oWnd.location.href, oWnd.document.title );
	return true;
}

//*****************************************************************************************************************
function DateValidate(source, arguments){
// custom function for client-side validation of dates
//*****************************************************************************************************************
	arguments.IsValid = !isNaN(Date.parse(arguments.Value)) && 
	                    (Date.parse(arguments.Value) >= Date.parse('1/1/1950')) && 
	                    (Date.parse(arguments.Value) <= Date.parse('12/30/2170'));
}

//*****************************************************************************************************************
function ValidateTBD(source, arguments){
// custom function for client-side validation of selectors to not be TBD
//*****************************************************************************************************************
	arguments.IsValid = (arguments.Value != 'TBD');
}

//*****************************************************************************************************************
function DisableSubmitButton(element,id) {
// custom function to hide the submit button in a form, and display a "please wait" button instead
//*****************************************************************************************************************
	if (element) {
		element.style.visibility='hidden';
		element.style.display='none';
		element.parentElement.all(id).style.display='inline';
	}
}

//*****************************************************************************************************************
function ShowNamedElement(strElementName) {
//*****************************************************************************************************************
	document.all(strElementName).style.display='inline';
}

//*****************************************************************************************************************
function HideNamedElement(strElementName) {
//*****************************************************************************************************************
	document.all(strElementName).style.display='none';
}

//*****************************************************************************************************************
function ShowIfChecked(strElementName) {
//*****************************************************************************************************************
	if (window.event.srcElement.checked) {
		ShowNamedElement(strElementName);
	}
	else {
		HideNamedElement(strElementName);
	}
}

//*****************************************************************************************************************
function HideIfChecked(strElementName) {
//*****************************************************************************************************************
	if (window.event.srcElement.checked) {
		HideNamedElement(strElementName);
	}
	else {
		ShowNamedElement(strElementName);
	}
}

// </script>
							