/*  bgImageTween, a Jquery plugin for smoot background image transition loops.
    Copyright (C) 2010  Toni Anzlovar

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
	
	$('#some.element').imageBgTween(['/your.jpg', 
                                 '/set.jpg', 
                                 '/of.jpg', 
                                 '/images.jpg'], 3000, 2000 );
*/

(function( $ ){
	
  $.fn.navHover = function(active){
	  if(active){
		  active.css('color','#333').prev().fadeOut();
	  }
	  $(this).bind('click', function(event){
		  	if($(this).hasClass('unlink')){
				event.preventDefault();
			}
			
			$('ul.collapsable').not($(this).parent().children()).each(function(){
				$(this).slideUp('normal');
			});
		  $('.t1nav').not($(this)).css('color','#FFF').prev().fadeIn();
		 if($(this).prev().css('display') != 'none'){
			$(this).css('color','#333');
			$(this).prev().fadeOut();
		} else {
			$(this).css('color','#FFF');
			$(this).prev().fadeIn();
		}
	  });
  },
	
	
  $.fn.cbNav = function(active,show,allowclick) {
    $('#navigation ul').hide();
	active.addClass('selected');
	if(allowclick){
	} else{
		active.click(
		function(event){
			event.preventDefault();
		});
	}
	if(show){
		active.parent().children('ul').slideToggle(0);
		if(active.attr('id') != 'navsupport'){
			active.css('border-bottom','3px solid #c6c6c6');
		}
	}
	$(this).bind({
		click: function() {
			$('.accordion').removeClass('selected');
			$('.t1nav').not('#navsupport').css('border-bottom','3px solid #000000');
			$(this).addClass('selected');
			$('ul.collapsable').each(function(){
				if($(this).css('display') != 'none' && !$(this).parent().children('a').hasClass('selected')){
					$(this).slideToggle('normal');
				}
			});
			if($(this).attr('id') != 'navsupport'){
				if($(this).next().css('display') != 'none'){
					$(this).css('border-bottom','3px solid #000000');
				} else {
					$(this).css('border-bottom','3px solid #c6c6c6');
				}
			}
			$(this).parent().children('ul').slideToggle('normal');
		}/*,
		mouseenter: function() {
			$(this).css('color','#333');
			$(this).prev().fadeOut();
		},
		mouseleave: function() {
			if(!$(this).hasClass('selected')){
				$(this).css('color','#FFF');
				$(this).prev().fadeIn();
			}
		}*/
	});
  }
})( jQuery );

