<?php widget("fhead");include($path_cache.DS."mod_agent_Shared_fhead.php"); ?>
<body class="mainbg">
	<?php $item = $vd['item']; ?>
	<div id="mainhearder"><span>您的位置：<a href="<?php echo $vd['root']; ?>index.php?m=mod_b2b&a=Home">直销商管理系统</a> >> 帐户管理 >> 员工管理</span></div>
	<div id="hearder"><span>编辑员工</span></div>
	<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
	<td class="tableleft">
		<form method="post" action="index.php?m=mod_agent&c=staff&a=save">
		<?php $item = $vd['item']; ?>
		<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table1">
    <tr>
      <td width="22%"class="tableleft1"><b>员工编号：</b></td>
      <td width="78%" class="tableright1"><?php echo $item['staffid']; ?></td>
    </tr>
    <tr>
      <td class="tableleft1"><b>员工帐号：</b></td>
      <td class="tableright1"><?php echo $item['staffname']; ?></td>
    </tr>
    <tr>
      <td class="tableleft1"><b>登陆密码：</b></td>
      <td class="tableright1">
      <input type="password" class="input" style="font-weight:normal;background:#EAEAEA" id="staffpwd" name="staffpwd" readonly/><span id="spanstaffpwd"></span><input type="checkbox" onclick="enable(this)" style="vertical-align:middle;"/> 修改登陆密码(谨慎使用)</td>
    </tr>
    <tr>
      <td class="tableleft1"><b>确认登陆密码：</b></td>
      <td class="tableright1">
      <input type="password" class="input" style="font-weight:normal;background:#EAEAEA" id="restaffpwd" name="restaffpwd" readonly/><span id="spanrestaffpwd"></span></td>
    </tr>
    <tr>
      <td class="tableleft1"><b>交易密码：</b></td>
      <td class="tableright1">
      <input type="password" class="input" style="font-weight:normal;background:#EAEAEA" id="tradepwd" name="tradepwd" readonly/><span id="spanstaffpwd"></span><input type="checkbox" onclick="enable1(this)" style="vertical-align:middle;"/> 修改交易密码(谨慎使用)</td>
    </tr>
    <tr>
      <td class="tableleft1"><b>确认交易密码：</b></td>
      <td class="tableright1">
      <input type="password" class="input" style="font-weight:normal;background:#EAEAEA" id="retradepwd" name="tradepwd" readonly/><span id="spanrestaffpwd"></span></td>
    </tr>
    <tr>
		  <td class="tableleft1"><b>使用交易密码：</b></td>
		  <td class="tableright1"><input type="radio" name="checktradepwd" value="1" id="usetradepass"<?php if($item['checktradepwd']==1){ ?> checked<?php } ?> /><label for="usetradepass" tabindex="7"><u><font color=#0000ff>启用交易密码</font></u></label> <input type="radio" name="checktradepwd" value="0" id="nousetradepass" <?php if($item['checktradepwd']==0){ ?> checked<?php } ?>><label for="nousetradepass"><u><font color=#ff0000>不启用交易密码</font></u></label></td>
		</tr>
    <tr>
      <td class="tableleft1"><b>姓名：</b></td>
      <td class="tableright1">
      <input type="text" class="input" style="font-weight:normal" id="realname" name="realname" value="<?php echo $item['realname']; ?>"/><span id="spanrealname"></span></td>
    </tr>
    <tr>
      <td class="tableleft1"><b>邮箱：</b></td>
      <td class="tableright1">
      <input type="text" class="input" style="font-weight:normal" id="email" name="email" value="<?php echo $item['email']; ?>"/><span id="spanemail"></span></td>
    </tr>
    <tr>
      <td class="tableleft1"><b>手机：</b></td>
      <td class="tableright1">
      <input type="text" class="input" style="font-weight:normal" id="mobile" name="mobile" value="<?php echo $item['mobile']; ?>"/><span id="spanmobile"></span></td>
    </tr>
    <tr>
      <td class="tableleft1"><b>电话：</b></td>
      <td class="tableright1">
      <input type="text" class="input" style="font-weight:normal" id="tel" name="tel" value="<?php echo $item['tel']; ?>"/><span id="spantel"></span></td>
    </tr>
    <tr>
      <td class="tableleft1"><b>地址：</b></td>
      <td class="tableright1">
      <input type="text" class="input" style="font-weight:normal" id="addr" name="addr" value="<?php echo $item['addr']; ?>"/><span id="spanaddr"></span></td>
    </tr>
    <tr>
      <td class="tableleft1"><b>其他：</b></td>
      <td class="tableright1">
      <input type="text" class="input" style="font-weight:normal" id="other" name="other" value="<?php echo $item['other']; ?>"/><span id="spanother"></span></td>
    </tr>
    <tr>
		  <td class="tableleft1"><b>帐户状态：</b></td>
		  <td class="tableright1"><input type="radio" name="frozen" value="0" id="nofrozen"<?php if($item['frozen']==0){ ?> checked<?php } ?> /><label for="nofrozen" tabindex="7"><u><font color=#0000ff>启动</font></u></label> <input type="radio" name="frozen" value="1" id="frozen" <?php if($item['frozen']==1){ ?> checked<?php } ?>><label for="frozen"><u><font color=#ff0000>冻结</font></u></label></td>
		</tr>
    <tr>
      <td class="tableleft1"><b>每日销售限额：</b></td>
      <td class="tableright1">
      	<input type="text" class="input" style="font-weight:normal" id="dayconsum" name="dayconsum" value="<?php echo $item['dayconsum']; ?>"/> 0表示不限制</td>
    </tr>
    <tr>
		<td class="tableleft1"><b>显示进价：</b></td>
		<td class="tableright1"><input type="radio" name="canseeprice" value="1" id="canseeprice"<?php if($item['canseeprice']==1){ ?> checked<?php } ?>/><label for="canseeprice"><font color=#0000ff><u>显示</u></font></label> <input type="radio" name="canseeprice" value="0" id="nodisprice" tabindex="20" <?php if($item['canseeprice']==0){ ?> checked<?php } ?>><label for="nodisprice"><font color=#cccccc><u>不显示</u></font></label></td>
		</tr>
		<?php $temp=explode('|', $item['ini']); ?>
		<tr>
		<td class="tableleft1"><b>修改售价：</b></td>
		<td class="tableright1"><input type="radio" name="caneditbuyerprice" value="1" id="caneditbuyerprice"<?php if($temp[0]==1){ ?> checked<?php } ?> tabindex="21"><label for="caneditbuyerprice"><font color=#0000ff><u>能修改</u></font></label> <input type="radio" name="caneditbuyerprice" value="0" id="noeditprice" <?php if($temp[0]==0){ ?> checked<?php } ?>><label for="noeditprice"><font color=#cccccc><u>不能修改</u></font></label></td>
		</tr>
		<tr>
		<td class="tableleft1"><b>能否查询其他员工记录：</b></td>
		<td class="tableright1"><input type="radio" name="canseeothers" value="1" id="canseeothers"<?php if($temp[1]==1){ ?> checked<?php } ?> /><label for="canseeothers"><font color=#0000ff><u>能查看</u></font></label> <input type="radio" name="canseeothers" value="0" id="noqueryotherdata" <?php if($temp[1]==0){ ?> checked<?php } ?>><label for="noqueryotherdata"><font color=#cccccc><u>不能查看</u></font></label></td>
		</tr>
		<tr>
		<td class="tableleft1"><b>员工权限：</b></td>
		<td class="tableright1">
		<?php $item1 = $item; ?>
		<?php
		$auright1 = array(
		array(0,'购卡售用户',1),
		array(1,'进货记录查询',1),
		array(34,'销售记录查询',0),
		array(3,'给账户充值',0),
		array(5,'查看账户资金变动',0),
		array(6,'资金锁定',0),
		array(26,'借款管理',0),
		array(12,'操作日志',0),
		array(16,'在线投诉系统',1),
		array(18,'平台内部短信',1),
		array(19,'汇款通知书',0),
		array(23,'员工帐户管理',0),
		array(11,'员工零售利润报表',0),
		array(35,'员工零售价设定',0),
		array(38,'员工结帐管理',1),
		array(20,'帐户密码设定',1),
		array(15,'账户安全检查',1),
		array(39,'IP及所在地安全绑定',1),
		array(40,'硬件信息安全绑定',1),
		array(41,'手机令牌安全绑定',1),
    array(42,'密保产品安全绑定',1),
    array(52,'积分管理',0)
		);
		
		if($vd['ainfo']['tbcz'] == 1)
    {
    	$auright1[] = array(64,'淘宝小店列表/挂机',0);
    	$auright1[] = array(65,'淘宝小店添加',0);
    	$auright1[] = array(66,'淘宝订单记录',0);
    }
		
		$auright2 = array(
		array(51,'管理经销商系统',0),
		array(4,'账户余额详细',0),
		array(2,'修改下家进价',0),
		array(9,'划款给下级客户',0),
		array(13,'代注册下级帐号',0),
		array(14,'下级客户档案管理',0),
		array(28,'自有商品发布与管理',0),
		array(29,'自有商品添加',0),
		array(45,'自有商品定价',0),
		array(31,'自有商品库存',0),
    array(56,'自有商品充值管理',0),
		array(44,'商品销售报表查询',0),
		array(32,'销售收入入帐记录',0),
		array(30,'下级客户价格管理',0),
		array(46,'下级客户购卡权限',0),
		array(47,'下级客户消费记录',0),
		array(48,'下级汇款通知书',0),
		array(49,'业务员帐户管理',0),
    array(50,'业务员业绩查询',0),
    array(57,'代理一卡通列表',0),
    array(58,'代理一卡通换购记录',0),
    array(59,'换购商品返点费率',0),
    array(60,'一卡通返点明细',0)
		);
		
		if($vd['ainfo']['vipshop'] == 1)
    {
    	$auright2[] = array(53,'VIP平台设置',0);
      $auright2[] = array(62,'VIP风格选择',0);
      $auright2[] = array(63,'VIP风格自定义',0);
      $auright2[] = array(54,'VIP平台广告',0);
      $auright2[] = array(55,'VIP平台公告',0);
    }

		?>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr><td colspan="4"><b>直销商功能：</b></td></tr>
			<?php $i=0;foreach($auright1 as $item){ ?>
			
			<?php if($vd['leftrights'][$item[0]] == 1){ ?>
			
      <?php if($i == 0){ ?>
      <tr>
      <?php }$i++; ?>
        <td width="25%"><input type="checkbox" value="1" id="rights_<?php echo $item[0]; ?>" name="rights_<?php echo $item[0]; ?>" /><label for="rights_<?php echo $item[0]; ?>"><?php echo $item[1]; ?></label></td>
    	<?php if($i == 4){ ?>
    	</tr>
    	<?php $i=0;} ?>
    	
    	<?php } ?>
    	
    	<?php } ?>
    	<?php if($i > 0){ ?>
    	<?php for($j=0; $j < 4 - $i; $j++){ ?>
    	<td width="25%" class=stline>&nbsp;</td>
    	<?php } ?>
      </tr>
    	<?php } ?>
		</table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr><td colspan="4"><b>经销商功能：</b></td></tr>
			<?php $i=0;foreach($auright2 as $item){ ?>
			
			<?php if($vd['leftrights'][$item[0]] == 1){ ?>
			
      <?php if($i == 0){ ?>
      <tr>
      <?php }$i++; ?>
        <td width="25%"><input type="checkbox" value="1" id="rights_<?php echo $item[0]; ?>" name="rights_<?php echo $item[0]; ?>" <?php if($item[2]){ ?> checked<?php } ?> /><label for="rights_<?php echo $item[0]; ?>"><?php echo $item[1]; ?></label></td>
    	<?php if($i == 4){ ?>
    	</tr>
    	<?php $i=0;} ?>
    	
    	<?php } ?>
    	
    	<?php } ?>
    	<?php if($i > 0){ ?>
    	<?php for($j=0; $j < 4 - $i; $j++){ ?>
    	<td width="25%" class=stline>&nbsp;</td>
    	<?php } ?>
      </tr>
    	<?php } ?>
		</table>
		<br/>
		</td>
		</tr>
		<?php $item = $item1; ?>
		<?php if(!isset($vd['secitem']['ipcheck'])){;$vd['secitem']['ip']=',,,';$vd['secitem']['ipcheck']=0;} ?>
    <?php if(!isset($vd['secitem']['maccheck'])){;$vd['secitem']['mac']=',,,';$vd['secitem']['maccheck']=0;}  ?>
    <?php if(!isset($vd['secitem']['hdecheck'])){;$vd['secitem']['hde']=',,,';$vd['secitem']['hdecheck']=0;}  ?>
    <?php if(!isset($vd['secitem']['cpucheck'])){;$vd['secitem']['cpu']=',,,';$vd['secitem']['cpucheck']=0;}  ?>
		<tr>
      <td class="tableleft1"><b>绑定IP：</b></td>
      <td class="tableright1">
      <input type="radio" name="ipcheck" value="1" onclick="setdisp('ip',1)"  id="yesbind" <?php if($vd['secitem']['ipcheck']==1){ ?> checked <?php } ?>><label for="yesbind"><font color=#0000ff>绑定IP地址</font></label> <input type="radio" name="ipcheck" value="0" onclick="setdisp('ip',0)" id="nobind" <?php if($vd['secitem']['ipcheck']==0){ ?> checked <?php } ?>><label for="nobind"><font color=#cccccc>未绑定IP地址</font></label>
      </td>
    </tr>
    <?php $ips=explode(',', $vd['secitem']['ip'].',,,,,'); ?>
		<tr id="iptr"<?php if($vd['secitem']['ipcheck']==0){ ?> style="display:none"<?php } ?>>
		  <td class="tableleft1"><b>IP地址：</b></td>
		  <td class="tableright1">
		  	<?php for($i=0; $i<5; $i++){ ?>
		  	<div style="height:30px">
		  	<input type="text" class="myinput" size="25" name="ip[]" id="ip_<?php echo $i; ?>" value="<?php echo $ips[$i]; ?>"/>
		    <input type="button" name="button" value="取IP地址" class="button" onclick="getip(<?php echo $i; ?>)"></div>
		  	<?php } ?>
		  </td>
		</tr>
		<tr>
      <td class="tableleft1"><b>绑定网卡：</b></td>
      <td class="tableright1">
      <input type="radio" name="maccheck" value="1" onclick="setdisp('mac',1)"  id="yesbindmac" <?php if($vd['secitem']['maccheck']==1){ ?> checked <?php } ?>><label for="yesbindmac"><font color=#0000ff>绑定网卡地址</font></label> <input type="radio" name="maccheck" value="0" onclick="setdisp('mac',0)" id="nobindmac" <?php if($vd['secitem']['ipcheck']==0){ ?> checked <?php } ?>><label for="nobindmac"><font color=#cccccc>未绑定网卡地址</font></label>
      </td>
    </tr>
    <?php $macs=explode(',', $vd['secitem']['mac'].',,,,,'); ?>
		<tr id="mactr"<?php if($vd['secitem']['maccheck']==0){ ?> style="display:none"<?php } ?>>
		  <td class="tableleft1"><b>网卡地址：</b></td>
		  <td class="tableright1">
		  	<?php for($i=0; $i<5; $i++){ ?>
		  	<div style="height:30px">
		  	<input type="text" class="myinput" size="25" name="mac[]" id="mac_<?php echo $i; ?>" value="<?php echo $macs[$i]; ?>"/>
		    <input type="button" name="button" value="取本机网卡" class="button" onclick="getmac(<?php echo $i; ?>)"></div>
		  	<?php } ?>
		  </td>
		</tr>
		<tr>
      <td class="tableleft1"><b>绑定硬盘：</b></td>
      <td class="tableright1">
      <input type="radio" name="hdecheck" value="1" onclick="setdisp('hde',1)"  id="yesbindhde" <?php if($vd['secitem']['hdecheck']==1){ ?> checked <?php } ?>><label for="yesbindhde"><font color=#0000ff>绑定硬盘编码</font></label> <input type="radio" name="hdecheck" value="0" onclick="setdisp('hde',0)" id="nobindhde" <?php if($vd['secitem']['hdecheck']==0){ ?> checked <?php } ?>><label for="nobindhde"><font color=#cccccc>未绑定硬盘编码</font></label>
      </td>
    </tr>
    <?php $hdes=explode(',', $vd['secitem']['hde'].',,,,,'); ?>
		<tr id="hdetr"<?php if($vd['secitem']['hdecheck']==0){ ?> style="display:none"<?php } ?>>
		  <td class="tableleft1"><b>硬盘编码：</b></td>
		  <td class="tableright1">
		  	<?php for($i=0; $i<5; $i++){ ?>
		  	<div style="height:30px">
		  	<input type="text" class="myinput" size="25" name="hde[]" id="hde_<?php echo $i; ?>" value="<?php echo $hdes[$i]; ?>"/>
		    <input type="button" name="button" value="取本机硬盘" class="button" onclick="gethde(<?php echo $i; ?>)"></div>
		  	<?php } ?>
		  </td>
		</tr>
		<tr>
      <td class="tableleft1"><b>绑定CPU：</b></td>
      <td class="tableright1">
      <input type="radio" name="cpucheck" value="1" onclick="setdisp('cpu',1)" id="yesbindcpu" <?php if($vd['secitem']['cpucheck']==1){ ?> checked <?php } ?>><label for="yesbindcpu"><font color=#0000ff>绑定CPU编码</font></label> <input type="radio" name="cpucheck" value="0" onclick="setdisp('cpu',0)" id="nobindcpu" <?php if($vd['secitem']['cpucheck']==0){ ?> checked <?php } ?>><label for="nobindcpu"><font color=#cccccc>未绑定CPU编码</font></label>
      </td>
    </tr>
    <?php $cpus=explode(',', $vd['secitem']['cpu'].',,,,,'); ?>
		<tr id="cputr"<?php if($vd['secitem']['cpucheck']==0){ ?> style="display:none"<?php } ?>>
		  <td class="tableleft1"><b>CPU编码：</b></td>
		  <td class="tableright1">
		  	<?php for($i=0; $i<5; $i++){ ?>
		  	<div style="height:30px">
		  	<input type="text" class="myinput" size="25" name="cpu[]" id="cpu_<?php echo $i; ?>" value="<?php echo $cpus[$i]; ?>"/>
		    <input type="button" name="button" value="取本机CPU" class="button" onclick="getcpu(<?php echo $i; ?>)"></div>
		  	<?php } ?>
		  </td>
		</tr>
		<?php if(isset($vd['secitem']['mibaokacheck']) && $vd['secitem']['mibaokacheck']==1){ ?>
		<tr>
		  <td class="tableleft1"><b>密保卡绑定状态：</b></td>
		  <td class="tableright1"><b><font color="#0000ff">已绑定</font></b></td>
		</tr>
		<tr>
		  <td class="tableleft1"><b>绑定操作：</b></td>
		  <td class="tableright1">
		     <div style="padding-top:10px"><input type="button" value="申请解绑" onclick="javascript:window.location.href='index.php?m=mod_agent&c=Messenger&a=add&msgtitle=<?php echo urlencode('给员工'.$item['staffid'].'申请密保卡解绑'); ?>'" class="button" style="cursor:pointer"> </div>
		  </td>
		</tr>
		<?php }else{ ?>
		<tr>
		  <td class="tableleft1"><b>密保卡绑定状态：</b></td>
		  <td class="tableright1"><b><font color="#cccccc">未绑定</font></b>
		</td>
		</tr>
		<tr>
		  <td class="tableleft1"><b>绑定操作：</b></td>
		  <td class="tableright1">
		     <div style="padding-top:10px"><input type="button" value="免费申请密保卡" onclick="javascript:window.location.href='index.php?m=mod_agent&c=Messenger&a=add&msgtitle=<?php echo urlencode('给员工'.$item['staffid'].'申请密保卡'); ?>'" class="button" style="cursor:pointer"> </div>
		  </td>
		</tr>
		<?php } ?>
		<?php if(isset($vd['secitem']['mobilecheck']) && $vd['secitem']['mobilecheck']==1){ ?>
		<tr>
		  <td class="tableleft1"><b>令牌绑定状态：</b></td>
		  <td class="tableright1"><b><font color="#0000ff">已绑定</font></b></td>
		</tr>
		<tr>
		  <td class="tableleft1"><b>绑定操作：</b></td>
		  <td class="tableright1">
		     <div style="padding-top:10px"><input type="button" value="申请解绑" onclick="javascript:window.location.href='index.php?m=mod_agent&c=Messenger&a=add&msgtitle=<?php echo urlencode('给员工'.$item['staffid'].'申请令牌解绑'); ?>'" class="button" style="cursor:pointer"> </div>
		  </td>
		</tr>
		<?php }else{ ?>
		<tr>
		  <td class="tableleft1"><b>密保卡绑定状态：</b></td>
		  <td class="tableright1"><b><font color="#cccccc">未绑定</font></b>
		</td>
		</tr>
		<tr>
		  <td class="tableleft1"><b>绑定操作：</b></td>
		  <td class="tableright1">
		     <div style="padding-top:10px"><input type="button" value="申请令牌"  onclick="javascript:window.location.href='index.php?m=mod_agent&c=Messenger&a=add&msgtitle=<?php echo urlencode('给员工'.$item['staffid'].'申请令牌'); ?>'" class="button" style="cursor:pointer"> </div>
		  </td>
		</tr>
		<?php } ?>
    <tr>
      <td class="tableleft1"><b>创建时间：</b></td>
      <td class="tableright1"><?php echo $item['createdate']; ?></td>
    </tr>
    <tr>
      <td class="tableleft1"><b>创建IP：</b></td>
      <td class="tableright1"><?php echo $item['createip']; ?></td>
    </tr>
    <tr>
      <td class="tableleft1"><b>最近访问时间：</b></td>
      <td class="tableright1"><?php echo $item['thisdate']; ?></td>
    </tr>
    <tr>
      <td class="tableleft1"><b>最近访问IP：</b></td>
      <td class="tableright1"><?php echo $item['thisip']; ?></td>
    </tr>
    <td align="right" class="tableleft1">总帐号超级密码：</td>
		<td class="tableright1"><input type="password" name="superpwd" size="30" class='input'/></td>
		</tr>
    <tr>
		<td height="30" align="center" class="tableleft1">&nbsp;</td>
		<td height="30" class="tableright1">
		<input type="hidden" value="<?php echo $item['rights']; ?>" id="thisright"/>
    <input type="hidden" value="<?php echo $item['staffid']; ?>" name="staffid"/>	
		<input type="submit" name="submit" value="提交修改" class="button" tabindex="24">
		<input type="reset" value="重新填写" class="button" name="reset" tabindex="25">
		</td>
		</tr>
  </table>
  </form> 
  </td>
	</tr>
