var LinkDivActive = 0;var onDiv;var timeOnDiv;var layerRef;var styleRef;var showVar;var hideVar;var hideDivi;var showDivi;var currentCommentForm='0';var mynews_tag_select = '';if (navigator.appName == "Netscape") { layerRef="document."; styleRef=""; showVar="'show'"; hideVar="'hide'"; showDivi="''"; hideDivi="'none'";} else { layerRef="document.all."; styleRef=".style"; showVar="'visible'"; hideVar="'hidden'"; showDivi="''"; hideDivi="'none'";}function upArtRate(shop) {	document.getElementById('artrateformdo').value = 'upartrate';	document.artrateform.submit();	return false;}function downArtRate(shop) {	document.getElementById('artrateformdo').value = 'downartrate';	document.artrateform.submit();	return false;}function banfileSubmit(form, reason) {	if (document.getElementById(reason).value.length<=6) {		alert('Укажите причину запрета!');	} else if (confirm("Вы уверены?")) {		document.getElementById(form).submit();	}	return false;}function flashComplete(data) {	document.getElementById('publicfilesid').value = data;	document.getElementById('publicfiles').submit();}function strip_tags(str, allowed_tags) {    // http://kevin.vanzonneveld.net    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)    // +   improved by: Luke Godfrey    // +      input by: Pul    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)    // +   bugfixed by: Onno Marsman    // +      input by: Alex    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)    // +      input by: Marc Palau    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)    // +      input by: Brett Zamir (http://brettz9.blogspot.com)    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)    // +   bugfixed by: Eric Nagel    // +      input by: Bobby Drake    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)    // *     example 1: strip_tags('<p>Kevin</p> <br /><b>van</b> <i>Zonneveld</i>', '<i><b>');    // *     returns 1: 'Kevin <b>van</b> <i>Zonneveld</i>'    // *     example 2: strip_tags('<p>Kevin <img src="someimage.png" onmouseover="someFunction()">van <i>Zonneveld</i></p>', '<p>');    // *     returns 2: '<p>Kevin van Zonneveld</p>'    // *     example 3: strip_tags("<a href='http://kevin.vanzonneveld.net'>Kevin van Zonneveld</a>", "<a>");    // *     returns 3: '<a href='http://kevin.vanzonneveld.net'>Kevin van Zonneveld</a>'    // *     example 4: strip_tags('1 < 5 5 > 1');    // *     returns 4: '1 < 5 5 > 1'    var key = '', allowed = false;    var matches = [];    var allowed_array = [];    var allowed_tag = '';    var i = 0;    var k = '';    var html = '';    var replacer = function(search, replace, str) {        return str.split(search).join(replace);    };    // Build allowes tags associative array    if (allowed_tags) {        allowed_array = allowed_tags.match(/([a-zA-Z]+)/gi);    }    str += '';    // Match tags    matches = str.match(/(<\/?[\S][^>]*>)/gi);    // Go through all HTML tags    for (key in matches) {        if (isNaN(key)) {            // IE7 Hack            continue;        }         // Save HTML tag        html = matches[key].toString();         // Is tag not in allowed list? Remove from str!        allowed = false;         // Go through all allowed tags        for (k in allowed_array) {            // Init            allowed_tag = allowed_array[k];            i = -1;             if (i != 0) { i = html.toLowerCase().indexOf('<'+allowed_tag+'>');}            if (i != 0) { i = html.toLowerCase().indexOf('<'+allowed_tag+' ');}            if (i != 0) { i = html.toLowerCase().indexOf('</'+allowed_tag)   ;}             // Determine            if (i == 0) {                allowed = true;                break;            }        }        if (!allowed) {            str = replacer(html, "", str); // Custom replace. No regexing        }    }    return str;}function mynewsSubmit(noshowmess) {	if (document.newssend.newshead.value.length < 3) {		alert('Заполните заголовок новости');		document.newssend.newshead.focus();		return false;	}	var str = strip_tags(document.newssend.newsannounce.value);	if (str.length <= 6) {		alert('Заполните анонс новости');		document.newssend.newsannounce.focus();		return false;	}	var str = strip_tags(newstext_obj.getPageHtml(newstext_page));	if (str.length <= 6) {		alert('Заполните текст новости');		newstext_obj.focus();		return false;	}	if (noshowmess) document.newssend.noshowmess.value = 'no';	SpawPGcore.codeCleanupClick(newstext_obj.getTargetEditor(),newstext_obj.getToolbarItem('newstext_tools_0'));	setTimeout('document.newssend.submit();', 500);	return false;}function changeForumPartSubmit(el) {	if (el.value!='')  {		if (confirm("Вы уверены?")) {			document.changeforumpartform.submit();		} else el.selectedIndex = 0;	}}
function getMyNewsTagSelect(el) {	document.getElementById('mynewstags-'+mynews_tag_select).style.display = 'none';	document.getElementById('mynewstags-'+el.value).style.display = 'block';	mynews_tag_select = el.value;}//Divisions Show | Hidefunction switchDiv(divn) {      eval('if ('+'document.getElementById(\''+divn+'\')'+styleRef+'.visibility == '+hideVar+') {showDiv(divn);} else {hideDiv(divn);}');}function hideDiv(divn) { eval('document.getElementById(\''+divn+'\')'+styleRef+'.visibility = '+hideVar); eval('document.getElementById(\''+divn+'\')'+styleRef+'.display = '+hideDivi);}function showDiv(divn) { eval('document.getElementById(\''+divn+'\')'+styleRef+'.visibility = '+showVar); eval('document.getElementById(\''+divn+'\')'+styleRef+'.display = '+showDivi);}//Link Divisions Stufffunction showLinkDiv(divn) { if (timeOnDiv != null) {  clearTimeout(timeOnDiv);  hideDiv(onDiv); } showDiv(divn); onDiv = divn;}function divTimer() { timeOnDiv = setTimeout("divOut()",500)}function divOut() { if (LinkDivActive == 0) {  hideDiv(onDiv); } }function LinkDivOver() { LinkDivActive = 1; clearTimeout(timeOnDiv);}function LinkDivOut() { LinkDivActive = 0; timeOnDiv = setTimeout("divOut()",500)}function check_form (confirmMsg) {      var is_confirmed = confirm(confirmMsg);      return is_confirmed;}function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features);}
function open_winiid(url) { mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=550,height=414');}
function clearSearch() {      if (document.getElementById('textasrc').value=="  Поиск:") {            document.getElementById('textasrc').value='';      }}
function MM_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}
function MM_preloadImages() { //v3.0  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}
function MM_findObj(n, d) { //v4.01  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);  if(!x && d.getElementById) x=d.getElementById(n); return x;}
function MM_swapImage() { //v3.0  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}function makeCalendarChoice(alias) {      location.href='/'+alias+'/'+document.getElementById('archiveyear').value+'/'+document.getElementById('archivemonth').value+'/';}
function hideAllHREF(sDivNameHREF) {      if (! (document.getElementById))return;      var i=0;      while (true){            if (document.getElementById) {                  var obj = document.getElementById(sDivNameHREF+i);                  if (obj) {                         obj.className = "";                        i++;                  }                   else return;            } else break;      }}function setDivNews(showingimage,sDivNameHREF,pict,num) {      hideAllHREF(sDivNameHREF);      var obj = document.getElementById(sDivNameHREF+num);      if (obj) {             obj.className = "newshrefclass";      }       var tempmap="";      if (pict!="") {            tempmap=tempmap+'<img src="'+pict+'" border=0 alt="">';      }      document.getElementById(showingimage).innerHTML=tempmap;      return false;}
function cancelSetCommentForm() {	return setCommentForm(0);}
function setCommentForm(commentFormNumber, text) {	if (commentFormNumber!=currentCommentForm) {		var divCommentFormNew=document.getElementById('commentform'+commentFormNumber);		var divCommentFormCurrent=document.getElementById('commentform'+currentCommentForm);		if (divCommentFormCurrent && divCommentFormNew) {						$(divCommentFormCurrent).parent().css('height', 'auto');			document.getElementById("parentcommentid").value=commentFormNumber;			$(divCommentFormNew).html('<h2>Добавить комментарий:</h2>');			$('form#commentsend').appendTo(divCommentFormNew)					$(divCommentFormNew).css("height", "auto");			if (commentFormNumber*1!=0) {				$(divCommentFormNew).css("height", $(divCommentFormNew).height()+'px');				$('.actions a', divCommentFormCurrent.parentNode).eq(0).html('Ответить');				$('.actions a', divCommentFormNew.parentNode).eq(0).html('Отмена');					$box = $(divCommentFormNew);				$f = $box.parent();				$f.height($box.height()+ $f.height());			}			if (text) {				$('#commenttextid').val($('#commenttextid').val()+text);			}			divCommentFormCurrent.innerHTML='&nbsp;';						$("#commentform"+commentFormNumber).show();			$("#commentform"+currentCommentForm).hide();			currentCommentForm=commentFormNumber;		}	} else {		if (text) {			$('#commenttextid').val($('#commenttextid').val()+text);		} else { 			$('.actions a', $('#commentform'+commentFormNumber).parent()).eq(0).html('Ответить');			return cancelSetCommentForm();		}	}		$("#pagetype").val((commentFormNumber*1!= 0) ? 'curr' :'last');	//if (commentFormNumber!=0) document.getElementById('pagetype').value = 'curr';	//else document.getElementById('pagetype').value = 'last';	return false;}function citoCommentForm(commentFormNumber) {	if (document.getElementById("commentbody"+commentFormNumber) && document.getElementById("commenttextid")) {		//document.getElementById("commenttextid").value=document.getElementById("commenttextid").value+'<cite>'+document.getElementById("commentbody"+commentFormNumber).innerHTML+'</cite>';		document.getElementById('pagetype').value = 'curr';		return setCommentForm(commentFormNumber, '<cite>'+document.getElementById("commentbody"+commentFormNumber).innerHTML+'</cite>');	}		return false;}
function sendCommentForm() {	if (document.commentsend.from && !trim(document.commentsend.from.value)) {		alert('Заполните поле "Имя"!');		document.commentsend.from.focus();		return false;	}		if (!trim(document.commentsend.commenttext.value)) {		alert('Заполните поле "Текст"!');		document.commentsend.commenttext.focus();		return false;	}		if (document.commentsend.captcha && !trim(document.commentsend.captcha.value)) {		alert('Введите код с картинки!');		document.commentsend.captcha.focus();		return false;	}		document.commentsend.submit();		return false;}
function getPosX(obj) {	if (!obj) return 0;	return (obj.offsetLeft + getPosX(obj.offsetParent));}
function getPosY(obj) {	if (!obj) return 0;	return (obj.offsetTop + getPosY(obj.offsetParent));}
function deleteSubmit(formToCheck) {	if(document.getElementById(formToCheck)) {		if (confirm('Вы уверены?')) {			document.getElementById(formToCheck).submit();		}	}	return false;}
function deleteSubmit2(formToCheck,idInput,idValue,typeInput,typeValue) {	if(document.getElementById(formToCheck)) {		if (confirm('Вы уверены?')) {			if (document.getElementById(idInput)) document.getElementById(idInput).value=idValue;			if (document.getElementById(typeInput)) document.getElementById(typeInput).value=typeValue;			document.getElementById(formToCheck).submit();		}	}	return false;}
function updateSubmit(formToCheck,updateInput) {	if(document.getElementById(formToCheck)) {		if (document.getElementById(updateInput)) {			document.getElementById(updateInput).value='updatecomment';			document.getElementById(formToCheck).submit();		}	}	return false;}
function sendNewsForm(formToCheck,newsHead,newsText) {	if(document.getElementById(formToCheck)) {		if(document.getElementById(newsHead)) {			if (document.getElementById(newsText)) {				var textareatext=document.getElementById(newsText).value;				if (textareatext.length>0) {					var textareatext=document.getElementById(newsHead).value;					if (textareatext.length>0) {						document.getElementById(formToCheck).submit();					}				}			}		}	}	return false;}function makeCalendarChoice1(alias) {	var strhref='/'+alias+'/'+document.getElementById('archiveyear').value+'/'+document.getElementById('archivemonth').value+'/';	if (document.getElementById('withphotosonly')) {		if (document.getElementById('withphotosonly').checked) {			strhref=strhref+'photos/';		}	}	if (document.getElementById('withvideosonly')) {		if (document.getElementById('withvideosonly').checked) {			strhref=strhref+'video/';		}	}	if (document.getElementById('withaudiosonly')) {		if (document.getElementById('withaudiosonly').checked) {			strhref=strhref+'audio/';		}	}	location.href=strhref;}function addToFavorites() {	window.external.AddFavorite (window.document.location, window.document.title);	return false;}function ShowHideDiv(formid) {	if (document.getElementById(formid)) {		if (document.getElementById(formid).style.display!='none') {			document.getElementById(formid).style.display='none';		} else {			document.getElementById(formid).style.display='block';		}	}	return false;}function NewShowDiv(formid) {	if (document.getElementById(formid)) {		document.getElementById(formid).style.display='block';	}	return false;}function NewHideDiv(formid) {	if (document.getElementById(formid)) {		document.getElementById(formid).style.display='none';	}	return false;}function selectChange(el) {	if (typeof(el)=='string') el = document.getElementById(el);	if (el.value=='') return false;	var count = document.messages_form.elements.length;	var tf = false;	for(var i=0; i<count; i++) {		if (document.messages_form.elements[i].name.toLowerCase()=='message[]' && document.messages_form.elements[i].checked) {			tf = true;		}	}	if (!tf) {		alert('Выберите хотя бы одно сообщение!');		el.selectedIndex=0;		return false;	}	if (!confirm('Вы уверены?')) {		el.selectedIndex=0;		return false;	}	var eldo = document.getElementById('do');	eldo.value = 'actionmessages_'+el.value;	document.messages_form.submit();}function trim(str, chars) {	return ltrim(rtrim(str, chars), chars);} function ltrim(str, chars) {	chars = chars || "\\s";	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");} function rtrim(str, chars) {	chars = chars || "\\s";	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");}function GlobalChecker() {	$this = $('#global_checker');	$(".message-ribbon input[type='checkbox']").attr('checked', $this.is(':checked') ? 'checked' : '');}
