<?

/*
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
*/

		$LinkDropdown = '<option value=""> '.$MsgText[0][191].':</option>';
		
		$LinkDropdown .= '<option value="index"> - '.$MsgText[0][1].'</option>';
		$JSArray5 = '"index"';
		
		//if ($IM['cl'] == 'y') {
			$LinkDropdown .= '<option value="calendar"> - '.$MsgText[1][1].'</option>';
			$JSArray5 .= ',"calendar"';
			$LinkDropdown .= '<option value="admin/calendar"> - '.$MsgText[1][2].'*</option>';
			$JSArray5 .= ',"admin/calendar"';
			$LinkDropdown .= '<option value="admin/calendar_prefs"> - '.$MsgText[1][3].'*</option>';
			$JSArray5 .= ',"admin/calendar_prefs"';
			$LinkDropdown .= '<option value="admin/calendar_colors"> - '.$MsgText[1][4].'*</option>';
			$JSArray5 .= ',"admin/calendar_colors"';
		//}
		//if ($IM['mb'] == 'y') {
			$LinkDropdown .= '<option value="forum"> - '.$MsgText[2][1].'</option>';
			$JSArray5 .= ',"forum"';
			$LinkDropdown .= '<option value="admin/messageboard_boardsandcats"> - '.$MsgText[2][4].'*</option>';
			$JSArray5 .= ',"admin/messageboard_boardsandcats"';
			$LinkDropdown .= '<option value="admin/messageboard_prefs"> - '.$MsgText[2][2].'*</option>';
			$JSArray5 .= ',"admin/messageboard_prefs"';
			$LinkDropdown .= '<option value="admin/messageboard_colors"> - '.$MsgText[2][3].'*</option>';
			$JSArray5 .= ',"admin/messageboard_colors"';
		//}
		
		//if ($IM['pg'] == 'y') {
			$LinkDropdown .= '<option value="photos"> - '.$MsgText[3][1].'</option>';
			$JSArray5 .= ',"photos"';
		
			$query2 = "select * from `".$Settings['DBPrefix']."pg-Galleries` where MinLevel<='".$UserLevel."' ORDER BY GalleryTitle ASC, RecordNumber ASC";
			$result2 = mysql_query($query2) or die (mysql_error());
			while ($row2 = mysql_fetch_array($result2)) {
				$LinkDropdown .= '<option value="photos/'.$row2['RecordNumber'].'">&nbsp;&nbsp;&nbsp;&nbsp; - '.$row2['GalleryTitle'].' ('.$row2['RecordNumber'].')</option>';
				$JSArray5 .= ',"photos/'.$row2['RecordNumber'].'"';
			}
			
			$LinkDropdown .= '<option value="admin/photos"> - '.$MsgText[3][2].'*</option>';
			$JSArray5 .= ',"admin/photos"';
			$LinkDropdown .= '<option value="admin/photos_galleries"> - '.$MsgText[3][3].'*</option>';
			$JSArray5 .= ',"admin/photos_galleries"';
			$LinkDropdown .= '<option value="admin/photos_prefs"> - '.$MsgText[3][4].'*</option>';
			$JSArray5 .= ',"admin/photos_prefs"';
		//}
		
		//if ($IM['cs'] == 'y') {
			$LinkDropdown .= '<option value="admin/stats"> - '.$MsgText[4][2].'*</option>';
			$JSArray5 .= ',"admin/stats"';
			$LinkDropdown .= '<option value="admin/stats_pageviews"> - '.$MsgText[4][3].'*</option>';
			$JSArray5 .= ',"admin/stats_pageviews"';
			$LinkDropdown .= '<option value="admin/stats_pages"> - '.$MsgText[4][4].'*</option>';
			$JSArray5 .= ',"admin/stats_pages"';
			$LinkDropdown .= '<option value="admin/stats_referrals"> - '.$MsgText[4][5].'*</option>';
			$JSArray5 .= ',"admin/stats_referrals"';
			$LinkDropdown .= '<option value="admin/stats_users"> - '.$MsgText[4][6].'*</option>';
			$JSArray5 .= ',"admin/stats_users"';
			$LinkDropdown .= '<option value="admin/stats_systems"> - '.$MsgText[4][7].'*</option>';
			$JSArray5 .= ',"admin/stats_systems"';
			$LinkDropdown .= '<option value="admin/stats_prefs"> - '.$MsgText[4][8].'*</option>';
			$JSArray5 .= ',"admin/stats_prefs"';
		//}
						
		//if ($IM['nl'] == 'y') {
			$LinkDropdown .= '<option value="newsletter/subscribe"> - '.$MsgText[5][6].'</option>';
			$JSArray5 .= ',"newsletter/subscribe"';
			$LinkDropdown .= '<option value="newsletter/unsubscribe"> - '.$MsgText[5][7].'</option>';
			$JSArray5 .= ',"newsletter/unsubscribe"';
			$LinkDropdown .= '<option value="newsletter/messages"> - '.$MsgText[5][8].'</option>';
			$JSArray5 .= ',"newsletter/messages"';
			
			$LinkDropdown .= '<option value="admin/newsletter_compose"> - '.$MsgText[5][2].'*</option>';
			$JSArray5 .= ',"admin/newsletter_compose"';
			$LinkDropdown .= '<option value="admin/newsletter_subscribers"> - '.$MsgText[5][3].'*</option>';
			$JSArray5 .= ',"admin/newsletter_subscribers"';
			$LinkDropdown .= '<option value="admin/newsletter_archived"> - '.$MsgText[5][4].'*</option>';
			$JSArray5 .= ',"admin/newsletter_archived"';
		//}
		
		//if ($IM['gb'] == 'y') {
			$LinkDropdown .= '<option value="guestbook"> - '.$MsgText[6][1].'</option>';
			$JSArray5 .= ',"guestbook"';
			
			$LinkDropdown .= '<option value="admin/guestbook_manage"> - '.$MsgText[6][2].'*</option>';
			$JSArray5 .= ',"admin/guestbook_manage"';
			$LinkDropdown .= '<option value="admin/guestbook_prefs"> - '.$MsgText[6][19].'*</option>';
			$JSArray5 .= ',"admin/guestbook_prefs"';
		//}
		
		//if ($IM['na'] == 'y') {
			$LinkDropdown .= '<option value="articles"> - '.$MsgText[7][1].'</option>';
			$JSArray5 .= ',"articles"';
			
			$query2 = "select * from `".$Settings['DBPrefix']."na-Categories` ORDER BY CategoryName ASC, RecordNumber ASC";
			$result2 = mysql_query($query2) or die (mysql_error());
			while ($row2 = mysql_fetch_array($result2)) {
				$LinkDropdown .= '<option value="articles/'.$row2['RecordNumber'].'">&nbsp;&nbsp;&nbsp;&nbsp; - '.$row2['CategoryName'].' ('.$row2['RecordNumber'].')</option>';
				$JSArray5 .= ',"articles/'.$row2['RecordNumber'].'"';
			}
			
			$LinkDropdown .= '<option value="admin/articles"> - '.$MsgText[7][2].'*</option>';
			$JSArray5 .= ',"admin/articles"';
			$LinkDropdown .= '<option value="admin/articles-generate"> - '.$MsgText[7][5].'*</option>';
			$JSArray5 .= ',"admin/articles-generate"';
			$LinkDropdown .= '<option value="admin/articles-prefs"> - '.$MsgText[7][3].'*</option>';
			$JSArray5 .= ',"admin/articles-prefs"';
		//}
		
		//if ($IM['lm'] == 'y') {
			$LinkDropdown .= '<option value="links"> - '.$MsgText[8][4].'</option>';
			$JSArray5 .= ',"links"';
			
			$LinkDropdown .= '<option value="admin/links"> - '.$MsgText[8][2].'*</option>';
			$JSArray5 .= ',"admin/links"';
			$LinkDropdown .= '<option value="admin/links-prefs"> - '.$MsgText[8][3].'*</option>';
			$JSArray5 .= ',"admin/links-prefs"';
		//}
		
			$LinkDropdown .= '<option value="store"> - Store</option>';
			$JSArray5 .= ',"store"';
			
			$LinkDropdown .= '<option value="admin/store-categories"> - Manage Categories*</option>';
			$JSArray5 .= ',"admin/store-categories"';
			$LinkDropdown .= '<option value="admin/store-products"> - Manage Products*</option>';
			$JSArray5 .= ',"admin/store-products"';
			$LinkDropdown .= '<option value="admin/countries"> - Manage Countries and Regions*</option>';
			$JSArray5 .= ',"admin/countries"';
			$LinkDropdown .= '<option value="admin/store-shipping"> - Manage Shipping Options*</option>';
			$JSArray5 .= ',"admin/store-shipping"';
			$LinkDropdown .= '<option value="admin/store-taxes"> - Manage Taxes*</option>';
			$JSArray5 .= ',"admin/store-taxes"';
			$LinkDropdown .= '<option value="admin/store-prefs"> - Modify Settings & Preferences*</option>';
			$JSArray5 .= ',"admin/store-prefs"';
			$LinkDropdown .= '<option value="admin/store-orders"> - View and Process Orders*</option>';
			$JSArray5 .= ',"admin/store-orders"';
			$LinkDropdown .= '<option value="admin/store-reports"> - View Reports and Statistics*</option>';
			$JSArray5 .= ',"admin/store-reports"';
		
		
		
		$LinkDropdown .= '<option value="options"> - '.$MsgText[0][4].'</option>';
		$JSArray5 .= ',"options"';
		
		$LinkDropdown .= '<option value="profile-edit"> - '.$MsgText[0][78].'</option>';
		$JSArray5 .= ',"profile-edit"';
		
		$LinkDropdown .= '<option value="login"> - '.$MsgText[0][192].'</option>';
		$JSArray5 .= ',"login"';
		
		$LinkDropdown .= '<option value="logout"> - '.$MsgText[0][193].'</option>';
		$JSArray5 .= ',"logout"';
		
		$LinkDropdown .= '<option value="register"> - '.$MsgText[0][124].'</option>';
		$JSArray5 .= ',"register"';
		
		$LinkDropdown .= '<option value="admin/modules"> - '.$MsgText[0][49].'*</option>';
		$JSArray5 .= ',"admin/modules"';
		
		$LinkDropdown .= '<option value="admin/blocks"> - '.$MsgText[0][50].'*</option>';
		$JSArray5 .= ',"admin/blocks"';
		
		$LinkDropdown .= '<option value="admin/pages"> - '.$MsgText[0][51].'*</option>';
		$JSArray5 .= ',"admin/pages"';
		
		$LinkDropdown .= '<option value="admin/images"> - '.$MsgText[0][52].'*</option>';
		$JSArray5 .= ',"admin/images"';
		
		$LinkDropdown .= '<option value="admin/permissions"> - '.$MsgText[0][55].'*</option>';
		$JSArray5 .= ',"admin/permissions"';
		
		$LinkDropdown .= '<option value="admin/levels"> - '.$MsgText[0][56].'*</option>';
		$JSArray5 .= ',"admin/levels"';
		
		$LinkDropdown .= '<option value="admin/info"> - '.$MsgText[0][57].'*</option>';
		$JSArray5 .= ',"admin/info"';
		
		$LinkDropdown .= '<option value="admin/where"> - '.$MsgText[0][58].'*</option>';
		$JSArray5 .= ',"admin/where"';
		
		$LinkDropdown .= '<option value="admin/users"> - '.$MsgText[0][59].'*</option>';
		$JSArray5 .= ',"admin/users"';
		
		$LinkDropdown .= '<option value="admin/smilies"> - '.$MsgText[0][60].'*</option>';
		$JSArray5 .= ',"admin/smilies"';
		
		$LinkDropdown .= '<option value="admin/registration"> - '.$MsgText[0][61].'*</option>';
		$JSArray5 .= ',"admin/registration"';
		
		$LinkDropdown .= '<option value="admin/countries"> - Manage Countries and Regions*</option>';
		$JSArray5 .= ',"admin/countries"';
		
		$LinkDropdown .= '<option value="admin/preferences"> - '.$MsgText[0][62].'*</option>';
		$JSArray5 .= ',"admin/preferences"';
		
		$LinkDropdown .= '<option value="admin/templates"> - '.$MsgText[0][63].'*</option>';
		$JSArray5 .= ',"admin/templates"';
		
		$LinkDropdown .= '<option value="admin/settings"> - '.$MsgText[0][64].'*</option>';
		$JSArray5 .= ',"admin/settings"';
		
		$LinkDropdown .= '<option value="admin/backup"> - Create Site Backup*</option>';
		$JSArray5 .= ',"admin/backup"';
		$LinkDropdown .= '<option value="admin/backup-restore"> - Restore Site From Backup*</option>';
		$JSArray5 .= ',"admin/backup-restore"';
			
		
		$LinkDropdown .= '<option value=""> '.$MsgText[0][194].':</option>';
		
		$query2 = "select * from `".$Settings['DBPrefix']."core-Pages` where MinLevel<='".$UserLevel."' ORDER BY PageTitle ASC";
		$result2 = mysql_query($query2) or die (mysql_error());
		while ($row2 = mysql_fetch_array($result2)) {
			if ($row2['PageLink'] == '') { $row2['PageLink'] == $row2['PageID']; }
			$LinkDropdown .= '<option value="pages/'.$row2['PageLink'].'">&nbsp;&nbsp;&nbsp;&nbsp; - '.$row2['PageTitle'].' ('.$row2['PageLink'].')</option>';
			$JSArray5 .= ',"pages/'.$row2['PageLink'].'"';
		} 
		
		
		
		
		
		$CatsPrint = '<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="BPageCatsList-0" value="y">&nbsp;<b>Top Level</b>';
			
			$LastParentAbove = '0';
			$CatLevel['0'] = 0;
			
						
			if (count($PageIDsArray['0']) > 0) {
				$CatsPrint .= '<br>';	
			}
			
			if (count($CategoryIDsArray['0']) > 0) {
				$CatSpacer = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
			}
			else {
				$CatSpacer = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
			}
			
			for ($x = 0; $x < count($PageIDsArray['0']); $x++) {
					
				$CatsPrint .= '<table border="0" cellpadding="0" cellspacing="0"><tr><td>'.$CatSpacer.'</td><td><font size="'.$FontSize.'" color="#222222">&nbsp;&nbsp;&nbsp;<input type="checkbox" name="BPagesList-'.$PageIDsArray['0'][$x].'" value="y">&nbsp;'.$PageNamesArray['0'][$x].' ('.$PageLinksArray['0'][$x].')</font></td></tr></table>';
									
			}
			
			
			
			
			function SpiderCategories2($CatParent) {
				
				Global $CategoryIDsArray, $CategoryNamesArray, $CategoryDescriptionsArray, $PageIDsArray, $PageNamesArray, $PageLinksArray, $CatsPrint, $LastParent, $LastParentAbove, $CatSpacersArray, $CatLevel, $CatsCount, $BaseURL, $ImagesURL, $MainURL, $FontSize, $FontColor, $PageCatSelected, $PageSelected;
				
				for ($i = 0; $i < count($CategoryIDsArray[$CatParent]); $i++) {
					
					$LastParentAboveB = $LastParentAbove;
					$LastParentB = $LastParent;
					
					$CatLevel[$CategoryIDsArray[$CatParent][$i]] = $CatLevel[$CatParent];
					if ($CatParent != $LastParent && $CatParent == $LastParentAbove) {
				
						$CatLevel[$CategoryIDsArray[$CatParent][$i]] = $CatLevel[$CatParent] + 1;
						$CatLevel[$CatParent]++;
						
						$CatsCount[$CatLevel[$CatParent]] = 0;
				
					}
					
					$LastParent = $CatParent;
					$LastParentAbove = $CategoryIDsArray[$CatParent][$i];
					
					$CatsCount[$CatLevel[$CatParent]]++;
					
										
					$CatSpacer = '';
					for ($x = 0; $x < $CatLevel[$CatParent]; $x++) {
						
											
						if ($CatsCount[$CatLevel[$CatParent]] == count($CategoryIDsArray[$CatParent]) && $x == $CatLevel[$CatParent]-1) {
							$CatSpacersArray[$CatLevel[$CatParent]] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
							$ResetAfter = 'y';
						}
						else if ($CatsCount[$CatLevel[$CatParent]] == count($CategoryIDsArray[$CatParent])) {
							$CatSpacersArray[$CatLevel[$CatParent]] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
						}
						else {
							if ($x < $CatLevel[$CatParent]) {
								$CatSpacersArray[$CatLevel[$CatParent]] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
								$ResetAfter = 'y2';
							}
							else {
								$CatSpacersArray[$CatLevel[$CatParent]] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
							}
						}
						
						$ConnectorsWidth += $ConnectorsWidthAdd;	
						$CatSpacer .= $CatSpacersArray[$x+1];
						
						if ($ResetAfter == 'y') {
							$CatSpacersArray[$CatLevel[$CatParent]] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
							$ResetAfter = 'n';
						}
						else if ($ResetAfter == 'y2') {
							$CatSpacersArray[$CatLevel[$CatParent]] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
							$ResetAfter = 'n';
						}
									
					}
					
					$ConnectorsWidth = (($CatLevel[$CatParent]-1)*35)+35;
					$CatsPrint .= '<br><table border="0" cellpadding="0" cellspacing="0"><tr><td>'.$CatSpacer.'</td><td><font size="'.$FontSize.'" color="#222222">&nbsp;&nbsp;&nbsp;<input type="checkbox" name="BPageCatsList-'.$CategoryIDsArray[$CatParent][$i].'" value="y">&nbsp;<b>'.$CategoryNamesArray[$CatParent][$i].'</b></font></td></tr></table>';
					
					$CatSpacer = '';
					for ($x = 0; $x < ($CatLevel[$CatParent]-1); $x++) {
						$CatSpacer .= $CatSpacersArray[$x+1];					
					}
					if ($CatsCount[$CatLevel[$CatParent]] == count($CategoryIDsArray[$CatParent])) {
						$CatSpacer .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
					}
					else {						
						$CatSpacer .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
					}

					
					if (count($CategoryIDsArray[$CategoryIDsArray[$CatParent][$i]]) > 0) {
						$CatSpacer .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
					}
					else {
						$CatSpacer .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
					}
					
					$ConnectorsWidth = (($CatLevel[$CatParent])*35)+35;
					
										
					for ($x = 0; $x < count($PageIDsArray[$CategoryIDsArray[$CatParent][$i]]); $x++) {
											
						$CatsPrint .= '<table border="0" cellpadding="0" cellspacing="0"><tr><td>'.$CatSpacer.'</td><td><font size="'.$FontSize.'" color="#222222">&nbsp;&nbsp;&nbsp;<input type="checkbox" name="BPagesList-'.$PageIDsArray[$CategoryIDsArray[$CatParent][$i]][$x].'" value="y">&nbsp;'.$PageNamesArray[$CategoryIDsArray[$CatParent][$i]][$x].' ('.$PageLinksArray[$CategoryIDsArray[$CatParent][$i]][$x].')</font></td></tr></table>';
					
					}
					
					
					if (count($CategoryIDsArray[$CatParent][$i]) > 0) {
						SpiderCategories2($CategoryIDsArray[$CatParent][$i]);
					}
				
				}
				
				
			}
			
			
			
			
			$LastParent = '';
			$LastParentAbove = '0';
			$CatSpacersArray = '';
			$CatLevel['0'] = 0;
			$CatsCount = '';
			
			SpiderCategories2('0');
			
				
			
			
			$DisplayList = $CatsPrint;
			
			
		
		
		
		/*
		$DisplayList .= '<b><br>
			<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="ModulesList-core" value="y"'.$ModuleSelected['core'].'>&nbsp;'.$MsgText[0][569].'
			<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="ModulesList-cl" value="y"'.$ModuleSelected['cl'].'>&nbsp;'.$MsgText[1][1].'
			<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="ModulesList-mb" value="y"'.$ModuleSelected['mb'].'>&nbsp;'.$MsgText[2][1].'
			<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="ModulesList-pg" value="y"'.$ModuleSelected['pg'].'>&nbsp;'.$MsgText[3][1].'
			<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="ModulesList-nl" value="y"'.$ModuleSelected['nl'].'>&nbsp;'.$MsgText[5][1].'
			<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="ModulesList-gb" value="y"'.$ModuleSelected['gb'].'>&nbsp;'.$MsgText[6][1].'
			<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="ModulesList-na" value="y"'.$ModuleSelected['na'].'>&nbsp;'.$MsgText[7][1].'
			<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="ModulesList-lm" value="y"'.$ModuleSelected['lm'].'>&nbsp;'.$MsgText[8][1].'
			<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" name="ModulesList-ec" value="y"'.$ModuleSelected['ec'].'>&nbsp;'.$MsgText[9][1].'			
			</b>';
		*/
		
		
		
		
		
		if ($row['BlockContents'] != '') {
		
		$ItemsArray = explode ('^^^^',$row['BlockContents']);
		
		// first line is used for settings
		if ($ItemsArray[0] != '') {
			list ($ItemSpacer, $Header, $Footer) = explode('%%%',$ItemsArray[0]);
		}
		else {
			$Header = '';
			$Footer = '';
			if ($row['BlockLocation'] == 1 || $row['BlockLocation'] == 2) {
				$ItemSpacer = '<br>';
			}
			else {
				$ItemSpacer = '&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;';
			}
		}
		
		
		for ($g = 1; $g < count($ItemsArray); $g++) {
			list ($Link, $ID, $Title, $Priority, $Image, $MOImage) = explode('%%%',$ItemsArray[$g]);
			$Links[] = $Link;
			$IDs[] = $ID;
			$Titles[] = $Title;
			$Priorities[] = $Priority;
			$Images[] = $Image;
			$MOImages[] = $MOImage;
		}
		
		// sort by name
		for ($g = 0; $g < count($Links); $g++) {
			for ($h = 0; $h < count($Links)-1; $h++) {

				if ($Titles[$h] > $Titles[$h+1]) {
									
					$Swap1 = $Links[$h+1];
					$Swap4 = $IDs[$h+1];
					$Swap2 = $Titles[$h+1];
					$Swap3 = $Priorities[$h+1];
					$Swap5 = $Images[$h+1];
					$Swap6 = $MOImages[$h+1];
															
					$Links[$h+1] = $Links[$h];
					$IDs[$h+1] = $IDs[$h];
					$Titles[$h+1] = $Titles[$h];
					$Priorities[$h+1] = $Priorities[$h];
					$Images[$h+1] = $Images[$h];
					$MOImages[$h+1] = $MOImages[$h];
															
					$Links[$h] = $Swap1;
					$IDs[$h] = $Swap4;
					$Titles[$h] = $Swap2;
					$Priorities[$h] = $Swap3;
					$Images[$h] = $Swap5;
					$MOImages[$h] = $Swap6;
													
				}
								
			}
		}
		
		// then re-sort by priority
		for ($g = 0; $g < count($Links); $g++) {
			for ($h = 0; $h < count($Links)-1; $h++) {

				if ($Priorities[$h] > $Priorities[$h+1]) {
									
					$Swap1 = $Links[$h+1];
					$Swap4 = $IDs[$h+1];
					$Swap2 = $Titles[$h+1];
					$Swap3 = $Priorities[$h+1];
					$Swap5 = $Images[$h+1];
					$Swap6 = $MOImages[$h+1];
															
					$Links[$h+1] = $Links[$h];
					$IDs[$h+1] = $IDs[$h];
					$Titles[$h+1] = $Titles[$h];
					$Priorities[$h+1] = $Priorities[$h];
					$Images[$h+1] = $Images[$h];
					$MOImages[$h+1] = $MOImages[$h];
															
					$Links[$h] = $Swap1;
					$IDs[$h] = $Swap4;
					$Titles[$h] = $Swap2;
					$Priorities[$h] = $Swap3;
					$Images[$h] = $Swap5;
					$MOImages[$h] = $Swap6;
													
				}
								
			}
		}
		
							
		$BGColor = '#f1f1f1';
							
		for ($g = 0; $g < count($Links); $g++) {
		
			if ($g == 0) {
				$JSArray1 = '"'.$Links[$g].'"';
				$JSArray2 = '"'.$Titles[$g].'"';
				$JSArray3 = '"'.$Priorities[$g].'"';
				$JSArray4 = '"'.$IDs[$g].'"';
				$JSArray6 = '"'.$Images[$g].'"';
				$JSArray7 = '"'.$MOImages[$g].'"';
			}
			else {
				$JSArray1 .= ',"'.$Links[$g].'"';
				$JSArray2 .= ',"'.$Titles[$g].'"';
				$JSArray3 .= ',"'.$Priorities[$g].'"';
				$JSArray4 .= ',"'.$IDs[$g].'"';
				$JSArray6 .= ',"'.$Images[$g].'"';
				$JSArray7 .= ',"'.$MOImages[$g].'"';
			}
		
			
			if ($BGColor == '#f1f1f1') {
				$BGColor = '#ffffff';
			}
			else {
				$BGColor = '#f1f1f1';
			} 
			
			
			if ($Links[$g] != '') {
				$LinkPrint = $Links[$g];			
			}
			else {
				if ($IDs[$g] != '') {
					$LinkPrint = '['.$IDs[$g].']';
				}
				else {
					$LinkPrint = '';
				}
			}
			
			
			$ItemsBlock .= '
				<tr bgcolor="'.$BGColor.'">
				<td><font face="'.$FontFace.'" size="2" color="#222222">'.$LinkPrint.'</td>
				<td><font face="'.$FontFace.'" size="2" color="#222222">'.$Titles[$g].'&nbsp;</td>
			    <td align="center"><font face="'.$FontFace.'" size="2" color="#222222">'.$Priorities[$g].'&nbsp;</td>
				<td align="center"><font face="'.$FontFace.'" size="2" color="#222222"><a href="javascript:EditItem('.$g.')"><font color="#222222">'.$MsgText[0][155].'</a></td>
				<td align="center"><font face="'.$FontFace.'" size="2" color="#222222"><a href="javascript:DeleteItem('.$g.')"><font color="#222222">'.$MsgText[0][156].'</a></td>
				</tr>';
								
	
		} // end loop
		
		} // end if not empty in the db
		else {
			$ItemsBlock = '<tr><td colspan="5"><font face="'.$FontFace.'" size="2" color="#222222">'.$MsgText[0][195].'</td></tr>';
		}
				
		
		$ItemSpacer = str_replace('&','&#38;',$ItemSpacer);
		$Header = str_replace('&','&#38;',$Header);
		$Footer = str_replace('&','&#38;',$Footer);
		
		$ItemSpacer = str_replace('"','&#34;',$ItemSpacer);
		$Header = str_replace('"','&#34;',$Header);
		$Footer = str_replace('"','&#34;',$Footer);
		
		
		$PMBStuff = '<input type="hidden" name="BlockContents" value="'.str_replace('"','&#34;',$row['BlockContents']).'"><input type="hidden" name="ReturnToBW" value=""><input type="hidden" name="CreateNewBulk" value=""><br><table width="95%" border="0" cellspacing="0">
    <tr>
      <td bgcolor="#c0c0c0"><table width="100%" border="0" cellpadding="6" cellspacing="0" align="center">
    <tr>
      <td bgcolor="#f6f6f6"><font color="#222222"><b>'.$MsgText[0][196].'</b><br><br><table width="100%" border="0" cellpadding="4" cellspacing="0"><tr>
				<td><font face="'.$FontFace.'" size="2" color="#222222"><b>'.$MsgText[0][197].'</b></td>
				<td><font face="'.$FontFace.'" size="2" color="#222222"><b>'.$MsgText[0][198].'</b></td>
			    <td align="center"><font face="'.$FontFace.'" size="2" color="#222222"><b>'.$MsgText[0][199].'</b></td>
				<td align="center"><font face="'.$FontFace.'" size="2" color="#222222"><b>'.$MsgText[0][155].'</b></td>
				<td align="center"><font face="'.$FontFace.'" size="2" color="#222222"><b>'.$MsgText[0][156].'</b></td>
				</tr>'.$ItemsBlock.'</table>
				
				<input type="hidden" name="CurrentlyBeingEdited" value="-1">

