function randomNumber (m,n)
{
  m = parseInt(m);
  n = parseInt(n);
  return Math.floor( Math.random() * (n - m + 1) ) + m;
}

$(document).ready(function(){

  $('.form .file,.form .text, .form textarea, .form select').focus(function(){$(this).addClass('focused')});
  $('.form .file,.form .text, .form textarea, .form select').blur(function(){$(this).removeClass('focused')});
  
  $('.faq .item .answer').css('display', 'none');
  $('.faq .item .read_answer').click(function(){
    $(this).next('.answer').slideToggle('fast');
    return false;
  });
  var rand ="?rand="+randomNumber(1,111);
  
  $('a.main_menu').each(function(){
      $(this).attr('href',$(this).attr('href')+rand)
  });

    
  
 


  $('a.hymn').click(function(){
		if($(this).attr('href') == "javascript:movie.SetVariable('stat','play');")
		{
			$(this).attr('href',"javascript:movie.SetVariable('stat','stop');");
			$(this).find('img').attr('src', '/pic/icons/hymn.gif');
		}
		else
		{
			$(this).attr('href',"javascript:movie.SetVariable('stat','play');");
			$(this).find('img').attr('src', '/pic/icons/hymn-active.gif');
		}
 })
 
  $('#f_date_from, #f_date_to').datepicker({
    dateFormat: 'dd.mm.yy'
  });
 
});

function get_flash(id,path,width,height,codebase_version,classid)
{
        var tag = document.getElementById(id);
        var code = '';

        code = '<object classid="clsid:'+classid+'" width="'+width+'" height="'+height+'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+codebase_version+'">';
        code += '<param name="movie" value="'+path+'"><param name="play" value="true"><param name="loop" value="true"><param name="quality" value="high"><param name="menu" value="false"><param name="wmode" value="transparent">';
        code += '<embed src="'+path+'" wmode="transparent" loop="true" quality="high" menu="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="'+width+'" height="'+height+'"></object>';
        tag.innerHTML = code;
}


                
                        


