<!--<?php
if ($a == 'delalbum') {print <<<EOT
-->
	<form action="{$basename}&a=$a&cyid=$cyid" onsubmit="return false;" method="post">
	<input type="hidden" name="aid" value="$aid" />
	<input type="hidden" name="step" value="3" />
	<div style="width:250px;">
		<div class="p15 lh_22">刪除相冊將同時刪除所有照片<br />您確定要刪除嗎？</div>
		<div class="popBottom">
		<span class="btn2"><span><button type="button" onclick="ajax.submit(this.form)">刪 除</button></span></span>
		<span class="bt2"><span><button type="button" onclick="closep();">取消</button></span></span>
	</div>
	</div>
	</form>
<!--
EOT;
} elseif ($a == 'editalbum') {print <<<EOT
-->
	<form action="{$basename}q=photos&a=editalbum" onSubmit="return false;" method="POST">
		<input type="hidden" name="step" value="3" />
		<input type="hidden" name="aid" value="$aid" />
		<div style="width:450px">
		<div class="popTop">編輯相冊</div>
		<table cellpadding="0" cellspacing="0" width="100%" class="vt lh_24">
			<tr>
				<td width="60">相冊名*</td>
				<td><input type="text" class="input input_wa mr10" id="ajax_aname" name="aname" value="$albumInfo[aname]" /><span id="ajax_aname_warn">限 24 字節</span></td>
			</tr>
			<tr>
				<td>描述</td>
				<td>
					<textarea id="ajax_aintro" name="aintro" class="textareaA">{$albumInfo[aintro]}</textarea>
					<div id="ajax_aintro_warn"> 限 255 字節</div>
				</td>
			</tr>
			<tr>
				<td>可見度</td>
				<td>
					<select name="private" onchange="optionsel(this.value);" class="select_wa">
						<option value="0" $select_0>全站用戶可見</option>
						<option value="1" $select_1>僅好友可見</option>
						<option value="2" $select_2>僅自己可見</option>
						<option value="3" $select_3>需要密碼訪問</option>
					</select>
<!--
EOT;
if($select_3 == 'selected'){print<<<EOT
-->
					<span id="resetpwd_$albumInfo[aid]" onclick="resetpwd();" class="cp">重設密碼</span>
<!--
EOT;
}else{print<<<EOT
-->
					<span id="resetpwd_$albumInfo[aid]"></span>
<!--
EOT;
}print <<<EOT
-->
				</td>
			</tr>
			<tbody id="photo_pwd" style="display:none">
			<tr>
				<td>輸入密碼</td>
				<td>
					<input type="password" class="input input_wa mr10" name="pwd" id="c_ajax_pwdinfo" /><span id="c_ajax_pwdinfo_warn">最小長度:3 最大長度:15</span>
				</td>
			</tr>
			<tr>
				<td>確認密碼</td>
				<td>
					<input type="password" class="input input_wa" name="repwd" id="repwd_info" />
				</td>
			</tr>
			</tbody>
		</table>
		<div class="popBottom"><span class="btn2"><span><button type="submit" onclick="ajax.submit(this.form)">確定</button></span></span><span class="bt2"><span><button type="button" onclick="closep();">取消</button></span></span></div>
		</div>
	</form>
<script>
var charset = '$db_charset';
setTimeout(function(){initCheckTextNum('ajax_aname','ajax_aname_warn',24);},300);
setTimeout(function(){initCheckTextNum('ajax_aintro','ajax_aintro_warn',255);},300);
function resetpwd() {
	getObj('resetpwd_$albumInfo[aid]').style.display = 'none';
	getObj('photo_pwd').style.display = '';
}
function optionsel(id) {
	var pwdobj = getObj('photo_pwd');
	var resetpwdid = getObj('resetpwd_$albumInfo[aid]');
	resetpwdid.style.display = 'none';
	if (isNaN(id)) {
		showDialog('error','非法操作');
	}
	if (id == '3') {
		pwdobj.style.display = '';
	} else {
		pwdobj.style.display = 'none';
	}
}
</script>
<!--
EOT;
}elseif ($a == 'viewalbum') {print <<<EOT
--><div style="width:200px;">
	<form action="{$basename}&a=viewalbum" onSubmit="return false;" method="POST">
		<input type="hidden" name="aid" id="aidvalue" value="$aid" />
		<input type="hidden" name="ifspace" id="ifspace" value="$ifspace" />	
		<input type="hidden" name="uid" id="uid" value="$uid" />
		<input type="hidden" name="ifriend" id="ifriend" value="$ifriend" />
		<div class="popTop">輸入密碼</div>	
		<div class="p10"><input type="password" class="input input_wa" name="viewpwd" id="pwdvalue" maxlength="15" /></div>
		<div class="popBottom"><span class="btn2"><span><button type="submit" onclick="tourl();">提 交</button></span></span><span class="bt2"><span><button type="button" onclick="closep();">取消</button></span></span></div>
	</form></div>
<script>
function tourl() {
	var aid = getObj('aidvalue').value;
	var viewpwd = getObj('pwdvalue').value;
	var ifspace = getObj('ifspace').value;
	var ifriend = getObj('ifriend').value;
	var uid = getObj('uid').value;
	var data = '';
	if(ifspace == 1 || ifspace == '1'){
		data = '&uid='+uid;
	}
	if(ifriend == 1 || ifriend == '1'){
		data += '&ifriend='+ifriend;
	}
	ajax.send("{$basename}a=albumcheck",'aid=' + aid + '&viewpwd=' + viewpwd+data,function(){
		var rText = ajax.request.responseText;
		if (rText == 'fail') {
			showDialog('error','密碼錯誤,請重新輸入',2);
		} else if (rText == 'empty') {
			showDialog('error','密碼不能為空,請重新輸入',2);
		} else if (rText == 'success') {
			window.location.href = "{$basename}&a=album&aid=" + aid + data;
		} else {
			showDialog('error','數據鏈接出錯',2);
		}
	});
}
</script>
<!--
EOT;
} elseif ($a == 'createajax') {
print <<<EOT
-->
	<div style="width:450px;">
	<div class="popTop">創建相冊</div>
	<table class="vt mb5 z" width="100%">
		<tr class="tr3">
			<td width="70">相冊名*</td>
			<td><input type="text" class="input input_wa mr5" id="c_ajax_aname" name="aname" /><span id="c_ajax_aname_warn">限 24 字節</span></td>
		</tr>
		<tr class="tr3">
			<td>描述</td>
			<td>
				<textarea id="c_ajax_aintro" name="aintro" class="textareaA mb5"></textarea>
				<p id="c_ajax_aintro_warn" class="gray"> 限 255 字節</p>
			</td>
		</tr>
		<tr class="tr3">
			<td>可見度</td>
			<td>
				<select name="private" id="private_info" onchange="optionsel(this.value)" class="select_wa">
					<option value="0">全站用戶可見</option>
					<option value="1">僅好友可見</option>
					<option value="2">僅自己可見</option>
					<option value="3">需要密碼訪問</option>
				</select>
			</td>
		</tr>
		<tbody id="photopwd" style="display:none">
		<tr class="tr3">
			<td>輸入密碼</td>
			<td>
				<input type="password" name="pwd" class="input input_wa mr5" id="c_ajax_pwdinfo" /><span id="c_ajax_pwdinfo_warn">最小長度:3 最大長度:15</span>
			</td>
		</tr>
		<tr class="tr3">
			<td>確認密碼</td>
			<td>
				<input type="password" name="repwd" class="input input_wa" id="repwd_info" />
			</td>
		</tr>
		</tbody>
		<!--
EOT;
if ($o_photos_gdcheck) {
$checkCode = L::loadClass('checkcode', 'site');
$checkCodeString = $checkCode->getCheckCodeTemplate();
print <<<EOT
-->
		<tr class="tr3">
			<td>驗證碼:*</td>
			<td>
$checkCodeString
				<div id="ckcode" style="display:none;margin-bottom:5px;"></div>
				<br />
				<input class="input" onfocus="showgd();" type="text" name="gdcode" id="gdcode" style="width:50px;" tabindex="3"  />
			</td>
		</tr>
<!--
EOT;
}if($db_question && $o_photos_qcheck){
if($db_imagequestion){
	$question = '<img id="ckquestion" src="ckquestion.php?q='.$qkey.'&t='.$timestamp.'" align="top">';
}else{
	$question = $qkey<0 ? getMachineQuestion_1() :  $db_question[$qkey];
}
$q_a = $question.($showq && $qkey>0?" （答案︰".$db_answer[$qkey] . '）' : '');
print <<<EOT
-->
		<tr class="tr3">
			<td>驗證問題*</td>
			<td>
			<div>{$q_a}</div>
			<input class="input" name="qanswer" id="qanswer" size="25" tabindex="7" />
			<input type="hidden" name="qkey" id="qkey" value="$qkey" />
			</td>
		</tr>
<!--
EOT;
}print <<<EOT
-->
	</table>
	<div class="popBottom"><span class="btn2"><span><button type="submit" onclick="fetchvalue();">提 交</button></span></span><span class="bt2"><span><button type="button" onclick="closep();">取消</button></span></span></div>
	</div>
<script>
var charset = '$db_charset';
setTimeout(function(){initCheckTextNum('c_ajax_aname','c_ajax_aname_warn',24);},300);
setTimeout(function(){initCheckTextNum('c_ajax_aintro','c_ajax_aintro_warn',255);},300);
setTimeout(function(){initCheckTextNum('c_ajax_pwdinfo','c_ajax_pwdinfo_warn',15);},300);

function optionsel(id) {
	pwdobj = getObj('photopwd');
	if (isNaN(id)) {
		showDialog('error','非法操作');
	}
	if (id == '3') {
		pwdobj.style.display = '';
	} else {
		pwdobj.style.display = 'none';
	}
}
function fetchvalue() {
	var aname = getObj('c_ajax_aname').value;
	var aintro = getObj('c_ajax_aintro').value;
	var privated = getObj('private_info').value;
	var pwd = getObj('c_ajax_pwdinfo').value;
	var repwd = getObj('repwd_info').value;
	var albumnum = "$o_maxphotonum";
	var maxlength
	if(albumnum == "" || albumnum == 0 || albumnum == "0"){
		albumnum = "";
	}else{
		var maxlength = albumnum;
		albumnum = '您還可以上傳'+albumnum+'張照片';
	}
	if (IsElement('gdcode')){
		var gdcode = getObj('gdcode').value;
	}
	if (IsElement('qanswer')){
		var qanswer = getObj('qanswer').value;
	}
	if (IsElement('qkey')){
		var qkey = getObj('qkey').value;
	}
    if(IsElement('gdcode') && gdcode == ""){
        showDialog('error','請輸入驗證碼',2);
        return false;
    }
	if (IsElement('qanswer') && qanswer == ""){
		showDialog('error','請輸入問題答案',2);
        return false;
	}
	ajax.send("{$basename}a=create",'step=2&checkpwd=1&aname=' + aname + '&aintro=' + aintro + '&pwd=' + pwd + '&repwd=' + repwd + '&private=' + privated + '&gdcode=' + gdcode + '&qanswer=' + qanswer + '&qkey=' + qkey + '&ajax=1',function(){
		var rText = ajax.request.responseText.split('\\t');
		if (rText[0] == 'success') {
			var aidsel = getObj('aidsel_info');
			var option = elementBind('option');
			option.innerHTML = aname;
			option.value = rText[1];
			option.selected = 'selected';

			//photoselect.vir.getElementsByTagName('h4')[0].innerHTML=aname;
			aidsel.insertBefore(option,null);
			aidsel.selectedIndex = aidsel.options.length-1;
			getObj('aidsel_info').parentNode.getElementsByTagName('a')[0].innerHTML= aname;
			var job = '$job';
			if (job == 'flash') {
				uploader.setAlbumId(aidsel.value);
				showDialog('success','相冊添加成功!',2,function(){
				});
			}
			getObj('allowflash').innerHTML = albumnum;
			showDialog('success','相冊添加成功!',2,function(){
			});
			uploader.maxLength = maxlength;
			uploader.countFile();
			
		} else if (rText[0] == 'limit_num') {
			showDialog('error','您創建的相冊已經達到'+rText[1]+'個',2);
			
		} else if (typeof rText[1] != 'undefined') {
			showDialog('error',rText[1] != '' ? rText[1] : '非法錯誤',2);
		} else {
			showDialog('error',ajax.request.responseText,2);
		}
		read.menu.style.top="300px";
		closep();
	});

}
</script>
<!--
EOT;
}?>-->