<!--
var sessionhash, timecolor, imagesfolder;var skipvalidation = false;
function aimwindow(session,aimid) {
	window.open("member.php?s="+session+"&action=aimmessage&aim="+aimid,"_blank","toolbar=no,location=no,menubar=no,scrollbars=no,width=175,height=275,resizeable=yes,status=no")
}
function opensmiliewindow(x,y,sessionhash) {
	window.open("misc.php?action=getsmilies&s="+sessionhash, "smilies", "toolbar=no,scrollbars=yes,resizable=yes,width="+x+",height="+y);
}
function validate(theform,postmaxchars) {
	if (skipvalidation) {
		return true;
	}
	if (theform.message.value=="") {
		alert("Введите пожалуйста сообщение.");
		return false;
	}
	if (postmaxchars != 0) {
		if (theform.message.value.length > postmaxchars) {
			alert("Ваше сообщение слишком длинное.\n\nОно не может содержать более "+postmaxchars+" символов.\nСейчас оно содержит "+theform.message.value.length+" символов.");
			return false;
		}else {
			return true;
		}
	} else {
		return true;
	}
}
function checklength(theform,postmaxchars) {
	if (postmaxchars != 0) {
		message = "\nМаксимально допустимая длина сообщения "+postmaxchars+" символов.";
	}else {
		message = "";
	}
	alert("Ваше сообщение содержит "+theform.message.value.length+" символов."+message);
}
function who(session,threadid) {
	window.open("misc.php?s="+session+"&action=whoposted&threadid="+threadid, "whoposted", "toolbar=no,scrollbars=yes,resizable=yes,width=250,height=300");
}
function whog(threadid) {
	window.open("misc.php?s="+sessionhash+"&action=whoposted&threadid="+threadid, "whoposted", "toolbar=no,scrollbars=yes,resizable=yes,width=230,height=300");
}
function confirm_newpm(session,inboxname) {
	input_box=confirm("У вас новые Персональные сообщения. Нажмите \"OK\" для их просмотра, или \"Cancel\" для отмены.");
	if (input_box==true) {
		second_box=confirm("Открыть в новом окне?\n\n(Нажмите \"Cancel\" для открытия папки "+inboxname+" в этом окне.)");
		if (second_box==true) {window.open('private.php?s='+session,'xvidpmnew','width=600,height=500,menubar=yes,scrollbars=yes,toolbar=yes,location=yes,directories=yes,resizable=yes,top=50,left=50');
		} else {
			window.location="private.php?s="+session;
		}
	} else {

	}
}
function checkCustom(formname) {formname.customavatarcheck.checked=true;}function CheckAll() {for (var i=0;i<document.form.elements.length;i++) {var e = document.form.elements[i];if ((e.name != 'allbox') && (e.type=='checkbox')) {e.checked = document.form.allbox.checked;}}}function CheckCheckAll() {var TotalBoxes = 0;var TotalOn = 0;for (var i=0;i<document.form.elements.length;i++) {var e = document.form.elements[i];if ((e.name != 'allbox') && (e.type=='checkbox')) {TotalBoxes++;if (e.checked) {TotalOn++;}}}if (TotalBoxes==TotalOn) {document.form.allbox.checked=true;} else {document.form.allbox.checked=false;}}function CheckAllForm(theform) {for (var i=0;i<theform.elements.length;i++) {var e = theform.elements[i];if ((e.name != 'allbox') && (e.type=='checkbox'))e.checked = theform.allbox.checked;}}function CheckCheckAllForm(theform) {var TotalBoxes = 0;var TotalOn = 0;for (var i=0;i<theform.elements.length;i++) {var e = theform.elements[i];if ((e.name != 'allbox') && (e.type=='checkbox')) {TotalBoxes++;if (e.checked) TotalOn++;}}if (TotalBoxes==TotalOn) theform.allbox.checked=true;else theform.allbox.checked=false;}function smilie(smilietext) {document.vbform.message.value += smilietext+" ";}function parentsmilie(smilietext) {opener.document.vbform.message.value += smilietext+" ";} function QueueChooserUpdate(sel) {document.form.threadurl.value = 'http://forum.xvid.ru/showthread.php?postid='+sel.value;} function AwayFieldReset(awayform){awayform.awayfromday.value = awayform.awayfrommonth.value = -1;awayform.awayfromyear.value = '';awayform.awaynolinksfromday.value = awayform.awaynolinksfrommonth.value = -1;awayform.awaynolinksfromyear.value = '';awayform.awaybackday.value = awayform.awaybackmonth.value = -1;awayform.awaybackyear.value = '';}
function UpdateTitle(text) {
if (document.vbform.threadtitle) {document.vbform.threadtitle.value = text;}
if (document.vbform.posttitle) {document.vbform.posttitle.value = text;}
if (document.vbform.title) {document.vbform.title.value = text;}
}

