var C = {
	//-
	faq: {
		init: function()  {
			$('dd.answer').css('display', 'none');
			$('.faq_link').click(function() {
				item_id=$(this).attr('id');
				item_id=item_id.substr(4);
				C.faq.showHide(item_id);
				return false;
			})
		},
		showHide: function(item_id) {
			var id = '#answer' + item_id;
			var link_id = "#faq_" + item_id;
			if ($(id).css('display') == 'none') {
				//$(id).show('slow');
				//$(id).slideDown('fast');
				$(id).slideDown('fast',function(){
					$(this).css("border-bottom", ".3em #E6E7DA solid")
					$(this).css("margin-bottom", "1em")
					});
				$(link_id).addClass("active");
			} else {
				//$(id).hide('slow');
				$(id).slideUp('fast');
				$(link_id).removeClass("active");
				}
			}
		},
	// -   
	newarchive: {
		init: function()  {
			$('.arch>li').click(function() {
				$('.arch>li').removeClass('hovered');
				$(this).addClass('hovered');
				return false;
			}, function() {
				$(this).removeClass('hovered');
				$('#thisyear').addClass('hovered');
				return false;
			});
		}
	}
}




/*after all*/
$.fn.hint = function (blurClass) {
	if (!blurClass) { blurClass = 'blur'; }
	return this.each(function () {
	// get jQuery version of 'this'
	var $input = $(this),

	// capture the rest of the variable to allow for reuse
	title = $input.attr('title'),
	$form = $(this.form),
	$win = $(window);

	function remove() {
		if ($input.val() === title && $input.hasClass(blurClass)) {
			$input.val('').removeClass(blurClass);
		}
	}

	// only apply logic if the element has the attribute
    if (title) { 
      // on blur, set value to title attr if text is blank
      $input.blur(function () {
        if (this.value === '') {
          $input.val(title).addClass(blurClass);
        }
      }).focus(remove).blur(); // now change all inputs to title
      
      // clear the pre-defined text when form is submitted
      $form.submit(remove);
      $win.unload(remove); // handles Firefox's autocomplete
    }
  });
}





/* 
============================================
Accordion menu
Author:Kamil Kashaev [http://kashaev.ru]
Created date:06.02.2007 20:29 
==============================================
*/

function initMenu() {
	var	menu = ".mmnu ul";
		cur = "active";

	$(menu).find('ul').hide();
	$(menu).find('a.activeLink').parents("ul").show();

	$(menu).find('li a').click(function(){
		var th = this;
			checkElement = $(th).next();
			thParent = $(th).parent();

		if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
			return false;
			}
		if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
			$(menu).find('ul:visible').slideUp('fast');
			
			checkElement.slideDown('fast');
			
			thParent.addClass(cur);
			thParent.siblings().removeClass(cur);
			
			return false;
			}
		});
	}




$(document).ready(function() {

	initMenu();
	//  ,   ,   "after all"
	$('input[title!=""],textarea[title!=""]').hint();


});


