<?php
/**
* swmenumaker v1.0
* http://swonline.biz
* Copyright 2006 Sean White
**/

// ensure this file is being included by a parent file
defined( '_JEXEC' ) or die( 'Restricted access' );

class HTML_swmenumaker
{
	function showMenus( &$rows, $option, $pageNav,$lists,$menus,$tabid )
	{
		global $mosConfig_absolute_path;
	?> 
	
	
<script type="text/javascript">
<!--

function menudelete(title){
	
if (title=="mainmenu"){
	
	alert("<?php echo _SWMAK_MAINMENU_DELETE_ALERT; ?>");
}else if (confirm("<?php echo _SWMAK_DELETE_ALERT_1; ?> " + title + " <?php echo _SWMAK_DELETE_ALERT_2; ?> ")){	
	form=document.adminForm;
	form.menuname.value=title;
	form.task.value="removemenu";
	//form.id.value=id;
	setTimeout('form.submit()',200) ;
}

}

function menuEdit(title){

	form=document.adminForm;
	form.task.value="menuEdit";
	form.menuname.value=title;
	setTimeout('form.submit()',200) ;
	
}

function menuCopy(title){

	form=document.adminForm;
	form.task.value="menuEdit";
	form.menuname.value=title;
	form.copymenu.value=1;
	setTimeout('form.submit()',200) ;
	
	
}
function newmenu(){
//alert("hello");
	form=document.adminForm;
	form.task.value="menuEdit";
	//form.menuname.value=title;
	form.newmenu2.value="1";
	setTimeout('form.submit()',200) ;
}

		
-->
</script>
	
	<link rel="stylesheet" href="components/com_swmenumaker/css/swmenumaker.css" type="text/css" />

<div class="swmenu_container" >

		
 <table align="left" cellpadding="4" cellspacing="4" border="0" width="750">
  <tr>
     <td width="10%"><img src="components/com_swmenumaker/images/swmenumaker_logo_small.gif" align="left" alt="swmenumaker" border="0"/></td>
     <td valign="bottom"><span class="swmenu_sectionname"><?php echo _SWMAK_PRO_EDITION; ?></span> </td>
     
   </tr>
</table>

    <form action="index2.php" method="POST" name="adminForm">
        
 <div style="clear:both;"></div>
    
    <table align="left" cellpadding="3" cellspacing="0" border="0" width="100%" >
 <tr><td width="450" valign="top">
 
    <table cellpadding="2" cellspacing="0" border="0" width="100%" align="left"> 
     <tr><td colspan="3" class="swmenu_tabheading"><?php echo _SWMAK_MENU_LABEL; ?></td><td colspan="3" align="right" class="swmenu_tabheading" ></td>   </tr>
      <?php
      $k = 0;
      for ($i=0, $n=count($menus); $i < $n; $i++)
      {
      	$row = &$menus[$i];
      	
	?> 
      <tr class="swmenu_row<?PHP echo $k; ?>"> 
         <td width="10"><?php echo $i+$pageNav->limitstart+1;?></td>
        <td><input type="checkbox" id="cb<?PHP echo $i; ?>" name="cid[]" value="<?PHP echo $row->id; ?>"  /></td> 
        <td width="300"><div align="left"> <a href="javascript:void(0);" onmouseover="this.T_WIDTH=180;return escape('<?php echo sprintf (_SWMAK_MENU_INFO_TIP,addslashes($row->published),addslashes($row->unpublished),addslashes($row->trash),addslashes($row->modules)); ?>')" onclick="menuEdit('<?PHP echo $row->type; ?>')"><?PHP echo $row->type; ?></a></div></td> 
        <td align="right">
       
          <?PHP 
          
          	echo "<a href=\"javascript:void(0)\" class=\"swmenu_button_edit\" onmouseover=\"return escape('".sprintf (_SWMAK_EDIT_TIP,addslashes($row->type))."')\" onclick=\"menuEdit('".$row->type."')\">"._SWMAK_EDIT."</a></td><td>\n";
            echo "<a href=\"javascript:void(0)\" class=\"swmenu_button_export\" onmouseover=\"return escape('".sprintf (_SWMAK_COPY_TIP,addslashes($row->type))."')\" onclick=\"menuCopy('".$row->type."')\">"._SWMAK_COPY."</a></td><td>\n";
           	echo "<a href=\"javascript:void(0)\" class=\"swmenu_button_delete\" onmouseover=\"return escape('".sprintf (_SWMAK_DELETE_TIP,addslashes($row->type))."')\" onclick=\"menudelete('".$row->type."')\">"._SWMAK_DELETE."</a>\n";
          
		?> 
		</td> 
      </tr> 
      <?PHP 
      $k = 1 - $k;
      }
?> 


<tr> 
        <td class="swmenu_pagination" align="center" colspan="6" style="text-align:center;"> <?php echo $pageNav->getListFooter(); ?></td> 
      </tr> 
      
    </table> 
    </td><td width="300" valign="top">
    
    
     <table cellpadding="0" width="100%" cellspacing="0" class="swmenu_table" border="0">
   <tr><td class="swmenu_tabheading"><?PHP echo _SWMAK_CREATE_NEW_LABEL; ?></td></tr>
   <tr><td>
    <a href="javascript:void(0);" onmouseover="return escape('<?PHP echo _SWMAK_SELECT_TOP_TIP; ?>')" >
	 <img src="components/com_swmenumaker/images/info.png" alt="info" align="middle" name="info" border="0" /></a>
  <?php echo _SWMAK_SELECT_TOP_LABEL; ?>
   </td></tr>
   
   <tr><td align="center"><?php echo $lists['category']; ?></td></tr>

   <tr><td><br />
   <a href="javascript:void(0);" onmouseover="return escape('<?PHP echo _SWMAK_BLOG_TABLE_TIP; ?>')" >
	 <img src="components/com_swmenumaker/images/info.png" alt="info" align="middle" name="info" border="0" /></a>
	
   <?php echo $lists['usetables']; ?></td></tr>
<tr><td align="center"><br />
<a href="javascript:void(0);" class="swmenu_button_wide_create" onmouseover="return escape('<?PHP echo _SWMAK_CREATE_NEW_TIP; ?>');" onclick="javascript:newmenu('2');">
   <?PHP echo _SWMAK_CREATE_NEW_BUTTON; ?>     
</a>

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

    <input type="hidden" name="option" value="com_swmenumaker" />
    <input type="hidden" name="task" value="showmenus" />
    <input type="hidden" name="Itemid" value="<?PHP echo $Itemid; ?>" />
   
    <input type="hidden" name="do" value="1" />
    <input type="hidden" name="option" value="<?PHP echo $option; ?>" /> 
    <input type="hidden" name="boxchecked" value="" /> 
    <input type="hidden" name="id" value="0" /> 
    <input type="hidden" name="menuname" value="" /> 
     <input type="hidden" name="module" value="1" /> 
     <input type="hidden" name="newmenu2" value="0" />
     
 <input type="hidden" name="copymenu" value="0" /> 
        <input type="hidden" name="tabid" value="tab2" /> 
 
   
    </form>
    </div>
   
    
  <br />
 <div style="clear:both;"></div>
  <script language="JavaScript" type="text/javascript" src="components/com_swmenumaker/js/wz_tooltip.js"></script> 
 
  <?php
	}






