	
	var m_currentPursuit;
	    
		function body_onLoad(){
				
			matchCache = new MatchCache('matchCache', '');
			
			pursuitMatchList = new MatchList(
						'pursuitMatchList', 
						'/Pursuits/PursuitLookup.aspx', 
						document.getElementById('query'), 
						document.getElementById('pursuitList'), 
						matchCache);
			
			pursuitMatchList.displayThreshold = 25;
			pursuitMatchList.multiple = false;
		}
	
	function validatePursuitForm(frm)
	{
	    if (frm.query.value.length > 0 && frm.query.value != 'Please enter a pursuit...' && frm.query.value != 'Example: Increase My Energy Level')
	    {
	        frm.pursuitDescription.value = frm.query.value;
	        return true;
	    }
	    
	    frm.query.value = 'Please enter a pursuit...';
	    
	    return false;
	}   
	
	function pursuit_onMouseOver(source, title, id, counter)
	{
	    title = title.replace("\'", "'");
	    
	    m_currentPursuit = title;
	    document.getElementById('pursuitLabelDescription').innerHTML = title;
	    
	    if (counter == '(1)')
    	    counter += ' other person is pursuing this.';
    	else
    	    counter += ' other people are pursuing this.';
    	    
    	document.getElementById('pursuitLabelCounter').innerHTML = counter;

        var sourcePos = PositionUtil.getObjectPosition(source);	    	    
        var pursuitLabel = document.getElementById('pursuitLabel');

        pursuitLabel.style.top = sourcePos.top -7 + 'px';
        pursuitLabel.style.left = sourcePos.left + 100 + 'px';
        pursuitLabel.style.display = 'block';
        
        document.getElementById('pursuitLabelMeToo').href = '/Pursuits/PursuitAdd.aspx?apst=1&pursuitDescription=' + title;
        document.getElementById('pursuitLabelDoneThis').href = '/Pursuits/PursuitAdd.aspx?apst=2&pursuitDescription=' + title;
        document.getElementById('pursuitLabelMore').href = '/Pursuits/PursuitDetail.aspx?pid=' + id;
	}
	
	function pursuit_onMouseOut()
	{
	    m_currentPursuit = '';
	    setTimeout('pursuitLabel_Hide();', 250);
	}

	function pursuitLabel_onMouseOver(e)
	{
	    m_currentPursuit = document.getElementById('pursuitLabelDescription').innerHTML;
	}
	
	function pursuitLabel_onMouseOut()
	{
	    m_currentPursuit = '';
	    setTimeout('pursuitLabel_Hide();', 250);
	}
	
	function pursuitLabel_Hide()
	{
	    if (m_currentPursuit != document.getElementById('pursuitLabelDescription').innerHTML)
	        document.getElementById('pursuitLabel').style.display = 'none';
	}
	