<?php
//change 'curve' and 'mobile' to the names of your themes.
if ($CONFIG['theme'] == 'curve') {
	//add as many as you need they don't have to all exist or be in order. make the $key the cat number and the $value whatever the ad code is.
	$cat_ad_code_array = array(
		'3' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_3_code">{Ad code goes here cat 3}</div>',
		'4' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_4_code">{Ad code goes here cat 4}</div>',
		'8' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_8_code">{Ad code goes here cat 8}</div>',
		'9' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_9_code">{Ad code goes here cat 9}</div>',
		'1' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_9_code">{Ad code goes here cat 1}</div>',
	);
	$standard_ad_code = '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="standard_ad_code">{Ad code goes here standard}</div>';
} elseif ($CONFIG['theme'] == 'mobile') {
	//add as many as you need they don't have to all exist or be in order. make the $key the cat number and the $value whatever the ad code is.
	$cat_ad_code_array = array(
		'3' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_3_code">{Mobile ad code goes here cat 3}</div>',
		'4' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_4_code">{Mobile ad code goes here cat 4}</div>',
		'8' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_8_code">{Mobile ad code goes here cat 8}</div>',
		'9' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_9_code">{Mobile ad code goes here cat 9}</div>',
		'1' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_9_code">{Mobile ad code goes here cat 1}</div>',
	);
	$standard_ad_code = '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="standard_ad_code">{Ad code goes here standard}</div>';
} else { //keep this so users can't turn off ads by changing the theme.
	//add as many as you need they don't have to all exist or be in order. make the $key the cat number and the $value whatever the ad code is.
	$cat_ad_code_array = array(
		'3' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_3_code">{Ad code goes here cat 3}</div>',
		'4' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_4_code">{Ad code goes here cat 4}</div>',
		'8' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_8_code">{Ad code goes here cat 8}</div>',
		'9' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_9_code">{Ad code goes here cat 9}</div>',
		'1' => '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="cat_9_code">{Ad code goes here cat 1}</div>',
	);
	$standard_ad_code = '<div style="text-align:center;padding-bottom:5px;padding-top:5px;" id="standard_ad_code">{Ad code goes here standard}</div>';
}

//Don't change anything below this line unless you find a bug or want to change the way it functions.

$superCage = Inspekt::makeSuperCage();
if ($superCage->get->keyExists('cat')) {
	if (array_key_exists($superCage->get->getInt('cat'), $cat_ad_code_array)) {
		echo $cat_ad_code_array[$superCage->get->getInt('cat')];
	} else {
		echo $standard_ad_code;
	}
} elseif ($superCage->get->keyExists('album')) {
	$result = cpg_db_query("SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = ".$superCage->get->getInt('album'));
	$ad_cat_row = mysql_fetch_row($result);
	$ad_cat = $ad_cat_row[0];
	mysql_free_result($result);
	if (array_key_exists($ad_cat, $cat_ad_code_array)) {
		echo $cat_ad_code_array[$ad_cat];
	} else {
		echo $standard_ad_code;
	}
} else {
	echo $standard_ad_code;
}
?>