$(function() {
    $('#tabbed ul').tabs();
});  

$(document).ready( function() {
	if ($.browser.msie) {
		$('#slider li').css('zoom', '1');
		$('#slider a').css('zoom','1');
	}
});   

$(document).ready(function() {
	$("#slider").accordion({
		header: '.category',
		autoheight: false,
		alwaysopen: false,
		active: 0
	});
});

$(document).ready(function(){ 
	$('#dropnav a.hover img').hover(function() {
		$(this).attr('src', '_images/v2/nav/' + $(this).attr('id') + '.gif'); },
	function() {
		$(this).attr('src', '_images/v2/nav/' + $(this).attr('id') + '_off.gif'); }); 
});

$(document).ready(function(){
	$("#morefilters").change(function(){
 	this.submit();
 });
});

$(document).ready(function(){
	$('.formLogin #email, .formForgotten #email2, .formLoginHome #email').autofill({
		value: 'Email',
		defaultTextColor: '#545454',
		activeTextColor: '#545454'
	});

	$('.formLogin #pass, .formLoginHome #pass').autofill({
		value: 'Password',
		defaultTextColor: '#545454',
		activeTextColor: '#545454'
	});
});

function slideToggle(el, bShow){
  var $el = $(el), height = $el.data("originalHeight"), visible = $el.is(":visible");
  
  // if the bShow isn't present, get the current visibility and reverse it
  if( arguments.length == 1 ) bShow = !visible;
  
  // if the current visiblilty is the same as the requested state, cancel
  if( bShow == visible ) return false;
  
  // get the original height
  if( !height ){
    // get original height
    height = $el.show().height();
    // update the height
    $el.data("originalHeight", height);
    // if the element was hidden, hide it again
    if( !visible ) $el.hide().css({height: 0});
  }

  // expand the knowledge (instead of slideDown/Up, use custom animation which applies fix)
  if( bShow ){
    $el.show().animate({height: height}, {duration: 5000, complete:function (){
        $el.hide();
      }});
  } else {
    $el.animate({height: 0}, {duration: 0, complete:function (){
        $el.hide();
      }
    });
  }
}

$(document).ready(function(){
	$('a.circlecircle').click(function() {

	var circle = $(this).attr("rel");

	$.ajax({

		type: "POST",
		url: "_includes/ajax.php",
		data: "action=circle&data=" + circle,
		success: function(data) {
   $("span#" + circle).addClass("circleStatus");			
   $("span#" + circle).html(data);
   $("span#" + circle).slideDown(2000).fadeOut(3000);
   
//			slideToggle("span#" + circle);
/*

			$("span#" + circle).slideDown("slow", function () {
    $("span#" + circle).slideUp("5000");
   });
*/

		}
					
	});	

	return false;
	
	});
});