<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $_LANG['step3_title'];?></title>
<link rel="stylesheet" media="screen"  href="css/style.css"/>

</head>
<script>
function isIE()
{
	 if (navigator.appName == 'Microsoft Internet Explorer') {
	 	return true;
	 }
	 return false;
}

function trim(text)
{
	return (text || "").replace( /^\s+|\s+$/g, "").replace(/^　+|　+$/g, "");
}

function f_submit()
{
	var i, sign = true;
	for(i = 0; i < document.theForm.elements.length; i++) {
		if (isIE()) {
			if (document.theForm.elements[i].novaild) {
				continue;
			}
		} else {
			if (document.theForm.elements[i].getAttribute('novaild')) {
				continue;
			}
		}
		if (document.theForm.elements[i].type == 'text' || document.theForm.elements[i].type == 'password' || document.theForm.elements[i].type == 'textarea') {
			if (trim(document.theForm.elements[i].value) == '') {
				document.getElementById(document.theForm.elements[i].name+'_msg').innerHTML = '<?php echo $_LANG['js_check_input_empty'];?>';
				sign = false;
			}
			
			if(window.addEventListener){  //FF  
				document.getElementById(document.theForm.elements[i].name).addEventListener("blur", function(evt){var evt = window.event?window.event:evt,target=evt.srcElement||evt.target;if (trim(target.value) != ''){document.getElementById(target.name+'_msg').innerHTML = '';}}, false);    
			}else{  //IE chrome  
				document.getElementById(document.theForm.elements[i].name).attachEvent("onblur", function(evt){var evt = window.event?window.event:evt,target=evt.srcElement||evt.target;if (trim(target.value) != ''){document.getElementById(target.name+'_msg').innerHTML = '';}});    
			}  		
		}
	}
	
	if (sign == true) {
		document.theForm.submit();
	}
	return;
}

function choose_mc(cache)
{
	if (document.theForm.cache.checked == false) {
		document.getElementById('mc_host').disabled = 'disabled';
		document.getElementById('mc_port').disabled = 'disabled';
		if (isIE()) {
			document.getElementById('mc_host').novaild = 'true';
			document.getElementById('mc_port').novaild = 'true';
		} else {
			document.getElementById('mc_host').setAttribute('novaild', 'true');
			document.getElementById('mc_port').setAttribute('novaild', 'true'); 
		}
		document.getElementById('mc_host_notice').innerHTML = '<?php echo $_LANG['mc_host'];?>:';
		document.getElementById('mc_port_notice').innerHTML = '<?php echo $_LANG['mc_port'];?>:';
		document.getElementById('mc_host_msg').innerHTML = '';
		document.getElementById('mc_port_msg').innerHTML = '';
	} else {
		document.getElementById('mc_host').disabled = '';
		document.getElementById('mc_port').disabled = '';
		if (isIE()) {
			document.getElementById('mc_host').novaild = '';
			document.getElementById('mc_port').novaild = '';
		} else {
			document.getElementById('mc_host').setAttribute('novaild', '');
			document.getElementById('mc_port').setAttribute('novaild', ''); 
		}
		document.getElementById('mc_host_notice').innerHTML = '<span>*</span><?php echo $_LANG['mc_host'];?>:';
		document.getElementById('mc_port_notice').innerHTML = '<span>*</span><?php echo $_LANG['mc_port'];?>:';
	}
	
	if (cache == '1') {
		document.getElementById('mc_host').disabled = '';
		document.getElementById('mc_port').disabled = '';
		if (isIE()) {
			document.getElementById('mc_host').novaild = '';
			document.getElementById('mc_port').novaild = '';
		} else {
			document.getElementById('mc_host').setAttribute('novaild', '');
			document.getElementById('mc_port').setAttribute('novaild', ''); 
		}
		document.getElementById('mc_host_notice').innerHTML = '<span>*</span><?php echo $_LANG['mc_host'];?>:';
		document.getElementById('mc_port_notice').innerHTML = '<span>*</span><?php echo $_LANG['mc_port'];?>:';
		document.getElementById('mc_host').value = '<?php echo htmlspecialchars($mc_host);?>';
		document.getElementById('mc_port').value = '<?php echo htmlspecialchars($mc_port);?>';
	}
}

