//monitoring_update();

function getXmlHttp(){
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}

function comment(id) {
  obj = d.getElementById(id);
  if(obj.style.display == 'block') obj.style.display = 'none';
  else obj.style.display = 'block';
}

/*
function rating(module) {
	d.getElementById('rating').innerHTML = '<img border="0" src="http://cs.zoner.ru/images/ajax-loader.gif">';
	setTimeout("rating_save('" + module + "')", 1000);
}
*/

function rating(form) {
	var obj  = document.ratingForm.rate; 
	d.getElementById('ratingForm').style.display = 'none';
	d.getElementById('rating').innerHTML = '<img border="0" src="http://cs.zoner.ru/images/ajax-loader.gif">';
	setTimeout("rating_save('"+obj.options[obj.selectedIndex].text+"')", 1000);
	obj.disabled = true;
	//document.getElementsByName("InventoryType")[0].value
	//for (var i = 0; i < form.rate.options.length; i++) {
    //    if (form.rate.options[i].selected){
			//rating_save(form.rate.options[i].value);
	//		setTimeout("rating_save('"+form.rate.options[i].value+"')", 1000);
          //alert("You have selected " + form.rate.options[i].value);
     //   }
   //   }
}

function downloads_linkerror(lid) {
	var xmlhttp = getXmlHttp();
	var params = 'lid=' + lid + '&q=' + Math.random();
	xmlhttp.open("POST", 'http://cs.zoner.ru/functions/downloads_linkerror.php', true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			if(xmlhttp.status == 200) {
				alert(xmlhttp.responseText);
			}
		}
	};
	xmlhttp.send(params);
}

function message_send() {
	document.getElementById("button").innerHTML = '<img border="0" src="http://cs.zoner.ru/images/ajax-loader.gif">';
	var xmlhttp = getXmlHttp();
	var params = 'poluchatel=' + encodeURIComponent(d.getElementById("poluchatel").value) + '&zagolovok=' + encodeURIComponent(d.getElementById("zagolovok").value) + '&soobshenie=' + encodeURIComponent(d.getElementById("soobshenie").value) + '&q=' + Math.random();
	xmlhttp.open("POST", 'http://cs.zoner.ru/functions/message_save.php', true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			if(xmlhttp.status == 200) {
				//alert(xmlhttp.responseText);
				document.getElementById("button").innerHTML = xmlhttp.responseText;
			}
		}
	};
	xmlhttp.send(params);
}

function rating_save(rate) {
	//d.getElementById('rating').innerHTML = rate;
	var xmlhttp = getXmlHttp();
	var params = 'fid=' + encodeURIComponent(d.getElementById("fid").value) + '&userid=' + encodeURIComponent(d.getElementById("userid").value) + '&rate=' + rate + '&module=' + encodeURIComponent(d.getElementById("module").value) + '&q=' + Math.random();
	xmlhttp.open("POST", 'http://cs.zoner.ru/functions/rating_save.php', true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			if(xmlhttp.status == 200) {
				//alert(xmlhttp.responseText);
				d.getElementById('rating').innerHTML = xmlhttp.responseText;
				//setTimeout("profile_button()", 3000);
			}
		}
	};
	xmlhttp.send(params);
}

function profile_save() {
	d.getElementById('account_submit').innerHTML = '<img border="0" src="http://cs.zoner.ru/images/ajax-loader.gif">';
	setTimeout("profile_save_go()", 1000);
}
function profile_save_go() {
	var xmlhttp = getXmlHttp();
	var params = 'name=' + encodeURIComponent(d.getElementById("prName").value) + '&country=' + encodeURIComponent(d.getElementById("prCountry").value) + '&website=' + encodeURIComponent(d.getElementById("prSite").value) + '&icq=' + encodeURIComponent(d.getElementById("prICQ").value) + '&from=' + encodeURIComponent(d.getElementById("prCity").value) + '&id=' + encodeURIComponent(d.getElementById("account_id").value) + '&q=' + Math.random();
	xmlhttp.open("POST", 'http://cs.zoner.ru/functions/account_save.php', true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			if(xmlhttp.status == 200) {
				//alert(xmlhttp.responseText);
				d.getElementById('account_submit').innerHTML = xmlhttp.responseText;
				setTimeout("profile_button()", 3000);
			}
		}
	};
	xmlhttp.send(params);
}
function profile_button() {
	var button = '<input type="button" onclick="javascript:profile_save()" value="Сохранить">';
	d.getElementById('account_submit').innerHTML = button;
}

