<?php
/*************************************************************
* Mambo Community Builder
* Author MamboJoe
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
*************************************************************/

class HTML_comprofiler {
	function showLists( &$rows, $pageNav, $search, $option ) {
		global $mosConfig_offset;
?>
<form action="index2.php" method="post" name="adminForm">
  <table cellpadding="4" cellspacing="0" border="0" width="100%">
    <tr>
      <td width="100%" class="sectionname"><img src="../components/com_comprofiler/images/cblist.gif" align="middle">List Manager</td>
      <td nowrap="nowrap">Display #</td>
      <td> <?php echo $pageNav->writeLimitBox(); ?> </td>
      <td>Search:</td>
      <td> <input type="text" name="search" value="<?php echo $search;?>" class="inputbox" onChange="document.adminForm.submit();" />
      </td>
    </tr>
  </table>
  <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
    <tr>
      <th width="2%" class="title">#</th>
      <th width="3%" class="title"> <input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count($rows); ?>);" />
      </th>
      <th width="10%" class="title">Title</th>
      <th width="10%" class="title">Description</th>
      <th width="5%" class="title">Published?</th>
      <th width="5%" class="title">Default?</th>
      <th width="5%" class="title" colspan="2">Re-Order</th>
    </tr>
<?php
		$k = 0;
		for ($i=0, $n=count( $rows ); $i < $n; $i++) {
			$row =& $rows[$i];

		        $img3 = $row->published ?  'tick.png' : 'publish_x.png';
		        $task3 = $row->published ?  'listPublishedNo' : 'listPublishedYes';
		        $img4 = $row->default ?  'tick.png' : 'publish_x.png';
			$task4 = $row->default ?  'listDefaultNo' : 'listDefaultYes';
?>
    <tr class="<?php echo "row$k"; ?>">
      <td><?php echo $i+1+$pageNav->limitstart;?></td>
      <td><input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->listid; ?>" onClick="isChecked(this.checked);" /></td>
      <td> <a href="#editList" onClick="return listItemTask('cb<?php echo $i;?>','editList')"><?php echo $row->title; ?></a></td>
      <td><?php echo $row->description; ?></td>
      <td width="10%"><a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>
','<?php echo $task3;?>')"><img src="images/<?php echo $img3;?>" width="12" height="12" border="0" alt="" /></a></td>
      <td width="10%"><a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>
','<?php echo $task4;?>')"><img src="images/<?php echo $img4;?>" width="12" height="12" border="0" alt="" /></a></td>
      <td>
	<?php    if ($i > 0 || ($i+$pageNav->limitstart > 0)) { ?>
         <a href="#reorder" onClick="return listItemTask('cb<?php echo $i;?>','orderupList')">
            <img src="images/uparrow.png" width="12" height="12" border="0" alt="Move Up">
         </a>
	<?php    } ?>
      </td>
      <td>
	<?php    if ($i < $n-1 || $i+$pageNav->limitstart < $pageNav->total-1) { ?>
         <a href="#reorder" onClick="return listItemTask('cb<?php echo $i;?>','orderdownList')">
            <img src="images/downarrow.png" width="12" height="12" border="0" alt="Move Down">
         </a>
	<?php    } ?>
      </td>
    </tr>
    <?php $k = 1 - $k; } ?>
    <tr>
      <th align="center" colspan="9"> <?php echo $pageNav->writePagesLinks(); ?></th>
    </tr>
    <tr>
      <td align="center" colspan="9"> <?php echo $pageNav->writePagesCounter(); ?></td>
    </tr>
  </table>
  <input type="hidden" name="option" value="<?php echo $option;?>" />
  <input type="hidden" name="task" value="showLists" />
  <input type="hidden" name="boxchecked" value="0" />
</form>
<?php }
	function editList( &$row, $lists, $fields, $option, $tabid ) {
		global $my, $acl, $task, $database;
		if($tabid >0) {
			$col1fields=explode('|*|',$row->col1fields);
				for ($i=0, $n=count( $col1fields ); $i < $n; $i++) {
					$col1field =& $col1fields[$i];
					if(trim($col1field)!='' && trim($col1field)!=null) { 
					$col1options .= "<option value=\"".$col1field."\">".getLangDefinition(array_search($col1field,$fields))."\n";
					if($i>0) $fieldids .= ",";
					$fieldids .= "'".$col1field."'";
					}
			}
			$col2fields=explode('|*|',$row->col2fields);
				for ($i=0, $n=count( $col2fields ); $i < $n; $i++) {
					$col2field =& $col2fields[$i];
					if(trim($col2field)!='' && trim($col2field)!=null) { 
					$col2options .= "<option value=\"".$col2field."\">".getLangDefinition(array_search($col2field,$fields))."\n";
						$fieldids .= ",";
						$fieldids .= "'".$col2field."'";
					}
				}
			$col3fields=explode('|*|',$row->col3fields);
				for ($i=0, $n=count( $col3fields ); $i < $n; $i++) {
					$col3field =& $col3fields[$i];
					if(trim($col3field)!='' && trim($col3field)!=null) { 
					$col3options .= "<option value=\"".$col3field."\">".getLangDefinition(array_search($col3field,$fields))."\n";
						$fieldids .= ",";
						$fieldids .= "'".$col3field."'";			
					}
				}
			$col4fields=explode('|*|',$row->col4fields);
				for ($i=0, $n=count( $col4fields ); $i < $n; $i++) {
					$col4field =& $col4fields[$i];
					if(trim($col4field)!='' && trim($col4field)!=null) { 
					$col4options .= "<option value=\"".$col4field."\">".getLangDefinition(array_search($col4field,$fields))."\n";
						$fieldids .= ",";
						$fieldids .= "'".$col4field."'";
					}
			}
			$sqlWhere="\nAND fieldid NOT IN ($fieldids)";
		}
		$database->setQuery( "SELECT f.fieldid, f.title, f.name"
			. "\nFROM #__comprofiler_fields f"
			. "\nWHERE f.published = 1 AND f.profile = 1"
			. $sqlWhere
		);

		$fields = $database->loadObjectList();

$stripME = array(" ASC", " DESC","`");
$WhereIn = str_replace($stripME, "", $row->sortfields);
$WhereIn = "'".str_replace(", ","','",$WhereIn)."'";
$database->setQuery( "SELECT f.title, f.name"
	. "\nFROM #__comprofiler_fields f"
	. "\nWHERE f.published = 1 AND f.profile = 1 AND f.name!='NA'"
	. "\nAND f.name NOT IN(".$WhereIn.")"
);
$sortfields = $database->loadObjectList();



$sortlists=explode(", ",str_replace("`","",$row->sortfields));
$sortparts=array();
$i=0;
foreach($sortlists as $sortlist) {
	$sortlistpart=array();
	$sortlistpart=explode(" ",$sortlist);
	$sortparts[$i][field]=$sortlistpart[0];	
	$sortparts[$i][dir]=$sortlistpart[1];
	$database->setQuery("SELECT title FROM #__comprofiler_fields WHERE name='".$sortlistpart[0]."' LIMIT 1");
	$sortparts[$i][title]=$database->loadResult();
$i++;
}

?>
   <script language="javascript" src="js/dhtml.js"></script>
	<script language="javascript" type="text/javascript">
  <!--
		function submitbutton(pressbutton) {
			if (pressbutton == 'showLists') {
				submitform( pressbutton );
				return;
			}
			var coll = document.adminForm;
			var errorMSG = '';
			var iserror=0;
			if (coll.col1enabled.checked == true) coll.col1title.setAttribute('mosReq',1);
			if (coll.col2enabled.checked == true) coll.col2title.setAttribute('mosReq',1);
			if (coll.col3enabled.checked == true) coll.col3title.setAttribute('mosReq',1);
			if (coll.col4enabled.checked == true) coll.col4title.setAttribute('mosReq',1);
			getSortList(document.adminForm.sort);
		     if (coll != null) {
		       var elements = coll.elements;
		       // loop through all input elements in form
		       for (var i=0; i < elements.length; i++) {
		         // check if element is mandatory; here mosReq=1
		         if (elements.item(i).getAttribute('mosReq') == 1) {
		           if (elements.item(i).value == '') {
		             //alert(elements.item(i).getAttribute('mosLabel') + ':' + elements.item(i).getAttribute('mosReq'));
		             // add up all error messages
		             errorMSG += elements.item(i).getAttribute('mosLabel') + ' <?php echo _UE_REQUIRED_ERROR; ?>\n';
		             // notify user by changing background color, in this case to red
		             elements.item(i).style.background = "red";
		             iserror=1;
		           }
		         }
		       }
		     }
			if(iserror==1) { alert(errorMSG); }
			else {
				selectAll(document.adminForm.col1);
				selectAll(document.adminForm.col2);
				selectAll(document.adminForm.col3);
				selectAll(document.adminForm.col4);
				submitform( pressbutton );
			}

		}

    function addOption(selectObj, value)
    {
      optionSelected = (value == null);
      if(value == null) value = prompt('', '');
      if(value != null)
      {
        if(value.indexOf(',') != -1)
          alert('Commas are not allowed in size values');
        else
        {
          var i = selectObj.options.length;
          value = value.replace(/1\/2/g, '½');
          selectObj.options.length = i + 1;
          selectObj.options[i].value = (value != '' && value != ' ') ? value : ' ';
          selectObj.options[i].text = (value != '' && value != ' ') ? value : '[empty]';
          selectObj.options[i].selected = optionSelected;
// uncomment the line below if you want the select list to change it's size to match the number of options it contains.
//          selectObj.size = selectObj.options.length;
        }
      }
    }
  
    function editOptions(selectObj)
    {
      for(var i = 0; i < selectObj.options.length; i++)
      {
        if(selectObj.options[i].selected)
        {
          var value = prompt('', selectObj.options[i].value);
          if(value != null)
          {
            if(value.indexOf(',') != -1)
              alert('Commas are not allowed in size values');
            else
            {
              selectObj.options[i].value = value;
              selectObj.options[i].text = (value != '') ? value : '[empty]';
              selectObj.options[i].selected = true;
            }
          }
        }
      }
    }
    
    function deleteOptions(selectObj)
    {
      for(var i = 0; i < selectObj.options.length; i++)
      {
        if(selectObj.options[i].selected)
        {
          for(var j = i; j < selectObj.options.length - 1; j++)
          {
            selectObj.options[j].value = selectObj.options[j + 1].value;
            selectObj.options[j].text = selectObj.options[j + 1].text;
            selectObj.options[j].selected = selectObj.options[j + 1].selected;
          }
          selectObj.options.length = selectObj.options.length - 1;
          i--;
        }
      }
    }
    
    function moveOptions(selectObj, direction)
    {
      if(selectObj.selectedIndex != -1)
      {
        if(direction < 0)
        {
          for(i = 0; i < selectObj.options.length; i++)
          {
            swapValue = (i == 0 || selectObj.options[i + direction].selected) ? null : selectObj.options[i + direction].value;
            swapText = (i == 0 || selectObj.options[i + direction].selected) ? null : selectObj.options[i + direction].text;
            if(selectObj.options[i].selected && swapValue != null && swapText != null)
            {
              thisValue = selectObj.options[i].value;
              thisText = selectObj.options[i].text;
              selectObj.options[i].value = swapValue;
              selectObj.options[i].text = swapText;
              selectObj.options[i + direction].value = thisValue;
              selectObj.options[i + direction].text = thisText;
              selectObj.options[i].selected = false;
              selectObj.options[i + direction].selected = true;
            }
          }
        }
        else
        {
          for(i = selectObj.options.length - 1; i >= 0; i--)
          {
            swapValue = (i == selectObj.options.length - 1 || selectObj.options[i + direction].selected) ? null : selectObj.options[i + direction].value;
            swapText = (i == selectObj.options.length - 1 || selectObj.options[i + direction].selected) ? null : selectObj.options[i + direction].text;
            if(selectObj.options[i].selected && swapValue != null && swapText != null)
            {
              thisValue = selectObj.options[i].value;
              thisText = selectObj.options[i].text;
              selectObj.options[i].value = swapValue;
              selectObj.options[i].text = swapText;
              selectObj.options[i + direction].value = thisValue;
              selectObj.options[i + direction].text = thisText;
              selectObj.options[i].selected = false;
              selectObj.options[i + direction].selected = true;
            }
          }
        }
      }
    }
    var NS4 = (document.layers);

    function moveOption(fromObj, toObj)
    {
      for(var i = fromObj.options.length - 1; i >= 0; i--)
      {
        if(fromObj.options[i].selected)
        {
          fromObj.options[i].selected = false;
          optionText = fromObj.options[i].text.replace(' [ASC]','');
	  optionText = optionText.replace(' [DESC]','');
          optionValue = fromObj.options[i].value.replace(' ASC','');
	  optionValue = optionValue.replace(' DESC','');
          for(var j = i; j < fromObj.options.length - 1; j++)
          {
            fromObj.options[j].text = fromObj.options[j + 1].text;
            fromObj.options[j].value = fromObj.options[j + 1].value;
          }
          fromObj.options.length = fromObj.options.length - 1;
          toObjIndex = toObj.options.length;
          toObj.options.length = toObj.options.length + 1;
          toObj.options[toObjIndex].text = optionText;
          toObj.options[toObjIndex].value = optionValue;
          if(NS4)
            history.go(0);
        }
      }
    }

    function moveOption2(fromObj, toObj, appendValue)
    {
        if(fromObj.options[fromObj.selectedIndex].selected)
        {
	  fromObjIndex=fromObj.selectedIndex;
          fromObj.options[fromObjIndex].selected = false;
          optionText = fromObj.options[fromObjIndex].text+ ' ['+appendValue+']';
          optionValue = fromObj.options[fromObjIndex].value+' '+appendValue;
          for(var j = fromObjIndex; j < fromObj.options.length - 1; j++)
          {
            fromObj.options[j].text = fromObj.options[j + 1].text;
            fromObj.options[j].value = fromObj.options[j + 1].value;
          }
          fromObj.options.length = fromObj.options.length - 1;
          toObjIndex = toObj.options.length;
          toObj.options.length = toObj.options.length + 1;
          toObj.options[toObjIndex].text = optionText;
          toObj.options[toObjIndex].value = optionValue;
	  toObj.options[toObjIndex].selected=false;
          if(NS4)
            history.go(0);
        }

    }
   
    function getSortList(selectObj) {
	var sortfields='';
	var j=0;
	selectAll(selectObj);
      if(selectObj.selectedIndex != -1)
      {
          for(i = 0; i < selectObj.options.length; i++)
          {
		if(j>0) sortfields +=  ', ';
		sortfields +=  selectObj.options[i].value;
		j++
          }
		//alert(sortfields);
		document.adminForm.sortfields.value=sortfields;
        }
    }
  
    function selectAll(selectObj)
    {
      if(selectObj.options.length)
        for(i = 0; i < selectObj.options.length; i++)
          selectObj.options[i].selected = true;
      return false;
    }

    function loadUGIDs(selectObj)
    {
	var UGIDs='';
	var j=0;
      if(selectObj.selectedIndex != -1)
      {
          for(i = 0; i < selectObj.options.length; i++)
          {
		if(selectObj.options[i].selected) {
			if(j>0) UGIDs +=  ', ';
			UGIDs +=  selectObj.options[i].value;
			j++;
		}
          }
		document.adminForm.usergroupids.value=UGIDs;
        }
    }
    function enableListColumn(colnum) {
	var oForm;
	var colName;
	oForm=document.adminForm;
	colName="col"+colnum;
	if(oForm.col1enabled.checked) {
		//alert("Enabled");
		
	} else {
		//alert("Disabled");
		oForm.col1title.readOnly=true;
		oForm.col1captions.disabled=true;
		//document.col1.disabled=true;
		oForm.col1up.disabled=true;
		oForm.col1down.disabled=true;
		oForm.col1remove.disabled=true;
		oForm.addcol1.disabled=true;
	}		

    }

    // -->

	</script>

	<table cellpadding="4" cellspacing="0" border="0" width="100%">
		<tr>
			<td class="sectionname"><img src="../components/com_comprofiler/images/cblist.gif" align="middle"><?php echo $row->listid ? 'Edit' : 'Add';?> List</td>
		</tr>
	</table>

	<form action="index2.php?option=com_comprofiler&task=saveList" method="POST" name="adminForm">
	<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td width="20%">Title:</td>
			<td align=left  width="20%"><input type="text" name="title" mosReq=1 mosLabel="Title" class="inputbox" value="<?php echo $row->title; ?>" /></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">Description:</td>
			<td width="20%" align=left><input type="text" name="description" mosReq=1 mosLabel="Description" class="inputbox" value="<?php echo $row->description; ?>" /></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">User Groups to Include:</td>
			<td width="20%"><?php echo $lists['usergroups']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">Published:</td>
			<td width="20%"><?php echo $lists['published']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">Default:</td>
			<td width="20%"><?php echo $lists['default']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">Sort By:</td>
			<td width="20%">
				<select name="sortfieldlist">
					<?php
						for ($i=0, $n=count( $sortfields ); $i < $n; $i++) {
							$sortfield =& $sortfields[$i];
							echo "<option value=\"`".$sortfield->name."`\">".getLangDefinition($sortfield->title)."\n";
						}
		
					?>
				</select><select name=direction><option value="ASC">ASC</option><option value="DESC">DESC</option></select><input type=button onclick="moveOption2(this.form.sortfieldlist, sort, this.form.direction.value);" value=" Add "><br />
				<select id=sort name=sort size="5" multiple  mosReq=1 mosLabel="Sort By">
					<?php
						for ($i=0, $n=count( $sortparts ); $i < $n; $i++) {
							$sortpart = $sortparts[$i];
							if($sortpart[field]!='') {
								echo "<option value=\"`".$sortpart[field]."` ".$sortpart[dir]."\">".getLangDefinition($sortpart[title])." [".$sortpart[dir]."]\n";
							}
						}
		
					?>
				</select><br />
				<input type=button onclick="moveOptions(sort, -1);" value=" + " />
				<input type=button onclick="moveOptions(sort, 1);" value=" - " />
				<br />
				<input type=button onclick="moveOption(this.form.sort,this.form.sortfieldlist);" value=" Remove ">
			</td>
		</tr>
	</table>
	<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td width="33%">
				Enable Column 1: <input type=checkbox onclick="javascript:enableListColumn(1);" name=col1enabled <?php if($row->col1enabled == 1) echo " CHECKED ";  ?> value=1 ><br />
				Column 1 Title:<br />
				<input type="text" name="col1title" mosReq=0 mosLabel="Column 1 Title" class="inputbox" value="<?php echo $row->col1title; ?>" /><br />
				Column 1 Captions:<input type=checkbox name=col1captions <?php if($row->col1captions == 1) echo " CHECKED ";  ?> value=1 ><br />
				<select id=col1 size="5" multiple name=col1[] >
					<?php
					echo $col1options;
					?>
				</select><br />
				<input name=col1up type=button onclick="moveOptions(col1, -1);" value=" + " />
				<input name=col1down type=button onclick="moveOptions(col1, 1);" value=" - " />
				<br />
				<input name=col1remove type=button onclick="moveOption(col1,this.form.fieldlist);" value=" Remove ">
			</td>
			<td width="33%" rowspan=3 valign=center align=center>Field List:<br />
				<input name=addcol1 type=button onclick="moveOption(this.form.fieldlist, col1);" value=" <- Add ">
				<input type=button onclick="moveOption(this.form.fieldlist, col2);" value=" Add -> "><br />
				<select name="fieldlist" size="10" multiple>
					<?php
						for ($i=0, $n=count( $fields ); $i < $n; $i++) {
							$field =& $fields[$i];
							echo "<option value=\"".$field->fieldid."\">".getLangDefinition($field->title)."\n";
						}
		
					?>
				</select><br />
				<input type=button onclick="moveOption(this.form.fieldlist, col3);" value=" <- Add ">
				<input type=button onclick="moveOption(this.form.fieldlist, col4);" value=" Add -> ">
			</td>
			<td width="33%">
				Enable Column 2: <input type=checkbox name=col2enabled <?php if($row->col2enabled == 1) echo " CHECKED ";  ?> value=1 ><br />
				Column 2 Title:<br />
				<input type="text" name="col2title" mosReq=0 mosLabel="Column 2 Title" class="inputbox" value="<?php echo $row->col2title; ?>" /><br />
				Column 2 Captions:<input type=checkbox name=col2captions <?php if($row->col2captions == 1) echo " CHECKED ";  ?> value=1 ><br />
				<select id=col2 size="5" multiple name=col2[] >
					<?php
					echo $col2options;
					?>
				</select><br />
				<input type=button onclick="moveOptions(col2, -1);" value=" + " />
				<input type=button onclick="moveOptions(col2, 1);" value=" - " />
				<br />
				<input type=button onclick="moveOption(col2,this.form.fieldlist);" value=" Remove ">
			</td>
		</tr>
		<tr>
		</tr>
		<tr>
			<td width="33%">
				Enable Column 3: <input type=checkbox name=col3enabled <?php if($row->col3enabled == 1) echo " CHECKED ";  ?> value=1 /><br />
				Column 3 Title:<br />
				<input type="text" name="col3title" mosReq=0 mosLabel="Column 3 Title" class="inputbox" value="<?php echo $row->col3title; ?>" /><br />
				Column 3 Captions:<input type=checkbox name=col3captions <?php if($row->col3captions == 1) echo " CHECKED ";  ?> value=1 ><br />
				<select id=col3 size="5" multiple name=col3[]>
					<?php
					echo $col3options;
					?>
				</select><br />
				<input type=button onclick="moveOptions(col3, -1);" value=" + " />
				<input type=button onclick="moveOptions(col3, 1);" value=" - " />
				<br />
				<input type=button onclick="moveOption(col3,this.form.fieldlist);" value=" Remove ">
			</td>
			<td width="33%">
				Enable Column 4: <input type=checkbox name=col4enabled <?php if($row->col4enabled == 1) echo " CHECKED ";  ?> value=1 ><br />
				Column 4 Title:<br />
				<input type="text" name="col4title" mosReq=0 mosLabel="Column 4 Title" class="inputbox" value="<?php echo $row->col4title; ?>" /><br />
				Column 4 Captions:<input type=checkbox name=col4captions <?php if($row->col4captions == 1) echo " CHECKED ";  ?> value=1 ><br />
				<select id=col4 size="5" multiple name=col4[]>
					<?php
					echo $col4options;
					?>
				</select><br />
				<input type=button onclick="moveOptions(col4, -1);" value=" + " />
				<input type=button onclick="moveOptions(col4, 1);" value=" - " />
				<br />
				<input type=button onclick="moveOption(col4,this.form.fieldlist);" value=" Remove ">
			</td>
		</tr>
	</table>
  <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td colspan="3">&nbsp;</td>
		</tr>

  </table>
  <input type="hidden" name="sortfields" value="<?php echo $row->sortfields; ?>" />
  <input type="hidden" name="usergroupids" value="<?php echo $row->usergroupids; ?>" />
  <input type="hidden" name="listid" value="<?php echo $row->listid; ?>" />
  <input type="hidden" name="option" value="com_comprofiler" />
  <input type="hidden" name="task" value="" />
</form>
  
<?php 	
}

	function showFields( &$rows, $pageNav, $search, $option ) {
		global $mosConfig_offset;
?>
<form action="index2.php" method="post" name="adminForm">
  <table cellpadding="4" cellspacing="0" border="0" width="100%">
    <tr>
      <td width="100%" class="sectionname"><img src="../components/com_comprofiler/images/cbfield.gif" align="middle">Field Manager</td>
      <td nowrap="nowrap">Display #</td>
      <td> <?php echo $pageNav->writeLimitBox(); ?> </td>
      <td>Search:</td>
      <td> <input type="text" name="search" value="<?php echo $search;?>" class="inputbox" onChange="document.adminForm.submit();" />
      </td>
    </tr>
  </table>
  <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
    <tr>
      <th width="2%" class="title">#</td>
      <th width="3%" class="title"> <input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count($rows); ?>);" />
      </th>
      <th width="10%" class="title">Name</th>
      <th width="10%" class="title">Title</th>
      <th width="10%" class="title">Type</th>
      <th width="10%" class="title">Tab</th>
      <th width="5%" class="title">Required?</th>
      <th width="5%" class="title">Profile?</th>
      <th width="5%" class="title">Registration?</th>
      <th width="5%" class="title">Published?</th>
      <th width="5%" class="title" colspan="2">Re-Order</th>
    </tr>
