<!--{if $secqaacheck}-->
	<input name="secanswer" id="secanswer" type="text" autocomplete="off" style="width:50px" value="{lang secqaa}" class="txt" href="ajax.php?action=updatesecqaa" tabindex="1">
	<span id="checksecanswer"><img src="images/common/none.gif" width="16" height="16"></span>
<!--{/if}-->
<!--{if $seccodecheck}-->
	<input name="seccodeverify" id="seccodeverify_{CURSCRIPT}" type="text" autocomplete="off" style="width:50px" value="{lang seccode}" class="txt" href="ajax.php?action=updateseccode" tabindex="1">
	<a href="javascript:;" onclick="updateseccode();doane(event);">{lang seccode_change}</a>
	<span id="checkseccodeverify_{CURSCRIPT}"><img src="images/common/none.gif" width="16" height="16"></span>
<!--{/if}-->

<script type="text/javascript" reload="1">
	var profile_seccode_invalid = '{lang register_profile_seccode_invalid}';
	var profile_secanswer_invalid = '{lang register_profile_secqaa_invalid}';
	var lastseccode = lastsecanswer = secfocus ='';
	var secanswerObj = $('secanswer');
	var seccodeObj = $('seccodeverify_{CURSCRIPT}');
	var secstatus = {'secanswer':0,'seccodeverify_{CURSCRIPT}':0};

	if(secanswerObj) {
		secanswerObj.onclick = secanswerObj.onfocus = showIdentifying;
		secanswerObj.onblur = function(e) {if(!secfocus) $('secanswer_menu').style.display='none';checksecanswer();doane(e);};
	}

	if(seccodeObj) {
		seccodeObj.onclick = seccodeObj.onfocus = showIdentifying;
		seccodeObj.onblur = function(e) {if(!secfocus) $('seccodeverify_{CURSCRIPT}_menu').style.display='none';checkseccode();doane(e);};
	}

	function showIdentifying(e) {
		var obj = BROWSER.ie ? event.srcElement : e.target;
		if(!$(obj.id + '_menu')) {
			obj.value = '';
			ajaxmenu($(obj.id), 0, 1, 3, '12', function() {
				secstatus[obj.id] = 1;
				$(obj.id + '_menu').onmouseover = function() { secfocus = 1; }
				$(obj.id + '_menu').onmouseout = function() { secfocus = '';$(obj.id).focus(); }
			});
		} else if(secstatus[obj.id] == 1) {
			$(obj.id + '_menu').style.display = '';
		}
		obj.unselectable = 'off';
		obj.focus();
		doane(e);
	}

	function updateseccode(op) {
		if(isUndefined(op)) {
			ajaxget('ajax.php?action=updateseccode', seccodeObj.id + '_menu', 'ajaxwaitid', '', '', '$(seccodeObj.id + \'_menu\').style.display = \'\'');
		} else {
			window.document.seccodeplayer.SetVariable("isPlay", "1");
		}
		seccodeObj.focus();
	}

	function checkseccode() {
		var seccodeverify = seccodeObj.value;
		if(seccodeverify == lastseccode) {
			return;
		} else {
			lastseccode = seccodeverify;
		}
		var cs = $('checkseccodeverify_{CURSCRIPT}');
		{if $seccodedata['type'] != 1}
			if(!(/[0-9A-Za-z]{4}/.test(seccodeverify))) {
				warning(cs, profile_seccode_invalid);
				return;
			}
		{else}
			if(seccodeverify.length != 2) {
				warning(cs, profile_seccode_invalid);
				return;
			}
		{/if}
		ajaxresponse('checkseccodeverify_{CURSCRIPT}', 'action=checkseccode&seccodeverify=' + (BROWSER.ie && document.charset == 'utf-8' ? encodeURIComponent(seccodeverify) : seccodeverify));
	}

	function checksecanswer() {
	        var secanswer = secanswerObj.value;
		if(secanswer == lastsecanswer) {
			return;
		} else {
			lastsecanswer = secanswer;
		}
		ajaxresponse('checksecanswer', 'action=checksecanswer&secanswer=' + (BROWSER.ie && document.charset == 'utf-8' ? encodeURIComponent(secanswer) : secanswer));
	}

	function ajaxresponse(objname, data) {
		var x = new Ajax('XML', objname);
		x.get('ajax.php?inajax=1&' + data, function(s){
		        var obj = $(objname);
		        if(s.substr(0, 7) == 'succeed') {
		        	obj.style.display = '';
		                obj.innerHTML = '<img src="{IMGDIR}/check_right.gif" width="16" height="16" />';
				obj.className = "warning";
			} else {
				warning(obj, s);
			}
		});
	}

	function warning(obj, msg) {
		if((ton = obj.id.substr(5, obj.id.length)) != 'password2') {
			$(ton).select();
		}
		obj.style.display = '';
		obj.innerHTML = '<img src="{IMGDIR}/check_error.gif" width="16" height="16" />';
		obj.className = "warning";
	}
</script>