App.MailFriend = newClass();
App.MailFriend.prototype = {
	
	init: function(p) {
		var t = this;
		t.p = p;
		$('#'+t.p.mailfriendRef).click(function(e){
			return t.mailfriendRefClick(e);
		});
	},

		
	mailfriendRefClick: function(){
		var t = this;
		var MailFriendContent = '<div id="mailform" class="RegMessage"><div class="RegMessageHeader"><span>закрыть</span></div>' + 
		'<h1>Отправить ссылку</h1>' + 
		'<form method="post" target="frame_answer" action="" onsubmit="return false">' + 
		'<table>' + 
		'<tr><td class="Label" colspan="2"><label for="to_email">Электропочта адресата</label><br/><input id="to_email" name="to_email" type="text" style="width:543px" req="1" validate="email" /></td></tr>' + 
		'<tr><td class="Label" colspan="2"><label for="from_email">Ваша электропочта</label><br/><input id="from_email" name="from_email" type="text"  style="width:543px" req="1" validate="email" /></td></tr>' + 
		'<tr><td class="Label" colspan="2"><label for="link_url">Адрес статьи</label><br/><input id="link_url" name="link_url" type="text" value='+ThisUrl+' readonly="true"  style="width:543px"/></td></tr>' + 
		'<tr><td class="Label" colspan="2"><label for="mail_message">Текст сообщения</label><br/><textarea id="mail_message" name="mail_message" style="width:543px" rows="4" /></td></tr>' + 
		'<tr><td class="Label" style="width:165px">Введите код с картинки<br/> <input id="spec_key" name="spec_key" type="text" style="width:160px" req="1" /></td><td align="left" width="430"><label for="spec_key"><img src="/captcha/?key='+Math.round(Math.random()*1000000)+'" width="155" height="35"></label></td></tr>' + 
		'<tr><td class="Label" colspan="2"><span name="mail_form_error" id="mail_form_error"style="color:red;font-size:80%"></span></td></tr>' + 
		'</table>' + 
		'<div class="Button" name="submitBlock" id="submitBlock"><input type="submit" value="Отправить"  onClick="mailformSubmit(); return false" id="submitbutton"/><img src="/_img/load.gif" width="16" height="16" style="padding:4px 0px 0px 8px;display:none" id="sendimg"/></div>' +
		'</form>' +
		'</div>';
		
		t.MailFriendHtml = Onlyweb.Messages.generateHtml(MailFriendContent);
		$(t.MailFriendHtml).displayBox();
		$('.RegMessage .RegMessageHeader span').click(function(event){
			$.blockUI.impl.boxRemove();
		});
		oValidator.validateAll()
		return false;
	}
}