var acv_desscription;
function details(id)
{
	$("ul[id^=9999]").each(function(){ if (this.id == id) {
		if ($(this).css('display') == 'block') $(this).hide();
		else $(this).show();
	} else $(this).hide(); });
}

function show_mm(id)
{
	$("div[id^=mm]").each(function(){ if (this.id == 'mm'+id) {
		if ($(this).css('display') == 'block') $(this).hide();
		else $(this).show();
	} else $(this).hide(); });
	return false;
}

function LoadStatic(link, id)
{
	$("#"+id).load(link);
	return false;
}

function ClearData(id) { $("#"+id).html(""); $("#pages2").html(""); }

function textCounter(field,counter,maxlimit,linecounter) {
	var fieldWidth =  parseInt(field.offsetWidth);
	var charcnt = field.value.length;
	if (charcnt > maxlimit) { field.value = field.value.substring(0, maxlimit);}
	else { var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
	document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
	document.getElementById(counter).innerHTML=""+percentage+"%"
	setcolor(document.getElementById(counter),percentage,"background-color");}
}

function setcolor(obj,percentage,prop){	obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)"; }

function doload(value)
{
	$("#result").html('<center><br><img align=absmiddle src="'+imgdir+'load.gif"></center>');
	$("#result").load(host+'ajax.php?action=selcat&cat1='+value);
}

function Sizer(leftright,min,max) {
   document.write("<b id="+leftright+"_fsize>13</b>px");
   for (i=min; i < max; i++)
   document.write("<A onclick=\"setSize('"+leftright+"',"+i+"); return false;\" href=\"#\">"+i+"</A>");
}

function setSize(leftright,fsize) {
   document.getElementById(leftright).style.fontSize=fsize+"px";
   document.getElementById(leftright+'_fsize').innerHTML=fsize;
}

function addToNote(id)
{
	$("#query").show();
	$("#img_query").show();

	$.ajax({
	    url: host+'ajax.php',
	    dataType : "text",
	    data: {action: "addnote", idboard: id },
	    type: "GET",
	    success: function (data, textStatus) {
			$("#query").hide();
			$("#img_query").hide();
			$("#addToNote"+id).html("<img src='"+imgdir+"nonote.png' />");
	    }
	});

	return false;
}

function check(o)
{
$("input[type=checkbox]").each(function(){this.checked = o.checked;});
}

function selcity(value)
{
	$("#selcity").html('Загрузка городов...');
	$.ajax({
	    url: host+'ajax.php',
	    dataType : "text",
	    data: {action: "selcity" },
	    success: function (data, textStatus) {
	    	$("#selcity").html("<select name='ctid' style='width:170px;' onchange='document.chct.submit();'>"+data+"</select>");
	    }
	});
}

function overlay(curobj, subobj){
	if (document.getElementById){
		var subobj=document.getElementById(subobj)
		subobj.style.right="20%"
		subobj.style.top="80px"
		subobj.style.display="block"
		return false
	}
	else
	return true
}

function overlayclose(subobj){
	document.getElementById(subobj).style.display="none"
}

function oldImgLoad() {
	$(".oldimg").mouseenter(function(){ $(this).children().show();
	    }).mouseleave(function(){ $(this).children().hide(); });
}

function rmOldImg(id) {
	$.ajax({
	    url: host+'ajax.php',
	    dataType : "text",
	    data: {action: "rmoldimg", id: id },
	    type: "GET",
	    success: function (data, textStatus) {
			$("#old"+id).remove();
	    }
	});

}

function send_comments(id)
{
	var au = document.cmnFrm.autor.value;
	var txt = document.cmnFrm.text.value;
	if (au == 'Ваше имя') au = "";
	if (!au) { alert("Введите ваше имя"); return; }
	if (txt == "Содержание комментария") txt = "";
	if (!txt) { alert("Введите ваш комментарий"); return; }

	$.ajax({
	    url: host+'ajax.php',
	    dataType : "text",
	    type: "GET",
	    data: {action: "addcomment", id: id, author: au, txt: txt },
	    success: function (data, textStatus) {
	    	$("#add_comments2").html('<span style="color: rgb(226, 140, 97); font-size: 18px;"><strong>Комментарий добавлен.</strong></span>');
	    }
	});
	return false;
}

function send_mail_friends(id)
{
	$.ajax({
	    url: host+'ajax.php',
	    dataType : "text",
	    type: "GET",
	    data: {from: document.sendF.from.value, to: document.sendF.to.value, id: id, action: "sendfriend" },
	    success: function (data, textStatus) {
			$('#cntrld').removeClass('control_dialog');
			$('#mail_friends').hide();
	    }
	});
	return false;
}
