$(function() {
	$("ul.sf-menu").superfish({
		autoArrows: false,
		delay: 500, // one second delay on mouseout
		animation: {opacity:'toggle', height:'show'}, // fade-in and slide-down animation
		speed: 500, // faster animation speed
		autoArrows: false, // disable generation of arrow mark-up
		dropShadows: false // disable drop shadows
	});
	
	$(".featuredslider").jCarouselLite({
		btnNext: ".next",
        btnPrev: ".prev",
		auto: 5000,
	    speed: 1000
    });
	
	$("#twitter_bg .wrapper").tweet({
		join_text: "",
		username: twitterlogin,
		avatar_size: 0,
		count: twittercount,
		auto_join_text_default: "", 
		auto_join_text_ed: "",
		auto_join_text_ing: "",
		auto_join_text_reply: "",
		auto_join_text_url: "",
		loading_text: "loading tweets..."
	});
	
	$('#latest_themes .latest_theme').hover(function(){
		$(this).find('.preview').fadeTo("fast", 0.7);
    },
	function(){
		$(this).find('.preview').fadeTo("fast", 1);
    });
	
	
	$('#featured_themes .featured_theme').hover(function(){
		$(this).find('.preview').fadeTo("fast", 0.7);
    },
	function(){
		$(this).find('.preview').fadeTo("fast", 1);
    });
	
	$('.preview img').hover(function(){
		$(this).fadeTo("fast", 0.7);
    },
	function(){
		$(this).fadeTo("fast", 1);
    });
	
	var searchstring = $('input#s').attr('value');
	$('input#s').each(function () {
		if ($(this).val() == '') {
			$(this).val(searchstring);
		}
	}).focus(function () {
		if ($(this).val() == searchstring) {
			$(this).val('');
		}
	}).blur(function () {
		if ($(this).val() == '') {
			$(this).val(searchstring);
		}
	});
	$('#user_login, #user_pass').focus(function () {
		if ($(this).val() == 'Username' || $(this).val() == 'Password') {
			$(this).val('');
		}
	});
	
	$("#loginbtn").toggle(
		function () {
			$("#custom_login").show("slow");
			$(this).html("Cancel login");
      	},
      	function () {
        	$("#custom_login").hide("slow");
			$(this).html("Login");
      	}
	);
	$("#twitter_bg a").each(
		function(){
			$(this).attr('target', '_blank');
	});
	
});
