<?php
$show_init_form = false;	/* To display or not the initialization form */

/* Try to see if the call is from administration panel */
if(isset($admin_catdom_module_id) && $admin_catdom_module_id>0 && isset($_GET['action']) && $_GET['action'] == "custom_module") {
	$show_init_form = true;

	
	
	$main_article_link_title = "";
	$current_catdom_module_id = $admin_catdom_module_id;

}

if($show_init_form) {

	// Try to get any previously saved customization
	if(isset($module_params) && is_array($module_params)) {
		foreach ($module_params as $key=>$value) {
			${$key} = $value;
		}
	}
	?>
	<div class="inline_container">
	<form method="POST" action="custom_module_update.php" name="main_article_link_frm" id="main_article_link_frm">
		<table cellpadding="0" cellspacing="0" border="0" width="100%">
			<tr>
				<th colspan="2" align="left">
					Main Category Link Settings
				</th>
			</tr>
			<tr>
				<td nowrap class="itdh">Link Title</td>
				<td class="itd">
					<input type="text" name="main_article_link_title" id="main_article_link_title" value="<?php echo $main_article_link_title;?>" size="30" maxlength="255" style="width:100%;">
				</td>
			</tr>
			<tr>
				<td colspan="2" align="right" class="footer">
					<input type="reset" value="Reset" name="submit" class="submit_button"/>
					<input type="submit" value="Save" name="submit" class="submit_button"/>
					<input type="hidden" value="<?php echo $current_catdom_module_id; ?>" name="admin_catdom_module_id" id="admin_catdom_module_id"/>
				</td>
			</tr>
		</table>
	</form>
	</div>
	<script type="text/javascript">
		//initTree();
	</script>
	<?php
	
	$module_forms = array(
		"form_name" => "main_article_link_frm",
		"form_action" => "",
		"form_method" => "POST"
	);
}
else {
	// We are in the front-end
	// Initialize defaults
	$main_article_link_title = "";
	$middle_parent_id = isset($middle_parent_id) && intval($middle_parent_id) > 0 ? $middle_parent_id : 0;
	
	// Try to get any customization done
	if(isset($module_params) && is_array($module_params)) {
		foreach ($module_params as $key=>$value) {
			${$key} = $value;
		}
	}
}
?>