function profile_save_dop() {
	d.getElementById('account_submit_dop').innerHTML = '<img border="0" src="http://cs.zoner.ru/images/ajax-loader.gif">';
	setTimeout("profile_save_dop_go()", 1000);
}
function profile_save_dop_go() {
	var xmlhttp = getXmlHttp();
	var params = 'mouse=' + encodeURIComponent(d.getElementById("prMouse").value) + '&cover=' + encodeURIComponent(d.getElementById("prCover").value) + '&keyboard=' + encodeURIComponent(d.getElementById("prKeyboard").value) + '&headphone=' + encodeURIComponent(d.getElementById("prHeadphone").value) + '&video=' + encodeURIComponent(d.getElementById("prVideo").value) + '&sound=' + encodeURIComponent(d.getElementById("prSound").value) + '&mother=' + encodeURIComponent(d.getElementById("prMother").value) + '&monitor=' + encodeURIComponent(d.getElementById("prMonitor").value) + '&cpu=' + encodeURIComponent(d.getElementById("prCPU").value) + '&id=' + encodeURIComponent(d.getElementById("account_id").value) + '&q=' + Math.random();
	xmlhttp.open("POST", 'http://cs.zoner.ru/functions/account_save_dop.php', true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			if(xmlhttp.status == 200) {
				//alert(xmlhttp.responseText);
				d.getElementById('account_submit_dop').innerHTML = xmlhttp.responseText;
				setTimeout("profile_button_dop()", 3000);
			}
		}
	};
	xmlhttp.send(params);
}
function profile_button_dop() {
	var button = '<input type="button" onclick="javascript:profile_save_dop()" value="Сохранить">';
	d.getElementById('account_submit_dop').innerHTML = button;
}

function getSelection (obj) { 
	var data = ['', '', '']; 
	if (document.selection) { 
		sel = document.selection.createRange(); 
		data[1] = sel.text; 
		} else { 
		var text = obj.value; 
		var start = obj.selectionStart; 
		var end = obj.selectionEnd; 
		data[0] = text.substring (0, start); 
		data[1] = text.substring (start, end); 
		data[2] = text.substring (end, text.length); 
	} 
	return data; 
} 

function bbcode (input, value) { 
	//var input = document.q.comment; 
	var text = getSelection (input); 
	if (text[1].length > 0) { 
		output = text[1]; 
		output = '[' + value + ']' + text[1] + '[/' + value + ']'; 
		if (document.selection) 
			sel.text = output; 
		else 
			input.value = text[0] + output + text[2]; 
	} else { 
		input.value += '[' + value + '][/' + value + ']'; 
	} 
	input.focus(); 
}

function newwindow(url) 
{
  myWin=open("http://cs.zoner.ru/"+url, "displayWindow", 
       "width=400,height=300,status=no,toolbar=no,menubar=no");
}

function getQuest() {
	var xmlhttp = getXmlHttp();
	xmlhttp.open("GET", 'http://cs.zoner.ru/getquest.php?q='+Math.random(), true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			if(xmlhttp.status == 200) {
				document.getElementById('gameField').innerHTML = xmlhttp.responseText;
			}
		}
	};
	xmlhttp.send();
}

function monitoring_update() {
	var xmlhttp = getXmlHttp();
	xmlhttp.open("GET", 'http://www.csse.ru/monitor.php?q='+Math.random(), true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			if(xmlhttp.status == 200) {
				//alert('Update done');
			}
		}
	};
	xmlhttp.send();
}

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;
}

function vote_down(id) {
	var ans = 0;
	if(getRandomInt(0,2)==0) {
		rndNum1 = getRandomInt(0,100);
		rndNum2 = getRandomInt(0,100);
		var otvet=prompt('Сколько будет '+rndNum1+'+'+rndNum2+'?');
		if(rndNum1+rndNum2 == otvet) ans = 1;
	} else if(getRandomInt(0,2)==1) {
		rndNum1 = getRandomInt(50,100);
		rndNum2 = getRandomInt(0,50);
		var otvet=prompt('Сколько будет '+rndNum1+'-'+rndNum2+'?');
		if(rndNum1-rndNum2 == otvet) ans = 1;
	} else {
		rndNum1 = getRandomInt(0,10);
		rndNum2 = getRandomInt(0,10);
		var otvet=prompt('Сколько будет '+rndNum1+'*'+rndNum2+'?');
		if(rndNum1*rndNum2 == otvet) ans = 1;
	}
		
	if(ans == 1) {
		d.getElementById("do_vote").innerHTML = '<iframe src="http://www.csse.ru/vote.php?id=' + id + '&act=down&q=' + Math.random() + '"></iframe>';
		obj = d.getElementById(id);
		obj.innerHTML = Math.round(obj.innerHTML) - 1;
	} else {
		alert('Вы ошиблись');
	}
}