<?php
		$k = 0;
		for ($i=0, $n=count( $rows ); $i < $n; $i++) {
			$row =& $rows[$i];
			$img = $row->required ? 'tick.png' : 'publish_x.png' ;
			$task = $row->required ? 'fieldRequiredNo' : 'fieldRequiredYes' ;
		        $img2 = $row->profile ?  'tick.png' : 'publish_x.png';
		        $task2 = $row->profile ?  'fieldProfileNo' : 'fieldProfileYes';
		        $img3 = $row->published ?  'tick.png' : 'publish_x.png';
		        $task3 = $row->published ?  'fieldPublishedNo' : 'fieldPublishedYes';		        
			$img4 = $row->registration ?  'tick.png' : 'publish_x.png';
			$task4 = $row->registration ?  'fieldRegistrationNo' : 'fieldRegistrationYes';
?>
    <tr class="<?php echo "row$k"; ?>">
      <td><?php echo $i+1+$pageNav->limitstart;?></td>
      <td><input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->fieldid; ?>" onClick="isChecked(this.checked);" /></td>
      <td> <a href="#editField" onClick="return listItemTask('cb<?php echo $i;?>','editField')">
        <?php echo $row->name; ?> </a> </td>
      <td><?php echo getLangDefinition($row->title); ?></td>
      <td><?php echo $row->type; ?></td>
      <td><?php echo getLangDefinition($row->tab); ?></td>
      <td width="10%"><a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>
','<?php echo $task;?>')"><img src="images/<?php echo $img;?>" width="12" height="12" border="0" alt="" /></a></td>
      <td width="10%"><a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>
','<?php echo $task2;?>')"><img src="images/<?php echo $img2;?>" width="12" height="12" border="0" alt="" /></a></td>
      <td width="10%"><a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>
','<?php echo $task4;?>')"><img src="images/<?php echo $img4;?>" width="12" height="12" border="0" alt="" /></a></td>
      <td width="10%"><a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>
','<?php echo $task3;?>')"><img src="images/<?php echo $img3;?>" width="12" height="12" border="0" alt="" /></a></td>
      <td>
	<?php    if (($i > 0 || ($i+$pageNav->limitstart > 0)) && $row->tab == @$rows[$i-1]->tab) { ?>
         <a href="#reorder" onClick="return listItemTask('cb<?php echo $i;?>','orderupField')">
            <img src="images/uparrow.png" width="12" height="12" border="0" alt="Move Up">
         </a>
	<?php    } ?>
      </td>
      <td>
	<?php    if (($i < $n-1 || $i+$pageNav->limitstart < $pageNav->total-1) && $row->tab == @$rows[$i+1]->tab) { ?>
         <a href="#reorder" onClick="return listItemTask('cb<?php echo $i;?>','orderdownField')">
            <img src="images/downarrow.png" width="12" height="12" border="0" alt="Move Down">
         </a>
	<?php    } ?>
      </td>
    </tr>
    <?php $k = 1 - $k; } ?>
    <tr>
      <th align="center" colspan="12"> <?php echo $pageNav->writePagesLinks(); ?></th>
    </tr>
    <tr>
      <td align="center" colspan="12"> <?php echo $pageNav->writePagesCounter(); ?></td>
    </tr>
  </table>
  <input type="hidden" name="option" value="<?php echo $option;?>" />
  <input type="hidden" name="task" value="showField" />
  <input type="hidden" name="boxchecked" value="0" />