	function footer()
	{
	?> 
	<br clear="all" />
    <table cellpadding="4" cellspacing="0" border="0" align="center" width="100%"> 
      <tr> 
        <td width="100%" align="center">
		<a href="http://www.swmenupro.com" target="_blank">	
		<img src="components/com_swmenumaker/images/swmenupro_footer.png" alt="swmenupro.com" border="0"/>
		</a><br/> swMenuMaker &copy;2007 by Sean White<br />
		 <a href="http://www.swmenupro.com" target="_blank">http://www.swmenupro.com</a>
		</td> 
        </tr> 
    </table> 
   
  <?php
	}


	function makeMenu( &$rows, $option, $menu_id, $menu, $sample, $limit, $limitstart, $lists, $username,$new,$copy,$orders3 )
	{
		global $Itemid;


		$ordered=$rows;
		//echo $menu->name;
?>


<script language="javascript" type="text/javascript">
		<!--
		
		



var originalOrder2 = '';
var originalPos2 = '';
var orders2 = new Array();	// array in the format [key,value,text]
<?php	$i = 0;
foreach ($orders3 as $k=>$items) {
	foreach ($items as $v) {
		echo "\n	orders2[".$i++."] = new Array( '$k','$v->value','$v->text' );";
	}
}
?>


		//-->
		</script> 
  <link rel="stylesheet" type="text/css" href="components/com_swmenumaker/mm/DynamicTree.css" />
  <link rel="stylesheet" type="text/css" href="components/com_swmenumaker/css/swmenumaker.css" />
    <script type="text/javascript" src="components/com_swmenumaker/mm/ie5.js"></script>
    <script type="text/javascript" src="components/com_swmenumaker/mm/DynamicTreeBuilder.js"></script>
    <script type="text/javascript" src="components/com_swmenumaker/mm/plugins.js"></script>
  <div class="swmenu_container" >

		
 <table cellpadding="4" cellspacing="4" border="0" width="750">
  <tr>
     <td width="10%"> <img src="components/com_swmenumaker/images/swmenumaker_logo_small.gif" align="left" alt="swmenumaker" border="0"/> </td>
     <td valign="bottom"><span class="swmenu_sectionname">(Professional Edition)</span> </td>
   </tr>
</table>
  <form name="mm" action="index2.php" method="post" class="adminform" >
  

  

 
  
  <table cellpadding="0" class="swmenu_tabheading" width="100%"><tr><td >
    Menu Name:
<?php
if ($new || $copy){
	echo "<input type=\"text\" name=\"menuname\" id=\"menuname\" value=\"\" />\n";
}else{
	echo $menu;
	echo "<input type=\"hidden\" name=\"menuname\" id=\"menuname\" value=\"". $menu."\" />\n";
	
}
?>
    </td>
    <td align="right">
     <a id="tree-plugin-import-html" href="javascript:void(0)"></a>
            <a id="tree-plugin-export-html" href="javascript:void(0)"></a>
            
            <a href="javascript:void(0);" id="tree-plugin-export-php" class="swmenu_button_export" >Save</a> 
            </td><td>
            <a href="index2.php?option=com_swmenumaker&task=showmenus&limit=<?php echo $limit."&limitstart=".$limitstart; ?>&tabid=tab2" class="swmenu_button_cancel"> 
             Cancel</a>
            <a id="tree-plugin-export-sql" href="javascript:void(0)"></a> 

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

 
*Click on a menu item then use the tabs on the right to edit the menu items properties. Click "Create New" to make new menu items.
 
 <table width="100%" cellpadding="0" cellspacing="0"><tr><td valign="top">
 
 
 

    <table cellspacing="0" cellpadding="0" width="330">
    <tr>
        <td valign="top">

            <div class="DynamicTree" >
                <div class="wrap1" style="float:left" >
                    <div class="top">&nbsp;<b><?php echo $menu; ?></b></div>
                    <div class="wrap2" id="tree" >

 <?php

 $name = "";
 $link = "";
 $counter = 0;
 $doMenu = 1;
// $uniqueID = $swmenumaker['id'];
 $number = count($ordered);

 //echo "<div class=\"".$ordered[$counter]['type']."\" >\n";
 while ($doMenu && $number){

 	if ($ordered[$counter]['indent'] == 0){
 		$hasSub = 0;

 		if (($counter+1 == $number) || ($ordered[$counter+1]['indent'] == 0)){
 			$doSubMenu = 0;
 			//$doMenu = 0;
 			echo "<div class=\"".$ordered[$counter]['TYPE']."\" ><a href=\"".$ordered[$counter]['URL']."\" title=\"".$ordered[$counter]['TITLE']."\" target=\"".$ordered[$counter]['TARGET']."\"> \n";
 			echo $ordered[$counter]['NAME']."</a></div> \n";
 		}else{
 			$doSubMenu = 1;
 			echo "<div class=\"".$ordered[$counter]['TYPE']."\" ><a href='".$ordered[$counter]['URL']."' title='".$ordered[$counter]['TITLE']."' target='".$ordered[$counter]['TARGET']."'>\n";
 			echo $ordered[$counter]['NAME']."</a> \n";
 		}

 		$counter++;

 		while($doSubMenu){


 			if ($counter+1 == $number){
 				$doSubMenu = 0;
 				$doMenu = 0;
 				echo "<div class=\"".$ordered[$counter]['TYPE']."\" ><a href='".$ordered[$counter]['URL']."' title='".$ordered[$counter]['TITLE']."' target='".$ordered[$counter]['TARGET']."'> \n";
 				echo $ordered[$counter]['NAME']."</a></div> \n";
 				echo str_repeat("</div> \n",($ordered[$counter]['indent']-$ordered[$counter+1]['indent']));
 			}elseif ($ordered[$counter]['indent'] < $ordered[$counter + 1]['indent']){
 				echo "<div class=\"".$ordered[$counter]['TYPE']."\" ><a href='".$ordered[$counter]['URL']."' title='".$ordered[$counter]['TITLE']."' target='".$ordered[$counter]['TARGET']."'>".$ordered[$counter]['NAME']."\n";
 				echo "</a>\n";
 			}elseif ($ordered[$counter]['indent'] == $ordered[$counter + 1]['indent']){
 				echo "<div class=\"".$ordered[$counter]['TYPE']."\" ><a href='".$ordered[$counter]['URL']."' title='".$ordered[$counter]['TITLE']."' target='".$ordered[$counter]['TARGET']."'> \n";
 				echo $ordered[$counter]['NAME']."</a></div>";
 				// echo str_repeat("</div> \n",($ordered[$counter+1]['indent']+1));
 			}else{
 				echo "<div class=\"".$ordered[$counter]['TYPE']."\" ><a href='".$ordered[$counter]['URL']."' title='".$ordered[$counter]['TITLE']."' target='".$ordered[$counter]['TARGET']."'> \n";
 				echo $ordered[$counter]['NAME']."</a></div>";
 				echo str_repeat("</div> \n",($ordered[$counter]['indent']-$ordered[$counter+1]['indent']));
 			}
 			if (($counter+1 == $number) || ($ordered[$counter+1]['indent'] == 0)){
 				$doSubMenu = 0;
 			}


 			$counter++;
 			$hasSub++;

 		}

 		//  if ($hasSub > 0){echo str_repeat("</div> \n",($ordered[$counter-1]['indent']));}
 	}
 	if ($counter == ($number)){ $doMenu = 0;}

 }
?>
</div>
                    </div>
               </div>

        </td>
        <td valign="top">


        </td>

        <td valign="top">

            <div id="tree-plugin">

                <b id="tree-plugin-header"></b> <br />
                <textarea id="tree-plugin-textarea" cols="50" rows="10" style="display:none;"></textarea><br />
                <input id="tree-plugin-button-import-html" style="display:none;" type="button" value="Import" />

            </div>

        </td>

    </tr>
    </table>
    
</td><td valign="top">


<table width="400"><tr><td>

 
 <table cellpadding="0" cellspacing="0" border="0" width="100%" height="35" width="300">
          <tr>
           <td id="tab1" class="swmenu_offtab2" onclick="dhtml.cycleTab(this.id)">Edit <br />Item</td>
           <td id="tab4" class="swmenu_offtab2" onclick="dhtml.cycleTab(this.id)">Move <br />Item</td>
            <td id="tab2" class="swmenu_offtab2" onclick="dhtml.cycleTab(this.id)">Item <br />Params</td>
            <td id="tab3" class="swmenu_offtab2" onclick="dhtml.cycleTab(this.id)">Create <br />New</td>
             



          </tr>
        </table>
        

 <div id="tree-insert-form">
   <div id="page3" class="pagetext">
 <div class="swmenu_tabheading" align="right" style="height:5px;">
                              
 </div>
                        <table cellspacing="0" cellpadding="3" width="400">
                        
                        
                        <tr class="swmenu_menubackgr">
                            <td width=70" class="label">Type</td>
                            <td><select id="tree-insert-type" name="tree-insert-type"><option value="doc">Document</option><option value="folder">Folder</option></select></td>
                        </tr>
                        <tr>
                            <td class="label">Name</td>
                            <td><input class="input" size="40" id="tree-insert-name" name="tree-insert-name" type="text" value="" /></td>
                        </tr>
                        
                        
                      
                        <tr class="swmenu_menubackgr">
                            <td class="label">Link Type</td>
                            <td><?php echo $lists['new_linktype']; ?></td>
                            
                            
                          </tr>  <tr><td colspan="2" align="center">
                            <div  id="link_message" align="center"><b>Select Link Type First:</b></div>
                             <script language="javascript" type="text/javascript">
					<!--

	writeDynaList( 'class="inputbox" onchange="update_link(this,\'new\');" name="parentid" id="parentid" size="8" style="width:390px;display:none;"',
							orders2, originalPos2, originalPos2, originalOrder2 );
					//-->
					</script> 
					  
					</td>
                        </tr>
                        <tr class="swmenu_menubackgr">
                            <td class="label">Link</td>
                            <td>
                            <div  id="link_url" align="left">&nbsp</div>
                            <input class="input" size="40" id="tree-insert-href" name="tree-insert-href" type="text" style="display:none;" value="" /></td>
                        </tr>
                         <tr>
                            <td class="label">Target</td>
                            <td><?php echo $lists['new_target']; ?></td>
                        </tr>
                        <tr class="swmenu_menubackgr">
                            <td class="label">Published</td>
                            <td><?php echo $lists['new_published']; ?></td>
                        </tr>
                        <tr>
                            <td class="label">Access</td>
                            <td><?php echo $lists['new_access']; ?></td>
                        </tr>
                        <tr>
                            <td class="swmenu_menubackgr" colspan="2" align="center">
                            
 
 <a href="javascript:void(0);" onclick="treeInsertExecute();" class="swmenu_button_insert" >Insert New Item</a>     
                                
                                <input id="tree-insert-cancel" type="hidden" value="Cancel" />
                            </td>
                        </tr>
                        </table>
                        <input id="tree-insert-where" name="tree-insert-where" value="before" type="hidden" />
                        <input class="input" size="40" id="tree-insert-title" name="tree-insert-href" type="hidden" value="" />
                         <input type="hidden" id="menutype" name="menutype" value="<?php echo $menu; ?>" />
                        <input type="hidden" id="php_out" name="php_out" value="" />
                        <input type="hidden" id="task" name="task" value="makemenu" />
                        <input type="hidden" id="option" name="option" value="com_swmenumaker" />
                        <input type="hidden" id="menu_id" name="menu_id" value="<?php echo $menu_id; ?>" />
                        <input type="hidden" id="Itemid" name="Itemid" value="<?php echo $Itemid; ?>" />
                         <input type="hidden" id="limit" name="limit" value="<?php echo $limit; ?>" />
						 <input type="hidden" id="new" name="new" value="<?php echo $new; ?>" />
						  <input type="hidden" id="copymenu" name="copymenu" value="<?php echo $copy; ?>" />
                         <input type="hidden" id="limitstart" name="limitstart" value="<?php echo $limitstart; ?>" />
                       
                        <?php
                       /*
                         $count=1;
                        foreach($rows as $ordered){
                        	echo "<input type=\"hidden\" value=\"".$ordered['ID']."\" id=\"menuitem".$count."\" name=\"menuitem".$count."\" />\n";
                        	echo "<input type=\"hidden\" value=\"".$ordered['LINKTYPE']."\" id=\"tree-".$count."-linktype\" name=\"tree-".$count."-linktype\" />\n";
                        	echo "<input type=\"hidden\" value=\"".$ordered['PARAMS']."\" id=\"tree-".$count."-params\" name=\"tree-".$count."-params\" />\n";
                        	echo "<input type=\"hidden\" value=\"".$ordered['PUBLISHED']."\" id=\"tree-".$count."-published\" name=\"tree-".$count."-published\" />\n";
                        	echo "<input type=\"hidden\" value=\"".$ordered['ACCESS']."\" id=\"tree-".$count."-access\" name=\"tree-".$count."-access\" />\n";
                        	echo "<input type=\"hidden\" value=\"".$ordered['UTACCESS']."\" id=\"utaccess".$count."\" name=\"utaccess".$count."\" />\n";
                        	echo "<input type=\"hidden\" value=\"".$ordered['COMPID']."\" id=\"compid".$count."\" name=\"compid".$count."\" />\n";

                        	$count++;
                        }
                        */
                   
?>
                   
                     <br />
                </div>
                </div>




                <div id="tree-info-form">
                 <div id="page1" class="pagetext">
 <div class="swmenu_tabheading" align="right" style="height:5px;">

           
          
 </div>
                        <table cellspacing="0" cellpadding="3" width="400">
                         <tr class="swmenu_menubackgr">
                            <td width="70" class="label">Type</td>
                            <td><?php echo $lists['type']; ?></td>
                        </tr>
                        
                        <tr>
                            <td class="label">Name</td>
                            <td><input class="input" size="40" id="tree-info-name" name="tree-info-name" type="text" value=""  /></td>
                        </tr>
                        <tr class="swmenu_menubackgr">
                            <td class="label">Link Type</td>
                            <td><?php echo $lists['linktype']; ?></td>
                        </tr>
                        <tr><td colspan="2" align="center">
                           <div  id="link_exist_message" align="center">Select Link Type First:</div>
                             <script language="javascript" type="text/javascript">
					<!--

	writeDynaList( 'class="inputbox" onchange="update_link(this,\'exist\');" name="existlink" id="existlink" size="8" style="width:390px;display:none;"',
							orders2, originalPos2, originalPos2, originalOrder2 );
					//-->
					</script> 
					  
					</td>
                        </tr>
                        <tr class="swmenu_menubackgr">
                            <td class="label">Link</td>
                            <td>
                            <div  id="link_url2" align="left">&nbsp</div>
                            <input class="input" size="50" id="tree-info-href" name="tree-info-href" type="text" style="display:none"  value="" /></td>
                        </tr>
                        
                        
                        
                        
                        
                        <tr>
                            <td class="label">Target</td>
                            <td><?php echo $lists['target']; ?></td>
                        </tr>
                        <tr  class="swmenu_menubackgr">
                            <td class="label">Published</td>
                            <td><?php echo $lists['published']; ?></td>
                        </tr>
                        <tr>
                            <td class="label">Access</td>
                            <td><?php echo $lists['access']; ?></td>
                        </tr>
                        
                        <tr>
                         <td align="center" class="swmenu_menubackgr" colspan="2">
                         
                         
            <table width="100%" ><tr><td> 
           <a href="javascript:void(0);" onclick="treeInfoUpdate();" class="swmenu_button_update" >Update Menu Item</a>    
           </td><td> 
           <a href="javascript:void(0);" onclick="treeRemove();" class="swmenu_button_delete2" >Delete Menu Item</a>     
           </td></tr><tr><td colspan="2" align="center">
           <div id="update_message" ></div>            
          </td></tr></table>              
          </td>
        </tr>
                       
                        </table>

                                <input id="tree-info-cancel" type="hidden" value="Cancel" />
              <input class="input" size="40" id="tree-info-title" name="tree-info-title" type="hidden" value="" />


                        </div>
</div>

                        <div id="page2" class="pagetext" >
                         <div class="swmenu_tabheading" style="height:5px;">


 </div> 
						<table align="center" cellpadding="3" width="400" class="swmenu_menubackgr"><tr><td align="center">
						 <b>Parameters:</b></td>
						<tr><td align="center">
						<textarea cols="40" rows="15" name="tree-info-params" id="tree-info-params" class="inputbox" ></textarea>
						
						
						</td>
						</tr>
						<tr><td align="center">
							 
							 <a href="javascript:void(0);" onclick="treeInfoUpdate();" class="swmenu_button_update" >Update Menu Item Parameters</a>
           					
						</td></tr><tr><td colspan="2" align="center">
           <div id="update_message2" ></div>            
          </td></tr>
						</table>


                  
               
               </div>
               
                <div id="page4" class="pagetext">
                 <div class="swmenu_tabheading" style="height:5px;">


 </div>
                       <table  cellspacing="0" cellpadding="3" width="400" align="center" class="swmenu_menubackgr">
               <tr><td colspan="3" align="center"><b>Click Arrows to Move Selected Menu Item</b></td></tr>
               <tr><td>&nbsp;</td><td align="center">
                    <a id="tree-moveUp"  href="javascript:void(0)"><img src="components/com_swmenumaker/mm/images/up.png"  alt="" border="0" /></a>
                    </td><td>&nbsp;</td></tr><tr><td align="center">
                    <a id="tree-moveLeft"  href="javascript:void(0)"><img src="components/com_swmenumaker/mm/images/left.png"  alt="" border="0" /></a>
                    </td><td align="center" width="100"><div  id="tree-tooltip" align="center"></div></td><td align="center">
                    <a id="tree-moveRight"  href="javascript:void(0)"><img src="components/com_swmenumaker/mm/images/right.png"  alt="" border="0" /></a>
                    </td></tr><tr><td>&nbsp;</td><td align="center">
                    <a id="tree-moveDown" href="javascript:void(0)"><img src="components/com_swmenumaker/mm/images/down.png"  alt="" border="0" /></a>
                    </td><td>&nbsp;</td></tr>
                                         
                    </table>
                    
                    
        
                    <a id="tree-info"  href="javascript:void(0)"></a>
                     <a id="tree-insert"  href="javascript:void(0)"></a>


                  
               
               </div>
               
               
               
               
  </td></tr></table></td></tr></table>
    </form>
    </div>
    <script type="text/javascript">
    var tree = new DynamicTreeBuilder("tree");
    tree.init();
    DynamicTreePlugins.call(tree);
    //tree.treePluginHide();
    </script>
    <script type="text/javascript" src="components/com_swmenumaker/mm/actions.js"></script>
    <script type="text/javascript">
    <!--
    dhtml.onTabStyle = 'swmenu_ontab2';
    dhtml.offTabStyle = 'swmenu_offtab2';

    dhtml.cycleTab('tab1');


    // treeHideInfo();
    // treeHideInsert();
    -->
</script>


<?php
 $ordered=$rows;    
                echo "<script language=\"javascript\" type=\"text/javascript\"><!--\n";        
                        for($i=0;$i<count($ordered);$i++){
      	echo "var node = tree.allNodes['tree-".($i+1)."'];\n";
      		echo "node.cid='".@$ordered[$i]['ID']."';\n";
      		echo "node.linktype='".(is_null(@$ordered[$i]['LINKTYPE'])?'':$ordered[$i]['LINKTYPE'])."';\n";
      		echo "node.params='".(is_null(@$ordered[$i]['PARAMS'])?'':urlencode($ordered[$i]['PARAMS']))."';\n";
      		echo "node.published='".(is_null(@$ordered[$i]['PUBLISHED'])?'1':$ordered[$i]['PUBLISHED'])."';\n";
      		echo "node.access='".(is_null(@$ordered[$i]['ACCESS'])?'0':$ordered[$i]['ACCESS'])."';\n";
      		echo "node.utaccess='".(is_null(@$ordered[$i]['UTACCESS'])?'0':$ordered[$i]['UTACCESS'])."';\n";
      		echo "node.compid='".(is_null(@$ordered[$i]['COMPID'])?'0':$ordered[$i]['COMPID'])."';\n";
     // 	echo "alert(node.id);";
      	
           	
      }
      echo "//--></script>";
	}








}
?>