function vote_up(id) {
	var ans = 0;
	if(getRandomInt(0,2)==0) {
		rndNum1 = getRandomInt(0,100);
		rndNum2 = getRandomInt(0,100);
		var otvet=prompt('Сколько будет '+rndNum1+'+'+rndNum2+'?');
		if(rndNum1+rndNum2 == otvet) ans = 1;
	} else if(getRandomInt(0,2)==1) {
		rndNum1 = getRandomInt(50,100);
		rndNum2 = getRandomInt(0,50);
		var otvet=prompt('Сколько будет '+rndNum1+'-'+rndNum2+'?');
		if(rndNum1-rndNum2 == otvet) ans = 1;
	} else {
		rndNum1 = getRandomInt(0,10);
		rndNum2 = getRandomInt(0,10);
		var otvet=prompt('Сколько будет '+rndNum1+'*'+rndNum2+'?');
		if(rndNum1*rndNum2 == otvet) ans = 1;
	}
		
	if(ans == 1) {
		d.getElementById("do_vote").innerHTML = '<iframe src="http://www.csse.ru/vote.php?id=' + id + '&act=up&q=' + Math.random() + '"></iframe>';
		obj = d.getElementById(id);
		obj.innerHTML = Math.round(obj.innerHTML) + 1;
	} else {
		alert('Вы ошиблись');
	}
}