</form>
<?php }

	function editfield( &$row, $lists, $fieldvalues, $option, $tabid ) {
		global $my, $acl, $task;
?>
   <script language="javascript" src="js/dhtml.js"></script>
<script language="javascript" type="text/javascript">
  function getObject(obj) {
    var strObj;
    if (document.all) {
      strObj = document.all.item(obj);
    } else if (document.getElementById) {
      strObj = document.getElementById(obj);
    }
    return strObj;
  }
  
   function submitbutton(pressbutton) {
     if (pressbutton == 'showField') {
       submitform(pressbutton);
       return;
     }
     prep4SQL(document.adminForm.name);
     var coll = document.adminForm;
     var errorMSG = '';
     var iserror=0;
     if (coll != null) {
       var elements = coll.elements;
       // loop through all input elements in form
       for (var i=0; i < elements.length; i++) {
         // check if element is mandatory; here mosReq=1
         if (elements.item(i).getAttribute('mosReq') == 1) {
           if (elements.item(i).value == '') {
             //alert(elements.item(i).getAttribute('mosLabel') + ':' + elements.item(i).getAttribute('mosReq'));
             // add up all error messages
             errorMSG += elements.item(i).getAttribute('mosLabel') + ' <?php echo _UE_REQUIRED_ERROR; ?>\n';
             // notify user by changing background color, in this case to red
             elements.item(i).style.background = "red";
             iserror=1;
           }
         }
       }
     }
     if(iserror==1) {
       alert(errorMSG);
     } else {
       submitform(pressbutton);
     }
   }

  function insertRow() {
    var oTable = getObject("fieldValuesBody");
    var oRow, oCell ,oCellCont, oInput;
    var i, j;
    i=document.adminForm.valueCount.value;
    i++;
    // Create and insert rows and cells into the first body.
    oRow = document.createElement("TR");
    oTable.appendChild(oRow);

    oCell = document.createElement("TD");
    oInput=document.createElement("INPUT");
    oInput.name="vNames["+i+"]";
    oInput.setAttribute('mosLabel','Name');
    oInput.setAttribute('mosReq',0);
    oCell.appendChild(oInput);
    oRow.appendChild(oCell);
    oInput.focus();

    document.adminForm.valueCount.value=i;
  }

  function disableAll() {
    var elem;
    elem=getObject('divValues');
    elem.style.visibility = 'hidden';
    elem.style.display = 'none';
    elem=getObject('divTextarea');
    elem.style.visibility = 'hidden';
    elem.style.display = 'none';
    elem=getObject('divText');
    elem.style.visibility = 'hidden';
    elem.style.display = 'none';
    if (elem=getObject('vNames[0]')) {
      elem.setAttribute('mosReq',0);
    }
  }
  
  function selType(sType) {
    var elem;
    //alert(sType);
    switch (sType) {
      case 'editorta':
      case 'textarea':
        disableAll();
        elem=getObject('divTextarea');
        elem.style.visibility = 'visible';
        elem.style.display = 'block';
      break;
      
      case 'emailaddress':
      case 'webaddress':
      case 'password':
      case 'text':
        disableAll();
        elem=getObject('divText');
        elem.style.visibility = 'visible';
        elem.style.display = 'block';
      break;
      
      case 'radio':
      case 'select':
        disableAll();
        elem=getObject('divValues');
        elem.style.visibility = 'visible';
        elem.style.display = 'block';
        if (elem=getObject('vNames[0]')) {
          elem.setAttribute('mosReq',1);
        }
      break;
      
      default: 
        disableAll();
    }
  }

  function prep4SQL(o){
    o.value=o.value.replace(/[^a-zA-Z0-9]+/g,'');
  }

</script>
	<table cellpadding="4" cellspacing="0" border="0" width="100%">
		<tr>
			<td class="sectionname"><img src="../components/com_comprofiler/images/cbfield.gif" align="middle"><?php echo $row->fieldid ? 'Edit' : 'Add';?> Field</td>
		</tr>
	</table>

	<form action="index2.php?option=com_comprofiler&task=saveField" method="POST" name="adminForm">
	<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td width="20%">Type:</td>
			<td width="20%"><?php echo $lists['type']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">Tab:</td>
			<td width="20%"><?php echo $lists['tabs']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">Name:</td>
			<td align=left  width="20%"><input onblur="prep4SQL(this);" type="text" name="name" mosReq=1 mosLabel="Name" class="inputbox" value="<?php echo $row->name; ?>" /></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">Title:</td>
			<td width="20%" align=left><input type="text" name="title" mosReq=1 mosLabel="Title" class="inputbox" value="<?php echo $row->title; ?>" /></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">Required?:</td>
			<td width="20%"><?php echo $lists['required']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">Show on Profile?:</td>
			<td width="20%"><?php echo $lists['profile']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">User Read Only?:</td>
			<td width="20%"><?php echo $lists['readonly']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">Require at Registration?:</td>
			<td width="20%"><?php echo $lists['registration']; ?></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">Published:</td>
			<td width="20%"><?php echo $lists['published']; ?></td>
			<td>&nbsp;</td>
		</tr>
		</table>
		<div id=page1  class="pagetext">
		
		</div>
		<div id=divText  class="pagetext">
		<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td width="20%">Max Length:</td>
			<td width="20%"><input type="text" name="<?php if($row->type=='textarea') { echo 'maxlength2'; } ELSE { echo 'maxlength'; } ?>" mosLabel="Max Length" class="inputbox" value="<?php echo $row->maxlength; ?>" /></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">Size:</td>
			<td width="20%"><input type="text" name="size" mosLabel="Size" class="inputbox" value="<?php echo $row->size; ?>" /></td>
			<td>&nbsp;</td>
		</tr>
		</table>
		</div>
		<div id=divTextarea  class="pagetext">
		<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td width="20%">Max Length:</td>
			<td width="20%"><input type="text" name="<?php if($row->fieldid > 0 && $row->type=='textarea') { echo 'maxlength'; } ELSE { echo 'maxlength2'; } ?>" mosLabel="Max Length" class="inputbox" value="<?php echo $row->maxlength; ?>" /></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">Cols:</td>
			<td width="20%"><input type="text" name="cols" mosLabel="Cols" class="inputbox" value="<?php echo $row->cols; ?>" /></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td width="20%">Rows:</td>
			<td width="20%"><input type="text" name="rows"  mosLabel="Rows" class="inputbox" value="<?php echo $row->rows; ?>" /></td>
			<td>&nbsp;</td>
		</tr>
		</table>
		</div>
		<div id=divValues style="text-align:left;">
		Use the table below to add new values.<br />
		<input type=button onclick="insertRow();" value="Add a Value" />
		<table align=left id="divFieldValues" cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform" >
		<thead>
			<th width="20%">Name</th>
		</thead>
		<tbody id="fieldValuesBody">
		<tr>
			<td></td>
		</tr>
	<?php	
		//echo "count:".count( $fieldvalues );
		//print_r (array_values($fieldvalues));
		for ($i=0, $n=count( $fieldvalues ); $i < $n; $i++) {
			//print "count:".$i;
			$fieldvalue = $fieldvalues[$i];
			if ($i==0) $req =1;
			else $req = 0;
			echo "<tr>\n<td width=\"20%\"><input type=text mosReq=$req  mosLabel='Value' value=\"".stripslashes($fieldvalue->fieldtitle)."\" name=vNames[".$i."] /></td></tr>\n";
		}
		if(count( $fieldvalues )< 1) {
			echo "<tr>\n<td width=\"20%\"><input type=text mosReq=0  mosLabel='Value' value='' name=vNames[0] /></td></tr>\n";
			$i=0;
		}
	?>
		</tbody>
		</table>
		</div>
  <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td colspan="3">&nbsp;</td>
		</tr>

  </table>
  <input type="hidden" name="valueCount" value=<?php echo $i; ?> />
  <input type="hidden" name="oldtabid" value="<?php echo $row->tabid; ?>" />
  <input type="hidden" name="fieldid" value="<?php echo $row->fieldid; ?>" />
  <input type="hidden" name="ordering" value="<?php echo $row->ordering; ?>" />
  <input type="hidden" name="option" value="<?php echo $option; ?>" />
  <input type="hidden" name="task" value="" />
</form>
  
<?php 
	if($row->fieldid > 0) {
		print "<script> document.adminForm.name.readOnly=true; </script>";	
		print "<script> document.adminForm.type.disabled=true; </script>";		
	}
		print "<script> disableAll(); </script>";
		print "<script> selType('".$row->type."'); </script>";	
}


	function showTabs( &$rows, $pageNav, $search, $option ) {
		global $mosConfig_offset;
?>
<form action="index2.php" method="post" name="adminForm">
  <table cellpadding="4" cellspacing="0" border="0" width="100%">
    <tr>
      <td width="100%" class="sectionname"><img src="../components/com_comprofiler/images/cbtab.gif" align="middle">Tab Manager</td>
      <td nowrap="nowrap">Display #</td>
      <td> <?php echo $pageNav->writeLimitBox(); ?> </td>
      <td>Search:</td>
      <td> <input type="text" name="search" value="<?php echo $search;?>" class="inputbox" onChange="document.adminForm.submit();" />
      </td>
    </tr>
  </table>
  <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
    <tr>
      <th width="2%" class="title">#</td>
      <th width="3%" class="title"> <input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count($rows); ?>);" />
      </th>
      <th width="20%" class="title">Title</th>
      <th width="5%" class="title" colspan="2">Re-Order</th>
    </tr>
