<!--<?php
require_once(uTemplate::printEot('header'));
require_once(uTemplate::printEot('space_appleft'));
print<<<EOT
-->
<script type="text/javascript">
function wordlength(target,maxLength){
	var val = target.value;
	var n = 2*val.length-val.replace(/[\u4e00-\u9fa5]/g,'').length;
	var val=target.value;
	while(n>maxLength)
	{
		var key = val.substr(-1);
		target.value=val.substr(0,val.length-1);
		val = target.value;
		n -= /[\u4e00-\u9fa5]/.test(key)?2:1;
	}
	str='('+n+'/'+maxLength+')';
	var tip = getObj('span_'+target.name);
	tip.innerHTML = str;
	if(n==maxLength){
		tip.className='s3';
	}else{
		tip.className="s6";
	}
}
</script>
<div class="sideB" style="width:750px;">
	<div class="boxA">
	<table width="100%"><tr><td class="vt" height="600">
			<div class="p15">
      	<h4 class="site"><img src="u/images/module/set.png" class="mr10" /><span>空間裝扮</span></h4>
				<div class="navC mb10">
					<ul id="tabList">
						<li id="tab_basic"{$sel_basic}><a href="javascript:" hidefocus="true">基本設置</a></li>
						<li id="tab_skin"{$sel_skin}><a href="javascript:" hidefocus="true">風格皮膚</a></li>
						<li id="tab_model"{$sel_model}><a href="javascript:" hidefocus="true">首頁模塊設置</a></li>
					</ul>
				</div>
				<form action="u.php?a=set&" method="post" enctype="multipart/form-data">
				<input type="hidden" name="step" value="3" />
				<div id="set_basic" style="display:$style_basic">
				<div class="p10">
					<table width="100%" class="setTable">
						<tr>
							<th class="th">空間名稱</th>
							<td class="td">
								<input name="name" id="name" type="text" class="input input_wb mr5" value="$space[name]" onkeyup="wordlength(this,80)" /><span id="span_name" class="f10 gray">($space[namelength]/80)</span>
							</td>
						</tr>
						<tr>
							<th class="th">空間簡介</th>
							<td class="td">
								<textarea name="descript"  class="textareaA fl mr5"  onkeyup="wordlength(this,255)">$space[descript]</textarea><span id="span_descript" class="f10 gray">($space[desclength]/255)</span>
							</td>
						</tr>
						<tr>
							<th class="th">背景圖片</th>
							<td class="td">
								<input name="banner" id="banner" type="file" class="input mb5" style="width:338px;padding:3px 0;margin:0;" onchange="uploadbanner();">
								<script type="text/javascript">
									function uploadbanner(){
										var atm=getObj('banner');
										var path = getObj('banner').value;
										var maxUploadSize;
										var filesize;
										if('$maxuploadsize'.indexOf('M')>-1){											
										 	maxUploadSize=parseInt('$maxuploadsize'.split('M')[0])*1024*1024;
										}else if('$maxuploadsize'.indexOf('K') >-1) {
											maxUploadSize=parseInt('$maxuploadsize'.split('K')[0])*1024;
										}else{
											maxUploadSize=2048000;
										}
										if(atm.files)
										{
											filesize =atm.files[0].fileSize;
										}
										else if (window.navigator.userAgent.indexOf("MSIE 6") > 0 && !window.XMLHttpRequest) {
												var img = new Image();
												img.dynsrc =path;
												filesize =img.fileSize;
										}
										if(filesize && filesize>maxUploadSize){
											showDialog('warning','附件大小不能超過'+ maxUploadSize/1024/1024 +'M');
											atm.value=null;
											if(is_ie){
												atm.select();
												document.execCommand('delete');
											}else
													atm.value=null;
													return false;
										}
									}
								</script>