function RefreshVideoPtTitle() {

	var cdcount = 1;
	var engtitleseparator = '';
	var movietitle = document.vbform.pt_var_movietitle;
	var originalname = document.vbform.pt_var_originalname;
	var year = document.vbform.pt_var_year;
	var producer = document.vbform.pt_var_producer;
	var dvdtype = '';
	var titleproducer = '';


	cdcount += "";
	if(movietitle.value != '') {
		var title = movietitle.value;
	}
	if (originalname.value !== ''){
		title = title+'/'+originalname.value;
	}
	if(year.value != '' || producer.value != ''){
		if(year.value != '' && producer.value != ''){
			titleproducer = ', ';
		}
		title = title+'('+year.value+titleproducer+producer.value+')';
	}
	if(document.vbform.pt_var_dvdtype){
		var myselect = document.vbform.pt_var_dvdtype;
		for (var i=0; i<myselect.options.length; i++){
			if (myselect.options[i].selected===true){
				var dvdtype = myselect.options[i].value;
				break;
			}
		}

		title = dvdtype+': '+title;
	}

	
	

	


	//title = dvdtype+movietitle+ engtitleseparator +document.vbform.pt_var_originalname.value+ ' ('+document.vbform.pt_var_year.value+', '+document.vbform.pt_var_producer.value+')';

//var title = document.vbform.pt_var_movietitle.value+', '+document.vbform.pt_var_language.value.substr(0,2)+', '+document.vbform.pt_var_ripsource.value+', '+document.vbform.pt_var_container.value+'-'+document.vbform.pt_var_videocodec.value+'-'+document.vbform.pt_var_audiocodec.value+', кач.'+document.vbform.pt_var_quality.value.substr(0,1)+'/5, '+cdcount;

title = title.replace(new RegExp(',,|,( +),|( +),', 'g'), ',');

title = title.replace(new RegExp(', $', 'g'), '');

UpdateTitle(title);

if (document.vbform.pt_var_ripsource.value == 'VCD PAL') {

document.vbform.pt_var_videowidth.value = 352;

document.vbform.pt_var_videoheight.value = 288;

} else if (document.vbform.pt_var_ripsource.value == 'VCD NTSC') {

document.vbform.pt_var_videowidth.value = 352;

document.vbform.pt_var_videoheight.value = 240;

} else if (document.vbform.pt_var_ripsource.value == 'SVCD PAL') {

document.vbform.pt_var_videowidth.value = 480;document.vbform.pt_var_videoheight.value = 576;

} else if (document.vbform.pt_var_ripsource.value == 'SVCD NTSC') {

document.vbform.pt_var_videowidth.value = 480;

document.vbform.pt_var_videoheight.value = 480;

}

}




	function RefreshAudioPtTitle() {
	var cdcount = 1;

	cdcount += "";
var bitrate = document.vbform.pt_var_audiobitrate.value;
	if (bitrate.length > 0) {
		bitrate = ' '+bitrate;
}

	var title = document.vbform.pt_var_artist.value+' - '+document.vbform.pt_var_audiotitle.value+' ('+document.vbform.pt_var_audiocodec.value+bitrate+')';
title = title.replace(new RegExp(',,|,( +),|( +),', 'g'), ',');
title = title.replace(new RegExp(', $', 'g'), '');
UpdateTitle(title);
}

