// JScript source code
// Set a value and submit form
					function doSetValAndSubmit( sItemName, fItemVal, fCmd )
					{
						var hItem = document.all[ g_arSetItems[sItemName] ];
						if( hItem )
						{
							if( hItem.length )
								hItem(0).value = fItemVal;
							else
								hItem.value = fItemVal;

							doSubmitForm( document.forms['f_mus_search'].sbOK );
						}
					}
					//Функция переключения цвета в блоке
					function hilight()

					{
								var el=getElem(event.srcElement);
								
								
								if (!el) return;
								
								
								var tbl=document.getElementById("tbl");

								var tr0=tbl.rows[0];

								var tr1=tbl.rows[1];

								for (var i=0; i<tr0.cells.length; i++)
								{

											tr0.cells[i].style.backgroundColor="white";
									
											tr0.cells[i].style.borderColor="white";

											tr1.cells[i].style.backgroundColor="#FEE9B2";

											tr1.cells[i].style.borderColor="#545456";

											tr1.cells[i].style.color="black"
								}

								el.style.backgroundColor="#C0113B";
								el.style.color="white"
								
								
								if (el.parentElement.rowIndex==0)
								{

											tr1.cells[el.cellIndex].style.backgroundColor="#C0113B";
											tr0.cells[el.cellIndex].style.backgroundColor="#C0113B";
											tr1.cells[el.cellIndex].style.borderLeftColor="white";
											tr1.cells[el.cellIndex].style.color="white";
											tr1.cells[el.cellIndex].style.borderRightColor="#C0113B";
											tr1.cells[el.cellIndex].style.borderTopColor="#C0113B";
					                       
													if (el.cellIndex>0)
													{                                 
													tr0.cells[el.cellIndex-1].style.borderRightColor="white";
													tr1.cells[el.cellIndex-1].style.borderRightColor="#FEE9B2";
													tr1.cells[el.cellIndex].style.borderTopColor="#C0113B";	 								
													}
											 
								}else
								{                

											tr1.cells[el.cellIndex].style.borderTopColor="#C0113B";
											tr1.cells[el.cellIndex].style.borderRightColor="#C0113B";
											tr0.cells[el.cellIndex].style.backgroundColor="#C0113B";

											if (el.cellIndex>0)
											{                                 

													tr0.cells[el.cellIndex-1].style.borderRightColor="white";
													tr1.cells[el.cellIndex-1].style.borderRightColor="#FEE9B2";
													tr1.cells[el.cellIndex].style.borderTopColor="#C0113B";	
													
											}

								}

					}


					function getElem(el)

					{

								while(el.tagName!="TBODY"){

											if (el.tagName=="TD")

													return el;

											el=el.parentElement;

								}

								return null;

					}
					// Invokes when a user clicked tab
					function doClickTab( nRubric)
					{
						document.forms['f_mus_search'].idr.value = nRubric;
						//alert(document.forms['f_mus_search'].idr.value);
						//alert(document.forms['f_mus_search'].idr.value);
						if(nRubric==50 || nRubric==1)
							document.all.mp3_tbl_alpha.style.visibility='visible'
						else
							document.all.mp3_tbl_alpha.style.visibility='hidden'
						
						if (nRubric==50)
							document.forms['f_mus_search'].mp3_tp.style.visibility='visible'
						else
							document.forms['f_mus_search'].mp3_tp.style.visibility='hidden'
						
						if(nRubric==1)
							document.forms['f_mus_search'].mp3_atp.value=2;
						else
						document.forms['f_mus_search'].mp3_atp.value=1;
						//alert(document.all.mp3_atp.value);
						//showExampleOrCheckBox();
						
					}
					
					// Invokes when doc starts and when a user clicked tab
					function showExampleOrCheckBox()
					{
						
						
						/*var hExtra = document.all['idsrch_extra'];
						var L_EXTRA_MSG = '<font class="qryExample">Пример:</font>&nbsp;';
						
						if( sFindHereExtra == '' )
						{
							if( hExtra.innerHTML != '' )return;
							hExtra.innerHTML = L_EXTRA_MSG + idsrch_extra_src.innerHTML;
							return;
						}
						
						var nIDT = sFindHereExtra.split( '|' )[0];
						var sFilterName = sFindHereExtra.split( '|' )[1];
						switch( document.forms['f_mus_search'].idr.value )
						{
						case '0':
						case '2':
							hExtra.innerHTML = '<nobr><div style="margin-bottom:-3; margin-right:0px; :0px;margin-top:-10px; margin-left:-4px;"><input type="checkbox" value="1" checked onclick="doToggleExtra( this )">' + 'Искать в разделе KM.RU ' + sFilterName + '</input></div></nobr>';
							document.forms['f_mus_search'].idt.value = nIDT + '-';
							break;
						default:
							hExtra.innerHTML = L_EXTRA_MSG + idsrch_extra_src.innerHTML;
							document.forms['f_mus_search'].idt.value = '';
						}*/
						
					}

					// Toggles on/off of extra checkbox
					function doToggleExtra( hExtra )
					{
						if( !hExtra )return;
						hExtra.value = hExtra.value == '1' ? '0' : '1';
						document.forms['f_mus_search'].idt.value = hExtra.value == '1' ? sFindHereExtra.split( '|' )[0] + '-' : '';
					}
					
					// Invokes when user press any key in query text fld and submits form when the key is Enter
					function doCheckKeyDown()
					{
						if( event.keyCode == 13 )
						{
							event.cancelBubble = true;
							doSubmitForm( document.forms['f_mus_search'].sbOK );
						}
					}

					function doSubmitForm( pButton )
					{
						var f = document.forms['f_mus_search'];
						if( !f )return( true );
						if( !pButton )return( true );
						
						if( 'sbDwn' == pButton.name )
						{
							f.sq.value = document.all['sqDwn'] ? document.all['sqDwn'].value : '';
							var rSelectDwn = document.all['idrs'];
							if( rSelectDwn )
							{
								f.idr.value = rSelectDwn.options[ rSelectDwn.selectedIndex ].value;
							}
						}
						
						// Submitting
						f.sbOK.disabled = true;
						f.submit();
					}
					
					function doChangeTabStyle( hTab, bActive )
					{
						if( !hTab )return;
						if( parseInt( document.forms['f_mus_search'].idr.value ) == parseInt( hTab.id.replace('idsrchtab','') ) )
						{
							hTab.children(0).children(0).style.textDecoration = 'none';
							return;
						}
						hTab.children(0).children(0).style.textDecoration = bActive ? 'underline' : 'none';
					}
					//-->
					
					
					