<div align="center"><br><br>
<table align="center" width="75%" border="0" cellspacing="0">
    <tr>
      <td bgcolor="#d1d1d1">
<table width="100%" bgcolor="#ffffff" border="0" cellpadding="5" cellspacing="0">
	<tr><td colspan="2" bgcolor="#f1f1f1"><font size="2" color="#222222"><b>'.$MsgText[0][200].':</b></font><br></td></tr>
    <tr>
      <td width="25%"><font face="'.$FontFace.'" size="2" color="#222222"><b>Link</b></td>
      <td><font size="2" color="#222222">'.$MsgText[0][201].':<br><input type="text" name="Link" size="40"><br>'.$MsgText[0][202].':<br><select name="LinkDropdown">'.$LinkDropdown.'</select><br><font size="1" color="#222222">'.$MsgText[0][203].'</font></td>
    </tr>
	<tr>
      <td bgcolor="#ffffff"><font face="'.$FontFace.'" size="2" color="#222222"><b>'.$MsgText[0][198].'</b></td>
      <td bgcolor="#ffffff"><input type="text" name="Title" size="40"><br><font size="1" color="#222222">'.$MsgText[0][204].'</font></td>
    </tr>
	<tr>
      <td bgcolor="#ffffff"><font face="'.$FontFace.'" size="2" color="#222222"><b>'.$MsgText[0][218].'</b><br><font size="1">('.$MsgText[0][418].')</font></td>
      <td bgcolor="#ffffff"><script>
	  
	  var ExistingImagesWindowCode = "";
	  var UploadWindowCode = "";
	  
	  function SelectFromServerBW() {

		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";

		ExistingImagesWindowCode = window.open("'.$BaseURL.'/inc-core-admin-editor-existingimages.php?"+document.forms["PostForm"].elements["Image"].value+"/bw","existingimages",WindowProperties);

	  }
	  
	  function ExistingImageSelectedBW(ImageName,ImageWidth,ImageHeight) {

		ExistingImagesWindowCode.close();
	
		document.forms["PostForm"].elements["Image"].value = ImageName;
	
	  }
	  
	  function UploadToServerBW() {

		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?/bw","imageupload",WindowProperties);

	  }

	  function UploadedImageSelectedBW(ImageName,ImageWidth,ImageHeight) {

		UploadWindowCode.close();
	
		document.forms["PostForm"].elements["Image"].value = ImageName;
		
	  }
	  
	  </script><input type="text" name="Image" size="40"><br><input type="button" value="'.$MsgText[0][562].'" onClick="SelectFromServerBW();">&nbsp;<input type="button" value="'.$MsgText[0][563].'" onClick="UploadToServerBW();"></td>
    </tr>
	<tr>
      <td bgcolor="#ffffff"><font face="'.$FontFace.'" size="2" color="#222222"><b>'.$MsgText[0][646].'</b><br><font size="1">('.$MsgText[0][418].')</font></td>
      <td bgcolor="#ffffff"><script>
	  
	  var ExistingImagesWindowCode = "";
	  var UploadWindowCode = "";
	  
	  function SelectFromServerBW2() {

		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";

		ExistingImagesWindowCode = window.open("'.$BaseURL.'/inc-core-admin-editor-existingimages.php?"+document.forms["PostForm"].elements["Image2"].value+"/bw2","existingimages",WindowProperties);

	  }
	  
	  function ExistingImageSelectedBW2(ImageName,ImageWidth,ImageHeight) {

		ExistingImagesWindowCode.close();
	
		document.forms["PostForm"].elements["Image2"].value = ImageName;
	
	  }
	  
	  function UploadToServerBW2() {

		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?/bw2","imageupload",WindowProperties);

	  }

	  function UploadedImageSelectedBW2(ImageName,ImageWidth,ImageHeight) {

		UploadWindowCode.close();
	
		document.forms["PostForm"].elements["Image2"].value = ImageName;
		
	  }
	  
	  
	  function CreateBulkLinks() {

		document.forms["PostForm"].elements["ReturnToBW"].value = "y";
		document.forms["PostForm"].elements["CreateNewBulk"].value = "y";
		document.forms["PostForm"].submit();

	  }
	  
	  </script><input type="text" name="Image2" size="40"><br><input type="button" value="'.$MsgText[0][562].'" onClick="SelectFromServerBW2();">&nbsp;<input type="button" value="'.$MsgText[0][563].'" onClick="UploadToServerBW2();"></td>
    </tr>
	<tr>
      <td><font face="'.$FontFace.'" size="2" color="#222222"><b>'.$MsgText[0][199].'</b></td>
      <td><input type="text" name="Priority" size="5"><br><font size="1" color="#222222">'.$MsgText[0][205].'</td>
    </tr>
	<tr>
	<td colspan="2" bgcolor="#f1f1f1"><div align="center"><input type="button" value="'.$MsgText[0][206].'" onClick="SaveChanges();">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="'.$MsgText[0][207].'" onClick="SaveAsNew();"></div></td>	
	</tr>