<?php
		$k = 0;
		for ($i=0, $n=count( $rows ); $i < $n; $i++) {
			$row =& $rows[$i];
?>
    <tr class="<?php echo "row$k"; ?>">
      <td><?php echo $i+1+$pageNav->limitstart;?></td>
      <td><input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->tabid; ?>" onClick="isChecked(this.checked);" /></td>
      <td> <a href="#editTab" onClick="return listItemTask('cb<?php echo $i;?>','editTab')">
        <?php echo getLangDefinition($row->title); ?> </a> </td>
      <td>
	<?php    if ($i > 0 || ($i+$pageNav->limitstart > 0)) { ?>
         <a href="#reorder" onClick="return listItemTask('cb<?php echo $i;?>','orderupTab')">
            <img src="images/uparrow.png" width="12" height="12" border="0" alt="Move Up">
         </a>
	<?php    } ?>
      </td>
      <td>
	<?php    if ($i < $n-1 || $i+$pageNav->limitstart < $pageNav->total-1) { ?>
         <a href="#reorder" onClick="return listItemTask('cb<?php echo $i;?>','orderdownTab')">
            <img src="images/downarrow.png" width="12" height="12" border="0" alt="Move Down">
         </a>
	<?php    } ?>
      </td>
    </tr>
    <?php $k = 1 - $k; } ?>
    <tr>
      <th align="center" colspan="9"> <?php echo $pageNav->writePagesLinks(); ?></th>
    </tr>
    <tr>
      <td align="center" colspan="9"> <?php echo $pageNav->writePagesCounter(); ?></td>
    </tr>
  </table>
  <input type="hidden" name="option" value="<?php echo $option;?>" />
  <input type="hidden" name="task" value="showTab" />
  <input type="hidden" name="boxchecked" value="0" />
</form>
<?php }

	function edittab( &$row, $option, &$lists, $tabid ) {
		global $my, $acl, $task;
?>
	<script language="javascript" type="text/javascript">
		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == 'showTab') {
				submitform( pressbutton );
				return;
			}
			var r = new RegExp("[^0-9A-Za-z]", "i");

			// do field validation
			if (trim(form.title.value) == "") {
				alert( "You must provide a title." );
			} else {
				submitform( pressbutton );
			}
		}
	</script>

	<table cellpadding="4" cellspacing="0" border="0" width="100%">
		<tr>
			<td class="sectionname"><img src="../components/com_comprofiler/images/cbtab.gif" align="middle"><?php echo $row->id ? 'Edit' : 'Add';?> Tab</td>
		</tr>
	</table>

	<form action="index2.php?option=com_comprofiler&task=saveTab" method="POST" name="adminForm">
	<table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
		<tr>
			<td width="25">Title:</td>
			<td width="85%"><input type="text" name="title" class="inputbox" size="40" value="<?php echo $row->title; ?>" /></td>
		</tr>
		<tr>
			<td width="25">Description:</td>
			<td width="85%"><textarea name="description" class="inputbox" cols="40" rows="10"><?php echo $row->description; ?></textarea></td>
		</tr>
		<tr>
			<td width="25">Width:</td>
			<td width="85%"><?php echo $lists['width']; ?></td>
		</tr>
		<tr>
			<td width="25">Enabled:</td>
			<td width="85%"><?php echo $lists['enabled']; ?></td>
		</tr>
		<tr>
			<td colspan="2">&nbsp;</td>
		</tr>
  </table>
  <input type="hidden" name="tabid" value="<?php echo $row->tabid; ?>" />
  <input type="hidden" name="option" value="<?php echo $option; ?>" />
  <input type="hidden" name="task" value="" />