function RefreshGamePtTitle() {
var cdcount = 1;

	cdcount += "";
	var title = document.vbform.pt_var_gametitle.value;
title = title.replace(new RegExp(',,|,( +),|( +),', 'g'), ',');
title = title.replace(new RegExp(', $', 'g'), '');
UpdateTitle(title);
}


function RefreshBookPtTitle() {
	var cdcount = 1;

	cdcount += "";
var booktitle = document.vbform.pt_var_booktitle.value;
var autor = document.vbform.pt_var_autor.value;
var title = document.vbform.pt_var_autor.value+' '+document.vbform.pt_var_booktitle.value+'('+document.vbform.pt_var_bookformat.value+')';
title = title.replace(new RegExp(',,|,( +),|( +),', 'g'), ',');
title = title.replace(new RegExp(', $', 'g'), '');
UpdateTitle(title);
}

function defaultvalidate(form) {return true;}
var posttemplatevalidators = new Array();
function validateposttemplate(form) {
if (skipvalidation)	{return true;}
if (form.copyposttemplatefrom && form.copyposttemplatefrom.value.length > 0)return true;
for (var i = 0; i < posttemplatevalidators.length; ++i) {
	if (!posttemplatevalidators[i](form))
		return false;
	}
	return true;
}
function validatenotempty(textbox, title) {
var rv = textbox.value.length > 0;
if (!rv)window.alert('Поле "'+title+'" должно быть заполнено.');
return rv;
}
function validatenumeric(textbox, title) {var rv = (textbox.value.match(/^[0-9]+$/) ? true : false);if (!rv)window.alert('Поле "'+title+'" должно состоять только из цифр.');return rv;}
function validatenotemptyandnumeric(textbox, title) {return validatenotempty(textbox, title) && validatenumeric(textbox, title);}
function validateptvideo(form) {
	var rv =validatenotempty(form.pt_var_movietitle, "Название фильма") &&validatenotempty(form.pt_var_quality, "Качество") &&validatenotempty(form.pt_var_container, "Формат файла") &&validatenotempty(form.pt_var_videocodec, "Кодек видео") &&validatenotemptyandnumeric(form.pt_var_videowidth, "Ширина видео") &&validatenotemptyandnumeric(form.pt_var_videoheight, "Высота видео") &&validatenotempty(form.pt_var_language, "Язык звука") &&validatenotempty(form.pt_var_audiocodec, "Кодек звука") &&1;
	return rv;
}
function validateptaudio(form) {rv =validatenotempty(form.pt_var_audiotitle, "Название записи") &&validatenotempty(form.pt_var_language, "Язык звука") &&validatenotempty(form.pt_var_audiocodec, "Кодек звука") &&1;return rv;}
function validateptgame(form) {rv = validatenotempty(form.pt_var_gametitle, "Название") &&validatenotempty(form.pt_var_language, "Язык звука") &&1;return rv;}
function validateptbook(form) {rv=validatenotempy(form.pt_var_booktitle, "Название") &&validatenotempty(form.pt_var_autor, "Автор") && validatenotempty(form.pt_var_bookformat, "Формат") &&1;return rv;}                  
function validateptdownload(form) {rv =validatenotempty(form.pt_var_protocol, "Протокол скачивания") &&validatenotempty(form.pt_var_splitmethod, "Разбивка файла") &&validatenotempty(form.pt_var_servicetype, "Источник") &&1;return rv;}
function autofocus() {if (document.vbform) {with (document.vbform) {for (i = 0; i < length; ++i) {if (elements[i].type == 'text' || elements[i].type == 'textarea') {elements[i].focus();break;}}}}}

