function $() { return document.getElementById(arguments[0]); }

//if (!getCookie('path')) { document.cookie = 'path = /malls/moscow/tstan;'; }

function addHandler(object, event, handler)
{
	if (object)
	{
		if (typeof(object.addEventListener) != 'undefined')
		{
			object.addEventListener(event, handler, false);
		}
		if (typeof(object.attachEvent) != 'undefined')
		{
			object.attachEvent('on' + event, handler);
		}
	}
}

function buildMenu()
{
	var i,oLink;
	for (i = 0; (oLink = document.getElementsByTagName('a')[i]); i++)
	{
		var link = oLink.getAttribute('linker');
		if (link)
		{
			oLink.setAttribute('href', getCookie('path1') + link);
		}
	}
	if ($('point'))
	{
       		var point = $('point');
		point.setAttribute('href', getCookie('path1') + '/point/index.wbp');
	}
}

function showhide(value)
{
	var d = $(value);
	d.style.display = (d.style.display == 'block') ? 'none' : 'block';
	return;
}

function getPage(value)
{
	document.location.href = value;
	return;
}

function selectList(id)
{
	var i, block;
	if ($('careersText'))
	{
		var texts = $('careersText').childNodes;
		for (i = 0; (block = texts[i]); i++)
		{
			if(block.nodeName == 'DIV')
			{
				block.style.display = 'none';
			}
		}
	}
		var arrows = $('careersList').getElementsByTagName('img');
		for (i = 0; (arrow = arrows[i]); i++)
		{
			arrow.style.visibility = 'hidden';
		}
		$('list_img_'+id).style.visibility = 'visible';
		$('text_'+id).style.display = 'block';
}

		function checkPoll(f, errorID)
		{
			var groups = new Array();
			var i = 0;
			var checked = 0;
			
			$('#'+f+' input[type=radio]').each(function()
			{		
				name = $(this).attr('name');
				nextName = $(this).nextAll('input[type=radio]').eq(0).attr('name');
				
				if (name != nextName) {			
					i++;
					groups[i] = name;			
				}
			});
			
			for(i=0;i<groups.length;i++)
			{		
				check = $('#'+f+' input[name='+groups[i]+']:checked').length;
				if(check > 0) checked++;		
			}	
			
			if (checked == (groups.length - 1)) return true;
			
			
			$('#'+errorID).text('Все вопросы обязательны.')
			$('#'+errorID).show();
			return false;
		}