<!--
EOT;
if ($space['banner']) {print <<<EOT
-->
								<div class="fileImg1" id="dellogo"><img src="$space[banner_s]" width="400" /> <a href="pw_ajax.php?action=delspacelogo" onclick="return dellogo(this.href);">[刪]</a></div>
<script type="text/javascript">
function dellogo(url) {
	ajax.send(url, '', function() {
		if (ajax.request.responseText == 'ok') {
			getObj('dellogo').style.display = 'none';
		} else {
			ajax.guide();
		}
	});
	return false;
}
</script>
<!--
EOT;
}print <<<EOT
-->
							</td>
						</tr>
						<!-- <tr>
							<th class="th">空間域名</th>
							<td class="td">
								$db_bbsurl/u/ <input name="domain" type="text" class="input input_wc" value="$space[domain]" />
							</td>
						</tr> -->
						<tr>
							<th class="th">
								空間類型
							</th>
							<td class="td">
								<ul class="menuSkin" id="spacestyleType" style="padding:0;margin:0;">
									<li style="margin-top:0;" {$spacestyle_2}>
										<a href="javascript:;" style="border:0;" hidefocus="true" onClick="selectStyle('spacestyleType')">
											<i style="background:url(u/images/space/1v2.png) no-repeat">&nbsp;</i>
											<span style="line-height:18px;"><label for="ifcheckstyle_2"><input id="ifcheckstyle_2" name="spacestyle" type="radio" class="mr5" value="2" {$ifcheckstyle_2} />兩欄式</label></span></a>
									</li>
									<li style="margin-top:0;" {$spacestyle_3}>
										<a href="javascript:;" style="border:0;" hidefocus="true" onClick="selectStyle('spacestyleType')">
											<i style="background:url(u/images/space/1v1v1.png) no-repeat">&nbsp;</i>
											<span style="line-height:18px;"><label for="ifcheckstyle_3"><input id="ifcheckstyle_3" name="spacestyle" type="radio" class="mr5" value="3" {$ifcheckstyle_3} />三欄式</label></span></a>
									</li>
								</ul>
							</td>
						</tr>
            <tr>
							<th class="th">
								空間主題
							</th>
							<td class="td">
								<ul class="menuSkin cc" id="spacesthemes" style="padding:0;margin:0;width:auto;">
									<li style="margin-top:0;" {$spacethemes_3}>
										<a href="javascript:;" style="border:0;" hidefocus="true" onClick="selectStyle('spacesthemes')">
											<i style="background:url(u/images/space/bbs_mode.png) no-repeat">&nbsp;</i>
											<span style="line-height:18px;"><label for="ifcheckstyle_2"><input id="ifcheckstyle_3" name="spacetype" type="radio" class="mr5" value="3" {$ifcheck_3} />論壇模式</label></span></a>
									</li>
									<li style="margin-top:0;" {$spacethemes_1}>
										<a href="javascript:;" style="border:0;" hidefocus="true" onClick="selectStyle('spacesthemes')">
											<i style="background:url(u/images/space/blog_mode.png) no-repeat">&nbsp;</i>
											<span style="line-height:18px;"><label for="ifcheckstyle_2"><input id="ifcheckstyle_1" name="spacetype" type="radio" class="mr5" value="1" {$ifcheck_1} />博客模式</label></span></a>
									</li>
									<li style="margin-top:0;" {$spacethemes_2}>
										<a href="javascript:;" style="border:0;" hidefocus="true" onClick="selectStyle('spacesthemes')">
											<i style="background:url(u/images/space/img_mode.png) no-repeat">&nbsp;</i>
											<span style="line-height:18px;"><label for="ifcheckstyle_2"><input id="ifcheckstyle_2" name="spacetype" type="radio" class="mr5" value="2" {$ifcheck_2} />圖片模式</label></span></a>
									</li>
									<li style="margin-top:0;" {$spacethemes_0}>
										<a href="javascript:;" style="border:0;" hidefocus="true" onClick="selectStyle('spacesthemes')">
											<i style="background:url(u/images/space/all_mode.png) no-repeat">&nbsp;</i>
											<span style="line-height:18px;"><label for="ifcheckstyle_2"><input id="ifcheckstyle_0" name="spacetype" type="radio" class="mr5" value="0" {$ifcheck_0} />綜合模式</label></span></a>
									</li>
								</ul>
							</td>
						</tr>
					</table>
				</div>
				</div>
				<div id="set_skin" style="display:$style_skin">
					<div class="b p10">選擇你喜歡的風格</div>
					<div style="padding:0 10px 40px;">
						<ul class="cc menuSkin" style="width:auto;padding:0;background:none;" id="themesLi">
<!--
EOT;
foreach ($o_uskin as $key => $value) {
$style = ($key == $space['skin']) ? 'class="current"' : '';
$ifcheck = ($key == $space['skin']) ? ' checked' : '';
print <<<EOT
-->
							<li {$style}>
								<a href="javascript:;" hidefocus="true"  onClick="selectStyle('themesLi')">
									<i style="background:url(u/themes/$key/images/preview.jpg) no-repeat">&nbsp;</i>
									<span><label for="skin{$key}"><input type="radio" name="spaceskin" value="$key" id="skin{$key}" class="mr5" {$ifcheck} />{$value}</label></span>
								</a>
							</li>
<!--
EOT;
}print <<<EOT
-->
						</ul>
					</div>
				</div>
				<div id="set_model" style="display:$style_model">
					<div class="moduleList mb15">
						<ul class="cc">
<!--
EOT;
foreach ($spaceModel as $key) {
$value = $lang_model[$key];
$ifcheck = $space['modelset'][$key]['ifopen'] ? ' checked' : '';
print <<<EOT
-->
							<li>
								<div class="cc">
									<span class="fl icon"><img src="u/images/module/$value[2].png" /></span>
									<h4 class="fl f14 b"><a href="javascript:;">$value[0]</a></h4>
									<span class="fr"><label><input type="checkbox" name="ifopen[$key]" value="1"{$ifcheck} />顯示</label></span>
								</div>
								<p class="lh_22"><!--label class="fl">隱私</label><select name=""><option value="">登錄後任何人可見</option></select--><label class="fl">&nbsp;</label>&nbsp;展示&nbsp;<input type="text" name="shownum[$key]" class="input mr5" value="{$space['modelset'][$key]['num']}" size="1" />$value[1]</p>
							</li>
<!--
EOT;
}print <<<EOT
-->
						</ul>
					</div>
				</div>
				<div class="tac p10"><span class="btn"><span><button type="submit">保 存</button></span></span></div>
				</form>
				</div>
	</td></tr></table>
	</div>
</div>
<script type="text/javascript">window.onReady(function(){new pwTab('tabList', 'tab_', 'set_', 'spacemodeset');});</script>
<script type="text/javascript">
function selectStyle(obj) {
	var lis = getObj(obj).getElementsByTagName('li');
	for(var i = 0,j = lis.length;i < j;i++){
		lis[i].onclick = function(){
			for(var i = 0;i<j;i++){lis[i].className = '';}
			this.getElementsByTagName('input')[0].checked = 'checked';
			this.className = 'current';
		}
	}
}
</script>
<!--
EOT;
require_once(uTemplate::printEot('footer'));
?>-->