function clean(A,D,B)
{		
	var C=D||A.previousSibling;
	if(C)
	{
		if(!C.patched&&!B)
		{
			A.onblur=function()
					{if(!A.value)
						{C.style.top=""}
					}
			
		}
		C.patched=true;
		C.style.top="-9999px"
	}
}

function switch_eche(id)
{
	var el=document.getElementById(id);
	if(el)
	{
		if(el.className=="eshe_hidden") 
			el.className="eshe_visible";
		else if(el.className=="eshe_visible") 
			el.className="eshe_hidden";
	}
}
var dontCloseEshe=false;
function onLoadBody()
{
	if(!dontCloseEshe)
	{
		var i=document.getElementById("eshe_links_1");
		try
		{
			i.className="eshe_hidden";
		}
		catch(e){};
		
		var i=document.getElementById("eshe_links_2");
		try
		{
			i.className="eshe_hidden";
		}
		catch(e){};
	}
	dontCloseEshe=false;
}

function show_stat_region(id)
{
	for(var i=0; i<10; i++)
	{
		document.getElementById("region_"+i).style.display=(id==i?"block":"none");
		document.getElementById("head_region_"+i).style.display=(id==i?"block":"none");
		document.getElementById("link_region_"+i).className=(id==i?"selected_link":"notselected_link");
	}
}


function fix_rating(id,val)
{
	document.getElementById('rating_input_'+id).value=val;
	var item=document.getElementById(id);
	var a=item.childNodes;
	for(var i=0; i<a.length; i++)
	{
		a[i].onmouseout=null;
		a[i].onmouseover=null;
		a[i].onclick= function() { return false; };
	}
}

function rating(containerId)
{
	var p, str;
	for(var i=0; i<names_arr.length; i++)
	{
		str='';
		if(!names_arr[i].val)
			str+='<input type="hidden" id="rating_input_'+names_arr[i].id+'" name="r['+names_arr[i].id+']" value="0">';
		str+='<table class="stars_table" style="width:auto;"><tr><td width="75">';
		str+='<span id="'+names_arr[i].id+'" class="rating-points'+(names_arr[i].val?" rating-points-"+names_arr[i].val:"")+'">';
		for(var j=0; j<rating_arr.length; j++)
		{
			p=j+1;
			str+='<a class="r'+p+'" title="'+rating_arr[j]+'" href="#r'+p+'" ';
			if(!names_arr[i].val)
			{
				str+='onmouseover="parentNode.className=\'rating-points rating-points-'+p+
				'\';" onmouseout="parentNode.className=\'rating-points\';" '+
				'onclick="fix_rating(\''+names_arr[i].id+'\','+p+'); return false;"';
			}
			else
			{
				str+='onclick="return false;"';
			}
			str+='></a>';
		}	
		str+='</span></td><td>'+names_arr[i].name+'</td></tr></table>';
		
		document.getElementById(containerId).innerHTML+=str;
	}	
}
function change_display(id)
{
    if(document.getElementById(id).style.display=='none')
        document.getElementById(id).style.display='block';
    else if(document.getElementById(id).style.display=='block')
        document.getElementById(id).style.display='none';
}

function change_select(id)
{
    if(document.getElementById(id).checked==true)
        document.getElementById(id).checked=false;
    else if(document.getElementById(id).checked==false)
        document.getElementById(id).checked=true;
}
function showkarta(el)
{
	el.parentNode.style.display="none"; 
	document.getElementById("hiddenkarta").style.display="block";
}