</table>
</td>
    </tr>
</table></div>	


<div align="center"><br><br>
<table align="center" width="75%" border="0" cellspacing="0">
    <tr>
      <td bgcolor="#d1d1d1">
<table width="100%" bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
	<tr><td bgcolor="#f1f1f1"><font size="2" color="#222222"><b>Create New Bulk Links:</b></font><br></td></tr>
  	<tr>
      <td><font face="'.$FontFace.'" size="2" color="#222222"><b>Select the pages and/or modules you wish to create links for.  Selecting a page category will create links for all the pages contained directly within that category (single level only, not other categories below it).<br>'.$DisplayList.'<br><br><input type="hidden" name="LargestPageID" value="'.$LargestPageID.'">
<input type="hidden" name="LargestPageCatID" value="'.$LargestPageCatID.'"></b></td>
    </tr>
	<tr>
	<td bgcolor="#f1f1f1"><div align="center"><input type="button" value="Create New Bulk Links" onClick="CreateBulkLinks();"></div></td>	
	</tr>
</table>
</td>
    </tr>
</table></div>	

				
	<div align="center"><br><br>
<table align="center" width="75%" border="0" cellspacing="0">
    <tr>
      <td bgcolor="#d1d1d1">
<table width="100%" bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
	<tr><td colspan="2" bgcolor="#f1f1f1"><font size="2" color="#222222"><b>'.$MsgText[0][208].':</b></font><br></td></tr>
    <tr>
      <td width="25%"><font face="'.$FontFace.'" size="2" color="#222222"><b>'.$MsgText[0][209].'</b></td>
      <td><input type="text" name="Spacer" size="25" value="'.$ItemSpacer.'"><br><font size="1" color="#222222">'.$MsgText[0][210].'</td>
    </tr>
	<tr>
      <td bgcolor="#ffffff"><font face="'.$FontFace.'" size="2" color="#222222"><b>'.$MsgText[0][211].'</b></td>
      <td bgcolor="#ffffff"><input type="text" name="Header" size="25" value="'.$Header.'"><br><font size="1" color="#222222">'.$MsgText[0][212].'</font></td>
    </tr>
	<tr>
      <td><font face="'.$FontFace.'" size="2" color="#222222"><b>'.$MsgText[0][213].'</b></td>
      <td><input type="text" name="Footer" size="25" value="'.$Footer.'"><br><font size="1" color="#222222">'.$MsgText[0][214].'</td>
    </tr>
		<tr>
	<td colspan="2" bgcolor="#f1f1f1"><div align="center"><input type="button" value="'.$MsgText[0][123].'" onClick="SaveSettings();"></div></td>	
	</tr>