function ImportPtVideoFromAviCodec() {var filestr = prompt('Введите строку информации о файле (ESC для пропуска):');if (filestr) {var ofs = filestr.indexOf('File     :  ');if (ofs > -1) {filestr = filestr.substr(ofs+12);}var filearr = filestr.split(',  ');document.vbform.pt_var_bytesize.value = filearr[0].match(/[0-9.]+ \w+/);document.vbform.pt_var_videoextra.value = filearr[1];document.vbform.pt_var_container.value = filearr[2].substr(6);}var videostr = prompt('Введите строку информации о видео (ESC для пропуска):');if (videostr) {var ofs = videostr.indexOf('Video :  ');if (ofs > -1) {videostr = videostr.substr(ofs+9);var videoarr = videostr.split(',  ');document.vbform.pt_var_videobitrate.value = videoarr[1].match(/\d+/);document.vbform.pt_var_videoextra.value = (document.vbform.pt_var_videoextra.value.length > 0 ? document.vbform.pt_var_videoextra.value+'; '+videoarr[2] : videoarr[2]);var re = /(\d+)\*(\d+)/;var matches = re.exec(videoarr[3]);document.vbform.pt_var_videowidth.value = matches[1];document.vbform.pt_var_videoheight.value = matches[2];re = /(.+?) = (.+)/;matches = re.exec(videoarr[4]);var fourcc = matches[1];var videocodec = matches[2];if (fourcc == 'XVID') {document.vbform.pt_var_videocodec.value = 'XviD';} else if (fourcc == 'DIV3') {document.vbform.pt_var_videocodec.value = 'Low Motion DivX 3';} else if (fourcc == 'DX50') {document.vbform.pt_var_videocodec.value = '5.* DivX';} else if (fourcc == 'DIVX') {document.vbform.pt_var_videocodec.value = 'OpenDivX 4';}}}var audiostr = prompt('Введите строку информации о звуке (ESC для пропуска):');if (audiostr) {var ofs = audiostr.indexOf('Audio :  ');if (ofs > -1) {audiostr = audiostr.substr(ofs+9);}var audioarr = audiostr.split(',  ');document.vbform.pt_var_audiobitrate.value = audioarr[1].match(/\d+/);document.vbform.pt_var_audioextra.value = audioarr[2]+'; '+audioarr[3];var channels = audioarr[3].match(/\d+/);var re = /(.+?) = (.+)/;var matches = re.exec(audioarr[4]);var id = matches[1];var audiocodec = matches[2];if ((channels == 6 || channels == 5) && id == 0x2000) {document.vbform.pt_var_audiocodec.value = 'AC3 5.1';} else if (channels == 2 && id == 0x2000) {document.vbform.pt_var_audiocodec.value = 'AC3 2.0';} else if (id == 0x55) {var br = document.vbform.pt_var_audiobitrate.value;if (br == 24 || br == 32 || br == 64 || br == 96 || br == 112 || br == 128 || br == 160 || br == 192 || br == 224 || br == 256 || br == 320) {document.vbform.pt_var_audiocodec.value = 'CBR MP3';} else {document.vbform.pt_var_audiocodec.value = 'VBR MP3';}}}RefreshTitle();}var onLoadHandlers = new Array();
function handleOnLoad() {
	for (var i = 0; i < onLoadHandlers.length; ++i) {onLoadHandlers[i]();}
}
var titleRefresher;
function RefreshTitle() {
	titleRefresher();
}


function offer_to_warn(postid) {var response = confirm('Вы собрались редактировать чужой пост. Если вы хотите выдать этому участнику предупреждение, вам следует сначала выдать предупреждение (это сохранит копию оригинального поста), после чего редактировать пост.\n\nЕсли вы хотите перейти к форме выдачи предупреждения, нажмите "Да" ниже. Нажмите "Нет" чтобы остаться на этой странице редактирования.');if (response) {window.location = 'warning.php?s='+sessionhash+'&action=warn&postid='+postid;}}

