	function $A(C){if(!C){return[]}if(C.toArray){return C.toArray()}var B=C.length||0,A=new Array(B);while(B--){A[B]=C[B]}return A}Object.extend=function(A,C){for(var B in C){A[B]=C[B]}return A};Object.extend(Object,{inspect:function(A){try{if(Object.isUndefined(A)){return"undefined"}if(A===null){return"null"}return A.inspect?A.inspect():A.toString()}catch(B){if(B instanceof RangeError){return"..."}throw B}},toQueryString:function(A){return $H(A).toQueryString()},toHTML:function(A){return A&&A.toHTML?A.toHTML():String.interpret(A)},keys:function(A){var B=[];for(var C in A){B.push(C)}return B},values:function(B){var A=[];for(var C in B){A.push(B[C])}return A},isElement:function(A){return A&&A.nodeType==1},isArray:function(A){return A&&A.constructor===Array},isHash:function(A){return A instanceof Hash},isFunction:function(A){return typeof A=="function"},isString:function(A){return typeof A=="string"},isNumber:function(A){return typeof A=="number"},isUndefined:function(A){return typeof A=="undefined"}});var Class={create:function(){var E=null,D=$A(arguments);if(Object.isFunction(D[0])){E=D.shift()}function A(){this.initialize.apply(this,arguments)}Object.extend(A,Class.Methods);A.superclass=E;A.subclasses=[];if(E){var B=function(){};B.prototype=E.prototype;A.prototype=new B;E.subclasses.push(A)}for(var C=0;C<D.length;C++){A.addMethods(D[C])}if(!A.prototype.initialize){A.prototype.initialize=function(){}}A.prototype.constructor=A;return A}};Class.Methods={addMethods:function(G){var C=this.superclass&&this.superclass.prototype;var B=Object.keys(G);if(!Object.keys({toString:true}).length){B.push("toString","valueOf")}for(var A=0,D=B.length;A<D;A++){var F=B[A],E=G[F];if(C&&Object.isFunction(E)&&E.argumentNames().first()=="$super"){var H=E,E=Object.extend((function(I){return function(){return C[I].apply(this,arguments)}})(F).wrap(H),{valueOf:function(){return H},toString:function(){return H.toString()}})}this.prototype[F]=E}return this}};

	

	var isIE = (navigator.appName == "Microsoft Internet Explorer");
	var isFF = (!isIE && !(navigator.appVersion.indexOf("MSIE")>-1));
	var isOPR = (navigator.userAgent.indexOf("Opera")!=-1);
	var isIE6 = navigator.userAgent.indexOf("MSIE 6.0") >= 0;
	var isIE7 = navigator.userAgent.indexOf("MSIE 7.0") >= 0;
	var isIE8 = navigator.userAgent.indexOf("MSIE 8.0") >= 0;
	if (isOPR || isIE7) { isIE = false; }

	var xPos;
	var yPos;

	var YMaps = new Object();

	document.onmousemove = function(event) { getClickPos(event); };

	function getClickPos(e)
		{
		if (isFF)
		    {
		    xPos = e.pageX;
		    yPos = e.pageY;
		    }
		else
		    {
		    if (document.documentElement && document.documentElement.scrollTop)
		    	{
		    	try
		    		{
		    		xPos = event.clientX + document.documentElement.scrollLeft;
		    		yPos = event.clientY + document.documentElement.scrollTop;
		    		}
				catch (e)
					{
					}
		    	}
		    else
		    	{
		    	try
		    		{
		    		xPos = event.clientX + document.body.scrollLeft;
		    		yPos = event.clientY + document.body.scrollTop;
		    		}
				catch (e)
					{
					}
		    	}
		    }

		}

	function getPosition(obj)
		{
		var elem = obj

    	var l = 0;
    	var t = 0;

    	while (elem)
	   		{
	       	l += elem.offsetLeft;
	      	t += elem.offsetTop;
	     	elem = elem.offsetParent;
	   		}
	   	obj.l = l;
	   	obj.t = t;
		}

	window.onload = function()
		{

		}

	function proveOrder(id,status)
		{	
		switch (status){
			case 'recived':
				text = 'получена';
				classN = 'bolt';
				break;
			case 'approved':
				text = 'одобрена';
				classN = 'prooved';
				break;
			case 'failed':
				text = 'отклонена';
				classN = 'bolt';
				break;
			case 'winner':
				text = 'победитель';
				classN = 'prooved';
				break;
		}
		
		//$('sp_'+id).className = class;
		//$('sp_'+id).innerHTML = text;
		if ($('changeStatusSuccess_'+id))
			$('changeStatusSuccess_'+id).display = 'none';
		
		if ($('change_status_success_'+id))
			$('change_status_success_'+id).innerHTML = '<img alt="загрузка" src="http://im1.zv.innovaterussia.ru/data/zv/images/co_pl.gif" />';
		
		if ($('status_'+id))
			{
			$('status_'+id).className = classN;
			$('status_'+id).innerHTML = text + ' <em>(<a href="#" onclick="showStatusChange(this, $(\'changeStatus_'+id+'\')); return false;">изменить</a>)</em>';
			}
		
		var url = 'id='+id+'&status='+status;
		if($('comm_'+id) && $('comm_'+id).value)
		    url += '&comment='+$('comm_'+id).value;
		
		lookup({url:'/api/co.order.api.php', values:url, postFunction: function() { 
					if ($('changeStatusSuccess_'+id)) $('changeStatusSuccess_'+id).style.display = 'block'; 
					if ($('change_status_success_'+id))
						{
						$('change_status_success_'+id).innerHTML = 'Изменения сохранены!';
						setTimeout(function() { $('change_status_success_'+id).innerHTML = '' }, 2000);
						}
					}
				});
		if ($('changeStatus_'+id))
			setTimeout(function() { $('changeStatus_'+id).style.display = 'none'; }, 2000);
		}

	function processCompanyFilter()
		{
		companyList = $('company_filter').getElementsByTagName('input');
		selectedCompanies = new Array;
		j=0;
		for (i=0; i<companyList.length; i++)
			{
			if (companyList[i].checked)
				{
				selectedCompanies[j] = companyList[i].value;
				j++;
				}
			}
		companyFilter = '/competitions/company_';
		if (selectedCompanies.length == 0)
			{
			alert('Необходимо выбрать хотя бы одну компанию');
			return false;
			}
		else
			{
			companyFilter += selectedCompanies.join(',');
			if($('search')){
			    if($('search').value) companyFilter += '/search_'+$('search').value;
			}
			location.href = companyFilter;
			}
			
		}

	function processCompanyEndFilter()
		{
		companyList = $('company_filter').getElementsByTagName('input');
		selectedCompanies = new Array;
		j=0;
		for (i=0; i<companyList.length; i++)
			{
			if (companyList[i].checked)
				{
				selectedCompanies[j] = companyList[i].value;
				j++;
				}
			}
		companyFilter = '/competitions/competitions_end/company_';
		if (selectedCompanies.length == 0)
			{
			alert('Необходимо выбрать хотя бы одну компанию');
			return false;
			}
		else
			{
			companyFilter += selectedCompanies.join(',');
			location.href = companyFilter;
			}
		}


	// СМС-ки
	function sendMySMS(id)
		{
		lookup({
				url:'/api/sms.api.php', 
				values:'action=send_sms&id='+id,
				postFunction: function(http)
					{
					$('phone_auth_'+id).style.display = 'block';
					$('ph_'+id).style.display = 'none';
					} 
				});
		}

	// Сахер

	var $ = function(id)
		{
		return document.getElementById(id)
		}


	function getElementsByClass(searchClass,node,tag)
		{
        var classElements = new Array();
        if (node == null) node = document;
        if (tag == null) tag = '*';
        var els = node.getElementsByTagName(tag);
        var elsLen = els.length;
        var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
        for (i = 0, j = 0; i < elsLen; i++)
        	{
			if (pattern.test(els[i].className))
				{
				classElements[j] = els[i];
				j++;
				}
			}
		return classElements;
		}

	// Комплитар
	var Autocompleter = { }
	Autocompleter = Class.create({
  		initialize: function(element, url) {

    		var autocompleter = this;

			this.id = element;
			this.selected = null;
			this.lis = new Array;
			this.input = null;
			this.url = url;
			this.focused = false;

			autocompleter.ac = {};

			this.input = $(this.id);
			//$(this.id).autocomplete = 'off';
			this.input.onkeyup = function(event) { if (!this.value && $('ac_'+this.id) && !autocompleter.focused) { $('ac_'+this.id).style.display='none'; } autocompleter.autocomplete(autocompleter, event, this); return false };
			this.input.onblur = function() { if ($('education')) cloneEdu($('education')); if ($('ac_'+this.id)) $('ac_'+this.id).style.display = 'none' };
			this.input.onfocus = function(event) { if (this.value == '') autocompleter.acFocus(autocompleter, this, event) }
    		this.initialized = true;
		  },

		autocomplete: function(autocompleter, event, obj) {
			//$('test').innerHTML += this.selected + '<br />';
			event = event || window.event;
			//obj.autocomplete = 'off';

			if ((event.keyCode != 40 && event.keyCode != 38 && event.keyCode != 13) && obj.value)
			    {
			    autocompleter.focused = false;
				obj.onkeydown = function(event) { autocompleter.autocompleteNavigation(autocompleter,event) }

			    lookup({
			    url:'/api/'+autocompleter.url,
			    values:'query='+encodeURIComponent(obj.value),
			    postFunction: function(transport)
			    	{
			    	if (!$('ac_'+obj.id))
			    	    {
			    	    getPosition(obj);
			    	    newAC = document.createElement('span')
			    	    newAC.id = 'ac_'+obj.id;
			    	    newAC.className = 'autocompliter';
			    	    newAC.style.position = 'absolute';
			    	    newAC.style.zIndex = '20';
			    	    obj.parentNode.style.position = 'relative';
			    	    newAC.style.top = obj.offsetHeight + obj.t + 'px';
			    	    newAC.style.left = obj.l + 10 + 'px';
			    		document.getElementsByTagName('body')[0].appendChild(newAC);
			    		autocompleter.ac = newAC;
			    	    }
					
			    	autocompleter.ac.style.display = 'block';
			    	autocompleter.ac.innerHTML = transport.responseText;
			    	//$('test').innerHTML = newAC.innerHTML;
			    	autocompleter.lis = $(autocompleter.ac.id).getElementsByTagName('a');
			    	autocompleter.selected = null;
			    	for (i=0; i<autocompleter.lis.length; i++)
			    	    {
			    		//$('test').innerHTML += this.lis[i]+'<br />'
			    		autocompleter.lis[i].num = i;
			    		autocompleter.lis[i].onmousedown = function() { obj.value = this.innerHTML.replace(/<small>(.*?)<\/small>/i,''); obj.value = obj.value.replace(/<(.*?)>/ig,''); if ($(obj.id+'_id')) {$(obj.id+'_id').value=this.id;} $('ac_'+obj.id).style.display = 'none'; }
			    		autocompleter.lis[i].onmouseover = function() { if (autocompleter.selected) { autocompleter.selected.className = ''; } autocompleter.selected = this; this.className = 'active' }
			    		autocompleter.lis[i].onmouseout = function() { this.className = '' }
			    	    }
			    	//alert(autocompleter.lis)
			    	}
			    	});
			    }
			},

		autocompleteNavigation: function(autocompleter,event)
		    {
			event = event || window.event;

		    if (event.keyCode == 40)
		    	{
		    	if (event.preventDefault)
		    		event.preventDefault();
		    	else
		    		event.returnValue = false;

		    	if (!autocompleter.selected && this.lis.length>0)
		    		{
		    		autocompleter.selected = this.lis[0];
		    		autocompleter.lis[0].className = 'active';
		    		}
		    	else
		    		{
		    		autocompleter.selected.className = '';
		    		if (autocompleter.selected.num != autocompleter.lis.length-1 )
		    			autocompleter.selected = autocompleter.lis[autocompleter.selected.num+1];
		    		else
		    			autocompleter.selected = autocompleter.lis[0];

		    		autocompleter.selected.className = 'active';
		    		}
		    	}

		    if (event.keyCode == 38)
		    	{
		    	if (event.preventDefault)
		    		event.preventDefault();
		    	else
		    		event.returnValue = false;

		    	if (!autocompleter.selected)
		    		{
		    		autocompleter.selected = autocompleter.lis[autocompleter.lis.length-1];
		    		autocompleter.lis[autocompleter.lis.length-1].className = 'active';
		    		}
		    	else
		    		{
		    		autocompleter.selected.className = '';
		    		if (autocompleter.selected.num != 0)
		    			autocompleter.selected = autocompleter.lis[autocompleter.selected.num-1];
		    		else
		    			autocompleter.selected = autocompleter.lis[autocompleter.lis.length-1]

		    		autocompleter.selected.className = 'active';
		    		}
		    	}

		    if (event.keyCode == 13)
		    	{
		    	if (event.preventDefault)
		    		event.preventDefault();
		    	else
		    		event.returnValue = false;

		    	autocompleter.input.value = autocompleter.selected.innerHTML.replace(/<small>(.*?)<\/small>/i,'');
		    	autocompleter.input.value = autocompleter.input.value.replace(/<(.*?)>/ig,'');
		    	autocompleter.ac.style.display = 'none';
		    	if ($(autocompleter.input.id+'_id')) $(autocompleter.input.id+'_id').value=autocompleter.selected.id;
		    	}
		    },

		acFocus: function(autocompleter, obj, event)
			{
			autocompleter.focused = true;
			obj.onkeydown = function(event) { autocompleter.autocompleteNavigation(autocompleter,event) }

    	    lookup({
    	    url:'/api/'+autocompleter.url,
    	    values:'empty=true',
    	    postFunction: function(transport)
    	    	{

    	    	if (!$('ac_'+obj.id))
    	    	    {
    	    	    getPosition(obj);
    	    	    newAC = document.createElement('span')
    	    	    newAC.id = 'ac_'+obj.id;
    	    	    newAC.className = 'autocompliter';
    	    	    newAC.style.position = 'absolute';
    	    	    newAC.style.zIndex = '20';
    	    	    obj.parentNode.style.position = 'relative';
    	    	    newAC.style.top = obj.offsetHeight + obj.t + 'px';
			    	newAC.style.left = obj.l + 10 + 'px';
    	    		document.getElementsByTagName('body')[0].appendChild(newAC);
    	    		autocompleter.ac = newAC;
    	    	    }

    	    	autocompleter.ac.style.display = 'block';
    	    	autocompleter.ac.innerHTML = transport.responseText;
    	    	//$('test').innerHTML = newAC.innerHTML;
    	    	autocompleter.lis = $(autocompleter.ac.id).getElementsByTagName('a');
    	    	autocompleter.selected = null;
    	    	for (i=0; i<autocompleter.lis.length; i++)
    	    	    {
    	    		//$('test').innerHTML += this.lis[i]+'<br />'
    	    		autocompleter.lis[i].num = i;
    	    		autocompleter.lis[i].onmousedown = function() { obj.value = this.innerHTML.replace(/<small>(.*?)<\/small>/i,''); obj.value = obj.value.replace(/<(.*?)>/ig,''); if ($(obj.id+'_id')) {$(obj.id+'_id').value=this.id;} $('ac_'+obj.id).style.display = 'none'; }
    	    		autocompleter.lis[i].onmouseover = function() { if (autocompleter.selected) { autocompleter.selected.className = ''; } autocompleter.selected = this; this.className = 'active' }
    	    		autocompleter.lis[i].onmouseout = function() { this.className = '' }
    	    	    }
    	    	//alert(autocompleter.lis)
    	    	}
    	    	});

			}
		});

	
	// Комментарии
	function addComment(object,id)
		{
		$('err_comment').style.display = 'none';
		if (!/[A-zА-я0-9()]/.exec($('comment_text').value))
			{
			$('err_comment').innerHTML = 'Вы ничего не написали!';
			$('err_comment').style.display = 'block';
			$('comment_text').focus();
			return false;
			}
		request = 'action=add&data[object]='+object+'&data[object_id]='+id+'&data[text]='+encodeURIComponent($('comment_text').value);
		$('new_comment').style.display = 'block';
		coms = $('new_comment').innerHTML;
		$('new_comment').innerHTML = coms+'<img id="cLoad" src="/images/comment-loader.gif" />';
		lookup({
			url: '/work/comment.work.html',
			values: request,
			postFunction: function(transport)
				{
				$('cLoad').style.display = 'none';

				$('new_comment').innerHTML = coms + transport.responseText;
				$('new_comment').style.display = 'block';

				newObject = document.createElement("span");
				newObject.id = 'tmp_new_comment';
				newObject.style.display = 'none';
				$('new_comment').parentNode.appendChild(newObject);
				$('comment_text').value = '';
				//tinyMCE.getInstanceById('comment_text').setContent('');
				$('new_comment').id = '';
				$('tmp_new_comment').id = 'new_comment';

			//	$('comment_form').style.display = 'none';
				if ($('no_comments'))
					{
					$('no_comments').style.display = 'none';
					}
				}
			});
		}

	function delToMessage(id,obj)
		{
		lookup({
			url: '/work/message.del.work.html',
			values: 'action=to&id='+id,
			postFunction: function(transport)
				{
				obj.parentNode.removeChild(obj);
				}
			});
		}

	function delComment(id)
		{
		lookup({
			url: '/work/comment.work.html',
			values: 'action=del&id='+id,
			postFunction: function(transport)
				{
				$('c_'+id).parentNode.removeChild($('c_'+id));
				}
			});
		}

	function decline(id)
		{
		lookup({
			url: '/work/decline.work.html',
			values: 'action=del&id='+id,
			postFunction: function(transport)
				{
				$('pr_'+id).parentNode.removeChild($('pr_'+id));
				}
			});
		}



	function reloadCapcha()
		{
		var dateObj = new Date();
		$('capcha_img').src = '/api/capcha.api.php?reload='+dateObj.getTime();
		}

	function chcat(a)
		{
		var i;
		for (i=1; i<=3; i=i+1)
			{
			if ( document.getElementById('a'+i).style.display='block' )
			document.getElementById('a'+i).style.display='none';
			}
		document.getElementById('a'+a).style.display='block';
		}

	var prevComment;
	var prevCommentIH;
	var answerForm = '';
	function commentAnswer(parent_id, object, object_id)
		{
		$('new_comment_form').style.display = 'none';

		if (prevComment)
			{
			prevComment.innerHTML = prevCommentIH;
			}

		prevComment = $('answer_'+parent_id);
		prevCommentIH = $('answer_'+parent_id).innerHTML;

		answerForm = '<form target="server" action="comment.zv.tree.work.html" method="post">\r\n';
		answerForm += '<textarea id="comment_text_'+parent_id+'" name="data[text]"></textarea><span class="err" id="err_comment_'+parent_id+'"></span<br /><input type="button" onclick="addTreeComment(\''+object+'\','+object_id+','+parent_id+')" value="ответить" /> <input type="button" onclick="prevComment.innerHTML = prevCommentIH; return false;" value="отмена" />\r\n';
		answerForm += '</form>';
		$('answer_'+parent_id).innerHTML = answerForm;
		return false;
		}


	function addTreeComment(object,id,parent_id)
		{
		$('err_comment_'+parent_id).style.display = 'none';
		if (!/[A-zА-я0-9()]/.exec($('comment_text_'+parent_id).value))
			{
			$('err_comment_'+parent_id).innerHTML = 'Вы ничего не написали!';
			$('err_comment_'+parent_id).style.display = 'block';
			$('comment_text_'+parent_id).focus();
			return false;
			}
		request = 'action=add&data[parent_id]='+parent_id+'&data[object]='+object+'&data[object_id]='+id+'&data[text]='+encodeURIComponent($('comment_text_'+parent_id).value);
		$('new_comment_'+parent_id).style.display = 'block';
		$('answer_'+parent_id).innerHTML = prevCommentIH;
		$('new_comment_'+parent_id).innerHTML = '<img id="cLoad" src="http://im1.zv.innovaterussia.ru/images_ir/loader.gif" />';
		lookup({
			url: '/work/comment.zv.tree.work.html',
			values: request,
			postFunction: function(transport)
				{
				$('cLoad').parentNode.removeChild($('cLoad'));

				newObject = document.createElement("div");
				newObject.innerHTML = transport.responseText;
				newObject.style.marginLeft = '0';
				$('c_'+parent_id).insertBefore(newObject, $('new_comment_'+parent_id));
				}
			});
		}

	function addTreeRootComment(object,id)
		{
		$('err_comment').style.display = 'none';
		if (!/[A-zА-я0-9()]/.exec($('comment_text').value))
			{
			$('err_comment').innerHTML = 'Вы ничего не написали!';
			$('err_comment').style.display = 'block';
			$('comment_text').focus();
			return false;
			}
		request = 'action=add&data[object]='+object+'&data[object_id]='+id+'&data[text]='+encodeURIComponent($('comment_text').value);
		$('new_comment').style.display = 'block';
		coms = $('new_comment').innerHTML;
		$('new_comment').innerHTML = coms+'<img id="cLoad" src="/images/comment-loader.gif" />';
		lookup({
			url: '/work/comment.zv.tree.work.html',
			values: request,
			postFunction: function(transport)
				{
				$('cLoad').style.display = 'none';

				$('new_comment').innerHTML = coms + transport.responseText;
				$('new_comment').style.display = 'block';

				newObject = document.createElement("div");
				newObject.id = 'tmp_new_comment';
				newObject.style.display = 'none';
				$('new_comment').parentNode.insertBefore(newObject, $('before_nah'));
				$('comment_text').value = '';
				//tinyMCE.getInstanceById('comment_text').setContent('');
				$('new_comment').id = '';
				$('tmp_new_comment').id = 'new_comment';

			//	$('comment_form').style.display = 'none';
				if ($('no_comments'))
					{
					$('no_comments').style.display = 'none';
					}
				}
			});
		}
	
	var prevStatusForm;
	function showStatusChange(obj, showObj)
		{
		if (prevStatusForm)
			prevStatusForm.style.display = 'none';
		
		$('changeStatusSuccess_'+showObj.id.replace('changeStatus_','')).style.display = 'none';
		
		getElementPosition(obj);
		getElementPosition($('left_colomn'));
		
		showObj.style.top = obj.t + 'px';
			
		showObj.style.display = 'block';
		
		if ((parseInt(showObj.style.top)+parseInt(showObj.offsetHeight) > ($('left_colomn').t + $('left_colomn').offsetHeight)))
			{
			showObj.style.top = ($('left_colomn').offsetHeight + $('left_colomn').t) - showObj.offsetHeight + 'px';
			}
		
		prevStatusForm = showObj;
		}
	
	function getElementPosition(obj)
		{
		var elem = obj

    	var l = 0;
    	var t = 0;

    	while (elem)
	   		{
	       	l += elem.offsetLeft;
	      	t += elem.offsetTop;
	     	elem = elem.offsetParent;
	   		}
	   	obj.l = l;
	   	obj.t = t;
		}

	//аякс
	function getHTTP()
		{
		var xmlhttp;
		/*@cc_on
		@if (@_jscript_version >= 5)
			try
				{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
			catch (e)
				{
				try
					{
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
					}
				catch (E)
					{
					xmlhttp = false;
					}
				}
		@else
			xmlhttp = false;
		@end @*/
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
			{
			try
				{
				xmlhttp = new XMLHttpRequest();
				}
			catch (e)
				{
				xmlhttp = false;
				}
			}
		return xmlhttp;
		}

	function lookup(lookupSettings)
		{
		if (!lookupSettings) lookupSettings = new Object();

		if (!lookupSettings.values)   lookupSettings.values   = '';
		if (!lookupSettings.dest)  lookupSettings.dest = false;
		if (!lookupSettings.cache)  lookupSettings.cache = false;
		if (!lookupSettings.postFunction)   lookupSettings.postFunction   = '';


		if (lookupSettings.url)
			{
			if (lookupSettings.cache && cacheStore[lookupSettings.url+'?'+lookupSettings.values])
				{
				try { document.getElementById(lookupSettings.dest).innerHTML = cacheStore[lookupSettings.url+'?'+lookupSettings.values].responseText }
				catch (e) { }
				if (lookupSettings.postFunction) lookupSettings.postFunction(cacheStore[lookupSettings.url+'?'+lookupSettings.values]);
				}
			else
				{
				this.working = false;
				if (!this.working && (this.http = getHTTP()))
					{
					var http = this.http;
					this.http.open("POST", lookupSettings.url, true);
					this.http.onreadystatechange = function()
						{
						if (http.readyState == 4)
							{
							if (lookupSettings.cache)
								{
								cacheStore[lookupSettings.url+'?'+lookupSettings.values] = http;
								}
							try { destObj = document.getElementById(lookupSettings.dest).innerHTML = http.responseText }
							catch (e) { }
							if (lookupSettings.postFunction) lookupSettings.postFunction(http);
							this.working = false;
							this.http = false;
							}
						}
					this.working = true;
					this.http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
					this.http.send(lookupSettings.values);
					}
				}
			}
		}

 // пометить сообщение как спам
