// START SPITTIN' OUT THE PAGE
// *******************************************************************
//get_header();
echo "<h2>{$title}</h2>";
if (checkAdmin()) {
    get_adminselector();
}
?>
	<form action="<?php 
echo PAGE_PROFILE;
?>
" method="post" name="profileForm" id="profileForm" >

		<p class="vendor_txt_r"><input name="doSave" type="submit" id="vendor_submit" value="Save Profile Changes" /></p>
		<?php 
if (is_advertiser()) {
    echo '<p class="right"><a href="/profile/' . $a['slug'] . '" target="_blank"> View Public Profile</a></p>';
}
if (!empty($err)) {
    echo '<p class="error_msg">';
    foreach ($err as $e) {
        echo "{$e}<br />";
    }
    echo "</p>";
}
?>
		<div id="TabbedPanels3" class="TabbedPanels"> 
			<div class="TabbedPanelsTabGroup"> 
				<p class="TabbedPanelsTab"> Profile </p>
				<p class="TabbedPanelsTab"> Descriptions </p>
				<p class="TabbedPanelsTab"> Contact </p>
<?php

if (!is_advertiser() && !checkAdmin()) {
    header("Location: " . PAGE_HOME);
    exit;
}
$cmd = pods_url_variable(2);
if ($cmd == 'download') {
    // fix for IE catching or PHP bug issue
    header("Pragma: public");
    header("Expires: 0");
    // set expiration time
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    // browser must download file from server instead of cache
    // force download dialog
    header("Content-Type: application/force-download");
    header("Content-Type: application/octet-stream");
    header("Content-Type: application/download");
    // use the Content-Disposition header to supply a recommended filename and
    // force the browser to display the save dialog.
    $dtmarker = date('Ymd');
    header("Content-Disposition: attachment; filename=occasions_leads_{$dtmarker}.csv;");
    /*
    The Content-transfer-encoding header should be binary, since the file will be read
    directly from the disk and the raw bytes passed to the downloading computer.
    The Content-length header is useful to set for downloads. The browser will be able to
    show a progress meter as a file downloads. The content-lenght can be determines by
    filesize function returns the size of a file.
    */
    header("Content-Transfer-Encoding: binary");
    //header("Content-Length: ".strlen($csv_data));
  </div>
  <?php 
    }
    // end !is_advertiser()
    ?>
	<p>
	<a href="<?php 
    echo PAGE_HOME;
    ?>
">Dashboard</a>
	<br /><a href="<?php 
    echo PAGE_PROFILE;
    ?>
">My Profile</a>
<?php 
    if (is_advertiser() || checkAdmin()) {
        if (checkAdmin()) {
            ?>
	<br />You can view these as an administrator...
<?php 
        }
        ?>
	<br /><a href="<?php 
        echo PAGE_EVENTS;
        ?>
">My Events</a>
	<br /><a href="<?php 
        echo PAGE_LEADS;
        ?>
">Lead List</a>
	<br /><a href="<?php