function display_calendar($page, $show_time, $show_adv, $show_bottom, $show_limit, $show_breakdown, $show_type, $show_cpc_or_cpv = true, $show_adv_breakdown = false)
{
    global $navigation;
    $database = DB::getInstance();
    $db = $database->getConnection();
    AUTH::set_timezone($_SESSION['user_timezone']);
    $mysql['user_id'] = $db->real_escape_string($_SESSION['user_id']);
    $user_sql = "SELECT * FROM 202_users_pref WHERE user_id=" . $mysql['user_id'];
    $user_result = _mysqli_query($user_sql);
    $user_row = $user_result->fetch_assoc();
    $html['user_pref_aff_network_id'] = htmlentities($user_row['user_pref_aff_network_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_aff_campaign_id'] = htmlentities($user_row['user_pref_aff_campaign_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_text_ad_id'] = htmlentities($user_row['user_pref_text_ad_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_method_of_promotion'] = htmlentities($user_row['user_pref_method_of_promotion'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_landing_page_id'] = htmlentities($user_row['user_pref_landing_page_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_ppc_network_id'] = htmlentities($user_row['user_pref_ppc_network_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_ppc_account_id'] = htmlentities($user_row['user_pref_ppc_account_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_group_1'] = htmlentities($user_row['user_pref_group_1'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_group_2'] = htmlentities($user_row['user_pref_group_2'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_group_3'] = htmlentities($user_row['user_pref_group_3'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_group_4'] = htmlentities($user_row['user_pref_group_4'], ENT_QUOTES, 'UTF-8');
    $time = grab_timeframe();
    $html['from'] = date('m/d/Y - G:i', $time['from']);
    $html['to'] = date('m/d/Y - G:i', $time['to']);
    $html['ip'] = htmlentities($user_row['user_pref_ip'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_country_id'] = htmlentities($user_row['user_pref_country_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_region_id'] = htmlentities($user_row['user_pref_region_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_isp_id'] = htmlentities($user_row['user_pref_isp_id'], ENT_QUOTES, 'UTF-8');
    $html['referer'] = htmlentities($user_row['user_pref_referer'], ENT_QUOTES, 'UTF-8');
    $html['keyword'] = htmlentities($user_row['user_pref_keyword'], ENT_QUOTES, 'UTF-8');
    $html['page'] = htmlentities($page, ENT_QUOTES, 'UTF-8');
    $html['user_pref_device_id'] = htmlentities($user_row['user_pref_device_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_browser_id'] = htmlentities($user_row['user_pref_browser_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_platform_id'] = htmlentities($user_row['user_pref_platform_id'], ENT_QUOTES, 'UTF-8');
    ?>
	
<div class="row" style="margin-bottom: 15px;">
	<div class="col-xs-12">
	<div id="preferences-wrapper">
		<span style="position: absolute; font-size:12px;"><span class="fui-search"></span> Refine your search: </span>
		<form id="user_prefs" onsubmit="return false;" class="form-inline text-right" role="form">
		<div class="row">
			<div class="col-xs-12">
				<label for="from">Start date: </label>
				<div class="form-group datepicker" style="margin-right: 5px;">
				    <input type="text" class="form-control input-sm" name="from" id="from" value="<?php 
    echo $html['from'];
    ?>
">
				</div>

				<label for="to">End date: </label>
				<div class="form-group datepicker">
				    <input type="text" class="form-control input-sm" name="to" id="to" value="<?php 
    echo $html['to'];
    ?>
">
				</div>

				<div class="form-group">
					<label class="sr-only" for="user_pref_time_predefined">Date</label>
					<select class="form-control input-sm" name="user_pref_time_predefined" id="user_pref_time_predefined" onchange="set_user_pref_time_predefined();">
					    <option value="">Custom Date</option>                                       
						<option <?php 
    if ($time['user_pref_time_predefined'] == 'today') {
        echo 'selected=""';
    }
    ?>
 value="today">Today</option>
						<option <?php 
    if ($time['user_pref_time_predefined'] == 'yesterday') {
        echo 'selected=""';
    }
    ?>
 value="yesterday">Yesterday</option>
						<option <?php 
    if ($time['user_pref_time_predefined'] == 'last7') {
        echo 'selected=""';
    }
    ?>
 value="last7">Last 7 Days</option>
						<option <?php 
    if ($time['user_pref_time_predefined'] == 'last14') {
        echo 'selected=""';
    }
    ?>
 value="last14">Last 14 Days</option>
						<option <?php 
    if ($time['user_pref_time_predefined'] == 'last30') {
        echo 'selected=""';
    }
    ?>
 value="last30">Last 30 Days</option>
						<option <?php 
    if ($time['user_pref_time_predefined'] == 'thismonth') {
        echo 'selected=""';
    }
    ?>
 value="thismonth">This Month</option>
						<option <?php 
    if ($time['user_pref_time_predefined'] == 'lastmonth') {
        echo 'selected=""';
    }
    ?>
 value="lastmonth">Last Month</option>
						<option <?php 
    if ($time['user_pref_time_predefined'] == 'thisyear') {
        echo 'selected=""';
    }
    ?>
 value="thisyear">This Year</option>
						<option <?php 
    if ($time['user_pref_time_predefined'] == 'lastyear') {
        echo 'selected=""';
    }
    ?>
 value="lastyear">Last Year</option>
						<option <?php 
    if ($time['user_pref_time_predefined'] == 'alltime') {
        echo 'selected=""';
    }
    ?>
 value="alltime">All Time</option>
					</select>
				</div>
			</div>
		</div>

		<div class="form_seperator" style="margin:5px 0px; padding:1px">
			<div class="col-xs-12"></div>
		</div>

		<?php 
    if ($navigation[1] == 'tracking202') {
        ?>
		<div class="row" style="text-align:left; <?php 
        if ($show_adv == false) {
            echo 'display:none;';
        }
        ?>
">
			<div class="col-xs-12" style="margin-top:5px;">
				<div class="row">
					<div class="col-xs-6">
						<label>PPC Network/Account: </label>
						
						<div class="form-group">
							<img id="ppc_network_id_div_loading" class="loading" style="display: none;" src="/202-img/loader-small.gif"/>
							<div id="ppc_network_id_div"></div>
						</div>

						<div class="form-group">
							<div id="ppc_account_id_div"></div>
						</div>
					</div>

					<div class="col-xs-6" style="text-align:right">
						<label>Visitor IP: </label>
						<div class="form-group">
							<input type="text" class="form-control input-sm" name="ip" id="ip" value="<?php 
        echo $html['ip'];
        ?>
"/>
						</div>
					</div>

					<div class="col-xs-6">
						<label>Aff Network/Campaign: </label>
						<div class="form-group">
							<img id="aff_network_id_div_loading" class="loading" style="display: none;" src="/202-img/loader-small.gif"/>
							<div id="aff_network_id_div" ></div>
						</div>

						<div class="form-group">
							<div id="aff_campaign_id_div"></div>
						</div>
					</div>

					<div class="col-xs-6" style="text-align:right">
						<div class="row">
							<div class="col-xs-6">
								<label>Keyword: </label>
								<div class="form-group">
									<input name="keyword" id="keyword" type="text" class="form-control input-sm" value="<?php 
        echo $html['keyword'];
        ?>
"/>
								</div>
							</div>
							<div class="col-xs-6">
								<label>Referer: </label>
								<div class="form-group">
									<input name="referer" id="referer" type="text" class="form-control input-sm" value="<?php 
        echo $html['referer'];
        ?>
"/>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<div class="form_seperator" style="margin:5px 0px; padding:1px; <?php 
        if ($show_adv == false) {
            echo 'display:none;';
        }
        ?>
">
			<div class="col-xs-12"></div>
		</div>
		<div id="more-options" style="height: 87px; <?php 
        if ($user_row['user_pref_adv'] != '1' or $show_adv == false) {
            echo 'display: none;';
        }
        ?>
">
			<div class="row" style="text-align:left;">
				<div class="col-xs-12" style="margin-top:5px;">
					<div class="row">
						<div class="col-xs-6">
							<label>Text Ad: </label>
							
							<div class="form-group">
								<img id="text_ad_id_div_loading" class="loading" style="display: none;" src="/202-img/loader-small.gif"/>
								<div id="text_ad_id_div" style="margin-left: 69px;"></div>
							</div>

							<div class="form-group">
								<img id="ad_preview_div_loading" class="loading" style="display: none;" src="/202-img/loader-small.gif"/>
								<div id="ad_preview_div" style="position: absolute;top: -12px; font-size:10px;"></div>
							</div>
						</div>

						<div class="col-xs-6" style="text-align:right">
							<div class="row">
								<div class="col-xs-6">
								<label>Device type: </label>
								<div class="form-group">
									<img id="device_id_div_loading" class="loading" style="right:0px; left: 5px;" src="/202-img/loader-small.gif"/>
									<div id="device_id_div" style="top: -12px; font-size:10px;">
										<select class="form-control input-sm" name="device_id" id="device_id">
	    									<option value="0"> -- </option>
	    								</select>
									</div>
								</div>
							</div>

							<div class="col-xs-6">
								<label>Country: </label>
								<div class="form-group">
									<img id="country_id_div_loading" class="loading" style="right:0px; left: 5px;" src="/202-img/loader-small.gif"/>
									<div id="country_id_div" style="top: -12px; font-size:10px;">
										<select class="form-control input-sm" name="country_id" id="country_id">
	    									<option value="0"> -- </option>
	    								</select>
									</div>
								</div>
							</div>
							</div>
						</div>

						<div class="col-xs-6">
							<label>Method of Promotion: </label>
							<div class="form-group">
								<img id="method_of_promotion_div_loading" class="loading" style="display: none;" src="/202-img/loader-small.gif"/>
								<div id="method_of_promotion_div" style="margin-left: 6px;"></div>
							</div>
						</div>

						<div class="col-xs-6" style="text-align:right">
							<div class="row">
								<div class="col-xs-6">
									<label>Browser: </label>
									<div class="form-group">
										<img id="browser_id_div_loading" class="loading" style="right:0px; left: 5px;" src="/202-img/loader-small.gif"/>
										<div id="browser_id_div" style="top: -12px; font-size:10px;">
											<select class="form-control input-sm" name="browser_id" id="browser_id">
		    									<option value="0"> -- </option>
		    								</select>
										</div>
									</div>
								</div>
								<div class="col-xs-6">
									<label>Region: </label>
									<div class="form-group">
										<img id="region_id_div_loading" class="loading" style="right:0px; left: 5px;" src="/202-img/loader-small.gif"/>
										<div id="region_id_div" style="top: -12px; font-size:10px;">
											<select class="form-control input-sm" name="region_id" id="region_id">
		    									<option value="0"> -- </option>
		    								</select>
										</div>
									</div>
								</div>
							</div>
						</div>

						<div class="col-xs-6">
							<label>Landing Page: </label>
							<div class="form-group">
								<img id="landing_page_div_loading" class="loading" style="display: none;" src="/202-img/loader-small.gif"/>
								<div id="landing_page_div" style="margin-left: 45px;"></div>
							</div>
						</div>

						<div class="col-xs-6" style="text-align:right">
							<div class="row">
								<div class="col-xs-6">
									<label>Platforms: </label>
									<div class="form-group">
										<img id="platform_id_div_loading" class="loading" style="right:0px; left: 5px;" src="/202-img/loader-small.gif"/>
										<div id="platform_id_div" style="top: -12px; font-size:10px;">
											<select class="form-control input-sm" name="platform_id" id="platform_id">
		    									<option value="0"> -- </option>
		    								</select>
										</div>
									</div>
								</div>
								<div class="col-xs-6">
									<label>ISP/Carrier: </label>
									<div class="form-group">
										<img id="isp_id_div_loading" class="loading" style="right:0px; left: 5px;" src="/202-img/loader-small.gif"/>
										<div id="isp_id_div" style="top: -12px; font-size:10px;">
											<select class="form-control input-sm" name="isp_id" id="isp_id">
		    									<option value="0"> -- </option>
		    								</select>
										</div>
									</div>
								</div>
							</div>
						</div>

					</div>
				</div>
			</div>

			<div class="form_seperator" style="margin:5px 0px; padding:1px;">
				<div class="col-xs-12"></div>
			</div>
		</div>

		<?php 
    }
    ?>
		<?php 
    if ($show_adv_breakdown == true) {
        ?>
		<div class="row">
			<div class="col-xs-12" style="margin-top:5px; <?php 
        if ($show_adv != false) {
            echo 'text-align:left;';
        }
        ?>
 <?php 
        if ($show_bottom == false) {
            echo 'display:none;';
        }
        ?>
">
				<label>Group By: </label>
				<div class="form-group">
					<label class="sr-only" for="user_pref_limit">Date</label>
					<select class="form-control input-sm" name="details[]">
						<?php 
        foreach (ReportSummaryForm::getDetailArray() as $detail_item) {
            ?>
							<option value="<?php 
            echo $detail_item;
            ?>
" <?php 
            echo $html['user_pref_group_1'] == $detail_item ? 'selected="selected"' : '';
            ?>
><?php 
            echo ReportBasicForm::translateDetailLevelById($detail_item);
            ?>
</option>
						<?php 
        }
        ?>
					</select>
				</div>

				<label>Then Group By: </label>
				<div class="form-group">
					<label class="sr-only" for="user_pref_breakdown">Date</label>
					<select class="form-control input-sm" name="details[]">
						<option value="<?php 
        echo ReportBasicForm::DETAIL_LEVEL_NONE;
        ?>
" <?php 
        echo $html['user_pref_group_1'] == ReportBasicForm::DETAIL_LEVEL_NONE ? 'selected="selected"' : '';
        ?>
><?php 
        echo ReportBasicForm::translateDetailLevelById(ReportBasicForm::DETAIL_LEVEL_NONE);
        ?>
</option>
						<?php 
        foreach (ReportSummaryForm::getDetailArray() as $detail_item) {
            ?>
							<option value="<?php 
            echo $detail_item;
            ?>
" <?php 
            echo $html['user_pref_group_2'] == $detail_item ? 'selected="selected"' : '';
            ?>
><?php 
            echo ReportBasicForm::translateDetailLevelById($detail_item);
            ?>
</option>
						<?php 
        }
        ?>
					</select>
				</div>

				<label>Then Group By: </label>
				<div class="form-group">
					<label class="sr-only" for="user_pref_chart">Date</label>
					<select class="form-control input-sm" name="details[]">
						<option value="<?php 
        echo ReportBasicForm::DETAIL_LEVEL_NONE;
        ?>
" <?php 
        echo $html['user_pref_group_1'] == ReportBasicForm::DETAIL_LEVEL_NONE ? 'selected="selected"' : '';
        ?>
><?php 
        echo ReportBasicForm::translateDetailLevelById(ReportBasicForm::DETAIL_LEVEL_NONE);
        ?>
</option>
						<?php 
        foreach (ReportSummaryForm::getDetailArray() as $detail_item) {
            ?>
							<option value="<?php 
            echo $detail_item;
            ?>
" <?php 
            echo $html['user_pref_group_3'] == $detail_item ? 'selected="selected"' : '';
            ?>
><?php 
            echo ReportBasicForm::translateDetailLevelById($detail_item);
            ?>
</option>
						<?php 
        }
        ?>
					</select>
				</div>

				<label>Then Group By: </label>
				<div class="form-group">
					<label class="sr-only" for="user_pref_show">Date</label>
					<select class="form-control input-sm" name="details[]">
						<option value="<?php 
        echo ReportBasicForm::DETAIL_LEVEL_NONE;
        ?>
" <?php 
        echo $html['user_pref_group_1'] == ReportBasicForm::DETAIL_LEVEL_NONE ? 'selected="selected"' : '';
        ?>
><?php 
        echo ReportBasicForm::translateDetailLevelById(ReportBasicForm::DETAIL_LEVEL_NONE);
        ?>
</option>
						<?php 
        foreach (ReportBasicForm::getDetailArray() as $detail_item) {
            ?>
							<option value="<?php 
            echo $detail_item;
            ?>
" <?php 
            echo $html['user_pref_group_4'] == $detail_item ? 'selected="selected"' : '';
            ?>
><?php 
            echo ReportBasicForm::translateDetailLevelById($detail_item);
            ?>
</option>
						<?php 
        }
        ?>
					</select>
				</div>
				
			</div>
		</div>

		<div class="form_seperator" style="margin:5px 0px; padding:1px;">
			<div class="col-xs-12"></div>
		</div>

		<?php 
    }
    ?>
		<div class="row">
			<div class="col-xs-12" style="margin-top:5px; <?php 
    if ($show_adv != false) {
        echo 'text-align:left;';
    }
    ?>
 <?php 
    if ($show_bottom == false) {
        echo 'display:none;';
    }
    ?>
">
				<label>Display: </label>
				<div class="form-group">
					<label class="sr-only" for="user_pref_limit">Date</label>
					<select class="form-control input-sm" name="user_pref_limit" id="user_pref_limit" style="width: auto; <?php 
    if ($show_limit == false) {
        echo 'display:none;';
    }
    ?>
">
					    <option <?php 
    if ($user_row['user_pref_limit'] == '10') {
        echo 'SELECTED';
    }
    ?>
 value="10">10</option>
						<option <?php 
    if ($user_row['user_pref_limit'] == '25') {
        echo 'SELECTED';
    }
    ?>
 value="25">25</option>
						<option <?php 
    if ($user_row['user_pref_limit'] == '50') {
        echo 'SELECTED';
    }
    ?>
 value="50">50</option>
						<option <?php 
    if ($user_row['user_pref_limit'] == '75') {
        echo 'SELECTED';
    }
    ?>
 value="75">75</option> 
						<option <?php 
    if ($user_row['user_pref_limit'] == '100') {
        echo 'SELECTED';
    }
    ?>
 value="100">100</option>
						<option <?php 
    if ($user_row['user_pref_limit'] == '150') {
        echo 'SELECTED';
    }
    ?>
 value="150">150</option>
						<option <?php 
    if ($user_row['user_pref_limit'] == '200') {
        echo 'SELECTED';
    }
    ?>
 value="200">200</option>
					</select>
				</div>

				<div class="form-group">
					<label class="sr-only" for="user_pref_breakdown">Date</label>
					<select class="form-control input-sm" name="user_pref_breakdown" id="user_pref_breakdown" <?php 
    if ($show_breakdown == false) {
        echo 'style="display:none;"';
    }
    ?>
>
						<option <?php 
    if ($user_row['user_pref_breakdown'] == 'hour') {
        echo 'SELECTED';
    }
    ?>
 value="hour">By Hour</option>
						<option <?php 
    if ($user_row['user_pref_breakdown'] == 'day') {
        echo 'SELECTED';
    }
    ?>
 value="day">By Day</option>
						<option <?php 
    if ($user_row['user_pref_breakdown'] == 'month') {
        echo 'SELECTED';
    }
    ?>
 value="month">By Month</option>  
						<option <?php 
    if ($user_row['user_pref_breakdown'] == 'year') {
        echo 'SELECTED';
    }
    ?>
 value="year">By Year</option>  
					</select>
				</div>

				<div class="form-group">
					<label class="sr-only" for="user_pref_chart">Date</label>
					<select class="form-control input-sm" name="user_pref_chart" id="user_pref_chart" <?php 
    if ($show_breakdown == false) {
        echo 'style="display:none;"';
    }
    ?>
>
						<option <?php 
    if ($user_row['user_pref_chart'] == 'profitloss') {
        echo 'SELECTED';
    }
    ?>
 value="profitloss">Profit Loss Bar Graph</option>
						<option <?php 
    if ($user_row['user_pref_chart'] == 'clicks') {
        echo 'SELECTED';
    }
    ?>
 value="clicks">Clicks Line Graph</option>
						<option <?php 
    if ($user_row['user_pref_chart'] == 'leads') {
        echo 'SELECTED';
    }
    ?>
 value="leads">Leads Line Graph</option>
						<option <?php 
    if ($user_row['user_pref_chart'] == 'su_ratio') {
        echo 'SELECTED';
    }
    ?>
 value="su_ratio">S/U Ratio Line Graph</option>
						<option <?php 
    if ($user_row['user_pref_chart'] == 'payout') {
        echo 'SELECTED';
    }
    ?>
 value="payout">Payout Line Graph</option>
						<option <?php 
    if ($user_row['user_pref_chart'] == 'epc') {
        echo 'SELECTED';
    }
    ?>
 value="epc">EPC Line Graph</option>
						<option <?php 
    if ($user_row['user_pref_chart'] == 'cpc') {
        echo 'SELECTED';
    }
    ?>
 value="cpc">Avg CPC Line Graph</option>
						<option <?php 
    if ($user_row['user_pref_chart'] == 'income') {
        echo 'SELECTED';
    }
    ?>
 value="income">Income Line Graph</option>
						<option <?php 
    if ($user_row['user_pref_chart'] == 'cost') {
        echo 'SELECTED';
    }
    ?>
 value="cost">Cost Line Graph</option>
						<option <?php 
    if ($user_row['user_pref_chart'] == 'net') {
        echo 'SELECTED';
    }
    ?>
 value="net">Net Line Graph</option>
						<option <?php 
    if ($user_row['user_pref_chart'] == 'roi') {
        echo 'SELECTED';
    }
    ?>
 value="roi">ROI Line Graph</option> 
					</select>
				</div>

				<div class="form-group">
					<label class="sr-only" for="user_pref_show">Date</label>
					<select style="width: 155px;" class="form-control input-sm" name="user_pref_show" id="user_pref_show" <?php 
    if ($show_type == false) {
        echo 'style="display:none;"';
    }
    ?>
>
						<option <?php 
    if ($user_row['user_pref_show'] == 'all') {
        echo 'SELECTED';
    }
    ?>
 value="all">Show All Clicks</option>
						<option <?php 
    if ($user_row['user_pref_show'] == 'real') {
        echo 'SELECTED';
    }
    ?>
 value="real">Show Real Clicks</option>
						<option <?php 
    if ($user_row['user_pref_show'] == 'filtered') {
        echo 'SELECTED';
    }
    ?>
 value="filtered">Show Filtered Out Clicks</option>
						<option <?php 
    if ($user_row['user_pref_show'] == 'filtered_bot') {
        echo 'SELECTED';
    }
    ?>
 value="filtered_bot">Show Filtered Out Bot Clicks</option>
						<option <?php 
    if ($user_row['user_pref_show'] == 'leads') {
        echo 'SELECTED';
    }
    ?>
 value="leads">Show Converted Clicks</option>
					</select>
				</div>

				<div class="form-group">
					<label class="sr-only" for="user_cpc_or_cpv">Date</label>
					<select class="form-control input-sm" name="user_cpc_or_cpv" id="user_cpc_or_cpv" <?php 
    if ($show_cpc_or_cpv == false) {
        echo 'style="display:none;"';
    }
    ?>
>
						<option <?php 
    if ($user_row['user_cpc_or_cpv'] == 'cpc') {
        echo 'SELECTED';
    }
    ?>
 value="cpc">CPC Costs</option>
						<option <?php 
    if ($user_row['user_cpc_or_cpv'] == 'cpv') {
        echo 'SELECTED';
    }
    ?>
 value="cpv">CPV Costs</option>
					</select>
				</div>
				<button id="s-search" style="width: 130px; <?php 
    if ($show_adv != false) {
        echo 'float:right;';
    }
    ?>
" type="submit" class="btn btn-xs btn-info" onclick="set_user_prefs('<?php 
    echo $html['page'];
    ?>
');">Set Preferences</button>
				<button id="s-toogleAdv" style="width: 130px; margin-right: 5px; float:right; <?php 
    if ($show_adv == false) {
        echo 'display:none;';
    }
    ?>
" type="submit" class="btn btn-xs btn-default">More Options</button>
			</div>
		</div>

		</form>
	</div>	   
</div>
</div>

<div class="row">
	<div class="col-xs-12">
		<div id="m-content">
			<div class="loading-stats"><span class="infotext">Loading stats...</span> <img src="/202-img/loader-small.gif"></div>
		</div>  
	</div>
</div>                              
   
   <script type="text/javascript">
		
		/* TIME SETTING FUNCTION */ 
		function set_user_pref_time_predefined() {

			var element = $('#user_pref_time_predefined');

			if (element.val() == 'today') {
				<?php 
    $time['from'] = mktime(0, 0, 0, date('m', time()), date('d', time()), date('Y', time()));
    $time['to'] = mktime(23, 59, 59, date('m', time()), date('d', time()), date('Y', time()));
    ?>

				$('#from').val('<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
');
				$('#to').val('<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
');
			}

			if (element.val() == 'yesterday') {
				<?php 
    $time['from'] = mktime(0, 0, 0, date('m', time() - 86400), date('d', time() - 86400), date('Y', time() - 86400));
    $time['to'] = mktime(23, 59, 59, date('m', time() - 86400), date('d', time() - 86400), date('Y', time() - 86400));
    ?>

				$('#from').val('<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
');
				$('#to').val('<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
');
			}

			if (element.val() == 'last7') {
				<?php 
    $time['from'] = mktime(0, 0, 0, date('m', time() - 86400 * 7), date('d', time() - 86400 * 7), date('Y', time() - 86400 * 7));
    $time['to'] = mktime(23, 59, 59, date('m', time()), date('d', time()), date('Y', time()));
    ?>

				$('#from').val('<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
');
				$('#to').val('<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
');
			}

			if (element.val() == 'last14') {
				<?php 
    $time['from'] = mktime(0, 0, 0, date('m', time() - 86400 * 14), date('d', time() - 86400 * 14), date('Y', time() - 86400 * 14));
    $time['to'] = mktime(23, 59, 59, date('m', time()), date('d', time()), date('Y', time()));
    ?>

				$('#from').val('<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
');
				$('#to').val('<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
');
			}

			if (element.val() == 'last30') {
				<?php 
    $time['from'] = mktime(0, 0, 0, date('m', time() - 86400 * 30), date('d', time() - 86400 * 30), date('Y', time() - 86400 * 30));
    $time['to'] = mktime(23, 59, 59, date('m', time()), date('d', time()), date('Y', time()));
    ?>

				$('#from').val('<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
');
				$('#to').val('<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
');
			}

			if (element.val() == 'thismonth') {
				<?php 
    $time['from'] = mktime(0, 0, 0, date('m', time()), 1, date('Y', time()));
    $time['to'] = mktime(23, 59, 59, date('m', time()), date('d', time()), date('Y', time()));
    ?>

				$('#from').val('<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
');
				$('#to').val('<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
');
			}

			if (element.val() == 'lastmonth') {
				<?php 
    $time['from'] = mktime(0, 0, 0, date('m', time() - 2629743), 1, date('Y', time() - 2629743));
    $time['to'] = mktime(23, 59, 59, date('m', time() - 2629743), getLastDayOfMonth(date('m', time() - 2629743), date('Y', time() - 2629743)), date('Y', time() - 2629743));
    ?>

				$('#from').val('<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
');
				$('#to').val('<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
');
			}

			if (element.val() == 'thisyear') {
				<?php 
    $time['from'] = mktime(0, 0, 0, 1, 1, date('Y', time()));
    $time['to'] = mktime(23, 59, 59, date('m', time()), date('d', time()), date('Y', time()));
    ?>

				$('#from').val('<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
');
				$('#to').val('<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
');
			}

			if (element.val() == 'lastyear') {
				<?php 
    $time['from'] = mktime(0, 0, 0, 1, 1, date('Y', time() - 31556926));
    $time['to'] = mktime(0, 0, 0, 12, getLastDayOfMonth(date('m', time() - 31556926), date('Y', time() - 31556926)), date('Y', time() - 31556926));
    ?>

				$('#from').val('<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
');
				$('#to').val('<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
');
			}
			
			if (element.val() == 'alltime') {
				<?php 
    //for the time from, do something special select the exact date this user was registered and use that :)
    $mysql['user_id'] = $db->real_escape_string($_SESSION['user_id']);
    $user_sql = "SELECT user_time_register FROM 202_users WHERE user_id='" . $mysql['user_id'] . "'";
    $user_result = $db->query($user_sql) or record_mysql_error($user_sql);
    $user_row = $user_result->fetch_assoc();
    $time['from'] = $user_row['user_time_register'];
    $time['from'] = mktime(0, 0, 0, date('m', $time['from']), date('d', $time['from']), date('Y', $time['from']));
    $time['to'] = mktime(23, 59, 59, date('m', time()), date('d', time()), date('Y', time()));
    ?>

				$('#from').val('<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
');
				$('#to').val('<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
');
			}
		}
		
		/* SHOW FIELDS */        

		load_ppc_network_id('<?php 
    echo $html['user_pref_ppc_network_id'];
    ?>
');
		<?php 
    if ($html['user_pref_ppc_account_id'] != '') {
        ?>
			load_ppc_account_id('<?php 
        echo $html['user_pref_ppc_network_id'];
        ?>
','<?php 
        echo $html['user_pref_ppc_account_id'];
        ?>
');      
		<?php 
    }
    ?>
		
		load_aff_network_id('<?php 
    echo $html['user_pref_aff_network_id'];
    ?>
');
		<?php 
    if ($html['user_pref_aff_campaign_id'] != '') {
        ?>
			load_aff_campaign_id('<?php 
        echo $html['user_pref_aff_network_id'];
        ?>
','<?php 
        echo $html['user_pref_aff_campaign_id'];
        ?>
');
		<?php 
    }
    ?>
		
		<?php 
    if ($html['user_pref_text_ad_id'] != '') {
        ?>
			load_text_ad_id('<?php 
        echo $html['user_pref_aff_campaign_id'];
        ?>
','<?php 
        echo $html['user_pref_text_ad_id'];
        ?>
');
			load_ad_preview('<?php 
        echo $html['user_pref_text_ad_id'];
        ?>
'); 
		<?php 
    }
    ?>
		
		load_method_of_promotion('<?php 
    echo $html['user_pref_method_of_promotion'];
    ?>
');
		
		<?php 
    if ($html['user_pref_landing_page_id'] != '') {
        ?>
			load_landing_page('<?php 
        echo $html['user_pref_aff_campaign_id'];
        ?>
', '<?php 
        echo $html['user_pref_landing_page_id'];
        ?>
', '<?php 
        echo $html['user_pref_method_of_promotion'];
        ?>
');
		<?php 
    }
    ?>

		<?php 
    if ($show_adv != false) {
        ?>
			load_country_id('<?php 
        echo $html['user_pref_country_id'];
        ?>
');
			load_region_id('<?php 
        echo $html['user_pref_region_id'];
        ?>
');
			load_isp_id('<?php 
        echo $html['user_pref_isp_id'];
        ?>
');
			load_device_id('<?php 
        echo $html['user_pref_device_id'];
        ?>
');
			load_browser_id('<?php 
        echo $html['user_pref_browser_id'];
        ?>
');
			load_platform_id('<?php 
        echo $html['user_pref_platform_id'];
        ?>
');
		<?php 
    }
    ?>
		

   </script> 
<?php 
}
 /**
  * Returns a new child form
  * @return Form
  */
 function getChildForm()
 {
     $classname = ReportSummaryForm::translateDetailFunctionById($this->getReportParameters()->getDetailsByKey($this->getDetailId()));
     $child_class = new $classname();
     $next_id = $this->getDetailId() + 1;
     $child_class->setDetailId($next_id);
     $child_class->setParentClass($this);
     return $child_class;
 }
Exemplo n.º 3
0
//show real or filtered clicks
$mysql['user_id'] = $db->real_escape_string($_SESSION['user_id']);
$user_sql = "SELECT * FROM 202_users_pref WHERE user_id=" . $mysql['user_id'];
$user_result = _mysqli_query($user_sql, $dbGlobalLink);
//($user_sql);
$user_row = $user_result->fetch_assoc();
$html['user_pref_group_1'] = htmlentities($user_row['user_pref_group_1'], ENT_QUOTES, 'UTF-8');
$html['user_pref_group_2'] = htmlentities($user_row['user_pref_group_2'], ENT_QUOTES, 'UTF-8');
$html['user_pref_group_3'] = htmlentities($user_row['user_pref_group_3'], ENT_QUOTES, 'UTF-8');
$html['user_pref_group_4'] = htmlentities($user_row['user_pref_group_4'], ENT_QUOTES, 'UTF-8');
if ($user_row['user_cpc_or_cpv'] == 'cpv') {
    $cpv = true;
} else {
    $cpv = false;
}
$summary_form = new ReportSummaryForm();
$summary_form->setDetails(array($user_row['user_pref_group_1'], $user_row['user_pref_group_2'], $user_row['user_pref_group_3'], $user_row['user_pref_group_4']));
$summary_form->setDetailsSort(array(ReportBasicForm::SORT_NAME));
$summary_form->setDisplayType(array(ReportBasicForm::DISPLAY_TYPE_TABLE));
$summary_form->setStartTime($mysql['from']);
$summary_form->setEndTime($mysql['to']);
?>

<div class="row">
	<div class="col-xs-8">
		<h6>Group Overview</h6>
		<small>The group overview screen gives you a quick glance at all of your traffic across all dimensions.</small>
	</div>
	<div class="col-xs-4 text-right" style="margin-top:15px;">
		<img style="margin-bottom:2px;" src="/202-img/icons/16x16/page_white_excel.png"/>
		<a style="font-size:12px;" target="_new" href="/tracking202/overview/group_overview_download.php">
//show real or filtered clicks
$mysql['user_id'] = $db->real_escape_string($_SESSION['user_id']);
$user_sql = "SELECT * FROM 202_users_pref WHERE user_id=" . $mysql['user_id'];
$user_result = _mysqli_query($user_sql, $dbGlobalLink);
//($user_sql);
$user_row = $user_result->fetch_assoc();
$html['user_pref_group_1'] = htmlentities($user_row['user_pref_group_1'], ENT_QUOTES, 'UTF-8');
$html['user_pref_group_2'] = htmlentities($user_row['user_pref_group_2'], ENT_QUOTES, 'UTF-8');
$html['user_pref_group_3'] = htmlentities($user_row['user_pref_group_3'], ENT_QUOTES, 'UTF-8');
$html['user_pref_group_4'] = htmlentities($user_row['user_pref_group_4'], ENT_QUOTES, 'UTF-8');
if ($user_row['user_cpc_or_cpv'] == 'cpv') {
    $cpv = true;
} else {
    $cpv = false;
}
$summary_form = new ReportSummaryForm();
$summary_form->setDetails(array($user_row['user_pref_group_1'], $user_row['user_pref_group_2'], $user_row['user_pref_group_3'], $user_row['user_pref_group_4']));
$summary_form->setDetailsSort(array(ReportBasicForm::SORT_NAME));
$summary_form->setDisplayType(array(ReportBasicForm::DISPLAY_TYPE_TABLE));
$summary_form->setStartTime($mysql['from']);
$summary_form->setEndTime($mysql['to']);
$mysql['user_id'] = $db->real_escape_string($_SESSION['user_id']);
$info_result = _mysqli_query($summary_form->getQuery($mysql['user_id'], $user_row));
while ($row = $info_result->fetch_assoc()) {
    $summary_form->addReportData($row);
}
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"GroupOverviewReport" . date("mdy") . ".csv\"");
header("Expires: 0");
header("Pragma: no-cache");
ReportBasicForm::echoCell("Group Overview Report for " . date("m/d/Y", strtotime($summary_form->getStartDate())) . " to " . date("m/d/Y", strtotime($summary_form->getEndDate())));
Exemplo n.º 5
0
function display_calendar($page, $show_time, $show_adv, $show_bottom, $show_limit, $show_breakdown, $show_type, $show_cpc_or_cpv = true, $show_adv_breakdown = false)
{
    global $navigation;
    AUTH::set_timezone($_SESSION['user_timezone']);
    $mysql['user_id'] = mysql_real_escape_string($_SESSION['user_id']);
    $user_sql = "SELECT * FROM 202_users_pref WHERE user_id=" . $mysql['user_id'];
    $user_result = _mysql_query($user_sql);
    $user_row = mysql_fetch_assoc($user_result);
    $html['user_pref_aff_network_id'] = htmlentities($user_row['user_pref_aff_network_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_aff_campaign_id'] = htmlentities($user_row['user_pref_aff_campaign_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_text_ad_id'] = htmlentities($user_row['user_pref_text_ad_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_method_of_promotion'] = htmlentities($user_row['user_pref_method_of_promotion'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_landing_page_id'] = htmlentities($user_row['user_pref_landing_page_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_ppc_network_id'] = htmlentities($user_row['user_pref_ppc_network_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_ppc_account_id'] = htmlentities($user_row['user_pref_ppc_account_id'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_group_1'] = htmlentities($user_row['user_pref_group_1'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_group_2'] = htmlentities($user_row['user_pref_group_2'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_group_3'] = htmlentities($user_row['user_pref_group_3'], ENT_QUOTES, 'UTF-8');
    $html['user_pref_group_4'] = htmlentities($user_row['user_pref_group_4'], ENT_QUOTES, 'UTF-8');
    $time = grab_timeframe();
    $html['from'] = date('m/d/Y - G:i', $time['from']);
    $html['to'] = date('m/d/Y - G:i', $time['to']);
    $html['country'] = htmlentities($user_row['user_pref_country'], ENT_QUOTES, 'UTF-8');
    $html['ip'] = htmlentities($user_row['user_pref_ip'], ENT_QUOTES, 'UTF-8');
    $html['referer'] = htmlentities($user_row['user_pref_referer'], ENT_QUOTES, 'UTF-8');
    $html['keyword'] = htmlentities($user_row['user_pref_keyword'], ENT_QUOTES, 'UTF-8');
    $html['page'] = htmlentities($page, ENT_QUOTES, 'UTF-8');
    ?>
	

	<form onsubmit="return false;" id="user_prefs">
		<input type="hidden" name="duration" value="1"/>
		<input type="hidden" name="user_pref_adv" id="user_pref_adv" value="<?php 
    if ($user_row['user_pref_adv'] == '1') {
        echo '1';
    }
    ?>
" />
		
		<table class="s-top" cellspacing="0" cellpadding="0" id="s-top">
			<tr valign="top">
				<td class="s-top-left"/>
				<td class="s-top-middle">
					<table class="s-top-middle-table" cellspacing="0" cellpadding="0">
						<tr>
							<td class="s-top-middle-table-left">Refine your search:</td>
							<td >
								<table cellspacing="0" cellpadding="0" class="s-top-middle-table-right" <?php 
    if ($show_time == false) {
        echo 'style="display:none;"';
    }
    ?>
>
									<tr>
										<td>
											Start Date: <input onclick=" $('from_cal').style.display='block'; $('to_cal').style.display='none';  unset_user_pref_time_predefined();"   class="s-input s-input-date" type="text" name="from" id="from" value="<?php 
    echo $html['from'];
    ?>
" onkeydown="$('from_cal').style.display='none'; unset_user_pref_time_predefined();"/>
											
											<div id="from_cal" class="scal tinyscal" style="position: absolute; z-index: 10; display: none;"></div>
											<script type="text/javascript">
												var options = ({
												     updateformat: 'mm/dd/yyyy - 0:00',
	            									     month:<?php 
    echo date('m', $time['from']);
    ?>
,
												     year:<?php 
    echo date('Y', $time['from']);
    ?>
,
												     day: <?php 
    echo date('d', $time['from']);
    ?>
												});
												var from_cal = new scal('from_cal','from', options);
											</script>
											
										</td>
										<td>
											End Date: <input onclick=" $('to_cal').style.display='block'; $('from_cal').style.display='none';  unset_user_pref_time_predefined();"  class="s-input s-input-date" type="text" name="to" id="to" value="<?php 
    echo $html['to'];
    ?>
" onkeydown="$('to_cal').style.display='none'; unset_user_pref_time_predefined();"/>		
											
											<div id="to_cal" class="scal tinyscal" style="position: absolute; z-index: 10; display: none;"></div>
											<script type="text/javascript">
												var options = ({
												     updateformat: 'mm/dd/yyyy - 23:59',
	            									     month:<?php 
    echo date('m', $time['from']);
    ?>
,
												     year:<?php 
    echo date('Y', $time['from']);
    ?>
,
												     day: <?php 
    echo date('d', $time['from']);
    ?>
												});
												var to_cal = new scal('to_cal','to', options);
											</script>
											
										</td>
										<td><select class="s-input" name="user_pref_time_predefined" id="user_pref_time_predefined" onchange="set_user_pref_time_predefined();">
											<option value="">Custom Date</option>                                       
											<option <?php 
    if ($time['user_pref_time_predefined'] == 'today') {
        echo 'selected=""';
    }
    ?>
 value="today">Today</option>
											<option <?php 
    if ($time['user_pref_time_predefined'] == 'yesterday') {
        echo 'selected=""';
    }
    ?>
 value="yesterday">Yesterday</option>
											<option <?php 
    if ($time['user_pref_time_predefined'] == 'last7') {
        echo 'selected=""';
    }
    ?>
 value="last7">Last 7 Days</option>
											<option <?php 
    if ($time['user_pref_time_predefined'] == 'last14') {
        echo 'selected=""';
    }
    ?>
 value="last14">Last 14 Days</option>
											<option <?php 
    if ($time['user_pref_time_predefined'] == 'last30') {
        echo 'selected=""';
    }
    ?>
 value="last30">Last 30 Days</option>
											<option <?php 
    if ($time['user_pref_time_predefined'] == 'thismonth') {
        echo 'selected=""';
    }
    ?>
 value="thismonth">This Month</option>
											<option <?php 
    if ($time['user_pref_time_predefined'] == 'lastmonth') {
        echo 'selected=""';
    }
    ?>
 value="lastmonth">Last Month</option>
											<option <?php 
    if ($time['user_pref_time_predefined'] == 'thisyear') {
        echo 'selected=""';
    }
    ?>
 value="thisyear">This Year</option>
											<option <?php 
    if ($time['user_pref_time_predefined'] == 'lastyear') {
        echo 'selected=""';
    }
    ?>
 value="lastyear">Last Year</option>
											<option <?php 
    if ($time['user_pref_time_predefined'] == 'alltime') {
        echo 'selected=""';
    }
    ?>
 value="alltime">All Time</option>
										</select></td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
				<td class="s-top-right"/>
			</tr>
		</table>
	   
	   <div class="s-bottom" >
	   <?php 
    if ($navigation[1] == 'tracking202') {
        ?>
			<div id="s-main" <?php 
        if ($show_adv == false) {
            echo 'style="display:none;"';
        }
        ?>
>
				<table class="s-table" cellspacing="0" cellpadding="0">
					<tr>
						<td >
							<table cellspacing="0" cellpadding="0" class="s-table-left">
								<tr>
									<td>PPC Network/Account</td>
									<td><img id="ppc_network_id_div_loading" style="display: none;" src="/202-img/loader-small.gif"/><div id="ppc_network_id_div"></div></td>
									<td class="s-td-slim"><img id="ppc_account_id_div_loading" style="display: none;" src="/202-img/loader-small.gif"/><div id="ppc_account_id_div"></div></td> 
								</tr>
							</table>
						</td>
						<td>
							<table cellspacing="0" cellpadding="0" class="s-table-right">
								<tr>
									<td>Keyword</td>
									<td><input name="keyword" id="keyword" type="text" value="<?php 
        echo $html['keyword'];
        ?>
"/></td> 
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td>
							 <table cellspacing="0" cellpadding="0" class="s-table-left">
								<tr>
									<td>Aff Network/Campaign</td>
									<td><img id="aff_network_id_div_loading" style="display: none;" src="/202-img/loader-small.gif"/><div id="aff_network_id_div" ></div></td>
									<td class="s-td-slim"><img id="aff_campaign_id_div_loading" style="display: none;" src="/202-img/loader-small.gif"/><div id="aff_campaign_id_div"></div></td>
								</tr>
							</table>
						</td>
						<td >
							<table cellspacing="0" cellpadding="0" class="s-table-right">
								<tr>
									<td>Visitor IP</td>
									<td><input name="ip" id="ip" type="text" value="<?php 
        echo $html['ip'];
        ?>
"/> </td> 
								</tr>
							</table>
						</td>  
					</tr>
				</table>
			</div>
			
			<div class="s-adv" id="s-adv" style="<?php 
        if ($user_row['user_pref_adv'] != '1' or $show_adv == false) {
            echo 'display: none;';
        }
        ?>
">
				<div class="s-border" <?php 
        if ($show_adv == false) {
            echo 'style="display:none;"';
        }
        ?>
></div>
				<table class="s-table" cellspacing="0" cellpadding="0">
					<tr>
						<td>
							<table cellspacing="0" cellpadding="0" class="s-table-left">
								<tr>
									<td>Text Ad</td>
									<td><img id="text_ad_id_div_loading" style="display: none;" src="/202-img/loader-small.gif"/><div id="text_ad_id_div"></div></td>
								</tr>
							</table>
						</td>
						<td rowspan="3"><img id="ad_preview_div_loading" style="display: none;" src="/202-img/loader-small.gif"/><div id="ad_preview_div"></div></td>
						
					</tr>
					<tr>
						<td>
							<table cellspacing="0" cellpadding="0" class="s-table-left">
								<tr>
									<td>Method of Promotion</td>
									<td><img id="method_of_promotion_div_loading" style="display: none;" src="/202-img/loader-small.gif"/><div id="method_of_promotion_div" style="display: none;"></div></td>
								</tr>
							</table>
						</td>
						<td>
							<table cellspacing="0" cellpadding="0" class="s-table-right">
								<tr>
									<td>Country</td>
									<td><input name="country" id="country" readonly="readonly" type="text" value="<?php 
        echo $html['country'];
        ?>
"/> </td> 
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td>
							<table cellspacing="0" cellpadding="0" class="s-table-left">
								<tr>
									<td>Landing Page</td>
									<td>
										<img id="landing_page_div_loading" style="display: none;" src="/202-img/loader-small.gif"/>
										<div id="landing_page_div" style="display: none;"></div>
									</td>
								</tr>
							</table>
						</td>
						<td>
							<table cellspacing="0" cellpadding="0" class="s-table-right">
								<tr>
									<td>Referer</td>
									<td><input name="referer" id="referer" type="text" value="<?php 
        echo $html['referer'];
        ?>
"/> </td> 
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</div>
			
		<?php 
    }
    ?>
		<?php 
    if ($show_adv_breakdown == true) {
        ?>
			<div class="s-adv" id="s-adv" style="<?php 
        if ($show_adv_breakdown == false) {
            echo 'display: none;';
        }
        ?>
">
				<div class="s-border" <?php 
        if ($show_adv_breakdown == false) {
            echo 'style="display:none;"';
        }
        ?>
></div>
				<table class="s-table" cellspacing="0" cellpadding="0">
					<tr>
						<td>
							<table cellspacing="0" cellpadding="0" class="s-table-left">
								<tr>
									<td>
										<span>Group By </span>
										<select name="details[]">
											<?php 
        foreach (ReportSummaryForm::getDetailArray() as $detail_item) {
            ?>
												<option value="<?php 
            echo $detail_item;
            ?>
" <?php 
            echo $html['user_pref_group_1'] == $detail_item ? 'selected="selected"' : '';
            ?>
><?php 
            echo ReportBasicForm::translateDetailLevelById($detail_item);
            ?>
</option>
											<?php 
        }
        ?>
										</select>
									</td>
									<td>
										<span>Then Group By</span>
										<select name="details[]">
											<option value="<?php 
        echo ReportBasicForm::DETAIL_LEVEL_NONE;
        ?>
" <?php 
        echo $html['user_pref_group_1'] == ReportBasicForm::DETAIL_LEVEL_NONE ? 'selected="selected"' : '';
        ?>
><?php 
        echo ReportBasicForm::translateDetailLevelById(ReportBasicForm::DETAIL_LEVEL_NONE);
        ?>
</option>
											<?php 
        foreach (ReportSummaryForm::getDetailArray() as $detail_item) {
            ?>
												<option value="<?php 
            echo $detail_item;
            ?>
" <?php 
            echo $html['user_pref_group_2'] == $detail_item ? 'selected="selected"' : '';
            ?>
><?php 
            echo ReportBasicForm::translateDetailLevelById($detail_item);
            ?>
</option>
											<?php 
        }
        ?>
										</select>
									</td>
									<td>
										<span>Then Group By</span>
										<select name="details[]">
											<option value="<?php 
        echo ReportBasicForm::DETAIL_LEVEL_NONE;
        ?>
" <?php 
        echo $html['user_pref_group_1'] == ReportBasicForm::DETAIL_LEVEL_NONE ? 'selected="selected"' : '';
        ?>
><?php 
        echo ReportBasicForm::translateDetailLevelById(ReportBasicForm::DETAIL_LEVEL_NONE);
        ?>
</option>
											<?php 
        foreach (ReportSummaryForm::getDetailArray() as $detail_item) {
            ?>
												<option value="<?php 
            echo $detail_item;
            ?>
" <?php 
            echo $html['user_pref_group_3'] == $detail_item ? 'selected="selected"' : '';
            ?>
><?php 
            echo ReportBasicForm::translateDetailLevelById($detail_item);
            ?>
</option>
											<?php 
        }
        ?>
										</select>
									</td>
									<td>
										<span>Then Group By</span>
										<select name="details[]">
											<option value="<?php 
        echo ReportBasicForm::DETAIL_LEVEL_NONE;
        ?>
" <?php 
        echo $html['user_pref_group_1'] == ReportBasicForm::DETAIL_LEVEL_NONE ? 'selected="selected"' : '';
        ?>
><?php 
        echo ReportBasicForm::translateDetailLevelById(ReportBasicForm::DETAIL_LEVEL_NONE);
        ?>
</option>
											<?php 
        foreach (ReportBasicForm::getDetailArray() as $detail_item) {
            ?>
												<option value="<?php 
            echo $detail_item;
            ?>
" <?php 
            echo $html['user_pref_group_4'] == $detail_item ? 'selected="selected"' : '';
            ?>
><?php 
            echo ReportBasicForm::translateDetailLevelById($detail_item);
            ?>
</option>
											<?php 
        }
        ?>
										</select>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td>
							<table cellspacing="0" cellpadding="0" class="s-table-left">
								<tr>
									
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</div>
		<?php 
    }
    ?>
			<div class="s-adv">
				<div class="s-border" <?php 
    if ($show_adv == false) {
        echo 'style="display:none;"';
    }
    ?>
></div>
				<table class="s-table" cellspacing="0" cellpadding="0">
					 <tr>
						<td>
							<table cellspacing="0" cellpadding="0" class="s-table-left" <?php 
    if ($show_bottom == false) {
        echo 'style="display:none;"';
    }
    ?>
>
								<tr>
									<td>Display</td>
									<td>
										<select name="user_pref_limit" <?php 
    if ($show_limit == false) {
        echo 'style="display:none;"';
    }
    ?>
>
											<option <?php 
    if ($user_row['user_pref_limit'] == '10') {
        echo 'SELECTED';
    }
    ?>
 value="10">10</option>
											<option <?php 
    if ($user_row['user_pref_limit'] == '25') {
        echo 'SELECTED';
    }
    ?>
 value="25">25</option>
											<option <?php 
    if ($user_row['user_pref_limit'] == '50') {
        echo 'SELECTED';
    }
    ?>
 value="50">50</option>
											<option <?php 
    if ($user_row['user_pref_limit'] == '75') {
        echo 'SELECTED';
    }
    ?>
 value="75">75</option> 
											<option <?php 
    if ($user_row['user_pref_limit'] == '100') {
        echo 'SELECTED';
    }
    ?>
 value="100">100</option>
											<option <?php 
    if ($user_row['user_pref_limit'] == '150') {
        echo 'SELECTED';
    }
    ?>
 value="150">150</option>
											<option <?php 
    if ($user_row['user_pref_limit'] == '200') {
        echo 'SELECTED';
    }
    ?>
 value="200">200</option>
										</select>
									</td>
									<td>
										<select name="user_pref_breakdown" <?php 
    if ($show_breakdown == false) {
        echo 'style="display:none;"';
    }
    ?>
>
											<option <?php 
    if ($user_row['user_pref_breakdown'] == 'hour') {
        echo 'SELECTED';
    }
    ?>
 value="hour">By Hour</option>
											<option <?php 
    if ($user_row['user_pref_breakdown'] == 'day') {
        echo 'SELECTED';
    }
    ?>
 value="day">By Day</option>
											<option <?php 
    if ($user_row['user_pref_breakdown'] == 'month') {
        echo 'SELECTED';
    }
    ?>
 value="month">By Month</option>  
											<option <?php 
    if ($user_row['user_pref_breakdown'] == 'year') {
        echo 'SELECTED';
    }
    ?>
 value="year">By Year</option>  
										</select>
									</td>
									<td>
										<select name="user_pref_chart" <?php 
    if ($show_breakdown == false) {
        echo 'style="display:none;"';
    }
    ?>
>
											<option <?php 
    if ($user_row['user_pref_chart'] == 'profitloss') {
        echo 'SELECTED';
    }
    ?>
 value="profitloss">Profit Loss Bar Graph</option>
											<option <?php 
    if ($user_row['user_pref_chart'] == 'clicks') {
        echo 'SELECTED';
    }
    ?>
 value="clicks">Clicks Line Graph</option>
											<option <?php 
    if ($user_row['user_pref_chart'] == 'leads') {
        echo 'SELECTED';
    }
    ?>
 value="leads">Leads Line Graph</option>
											<option <?php 
    if ($user_row['user_pref_chart'] == 'su_ratio') {
        echo 'SELECTED';
    }
    ?>
 value="su_ratio">S/U Ratio Line Graph</option>
											<option <?php 
    if ($user_row['user_pref_chart'] == 'payout') {
        echo 'SELECTED';
    }
    ?>
 value="payout">Payout Line Graph</option>
											<option <?php 
    if ($user_row['user_pref_chart'] == 'epc') {
        echo 'SELECTED';
    }
    ?>
 value="epc">EPC Line Graph</option>
											<option <?php 
    if ($user_row['user_pref_chart'] == 'cpc') {
        echo 'SELECTED';
    }
    ?>
 value="cpc">Avg CPC Line Graph</option>
											<option <?php 
    if ($user_row['user_pref_chart'] == 'income') {
        echo 'SELECTED';
    }
    ?>
 value="income">Income Line Graph</option>
											<option <?php 
    if ($user_row['user_pref_chart'] == 'cost') {
        echo 'SELECTED';
    }
    ?>
 value="cost">Cost Line Graph</option>
											<option <?php 
    if ($user_row['user_pref_chart'] == 'net') {
        echo 'SELECTED';
    }
    ?>
 value="net">Net Line Graph</option>
											<option <?php 
    if ($user_row['user_pref_chart'] == 'roi') {
        echo 'SELECTED';
    }
    ?>
 value="roi">ROI Line Graph</option> 
										</select>
									</td>
									<td>
										<select name="user_pref_show" <?php 
    if ($show_type == false) {
        echo 'style="display:none;"';
    }
    ?>
>
											<option <?php 
    if ($user_row['user_pref_show'] == 'all') {
        echo 'SELECTED';
    }
    ?>
 value="all">Show All Clicks</option>
											<option <?php 
    if ($user_row['user_pref_show'] == 'real') {
        echo 'SELECTED';
    }
    ?>
 value="real">Show Real Clicks</option>
											<option <?php 
    if ($user_row['user_pref_show'] == 'filtered') {
        echo 'SELECTED';
    }
    ?>
 value="filtered">Show Filtered Out Clicks</option>
											<option <?php 
    if ($user_row['user_pref_show'] == 'leads') {
        echo 'SELECTED';
    }
    ?>
 value="leads">Show Converted Clicks</option>
										</select>
									</td>
									<td class="s-td-slim">
										<select name="user_cpc_or_cpv" <?php 
    if ($show_cpc_or_cpv == false) {
        echo 'style="display:none;"';
    }
    ?>
>
											<option <?php 
    if ($user_row['user_cpc_or_cpv'] == 'cpc') {
        echo 'SELECTED';
    }
    ?>
 value="cpc">CPC Costs</option>
											<option <?php 
    if ($user_row['user_cpc_or_cpv'] == 'cpv') {
        echo 'SELECTED';
    }
    ?>
 value="cpv">CPV Costs</option>
										</select>
									</td>
								</tr>
							</table>
						</td>
						<td>
							<table cellspacing="0" cellpadding="0" class="s-table-right">
								<tr>
									<!-- This first is so the ENTER is defaulted to the first submit -->
									<td id="s-status-loading" style="display:none;"><img src="/202-img/loader-small.gif"/></td>
									<td style="display: none;"><input type="submit" id="s-search" class="s-submit s-submit1" onclick="set_user_prefs('<?php 
    echo $html['page'];
    ?>
');" value="Save User Preferences"/></td>
									<td><button id="s-toogleAdv" class="s-submit s-submit2" onclick="toggleAdvanced();" <?php 
    if ($show_adv == false) {
        echo 'style="display:none;"';
    }
    ?>
><?php 
    if ($user_row['user_pref_adv'] != '1') {
        echo 'More Options';
    } else {
        echo 'Less Options';
    }
    ?>
									<td><input type="submit" id="s-search" class="s-submit s-submit1" onclick="set_user_prefs('<?php 
    echo $html['page'];
    ?>
');" value="Set Preferences"/></td>
								</tr>
							</table>
						</td>
					</tr>
				</table>   
			</div>
	   </div>
	   <div id="s-status"></div>  
   </form>
   
   <div id="m-content"></div>                                
   
   <script type="text/javascript">
		
		/* TIME SETTING FUNCTION */ 
		function set_user_pref_time_predefined() {
			
			$('to_cal').style.display='none'; 
			$('from_cal').style.display='none';
	
			if($('user_pref_time_predefined').options[$('user_pref_time_predefined').selectedIndex].value == 'today') {
				<?php 
    $time['from'] = mktime(0, 0, 0, date('m', time()), date('d', time()), date('Y', time()));
    $time['to'] = mktime(23, 59, 59, date('m', time()), date('d', time()), date('Y', time()));
    ?>
				
				//now set the from and to dates
				$('from').value='<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
';
				$('to').value='<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
';  
				
				//now set the calendar dates too
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['from']), date('n', $time['from']), date('j', $time['from']));
    ?>
);
				from_cal.setCurrentDate(d);
				
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['to']), date('n', $time['to']), date('j', $time['to']));
    ?>
);
				to_cal.setCurrentDate(d);
			}
			
			if($('user_pref_time_predefined').options[$('user_pref_time_predefined').selectedIndex].value == 'yesterday') {
				<?php 
    $time['from'] = mktime(0, 0, 0, date('m', time() - 86400), date('d', time() - 86400), date('Y', time() - 86400));
    $time['to'] = mktime(23, 59, 59, date('m', time() - 86400), date('d', time() - 86400), date('Y', time() - 86400));
    ?>
				
				//now set the from and to dates
				$('from').value='<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
';
				$('to').value='<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
';  
				
				//now set the calendar dates too
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['from']), date('n', $time['from']), date('j', $time['from']));
    ?>
);
				from_cal.setCurrentDate(d);
				
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['to']), date('n', $time['to']), date('j', $time['to']));
    ?>
);
				to_cal.setCurrentDate(d);
			}
			
			if($('user_pref_time_predefined').options[$('user_pref_time_predefined').selectedIndex].value == 'last7') {
				<?php 
    $time['from'] = mktime(0, 0, 0, date('m', time() - 86400 * 7), date('d', time() - 86400 * 7), date('Y', time() - 86400 * 7));
    $time['to'] = mktime(23, 59, 59, date('m', time()), date('d', time()), date('Y', time()));
    ?>
				
				//now set the from and to dates
				$('from').value='<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
';
				$('to').value='<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
';  
				
				//now set the calendar dates too
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['from']), date('n', $time['from']), date('j', $time['from']));
    ?>
);
				from_cal.setCurrentDate(d);
				
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['to']), date('n', $time['to']), date('j', $time['to']));
    ?>
);
				to_cal.setCurrentDate(d);
			}
			
			if($('user_pref_time_predefined').options[$('user_pref_time_predefined').selectedIndex].value == 'last14') {
				<?php 
    $time['from'] = mktime(0, 0, 0, date('m', time() - 86400 * 14), date('d', time() - 86400 * 14), date('Y', time() - 86400 * 14));
    $time['to'] = mktime(23, 59, 59, date('m', time()), date('d', time()), date('Y', time()));
    ?>
				
				//now set the from and to dates
				$('from').value='<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
';
				$('to').value='<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
';  
				
				//now set the calendar dates too
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['from']), date('n', $time['from']), date('j', $time['from']));
    ?>
);
				from_cal.setCurrentDate(d);
				
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['to']), date('n', $time['to']), date('j', $time['to']));
    ?>
);
				to_cal.setCurrentDate(d);
			}
			
			if($('user_pref_time_predefined').options[$('user_pref_time_predefined').selectedIndex].value == 'last30') {
				<?php 
    $time['from'] = mktime(0, 0, 0, date('m', time() - 86400 * 30), date('d', time() - 86400 * 30), date('Y', time() - 86400 * 30));
    $time['to'] = mktime(23, 59, 59, date('m', time()), date('d', time()), date('Y', time()));
    ?>
				
				//now set the from and to dates
				$('from').value='<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
';
				$('to').value='<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
';  
				
				//now set the calendar dates too
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['from']), date('n', $time['from']), date('j', $time['from']));
    ?>
);
				from_cal.setCurrentDate(d);
				
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['to']), date('n', $time['to']), date('j', $time['to']));
    ?>
);
				to_cal.setCurrentDate(d);
			}
			
			if($('user_pref_time_predefined').options[$('user_pref_time_predefined').selectedIndex].value == 'thismonth') {
				<?php 
    $time['from'] = mktime(0, 0, 0, date('m', time()), 1, date('Y', time()));
    $time['to'] = mktime(23, 59, 59, date('m', time()), date('d', time()), date('Y', time()));
    ?>
				
				//now set the from and to dates
				$('from').value='<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
';
				$('to').value='<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
';  
				
				//now set the calendar dates too
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['from']), date('n', $time['from']), date('j', $time['from']));
    ?>
);
				from_cal.setCurrentDate(d);
				
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['to']), date('n', $time['to']), date('j', $time['to']));
    ?>
);
				to_cal.setCurrentDate(d);
			}
	
			if($('user_pref_time_predefined').options[$('user_pref_time_predefined').selectedIndex].value == 'lastmonth') {
				<?php 
    $time['from'] = mktime(0, 0, 0, date('m', time() - 2629743), 1, date('Y', time() - 2629743));
    $time['to'] = mktime(23, 59, 59, date('m', time() - 2629743), getLastDayOfMonth(date('m', time() - 2629743), date('Y', time() - 2629743)), date('Y', time() - 2629743));
    ?>
				
				//now set the from and to dates
				$('from').value='<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
';
				$('to').value='<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
';  
				
				//now set the calendar dates too
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['from']), date('n', $time['from']), date('j', $time['from']));
    ?>
);
				from_cal.setCurrentDate(d);
				
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['to']), date('n', $time['to']), date('j', $time['to']));
    ?>
);
				to_cal.setCurrentDate(d);
			}
			
			if($('user_pref_time_predefined').options[$('user_pref_time_predefined').selectedIndex].value == 'thisyear') {
				<?php 
    $time['from'] = mktime(0, 0, 0, 1, 1, date('Y', time()));
    $time['to'] = mktime(23, 59, 59, date('m', time()), date('d', time()), date('Y', time()));
    ?>
				
				//now set the from and to dates
				$('from').value='<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
';
				$('to').value='<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
';  
				
				//now set the calendar dates too
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['from']), date('n', $time['from']), date('j', $time['from']));
    ?>
);
				from_cal.setCurrentDate(d);
				
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['to']), date('n', $time['to']), date('j', $time['to']));
    ?>
);
				to_cal.setCurrentDate(d);
			}
			
			if($('user_pref_time_predefined').options[$('user_pref_time_predefined').selectedIndex].value == 'lastyear') {
				<?php 
    $time['from'] = mktime(0, 0, 0, 1, 1, date('Y', time() - 31556926));
    $time['to'] = mktime(0, 0, 0, 12, getLastDayOfMonth(date('m', time() - 31556926), date('Y', time() - 31556926)), date('Y', time() - 31556926));
    ?>
				
				//now set the from and to dates
				$('from').value='<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
';
				$('to').value='<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
';  
				
				//now set the calendar dates too
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['from']), date('n', $time['from']), date('j', $time['from']));
    ?>
);
				from_cal.setCurrentDate(d);
				
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['to']), date('n', $time['to']), date('j', $time['to']));
    ?>
);
				to_cal.setCurrentDate(d);
			}
			
			if($('user_pref_time_predefined').options[$('user_pref_time_predefined').selectedIndex].value == 'alltime') {
				<?php 
    //for the time from, do something special select the exact date this user was registered and use that :)
    $mysql['user_id'] = mysql_real_escape_string($_SESSION['user_id']);
    $user_sql = "SELECT user_time_register FROM 202_users WHERE user_id='" . $mysql['user_id'] . "'";
    $user_result = mysql_query($user_sql) or record_mysql_error($user_sql);
    $user_row = mysql_fetch_assoc($user_result);
    $time['from'] = $user_row['user_time_register'];
    $time['from'] = mktime(0, 0, 0, date('m', $time['from']), date('d', $time['from']), date('Y', $time['from']));
    $time['to'] = mktime(23, 59, 59, date('m', time()), date('d', time()), date('Y', time()));
    ?>
		
				//now set the from and to dates
				$('from').value='<?php 
    echo date('m/d/y - G:i', $time['from']);
    ?>
';
				$('to').value='<?php 
    echo date('m/d/y - G:i', $time['to']);
    ?>
';  
				
				//now set the calendar dates too
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['from']), date('n', $time['from']), date('j', $time['from']));
    ?>
);
				from_cal.setCurrentDate(d);
				
				var d = new Date(<?php 
    printf('%s, %s, %s', date('Y', $time['to']), date('n', $time['to']), date('j', $time['to']));
    ?>
);
				to_cal.setCurrentDate(d);
			}
			
			//bump the date down for some reason it keeps adding ONE MONTH?!?!?!?!
			from_cal.setCurrentDate('monthdown');
			to_cal.setCurrentDate('monthdown');
			
		}
	
		/* TOGGLE FUNCTION */
		function toggleAdvanced() { 
			
			$('to_cal').style.display='none'; 
			$('from_cal').style.display='none';
			
			Effect.toggle('s-adv','blind');
			if ($('text_ad_id')) {  $('text_ad_id').selectedIndex = 0;  } 
			if ($('method_of_promotion')) {  $('method_of_promotion').selectedIndex = 0;  } 
			if ($('landing_page_id')) {  $('landing_page_id').selectedIndex = 0;  } 
			$('ad_preview_div').style.display = 'none';
			$('country').value = '';
			$('referer').value = '';
			
			if($('s-adv').style.display == 'none') { 
				$('user_pref_adv').value = '1';
				$('s-toogleAdv').innerHTML = 'Less Options';
			} else {
				$('user_pref_adv').value = '';
				$('s-toogleAdv').innerHTML = 'More Options';
			}
			
			<?php 
    /*set_user_prefs('<? echo $html['page']; ?>'); */
    ?>
		}
		
		/* SHOW FIELDS */        

		load_ppc_network_id('<?php 
    echo $html['user_pref_ppc_network_id'];
    ?>
');
		<?php 
    if ($html['user_pref_ppc_account_id'] != '') {
        ?>
			load_ppc_account_id('<?php 
        echo $html['user_pref_ppc_network_id'];
        ?>
','<?php 
        echo $html['user_pref_ppc_account_id'];
        ?>
');      
		<?php 
    }
    ?>
		
		load_aff_network_id('<?php 
    echo $html['user_pref_aff_network_id'];
    ?>
');
		<?php 
    if ($html['user_pref_aff_campaign_id'] != '') {
        ?>
			load_aff_campaign_id('<?php 
        echo $html['user_pref_aff_network_id'];
        ?>
','<?php 
        echo $html['user_pref_aff_campaign_id'];
        ?>
');
		<?php 
    }
    ?>
		
		<?php 
    if ($html['user_pref_text_ad_id'] != '') {
        ?>
			load_text_ad_id('<?php 
        echo $html['user_pref_aff_campaign_id'];
        ?>
','<?php 
        echo $html['user_pref_text_ad_id'];
        ?>
');
			load_ad_preview('<?php 
        echo $html['user_pref_text_ad_id'];
        ?>
'); 
		<?php 
    }
    ?>
		
		load_method_of_promotion('<?php 
    echo $html['user_pref_method_of_promotion'];
    ?>
');
		
		<?php 
    if ($html['user_pref_landing_page_id'] != '') {
        ?>
			load_landing_page('<?php 
        echo $html['user_pref_aff_campaign_id'];
        ?>
', '<?php 
        echo $html['user_pref_landing_page_id'];
        ?>
', '<?php 
        echo $html['user_pref_method_of_promotion'];
        ?>
');
		<?php 
    }
    ?>

   </script> 
<?php 
}