<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
?>
<!--<?php
print <<<EOT
-->
<!-- Start Draw Magic Face -->
<SCRIPT LANGUAGE="JavaScript">
<!--
function MM_showHideLayers() { //v6.0

  var i,p,v,obj,args=MM_showHideLayers.arguments;
  obj=parent.document.getElementById("MagicFaced");
  for (i=0; i<(args.length-2); i+=3) if (obj) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}

function DispMagicEmot(MagicID,H,W){
	MagicFaceUrl = "dv_plus/tools/magicface/swf/" + MagicID + ".swf";
	var obj = parent.document.getElementById("MagicFaced");
	obj.innerHTML = '<OBJECT codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + W + '" height="' + H + '"><PARAM NAME=movie VALUE="'+ MagicFaceUrl +'"><param name=menu value=false><PARAM NAME=quality VALUE=high><PARAM NAME=play VALUE=false><param name="wmode" value="transparent"><embed src="' + MagicFaceUrl +'" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + W + '" height="' + H + '"></embed>';
	obj.style.top = (parent.document.body.scrollTop+((parent.document.body.clientHeight-300)/2))+"px";
	obj.style.left = (parent.document.body.scrollLeft+((parent.document.body.clientWidth-480)/2))+"px";
	obj.style.display = 'block';
	MagicID += Math.random();
	setTimeout("MM_showHideLayers('MagicFaced','','none')",8000);
	NowMeID = MagicID;
}
//-->
</SCRIPT>
<!-- End Draw Magic Face -->
<script language="javascript">
function select(image1,M,T,A1,A2,A3,A4,A5){
	var UserMoney = '{$userinfo['usermoney']}';
	var UserTicket = '{$userinfo['userticket']}';
	var UserArticle = '{$userinfo['userpost']}';
	var UserWealth = '{$userinfo['userwealth']}';
	var UserEP = '{$userinfo['userep']}';
	var UserCP = '{$userinfo['usercp']}';
	var UserPower = '{$userinfo['userpower']}';
	if(UserMoney < M && UserTicket < T){alert("{$lang['tpl.str1']}{$strSV}{$lang['tpl.str21']}");return false;}
	if(UserArticle < A1){alert("{$lang['tpl.str2']}{$strSV}{$lang['tpl.str3']}");return false;}
	if(UserWealth < A2){alert("{$lang['tpl.str2']}{$strSV}{$lang['tpl.str3']}");return false;}
	if(UserEP < A3){alert("{$lang['tpl.str2']}{$strSV}{$lang['tpl.str3']}");return false;}
	if(UserCP < A4){alert("{$lang['tpl.str2']}{$strSV}{$lang['tpl.str3']}");return false;}
	if(UserPower < A5){alert("{$lang['tpl.str2']}{$strSV}{$lang['tpl.str3']}");return false;}
	var image2 = 'dv_plus/tools/magicface/gif/'+image1+'.gif';
	//parent.document.images['magicfacepic'].src=image2;
	parent.document.getElementById("magicmoney").innerHTML = M;
	parent.document.getElementById("magicticket").innerHTML = T;
	parent.document.getElementById("smagicface").value = image1;
}
function norightclick(e) 
{
	event.cancelBubble = true
	event.returnValue = false;
	return false;
}
document.oncontextmenu = norightclick;
</script>
<!--
EOT;
if( !is_numeric($page) || $page < 1 ){
	$page = 1;
}
if( !is_numeric($stype) ){
	$stype = -2;
}
print <<<EOT
-->
<table cellspacing=0 cellpadding=0 align=center class=" tableborder" border=0>
<tr>
<th align=left height=25 ID="TableTitleLink" colspan=8>{$lang['tpl.str4']}{$sv}:<a href="?boardid={$boardid}&s={$s}">{$lang['tpl.str5']}</a> | <a href="?boardid={$boardid}&stype=-1&s={$s}">{$lang['tpl.str6']}</a> | 
<!--
EOT;
$arrMagicFaceType = explode('|',$lang['MagicFaceType']);
if( is_array($arrMagicFaceType) ){
	$count = count($arrMagicFaceType);
	foreach( $arrMagicFaceType as $index => $val ){
		if( $index === ($count - 1) ){
			print <<<EOT
-->
<a href="?boardid={$boardid}&stype={$index}&s={$s}">{$val}</a>
<!--
EOT;
		} else{
			print <<<EOT
-->
<a href="?boardid={$boardid}&stype={$index}&s={$s}">{$val}</a> | 
<!--
EOT;
		}
	}
}
print <<<EOT
-->
| <a href="userpay.php" target=_blank>{$lang['tpl.str7']}</a>
</th>
</tr>
<tr>
<td rowspan="5" width="5"  style="border-right : 1px dotted gray;background-color:#F0F0F0;"><div align=right style="float:right;font-size:11px;word-spacing: 2;font-family:Verdana;font-weight:bold;writing-mode:tb-rl;" title="{$lang['tpl.str20']}"><a href="http://home.dvbbs.net" target=_blank><font style="color:#CC00FF;"><font style="color:#33CCFF;">DV</font>-<font style="color:#D98200;">M</font>agic<font style="color:#D98200;">F</font>ace</font></a></div>
</td>
<td class="tablebody2" colspan=7>&nbsp;{$lang['tpl.str8']}<font color=red><B>{$userinfo['usermoney']}</B></font>{$lang['tpl.str9']}<font color=red><B>{$userinfo['userticket']}</B></font> {$lang['tpl.str10']}</td>
</tr>
<!--
EOT;
$arrMagicFace =& getMagicFace();
$iii = 0;
if( is_array($arrMagicFace) && $arrMagicFace['ResultSets'] !== false ){
	foreach( $arrMagicFace['ResultSets'] as $index => $val ){
		$arrMagicSetting = explode('|',$val['magicsetting']);
		$strTR = '';
		if( $index % 7 === 0 ){
			if( $index === 0 ){
				$strTR = '<tr>';
			} else{
				$strTR = '</tr><tr>';
			}
			$iii++;
		}
		print <<<EOT
-->{$strTR}
<td valign="top" class="tablebody1" style="width:60">
	<div align="center" bgcolor="F8F8F8">
		<img src="dv_plus/tools/magicface/gif/{$val['magicface_s']}.gif" title="{$val['title']}" width="40" height="39" border="0" alt="{$val['title']}" class="ImgOnclick"  onClick="select('{$val['magicface_s']}',{$val['money']},{$val['ticket']},{$arrMagicSetting[0]},{$arrMagicSetting[1]},{$arrMagicSetting[2]},{$arrMagicSetting[3]},{$arrMagicSetting[4]})" onMouseDown="DispMagicEmot({$val['magicface_s']},350,500)">
		</div><div align="center" style="padding:2px">
		<font color=gray style="font-size: 11px" title="{$lang['tpl.str11']}{$vval['money']}{$lang['tpl.str12']}{$vval['ticket']}{$lang['tpl.str13']}">{$val['money']} / {$val['ticket']}</font></td>
	</div>
</td>
<!--
EOT;
	}
	$count = count($arrMagicFace['ResultSets']);
	if( $count > 0 ){
		print '--'.'>';
		$mod = $count % 7;
		if( $mod > 0 && $mod < 7 ){
			print str_repeat('<td width="56" class="tablebody1"></td>',7-$mod);
		}
		print '</tr><!--';
		if( $iii == 1 ){
			print '--'.'><tr><td colspan="7"></td></tr><tr><td colspan="7"></td></tr><!--';
		} elseif( $iii == 2 ){
			print '--'.'><tr><td colspan="7" class="tablebody1"></td></tr><!--';
		}
	}
}
if( $stype == -2 ){
	$strTmp1 = $lang['tpl.str14'];
} elseif( $stype == -1 ){
	$strTmp1 = $lang['tpl.str15'];
}
print <<<EOT
-->
</table>
<table width="403" border="0" cellspacing="0" cellpadding="0" height="26" align=center>
	<form action="?" method="post">
	<tr>
		<td width="9" align="right" height="22">&nbsp;</td>
		<td width="90" height="22"><img src="dv_plus/tools/magicface/dot.gif" width="7" height="7">
		<b><font color="#D98200">{$strTmp1}{$arrMagicFaceType[$stype]}</font></b></td>
		<td width="120"><font color=blue>{$lang['tpl.str16']}</font></td>
		<td width="58" height="22" align="right">
