function showlist(id,what)
{
	var changer=id+what;
	var src=document.getElementById(id+"list");
	var linksrc=document.getElementById(id);
	
	if(what=="show")
	{
		src.style.display="inline";
		linksrc.title="hide";
	}
	else
	{
		src.style.display="none";
		linksrc.title="show";
	}
	return false;
}

function checkdigit(id)
{
	var checkpole=document.getElementById(id).value;
	
	var noletters=String(checkpole).replace(/[^0-9]/,"")
	
	document.getElementById(id).value=noletters;
}

function addLoadEvent(func) 
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function') 
	{
		window.onload = func;
	}
	else
	{
		window.onload = function() 
		{
			if (oldonload) 
			{
				oldonload();
			}
			func();
		}
	}
}

function show(what,where,id) 
{
    var type=document.getElementById(what);
	type.style.display="inline";

    var head = document.getElementsByTagName('head').item(0);
    var scriptTag = document.getElementById('loadScript');
    if(scriptTag) head.removeChild(scriptTag);
    script = document.createElement('script');
    script.src =  "/js/select.php?switch="+what+"&"+what+"="+where+"&is_send=1&imotid="+id;
	//if(what=="rayon") document.write(script.src);
    script.type = 'text/javascript';
    script.id = 'loadScript';
	head.appendChild(script);
  return false;
}

function swappanels(which,what)
{
	var container=document.getElementById(which);
	var switcher=container.getElementsByTagName("p");
	
	for(i=0;i<(switcher.length);i++)
	{
		var test=switcher[i].id;
		
		var switchpicz=switcher[i].id+"pic";
		
		if(test==what)
		{
			document.getElementById(switchpicz).style.display="block";
		}
		else
			document.getElementById(switchpicz).style.display="none";
	}
}