// ======================================================================
// Open Window
// -------------------------------------------------------------------
// Description: 
// 	On several pages of this website there are small question marks.
//  These question marks are used for quick reference to common
//  questions and glossary terms for explaining single items.
// ======================================================================
function OpenWindow(url)
{
	window.open( url ,'', 'menubar=yes,location=no,toolbar=yes,height=600,width=800,resizable=yes,scrollbars=yes' );
}
function OpenWindow(url, options)
{
	window.open( url ,'', options );
}
// ======================================================================
// Change Form Action
// -------------------------------------------------------------------
// Description: 
// 	By default, ASP.NET server forms post back only to themselves.
//  By setting an onclick attribute to your server side button
//  you can call this javascript method passing the name or path
//  of the page you want to post to.
//  IE: WriteNewFormAction('https://mysite.com/mynewpage.aspx');
// ======================================================================
function WriteNewFormAction( actionPath )
{
	// set the new form action
	document.forms[0].action = actionPath;
	
	// by renaming viewstate, we disallow the viewstate 
	// from passing to another asp.net page avoiding the 
	// following error:
	//
	// "The viewstate is invalid for this page and might be corrupted."
	document.forms[0].__VIEWSTATE.name = 'NOVIEWSTATE';
}
// ======================================================================
// Clear A Field
// -------------------------------------------------------------------
// Description: 
// 	Using a fieldname, clear the value of this field.
// ======================================================================
function ClearField( FieldName )  
{
	FieldName.value = "";
}	
// ======================================================================
// JumpToNextField
// -------------------------------------------------------------------
// Description: 
// 	Jumps cursor to specified field.
// ======================================================================
function JumpToNextField( ConditionalLength, CurrentFieldName, FieldToGiveFocus )
{
	var _focusFieldName = document.forms[0].FieldToGiveFocus;
	
	if( CurrentFieldName.value.length == ConditionalLength )
	{
		FieldToGiveFocus.focus();
	}		
}
function OpenMap(street, city, state, zipcode, mapType)
{
	switch( mapType )
	{
		case '1' :
			var page = 'http://www.mapquest.com/maps/map.adp?country=US&countryid=US&addtohistory=&searchtab=address&searchtype=address';
			page += '&address=' + street + '&city=' + city + '&state=' + state + '&zipcode=' + zipcode;
			page += '&search=++Search++';
			
			window.open(page,null,'height=600,width=800,menubar=yes,location=no,resizable=yes,scrollbars=yes');			
			return false;
			
		case '2' :				
			var page = 'http://maps.google.com/maps?q=';
			page += street.replace (/\s+/, "+") + ',' + city + ',' + state + ',' + zipcode;
			page += '&hl=en';
			
			window.open(page,null,'height=600,width=800,menubar=yes,location=no,resizable=yes,scrollbars=yes');			
			return false;
			
		default:
			window.open("",null,'height=600,width=800,menubar=yes,location=no,resizable=yes,scrollbars=yes');
			return false;
	}
}

function OpenModal( baseUrlPath, Source )
{
	window.open(baseUrlPath + 'Modal.aspx?src=' + Source, null, 'height=600,width=800,menubar=no,location=no,resizable=yes,scrollbars=yes');
	return false;
}

