function insidesubmit() {
	form = document.reg;
	if (form.name.value == '')  {alert(TEXT['Please_login']);return false}
	if (form.name.value.length < 3) {alert(TEXT['The_short_username']);return false}
	if (form.name.value.length > 20) {alert(TEXT['Long_login']);return false}
	if (form.pass.value != form.pass1.value) {alert(TEXT['Passwords_do_not_match']);return false}
	if (form.pass.value.length < 6) {alert(TEXT['not_a_secure_password']);return false}
	if (form.pass.value.length > 20) {alert(TEXT['A_difficult_password']);return false}
	if (!form.mail.value.match(/^[^@,]+@[^@,]*[^.]\.[^.@,]+$/)) {alert(TEXT['Please_enter_a_valid_mail']); return false}
	if (form.code.value.length !=6) {alert(TEXT['wrong_security_code']);return false}
	if (!form.rules.checked) {alert(TEXT['agree_rules']);return false}
	if (true) form.submit();
}
function passsendsubmit(mail, code) {
	$('#HCWATE').text(TEXT['Wait___']);
	aj_go("HCWATE", host+"/registration.html?PASSSEND="+mail+"&CPH="+code, 2);
	$("#HCIMG").html("<img src='?CAPCHA&"+Math.round((Math.random() * (10000000 - 1)))+"' alt=''>");
}
function forpasssend() {
	$("#body").fadeTo("slow",0.1);
	$("#header").fadeTo("slow",0.1);
	$("#window").slideDown();
	$("#passsend").css({display: "block"}).html(passText());
	$("#inside").css({display:"none"});
}
function registration() {
	$("#body").fadeTo("slow",0.1);
	$("#header").fadeTo("slow",0.1);
	$("#window").slideDown();
	$("#inside").css({display:"block"}).html(regText());
	$("#passsend").css({display: "none"});
}
function regText() {
	text = '<p><b>' + TEXT['_registration'] + '</b></p>'+
		'<form action="registration.html" method="post" name="reg">'+
		'<p>'+ TEXT['Please_login'] +': <input type="text" name="name" value="" class="input" /></p>'+
		'<p>'+ TEXT['Choose_password'] +': <input type="text" name="pass" value="" class="input" /></p>'+
		'<p>'+ TEXT['Repeat_password'] +': <input type="text" name="pass1" value="" class="input" /></p>'+
		'<p>'+ TEXT['Your_mail'] +': <input type="text" name="mail" value="" class="input" /></p>'+
		'<p>&nbsp;</p>'+
		'<p align="center">'+ TEXT['Enter_code'] +':<br />'+
		'<img src="?CAPCHA" alt="code" />'+
		'<input type="text" name="code" value="" style="width:100px"/></p><p id="MNJKx" style="text-align: left; color: #222;">&nbsp;</p>'+
		'<p>'+ TEXT['Accept_Terms'] +'<input type="checkbox" class="checkbox" name="rules" /></p>'+
		'<p align="center">'+
		'<input type="button" value="'+ TEXT['_cancel'] +'" style="width:100px;" onclick="insideclose()" />'+
		'<input type="button" value="'+ TEXT['_registration'] +'" style="width:100px;" onclick="insidesubmit()" />'+
		'</p></form>';
	return text;
}
function passText() {
	text = '<p><b>' + TEXT['Lost_Password_reminder'] + '</b></p>'+
		'<form action="" method="post" name="pd">'+
		'<p>'+ TEXT['Enter_mail_registering'] +':<br />'+
		'<input type="text" name="ssd" value="" class="input" /></p>'+
		'<p style="color:#f60;text-align: center;">&nbsp;<span id="HCWATE"></span></p><br />'+
		'<p align="center">'+ TEXT['Enter_code'] +':<br />'+
		'<span id="HCIMG"><img src="'+host+'?CAPCHA" alt="code" /></span>'+
		'<input type="text" name="codes" value="" style="width:100px"/></p>'+
		'<p align="center">'+
		'<input type="button" value="'+ TEXT['_cancel'] +'" style="width:150px;" onclick="insideclose()" />'+
		'<input type="button" value="'+ TEXT['Forgot_my_password'] +'" style="width:150px;" onclick="passsendsubmit(d.pd.ssd.value, d.pd.codes.value);" />'+
		'</p></form>';
		return text;
}
function insideclose() {
	$("#window").slideUp();
	$("#body").fadeTo("slow",1);$("#header").fadeTo("slow",1);
}

function printAuthor(mail, name) {
	text = '<a hr'+'ef="ma'+'il'+'to:'+mail+'">'+name+'</a>'; d.write(text);
}

var flag, signup = '', fulltext = '';
function commMax(ckc) {
	if (!ckc) var maxleng = (999 - signup.length); else var maxleng = (ckc - signup.length)
	txt = d.formcomm.cpost.value; txtleng = txt.length;
	if (txtleng < maxleng) {
		$("#commMax").text(TEXT['Symbols_left']+": "+(maxleng - txtleng));
		d.formcomm.cpost.focus();if (txt=='')d.formcomm.indi.value=maxleng;if(fulltext)fulltext='';
	} else { 
		if (!fulltext)fulltext=txt.substring(0,maxleng);d.formcomm.cpost.value=fulltext;d.formcomm.indi.value=0;
	}
}
function submitComm() {
	f = d.formcomm;
	if (f.ccode.value.length!=6) {alert(TEXT['incorrect_security_code']); return false;}
	if (f.cname.value == '') {alert(TEXT['Enter_your_name']);return false;}
	if (f.cname.value.length<2) {alert(TEXT['Specify_real_name']);return false;}
	if (f.cname.value.length>20) {alert(TEXT['name_too_long']);return false;}
	if (!f.cmail.value.match(/^[^@,]+@[^@,]*[^.]\.[^.@,]+$/)) {alert(TEXT['valid_Email_feedback']); return false;}
	if (f.ctema.value.length>150) {alert(TEXT['Reduce_topic_comment']);return false;}
	if (f.cpost.value.length<2) {alert(TEXT['No_comment_text']);return false;}
	if (true) f.submit();
}
















/***** and ******/