</form>
<?php }

	function showUsers( &$rows, $pageNav, $search, $option ) {
		global $mosConfig_offset;
?>
<form action="index2.php" method="post" name="adminForm">
  <table cellpadding="4" cellspacing="0" border="0" width="100%">
    <tr>
      <td width="100%" class="sectionname"><img src="../components/com_comprofiler/images/cbuser.gif" align="middle">User Manager</td>
      <td nowrap="nowrap">Display #</td>
      <td> <?php echo $pageNav->writeLimitBox(); ?> </td>
      <td>Search:</td>
      <td> <input type="text" name="search" value="<?php echo $search;?>" class="inputbox" onChange="document.adminForm.submit();" />
      </td>
    </tr>
  </table>
  <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
    <tr>
      <th width="2%" class="title">#</td>
      <th width="3%" class="title"> <input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count($rows); ?>);" />
      </th>
      <th width="20%" class="title">Name</th>
      <th width="10%" class="title">UserName</th>
      <th width="5%" class="title" nowrap="nowrap">Logged In</th>
      <th width="15%" class="title">Group</th>
      <th width="15%" class="title">E-Mail</th>
      <th width="15%" class="title">Last Visit</th>
      <th width="5%" class="title">Enabled</th>
      <th width="5%" class="title">Approved</th>
      <th width="5%" class="title">Confirmed</th>
    </tr>
<?php
		$k = 0;
		for ($i=0, $n=count( $rows ); $i < $n; $i++) {
			$row =& $rows[$i];
			$img = $row->block ? 'publish_x.png' : 'tick.png';
			$task = $row->block ? 'unblock' : 'block';

		        $img2 = $row->approved ?  'tick.png' : 'publish_x.png';
		        $task2 = $row->approved ?   'reject':'approve';

		        $img3 = $row->confirmed ?  'tick.png' : 'publish_x.png';
		        $task3 = $row->confirmed ?   'reject':'approve';

?>
    <tr class="<?php echo "row$k"; ?>">
      <td><?php echo $i+1+$pageNav->limitstart;?></td>
      <td><input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row->id; ?>" onClick="isChecked(this.checked);" /></td>
      <td> <a href="#edit" onClick="return listItemTask('cb<?php echo $i;?>','edit')">
        <?php echo $row->name; ?> </a> </td>
      <td><?php echo $row->username; ?></td>
      <td align="center"><?php echo $row->loggedin ? '<img src="images/tick.png" width="12" height="12" border="0" alt="" />': ''; ?></td>
      <td><?php echo $row->groupname; ?></td>
      <td><a href="mailto:<?php echo $row->email; ?>"><?php echo $row->email; ?></a></td>
      <td><?php echo mosFormatDate( $row->lastvisitDate, "%Y-%m-%d %H:%M:%S" ); ?></td>
      <td width="10%"><a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>
','<?php echo $task;?>')"><img src="images/<?php echo $img;?>" width="12" height="12" border="0" alt="" /></a></td>
	<td width="10%"><a href="javascript: void(0);" onClick="return listItemTask('cb<?php echo $i;?>
','<?php echo $task2;?>')"><img src="images/<?php echo $img2;?>" width="12" height="12" border="0" alt="" /></a></td>
	<td width="10%"><img src="images/<?php echo $img3;?>" width="12" height="12" border="0" alt="" /></td>

    </tr>
    <?php $k = 1 - $k; } ?>
    <tr>
      <th align="center" colspan="11"> <?php echo $pageNav->writePagesLinks(); ?></th>
    </tr>
    <tr>
      <td align="center" colspan="11"> <?php echo $pageNav->writePagesCounter(); ?></td>
    </tr>
  </table>
  <input type="hidden" name="option" value="<?php echo $option;?>" />
  <input type="hidden" name="task" value="showusers" />
  <input type="hidden" name="boxchecked" value="0" />
</form>
<?php }

	function edituser( &$row,$rowExtras, $rowFields, $rowFieldValues,&$lists, $option, $uid,$fieldJS=null ) {
		global $my, $acl,$database,$ueConfig,$mosConfig_live_site;
		$canBlockUser = $acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'user properties', 'block_user' );
		$canEmailEvents = $acl->acl_check( 'workflow', 'email_events', 'users', $acl->get_group_name( $row->gid, 'ARO' ) );
?>
<style>
.titleCell {
	font-weight:bold;
	width:85px;
}
</style>
<link rel="stylesheet" type="text/css" media="all" href="../includes/js/calendar/calendar-mos.css" title="green" />
<!-- import the calendar script -->
<script type="text/javascript" src="../includes/js/calendar/calendar.js"></script>
<!-- import the language module -->
<script type="text/javascript" src="../includes/js/calendar/lang/calendar-en.js"></script>
<script language="Javascript" src="../includes/js/dhtml.js"></script>
<script language="javascript" type="text/javascript">
  function getObject(obj) {
    var strObj;
    if (document.all) {
      strObj = document.all.item(obj);
    } else if (document.getElementById) {
      strObj = document.getElementById(obj);
    }
    return strObj;
  }
    function submitbutton(pressbutton) {
     if (pressbutton == 'showusers') {
       submitform(pressbutton);
       return;
     }
      var coll = document.adminForm;
      var r = new RegExp("[^0-9A-Za-z]", "i");
      var errorMSG = '';
      var iserror=0;
<?php echo $fieldJS; ?>

      if (r.exec(coll.username.value)) {
        errorMSG += '<?php printf( _VALID_AZ09, _PROMPT_UNAME, 6 );?>\n';
        iserror=1;
      } else if ((coll.password.value != "") && (coll.password.value != coll.password2.value)){
        errorMSG += '<?php echo _REGWARN_VPASS2;?>\n';
        iserror=1;
      } else if (r.exec(coll.password.value)) {
        errorMSG += '<?php printf( _VALID_AZ09, _REGISTER_PASS, 6 );?>\n';
        iserror=1;
      } else if (coll.gid.value == "") {
        errorMSG += 'You must assign user to a group.\n';
        iserror=1;
      }
     if (coll != null) {
       var elements = coll.elements;
	//elements += document.getElementsByTagName('textarea');
       // loop through all input elements in form
       for (var i=0; i < elements.length; i++) {
         // check if element is mandatory; here mosReq=1
         if (elements.item(i).getAttribute('mosReq') == 1) {
           if (elements.item(i).value == '') {
             //alert(elements.item(i).getAttribute('mosLabel') + ':' + elements.item(i).getAttribute('mosReq'));
             // add up all error messages
             errorMSG += elements.item(i).getAttribute('mosLabel') + ' <?php echo _UE_REQUIRED_ERROR; ?>\n';
             // notify user by changing background color, in this case to red
             elements.item(i).style.background = "red";
             iserror=1;
           }
         }
       }
      }
      if(iserror==1) { alert(errorMSG); }
      else {
        coll.submit();
      }
    }
    function showCalendar2(id,dFormat) {
      var el = getObject(id);
      if (calendar != null) {
        // we already have one created, so just update it.
        calendar.hide();    // hide the existing calendar
        calendar.parseDate(el.value); // set it to a new date
      } else {
        // first-time call, create the calendar
        var cal = new Calendar(true, null, selected, closeHandler);
        calendar = cal;    // remember the calendar in the global
        cal.setRange(1900, 2070);  // min/max year allowed
        cal.dateFormat = dFormat;
        calendar.create();    // create a popup calendar
      }
      calendar.sel = el;    // inform it about the input field in use
      calendar.showAtElement(el);  // show the calendar next to the input field

      // catch mousedown on the document
      Calendar.addEvent(document, "mousedown", checkCalendar);
      return false;
    }
  </script>


<?
$ptabs='';
$pfields='';
$poldtab='';
$t=2;
for($i=0, $n=count( $rowFields ); $i < $n; $i++) {
	if($poldtab <> $rowFields[$i]->tab)  {
		$ptabs .= "<td id=\"ue_tab".$t."\" class=\"offtab\" onClick=\"dhtml.cycleTab(this.id)\">".getLangDefinition($rowFields[$i]->tab)."</td>\n";
		if($i > 0) $pfields .= "\t</table>\n</div>\n";
		$pfields .= "<div id=\"ue_page".$t."\"  class=\"pagetext\" >\n";
		$pfields .= "\t<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" width=\"100%\" class=\"adminform\">\n";
		$t++;
	}
	if($rowFields[$i]->table=='#__users') $dArray ='$row->';
	else $dArray ='$rowExtras->';
	$poldtab=$rowFields[$i]->tab;
	$pfields .= "\t\t<tr>\n";
	$pfields .= "\t\t\t<td class=\"titleCell\">". getLangDefinition($rowFields[$i]->title) .":</td>\n";
	if($ueConfig['adminrequiredfields']==0) $rowFields[$i]->required=0;
	eval("\$oValue = \"".$dArray.$rowFields[$i]->name."\";");
	$pfields .= "\t\t\t<td>".getFieldEntry($rowFields[$i]->type,$rowFields[$i]->name,$oValue,$rowFields[$i]->required,$rowFields[$i]->title,$rowFields[$i]->id,$rowFields[$i]->size, $rowFields[$i]->maxlength, $rowFields[$i]->cols, $rowFields[$i]->rows,$rowFields[$i]->profile,$rowFieldValues['lst_'.$rowFields[$i]->name])."</td>\n";
	$pfields .= "\t\t</tr>\n";
}
	$pfields .= "\t</table>\n";
	$pfields .= "</div>";