</script>
<body id="step3">
   <div id="wrap">
     <div id="main" >
     
        <?php include_once 'templates/header.php';?>
        
        <div id="content">
          <div class="content-inner">
            <?php include_once 'templates/nav.php';?>
            <div class="middle">
              <div class="pad1">
                <form name="theForm" action="index.php?step=4" method="post" class="step">
                <h3 class="normal-a"><?php echo $_LANG['database_info'];?><span>(<?php echo $_LANG['database_comment'];?>)</span></h3>
                
                  <fieldset>
                    <div class="clear"><label style="margin-bottom:1em"><span>*</span><?php echo $_LANG['db_host'];?>:</label><input type="text" name="db_host" id="db_host" value="<?php echo empty($db_host) ? 'localhost' : htmlspecialchars($db_host);?>" class="w318" /><span class="r" id="db_host_msg"></span>
                    <p><?php echo $_LANG['dbhost_comment'];?>t</p>
                    </div>
                    <div class="clear"><label><span>*</span><?php echo $_LANG['db_name'];?>:</label><input type="text" name="db_name"  id="db_name" value="<?php echo htmlspecialchars($db_name);?>" class="w318" /><span class="r" id="db_name_msg"></span></div>
                    <div class="clear"><label><span>*</span><?php echo $_LANG['db_user'];?>:</label><input type="text" name="db_user" id="db_user" value="<?php echo htmlspecialchars($db_user);?>" class="w318" /><span class="r" id="db_user_msg"></span></div>
                    <div class="clear"><label><span>*</span><?php echo $_LANG['db_passwd'];?>:</label><input type="password" name="db_passwd" id="db_passwd" value="<?php echo htmlspecialchars($db_passwd);?>" class="w318" /><span class="r" id="db_passwd_msg"></span></div>
                    <div class="clear"><label style="margin-bottom:1em"><?php echo $_LANG['db_prefix'];?>:</label><input type="text" name="db_prefix" id="db_prefix" value="<?php if (empty($db_prefix)):?>xwb_<?php else:?><?php echo htmlspecialchars($db_prefix);?><?php endif;?>" class="w318" />
                      <p><?php echo $_LANG['tablepre_comment'];?> </p>
                    </div>

                    <h3 class="normal-a"><input type="checkbox" name="cache" onclick="choose_mc()" class="c" value="1" <?php if ($cache == 1):?> checked="checked" <?php endif;?> /><?php echo $_LANG['cache'];?><span>(<?php echo $_LANG['memcache_comment'];?>)</span></h3>
                    <div class="clear"><label id="mc_host_notice"><?php echo $_LANG['mc_host'];?>:</label><input type="text" name="mc_host" disabled="disabled" id="mc_host" class="w318" /><span class="r" id="mc_host_msg"></span></div>
                    <div class="clear"><label id="mc_port_notice"><?php echo $_LANG['mc_port'];?>:</label><input type="text" name="mc_port" disabled="disabled" id="mc_port" class="w318" /><span class="r" id="mc_port_msg"></span></div>
                    <h3 class="normal-a"><?php echo $_LANG['admin_info'];?><span>(<?php echo $_LANG['admin_comment'];?>)</span></h3>
                    <div class="clear"><label><span>*</span><?php echo $_LANG['admin_name'];?>:</label><input type="text" name="admin_name" id="admin_name" value="<?php echo htmlspecialchars($admin_name);?>" class="w318" /><span class="r" id="admin_name_msg"></span></div>
                    <div class="clear"><label><span>*</span><?php echo $_LANG['admin_passwd'];?>:</label><input type="password" name="admin_passwd" id="admin_passwd" class="w318" /><span class="r" id="admin_passwd_msg"></span></div>
                    <div class="clear"><label><span>*</span><?php echo $_LANG['admin_confirm_passwd'];?>:</label><input type="password" name="admin_confirm_passwd" id="admin_confirm_passwd" class="w318" /><span class="r" id="admin_confirm_passwd_msg"></span></div>
                    <h3 class="normal-a"><?php echo $_LANG['contact'];?><span>(<?php echo $_LANG['contact_comment'];?>)</span></h3>
                    <div class="clear"><label><span>*</span><?php echo $_LANG['user_name'];?>:</label><input type="text" name="user_name" id="user_name" value="<?php echo htmlspecialchars($user_name);?>" class="w318" /><span class="r" id="user_name_msg"></span></div>
                    <div class="clear"><label style="margin-bottom:1em;"><span>*</span><?php echo $_LANG['email'];?>:</label><input type="text" name="email" id="email" value="<?php echo htmlspecialchars($email);?>" class="w318" /><span class="r" id="email_msg"></span>
                      <p><?php echo $_LANG['email_comment'];?></p>
                    </div>
                    <div class="clear"><label><?php echo $_LANG['qq'];?>:</label><input type="text" novaild="true" name="qq" id="qq" value="<?php echo htmlspecialchars($qq);?>" class="w318" /></div>
                    <div class="clear"><label><?php echo $_LANG['msn'];?>:</label><input type="text" novaild="true" name="msn" id="msn" value="<?php echo htmlspecialchars($msn);?>" class="w318" /></div>
                    <div class="clear"><label><?php echo $_LANG['tel'];?>:</label><input type="text" novaild="true" name="tel" id="tel" value="<?php echo htmlspecialchars($tel);?>" class="w318" /></div>
                  </fieldset>
               
                </form>
                <p class="tips" style="padding-top:50px"><a href="index.php?step=2"><img src="img/btn5.gif" /></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:f_submit();"><img src="img/btn4.gif" /></a></p>
              </div>
              
              
              
              
              
               
            </div>
            
            <div class="bottom"></div>
            
          </div>
          
          
          
        </div>
     </div>
   </div>
<script>
choose_mc('<?php echo $cache;?>');
</script>
</body>
</html>