</table>
</td>
    </tr>
</table></div>
	
	</td>
    </tr>
</table>
</td>
    </tr>
</table><br><script language="JavaScript">

var Links = new Array('.$JSArray1.');
var Titles = new Array('.$JSArray2.');
var Priorities = new Array('.$JSArray3.');
var IDs = new Array('.$JSArray4.');
var Images = new Array('.$JSArray6.');
var MOImages = new Array('.$JSArray7.');

var ExistingItems = new Array('.$JSArray5.');

var LineOne = "'.str_replace('"','\\"',$ItemsArray[0]).'";
var Spacer = "'.str_replace('"','\\"',$ItemSpacer).'";
var Header = "'.str_replace('"','\\"',$Header).'";
var Footer = "'.str_replace('"','\\"',$Footer).'";


function EditItem(ItemNumber) {

	ArrayPosition = ItemNumber;

	document.forms["PostForm"].elements["Title"].value = Titles[ArrayPosition];
	document.forms["PostForm"].elements["Link"].value = Links[ArrayPosition];
	document.forms["PostForm"].elements["LinkDropdown"].value = IDs[ArrayPosition];
	document.forms["PostForm"].elements["Priority"].value = Priorities[ArrayPosition];
	document.forms["PostForm"].elements["Image"].value = Images[ArrayPosition];
	document.forms["PostForm"].elements["Image2"].value = MOImages[ArrayPosition];
	
	document.forms["PostForm"].elements["CurrentlyBeingEdited"].value = ArrayPosition;

}
function SaveChanges() {

	ArrayPosition = document.forms["PostForm"].elements["CurrentlyBeingEdited"].value;
	if (ArrayPosition >= 0) {
	
		if (document.forms["PostForm"].elements["Title"].value != Titles[ArrayPosition] || document.forms["PostForm"].elements["Link"].value != Links[ArrayPosition] || document.forms["PostForm"].elements["LinkDropdown"].value != IDs[ArrayPosition] || document.forms["PostForm"].elements["Priority"].value != Priorities[ArrayPosition] || document.forms["PostForm"].elements["Image"].value != Images[ArrayPosition] || document.forms["PostForm"].elements["Image2"].value != MOImages[ArrayPosition]) {


			Titles[ArrayPosition] = document.forms["PostForm"].elements["Title"].value;
			Links[ArrayPosition] = document.forms["PostForm"].elements["Link"].value;
			IDs[ArrayPosition] = document.forms["PostForm"].elements["LinkDropdown"].value;
			Priorities[ArrayPosition] = document.forms["PostForm"].elements["Priority"].value;
			Images[ArrayPosition] = document.forms["PostForm"].elements["Image"].value;
			MOImages[ArrayPosition] = document.forms["PostForm"].elements["Image2"].value;
			
			if (Priorities[ArrayPosition] == "") { Priorities[ArrayPosition] = 0; }
			
			
			if (Links[ArrayPosition] != "") {
				for (i = 0; i < ExistingItems.length; ++i) {
			
					if (ExistingItems[i] == Links[ArrayPosition]) {
					
						Links[ArrayPosition] = "";
						IDs[ArrayPosition] = ExistingItems[i];
						
						// break the loop
						i = ExistingItems.length;
					
					}
				}
			}

			var FinalBlockContents = LineOne;
		
			for (i = 0; i < Titles.length; ++i) {
			
				if ((Titles[i] != \'\' && Titles[i] != \'undefined\') || (Images[i] != \'\' && Images[i] != \'undefined\')) {
			
					FinalBlockContents = FinalBlockContents + \'^^^^\' + Links[i] + \'%%%\' + IDs[i] + \'%%%\' + Titles[i] + \'%%%\' + Priorities[i] + \'%%%\' + Images[i] + \'%%%\' + MOImages[i];
			
				}
		
			}
		
			document.forms["PostForm"].elements["BlockContents"].value = FinalBlockContents;
			document.forms["PostForm"].elements["ReturnToBW"].value = "y";
			document.forms["PostForm"].submit();

		}
		else {
		
			document.forms["PostForm"].elements["Title"].value = "";
			document.forms["PostForm"].elements["Link"].value = "";
			document.forms["PostForm"].elements["LinkDropdown"].value = "";
			document.forms["PostForm"].elements["Priority"].value = "";
			document.forms["PostForm"].elements["Image"].value = "";
			document.forms["PostForm"].elements["Image2"].value = "";
	
			document.forms["PostForm"].elements["CurrentlyBeingEdited"].value = "-1";
	
		}
	} // end if changing an existing one
	else {
	// creating a new one
	
		ArrayPosition = Titles.length;
	
		if ((document.forms["PostForm"].elements["Title"].value == "" || (document.forms["PostForm"].elements["Link"].value == "" && document.forms["PostForm"].elements["LinkDropdown"].value == "")) && document.forms["PostForm"].elements["Image"].value == "" && document.forms["PostForm"].elements["Image2"].value == "") {
	
			alert("'.$MsgText[0][215].'");
	
		}
		else {
	
			Titles[ArrayPosition] = document.forms["PostForm"].elements["Title"].value;
			Links[ArrayPosition] = document.forms["PostForm"].elements["Link"].value;
			IDs[ArrayPosition] = document.forms["PostForm"].elements["LinkDropdown"].value;
			Priorities[ArrayPosition] = document.forms["PostForm"].elements["Priority"].value;
			Images[ArrayPosition] = document.forms["PostForm"].elements["Image"].value;
			MOImages[ArrayPosition] = document.forms["PostForm"].elements["Image2"].value;
			
			if (Priorities[ArrayPosition] == "") { Priorities[ArrayPosition] = 0; }
			
			
			if (Links[ArrayPosition] != "") {
				for (i = 0; i < ExistingItems.length; ++i) {
			
					if (ExistingItems[i] == Links[ArrayPosition]) {
					
						Links[ArrayPosition] = "";
						IDs[ArrayPosition] = ExistingItems[i];
						
						// break the loop
						i = ExistingItems.length;
					
					}			
				}
			}
			
	
			var FinalBlockContents = LineOne;
		
			for (i = 0; i < Titles.length; ++i) {
				
				if ((Titles[i] != \'\' && Titles[i] != \'undefined\') || (Images[i] != \'\' && Images[i] != \'undefined\')) {
			
					FinalBlockContents = FinalBlockContents + \'^^^^\' + Links[i] + \'%%%\' + IDs[i] + \'%%%\' + Titles[i] + \'%%%\' + Priorities[i] + \'%%%\' + Images[i] + \'%%%\' + MOImages[i];
			
				}
		
			}
			
			document.forms["PostForm"].elements["BlockContents"].value = FinalBlockContents;
			document.forms["PostForm"].elements["ReturnToBW"].value = "y";
			document.forms["PostForm"].submit();
		}
	
	}

}
function SaveAsNew() {

	ArrayPosition = Titles.length;
	
	if ((document.forms["PostForm"].elements["Title"].value == "" || (document.forms["PostForm"].elements["Link"].value == "" && document.forms["PostForm"].elements["LinkDropdown"].value == "")) && document.forms["PostForm"].elements["Image"].value == "" && document.forms["PostForm"].elements["Image2"].value == "") {
	
		alert("'.$MsgText[0][215].'");
	
	}
	else {
	
		Titles[ArrayPosition] = document.forms["PostForm"].elements["Title"].value;
		Links[ArrayPosition] = document.forms["PostForm"].elements["Link"].value;
		IDs[ArrayPosition] = document.forms["PostForm"].elements["LinkDropdown"].value;
		Priorities[ArrayPosition] = document.forms["PostForm"].elements["Priority"].value;
		Images[ArrayPosition] = document.forms["PostForm"].elements["Image"].value;
		MOImages[ArrayPosition] = document.forms["PostForm"].elements["Image2"].value;
		
		if (Priorities[ArrayPosition] == "") { Priorities[ArrayPosition] = 0; }
		
		
		if (Links[ArrayPosition] != "") {
			for (i = 0; i < ExistingItems.length; ++i) {
			
				if (ExistingItems[i] == Links[ArrayPosition]) {
					
					Links[ArrayPosition] = "";
					IDs[ArrayPosition] = ExistingItems[i];
					
					// break the loop
					i = ExistingItems.length;
					
				}			
			}
		}
		

		var FinalBlockContents = LineOne;
		
		for (i = 0; i < Titles.length; ++i) {
				
			if ((Titles[i] != \'\' && Titles[i] != \'undefined\') || (Images[i] != \'\' && Images[i] != \'undefined\')) {
			
				FinalBlockContents = FinalBlockContents + \'^^^^\' + Links[i] + \'%%%\' + IDs[i] + \'%%%\' + Titles[i] + \'%%%\' + Priorities[i] + \'%%%\' + Images[i] + \'%%%\' + MOImages[i];
			
			}
		
		}
			
		document.forms["PostForm"].elements["BlockContents"].value = FinalBlockContents;
		document.forms["PostForm"].elements["ReturnToBW"].value = "y";
		document.forms["PostForm"].submit();
	}

}
function DeleteItem(ItemNumber) {

	var ArrayPosition = ItemNumber;

	var ConfirmDelete = confirm("'.$MsgText[0][216].'");
	
	if (ConfirmDelete == true) {
		
		Titles[ArrayPosition] = "";
		Links[ArrayPosition] = "";
		IDs[ArrayPosition] = "";
		Priorities[ArrayPosition] = "";
		Images[ArrayPosition] = "";
		MOImages[ArrayPosition] = "";
		
		
		var FinalBlockContents = LineOne;
	
		for (i = 0; i < Titles.length; ++i) {
				
			if ((Titles[i] != \'\' && Titles[i] != \'undefined\') || (Images[i] != \'\' && Images[i] != \'undefined\')) {
			
				FinalBlockContents = FinalBlockContents + \'^^^^\' + Links[i] + \'%%%\' + IDs[i] + \'%%%\' + Titles[i] + \'%%%\' + Priorities[i] + \'%%%\' + Images[i] + \'%%%\' + MOImages[i];
			
			}
		
		}
			
		document.forms["PostForm"].elements["BlockContents"].value = FinalBlockContents;
		document.forms["PostForm"].elements["ReturnToBW"].value = "y";
		document.forms["PostForm"].submit();
	
	}

}
function SaveSettings() {

	var FinalBlockContents = document.forms["PostForm"].elements["Spacer"].value + \'%%%\' + document.forms["PostForm"].elements["Header"].value + \'%%%\' + document.forms["PostForm"].elements["Footer"].value;
		
	for (i = 0; i < Titles.length; ++i) {
				
		if ((Titles[i] != \'\' && Titles[i] != \'undefined\') || (Images[i] != \'\' && Images[i] != \'undefined\')) {
		
			FinalBlockContents = FinalBlockContents + \'^^^^\' + Links[i] + \'%%%\' + IDs[i] + \'%%%\' + Titles[i] + \'%%%\' + Priorities[i] + \'%%%\' + Images[i] + \'%%%\' + MOImages[i];
		
		}
	
	}
			
	document.forms["PostForm"].elements["BlockContents"].value = FinalBlockContents;
	document.forms["PostForm"].elements["ReturnToBW"].value = "y";
	document.forms["PostForm"].submit();


}

</script>';


?>