function delmess(id,type){
    lookup({
        url:'/api/spam.api.php',
        values:'id='+id+'&type='+type,
        postFunction: function(transport){
                if(type=="spam"){
                    document.getElementById('t_'+id).innerHTML = "Сообщение удалено как спам";
                }else{
                    document.getElementById('t_'+id).innerHTML = "Сообщение удалено";
                }
                setTimeout("self.location.reload()",1000);
        }
    });
}

 // удалить контакт
function deleteContact(cuId,contactId,contactPage,cabinet){
    lookup({
        url:'/api/delete_contact.api.php',
        values:'cu_id='+cuId+'&contact_id='+contactId,
        postFunction: function(transport){
        		if (!contactPage)
                	$('contacts').removeChild($('contact_'+contactId))
               	else
               		document.location = '/zv_project/'+(cabinet?cabinet+'_':'')+'cabinet/messages'
        }
    });
}

// добавляем голос
function addVoice(obj,obj_id,from_id,people_id){
    lookup({
        url:'/api/voice.api.php',
        values:'object='+obj+'&object_id='+obj_id+'&from_id='+from_id+'&people_id='+people_id,
        postFunction: function(transport){
                if(transport.responseText){
        		document.getElementById('voice_'+obj_id).innerHTML = transport.responseText;
                }
                document.getElementById('voice_add_'+obj_id).style.display = 'none';
        }
    });
}

// Лента событий
function lookupEvents(type){
    lookup({
        url:'/api/timeline.api.php',
        values:'type='+type,
        postFunction: function(transport){
                if(transport.responseText){
        		document.getElementById('timeline_td').innerHTML = transport.responseText;
                }
        }
    });
}