<?

/*
FlexCMS (http://www.flexcms.com)
Flexible, Powerful, Affordable.

Contents of this file are protected by the copyright
notice found at http://www.flexcms.com/flex/pages/copyright.html,
and its usage is subject to the terms of the licensing agreement 
available at http://www.flexcms.com/flex/pages/license.html
*/



	// ========================================================================================
	// edit page
	// ========================================================================================
	
	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_content.gif" width="23" height="20"> '.$MsgText[0][300];
	$BrowserTitle = $MsgText[0][300];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="'.$MainURL.'/options.html">'.$MsgText[0][4].'</a> > <a href="'.$MainURL.'/admin/pages.html">'.$MsgText[0][244].'</a> > '.$MsgText[0][300];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		
		$query = "select * from `".$Settings['DBPrefix']."core-Pages` where RecordNumber='".intval($Arguments3)."' LIMIT 1";
        $result = mysql_query($query) or die (mysql_error());
		$row = mysql_fetch_array($result);
		
		
		if ($Permissions[18] == 'y' && $row['MinLevel'] <= $UserLevel && $row['MinEditLevel'] <= $UserLevel) {
	
						
			if ($Arguments3 != '') {
			
			
			$query35 = "select * from `".$Settings['DBPrefix']."core-PageCategories` ORDER BY Name ASC";
			$result35 = mysql_query($query35) or die (mysql_error());
		
			while ($row35 = mysql_fetch_array($result35)) { 
         	   
				$CategoryIDsArray[$row35['Parent']][] = $row35['RecordNumber'];
				$CategoryNamesArray[$row35['Parent']][] = $row35['Name'];
		
			}	
			
			
			
			$TitleAlignmentSelected[$row['TitleAlignment']] = ' selected';
			$PageAlignmentSelected[$row['PageAlignment']] = ' selected';
			$PageEnabledSelected[$row['PageEnabled']] = ' selected';
			
			$ShowPrintableChecked[$row['ShowPrintable']] = ' checked';
			$ShowEmailChecked[$row['ShowEmail']] = ' checked';
			
			
			
			if ($row['NLtoBR'] == 1) { $NLtoBRChecked = ' checked'; }
			if ($row['ConvertLinks'] == 1) { $ConvertLinksChecked = ' checked'; }
			if ($row['HidePage'] == 'y') { $HidePageChecked = ' checked'; }
			
			
			
			if ($row['PageType'] == 1 || $row['PageType'] == 2 || $row['PageType'] == 3) {
				$PageTypeSelected[$row['PageType']] = ' selected';
			}
			else if ($row['EnablePHP'] == 1) {
				$PageTypeSelected[3] = ' selected';
			}
			
			
					
			
			
			// start date block
			if ($row['StartDate'] > 0) {
				$DatePieces = getdate($row['StartDate']);
				$UseSDChecked = ' checked';
			}
			for ($d = 1; $d <= 31; $d++) {
				if ($DatePieces['mday'] == $d) {
					$Selected = ' selected';
				}
				else {
					$Selected = '';
				}
				if ($d < 10) {
					$DaysSelect .= '<option value="'.$d.'"'.$Selected.'> &nbsp;&nbsp;'.$d.'</option>';
				}
				else {
					$DaysSelect .= '<option value="'.$d.'"'.$Selected.'> '.$d.'</option>';
				}
			}
			for ($y = 2004; $y <= 2020; $y++) {
				if ($DatePieces['year'] == $y) {
					$Selected = ' selected';
				}
				else {
					$Selected = '';
				}
				$YearsSelect .= '<option value="'.$y.'"'.$Selected.'> '.$y.'</option>';
			}
			
			$HoursSelect = '<option value="0"> 12</option>';
			if ($DatePieces['hours'] > 11) {
				$DatePieces['hours'] -= 12;
				$SDAmPmSelected['pm'] = ' selected';
			} 
			for ($h = 1; $h <= 11; $h++) {
				if ($DatePieces['hours'] == $h) {
					$Selected = ' selected';
				}
				else {
					$Selected = '';
				}
				if ($h < 10) {
					$HoursSelect .= '<option value="'.$h.'"'.$Selected.'> &nbsp;&nbsp;'.$h.'</option>';
				}
				else {
					$HoursSelect .= '<option value="'.$h.'"'.$Selected.'> '.$h.'</option>';
				}
			}
			
			for ($m = 0; $m <= 59; $m++) {
				if ($DatePieces['minutes'] == $m) {
					$Selected = ' selected';
				}
				else {
					$Selected = '';
				}
				if ($m < 10) {
					$MinutesSelect .= '<option value="'.$m.'"'.$Selected.'> 0'.$m.'</option>';
				}
				else {
					$MinutesSelect .= '<option value="'.$m.'"'.$Selected.'> '.$m.'</option>';
				}
			}
			$SDMonthSelected[$DatePieces['mon']] = ' selected';
			
			$SDString = '<input type="checkbox" name="UseStartDate" value="Yes"'.$UseSDChecked.'> Yes&nbsp;&nbsp;&nbsp;&nbsp;<select name="SDMonth"><option value="1"'.$SDMonthSelected[1].'> '.$MsgText[0][284].'</option><option value="2"'.$SDMonthSelected[2].'> '.$MsgText[0][285].'</option><option value="3"'.$SDMonthSelected[3].'> '.$MsgText[0][286].'</option><option value="4"'.$SDMonthSelected[4].'> '.$MsgText[0][287].'</option><option value="5"'.$SDMonthSelected[5].'> '.$MsgText[0][288].'</option><option value="6"'.$SDMonthSelected[6].'> '.$MsgText[0][289].'</option><option value="7"'.$SDMonthSelected[7].'> '.$MsgText[0][290].'</option><option value="8"'.$SDMonthSelected[8].'> '.$MsgText[0][291].'</option><option value="9"'.$SDMonthSelected[9].'> '.$MsgText[0][292].'</option><option value="10"'.$SDMonthSelected[10].'> '.$MsgText[0][293].'</option><option value="11"'.$SDMonthSelected[11].'> '.$MsgText[0][294].'</option><option value="12"'.$SDMonthSelected[12].'> '.$MsgText[0][295].'</option></select>&nbsp;<select name="SDDay">'.$DaysSelect.'</select>&nbsp;<select name="SDYear">'.$YearsSelect.'</select> @ <select name="SDHour">'.$HoursSelect.'</select>:<select name="SDMinute">'.$MinutesSelect.'</select>&nbsp;<select name="SDAmPm"><option value="am"> AM</option><option value="pm"'.$SDAmPmSelected['pm'].'> PM</option></select>';


			// end date block
			$DatePieces = '';
			if ($row['EndDate'] > 0 && $row['EndDate'] < 4294967295) {
				$DatePieces = getdate($row['EndDate']);
				$UseEDChecked = ' checked';
			}
			$DaysSelect = '';
			for ($d = 1; $d <= 31; $d++) {
				if ($DatePieces['mday'] == $d) {
					$Selected = ' selected';
				}
				else {
					$Selected = '';
				}
				if ($d < 10) {
					$DaysSelect .= '<option value="'.$d.'"'.$Selected.'> &nbsp;&nbsp;'.$d.'</option>';
				}
				else {
					$DaysSelect .= '<option value="'.$d.'"'.$Selected.'> '.$d.'</option>';
				}
			}
			$YearsSelect = '';
			for ($y = 2004; $y <= 2020; $y++) {
				if ($DatePieces['year'] == $y) {
					$Selected = ' selected';
				}
				else {
					$Selected = '';
				}
				$YearsSelect .= '<option value="'.$y.'"'.$Selected.'> '.$y.'</option>';
			}
			
			$HoursSelect = '<option value="0"> 12</option>';
			if ($DatePieces['hours'] > 11) {
				$DatePieces['hours'] -= 12;
				$EDAmPmSelected['pm'] = ' selected';
			} 
			for ($h = 1; $h <= 11; $h++) {
				if ($DatePieces['hours'] == $h) {
					$Selected = ' selected';
				}
				else {
					$Selected = '';
				}
				if ($h < 10) {
					$HoursSelect .= '<option value="'.$h.'"'.$Selected.'> &nbsp;&nbsp;'.$h.'</option>';
				}
				else {
					$HoursSelect .= '<option value="'.$h.'"'.$Selected.'> '.$h.'</option>';
				}
			}
			
			$MinutesSelect = '';
			for ($m = 0; $m <= 59; $m++) {
				if ($DatePieces['minutes'] == $m) {
					$Selected = ' selected';
				}
				else {
					$Selected = '';
				}
				if ($m < 10) {
					$MinutesSelect .= '<option value="'.$m.'"'.$Selected.'> 0'.$m.'</option>';
				}
				else {
					$MinutesSelect .= '<option value="'.$m.'"'.$Selected.'> '.$m.'</option>';
				}
			}
			$EDMonthSelected[$DatePieces['mon']] = ' selected';
			
			$EDString = '<input type="checkbox" name="UseEndDate" value="Yes"'.$UseEDChecked.'> Yes&nbsp;&nbsp;&nbsp;&nbsp;<select name="EDMonth"><option value="1"'.$EDMonthSelected[1].'> '.$MsgText[0][284].'</option><option value="2"'.$EDMonthSelected[2].'> '.$MsgText[0][285].'</option><option value="3"'.$EDMonthSelected[3].'> '.$MsgText[0][286].'</option><option value="4"'.$EDMonthSelected[4].'> '.$MsgText[0][287].'</option><option value="5"'.$EDMonthSelected[5].'> '.$MsgText[0][288].'</option><option value="6"'.$EDMonthSelected[6].'> '.$MsgText[0][289].'</option><option value="7"'.$EDMonthSelected[7].'> '.$MsgText[0][290].'</option><option value="8"'.$EDMonthSelected[8].'> '.$MsgText[0][291].'</option><option value="9"'.$EDMonthSelected[9].'> '.$MsgText[0][292].'</option><option value="10"'.$EDMonthSelected[10].'> '.$MsgText[0][293].'</option><option value="11"'.$EDMonthSelected[11].'> '.$MsgText[0][294].'</option><option value="12"'.$EDMonthSelected[12].'> '.$MsgText[0][295].'</option></select>&nbsp;<select name="EDDay">'.$DaysSelect.'</select>&nbsp;<select name="EDYear">'.$YearsSelect.'</select> @ <select name="EDHour">'.$HoursSelect.'</select>:<select name="EDMinute">'.$MinutesSelect.'</select>&nbsp;<select name="EDAmPm"><option value="am"> AM</option><option value="pm"'.$EDAmPmSelected['pm'].'> PM</option></select>';
			
			
			$query57 = "select Level,Description from `".$Settings['DBPrefix']."core-Permissions` where Level<=".$UserLevel;
   			$result57 = mysql_query($query57) or die (mysql_error());
			while ($row57 = mysql_fetch_array($result57)) {
				$LevelDescriptions[$row57['Level']] = $row57['Description'];
			}
		
			$MinLevelSelected[$row['MinLevel']] = ' selected';
			
			$PermissionsDropdown = '<option value="0"'.$MinLevelSelected[0].'> 0 - Everyone</option>';
			for ($i = 1; $i <= $UserLevel; $i++) {
				if ($LevelDescriptions[$i] != '') {
					$PermissionsDropdown .= '<option value="'.$i.'"'.$MinLevelSelected[$i].'> '.$i.' - '.$LevelDescriptions[$i].'</option>';
				}
				else {
					$PermissionsDropdown .= '<option value="'.$i.'"'.$MinLevelSelected[$i].'> '.$i.'</option>';
				}
			}
			
			$MinEditLevelSelected[$row['MinEditLevel']] = ' selected';
			
			$PermissionsDropdown2 = '<option value="0"'.$MinEditLevelSelected[0].'> 0 - Everyone</option>';
			for ($i = 1; $i <= $UserLevel; $i++) {
				if ($LevelDescriptions[$i] != '') {
					$PermissionsDropdown2 .= '<option value="'.$i.'"'.$MinEditLevelSelected[$i].'> '.$i.' - '.$LevelDescriptions[$i].'</option>';
				}
				else {
					$PermissionsDropdown2 .= '<option value="'.$i.'"'.$MinEditLevelSelected[$i].'> '.$i.'</option>';
				}
			}
			
								
			
			
			if ($Permissions[9] == 'y') {
				//$PHPSection = '<input id="EnablePHP" type="checkbox" name="EnablePHP" value="1"'.$EnablePHPChecked.'> '.$MsgText[0][118];
				
								
				$row['PageContents'] = preg_replace("/\&([\#\d\w]{1,5})\;/i", "&amp;\\1;", $row['PageContents']);
				$row['PageContents'] = str_replace('<!--', '&lt;!--', $row['PageContents']);
				$row['PageContents'] = str_replace('</', '&lt;/', $row['PageContents']);
				
				$CustomContents = '<br>
<b>'.$MsgText[0][689].':</b><br>

<script>
var EditorStarted = false;

function UpdatePageType() {
	var PageType = document.getElementById("PageType").value;
	
	if (PageType == 1) {
		document.getElementById("PageContents").value = document.getElementById("PageContents2").value;
	
		if (EditorStarted == false) {
			var oFCKeditor = new FCKeditor( "PageContents" ) ;

			oFCKeditor.BasePath = "'.$BaseURL.'/fckeditor/" ;	// "/fckeditor/" is the default value.

			oFCKeditor.Height	= 500 ;
			
			//oFCKeditor.Create() ;
			oFCKeditor.ReplaceTextarea();
			
			EditorStarted = true;
		}
	
		document.getElementById("EditorDiv").style.display = "";
		document.getElementById("NonEditorDiv").style.display = "none";
		document.getElementById("EnablePHP").value = 0;
	}
	else if (PageType == 2) {
		document.getElementById("PageContents2").value = document.getElementById("PageContents").value;
	
		document.getElementById("EditorDiv").style.display = "none";
		document.getElementById("NonEditorDiv").style.display = "";
		document.getElementById("EnablePHP").value = 0;
	}
	else if (PageType == 3) {
		document.getElementById("PageContents2").value = document.getElementById("PageContents").value;
		
		document.getElementById("EditorDiv").style.display = "none";
		document.getElementById("NonEditorDiv").style.display = "";
		document.getElementById("EnablePHP").value = 1;
	}
}
</script>

<select name="PageType" id="PageType" size="1" onChange="UpdatePageType();">
<option value="1"'.$PageTypeSelected[1].'> Rich Text / HTML Editor</option>
<option value="2"'.$PageTypeSelected[2].'> Plain Text / HTML Without Editor</option>
<option value="3"'.$PageTypeSelected[3].'> PHP-Enabled Code</option>
</select><br><div id="EditorDiv"><textarea id="PageContents" name="PageContents" cols="65" rows="8" style="width: 100%; height: 500px;" wrap="virtual">'.$row['PageContents'].'</textarea></div><div id="NonEditorDiv" style="display: none;"><textarea id="PageContents2" name="PageContents2" cols="65" rows="8" style="width: 100%; height: 500px;" wrap="virtual">'.$row['PageContents'].'</textarea></div>';

				$CustomPageScripts = '<script type="text/javascript" src="'.$BaseURL.'/fckeditor/fckeditor.js"></script><script>UpdatePageType();</script>';


			}
			else {
				if ($row['EnablePHP'] == 1) {
					$PHPSection = $MsgText[0][118].'<input id="EnablePHP" type="hidden" name="EnablePHP" value="1">';
					
					$row['PageContents'] = str_replace('"', '&#34;', $row['PageContents']);
					$CustomContents = '<i>('.$MsgText[0][242].')</i><br><input type="hidden" name="PageContents" value="'.$row['PageContents'].'"><br>';
				}
				else {
					$PHPSection = $MsgText[0][119];
					
					$row['PageContents'] = preg_replace("/\&([\#\d\w]{1,5})\;/i", "&amp;\\1;", $row['PageContents']);
					$row['PageContents'] = str_replace('<!--', '&lt;!--', $row['PageContents']);
					$row['PageContents'] = str_replace('</', '&lt;/', $row['PageContents']);
					
					$CustomContents = '<br>
<b>'.$MsgText[0][689].':</b><br>

<script>
var EditorStarted = false;

function UpdatePageType() {
	var PageType = document.getElementById("PageType").value;
	
	if (PageType == 1) {
		document.getElementById("PageContents").value = document.getElementById("PageContents2").value;
	
		if (EditorStarted == false) {
			var oFCKeditor = new FCKeditor( "PageContents" ) ;

			oFCKeditor.BasePath = "'.$BaseURL.'/fckeditor/" ;	// "/fckeditor/" is the default value.

			oFCKeditor.Height	= 500 ;
			
			//oFCKeditor.Create() ;
			oFCKeditor.ReplaceTextarea();
			
			EditorStarted = true;
		}
	
		document.getElementById("EditorDiv").style.display = "";
		document.getElementById("NonEditorDiv").style.display = "none";
		document.getElementById("EnablePHP").value = 0;
	}
	else if (PageType == 2) {
		document.getElementById("PageContents2").value = document.getElementById("PageContents").value;
	
		document.getElementById("EditorDiv").style.display = "none";
		document.getElementById("NonEditorDiv").style.display = "";
		document.getElementById("EnablePHP").value = 0;
	}
	else if (PageType == 3) {
		document.getElementById("PageContents2").value = document.getElementById("PageContents").value;
		
		document.getElementById("EditorDiv").style.display = "none";
		document.getElementById("NonEditorDiv").style.display = "";
		document.getElementById("EnablePHP").value = 1;
	}
}
</script>

<select name="PageType" id="PageType" size="1" onChange="UpdatePageType();">
<option value="1"'.$PageTypeSelected[1].'> Rich Text / HTML Editor</option>
<option value="2"'.$PageTypeSelected[2].'> Plain Text / HTML Without Editor</option>
</select><br><div id="EditorDiv"><textarea id="PageContents" name="PageContents" cols="65" rows="8" style="width: 100%; height: 500px;" wrap="virtual">'.$row['PageContents'].'</textarea></div><div id="NonEditorDiv" style="display: none;"><textarea id="PageContents2" name="PageContents2" cols="65" rows="8" style="width: 100%; height: 500px;" wrap="virtual">'.$row['PageContents'].'</textarea></div>';

					$CustomPageScripts = '<script type="text/javascript" src="'.$BaseURL.'/fckeditor/fckeditor.js"></script><script>UpdatePageType();</script>';

				}
			}
			
			
			
			
			$CurrentPageCategory = $row['PageParent'];
			
			
			$PageCategoryDropdown = '<option value="0"> '.$MsgText[0][248].'</option>';
			
			$CatParent5 = 0;
			$LastParentAbove5 = '0';
			$CatLevel5['0'] = 0;
						
			function SpiderCategories5($CatParent5) {
				
				Global $CategoryIDsArray, $CategoryNamesArray, $PageCategoryDropdown, $LastParent5, $LastParentAbove5, $CatSpacersArray5, $CatLevel5, $CatsCount5, $CurrentPageCategory;
				
				for ($i = 0; $i < count($CategoryIDsArray[$CatParent5]); $i++) {
					
					$LastParentAboveB5 = $LastParentAbove5;
					$LastParentB5 = $LastParent5;
					
					$CatLevel5[$CategoryIDsArray[$CatParent5][$i]] = $CatLevel5[$CatParent5];
					if ($CatParent5 != $LastParent5 && $CatParent5 == $LastParentAbove5) {
				
						$CatLevel5[$CategoryIDsArray[$CatParent5][$i]] = $CatLevel5[$CatParent5] + 1;
						$CatLevel5[$CatParent5]++;
												
						$CatsCount5[$CatLevel5[$CatParent5]] = 0;
				
					}
					
					$LastParent5 = $CatParent5;
					$LastParentAbove5 = $CategoryIDsArray[$CatParent5][$i];
					
					$CatsCount5[$CatLevel5[$CatParent5]]++;
					
										
					$CatSpacer5 = '';
					for ($x = 0; $x < $CatLevel5[$CatParent5]; $x++) {
						
						if ($CatsCount5[$CatLevel5[$CatParent5]] == count($CategoryIDsArray[$CatParent5]) && $x == $CatLevel5[$CatParent5]-1) {
							$CatSpacersArray5[$CatLevel5[$CatParent5]] = '&nbsp;\'------';
							$ResetAfter5 = 'y';
						}
						else if ($CatsCount5[$CatLevel5[$CatParent5]] == count($CategoryIDsArray[$CatParent5])) {
							$CatSpacersArray5[$CatLevel5[$CatParent5]] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
						}
						else {
							if ($x < $CatLevel5[$CatParent5]) {
								$CatSpacersArray5[$CatLevel5[$CatParent5]] = '&nbsp;|------';
								$ResetAfter5 = 'y2';
							}
							else {
								$CatSpacersArray5[$CatLevel5[$CatParent5]] = '&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
							}
						}
						
							
						$CatSpacer5 .= $CatSpacersArray5[$x+1];
						
						if ($ResetAfter5 == 'y') {
							$CatSpacersArray5[$CatLevel5[$CatParent5]] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
							$ResetAfter5 = 'n';
						}
						else if ($ResetAfter5 == 'y2') {
							$CatSpacersArray5[$CatLevel5[$CatParent5]] = '&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
							$ResetAfter5 = 'n';
						}
										
					}
					
					
					if ($CategoryIDsArray[$CatParent5][$i] == $CurrentPageCategory) {
						$PageCategoryDropdown .= '<option value="'.$CategoryIDsArray[$CatParent5][$i].'" selected> '.$CatSpacer5.' '.$CategoryNamesArray[$CatParent5][$i].'</option>';
					}
					else {
						$PageCategoryDropdown .= '<option value="'.$CategoryIDsArray[$CatParent5][$i].'"> '.$CatSpacer5.' '.$CategoryNamesArray[$CatParent5][$i].'</option>';
					}
					
										
					if (count($CategoryIDsArray[$CatParent5][$i]) > 0) {
						SpiderCategories5($CategoryIDsArray[$CatParent5][$i]);
					}
				
				}
				
				
			}
			
			SpiderCategories5('0');
			
			
			
			
			
			
			
	
			$row['PageTitle'] = str_replace('"', '&#34;', $row['PageTitle']);
			$row['AdminLabel'] = str_replace('"', '&#34;', $row['AdminLabel']);
			
			
			
			$PageContents = '<script>
function ValidateForm() {

	document.forms["PostForm"].elements["submit"].disabled = true;
				
	return true;
	
}

</script><br><b>'.$MsgText[0][300].':</b><form name="PostForm" action="'.$MainURL . '/admin/pages-edit-save" method="post" onSubmit="ValidateForm();"><input type="hidden" name="PageIDToEdit" value="'.$row['RecordNumber'].'">

<script>
var ImageDestination = "";

var ExistingImagesWindowCode = "";

function SelectImage(ImageDestinationSent) {
	var WindowProperties = "width=420,height=300,left=" + (screen.width-420)/2 + ",top=" + (screen.height-300)/2 + ",location=no,menubar=no,directories=no,toolbar=no,status=no,scrollbars=no,resizable=yes";

	ImageDestination = ImageDestinationSent;

	if (ImageDestination == "Photo") {
		ExistingImagesWindowCode = window.open("'.$BaseURL.'/inc-core-admin-editor-existingimages.php?"+document.forms["PostForm"].elements["PhotoURL"].value,"existingimages",WindowProperties);
	}
	else {
		ExistingImagesWindowCode = window.open("'.$BaseURL.'/inc-core-admin-editor-existingimages.php?"+document.forms["PostForm"].elements["TitleImage"].value,"existingimages",WindowProperties);
	}
}
function ExistingImageSelected(ImageName,ImageWidth,ImageHeight) {

	ExistingImagesWindowCode.close();
	
	if (ImageDestination == "Photo") {
		document.forms["PostForm"].elements["PhotoURL"].value = "/images/uploaded/"+ImageName;
	}
	else {
		document.forms["PostForm"].elements["TitleImage"].value = "/images/uploaded/"+ImageName;
	}

}
function UploadToServer(ImageDestinationSent) {

		ImageDestination = ImageDestinationSent;

		var WindowProperties = "width=580,height=380,left=" + (screen.width-580)/2 + ",top=" + (screen.height-380)/2 + ",location=no,menubar=no,directories=no,toolbar=no,status=no,scrollbars=no,resizable=yes";

		UploadWindowCode = window.open("'.$BaseURL.'/inc-core-admin-editor-imageupload.php","imageupload",WindowProperties);

	  }

	  function UploadedImageSelected(ImageName,ImageWidth,ImageHeight) {

		UploadWindowCode.close();
		
		
		if (ImageDestination == "Photo") {
			document.forms["PostForm"].elements["PhotoURL"].value = "/images/uploaded/"+ImageName;
		}
		else {
			document.forms["PostForm"].elements["TitleImage"].value = "/images/uploaded/"+ImageName;
		}
		
	  }
</script>


<b>'.$MsgText[0][517].':</b>&nbsp;&nbsp;<input type="text" name="AdminLabel" size="30" value="'.$row['AdminLabel'].'"><br><font size="1">'.$MsgText[0][518].'</font><br>

<br>
<b>'.$MsgText[0][252].':</b>&nbsp;&nbsp;<select name="PageCategory">'.$PageCategoryDropdown.'</select><br><br>

<br><b>'.$MsgText[0][253].':</b>&nbsp;&nbsp;<input type="text" name="PageLink" size="30" value="'.$row['PageLink'].'"><br><font size="1">'.$MsgText[0][254].'</font><br>


<br><b>'.$MsgText[0][255].':</b>&nbsp;&nbsp;<input type="text" name="PageTitle" size="30" value="'.$row['PageTitle'].'"><br><img src="'.$ImagesURL.'/admin/admin/spacer.gif" border="0" width="1" height="4" alt=""><br>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="45"><img src="'.$ImagesURL.'/admin/admin/spacer.gif" border="0" width="45" height="1" alt=""></td>
      <td width="100%"><font face="'.$FontFace.'" size="'.$FontSize.'">
	  
'.$MsgText[0][519].':&nbsp;&nbsp;<input type="text" name="TitleImage" size="40" value="'.$row['TitleImage'].'"><br><input type="button" value="'.$MsgText[0][521].'" onClick="SelectImage();">&nbsp;<input type="button" value="'.$MsgText[0][563].'" onClick="UploadToServer();"><br><font size="1">'.$MsgText[0][520].'<br></font>

<img src="'.$ImagesURL.'/admin/admin/spacer.gif" border="0" width="1" height="4" alt=""><br>'.$MsgText[0][166].':&nbsp;&nbsp;<select name="TitleAlignment">
	<option value="L"'.$TitleAlignmentSelected['L'].'> '.$MsgText[0][15].'</option>
	<option value="C"'.$TitleAlignmentSelected['C'].'> '.$MsgText[0][16].'</option>
	<option value="R"'.$TitleAlignmentSelected['R'].'> '.$MsgText[0][17].'</option>
</select>
<br><font size="1">'.$MsgText[0][257].'</font><br>
	  
	  
	  </td>
    </tr>
</table>
<br>
'.$EditorStuff.'


<br><b>'.$MsgText[0][263].':</b><br>'.$CustomContents.'<input id="EnablePHP" type="hidden" name="EnablePHP" value="'.$row['EnablePHP'].'"><img src="'.$ImagesURL.'/admin/admin/spacer.gif" border="0" width="1" height="6" alt=""><br><br><table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="45"><img src="'.$ImagesURL.'/admin/admin/spacer.gif" border="0" width="45" height="1" alt=""></td>
      <td width="100%"><font face="'.$FontFace.'" size="'.$FontSize.'">

'.$MsgText[0][258].':&nbsp;&nbsp;<select name="PageAlignment">
	<option value="L"'.$PageAlignmentSelected['L'].'> '.$MsgText[0][15].'</option>
	<option value="C"'.$PageAlignmentSelected['C'].'> '.$MsgText[0][16].'</option>
	<option value="R"'.$PageAlignmentSelected['R'].'> '.$MsgText[0][17].'</option>
</select>
<br><font size="1">'.$MsgText[0][259].'</font><br><img src="'.$ImagesURL.'/admin/admin/spacer.gif" border="0" width="1" height="4" alt=""><br>
'.$MsgText[0][180].':&nbsp;&nbsp;<input type="checkbox" name="NLtoBR" value="1"'.$NLtoBRChecked.'> '.$MsgText[0][118].'<br><font size="1">'.$MsgText[0][181].'<br></font>
<img src="'.$ImagesURL.'/admin/admin/spacer.gif" border="0" width="1" height="4" alt=""><br>'.$MsgText[0][182].':&nbsp;&nbsp;<input type="checkbox" name="ConvertLinks" value="1"'.$ConvertLinksChecked.'> '.$MsgText[0][118].'<br><font size="1">'.$MsgText[0][183].'<br></font>
<img src="'.$ImagesURL.'/admin/admin/spacer.gif" border="0" width="1" height="6" alt=""><br></font>

</td>
    </tr>
</table>

<br><img src="'.$ImagesURL.'/admin/admin/spacer.gif" border="0" width="1" height="8" alt=""><br>

<b>'.$MsgText[0][675].':</b>&nbsp;&nbsp;<input type="text" name="BrowserTitle" size="50" value="'.str_replace('"','&#34;',$row['BrowserTitle']).'"><br><font size="1">'.$MsgText[0][676].'<br></font>

<br>
<b>'.$MsgText[0][648].':</b>&nbsp;&nbsp;<input type="text" name="MetaKeywords" size="50" value="'.str_replace('"','&#34;',$row['MetaKeywords']).'"><br><font size="1">'.$MsgText[0][649].'<br></font>

<br>
<b>'.$MsgText[0][650].':</b>&nbsp;&nbsp;<input type="text" name="MetaDescription" size="50" value="'.str_replace('"','&#34;',$row['MetaDescription']).'"><br><font size="1">'.$MsgText[0][651].'<br></font>

<br>

<br><b>'.$MsgText[0][265].':</b>&nbsp;&nbsp;<select name="PageEnabled">
	<option value="0"'.$PageEnabledSelected['0'].'> '.$MsgText[0][266].'</option>
	<option value="1"'.$PageEnabledSelected['1'].'> '.$MsgText[0][267].'</option>
</select>
<br>

<br>
<b>'.$MsgText[0][268].':</b>&nbsp;&nbsp;<input type="checkbox" name="HidePage" value="y"'.$HidePageChecked.'> '.$MsgText[0][118].'<br><font size="1">'.$MsgText[0][269].'<br></font>

<br>
<b>Show Printable Link:</b>&nbsp;&nbsp;<input type="checkbox" name="ShowPrintable" value="1"'.$ShowPrintableChecked[1].'> '.$MsgText[0][118].'
<br><br>
<b>Show Email Link:</b>&nbsp;&nbsp;<input type="checkbox" name="ShowEmail" value="1"'.$ShowEmailChecked[1].'> '.$MsgText[0][118].'

<br><br>

<b>'.$MsgText[0][189].':</b>&nbsp;&nbsp;<select name="MinLevel">'.$PermissionsDropdown.'</select><br><font size="1">'.$MsgText[0][270].'<br></font>
<br>
<b>'.$MsgText[0][543].':</b>&nbsp;&nbsp;<select name="MinEditLevel">'.$PermissionsDropdown2.'</select><br><font size="1">'.$MsgText[0][544].'<br></font>

<br><br>
<b>'.$MsgText[0][271].':</b> '.date('F jS Y @ g:i:s A',GetTimestamp()).'
<br>
<br>
<b>'.$MsgText[0][272].':</b>&nbsp;'.$SDString.'<br><font size="1">'.$MsgText[0][273].'<br></font>

<br>
<b>'.$MsgText[0][274].':</b>&nbsp;'.$EDString.'<br><font size="1">'.$MsgText[0][275].'<br></font>


<br><br><b>'.$MsgText[0][301].':</b><br>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="DeletePage" value="delete"> '.$MsgText[0][118].'
<br><br><br><b>Save As New Page:</b><br>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="SaveAsCopy" value="copy"> '.$MsgText[0][118].'<br>
<br><br>
<br>
<input type="submit" name="submit" value="'.$MsgText[0][123].'">

</form><br><br><br><script>var FlexCMSScriptName="'.$Settings['ScriptName'].'";</script>'.$CustomPageScripts.'<br>';

		/*
		if ($Permissions[9] != 'y' && $row['EnablePHP'] == 1) {
			$PageContents .= '<script>
						document.getElementById("PageType3").disabled = true;
					</script>';		
		}
		*/
		
		}
			

		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}

	// ========================================================================================




?>
