function helpDisplayTopic(itemID)
{
	document.getElementById('helpTopic1Items').style.display='none';
	document.getElementById('helpTopic2Items').style.display='none';
	document.getElementById('helpTopic3Items').style.display='none';
	document.getElementById('helpTopic4Items').style.display='none';
	document.getElementById('helpTopic5Items').style.display='none';
	
	var displayNow = 'helpTopic' + itemID + 'Items';
	document.getElementById(displayNow).style.display='inline';
	
	var x;
	for (x = 1; x < 6; x++)
	{
		var highlight = 'helpTopicRow' + x;
		var highlightCell = 'helpTopicCell' + x;
		document.getElementById(highlight).style.backgroundColor = '#DDDDDD';
		document.getElementById(highlightCell).style.borderRight = '1px solid #ededed';
	}
	
	var highlight = 'helpTopicRow' + itemID;
	var highlightCell = 'helpTopicCell' + itemID;
	document.getElementById(highlight).style.backgroundColor = '#EEEEEE';
	document.getElementById(highlightCell).style.borderRight = 'none';
}


function GetHyperlinksById()
{
    for (var i = 0; i < document.links.length; i++)
    {
        if (document.links(i).id.indexOf('applynow_') >= 0)
        {
                document.links(i).href = GetApplyNowLink();
            }
    }
}

 /* Get lenderid from query string and build apply now link */ 
 function GetApplyNowLink() 
     {
        var qsParm = new Array();
      /* Default to lenderid of 899999 if url or lender id is invalid */
      qsParm['lenderid'] = '899999';
      var link = '/loanoptions/privateloan';
      var linkSuffix = '/application.aspx?LenderID=';
      var IsValidLender = true;
      var ValidChars = '0123456789';
        var query = window.location.search.substring(1);
        var parms = query.split('&');
        
        for (var i=0; i<parms.length; i++) 
        {
            var pos = parms[i].indexOf('=');
            if (pos > 0) 
            {
                var key = parms[i].substring(0,pos).toLowerCase();
                var val = parms[i].substring(pos+1);
                qsParm[key] = val;
            }
        }
    
   /* Validate that the lenderid is six characters in length */      
        if(qsParm['lenderid'].length != 6)
        {
          IsValidLender = false;
        }    
        
         /* Validate that the lenderid contains only numeric values (couldn't find a javascript function that did this */                     
        for (i = 0; i < qsParm['lenderid'].length; i++) 
        { 
            Char = qsParm['lenderid'].charAt(i); 
            if (ValidChars.indexOf(Char) == -1) 
            {
                IsValidLender = false;
            }
        }   
                           
        /* If lenderid doesn't validate length and numeric check - set to default lender id value */  
        if (IsValidLender == false)
        {
             qsParm['lenderid'] = '899999';
        }
             
        link += linkSuffix + qsParm['lenderid'];
        
        return link
}  

function doClick(buttonName, e)
{
	var key;

	 if(window.event)
		  key = window.event.keyCode;     //IE
	 else
		  key = e.which;     //firefox

	if (key == 13)
	{
		//Get the button the user wants to have clicked
		var btn = document.getElementById(buttonName);
		if (btn != null)
		{ //If we find the button click it
			btn.click();
			event.keyCode = 0
		}
	}
}