<!--
EOT;
if( $page == 1 ){
	if( $arrMagicFace['PageCount'] > 1 ){
		$nextPage = $page + 1;
		print <<<EOT
-->
			<a href='?boardid={$boardid}&stype={$stype}&page={$nextPage}&s={$s}'>{$lang['tpl.str17']}</a>
<!--
EOT;
	}
} else{
	if( $arrMagicFace['PageCount'] == $page ){
		$prevPage = $page - 1;
		print <<<EOT
-->
			<a href='?boardid={$boardid}&stype={$stype}&page={$prevPage}&s={$s}'>{$lang['tpl.str18']}</a>
<!--
EOT;
	} else{
		$prevPage = $page - 1;
		$nextPage = $page + 1;
		print <<<EOT
-->
			<a href='?boardid={$boardid}&stype={$stype}&page={$prevPage}&s={$s}'>{$lang['tpl.str18']}</a>&nbsp;
			<a href='?boardid={$boardid}&stype={$stype}&page={$nextPage}&s={$s}'>{$lang['tpl.str17']}</a>
<!--
EOT;
	}
}
print <<<EOT
-->
		</td>
		<td width="50" align="right"><font class="redfont">{$page}</font>/{$arrMagicFace['PageCount']}&nbsp;&nbsp;</td>
		<td width="26" align="right"><input type="text" name="page" size="1" style="BORDER-top: #C4C4C4 1px solid; BORDER-bottom: #C4C4C4 1px solid; BORDER-left: #C4C4C4 1px solid; BORDER-right: #C4C4C4 1px solid; font-size: 12px;"></td>
		<td width="18">&nbsp;{$lang['tpl.str19']} </td>
		<td width="44" valign="center" height="22" align="center">
		<input type="hidden" name="stype" value="{$stype}"><input type="hidden" name="s" value="{$s}">
		<input type="image" src="dv_plus/tools/magicface/bt_go.gif" onClick="this.form.submit()" style="cursor:hand" name="Submit" value="Submit">
		</td>
	</tr>
	</form>
</table>
<!--
EOT;
?>
-->