<style type="text/css">
<!--
#ad_table { background-color:#D8D8D8; margin-bottom:10px; }
#ad_table th { background-color:#EEEEEE; text-align:center; }
#ad_table th, #ad_table td { padding:5px 10px; font-size:12px; line-height:normal; word-wrap:break-word; word-break:break-all; }
#ad_table td { background-color:#FFFFFF; text-align:center; font-size:14px; }
.s_noset_bg { background:#CCC; }
-->
</style>

<?php
$text = $text_ = '';

if (!(isset($web['cssfile']) && !empty($web['cssfile']) && file_exists('writable/css/'.$web['cssfile']))) {
  $web['cssfile'] = 'default/0';
}
list($cssdir, ) = @explode('/', $web['cssfile']);

if (isset($_COOKIE['myStyle']) && !empty($_COOKIE['myStyle']) && file_exists('writable/css/'.$_COOKIE['myStyle'])) {
  $myStyle = $_COOKIE['myStyle'];
  list($cssdir_, ) = @explode('/', $_COOKIE['myStyle']);
  $now_style = ' name="'.$_COOKIE['myStyle'].'"><span class="styleIs"><img src="writable/css/'.$_COOKIE['myStyle'].'/thumb.jpg" /><br />
<div class="styleTile">'.@file_get_contents('writable/css/'.$cssdir_.'/title.txt').'风格/'.@file_get_contents('writable/css/'.$_COOKIE['myStyle'].'/title.txt').'</div></span>';
  $back_style = ' href="javascript:void(0)" onclick="try{if($(\'styleIs\')!=null){$(\'styleIs\').id=\'\';}this.id=\'styleIs\';$(\'cssfile\').value=\''.$web['cssfile'].'\';tryStyle(\''.$web['cssfile'].'\');return false;}catch(e){}" title="点击恢复默认风格"';
} else {
  $myStyle = $web['cssfile'];
  $now_style = ' style="background-image:none"><span class="grayword">还未设置呢</span>';
  $back_style = '';
}


if (isset($_GET['style']) && !empty($_GET['style']) && file_exists('writable/css/'.$_GET['style'])) {
  $style_files = @glob('writable/css/'.$_GET['style'].'/*', GLOB_ONLYDIR);
  $style_n = count($style_files);
  if ($style_n > 0) {
    foreach ($style_files as $style) {
      $style = basename($style);
      if ('css'.$myStyle == 'css'.$_GET['style'].'/'.$style) {
        $v2 = ' id="styleIs"';
      } else {
        $v2 = '';
      }
      $text_ .= '
<a'.$v2.' class="styleIs" href="javascript:void(0)" onclick="try{if($(\'styleIs\')!=null){$(\'styleIs\').id=\'\';}this.id=\'styleIs\';$(\'cssfile\').value=\''.$_GET['style'].'/'.$style.'\';tryStyle(\''.$_GET['style'].'/'.$style.'\');return false;}catch(e){}"><img src="writable/css/'.$_GET['style'].'/'.$style.'/thumb.jpg" /><div id="styleTile_'.$_GET['style'].'/'.$style.'" class="styleTile">'.@file_get_contents('writable/css/'.$_GET['style'].'/'.$style.'/title.txt').'</div></a>
'; // onmouseover="$(\'styleTile_'.$style.'\').style.display=\'block\';" onmouseout="$(\'styleTile_'.$style.'\').style.display=\'none\';"
    }
    $text_ .= '<center style="clear:both;"><button name="button" type="button" onclick="location.href=\'?get=style\';">返回</button></center>';
  
  } else {
    $text_ .= '该风格系列下没有样式';
  }
  $list_title = '<a href="?get=style" target="_self">全部风格系列</a><a class="list_title_in">'.@file_get_contents('writable/css/'.$_GET['style'].'/title.txt').'风格系列</a>';

} else {
  $total_style = 0;
  $style_files = array();
  $cssfiles = @glob('writable/css/*', GLOB_ONLYDIR);
  $css_n = count($cssfiles);

  if ($css_n > 0) {
    foreach ($cssfiles as $css) {
      $css = basename($css);
      $style_files[$css] = @glob('writable/css/'.$css.'/*', GLOB_ONLYDIR);
      $style_n = count($style_files[$css]);
	  $total_style += $style_n;

      $text_ .= '
<a class="cssIs" href="?get=style&style='.$css.'" target="_self"><img src="writable/css/'.$css.'/thumb.gif" /><br />
'.@file_get_contents('writable/css/'.$css.'/title.txt').'（'.$style_n.'）</a>
'; // onmouseover="$(\'styleTile_'.$style.'\').style.display=\'block\';" onmouseout="$(\'styleTile_'.$style.'\').style.display=\'none\';"
    }
  } else {
    $text_ .= '没有风格系列';
  }
  $list_title = '<a class="list_title_in">总计'.$css_n.'种风格系列、'.$total_style.'款样式</a>';
}



$text = '
<table border="0" cellspacing="1" cellpadding="0" id="ad_table">
  <tr>
    <th>系统默认风格</th>
    <th>当前所选样式</th>
  </tr>
<tr>
    <td width="50%"><a class="styleIs"'.$back_style.'><img src="writable/css/'.$web['cssfile'].'/thumb.jpg" /><br />
<div class="styleTile">'.@file_get_contents('writable/css/'.$cssdir.'/title.txt').'风格/'.@file_get_contents('writable/css/'.$web['cssfile'].'/title.txt').'</div></a></td>
    <td width="50%" id="nowStyleThumb"'.$now_style.'</td>
</tr>
</table>
    <h5 id="list_title">'.$list_title.'</h5>
';
/*


$cssfiles = @glob('writable/css/*', GLOB_ONLYDIR);
$n_all = count($cssfiles);
  $step = 0;
  $v3 = 0;
if ($n_all > 0) {
  foreach ($cssfiles as $style) {
    $step++;
    $style = basename($style);
    if ('css'.$myStyle == 'css'.$style) {
      //$v1 = ' style="border:2px #FF0000 solid;"';
      $v2 = ' id="styleIs"';
      $v3 = (ceil($step / 4) - 1) * 103;
    } else {
      //$v1 = ' style="border:2px #EEEEEE solid;"';
      $v2 = ' onmouseover="this.style.borderColor=\'#FFFF99\';" onmouseout="this.style.borderColor=\'#EFEFEF\';"';
    }
    $text .= '
<a'.$v2.' class="styleIs" href="javascript:void(0)" onclick="try{$(\'styleIs\').id=\'null\';this.id=\'styleIs\';$(\'cssfile\').value=\''.$style.'\';tryStyle(\''.$style.'\');return false;}catch(e){}"><img src="writable/css/'.$style.'/thumb.jpg" /><div id="styleTile_'.$style.'" class="styleTile">'.@file_get_contents('writable/css/'.$style.'/title.txt').'</div></a>
'; // onmouseover="$(\'styleTile_'.$style.'\').style.display=\'block\';" onmouseout="$(\'styleTile_'.$style.'\').style.display=\'none\';"
  }
} else {
  $text .= '没有风格记录';
}
*/
?>
<style type="text/css">
<!--
#nowStyleThumb { background-color:#FFF; background-image:url(readonly/images/loading2.gif); background-position:50% 50%; background-repeat:no-repeat; }
a.cssIs { display:inline-block !important; display:inline; zoom:1; text-align:center; color:#333333; text-align:center; text-decoration:none; font-size:12px; border:1px #FFF solid; }
a.cssIs:hover { border:1px #B9D7FC solid; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px; background-color:#F4F9FF; }
.styleIs { width:136px; height:92px; font-size:12px; padding:1px; border:3px #EFEFEF solid; display:inline-block !important; display:inline; zoom:1; position:relative; }
.styleIs:hover { border-color:#FFFF99; }
#styleIs { border:3px #FF9933 solid; }
.styleTile { width:136px; height:16px; line-height: normal; overflow:hidden; /*display:none;*/ position:absolute; top:77px; left:1px; text-align:center; background-color:#000000; color:#FFFFFF; font-size:12px;
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5; opacity:0.5; }
-->
</style>
<div style="display:none"><img src="readonly/images/loading2.gif" /></div>
<script>

function tryStyle(t){
  if(t==$('nowStyleThumb').name){
    alert('当前已是此风格！')
    return;
  }
  if(t=='<?php echo $web['cssfile']; ?>'){
    alert('已恢复系统默认风格')
    document.cookie='myStyle=; path=/;';
    $('nowStyleThumb').name='<?php echo $web['cssfile']; ?>';
    $('nowStyleThumb').style.backgroundImage='none';
    $('nowStyleThumb').innerHTML='<span class="grayword">还未设置呢</span>';
  } else {
    setCookie('myStyle', t, 365);
    $('nowStyleThumb').name=t;
    $('nowStyleThumb').style.backgroundImage='url(readonly/images/loading2.gif)';
    $('nowStyleThumb').innerHTML='<span class="styleIs"><img src="writable/css/'+t+'/thumb.jpg" /><br /><div class="styleTile">'+$('styleTile_'+t+'').innerHTML+'</div></span>';
  }

  if(parent){
    if(parent!=self){
      if(parent.document.getElementById('my_style')!=null){
        parent.document.getElementById('my_style').href='writable/css/'+t+'/style.css';
      }
    }
  }
  if(document.getElementById('my_style')!=null){
    document.getElementById('my_style').href='writable/css/'+t+'/style.css';
  }
  
}
<?php eval($eval); ?>

</script>
<?php
echo '
<form action="member.php?post=member_style" method="post" target="_self">
<div id="area_http_url">
'.$text.$text_.'
<input type="hidden" name="cssfile" id="cssfile" value="'.$myStyle.'" />
</div>
<!--center style="clear:both;"><button name="submit" type="submit">保存</button></center-->
</form>';


?>









