function LETSGO(num)
{
	flag=1;
	if (document.ADDRESS.Month.options[document.ADDRESS.Month.selectedIndex].value>0)
	{
		if (document.ADDRESS.Year.options[document.ADDRESS.Year.selectedIndex].value==0)
		{	
			flag=0;
			alert("Необходимо выбрать год")
		}
	}
	if (document.ADDRESS.Month2.options[document.ADDRESS.Month2.selectedIndex].value>0)
	{
		if (document.ADDRESS.Year2.options[document.ADDRESS.Year2.selectedIndex].value==0)
		{	
			flag=0;
			alert("Необходимо выбрать год")
		}
	}
	if (flag)
	{
		if (num>0)
		{
			document.ADDRESS.curpage.value=num;	
			document.ADDRESS.submit();
		}
		else
		{
		    http.open('get', '/misc/search.php?city='+document.ADDRESS.city.options[document.ADDRESS.city.selectedIndex].value+'&type='+document.ADDRESS.type.options[document.ADDRESS.type.selectedIndex].value+'&Month='+document.all.Month.value+'&Month2='+document.all.Month2.value+'&Year='+document.all.Year.value+'&Year2='+document.all.Year2.value+'&code='+document.all.code.value+'&street='+document.all.street.value);
    		http.onreadystatechange = handleResponse;
	    	http.send(null);
		}
	}
	
}
function thisMovie(movieName) 
{
	if (navigator.appName.indexOf("Microsoft") != -1) return document.all.autobord_map_v0;
	else return document[movieName];
}
/////////////////////////////////////////////////////////////////////
function createRequestObject() 
{
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer") ro = new ActiveXObject("Microsoft.XMLHTTP");
	else ro = new XMLHttpRequest();
    return ro;
}

var http = createRequestObject();

function handleResponse()
{
    if(http.readyState == 4)
	{
		if (glob_unic_id==0)
		{
    	    var response = http.responseText;
        	var update = new Array();
	        if(response.indexOf('|' != -1)) 
			{
        	    update = response.split('|');
				thisMovie("autobord_map_v0").bordSearch(update[0]);
	        } 
		}
    }
}

function ONE(id)
{
	WIN=window.open("oneaddress.php?id="+id,"One", "width=990,height=700,left=0,top=0,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes")
}
function bordClick(id)
{
	WIN=window.open("oneaddress.php?id="+id,"One", "width=990,height=700,left=0,top=0,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes")
}
///////////////////////////////////////////////////////////////
var COLORS = new Array; var glob_unic_id=0;
function COLOR(address_id, numcol, unic_id, title)
{
//	alert(document.getElementById("m"+address_id+numcol).style.backgroundColor);
	if (document.getElementById("m"+unic_id).style.backgroundColor=="rgb(255, 156, 0)" || document.getElementById("m"+address_id+numcol).style.backgroundColor=="#ff9c00")
	{
		if (COLORS[unic_id]==1)
		document.getElementById("m"+unic_id).style.backgroundColor="#fff600";
		else if (COLORS[unic_id]==2)
		document.getElementById("m"+unic_id).style.backgroundColor="#f80007";
		else
		document.getElementById("m"+unic_id).style.backgroundColor="#CCCCCC";
		COLORS[unic_id]=0;
	    http.open('get', '/misc/order.php?id='+unic_id+'&address_id='+address_id+'&numcol='+numcol+'&title='+title+'&type=2');
	}
	else
	{
		if (document.getElementById("m"+unic_id).style.backgroundColor=="rgb(255, 246, 0)" || document.getElementById("m"+address_id+numcol).style.backgroundColor=="#fff600")
		COLORS[unic_id]=1;
		if (document.getElementById("m"+unic_id).style.backgroundColor=="rgb(248, 0, 7)" || document.getElementById("m"+address_id+numcol).style.backgroundColor=="#f80007")
		COLORS[unic_id]=2;
		document.getElementById("m"+unic_id).style.backgroundColor="#ff9c00";
	    http.open('get', '/misc/order.php?id='+unic_id+'&address_id='+address_id+'&type=1&numcol='+numcol+'&title='+title);
	}
	glob_unic_id=unic_id;
	http.onreadystatechange = handleResponse;
   	http.send(null);
}
function ORDER()
{
//	document.all.COLORS[].value=COLORS;
	document.ADDRESS.action='order.php';
	document.ADDRESS.submit();
}


function makeFlashCode (url, id) {
var flashCode = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '+
'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" '+
'id="'+id+'" '+
'width="722" height="510" >'+
'<param name="movie" value="/flash/autobord_map_v0.swf?progress_url='+url+'" />'+
'<embed src="/flash/autobord_map_v0.swf?progress_url='+url+'" '+
'width="722" height="510" '+
'type="application/x-shockwave-flash" '+
'name="'+id+'" '+
'pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
'</object>';

	return flashCode;
}

function drowFlash (url, id)
{
	document.write(makeFlashCode(url, id));
}