function ALXErrorSendClass(){function strip_tags(str){return str.replace(/<\/?[^>]+>/gi,'');}var errorSendMessages=ALXerrorSendMessages;var errorLogoImgSrc=ALXerrorLogoImgSrc;var ErrorText={'start':'','body':'','end':''};var BeforeChars=50;var AfterChars=50;var _select;function getSelectedText(){if(window.getSelection){str_select=window.getSelection();}else if(document.getSelection){str_select=document.getSelection();}else if(document.selection){str_select=document.selection;}if(str_select.getRangeAt){if(document.getSelection()){_select=document.getSelection();}else if(window.getSelection()){_select=window.getSelection();}_select=_select.toString();var _start=document.createRange();_start.setStartBefore(str_select.getRangeAt(0).startContainer);_start.setEnd(str_select.getRangeAt(0).startContainer,str_select.getRangeAt(0).startOffset);text_start=_start.toString();var _end=str_select.getRangeAt(0).cloneRange();_end.setStart(str_select.getRangeAt(0).endContainer,str_select.getRangeAt(0).endOffset);_end.setEndAfter(str_select.getRangeAt(0).endContainer);text_end=_end.toString();text_start=text_start.substr(text_start.length-BeforeChars,text_start.length);text_end=text_end.substr(0,AfterChars);}if(str_select.createRange){var _select=str_select.createRange().text;var _start=str_select.createRange();_start.moveStart("character",-BeforeChars);_start.moveEnd("character",-_select.length);var text_start=_start.text;var _end=str_select.createRange();_end.moveStart("character",_select.length);_end.moveEnd("character",AfterChars);var text_end=_end.text;document.selection.empty();}if(!_select.length){return false;}if(_select.length>250){var content_LongText='\
			<div id="send-error_LongText">\
			<table class="bx-width100">\
				<tr>\
					<td class="no-bootom-border" valign="top" style="padding-top: 10px !important;">\
						<img src="/bitrix/images/altasib.errorsend/altasib.errorsend.error.gif" style="float: left; margin-right: 8px" />\
					</td>\
					<td width="90%" class="no-bootom-border" style="padding-top: 10px !important;"><font color="red"><b>'+errorSendMessages.LongText+'</b></font><br /><br />'+errorSendMessages.LongText2+'</td>\
				</tr>\
			</table>\
			</div>';var Dialog_LongText=new BX.CDialog({title:errorSendMessages.TitleForm,content:content_LongText,resizable:false,draggable:true,height:'110',width:'300'});if(/MSIE 6/i.test(navigator.userAgent)&&!(/MSIE 7/i.test(navigator.userAgent))&&!(/MSIE 8/i.test(navigator.userAgent))){Dialog_LongText.PARTS.CONTENT.className="a-dialog-center";Dialog_LongText.PARTS.TITLEBAR.className="a-dialog-head";Dialog_LongText.PARTS.TITLEBAR.style.width=(parseInt(Dialog_LongText.PARAMS.width)+25)+"px";Dialog_LongText.PARTS.FOOT.className="a-dialog-foot";Dialog_LongText.PARTS.FOOT.style.width=(parseInt(Dialog_LongText.PARAMS.width)+25)+"px";Dialog_LongText.PARTS.TITLEBAR_ICONS.className="a-dialog-head-icons";}Dialog_LongText.SetButtons([Dialog_LongText.btnClose]);Dialog_LongText.Show();return false;}ErrorText.start=text_start;ErrorText.body=_select;ErrorText.end=text_end;}function trimLeft(str){var firstSimb;str.substring(0,1)==" "?firstSimb=" ":firstSimb="";return firstSimb+str.replace(/^\s+/,'');}function trimRight(str){var lastSimb;str.substring(str.length-1,str.length)==" "?lastSimb=" ":lastSimb="";return str.replace(/\s+$/,'')+lastSimb;}function trimBoth(str){return trimRight(trimLeft(str));}function trimSpaces(str){return str.replace(/\s{2,}/g,' ');}window.ALXerrorsend_ReloadCaptcha=function(){$.getJSON('/bitrix/tools/ajax_captcha.php?_='+Math.random(),function(data){if(data.captcha_sid){$('#errorsend_captcha_sid').val(data.captcha_sid);$('#errorsend_cpt_container').html('<img id="alx_errorsend_CAPTCHA" src="/bitrix/tools/captcha.php?captcha_sid='+data.captcha_sid+'" width="180" height="40">');}});};Dialog_ok=new BX.CDialog({title:errorSendMessages.TitleForm,content:content_ok,resizable:false,draggable:true,height:'130',width:'350'});Dialog_ok.SetButtons([Dialog_ok.btnClose]);if(/MSIE 6/i.test(navigator.userAgent)&&!(/MSIE 7/i.test(navigator.userAgent))&&!(/MSIE 8/i.test(navigator.userAgent))){Dialog_ok.PARTS.CONTENT.className="a-dialog-center";Dialog_ok.PARTS.TITLEBAR.className="a-dialog-head";Dialog_ok.PARTS.TITLEBAR.style.width=(parseInt(Dialog_ok.PARAMS.width)+25)+"px";Dialog_ok.PARTS.FOOT.className="a-dialog-foot";Dialog_ok.PARTS.FOOT.style.width=(parseInt(Dialog_ok.PARAMS.width)+25)+"px";Dialog_ok.PARTS.TITLEBAR_ICONS.className="a-dialog-head-icons";}function esErrorSend(){var new_href=window.location.href;var hashpos=new_href.indexOf('#'),hash='';if(hashpos!=-1){hash=new_href.substr(hashpos);new_href=new_href.substr(0,hashpos);}var url=new_href;var arParam={"AJAX_CALL":"Y","ERROR_SEND":"Y","ERROR_TEXT_START":trimBoth(ErrorText.start),"ERROR_TEXT_BODY":document.getElementById('error_body').innerHTML,"ERROR_TEXT_END":trimBoth(ErrorText.end),"COMMENT":document.getElementById("error-comment").value,"ERROR_URL":window.location.href,"URL_ERROR":document.getElementById("errorsend_URL_ERROR").value,"BROWSER":document.getElementById("errorsend_BROWSER").value,"RIGHT_TEXT":document.getElementById("errorsend_RIGHT_TEXT").value,"USER_NAME":document.getElementById("errorsend_USER_NAME").value,"USER_EMAIL":document.getElementById("errorsend_USER_EMAIL").value,"IP_ADDRESS":document.getElementById("errorsend_IP_ADDRESS").value,"captcha_sid":document.getElementById("errorsend_captcha_sid").value,"captcha_word":document.getElementById("errorsend_captcha_word").value};BX.ajax.post(url,arParam,function(res){Dialog.PARTS.CONTENT_DATA.scrollTop=0;if(/OK!/i.test(res)){Dialog.Close();Dialog_ok.SetContent(content_ok);Dialog_ok.Show();if(typeof document.getElementById("send-error-no")!='undefined')document.getElementById("send-error-no").style.display='none';if(typeof document.getElementById("error-comment")!='undefined')document.getElementById("error-comment").value='';if(typeof document.getElementById("errorsend_URL_ERROR")!='undefined')document.getElementById("errorsend_URL_ERROR").value=window.location.href;if(typeof document.getElementById("errorsend_BROWSER")!='undefined')document.getElementById("errorsend_BROWSER").value=ALXerrorSendVals.browser_val;if(typeof document.getElementById("errorsend_RIGHT_TEXT")!='undefined')document.getElementById("errorsend_RIGHT_TEXT").value='';if(typeof document.getElementById("errorsend_USER_NAME")!='undefined')document.getElementById("errorsend_USER_NAME").value=ALXerrorSendVals.user_name;if(typeof document.getElementById("errorsend_USER_EMAIL")!='undefined')document.getElementById("errorsend_USER_EMAIL").value=ALXerrorSendVals.user_email;if(typeof document.getElementById("errorsend_IP_ADDRESS")!='undefined')document.getElementById("errorsend_IP_ADDRESS").value=ALXerrorSendVals.ip_val;if(typeof document.getElementById("errorsend_captcha_word")!='undefined')document.getElementById("errorsend_captcha_word").value='';}else if(false!==trim(res).indexOf(ALXerrorSendMessages.err_txt)){if(typeof Dialog.PARAMS.content.children[1]!='undefined'||typeof Dialog.PARAMS.content.children[0]!='undefined'){Dialog.SetContent(content_no.replace("#ERROR#",res)+'<div id="send-error">'+document.getElementById('send-error').innerHTML+'</div>');document.getElementById("error-comment").value=arParam.COMMENT;document.getElementById("errorsend_URL_ERROR").value=arParam.URL_ERROR;document.getElementById("errorsend_BROWSER").value=arParam.BROWSER;document.getElementById("errorsend_RIGHT_TEXT").value=arParam.RIGHT_TEXT;document.getElementById("errorsend_USER_NAME").value=arParam.USER_NAME;document.getElementById("errorsend_USER_EMAIL").value=arParam.USER_EMAIL;document.getElementById("errorsend_IP_ADDRESS").value=arParam.IP_ADDRESS;document.getElementById("errorsend_captcha_word").value=arParam.captcha_word;}else{Dialog.SetContent(content_no.replace("#ERROR#",res)+content);}ALXerrorsend_ReloadCaptcha();}else{Dialog.Close();Dialog_ok.SetContent(content_no.replace("#ERROR#",res));Dialog_ok.Show();}});}function trim(string){return string.replace(/(^\s+)|(\s+$)/g,"");}var content_no='\
	<div id="send-error-no">\
	<table class="bx-width100">\
		<tr>\
			<td class="no-bootom-border" valign="top" style="padding-top: 10px !important;">\
			<img src="/bitrix/images/altasib.errorsend/altasib.errorsend.error.gif" style="float: left; margin-right: 8px" />\
			</td>\
			<td width="90%" class="no-bootom-border" style="padding-top: 8px !important;">#ERROR#</td>\
		</tr>\
	</table>\
	</div>';var content_ok='\
	<div id="send-error-ok">\
	<table class="bx-width100">\
		<tr>\
			<td class="no-bootom-border" valign="top" style="padding-top: 10px !important;">\
			<img src="/bitrix/images/altasib.errorsend/altasib.errorsend.ok.gif" style="float: left; margin-right: 8px" />\
			</td>\
			<td width="90%" class="no-bootom-border" style="padding-top: 8px !important;"><span style="color: green; font-size: 14px"><b>\
			'+errorSendMessages.text_ok+'</b></span><span style="font-size: 12px; color: #7d7d7d"><br /><br />'+errorSendMessages.text_ok2+'</span></td>\
		</tr>\
	</table>\
	</div>';var rqu=errorSendMessages.requ;var content='\
	<div id="send-error">\
		<img style="float: left; margin-right: 15px;" src="'+errorLogoImgSrc+'" /><br /><span style="font-size: 16px; color: #143f6d">'+errorSendMessages.footer+'</span>\
		<br style="clear: both" />\ '+'<span class="errorsend_title">'+errorSendMessages.send_title+':</span></br></br>\
		<small class="errorsend_fname">'+errorSendMessages.URL_ERROR+rqu+':</small>\
		<div class="errorsend_input">\
			<input id="errorsend_URL_ERROR" type="text" value="'+window.location.href+'" name="URL_ERROR" size="40">\
		</div>\
			<span class="errorsend_fname">'+errorSendMessages.head+rqu+':</span>\
			<div style="border: 1px solid #d1d1d1; background-color: #fafafa; width: 470px; padding: 8px; margin: 7px 0px 13px 0px; height: 55px; color: #7d7d7d; font-size: 12px;">\
			<span id="error_start"></span><font color="red" id="error_body"></font><span id="error_end"></span>\
			</div>\
		<small class="errorsend_fname">'+errorSendMessages.BROWSER+rqu+':</small>\
			<div class="errorsend_input">\
				<input id="errorsend_BROWSER" type="text" value="'+ALXerrorSendVals.browser_val+'" name="BROWSER" size="40">\
			</div>\
		<small class="errorsend_fname">'+errorSendMessages.RIGHT_TEXT+rqu+':</small>\
		<div class="errorsend_input"><textarea name="RIGHT_TEXT" id="errorsend_RIGHT_TEXT" rows=1 cols=5></textarea></div>\
		<small class="errorsend_fname">'+errorSendMessages.USER_NAME+rqu+':</small>\
			<div class="errorsend_input">\
				<input id="errorsend_USER_NAME" type="text" value="'+ALXerrorSendVals.user_name+'" name="USER_NAME" size="40">\
			</div>\
		<small class="errorsend_fname">'+errorSendMessages.USER_EMAIL+rqu+':</small>\
			<div class="errorsend_input">\
				<input id="errorsend_USER_EMAIL" type="text" value="'+ALXerrorSendVals.user_email+'" name="USER_EMAIL" size="40">\
			</div>\
		<small class="errorsend_fname">'+errorSendMessages.comment+rqu+':</small>\
		<div class="errorsend_input"><textarea name="comment" id="error-comment" rows=3 cols=5></textarea></div>\
		<small class="errorsend_fname">'+errorSendMessages.IP_ADDRESS+rqu+':</small>\
			<div class="errorsend_input">\
				<input id="errorsend_IP_ADDRESS" type="text" disabled value="'+ALXerrorSendVals.ip_val+'" name="IP_ADDRESS" size="40">\
			</div>\
		<small class="errorsend_fname">'+errorSendMessages.CAPTHA_CODE+rqu+':</small>'+'<input id="errorsend_captcha_sid" type="hidden" name="captcha_sid" value="">\
			<div id="errorsend_cpt_container"></div>\
			<div style="margin-bottom:6px;"><small><a href="#" onclick="ALXerrorsend_ReloadCaptcha(); return false;">'+errorSendMessages.GENERATE_CAP+'</a></small></div>\
			<div class="errorsend_input">\
				<input id="errorsend_captcha_word" type="text" value="" name="captcha_word" size="40">\
			</div>\
	</div>';var Dialog=new BX.CDialog({title:errorSendMessages.TitleForm,content:content,resizable:false,draggable:true,height:'480',width:'540'});if(/MSIE 6/i.test(navigator.userAgent)&&!(/MSIE 7/i.test(navigator.userAgent))&&!(/MSIE 8/i.test(navigator.userAgent))){Dialog.PARTS.CONTENT.className="a-dialog-center";Dialog.PARTS.TITLEBAR.className="a-dialog-head";Dialog.PARTS.TITLEBAR.style.width=(parseInt(Dialog.PARAMS.width)+25)+"px";Dialog.PARTS.FOOT.className="a-dialog-foot";Dialog.PARTS.FOOT.style.width=(parseInt(Dialog.PARAMS.width)+25)+"px";Dialog.PARTS.TITLEBAR_ICONS.className="a-dialog-head-icons";}Dialog.SetButtons([new BX.CWindowButton({title:errorSendMessages.ButtonSend,id:'ok',name:'ok',action:function(){esErrorSend()}}),Dialog.btnCancel]);BX.bind(document,'keydown',altasib_error);function altasib_error(event){var kCode=window.event?window.event.keyCode:(event.keyCode?event.keyCode:(event.which?event.which:null));var fCode=window.event?window.event.ctrlKey:event.ctrlKey;if(kCode==13&&fCode){if(Dialog.isOpen){esErrorSend();}else{if(getSelectedText()!==false){document.getElementById('error_start').innerHTML=ErrorText.start;document.getElementById('error_body').innerHTML=ErrorText.body;document.getElementById('error_end').innerHTML=ErrorText.end;Dialog.Show();setTimeout(function(){ALXerrorsend_ReloadCaptcha();},50);}}return false;}}}BX.ready(function(){if(typeof ALXErrorSendClass=='function')ALXErrorSend=new ALXErrorSendClass();});