?>
	<table cellpadding="4" cellspacing="0" border="0" width="100%">
		<tr>
			<td class="sectionname"><img src="../components/com_comprofiler/images/cbuser.gif" align="middle"><?php echo $row->id ? 'Edit' : 'Add';?> User</td>
		</tr>
	</table>
	<form action="index2.php" method="POST" name="adminForm">
	<table  cellpadding="3" cellspacing="0" border="0" width="100%">
	        <tr>
    		  <td width="" class="tabpadding">&nbsp;</td>
	          <td id="ue_tab1" class="offtab" onClick="dhtml.cycleTab(this.id)">Contact Info</td>
	    	  <?php echo $ptabs; ?>
	          <td width="90%" class="tabpadding">&nbsp;</td>
	       </tr>
	</table>  

<div id="ue_page1"  class="pagetext">
	<table cellpadding="5" cellspacing="0" border="0" width="100%" class="adminform">
<?php
	SWITCH($ueConfig['name_style']) {
		case 2:
?>
		<tr>
			<td class="titleCell">First Name:</td>
			<td><input class="inputbox" type="text" size="40" mosReq=1 mosLabel="<?php echo _UE_YOUR_FNAME; ?>" name="firstname" value="<?php echo $rowExtras->firstname;?>" /><?php echo " <img src='".$mosConfig_live_site."/components/com_comprofiler/images/required.gif' title='"._UE_FIELDREQUIRED."' /> "; IF($ueConfig['name_format']!=3) echo "<img src='".$mosConfig_live_site."/components/com_comprofiler/images/profiles.gif' title='"._UE_FIELDONPROFILE."' />"; ELSE echo "<img src='".$mosConfig_live_site."/components/com_comprofiler/images/noprofiles.gif' title='"._UE_FIELDNOPROFILE."' />"; ?></td>
		</tr>
		<tr>
			<td class="titleCell">Last Name:</td>
			<td><input class="inputbox" type="text" size="40" mosReq=1 mosLabel="<?php echo _UE_YOUR_LNAME; ?>" name="lastname" value="<?php echo $rowExtras->lastname;?>" /><?php echo " <img src='".$mosConfig_live_site."/components/com_comprofiler/images/required.gif' title='"._UE_FIELDREQUIRED."' /> "; IF($ueConfig['name_format']!=3) echo "<img src='".$mosConfig_live_site."/components/com_comprofiler/images/profiles.gif' title='"._UE_FIELDONPROFILE."' />"; ELSE echo "<img src='".$mosConfig_live_site."/components/com_comprofiler/images/noprofiles.gif' title='"._UE_FIELDNOPROFILE."' />"; ?></td>
		</tr>
<?php
		break;
		case 3:
?>
		<tr>
			<td class="titleCell">First Name:</td>
			<td><input class="inputbox" type="text" size="40" mosReq=1 mosLabel="<?php echo _UE_YOUR_FNAME; ?>" name="firstname" value="<?php echo $rowExtras->firstname;?>" /><?php echo " <img src='".$mosConfig_live_site."/components/com_comprofiler/images/required.gif' title='"._UE_FIELDREQUIRED."' /> "; IF($ueConfig['name_format']!=3) echo "<img src='".$mosConfig_live_site."/components/com_comprofiler/images/profiles.gif' title='"._UE_FIELDONPROFILE."' />"; ELSE echo "<img src='".$mosConfig_live_site."/components/com_comprofiler/images/noprofiles.gif' title='"._UE_FIELDNOPROFILE."' />"; ?></td>
		</tr>
		<tr>
			<td class="titleCell">Middle Name:</td>
			<td><input class="inputbox" type="text" size="40" mosReq=0 mosLabel="<?php echo _UE_YOUR_MNAME; ?>" name="middlename" value="<?php echo $rowExtras->middlename;?>" /><?php IF($ueConfig['name_format']!=3) echo " <img src='".$mosConfig_live_site."/components/com_comprofiler/images/profiles.gif' title='"._UE_FIELDONPROFILE."' />"; ELSE echo " <img src='".$mosConfig_live_site."/components/com_comprofiler/images/noprofiles.gif' title='"._UE_FIELDNOPROFILE."' />"; ?></td>
		</tr>
		<tr>
			<td class="titleCell">Last Name:</td>
			<td><input class="inputbox" type="text" size="40" mosReq=1 mosLabel="<?php echo _UE_YOUR_LNAME; ?>" name="lastname" value="<?php echo $rowExtras->lastname;?>" /><?php echo " <img src='".$mosConfig_live_site."/components/com_comprofiler/images/required.gif' title='"._UE_FIELDREQUIRED."' /> "; IF($ueConfig['name_format']!=3) echo "<img src='".$mosConfig_live_site."/components/com_comprofiler/images/profiles.gif' title='"._UE_FIELDONPROFILE."' />"; ELSE echo "<img src='".$mosConfig_live_site."/components/com_comprofiler/images/noprofiles.gif' title='"._UE_FIELDNOPROFILE."' />"; ?></td>
		</tr>
<?php
		break;
		DEFAULT:
?>
		<tr>
			<td class="titleCell">Name:</td>
			<td><input class="inputbox" type="text" size="40" name="name" mosReq=1 mosLabel="Name"  value="<?php echo $row->name;?>" /><?php echo " <img src='".$mosConfig_live_site."/components/com_comprofiler/images/required.gif' title='"._UE_FIELDREQUIRED."' /> "; IF($ueConfig['name_format']!=3) echo "<img src='".$mosConfig_live_site."/components/com_comprofiler/images/profiles.gif' title='"._UE_FIELDONPROFILE."' />"; ELSE echo "<img src='".$mosConfig_live_site."/components/com_comprofiler/images/noprofiles.gif' title='"._UE_FIELDNOPROFILE."' />"; ?></td>
		</tr>
<?php 		
		break;
	} 
?>
		<tr>
			<td class="titleCell">Username:</td>
			<td><input type="text" name="username" mosReq=1 mosLabel="Username" class="inputbox" size="40" value="<?php echo $row->username; ?>" /><?php echo " <img src='".$mosConfig_live_site."/components/com_comprofiler/images/required.gif' title='"._UE_FIELDREQUIRED."' /> <img src='".$mosConfig_live_site."/components/com_comprofiler/images/profiles.gif' title='"._UE_FIELDONPROFILE."' />"; ?></td>
		</tr>
		<tr>
			<td class="titleCell">Email:</td>
			<td><input class="inputbox" type="text" mosReq=1 mosLabel="Email" name="email" size="40" value="<?php echo $row->email; ?>" /><?php echo " <img src='".$mosConfig_live_site."/components/com_comprofiler/images/required.gif' title='"._UE_FIELDREQUIRED."' /> <img src='".$mosConfig_live_site."/components/com_comprofiler/images/profiles.gif' title='"._UE_FIELDONPROFILE."' />"; ?></td>
		</tr>
		<tr>
			<td class="titleCell">New Password:</td>
			<td><input class="inputbox" type="password" mosReq=0 name="password" size="40" value="" /></td>
		</tr>
		<tr>
			<td class="titleCell">Verify Password:</td>
			<td><input class="inputbox" type="password" mosReq=0 name="password2" size="40" value="" /></td>
		</tr>
		<tr>
		  <td valign="top" class="titleCell">Group:</td>
		  <td><?php echo $lists['gid']; ?></td>
		</tr>
<?php	if ($canBlockUser) { ?>
		<tr>
		  <td class="titleCell">Block User</td>
		  <td><?php echo $lists['block']; ?></td>
		</tr>
		<tr>
		  <td class="titleCell">Approve User</td>
		  <td><?php echo $lists['approved']; ?></td>
		</tr>
		<tr>
		  <td class="titleCell">Confirm User</td>
		  <td><?php echo $lists['confirmed']; ?></td>
		</tr>
<?php	}
		if ($canEmailEvents) { ?>
		<tr>
		  <td class="titleCell">Receive Submission Emails</td>
		  <td><?php echo $lists['sendEmail']; ?></td>
		</tr>
<?php	} ?>
<?php if( $uid ) { ?>
		<tr>
		   <td class="titleCell">Register Date</td>
		   <td><?php echo $row->registerDate;?></td>
		</tr>
		<tr>
		   <td class="titleCell">Last Visit Date</td>
		   <td><?php echo $row->lastvisitDate;?></td>
		</tr>
<?php } ?>
  </table>
</div>                        
<?php echo $pfields; ?>
  <input type="hidden" name="id" value="<?php echo $row->id; ?>" />
<?php	if (!$canEmailEvents) { ?>
  <input type="hidden" name="sendEmail" value="0" />
<?php } ?>
  <input type="hidden" name="option" value="<?php echo $option; ?>" />
  <input type="hidden" name="task" value="save" />
   <script language="javascript" type="text/javascript">dhtml.cycleTab('ue_tab1');</script>
