function cbc(obj,act)
{
	var bgcolor='#3C5CA4';
	
	if (act) obj.className='top_menu_text_over';
	else obj.className='top_menu_text';
	
}

function goSupport(uri)
{
	if (uri!=0)
	document.location=uri;	
}

function smpr()
{
	var mini_mm = document.getElementById('mini_mm');
	var full_mm = document.getElementById('full_mm');
	var mmsmlnk = document.getElementById('mmsmlnk');
	
	if (full_mm.style.display!='block') 
	{
		full_mm.style.display='block';
		mini_mm.style.display='none';
		mmsmlnk.innerHTML = 'скрыть подразделы';
	}
	else 
	{
		full_mm.style.display='none';
		mini_mm.style.display='block';
		mmsmlnk.innerHTML = 'показать подразделы';
	}
}

function go_to(url)
{
	document.location = url;
}

function JumpMenu(id)
{
	var url = document.getElementById('JumpMenu_'+id).value;
	document.location = url;
}

function syncList(){}

syncList.prototype.sync = function()
{
	for (var i=0; i < arguments.length-1; i++)	document.getElementById(arguments[i]).onchange = (function (o,id1,id2){return function(){o._sync(id1,id2);};})(this, arguments[i], arguments[i+1]);
	document.getElementById(arguments[0]).onchange();
}

syncList.prototype._sync = function (firstSelectId, secondSelectId)
{
	var firstSelect = document.getElementById(firstSelectId);
	var secondSelect = document.getElementById(secondSelectId);

	secondSelect.length = 0;
	
	if (firstSelect.length>0)
	{
		var optionData = this.dataList[ firstSelect.options[firstSelect.selectedIndex==-1 ? 0 : firstSelect.selectedIndex].value ];
		for (var key in optionData || null) secondSelect.options[secondSelect.length] = new Option(optionData[key], key);
		
		if (firstSelect.selectedIndex == -1) setTimeout( function(){ firstSelect.options[0].selected = true;}, 1 );
		if (secondSelect.length>0) setTimeout( function(){ secondSelect.options[0].selected = true;}, 1 );
	}
	secondSelect.onchange && secondSelect.onchange();
};

function InputPlaceholder (input, value, cssFilled, cssEmpty)
{
	var thisCopy = this
	
	this.Input = input
	this.Value = value
	this.SaveOriginal = (input.value == value)
	this.CssFilled = cssFilled
	this.CssEmpty = cssEmpty

	this.setupEvent (this.Input, 'focus', function() {return thisCopy.onFocus()})
	this.setupEvent (this.Input, 'blur',  function() {return thisCopy.onBlur()})
	this.setupEvent (this.Input, 'keydown', function() {return thisCopy.onKeyDown()})

	if (input.value == '') this.onBlur();

	return this
}

InputPlaceholder.prototype.setupEvent = function (elem, eventType, handler)
{
	if (elem.attachEvent)
	{
		elem.attachEvent ('on' + eventType, handler)
	}

	if (elem.addEventListener)
	{
		elem.addEventListener (eventType, handler, false)
	}
}

InputPlaceholder.prototype.onFocus = function()
{
	if (!this.SaveOriginal &&  this.Input.value == this.Value)
	{
		this.Input.value = ''
	}
	else
	{
		//this.Input.className = this.cssFilled
	}
}

InputPlaceholder.prototype.onKeyDown = function()
{
	//this.Input.className = this.cssFilled
}

InputPlaceholder.prototype.onBlur = function()
{
	if (this.Input.value == '' || this.Input.value == this.Value)
	{
		this.Input.value = this.Value
		//this.Input.className = this.CssEmpty
	}
	else
	{
		//this.Input.className = this.CssFilled
	}
}

function openWnd(url,wnd_name,width,height,scrollbars){
		
		var stScrollBar = (scrollbars ? 'yes' : 'no');
		
		if (top[wnd_name]!=null && typeof(top[wnd_name])=='object' && !top[wnd_name].closed && top[wnd_name].load_flag==1) {
		if (top[wnd_name].document.location.href!=url) top[wnd_name].document.location.href=url;
				top[wnd_name].focus();
		} else {
				top[wnd_name]=window.open(url,wnd_name,'width='+width+',height='+height+',status=yes,menubar=no,resizable=yes,scrollbars='+stScrollBar+',left='+String((screen.width-width)/2)+',top='+String((screen.height-height)/2));
		}
}

function play_flash(url,flash,img,w,h,bg)
{
	
	/*if ( plugin ) 
	{
		plugin=parseInt(plugin.description.substring(plugin.description.indexOf(".")-1))>=6;
	}
	else */if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
	   && (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0)) {
		document.write('<SCRIPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('plugin=( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash")))\n');
		document.write('</SCRIPT\> \n');
	}

	if ( plugin ) 
	{
		document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="'+w+'" HEIGHT="'+h+'" id="'+flash+'" ALIGN=""><PARAM NAME=movie VALUE="'+flash+'"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE='+bg+'> <EMBED src="'+flash+'" quality=high bgcolor='+bg+'  WIDTH="'+w+'" HEIGHT="'+h+'" NAME="'+flash+'" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
	} 
	else if (!(navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.indexOf("2.")>=0) && img>0)
	{
		document.write('<a href="'+url+'"><img src="'+img+'" width="'+w+'" height="'+h+'" border="0"></a>');
	}
} 

function cm(id, action)
{
	var mc = document.getElementById('mc_'+id);
	var mcl = document.getElementById('mcl_'+id);
	if (action) 
	{	
		//mc.className = 'mc_box_over';
		mcl.style.color='#2166AB';
	}
	else 
	{
		//mc.className = 'mc_box';
		mcl.style.color='#000000';
	}
}

function open_search_box(bID) 
{
	switch (bID) 
	{
		case 1: bID_1 = 2; bID_2 = 3; bID_3 = 4; break;
		case 2: bID_1 = 1; bID_2 = 3; bID_3 = 4; break;
		case 3: bID_1 = 1; bID_2 = 2; bID_3 = 4; break;
		case 4: bID_1 = 1; bID_2 = 2; bID_3 = 3; break;
	}
		
	var box = document.getElementById('search_box_'+bID);
	var box2 = document.getElementById('search_box_'+bID_1);
	var box3 = document.getElementById('search_box_'+bID_2);
	var box4 = document.getElementById('search_box_'+bID_3);
	
	var lid = document.getElementById('slid_'+bID);
	var lid_2 = document.getElementById('slid_'+bID_1);
	var lid_3 = document.getElementById('slid_'+bID_2);
	var lid_4 = document.getElementById('slid_'+bID_3);
	
	if (box2)
	box2.className = 'search_box_inactive';
	if (box3)
	box3.className = 'search_box_inactive';
	if (box4)
	box4.className = 'search_box_inactive';
	
	if (lid_2)
	lid_2.className = 'search_navi_link';
	if (lid_3)
	lid_3.className = 'search_navi_link';
	if (lid_4)
	lid_4.className = 'search_navi_link';
	
	box.className = 'search_box_active';
	lid.className = 'search_navi_link_inactive';
	lid.blur();	
}