﻿// JScript File

<!-- Hide Code //


function Login(strReturnUrl)
{
	if( strReturnUrl == "" || strReturnUrl == undefined )
	{
		strReturnUrl = document.location.href;
	}
	
	var strLoginPage = '/Legacy/Admin/Login.asp?Cobrand=LEGACY&Popup=1&Url=' + escape(strReturnUrl);
	window.open(strLoginPage, 'login', 'menubar=no,scrollbars=yes,height=260,width=500,dependent=yes,left=50,top=50');

	return;
}

function ValidateSearch(formobj)
{
	bOk = true;

	/* Check for valid last name in search. */
	if( formobj.LastName.value.length < 2 )
	{
		strMsg = "You must enter a last name of at least\n two characters to continue your search.";
		if (bOk == true)
		{
			formobj.LastName.focus();
		}
			
		bOk = false;
	}
	
	/* Display message if error occurs. */	
	if (!bOk)
	{
		alert(strMsg);
	}

	return bOk;
}

function OpenPopup(strPageName, intWidth, intHeight, intScrollBars)
{
	if( intWidth == 0 )
	{
		intWidth = 500;
	}
	
	if( intHeight == 0 )
	{
		intHeight = 300;
	}
	
	if( intScrollBars == 0 )
	{
		strScrollBars = "no";
	}
	else
	{
		strScrollBars = "yes";
	}
	
	window.open('/Legacy/Popups/' + strPageName + '.asp?Cobrand=LEGACY', strPageName, 
		'menubar=no,scrollbars=' + strScrollBars + ',height=' + intHeight + ',width=' + 
		intWidth + ',dependent=yes,left=50,top=50');

	return;
}

function OpenTribute(intPersonId, isProd)
{
    if(isProd == 'TRUE')
    {
    	window.open("http://turbine.legacy.com/MT/Tribute.aspx?TributePersonID=" + intPersonId + "&Cobrand=LEGACY",'tribute', 
				'location=no,menubar=no,scrollbars=no,height=520,width=740,dependent=yes,left=10,top=10');	
    }
    else
    {
    	window.open("/MT/Tribute.aspx?TributePersonID=" + intPersonId + "&Cobrand=LEGACY",'tribute', 
				'location=no,menubar=no,scrollbars=no,height=520,width=740,dependent=yes,left=10,top=10');			
    }
}

function PhotoGalleryRedirect(strPersonId)
{
	window.open('/CommonCobrand/PhotoGalleryRedirect.asp?PersonId=' + strPersonId + '&Cobrand=LEGACY', 'photogalleryredirect', 
		'menubar=no,scrollbars=no,height=1,width=1,dependent=yes,left=50,top=50,alwaysLowered=yes');

	return;
}

function OpenTermsOfUse(intPopup, intPermanence)
{
	var strUrl = 'Soldiers.asp?Page=PopupTermsOfUse';
	if( intPermanence == 1 )
	{
		strUrl += '#Permanence';
	}
	
	if( intPopup == 1 )
	{
		window.open(strUrl, 'TermsOfUse', 'menubar=no,scrollbars=yes,height=475,width=650,dependent=yes,left=50,top=50');
	}
	else
	{
		location.href = strUrl;
	}
}

function JumpToResultsPage(intPageNo)
{
	document.SearchResults.PageNo.value = intPageNo;
	document.SearchResults.submit();
	return;
}

function ResetSearch()
{
	formobj = document.Search;
	formobj.FirstName.value = "";
	formobj.LastName.value = "";
	formobj.Branch.selectedIndex = 0;
	formobj.StateID.selectedIndex = 0;
	formobj.Base.selectedIndex = 0;
}

// End Hiding Code -->




