//	------------------------------------------------------------------------------	
//	The following two functions will check for the existence of a parent/grandparent
//	window and populate it with the address stored in variable 'loc' if the parent 
//  /grandparent exists. If the parent/grandparent window does not exist, then a new 
//	window will be opened unless the optional parameter "openNewOnError" is set to 
//	false, in which case no futher action will be performed
//	------------------------------------------------------------------------------
	
	function loadGrandParent(loc,openNewOnError)
	{
		if(openNewOnError==null)		//If parameter is not set, set it to true
		{
			var openNewOnError=true;
		}
		if(window.opener.closed || window.opener.opener.closed)	//If the parent/grand parent window has been closed by the user...
		{
			if(openNewOnError)		//if open a new window on error paramater is set to true
			{
				
				window.open(loc)		//open a new window
			}
		}
		else							//Parent window exists, so load new URL into it
		{
			window.opener.opener.location = loc;
			window.opener.opener.focus();		
		}
	}
	
	function loadParent(loc,openNewOnError)
	{
		if(openNewOnError==null)		//If parameter is not set, set it to true
		{
			var openNewOnError=true;
		}

		if(window.opener.closed)	//If the parent window has been closed by the user...
		{
			if(openNewOnError)		//if open a new window on error paramater is set to true
			{
				
				window.open(loc)		//open a new window
			}
		}
		else							//Parent window exists, so load new URL into it
		{
			window.opener.location = loc;
			window.opener.focus();		
		}
	}
