/**
 * @author on1ooker
 */

$(document).ready(function(){
	$('.all-sites .expand').click(function(){
		var list = $(this).parents('.all-sites').find('.sites');
		$(list).slideToggle(350);
		return false; 
	})
	
	$('.main-menu-item').hover(
		function (){
			var active_sub = $('.main-menu .active').find('.sub-menu');
			if (!$(this).hasClass('.active')) $(active_sub).css('display', 'none');
			$(this).stop();
			$(this).removeAttr('style');
			$(this).find('.sub-menu').show();
		},
		function (){
			var active_sub = $('.main-menu  .active').find('.sub-menu');
			$(active_sub).css('display', 'block');
			$(this).stop();
			$(this).removeAttr('style');
			if (!$(this).hasClass('.active'))
				$(this).find('.sub-menu').hide();
		});
	
	
	/*$('.main-menu-item').hover(
			function () {
			//	alert($(this).find('.sub-menu').html());
				//$(this).addClass('active');
				$(this).stop();
				$(this).removeAttr('style');
				$(this).find('.sub-menu').show();
			},
			function () {
				$(this).stop();
				$(this).removeAttr('style');
				$(this).find('.sub-menu').hide();
				//$(this).removeClass('active');
				$(this).css('height','26px');
				$('.main-menu-item a').css('height','21px');
				$('.sep').css('height','26px');
				$('.sep-sep').css('height','26px');
			}
	);*/
	
	/*$('.all-sites .expand').bind('blur',function(){
		var list = $(this).parents('.all-sites').find('.sites');
		$(list).slideUp(250);
	})*/
	
	$('.all-sites .cross').click(function(){
		var list = $(this).parents('.all-sites').find('.sites');
		$(list).slideUp(250);
		return false;
	})
	
	$('.search .find').bind('blur',function(){
		if ($(this).attr('value') == '')
		{
			$('.search span').fadeIn(300);
		};
	})
	
	$('.search .find').focus(function(){
		$('.search span').fadeOut(10);
	});
	
	$('.search span').click(function()
	{
		$(this).fadeOut(10);
		$('.seacrh .find').focus();
	})
	
	$('.thickbox').fancybox({ 
		'zoomSpeedIn': 200, 
		'zoomSpeedOut': 200,
		'frameWidth': 100,
		'frameHeight': 100,
		'overlayShow': true,
		'hideOnContentClick' :false,
		'centerOnScroll' : false
	});
	
	$('.header .print-page').click(function(){
			window.print();
			return false;
	})
	
	$('.content .table-charity').each(function()
	{
		$(this).find('tr:odd').addClass('odd');
		$(this).css('width','90%');
	})
	
	var faq_options = 
					{
				 		 target: '.ask-form', 
				  		 url:     $('#faq').attr('action'), 
		   			     success: function(data) { 
							         $('.ask-form').replaceWith(data);
									 $('#faq').ajaxForm(faq_options);	         
					              } 
					  };
	
	 $('#faq').ajaxForm(faq_options);	
					   
/*	  $('.logos-line a').hover(
	 	function()
		{
			$('.logos-line a').stop();
			$('.logos-line a').removeAttr('style');
			$('.logos-line a').not(this).animate({opacity:'0.3'},300);	
		},
		function()
		{
			$('.logos-line a').stop();
			$('.logos-line a').removeAttr('style');
			$('.logos-line a').animate({opacity:'1'},300);
		}
	 );
	 
	 $('.main .logos-line a').hover(
	 	function()
		{
			$(this).find('img').css('margin-top', '-50px');	
		},
		function()
		{
			$(this).find('img').css('margin-top', '0px');
		}
	 );*/
	
	 /*$('.main .logos-line a').hover(
	 	function()
		{
			$(this).find('img').css('margin-top', '-58px');	
		},
		function()
		{
			$(this).find('img').css('margin-top', '0px');
		}
	 );
	 */
	 $('.content .jobs-cities').click(function(){
		$(this).parent().next().slideToggle(250);
		return false;
	});
	
	$('ul.vacancies > li > a').click(function(){
  		$(this).parent().find('ul').slideToggle(250, function(){
			if (($.browser.msie) && ($.browser.version == 8)) {$('.center-block').height($('.center-block').find('.content').height())};
		});
		return false;
	})	;
					   
 	
});

function activate_movie(src,id,width, height)
{
	(width > 650)?(width = 650):(width);
	if (src != ''){
		$('#'+id).width(width).height(height);
		src = 'http://' + window.location.hostname + src;
		flashembed(id, "http://releases.flowplayer.org/swf/flowplayer-3.1.5.swf", { 
		// "config" parameter is a complex JSON object, not just a simple value 
			config: { 
				clip:  { 
					autoPlay: false, 
					autoBuffering: true, 
					url: src 
				} 
			} 
		});	
	} 
};


