<?
/*
**	Filename:	index.php
**	Date:		3/27/2005
**	Author:		Troy Lutton
**	Purpose:	A page to allow the administrator to manage users
*/

/////////////////////////////////////////////////////////////////////////////////////

// GET THE LOCAL CONFIG FILE
require_once("config.inc.php");

// AUTHENTICATE THIS USERS DETAILS
require_once("authentication.class.php");

// RUN AN AUTHORIZATION CHECK (SEND ACCESS LEVEL OF THIS PAGE)
$authorization = new Authentication(GENERAL_ACCESS);

// GET THE MENU BUILDER CLASS
require_once("menu_builder.class.php");

// GET THE MENU ARRAY OBJECT
require_once("menu.inc.php");

// GET THE TEMPLATING CLASS
require_once("template.class.php");

// GENERATE THE ADMIN MENU - (NULL IS NO SYSTEMS)
$menu_builder = new Admin_Menu_Builder($my_menu, $_SESSION['reg_sys'], $_SESSION['priv_level']);

// GET THE ADMIN MENU
$admin_menu = $menu_builder->get_menu();

// INSTANTIATE THE TEMPLATE CLASS WITH A TEMPLATE
$template = new Template_Builder((ADMIN_TEMPLATES_DIR . "admin_template.html"));

/////////////////////////////////////////////////////////////////////////////////////


// get the signatures class
require_once("properties.class.php");

// instantiate the class
$props = new Property_Manager(DB_USERNAME, DB_PASSWORD, DB_SERVER, PROPERTIES_DB);

// DECLARE VARS
$display = NULL;
$action = NULL;
$content = NULL;
$outcome_msg = NULL;
$jscript_1 = RESORTS_JSCRIPT_FILE . RESORTS_STYLE;
$jscript_2 = NULL;
$images_url = RESORT_IMAGES_URL;

$type_id = NULL;
$region_id = NULL;
$country_id = NULL;
$property_id = NULL;
$hidden_vars = NULL;

$property_content = NULL;
$apartment_content = NULL;


// CATCH GETVARS
if (isset($_GET['action'])){$action = $_GET['action'];}
if (isset($_GET['display'])){$display = $_GET['display'];}
if (isset($_GET['property_id'])){$property_id = $_GET['property_id'];}
if (isset($_GET['online_status'])){$online_status = $_GET['online_status'];}

if (isset($_POST['action'])){$action = $_POST['action'];}
if (isset($_POST['display'])){$display = $_POST['display'];}
if (isset($_POST['property_id'])){$property_id = $_POST['property_id'];}



// SWITCH ON ACTION
switch($action)
{
	// add a new property
	case "add_property":
	{		
		// add the property
		$props->add_property($_POST);

		// show any output
		$outcome_msg = $props->get_messages();

		break;
	}

	// remove a property
	case "remove_property":
	{		
		// add the property
		$props->remove_property($_POST);

		// show any output
		$outcome_msg = $props->get_messages();

		break;
	}

	// update a properties details
	case "update_property":
	{		
		// add the property
		$props->update_property_details($_POST);

		// show any output
		$outcome_msg = $props->get_messages();

		break;
	}

	// adds a new gallery entry
	case "add_gallery":
	{
		// create physical folder * 2
		// add gallery entry
		// update properties with gallery id
		$props->add_gallery_folder($_POST);

		// show any output
		$outcome_msg = $props->get_messages();

		break;
	}

	// adds a new gallery entry
	case "toggle_status":
	{
		// set the property as online
		$props->toggle_online_status($online_status, $property_id);

		// show any output
		$outcome_msg = $props->get_messages();

		break;
	}

	case "remove_image":
	{
		//delete the gallery image
		$props->remove_gallery_image($_GET);

		$outcome_msg = $props->get_messages();			
	}
}


