<?php
//ini_set("display_errors", 1);
include("../includes/site_config.php");
include('../session_handler.inc');
include('../message.php');

$Sess_UserType=$_SESSION['Sess_UserType'];
if ($Sess_UserType != "A") {exit;}

if(isset($_REQUEST['skin'])){
restrict_demo();
$skin=form_get('skin');
$que=mysql_query("UPDATE options set Value='$skin' where Name='skin'") or die(mysql_error());

	}


?>


<link rel="stylesheet" href="../lightbox2/lightbox.css" type="text/css" media="screen" />
<script type="text/javascript" src="../lightbox2/lightbox.js"></script>

<!--<script type="text/javascript" src="../lightbox/js/prototype.js"></script>
<!--<script type="text/javascript" src="../lightbox/js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="../lightbox/js/lightbox.js"></script>
<link rel="stylesheet" href="../lightbox/css/lightbox.css" type="text/css" media="screen" />-->

<?
$area = 'member';

$manager = &OptionManager::GetInstance();
$aGroups = $manager->GetGroupList();


	function display_option($option, $DEMO, $CONST_LINK_ROOT) {
    $res = "";

    if($option->type=='skin'){
		
      
	   $i=0;
	   //$res.= "<tr valign='top'>";
		foreach ($option->list as $value => $label){
		$selected = ($value == $option->value) ? "Current" : "Activate";
		if($i%4==0){
			$res.="<tr valign='top'>";
			}
			
			if($DEMO==false){
				$link="<a href=\"admin_templates.php?skin=$label\">$selected</a>"; 
				}
				
		$res.= "<td align='center' class='admin-head'>$label<br><a href='$CONST_LINK_ROOT/templates/$label/preview/$label.jpg' rel='lightbox' title='$label'><img src=\"$CONST_LINK_ROOT/templates/$label/preview/thumb.jpg\" width='150' ></a><br>$link<br><br></td>";
		
          
   		$i++; }
		//$res.= "</tr>";
        
    }
    return $res;
}
	
?>


<?php include("include/header.php"); ?><div class="mainwidth">

<div class="admin-page-header"><div class="admin-page-heading">&nbsp;&nbsp;<?=ADMIN_TEMPLATE?></div></div>
<div class="clear"></div>
<div class="admin-page">
<table width="100%" align="<?php print("$CONST_TABLE_ALIGN"); ?>" border="0" cellspacing="<?php print("$CONST_TABLE_CELLSPACING"); ?>" cellpadding="<?php print("$CONST_TABLE_CELLPADDING"); ?>"><!--DWLayoutTable-->
<form action="<?=$_SERVER['PHP_SELF']?>" name="coupForm" method="post">
<tr>

<? 
$group = 'general'; 

 $aOptions = ($group !== null) ? $manager->GetListByGroup($group) : array();
 $i=0;
foreach ($aOptions as $option){

?>
        

            
			<?=display_option($option, $DEMO, $CONST_LINK_ROOT)?>

             
		
           <?  }?>

  </tr>
  
</table>
</div><div class="admin-page-bottom"></div></div>


<?php include("include/footer.php"); ?>