function msgbox(acturl, title, width, height, text)
{
 windop=window.open(acturl, title,'width=' + width + ',height=' + height + ',status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,left=' + Math.ceil(document.body.clientWidth/2) + ',top=' + Math.ceil(document.body.clientHeight/2));
 windop.document.open();
 windop.document.write("<html>\n<head>\n<meta http-equiv = \"Content-Type\" content = \"text/html; charset = windows-1251\">\n<title>" + title + "</title>");
 windop.document.write("\n<style>\nfont.head\n{\n font-family: Arial;\n color: #2E2E2E;\n font-weight: bold;\n font-size: 12px;\n}\n");
 windop.document.write("input.button\n{\n padding: 0px 0px 0px 0px;\n margin: 0px 0px 0px 0px;\n border-left: #979797 1px solid;\n");
 windop.document.write(" border-right: #979797 1px solid;\n border-top: #979797 1px solid;\n border-bottom: #979797 1px solid;\n");
 windop.document.write(" color: #676767;\n background-color: #E9E9E9;\n font-weight: bold;\n font-size: 12px;\n font-family: Arial;\n");
 windop.document.write(" text-align: center;\n width: 104px;\n height: 30px;\n cursor: hand;\n}\n</style>\n");
 windop.document.write("</head>\n<body bgcolor = \"#BBBBBB\">");
 windop.document.write("\n<center>\n<font class = \"head\">\n" + text + "\n</font><p>");
 windop.document.write("\n<form>\n<input class = \"button\" type = \"button\" value = \"Close\" OnClick = \"window.close()\">\n");
 windop.document.write("</form>\n</center>\n</body>\n</html>");
 windop.document.close();
}
//var IMGDIR_MISC = "$stylevar[imgdir_misc]";
// -->
function showSpoiler(block) {
   // by The Small One
  // block.nextSibling.nextSibling.style.display ="block";
 //  block.parentNode.removeChild(block);
  
   
   if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display!= '') {
   	this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';
   	this.innerText = ''; 
   	this.value = 'Hide'; 
   } else { 
   	this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none';
   	this.innerText = ''; 
   	this.value ='Show'; }
}

function toggleVisibility(cellid, cellreplaceid)
{
    document.getElementById(cellid).style.display =
        document.getElementById(cellid).style.display == 'block' ?
            'none' : 'block';
    if (cellreplaceid) {
        document.getElementById(cellreplaceid).style.display =
            document.getElementById(cellreplaceid).style.display == 'block' ?
                'none' : 'block';
    }
    
    return true;
}
function Toggle(IDS,n) {
  for (var i=0; i<n; i++) { document.getElementById('DB'+i).style.display='none';
document.getElementById('tabs'+i).style.backgroundColor='#A4ABA4'; }
  document.getElementById('DB'+IDS).style.display = 'block';
  document.getElementById('tabs'+IDS).style.backgroundColor = '#8080A6';
}
function toggleLayer( whichLayer )
{
	var elem, vis;
	if( document.getElementById ) // this is the way the standards work
	elem = document.getElementById( whichLayer );
	else if( document.all ) // this is the way old msie versions work
	elem = document.all[whichLayer];
	else if( document.layers ) // this is the way nn4 works
	elem = document.layers[whichLayer];
	vis = elem.style;
	// if the style.display value is blank we try to figure it out here
	if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
	vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
	vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
function toggleVars( whichLayer )
{
	var elem=returnObjById( whichLayer );
	var vis = elem.style;
	// if the style.display value is blank we try to figure it out here
	if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
	vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
function toggleDivOL( elemID ){   
	 var elem = document.getElementById( elemID );
	     if( elem.style.position != 'absolute' )    { 
	     	       elem.style.position = 'absolute';        
	     	       elem.style.left = '-4000px';    
	     }    else    {        
	     	elem.style.position = 'relative';
	     	elem.style.left = '0px';    
	     }
}