function getRandomInt(min, max)
{
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

function changeSize(image)
{
	var i_width;
	var i_height;
	i_width = img.width;
	i_height = img.height;
	if(i_width > 460)
	{
		i_height = Math.round(460*i_height/i_width);
		i_width = 460;
	}
	image.width = i_width;
	image.height = i_height;
	return image;
}

function setWidth(id)
{
	alert(id);
	var allImg = document.getElementById(id).getElementsByTagName('img');
	for (var i=0; i<allImg.length; i++)
	{
		if (allImg[i].widht > 190)
		{
			allImg[i].height = allImg[i].height*(190/allImg[i].width);
			allImg[i].width = 190;
		}
	}
}


function createXMLHttp() {
    if(typeof XMLHttpRequest != "undefined") { // для браузеров аля Mozilla
        return new XMLHttpRequest();
    } else if(window.ActiveXObject) { // для Internet Explorer (all versions)
        var aVersions = ["MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0",
        "MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp",
        "Microsoft.XMLHttp"
        ];
        for (var i = 0; i < aVersions.length; i++) {
            try { //
              var oXmlHttp = new ActiveXObject(aVersions[i]);

              return oXmlHttp;
            } catch (oError) {

            }
        }
        throw new Error("Невозможно создать объект XMLHttp.");
    }
}
      
      /* Очень важная функция, обратите на неё внимание.
        Формирует строку запроса "name1=value1&name2=value2&name3...".
        Принимает один аргумент - ссылку на форму.
      */
        
function getRequestBody(oForm) {
    var aParams = new Array();
    for(var i = 0; i < oForm.elements.length; i++) {
        var sParam = encodeURIComponent(oForm.elements[i].name);
        sParam += "=";
        sParam += encodeURIComponent(oForm.elements[i].value);
        aParams.push(sParam);
    }
    return aParams.join("&");
}
      
      
      /* В этой ф-ции мы создаём объект XmlHttp, формируем запрос, инициализируем перехватчик состояний
        onreadystatechange, и посылаем наш запрос.
        
        Обратите внимание, что во втором аргументе метода open(..) мы передаём
        ссылку на oForm.action, это сделано как из соображений безопасности, так и ради
        того что-бы сценарий можно-было бы использовать для работы с несколькими страницами.
        
        Так-же, стоит отметить факт отправки дополнительного заголовка: "appilaction/x-www-form-urlencoded"
        Большинство языков (в том числе и PHP), требуют этого, для корректного выполнения
        синтаксического анализа пришедших данных. Этот момент очень важен.
        
      */
 
function editFile(form) {
    var oForm = form;
    var sBody = getRequestBody(oForm);
    var oXmlHttp = createXMLHttp();
    oXmlHttp.open("POST",oForm.action, true);
    oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        
    oXmlHttp.onreadystatechange = function() {
        if(oXmlHttp.readyState == 4) {
			if(oXmlHttp.status == 200) {
              alert(oXmlHttp.responseText);
			  window.document.location = document.location;
            }
          }
        };
        
        oXmlHttp.send(sBody);
	oForm.reset();
}
 
function sendRequest() {
	if(document.forms[0] != document.forms['form1']) {
		var oForm = document.forms[0];
	} else if(document.forms[1] != document.forms['form2']) {
		var oForm = document.forms[1];
	} else {
		var oForm = document.forms[2];
	}
    var sBody = getRequestBody(oForm);
    var oXmlHttp = createXMLHttp();
    oXmlHttp.open("POST",oForm.action, true);
    oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        
    oXmlHttp.onreadystatechange = function() {
        if(oXmlHttp.readyState == 4) {
			if(oXmlHttp.status == 200) {
				saveResult(oXmlHttp.responseText);
            } else {
              saveResult("Ошибка: " + oXmlHttp.statusText);
            }
          }
        };
        
        oXmlHttp.send(sBody);
	oForm.reset();
}

function addAdminPost(form) {
	var oForm = form;
	var sBody = getRequestBody(oForm);
	var oXmlHttp = createXMLHttp();
    oXmlHttp.open("POST",oForm.action, true);
    oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        
    oXmlHttp.onreadystatechange = function() {
        if(oXmlHttp.readyState == 4) {
			if(oXmlHttp.status == 200) {
				if(oXmlHttp.responseText == 'error')
				{
					alert('Ошибка: Заполнены не все поля');
				}
				else
				{
					alert(oXmlHttp.responseText);
					oForm.reset();
					if(window.location.hash == '#files-add') { // Загрузка файла
						document.getElementById('screens').style.borderTop = '0px dotted #5f5f5f';
						document.getElementById('screens').style.paddingTop = '0px';
						document.getElementById('screens').innerHTML = '';
						document.getElementById('screens2').innerHTML = '';
						uploadedScreens = 0;
					}
				}
            } else {
              saveResult("Ошибка: " + oXmlHttp.statusText);
            }
          }
        };
        oXmlHttp.send(sBody);
}

function addAdminEdit(form) {
	var oForm = form;
	var sBody = getRequestBody(oForm);
	var oXmlHttp = createXMLHttp();
    oXmlHttp.open("POST",oForm.action, true);
    oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        
    oXmlHttp.onreadystatechange = function() {
        if(oXmlHttp.readyState == 4) {
			if(oXmlHttp.status == 200) {
				if(oXmlHttp.responseText == 'error')
				{
					alert('Ошибка: Заполнены не все поля');
				}
				else
				{
					alert(oXmlHttp.responseText);
					getQuery('../../functions/admin-news-edit.php','admin');
					//oForm.reset();
				}
            } else {
              saveResult("Ошибка: " + oXmlHttp.statusText);
            }
          }
        };
        oXmlHttp.send(sBody);
}
      
function saveResult(sText) {
    var sElem = document.getElementById("divStatus");
    //sElem.innerHTML = sText;
	getQuery(sText);
}

function getQuery(url,id_result) {
	var xmlhttp = getXmlHttp();
	xmlhttp.open("GET", url+'?q='+Math.random(), true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {
			if(xmlhttp.status == 200) {
				if(id_result) {
					document.getElementById(id_result).innerHTML = xmlhttp.responseText;
				} else {
					document.getElementById('getAnswer').innerHTML = xmlhttp.responseText;
				}
			}
		}
	};
	xmlhttp.send();
}

function doDelete(url,return_result) {
	if (confirm("Вы подтверждаете удаление?")) {
		var xmlhttp = getXmlHttp();
		xmlhttp.open("GET", url+'?q='+Math.random(), true);
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4) {
				if(xmlhttp.status == 200) {
					if(xmlhttp.responseText.substr(0, 18) == 'http://cs.zoner.ru') {
						alert("Удалено");
						window.location.href = xmlhttp.responseText;
					} else if(return_result != '') {
						alert("Удалено");
						getQuery(xmlhttp.responseText, 'admin');
					} else {
						getQuery(xmlhttp.responseText);
					}
				}
			}
		};
		xmlhttp.send();
	}
}

