function InsertPng(Src, w, h) {
	if(!navigator.appMinorVersion) document.write("<img border=0 width='"+w+"' height='"+h+"' src='"+Src+"'/>");
		else document.write("<img width='"+w+"' height='"+h+"' border=0 src='/img/spacer.gif' style=\"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader (src='"+Src+"');\"/>");
}
function InsertSpacer(h) {
	if(!window.XMLHttpRequest) document.write("<img border=0 src='/img/spacer.gif' width='1' height='"+h+"' align='left'/>");
}
function loadCateg(id) {
	var o = document.getElementById('categ_'+id);
	if (o.getAttribute('_st') && o.getAttribute('_bt')) {
		o.innerHTML = o.getAttribute(o.getAttribute('_mode')!='opened' ? '_bt' : '_st');
		o.setAttribute('_mode', o.getAttribute('_mode')!='opened' ? 'opened' : 'closed');
	} else {
		o.setAttribute('_st', o.innerHTML);
		o.innerHTML = '';
		var img = document.createElement('img');
		img.setAttribute('src', '/img/asyncload.gif');
		o.appendChild(img);
		eval("var fn = function(text) {document.getElementById('categ_"+id+"').setAttribute('_bt', text); loadCateg('"+id+"');}");
		loader.SendRequest('/tehn/categ?id='+id, '', 'GET', fn);
	}
}
function loadListNews(page) {
	var o = document.getElementById('ajnews');
	o.innerHTML = '';
	var img = document.createElement('img');
	img.setAttribute('src', '/img/asyncload.gif');
	o.appendChild(img);
	eval("var fn = function(text) {document.getElementById('ajnews').innerHTML = text;}");
	loader.SendRequest('/tehn/ajnews/page/'+page, '', 'GET', fn);
}
function loadNew(id) {
	var o = document.getElementById('onenew');
	//o.innerHTML = '';
	//var o2 = document.getElementById('oneasdadasnew');
	var img = document.createElement('img');
	img.setAttribute('src', '/img/asyncload.gif');
	o.appendChild(img);
	eval("var fn = function(text) {document.getElementById('onenew').innerHTML = text;}");
	loader.SendRequest('/tehn/onenew?id='+id, '', 'GET', fn);
}
/*function loadCateg(id) {
	Load ('categ_'+id, '/tehn/categ?id='+id);
}
function loadnewscont(o, id) {
	var img = document.createElement('img');
	img.setAttribute('src', '/img/asyncload.gif');
	o.parentNode.appendChild(img);
	eval("var fn = function(text) {document.getElementById('cat"+id+"').innerHTML = text;}");
	loader.SendRequest('/tech/novosti/podrobno?id='+id, '', 'GET', fn);
}*/
function scrollTo(id) {
     var o = document.getElementById(id);
     window.scroll_end = o.offsetTop;
     while (o = o.offsetParent) window.scroll_end += o.offsetTop;
     window.scroll_start = document.documentElement.scrollTop + document.body.scrollTop;
     window.scroll_sign = (window.scroll_end > window.scroll_start) ? 1 : -1;
     window.scroll_timer = window.setInterval(scrollNext, 1);
}

function scrollNext() {
     var p =  parseInt( (document.documentElement.scrollTop + document.body.scrollTop - window.scroll_start) / (window.scroll_end - window.scroll_start) * 11 );
    var old = document.documentElement.scrollTop + document.body.scrollTop;
     switch (p) {
          case 0: window.scrollBy(0, 15 * window.scroll_sign); break; 
          case 1: window.scrollBy(0, 30 * window.scroll_sign); break;
          case 2: window.scrollBy(0, 50 * window.scroll_sign); break;
          case 3: window.scrollBy(0, 70 * window.scroll_sign); break;
          case 4: window.scrollBy(0, 90 * window.scroll_sign); break;
          case 5: window.scrollBy(0, 100 * window.scroll_sign); break;
          case 6: window.scrollBy(0, 90 * window.scroll_sign); break;
          case 7: window.scrollBy(0, 70 * window.scroll_sign); break;
          case 8: window.scrollBy(0, 50 * window.scroll_sign); break;
          case 9: window.scrollBy(0, 30 * window.scroll_sign); break;
          case 10: window.scrollBy(0, 15 * window.scroll_sign); break;
          default: window.clearInterval(window.scroll_timer); break;
     }
	 if (document.documentElement.scrollTop == old) window.clearInterval(window.scroll_timer);
}
function InsertFlashObj(sId, sSrc, sWidth, sHeight, bReturn) {
     var result = "<object id='"+sId+"' width='"+sWidth+"' height='"+sHeight+"' align='middle' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='"+sSrc+"' /><param name='quality' value='high' /><param name='wmode' value='transparent'/><embed src='"+sSrc+"' width='"+sWidth+"' height='"+sHeight+"' name='"+sId+"' align='middle' quality='high' wmode='transparent' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
     if (bReturn) return result;
     document.write(result);
}

