protected function getLinksFromDocument( $document, $onlyWithLabel = FALSE )
	{
		$baseUrl	= $this->getBaseUrl( $document );
		$links		= array();
		$nodes		= $document->getElementsByTagName( "a" );
		foreach( $nodes as $node )
		{
			$ref	= $node->getAttribute( 'href' );
			$ref	= trim( preg_replace( "@^\./@", "", $ref ) );
			if( strlen( $ref ) ){
				$base	= $document->getElementsByTagName( "base" );
	//			remark( $ref );
				if( preg_match( "@^(#|mailto:|javascript:)@", $ref ) )
					continue;
				if( $base->length && preg_match( "@^\.\./@", $ref ) )
					continue;
				if( preg_match( "@^\.?/@", $ref ) )
					$ref	= $baseUrl.$ref;
				else if( preg_match( "@^\./@", $ref ) )
					$ref	= preg_replace( "@^\./@", "", $ref );
				if( !preg_match( "@^https?://@", $ref ) )
					$ref	= $baseUrl.$ref;
				$label	= trim( strip_tags( $node->nodeValue ) );
				if( $node->hasAttribute( 'title' ) )
					$label	= trim( strip_tags( $node->getAttribute( 'title' ) ) );
				if( $onlyWithLabel && !strlen( $label ) )
					continue;
				$links[$ref]	= $label;
			}
		}
		return $links;
	}