isDOM=document.getElementById;
isMSIE=document.all && document.all.item;
isNetscape4=document.layers;
isOpera=window.opera;
isOpera5=isOpera && isDOM;
isMSIE5=isDOM && isMSIE && !isOpera;
isMozilla=isNetscape6=isDOM && !isMSIE && !isOpera;

function getLayer(layerName){
	if(isDOM){ return document.getElementById(layerName); }
	if(isMSIE){ return document.all[layerName]; }
	if(isNetscape4){ return eval('document.layers[layerName]'); }
	return false;
}

var http=ajaxRequestObject();

function ajaxRequestObject() {
	var xmlhttp;
	try { xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); }
	catch(e) {
		try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
		catch(f) { xmlhttp=null; }
	}
	if(!xmlhttp&&typeof XMLHttpRequest!="undefined") xmlhttp=new XMLHttpRequest();
	return  xmlhttp;
}

function sendRequest(sq) {
	try{
		http.open('POST','http://www.gt-bratsk.ru/brauto/dir/');
		http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		http.onreadystatechange=handleResponse;
		http.send(sq);
	}
	catch(e){}
	finally{}
}

function handleResponse() {
	try{
		if((http.readyState==4) && (http.status==200)) {
			out='';
			var response=http.responseXML.documentElement;
			var elm=response.getElementsByTagName('item');
			for (var i=0;i<elm.length;i++) {
				out+='<div><a href="/brauto/dir/'+elm[i].getAttribute('id')+'.html"><strong>'+elm[i].getAttribute('name')+'</strong></a><br />'+elm[i].firstChild.nodeValue+'</div>';
			}
			getLayer('dir_block').innerHTML=out;
		}
	}
	catch(e){}
	finally{}
}

function get_firms(fid) {
	if (isMozilla) {
		sendRequest('fid='+fid);
		return false
	}
	return true;
}

icon_p=new Image();
icon_p.src='http://tpl.gt-bratsk.ru/images/p.gif';
icon_m=new Image();
icon_m.src='http://tpl.gt-bratsk.ru/images/m.gif';

function oc(did) {
	if (getLayer('f'+did).className=='hdn') {
		getLayer('f'+did).className='vsb';
		getLayer('i'+did).src=icon_m.src;
	} else {
		getLayer('f'+did).className='hdn';
		getLayer('i'+did).src=icon_p.src;
	}
}

