';
	$hidden .= '';
	$hidden .= '';
	$hidden .= '';
	$hidden .= '';
	$hidden .= '';
	$hidden .= '';
	$hidden .= '';
	$hidden .= '';
	$hidden .= '';
	return $hidden;
}
function renderRelatedActivities($query,$id)
{
        global $mod_strings;
        global $app_strings;
        $hidden = getHiddenValues($id);
        $hidden .= '';
        echo $hidden;
        $focus = new Activity();
  
	$button = '';
        if(isPermitted("Activities",1,"") == 'yes')
        {
		$button .= ' ';
		$button .= ' ';
	}
	$returnset = '&return_module=Potentials&return_action=DetailView&return_id='.$id;
	
	$list = GetRelatedList('Potentials','Activities',$focus,$query,$button,$returnset);
	echo '';
}
function renderRelatedContacts($query,$id)
{
        global $mod_strings;
        global $app_strings;
        $hidden = getHiddenValues($id);
	echo $hidden;
	
	$focus = new Contact();
 
	$button = '';
        if(isPermitted("Contacts",3,"") == 'yes')
        {
 
		$button .= ' ';
	}
	$returnset = '&return_module=Potentials&return_action=DetailView&return_id='.$id;
	$list = GetRelatedList('Potentials','Contacts',$focus,$query,$button,$returnset);
	echo '';
}
function renderRelatedProducts($query,$id)
{
	require_once('modules/Products/Product.php');
        global $mod_strings;
        global $app_strings;
        $hidden = getHiddenValues($id);
        echo $hidden;
        $focus = new Product();
 
	$button = '';
        if(isPermitted("Products",1,"") == 'yes')
        {
 
		$button .= ' ';
	}
	if(isPermitted("Products",3,"") == 'yes')
        {
		$button .= ' ';
	}
	$returnset = '&return_module=Potentials&return_action=DetailView&return_id='.$id;
	$list = GetRelatedList('Potentials','Products',$focus,$query,$button,$returnset);
	echo '';
}
function renderRelatedAttachments($query,$id)
{
        $hidden = getHiddenValues($id);
        echo $hidden;
        getAttachmentsAndNotes('Potentials',$query,$id);
        echo '';
}
function renderRelatedHistory($query,$id)
{
	getHistory('Potentials',$query,$id);
	echo '
';
}
function renderRelatedStageHistory($query,$id)
{
  
	global $theme;
	$theme_path="themes/".$theme."/";
	$image_path=$theme_path."images/";
	require_once ($theme_path."layout_utils.php");
  
	global $adb;
	global $mod_strings;
	global $app_strings;
 
	$result=$adb->query($query);
	$noofrows = $adb->num_rows($result);
	echo '
';
	echo get_form_header($app_strings['LBL_SALES_STAGE'].' '.$app_strings['LBL_HISTORY'],'', false);
	if($noofrows == 0)
	{
	        echo 'Sales Stage Never Changed';
	}
	else
	{
		$list .= '
|  ';
		$list .= ' | '; $list .= $app_strings['LBL_AMOUNT'].''; $list .= ' |  ';
		$list .= ' | '; $list .= $app_strings['LBL_SALES_STAGE'].''; $list .= ' |  ';
		$list .= ' | '; $list .= $app_strings['LBL_PROBABILITY'].''; $list .= ' |  ';
		$list .= ' | '; $list .= $app_strings['LBL_CLOSE_DATE'].''; $list .= ' |  ';
                $list .= ' | '; $list .= $app_strings['LBL_LAST_MODIFIED'].''; $list .= ' |  ';
		$list .= ' | '; $list .= ''; $list .= ' | 
|  | |||||||||||
|  ';
			$list .= ' | '.$row['amount'].''; $list .= ' |  ';
			$list .= ' | '; $list .= $row['stage']; $list .= ''; $list .= ' |  ';
			$list .= ' | '; $list .= $row['probability']; $list .= ''; $list .= ' |  ';
                        $list .= ' | '; $list .= $row['closedate']; $list .= ''; $list .= ' |  ';
			$list .= ' | '; $list .= $row['lastmodified']; $list .= ''; $list .= ''; $list .= ' | ||