</table>
<object id="t1" codeBase="<?php echo $vd['sc']; ?>tools/umebiz.cab" classid="CLSID:B8748B60-E34D-42AA-9309-8012CA4964AC" height=0 width=0 ></object>
<input type="hidden" id="tmac" name="tmac"  value=""/>
<script type="text/javascript">
	var $ = function(id) {
		return document.getElementById(id);
	}
	
	var thisright = $("thisright").value;
	var tmp = thisright.split(",");
	for(var i = 0; i < tmp.length; i++)
	{
		if($("rights_" + i) != null)
		{
		  $("rights_" + i).checked = tmp[i]==1 ? true : false;
		}
	}
	
	function enable(obj)
  {
  	state   = obj.checked ? false : true;
  	bck     = obj.checked ? "#ffffff" : "#EAEAEA";
  	
  	$("staffpwd").readOnly   = state;
  	$("restaffpwd").readOnly = state;
  	
  	$("staffpwd").style.background = bck;
  	$("restaffpwd").style.background = bck;
  	
  	$("staffpwd").value = "";
  	$("restaffpwd").value = "";
  }
  
  function enable1(obj)
  {
  	state   = obj.checked ? false : true;
  	bck     = obj.checked ? "#ffffff" : "#EAEAEA";
  	
  	$("tradepwd").readOnly   = state;
  	$("retradepwd").readOnly = state;
  	
  	$("tradepwd").style.background = bck;
  	$("retradepwd").style.background = bck;
  	
  	$("tradepwd").value = "";
  	$("retradepwd").value = "";
  }
  
  function setdisp(tr, flag)
  {
  	$(tr+"tr").style.display = flag == 1 ? "" : "none"
  }