// SWITCH ON DISPLAY
switch($display)
{
	// case to add image galleries to the property
	case "edit_galleries":
	{
		// add a title
		$content .= "<table cellpadding='0' cellpadding='5'><tr><td><img src='{$images_url}photo_large.gif'></td><td><h4 class='no_break'> &nbsp; Editing Image Galleries</h4></td></tr></table>";

		// get it
		$property_name = $props->get_property_name($property_id);
		
		// get the [roperty name and display it
		$content .= "<p><li>Currently editing the image galleries for '<strong>$property_name</strong>'</li></p>";

		// get the gallery info for this property [property_gal_id][apartment_gal_id]
		$property_gallery = $props->get_gallery_images('property', $property_id);

		// get the gallery info for this property [property_gal_id][apartment_gal_id]
		$apartment_gallery = $props->get_gallery_images('apartment', $property_id);

		///////////////////////////////////////////////////////////////////////////////////////////
		
		// see if there was any images
		if (!is_null($property_gallery))
		{
			// temp - replace
			$img_order_list = "<select><option>00</option><option>2</option></select>";

			// build and format the property gallery
			$property_content .= $props->build_gallery_upload_table($property_gallery, RES_NUM_IMGS, BASE_RESORTS_DIR, 'resort', $images_url, ADMIN_GALLERY_BASE_URL, $img_order_list);
		}
		else
		{
			// get the suggested gallery folder name
			$suggested_name = $props->get_suggested_folder_name($property_id, "property");

			// there was no gallery found - show gallery creation info
			$property_content .= "
			<table class='gal_create_tbl'>
				<tr><td width='20'><img src='{$images_url}information.gif' width='16' height='16'></td><td>There is currently no property gallery for this property</td></tr>
				<tr><td width='20'><img src='{$images_url}information.gif' width='16' height='16'></td><td>A suggested gallery folder name has been placed below by default</td></tr>
			</table>				
			<form action='{$_SERVER['PHP_SELF']}' method='post' class='no_break'>
			<input type='hidden' name='display' value='edit_galleries'>
			<input type='hidden' name='property_id' value='$property_id'>
			<input type='hidden' name='action' value='add_gallery'>
			<input type='hidden' name='gal_type' value='property'>
			<table cellpadding='5' cellspacing='0' class='admin_tbl'>
				<tr>
					<td>Add Gallery Folder</td><td><input type='text' name='folder_path' size='50' value='$suggested_name'></td><td><input type='image' src='{$images_url}disk.gif' class='no_border'></td>
				</tr>
			</table>
			</form>";
		}

		///////////////////////////////////////////////////////////////////////////////////////////
		
		// see if there was any images
		if (!is_null($apartment_gallery))
		{
			// build and format the property gallery
			$apartment_content .= $props->build_gallery_upload_table($apartment_gallery, APART_NUM_IMGS, BASE_RESORTS_DIR, 'apartment', $images_url, ADMIN_GALLERY_BASE_URL, $img_order_list);
		}
		else
		{
			// get the suggested gallery folder name
			$suggested_name = $props->get_suggested_folder_name($property_id, "apartment");

			// there was no gallery found - show gallery creation info
			$apartment_content .= "
			<table class='gal_create_tbl'>
				<tr><td width='20'><img src='{$images_url}information.gif' width='16' height='16'></td><td>There is currently no apartment gallery for this property</td></tr>
				<tr><td width='20'><img src='{$images_url}information.gif' width='16' height='16'></td><td>A suggested gallery folder name has been placed below by default</td></tr>
			</table>				
			<form action='{$_SERVER['PHP_SELF']}' method='post' class='no_break'>
			<input type='hidden' name='display' value='edit_galleries'>
			<input type='hidden' name='property_id' value='$property_id'>		
			<input type='hidden' name='action' value='add_gallery'>
			<input type='hidden' name='gal_type' value='apartment'>
			<table cellpadding='5' cellspacing='0' class='admin_tbl'>
				<tr>
					<td>Add Gallery Folder</td><td><input type='text' name='folder_path' size='50' value='$suggested_name'></td><td><input type='image' src='{$images_url}disk.gif' class='no_border'></td>
				</tr>
			</table>
			</form>";
		}

		///////////////////////////////////////////////////////////////////////////////////////////

		// start the tabbed panes
		$content .= "
		<!-- contains dynamic content for the loaders -->
		<span id='dynamic_container'></span>		

		<table class='pane_parent' cellpadding='0'>			
		<tr>				
			<td valign='top'>
				<table cellpadding='0' cellspacing='0' class='pane_tabs'>
					<tr>
						<td class='pane_tab_on' id='tab:1'><a href=\"javascript:void(show_pane(1,2));\" class='pane_link_on' id='pane_link:1'>Property</a></td>
						<td class='pane_tab_off' id='tab:2'><a href=\"javascript:void(show_pane(2,2));\" class='pane_link_off' id='pane_link:2'>Apartment</a></td>	
						<td>&nbsp;</td>
					</tr>
					<tr class='tab_spacer'>
						<td><img src='/images/systems/resorts/tab_spacer.gif' width='100' height='5'></td>
						<td><img src='/images/systems/resorts/tab_spacer.gif' width='100' height='5'></td>
						<td width='100%'><img src='/images/systems/resorts/tab_spacer.gif' width='100%' height='5'></td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td valign='top' class='panel_cell'>	

			<!-- property galleries -->

			<div id='panel:1' class='primary_panel'>	
			<table class='img_gal_tbl'>
				<tr>
					<th class='panel_hdr'>Add & Remove Property Gallery Images</th>
				</tr>
				<tr>
					<th>$property_content</th>
				</tr>
			</table>
			</div>
		
			<!-- apartment galleries -->

			<div id='panel:2' class='pane_panel'>
			<table class='img_gal_tbl'>
				<tr>
					<th class='panel_hdr'>Add & Remove Apartment Gallery Images</th>
				</tr>
				<tr>
					<th align='center'>$apartment_content</th>
				</tr>
			</table>
			</div>

			</td>
		</tr>
		</table>";

		break;
	}


	// show the resort list
	default:
	{
		// add a title
		$content .= "<table cellpadding='0' cellpadding='5'><tr><td><img src='{$images_url}houses_large.gif'></td><td><h4 class='no_break'> &nbsp; Global Property List</h4></td></tr></table>";

		// put a link to add new resorts
		$content .= "<p><table cellpadding='5' cellspacing='0'><tr><td><a href='{$_SERVER['PHP_SELF']}?display=edit_property'><img src='{$images_url}add.gif' width='16' height='16' border='0'></a></td><td>Click to add a new property to the list.</td></tr></table></p>";

		// try to get all of the properties details
		$details = $props->get_property_list_info();		

		// show the lists
		$content .= $props->format_property_list($images_url, $details);

		// add the tables highlight
		$content .= "<script>tigra_tables('property_list', 1, 0, '" . HLIGHT_BG_1 . "', '" . HLIGHT_BG_2 . "', '" . HLIGHT_BG_SWAP. "', '" . HLIGHT_BG_CLICK. "');</script>";	

		// add the extra javascript for the tooltips
		$jscript_1 .= HLIGHT_JSCRIPT;

		break;
	}

	// show the resort list
	case "edit_property":
	{		
		/////////////////////////////////////////////////////////////////

		// IF ID IS NULL THEN ITS AN ADD - ELSE ITS AN EDIT
		if (!is_null($property_id))
		{
			// try to get the property details
			$details = $props->get_property_info($property_id);

			// change the action to update
			$action = "update_property";

			// assign the id details
			$type_id = $details['type_id'];
			$region_id = $details['region_id'];
			$country_id = $details['country_id'];

			// make the html safe for the editor
			$details['overview_html'] =  stripslashes($details['overview_html']);
			$details['location_html'] =  stripslashes($details['location_html']);
			$details['credits_html'] =  stripslashes($details['credits_html']);

			// add the extra hidden variables
			$hidden_vars = "
			<input name='property_id' type='hidden' value='{$details['property_id']}'>
			<input name='meta_id' type='hidden' value='{$details['meta_id']}'>
			<input name='demog_id' type='hidden' value='{$details['demog_id']}'>
			<input name='content_id' type='hidden' value='{$details['content_id']}'>";

			// reselect the meta tag options
			$jscript_2 = "<script language='javascript1.2'>reselect_option('meta_robots', '{$details['meta_robots']}');reselect_option('meta_distribution', '{$details['meta_distribution']}');reselect_option('meta_revisit', '{$details['meta_revisit']}');reselect_option('meta_rating', '{$details['meta_rating']}');reselect_option('meta_expiry', '{$details['meta_expiry']}');</script>";
		}
		else
		{
			// change the action to update
			$action = "add_property";

			// create an empty array
			$details = array('property_id' => '', 'property_name' => '', 'street_address' => '', 'phone_number' => '', 'fax_number' => '', 'email_address' => '', 'operation_hours' => '', 'meta_title' => '', 'meta_description' => '', 'meta_keywords' => '', 'meta_robots' => '', 'meta_distribution' => '', 'meta_revisit' => '', 'meta_rating' => '', 'meta_expiry' => '', 'overview_html' => '', 'location_html' => '', 'credits_html' => '', 'vr_tour_url' => '', 'weather_xml' => '', 'property_online' => '', 'last_updated' => '');		
		}


		//echo "<pre>";print_r($details);echo "</pre>";

		/////////////////////////////////////////////////////////////////

		// add the javascript file
		$jscript_1 .= CMS_JSCRIPT_FILE;

		// get the property region list
		$property_regions = $props->get_property_region_list($region_id);

		// get the property type list
		$property_types =  $props->get_property_type_list($type_id);

		// get the property countries
		$property_countries = $props->get_property_country_list($country_id);

		// add a title
		$content .= "<table cellpadding='0' cellpadding='5'><tr><td><img src='{$images_url}house_large.gif'></td><td><h4 class='no_break'> &nbsp; Editing Resort Pages</h4></td></tr></table>";

		// build the content into a tabbed pane
		$content .= "
		<form action='{$_SERVER['PHP_SELF']}' method='post'>

		<input name='action' type='hidden' value='$action'>
		<input name='display' type='hidden' value='edit_property'>
		$hidden_vars 
		
		<table cellpadding='0' cellspacing='0' class='pane_parent'>			
			<tr>				
				<td valign='top'>
					<table cellpadding='0' cellspacing='0' class='pane_tabs'>
						<tr>
							<td class='pane_tab_on' id='tab:1'><a href=\"javascript:void(show_pane(1,6));\" class='pane_link_on' id='pane_link:1'>Demographics</a></td>
							<td class='pane_tab_off' id='tab:2'><a href=\"javascript:void(show_pane(2,6));\" class='pane_link_off' id='pane_link:2'>Meta Tags</a></td>
							<td class='pane_tab_off' id='tab:3'><a href=\"javascript:void(show_pane(3,6));\" class='pane_link_off' id='pane_link:3'>Overview</a></td>
							<td class='pane_tab_off' id='tab:4'><a href=\"javascript:void(show_pane(4,6));\" class='pane_link_off' id='pane_link:4'>Location</a></td>
							<td class='pane_tab_off' id='tab:5'><a href=\"javascript:void(show_pane(5,6));\" class='pane_link_off' id='pane_link:5'>Credits</a></td>
							<td class='pane_tab_off' id='tab:6'><a href=\"javascript:void(show_pane(6,6));\" class='pane_link_off' id='pane_link:6'>Miscellaneous</a></td>
							<td align='middle'><input type='image' src='{$images_url}disks_large.gif' class='no_border' title='Save All Resort Page' onclick='javascript:return check_resort_pages_form(this.form);'></td>
						</tr>
						<tr class='tab_spacer'>
							<td><img src='/images/systems/resorts/tab_spacer.gif' width='100' height='5'></td>
							<td><img src='/images/systems/resorts/tab_spacer.gif' width='100' height='5'></td>
							<td><img src='/images/systems/resorts/tab_spacer.gif' width='100' height='5'></td>
							<td><img src='/images/systems/resorts/tab_spacer.gif' width='100' height='5'></td>
							<td><img src='/images/systems/resorts/tab_spacer.gif' width='100' height='5'></td>
							<td><img src='/images/systems/resorts/tab_spacer.gif' width='100' height='5'></td>
							<td width='100%'><img src='/images/systems/resorts/tab_spacer.gif' width='100%' height='5'></td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td valign='top' class='panel_cell'>

					<div id='panel:1' class='primary_panel'>

							<table cellpadding='5' cellspacing='0' width='100%'>
								<tr>
									<td class='panel_hdr'>Property Demographics</td>
								</tr>
								<tr>
									<td>
									<table cellpadding='5' cellspacing='0'>																
										<tr>
											<td class='red_star'>*</td><td>Property Region</td><td>$property_regions</td>
										</tr>
										<tr>
											<td class='red_star'>*</td><td>Property Country</td><td>$property_countries</td>
										</tr>
										<tr>
											<td class='red_star'>*</td><td>Property Type</td><td>$property_types</td>
										</tr>
										<tr>
											<td class='red_star'>*</td><td>Property Name</td><td><input type='text' name='property_name' size='50' value='".htmlspecialchars($details['property_name'], ENT_QUOTES)."'></td>
										</tr>													
										<tr>
											<td class='red_star'>*</td><td>Phone Number</td><td><input type='text' name='phone_number' size='20' value='{$details['phone_number']}'></td>
										</tr>
										<tr>
											<td class='red_star'>&nbsp;</td><td>Fax Number</td><td><input type='text' name='fax_number' size='20' value='{$details['fax_number']}'></td>
										</tr>
										<tr>
											<td class='red_star'>&nbsp;</td><td>Email Address</td><td><input type='text' name='email_address' size='50' value='{$details['email_address']}'></td>
										</tr>
										<tr>
											<td class='red_star'>*</td><td>Property Address</td><td><textarea name='street_address' rows='4' cols='70'>{$details['street_address']}</textarea></td>
										</tr>
										<tr>
											<td class='red_star'>&nbsp;</td><td>Operation Hours</td><td><textarea name='operation_hours' rows='4' cols='70'>{$details['operation_hours']}</textarea></td>
										</tr>																						
									</table>	
									</td>
								</tr>
							</table>

					</div>			

					<div id='panel:2' class='pane_panel'>					
							
							<table cellpadding='5' cellspacing='0' width='100%'>
								<tr>
									<td class='panel_hdr'>Property Meta Tag Details</td>
								</tr>
								<tr>
									<td>
										<table cellpadding='5' cellspacing='0' width='100%'>
											<tr>
												<td width='120'>Meta Title</td><td><input type='text' name='meta_title' value='{$details['meta_title']}' size='70'  /></td>
											</tr>
											<tr>
												<td>Meta Description</td><td><textarea rows='4' cols='70' name='meta_description' >{$details['meta_description']}</textarea></td>
											</tr>
											<tr>
												<td>Meta Keywords</td><td><textarea rows='4' cols='70' name='meta_keywords' >{$details['meta_keywords']}</textarea></td>
											</tr>
											<tr>
												<td>Meta Robots</td>
												<td>
													<select name='meta_robots' id='meta_robots'>
													<option value='index, follow'>Index, Follow</option>
													<option value='noindex, nofollow'>No Index, No Follow</option>
													<option value='index, nofollow'>Index, No Follow</option>
													<option value='noindex, follow'>No Index, Follow</option>
													</select>
												</td>
											</tr>
											<tr>
												<td>Meta Distribution</td>
												<td>
													<select name='meta_distribution' id='meta_distribution'>
													<option value='Global'>Global</option>
													<option value='local'>Local</option>
													</select>
												</td>
											</tr>					
											<tr>
												<td>Meta Revisit After</td>
												<td>
												<select name='meta_revisit' id='meta_revisit'>
													<option value='7 days'>7 Days</option>
													<option value='30 days' selected>30 Days</option>
													<option value='60 days'>60 Days</option>
													<option value='150 days'>150 Days</option>
													</select>
												</td>
											</tr>
											<tr>
												<td>Meta Rating</td>
													<td>
													<select name='meta_rating' id='meta_rating'>
													<option value='General'>General</option>
													<option value='Mature'>Mature</option>
													<option value='Adult'>Adult</option>
													</select>
												</td>
											</tr>					
											<tr>
												<td>Meta Expiry</td>
													<td>
													<select name='meta_expiry' id='meta_expiry'>
													<option value='never'>Never</option>
													<option value='30 days'>30 Days</option>
													<option value='60 Days'>60 Days</option>
													<option value='150 days'>150 Days</option>
													</select>
												</td>
											</tr>
										</table>												
								</td>
							</tr>	
						</table>
												
					</div>			

					<span id='panel:3' class='pane_panel'>							
							
							<table cellpadding='5' cellspacing='0' align='center' width='100%'>
								<tr>
									<td class='panel_hdr'>Property Overview</td>
								</tr>
								<tr>
									<td>
									
									<!-- Containder for the passed html --> 
									<pre id=\"temp_overview\" name=\"temp_overview\" style=\"display:none;\">{$details['overview_html']}</pre>
								
									<center>

									<!-- Embed the Editor -->
									<script>

										try
										{
											var overviewEditor = new InnovaEditor('overviewEditor');
											overviewEditor.btnStyles=true;											
											overviewEditor.arrCustomButtons = [[\"CustomName1\",\"modalDialogShow('/admin/cms/page_select.php',400,220)\",\"Caption 1 here\",\"btnCustom.gif\"]]
											overviewEditor.cmdAssetManager=\"modalDialogShow('/includes/assetmanager/assetmanager.php',640,465)\"; //Use relative to root path
											overviewEditor.features=get_editor_buttons('default');
											overviewEditor.css=\"" . PROPERTY_CMS_STYLES . "\";
											overviewEditor.RENDER(document.getElementById('temp_overview').innerHTML); 											
										}
										catch (e)
										{
											window.alert('Editor error: ' + e.message);
										}

									</script>

									</center>				
									
									<!-- Add a Hidden Form Field -->
									<input type=\"hidden\" name=\"overview_html\" id=\"overview_html\">	

									</td>
								</tr>
							</table>

					</span>

					<div id='panel:4' class='pane_panel'>	

							<table cellpadding='5' cellspacing='0' align='center' width='100%'>
								<tr>
									<td class='panel_hdr'>Property Location Details</td>
								</tr>
								<tr>
									<td>

									<!-- Containder for the passed html --> 
									<pre id=\"temp_location\" name=\"temp_location\" style=\"display:none;\">{$details['location_html']}</pre>

									<center>

									<!-- Embed the Editor -->
									<script>

										try
										{
											var locationEditor = new InnovaEditor('locationEditor');
											locationEditor.btnStyles=true;
											locationEditor.css=\"" . PROPERTY_CMS_STYLES . "\";						
											locationEditor.arrCustomButtons = [[\"CustomName1\",\"modalDialogShow('/admin/cms/page_select.php',400,220)\",\"Caption 1 here\",\"btnCustom.gif\"]]
											locationEditor.cmdAssetManager=\"modalDialogShow('/includes/assetmanager/assetmanager.php',640,465)\"; //Use relative to root path
											locationEditor.features=get_editor_buttons('default');
											locationEditor.RENDER(document.getElementById('temp_location').innerHTML); 
										}
										catch (e)
										{
											window.alert('Editor error: ' + e.message);
										}

									</script>
									
									</center>				
									
									<!-- Add a Hidden Form Field -->
									<input type=\"hidden\" name=\"location_html\" id=\"location_html\">	
							
									</td>
								</tr>
							</table>

					</div>		
						
					<div id='panel:5' class='pane_panel'>	

							<table cellpadding='5' cellspacing='0' align='center' width='100%'>
								<tr>
									<td class='panel_hdr'>Timeshare Credit Information</td>
								</tr>
								<tr>
									<td>

									<!-- Containder for the passed html --> 
									<pre id=\"temp_credits\" name=\"temp_credits\" style=\"display:none;\">{$details['credits_html']}</pre>

									<center>

									<!-- Embed the Editor -->
									<script>

										try
										{
											var creditInfo = new InnovaEditor('creditInfo');
											creditInfo.btnStyles=true;
											creditInfo.css=\"" . PROPERTY_CMS_STYLES . "\";						
											creditInfo.arrCustomButtons = [[\"CustomName1\",\"modalDialogShow('/admin/cms/page_select.php',400,220)\",\"Caption 1 here\",\"btnCustom.gif\"]]
											creditInfo.cmdAssetManager=\"modalDialogShow('/includes/assetmanager/assetmanager.php',640,465)\"; //Use relative to root path
											creditInfo.features=get_editor_buttons('default');
											creditInfo.RENDER(document.getElementById('temp_credits').innerHTML); 
										}
										catch (e)
										{
											window.alert('Editor error: ' + e.message);
										}

									</script>
									
									</center>				
									
									<!-- Add a Hidden Form Field -->
									<input type=\"hidden\" name=\"credits_html\" id=\"credits_html\">								
								
									</td>										
								</tr>
							</table>

					</div>	

					<div id='panel:6' class='pane_panel'>	

							<table cellpadding='5' cellspacing='0' class='panel_tbl' width='100%'>
								<tr>
									<td class='panel_hdr'>Miscellanious Property Features</td>
								</tr>
								<tr>
									<td>
										<table cellpadding='5' cellspacing='0'>
											<tr>
												<td>Virtual Tour URL</td><td><input type='text' name='vr_tour_url' size='50' value='{$details['vr_tour_url']}'></td>
											</tr>
											<tr>
												<td>Weather XML File</td><td><input type='text' name='weather_xml' size='50' value='{$details['weather_xml']}'></td>
											</tr>
											<tr>
												<td>Google Earth KML File</td><td><input type='text' name='gearth_kml' size='50' value=''></td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
					</div>
				</td>
			</tr>
		</table>	
								
		</form>";

		break;
	}

	// add / edit a resort
	case "edit_resort":
	{

		break;
	}	
}


// CHECK OUR OUTPUT MESSAGES
if (!is_null($outcome_msg))
{
	$outcome_msg = "<script language=\"Javascript1.2\">window.alert(\"$outcome_msg\");</script>";
}


/////////////////////////////////////////////////////////////////////////////////////

// ADD MULTIPLE COMPONENTS TO THE TEMPALTE
$template->add_multiple_components(array('ADMIN_MENU' => $admin_menu, 'SCRIPTS_1' => $jscript_1, 'SCRIPTS_2' => $jscript_2, 'CONTENT' => $content, 'USERNAME' => $_SESSION['account_username'], 'OUTCOME_MSG' => $outcome_msg));

// SHOW THE POPULATED TEMPALTE
echo $template->get_template();

/////////////////////////////////////////////////////////////////////////////////////

?>