</form>
<div style="align:center;">
<?php
echo "<img src='".$mosConfig_live_site."/components/com_comprofiler/images/required.gif' title='"._UE_FIELDREQUIRED."' /> "._UE_FIELDREQUIRED." | ";
echo "<img src='".$mosConfig_live_site."/components/com_comprofiler/images/profiles.gif' title='"._UE_FIELDONPROFILE."' /> "._UE_FIELDONPROFILE." | ";		
echo "<img src='".$mosConfig_live_site."/components/com_comprofiler/images/noprofiles.gif' title='"._UE_FIELDNOPROFILE."' /> "._UE_FIELDNOPROFILE;
?>
</div>
<?php }

   function showConfig( &$ueConfig, &$lists, $option ) {
?>
   <script language="javascript" src="js/dhtml.js"></script>
	<table cellpadding="4" cellspacing="0" border="0" width="100%">
		<tr>
			<td class="sectionname"><img src="../components/com_comprofiler/images/cbconfig.gif" align="middle">Configuration Manager</td>
		</tr>
	</table>
   <form action="index2.php" method="post" name="adminForm">

<table cellpadding="3" cellspacing="0" border="0" width="100%">
  <tr>
    <td width="" class="tabpadding">&nbsp;</td>
    <td id="tab1" class="offtab" onclick="dhtml.cycleTab(this.id)"><?php echo _UE_GENERAL ;?></td>
    <td id="tab2" class="offtab" onclick="dhtml.cycleTab(this.id)"><?php echo _UE_REGISTRATION ;?></td>
    <td id="tab3" class="offtab" onclick="dhtml.cycleTab(this.id)"><?php echo _UE_USERLIST ;?></td>
    <td id="tab4" class="offtab" onclick="dhtml.cycleTab(this.id)"><?php echo _UE_USERPROFILE ;?></td>
    <td id="tab5" class="offtab" onclick="dhtml.cycleTab(this.id)"><?php echo _UE_AVATARS ;?></td>
    <td id="tab6" class="offtab" onclick="dhtml.cycleTab(this.id)"><?php echo _UE_MODERATE ;?></td>
    <td id="tab7" class="offtab" onclick="dhtml.cycleTab(this.id)"><?php echo _UE_INTEGRATION ;?></td>
    <td width="90%" class="tabpadding">&nbsp;</td>
  </tr>
</table>
<div id="page1" class="pagetext">
   <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminform">
      <tr align="center" valign="middle">
         <th width="20%">&nbsp;</th>
         <th width="20%"><?php echo _UE_CURRENT_SETTINGS ?></th>
         <th width="60%"><?php echo _UE_EXPLANATION ?></th>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_NAME_STYLE ?></td>
         <td align="left" valign="top"><?php echo $lists['name_style']; ?></td>
         <td align="left" valign="top"><?php echo _UE_NAME_STYLE_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_NAME_FORMAT ?></td>
         <td align="left" valign="top"><?php echo $lists['name_format']; ?></td>
         <td align="left" valign="top"><?php echo _UE_NAME_FORMAT_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_DATE_FORMAT ?></td>
         <td align="left" valign="top"><?php echo $lists['date_format']; ?></td>
         <td align="left" valign="top"><?php echo _UE_DATE_FORMAT_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_ALLOW_EMAIL_DISPLAY ?></td>
         <td align="left" valign="top"><?php echo $lists['allow_email_display']; ?></td>
         <td align="left" valign="top"><?php echo _UE_ALLOW_EMAIL_DISPLAY_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_ALLOW_EMAIL ?></td>
         <td align="left" valign="top"><?php echo $lists['allow_email']; ?></td>
         <td align="left" valign="top"><?php echo _UE_ALLOW_EMAIL_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_ALLOW_WEBSITE ?></td>
         <td align="left" valign="top"><?php echo $lists['allow_website']; ?></td>
         <td align="left" valign="top"><?php echo _UE_ALLOW_WEBSITE_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_ALLOW_ONLINESTATUS ?></td>
         <td align="left" valign="top"><?php echo $lists['allow_onlinestatus']; ?></td>
         <td align="left" valign="top"><?php echo _UE_ALLOW_ONLINESTATUS_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <th colspan="3">&nbsp;</th>
      </tr>
   </table>
</div>
<div id="page2" class="pagetext">
   <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminform">
      <tr align="center" valign="middle">
         <th width="20%">&nbsp;</th>
         <th width="20%"><?php echo _UE_CURRENT_SETTINGS ?></th>
         <th width="60%"><?php echo _UE_EXPLANATION ?></th>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_REG_ADMIN_APPROVAL ?></td>
         <td align="left" valign="top"><?php echo $lists['admin_approval']; ?></td>
         <td align="left" valign="top"><?php echo _UE_REG_ADMIN_APPROVAL_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_REG_CONFIRMATION ?></td>
         <td align="left" valign="top"><?php echo $lists['confirmation']; ?></td>
         <td align="left" valign="top"><?php echo _UE_REG_CONFIRMATION_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_REG_EMAIL_NAME ?></td>
         <td align="left" valign="top"><input type="text" name="cfg_reg_email_name" value="<?php echo $ueConfig['reg_email_name']; ?>" /></td>
         <td align="left" valign="top"><?php echo _UE_REG_EMAIL_NAME_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_REG_EMAIL_FROM ?></td>
         <td align="left" valign="top"><input type="text" name="cfg_reg_email_from" value="<?php echo $ueConfig['reg_email_from']; ?>" /></td>
         <td align="left" valign="top"><?php echo _UE_REG_EMAIL_FROM_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_REG_EMAIL_REPLYTO ?></td>
         <td align="left" valign="top"><input type="text" name="cfg_reg_email_replyto" value="<?php echo $ueConfig['reg_email_replyto']; ?>" /></td>
         <td align="left" valign="top"><?php echo _UE_REG_EMAIL_REPLYTO_DESC ?></td>
      </tr>
      <tr  align="left" valign="middle">
	 <td align="left" valign="top"></td>
	 <td align="left" valign="top" colspan=2><?php echo _UE_REG_EMAIL_TAGS; ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_REG_PEND_APPR_SUB ?></td>
         <td align="left" valign="top"><input type="text" name="cfg_reg_pend_appr_sub" value="<?php echo $ueConfig['reg_pend_appr_sub']; ?>" /></td>
         <td align="left" valign="top"><?php echo _UE_REG_PEND_APPR_SUB_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_REG_PEND_APPR_MSG ?></td>
         <td align="left" valign="top" colspan=2><textarea name="cfg_reg_pend_appr_msg" cols=50 rows=6><?php echo $ueConfig['reg_pend_appr_msg']; ?></textarea></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_REG_WELCOME_SUB ?></td>
         <td align="left" valign="top"><input type="text" name="cfg_reg_welcome_sub" value="<?php echo $ueConfig['reg_welcome_sub']; ?>" /></td>
         <td align="left" valign="top"><?php echo _UE_REG_WELCOME_SUB_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_REG_WELCOME_MSG ?></td>
         <td align="left" valign="top" colspan=2><textarea name="cfg_reg_welcome_msg" cols=50 rows=6><?php echo $ueConfig['reg_welcome_msg']; ?></textarea></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_REG_TOC_MSG ?></td>
         <td align="left" valign="top"><?php echo $lists['reg_enable_toc']; ?></td>
         <td align="left" valign="top"><?php echo _UE_REG_TOC_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_REG_TOC_URL_MSG ?></td>
         <td align="left" valign="top"><input type="text" size="50" name="cfg_reg_toc_url" value="<?php echo $ueConfig['reg_toc_url']; ?>" /></td>
         <td align="left" valign="top"><?php echo _UE_REG_TOC_URL_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <th colspan="3">&nbsp;</th>
      </tr>
   </table>
</div>
<div id="page3" class="pagetext">
   <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminform">
      <tr align="center" valign="middle">
         <th width="20%">&nbsp;</th>
         <th width="20%"><?php echo _UE_CURRENT_SETTINGS ?></th>
         <th width="60%"><?php echo _UE_EXPLANATION ?></th>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_NUM_PER_PAGE ?></td>
         <td align="left" valign="top"><input type="text" name="cfg_num_per_page" value="<?php echo $ueConfig['num_per_page']; ?>" /></td>
         <td align="left" valign="top"><?php echo _UE_NUM_PER_PAGE_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_ALLOW_PROFILELINK ?></td>
         <td align="left" valign="top"><?php echo $lists['allow_profilelink']; ?></td>
         <td align="left" valign="top"><?php echo _UE_ALLOW_PROFILELINK_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_ALLOW_LISTVIEWBY ?></td>
         <td align="left" valign="top"><?php echo $lists['allow_listviewbyGID']; ?></td>
         <td align="left" valign="top"><?php echo _UE_ALLOW_LISTVIEWBY_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <th colspan="3">&nbsp;</th>
      </tr>
   </table>
</div>
<div id="page4" class="pagetext">
   <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminform">
      <tr align="center" valign="middle">
         <th width="20%">&nbsp;</th>
         <th width="20%"><?php echo _UE_CURRENT_SETTINGS ?></th>
         <th width="60%"><?php echo _UE_EXPLANATION ?></th>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_USERNAME ?></td>
         <td align="left" valign="top"><?php echo $lists['usernameedit']; ?></td>
         <td align="left" valign="top"><?php echo _UE_USERNAME_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_ADMINREQUIREDFIELDS ?></td>
         <td align="left" valign="top"><?php echo $lists['adminrequiredfields']; ?></td>
         <td align="left" valign="top"><?php echo _UE_ADMINREQUIREDFIELDS_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_ALLOW_PROFILEVIEWBY ?></td>
         <td align="left" valign="top"><?php echo $lists['allow_profileviewbyGID']; ?></td>
         <td align="left" valign="top"><?php echo _UE_ALLOW_PROFILEVIEWBY_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <th colspan="3">&nbsp;</th>
      </tr>
   </table>
</div>
<?
        $GDfuncList = get_extension_funcs('gd');
        ob_start();
        @phpinfo(INFO_MODULES);
        $output=ob_get_contents();
        ob_end_clean();
        $matches[1]='';
        if(preg_match("/GD Version[ \t]*(<[^>]+>[ \t]*)+([^<>]+)/s",$output,$matches)){
            $gdversion = $matches[2];
        }
        if( $GDfuncList &&  in_array('imagegd2',$GDfuncList)){
		$gdInstalled="<font color=green><b>TRUE</b></font>";
         } else {
		$gdInstalled="<font color=red><b>FALSE</b></font>";
        }
?>
<div id="page5" class="pagetext">
   <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminform">
      <tr align="center" valign="middle">
         <th width="20%">&nbsp;</th>
         <th width="20%"><?php echo _UE_CURRENT_SETTINGS ?></th>
         <th width="60%"><?php echo _UE_EXPLANATION ?></th>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_AVATAR ?></td>
         <td align="left" valign="top"><?php echo $lists['allowAvatar']; ?></td>
         <td align="left" valign="top"><?php echo _UE_AVATAR_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_AVATARUPLOAD ?></td>
         <td align="left" valign="top"><?php echo $lists['allowAvatarUpload']; ?></td>
         <td align="left" valign="top"><?php echo _UE_AVATARUPLOAD_DESC ?></td>
      </tr>      
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_AVATARGALLERY ?></td>
         <td align="left" valign="top"><?php echo $lists['allowAvatarGallery']; ?></td>
         <td align="left" valign="top"><?php echo _UE_AVATARGALLERY_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_AVATARIMAGERESIZE ?></td>
         <td align="left" valign="top"><?php echo $lists['autoImageResize']; ?></td>
         <td align="left" valign="top"><?php echo _UE_AVATARIMAGERESIZE_DESC." ".$gdInstalled." (".$gdversion.")"; ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_AVHEIGHT ?></td>
         <td align="left" valign="top"><input type="text" name="cfg_avatarHeight" value="<?php echo $ueConfig['avatarHeight'];?>" /></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_AVWIDTH ?></td>
         <td align="left" valign="top"><input type="text" name="cfg_avatarWidth" value="<?php echo $ueConfig['avatarWidth'];?>" /></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_AVSIZE ?></td>
         <td align="left" valign="top"><input type="text" name="cfg_avatarSize" value="<?php echo $ueConfig['avatarSize'];?>" /></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_TNHEIGHT ?></td>
         <td align="left" valign="top"><input type="text" name="cfg_thumbHeight" value="<?php echo $ueConfig['thumbHeight'];?>" /></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_TNWIDTH ?></td>
         <td align="left" valign="top"><input type="text" name="cfg_thumbWidth" value="<?php echo $ueConfig['thumbWidth'];?>" /></td>
      </tr>
      <tr align="center" valign="middle">
         <th colspan="3">&nbsp;</th>
      </tr>
   </table>
</div>
<div id="page6" class="pagetext">
   <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminform">
      <tr align="center" valign="middle">
         <th width="20%">&nbsp;</th>
         <th width="20%"><?php echo _UE_CURRENT_SETTINGS ?></th>
         <th width="60%"><?php echo _UE_EXPLANATION ?></th>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_AVATARUPLOADAPPROVALGROUP ?></td>
         <td align="left" valign="top"><?php echo $lists['imageApproverGid']; ?></td>
         <td align="left" valign="top"><?php echo _UE_AVATARUPLOADAPPROVALGROUP_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_MODERATORUSERAPPOVAL ?></td>
         <td align="left" valign="top"><?php echo $lists['allowModUserApproval']; ?></td>
         <td align="left" valign="top"><?php echo _UE_MODERATORUSERAPPOVAL_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_MODERATOREMAIL ?></td>
         <td align="left" valign="top"><?php echo $lists['moderatorEmail']; ?></td>
         <td align="left" valign="top"><?php echo _UE_MODERATOREMAIL_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_ALLOWUSERREPORTS ?></td>
         <td align="left" valign="top"><?php echo $lists['allowUserReports']; ?></td>
         <td align="left" valign="top"><?php echo _UE_ALLOWUSERREPORTS_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_AVATARUPLOADAPPROVAL ?></td>
         <td align="left" valign="top"><?php echo $lists['avatarUploadApproval']; ?></td>
         <td align="left" valign="top"><?php echo _UE_AVATARUPLOADAPPROVAL_DESC ?></td>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_ALLOWUSERPROFILEBANNING ?></td>
         <td align="left" valign="top"><?php echo $lists['allowUserBanning']; ?></td>
         <td align="left" valign="top"><?php echo _UE_ALLOWUSERPROFILEBANNING_DESC ?></td>
      </tr>

      <tr align="center" valign="middle">
         <th colspan="3">&nbsp;</th>
      </tr>
   </table>
</div>
<div id="page7" class="pagetext">
   <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminform">
      <tr align="center" valign="middle">
         <th width="20%">&nbsp;</th>
         <th width="20%"><?php echo _UE_CURRENT_SETTINGS ?></th>
         <th width="60%"><?php echo _UE_EXPLANATION ?></th>
      </tr>
      <tr align="center" valign="middle">
         <td align="left" valign="top"><?php echo _UE_PMS ?></td>
         <td align="left" valign="top"><?php echo $lists['pms']; ?></td>
         <td align="left" valign="top"><?php echo _UE_PMS_DESC ?></td>
	</tr>
      <tr align="center" valign="middle">
         <th colspan="3">&nbsp;</th>
      </tr>
   </table>
</div>
   <input type="hidden" name="task" value="" />
   <input type="hidden" name="option" value="<?php echo $option; ?>" />
   <input type="hidden" name="cfg_version" value="<?php echo $ueConfig['version']; ?>" />
   <script language="javascript" type="text/javascript">dhtml.cycleTab('tab1');</script>
   </form>


   <p><?php echo _UE_BY ?>
      <font class="small"><a href="http://www.mambojoe.com" target="_blank">MamboJoe</a></font>
      <br />
      <font class="small"><?php echo _UE_VERSION ?>: <?php echo $ueConfig['version']; ?></font>
   </p>
<?php
   }