</script>
<script type="text/JavaScript">
	
function getip(i)
{
	$("ip_"+i).value = "<?php echo $vd['ip']; ?>";
}

function getmac(i)
{
	$("mac_"+i).value = document.all.t1.GetMacAddr;
}

function getcpu(i)
{
	$("cpu_"+i).value = document.all.t1.GetCpuId;
}

function gethde(i)
{
	$("hde_"+i).value = document.all.t1.GetHDE;
}

</script>
<?php
   $fp = fopen($vd['sc']."tools/root.cer", "r");
   $cert = fread($fp, 8192);
   fclose($fp);
?>
<script type="text/JavaScript">
$("tmac").value = document.all.t1.GetMacAddr;
if($("tmac").value == "" || $("tmac").value == "undefined")
{
  document.write('<object id="XEnroll" classid="clsid:127698e4-e730-4e5c-a2b1-21490a70c8a1" codebase="xenroll.dll"></object>');
}

</script>
<script language="vbscript">
ON ERROR resume next
<?php
    $newcert = "sPKCS7=\"\"\r\n";
    $line=strtok($cert,"\r\n");
    while($line)
    {
     $newcert=$newcert."     sPKCS7=sPKCS7 & \"".$line."\" & vbcrlf\r\n";
     $line=strtok("\r\n");
    }
    echo $newcert;
?> 
XEnroll.InstallPKCS7 sPKCS7 
</script>
</body>
</html>