function doEdit(id) {
	var str = document.getElementById('message-'+id).innerHTML;
	str = str.replace(/\n/g, "");
	str = str.replace(/\<br>/g, "\n");
	str = str.replace(/\<a href="/g, "[url=");
	str = str.replace(/\" target="_blank">/g, "]");
	str = str.replace(/\<\/a>/g, "[/url]");
	str = str.replace(/\<b>/g, "[b]");
	str = str.replace(/\<\/b>/g, "[/b]");
	str = str.replace(/\<u>/g, "[u]");
	str = str.replace(/\<\/u>/g, "[/u]");
	str = str.replace(/\<i>/g, "[i]");
	str = str.replace(/\<\/i>/g, "[/i]");
	str = str.replace(/\<img src="/g, "[img]");
	str = str.replace(/\">/g, "[/img]");
	//alert(str);
	document.getElementById('panel-'+id).style.visibility = 'hidden';
	//document.getElementById('message-add').disabled = true;
	document.getElementById('message-add').style.display = 'none';
	document.getElementById('message-'+id).innerHTML = '<form action="http://cs.zoner.ru/functions/forums-post-edit.php" method="post" OnSubmit="sendRequest(); return false"><div style="text-align: left"><img class="redaktor" src="http://cs.zoner.ru/images/bbtags/b.gif" onclick="bbcode(getElementById(\'textarea\'), \'b\');">&nbsp;<img class="redaktor" src="http://cs.zoner.ru/images/bbtags/i.gif" onclick="bbcode(getElementById(\'textarea\'), \'i\');">&nbsp;<img class="redaktor" src="http://cs.zoner.ru/images/bbtags/u.gif" onclick="bbcode(getElementById(\'textarea\'), \'u\');">&nbsp;<img class="redaktor" src="http://cs.zoner.ru/images/bbtags/url.gif" onclick="bbcode(getElementById(\'textarea\'), \'url\');">&nbsp;<img class="redaktor" src="http://cs.zoner.ru/images/bbtags/img.gif" onclick="bbcode(getElementById(\'textarea\'), \'img\');"></div><textarea id="textarea" name="comment_post" style="width:100%; height: 150px">'+str+'</textarea><input type="hidden" name="aid" value="'+id+'"><br><center><input onclick="document.getElementById(\'message-'+id+'\').style.display=\'none\';document.getElementById(\'message-add\').style.display=\'block\'" type="submit" value="Редактировать"></center></form><div id="divStatus"></div>';
}

function startUpload(){
	document.getElementById('upload_process').style.display = 'block';
	document.getElementById('upload_form').style.display = 'none';
	return true;
}

function stopUpload(success, id_result){
	if(success == 'Недопустимый формат изображения') {
		alert('Недопустимый формат изображения');
	} else {
		getQuery(success,id_result);
	}
	//document.getElementById('f1_upload_process').style.display = 'hidden'; 
	//document.getElementById('upload_image').value = 'upload/'+result;
	document.forms['form2'].reset();
	document.getElementById('add-screenshot-button').style.display	= 'block';  
	document.getElementById('upload_block').style.display	= 'none';
	document.getElementById('upload_form').style.display = 'block';
	document.getElementById('upload_process').style.display	= 'none';
	return true;   
}

function fileUploadStart(form){
	if(form.name == 'form2') {
		document.getElementById('upload_process2').style.display = 'block';
	} else {
		document.getElementById('upload_process').style.display = 'block';
		document.getElementById('result').style.display	= 'none';
	}
	return true;
}

var uploadedScreens = 0;
function fileUploadStop(success, filesize) {
	if(success == 'Недопустимый формат изображения') {
		alert('Недопустимый формат изображения');
		document.getElementById('upload_process').style.display	= 'none';
	} else {
		if(!filesize) { 
			if(window.location.hash == '#files-add') { // Загрузка скриншотов к файлам
				uploadedScreens = uploadedScreens + 1;
				document.forms['form2'].reset();
				document.getElementById('upload_process2').style.display = 'none';
				document.getElementById('screens').style.borderTop = '1px dotted #5f5f5f';
				document.getElementById('screens').style.paddingTop = '10px';
				document.getElementById('screens').innerHTML = document.getElementById('screens').innerHTML+'<img src="http://cs.zoner.ru/modules/Gallery/upload/trumbs/'+success+'">&nbsp;';
				document.getElementById('screens2').innerHTML = document.getElementById('screens2').innerHTML+'<input type="text" name="scr'+uploadedScreens+'" value="'+success+'"><br />';
			} else if(window.location.hash == '#news-add') { // Загрузка изображение к новости
				document.getElementById('result').style.display	= 'block';
				document.getElementById('upload_process').style.display	= 'none';
				document.getElementById('result_link').value = 'http://cs.zoner.ru/upload/news/'+success;
			}
		} else { 
			document.forms['form1'].reset();
			if(window.location.hash == '#files-add') { // Загрузка файла
				document.getElementById('upload_process').style.display	= 'none';
				document.getElementById('link').value = 'http://cs.zoner.ru/upload/files/'+success;
				document.getElementById('size').value = filesize;
				alert('Файл загружен');
			}
		}
	}
	return true;
}