function showSubscription($database, $option, $mosConfig_lang)
   {
      include("components/com_comprofiler/ue_config.php");
   ?>


   <table width="90%" border="0" cellpadding="2" cellspacing="2" class="adminForm">
      <tr>
        <td width="100%" >
		Coming Soon!
      </td></tr></table>

 <?} //end function showInstructions

function showTools() {
   ?>
<table cellpadding="4" cellspacing="0" border="0" width="100%">
	<tr>
		<td class="sectionname"><img src="../components/com_comprofiler/images/cbtool.gif" align="middle">Tools Manager</td>
	</tr>
</table>

   <table width="90%" border="0" cellpadding="2" cellspacing="2" class="adminForm">
      <tr>
        <td>
		<a href="index2.php?option=com_comprofiler&task=loadSampleData">Load Sample Data</a>
      	</td>
	<td>
		This will load sample data into the Mambo Community Builder component.
	</td>
      </tr>
      <tr>
        <td>
		<a href="index2.php?option=com_comprofiler&task=syncUsers">Syncronize Users</a>
      	</td>
	<td>
		This will syncronize the Mambo User table with the Mambo Community Builder User Table.
	</td>
      </tr>
   </table>

 <?
} //end function showTools

function showCredits() {
global $ueConfig;
?>
		<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td bgcolor="#FFFFFF"> 
				<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
				<tr>
					<td align="center">
					<img src="../components/com_comprofiler/images/smcblogo.gif" /><br />
					<?php echo $ueConfig['version']; ?>

					</td>
				</tr>
				<tr>
					<td align="center">
					<br />
					<b>
					Credits
					</b>
					<br /><br />
					</td>
				<tr>
					<td align="center">
					<script language="JavaScript1.2">
					/*
					Fading Scroller- By DynamicDrive.com
					For full source code, and usage terms, visit http://www.dynamicdrive.com
					This notice MUST stay intact for use
					*/
					var delay=1000 //set delay between message change (in miliseconds)
					var fcontent=new Array()
					begintag='' //set opening tag, such as font declarations
					fcontent[0]="<h3>MamboJoe<br /></h3>PM & Lead Developer";
					fcontent[1]="<h3>DJTrail<br /></h3>PM & Lead Tester";
					fcontent[2]="<h3>Nicholas G. Antimisiaris<br /></h3>Documentation and Testing";
					fcontent[3]="<h3>damian caynes<br />inspired digital<br /></h3>Logo Design";
					closetag=''
					
					var fwidth='250px' //set scroller width
					var fheight='100px' //set scroller height
					
					var fadescheme=0 //set 0 to fade text color from (white to black), 1 for (black to white)
					var fadelinks=1 //should links inside scroller content also fade like text? 0 for no, 1 for yes.
					
					///No need to edit below this line/////////////////
					
					var hex=(fadescheme==0)? 255 : 0
					var startcolor=(fadescheme==0)? "rgb(255,255,255)" : "rgb(0,0,0)"
					var endcolor=(fadescheme==0)? "rgb(0,0,0)" : "rgb(255,255,255)"
					
					var ie4=document.all&&!document.getElementById
					var ns4=document.layers
					var DOM2=document.getElementById
					var faderdelay=0
					var index=0
					
					if (DOM2)
					faderdelay=2000
					
					//function to change content
					function changecontent(){
						if (index>=fcontent.length)
							index=0
							if (DOM2){
								document.getElementById("fscroller").style.color=startcolor
								document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
								linksobj=document.getElementById("fscroller").getElementsByTagName("A")
								if (fadelinks)
									linkcolorchange(linksobj)
									colorfade()
								} else if (ie4)
									document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag
								else if (ns4){
								document.fscrollerns.document.fscrollerns_sub.document.write(begintag+fcontent[index]+closetag)
								document.fscrollerns.document.fscrollerns_sub.document.close()
							}
						index++
						setTimeout("changecontent()",delay+faderdelay)
					}
					
					// colorfade() partially by Marcio Galli for Netscape Communications.  ////////////
					// Modified by Dynamicdrive.com
					
					frame=20;
					
					function linkcolorchange(obj){
						if (obj.length>0){
							for (i=0;i<obj.length;i++)
								obj[i].style.color="rgb("+hex+","+hex+","+hex+")"
							}
						}
					
					function colorfade() {
					// 20 frames fading process
					if(frame>0) {
						hex=(fadescheme==0)? hex-12 : hex+12 // increase or decrease color value depd on fadescheme
						document.getElementById("fscroller").style.color="rgb("+hex+","+hex+","+hex+")"; // Set color value.
						if (fadelinks)
							linkcolorchange(linksobj)
							frame--;
							setTimeout("colorfade()",20);
						} else {
							document.getElementById("fscroller").style.color=endcolor;
							frame=20;
							hex=(fadescheme==0)? 255 : 0
						}
					}
					
					if (ie4||DOM2)
						document.write('<div id="fscroller" style="border:0px solid black;width:'+fwidth+';height:'+fheight+';padding:2px"></div>')
						window.onload=changecontent
					</script>
					<ilayer id="fscrollerns" width=&{fwidth}; height=&{fheight};>
						<layer id="fscrollerns_sub" width=&{fwidth}; height=&{fheight}; left=0 top=0></layer>
					</ilayer>
					</td>
				</tr>
				</table>
		<table class="adminform">
		<tr>
			<th>
			Application
			</th>
			<th>
			URL
			</th>
			<th>
			Version
			</th>
			<th>
			License
			</th>
		</tr>
		<tr>
			<td>
			Icons
			</td>
			<td>
			<a href="http://www.foood.net" target="_blank">
			http://www.foood.net
			</a>
			</td>
			<td>
			N/A
			</td>
			<td>
			<a href="http://www.foood.net/agreement.htm" targer="_blank">
			http://www.foood.net/agreement.htm
			</a>
			</td>
		</tr>
		</table>
			</td>
		</tr>
</table>
<?php
}


}
?>
