$(document).ready(function(){	
	
	/* nav */
	$('#nav').superfish({ hoverClass: 'sfHover', autoArrows: false, delay: 200 }); 
	
	/* coupon */
	$('#coupon_form').hide();
	$('#coupon').click(function() {
		$('#coupon_form').toggle('slow');	
		return false;
	});

	/* dropdown */
	$("#network").click(function () {
		if ($("div#networkdropdown").is(":hidden")) {
			$("#networkdropdown").fadeIn('fast');
			$("#network").toggleClass("active"); 
		}
		else {
			$("div#networkdropdown").fadeOut('fast');
			$("#network").toggleClass("active"); }
	});
	$("div#networkdropdown").hover( function() {},
		function() { 
			$("div#networkdropdown").fadeOut('fast');
			$("#network").toggleClass("active");
	}); 
	
	/* go to top */
	$('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });
    
    /* social widget */
	$('#tab-subscribe').click(function(event) {
		event.preventDefault();

		if (!$(this).hasClass('active'))
		{
			$(this).toggleClass('active');
			$('#tab-rss').toggleClass('active');
			
			var emailHeight = $('#widget-email').outerHeight(); // get email height
			var rssHeight = $('#widget-rss').outerHeight(); // get rss height
			
			$('#widget-rss').fadeOut(300);
			$('#widget-email').fadeIn('slow');
			$("#widget-social").animate({
				height: emailHeight
			});
		}
	});
		
	$('#tab-rss').click(function(event) {
		event.preventDefault();	
	
		if (!$(this).hasClass('active'))
		{		
			$(this).toggleClass('active');
			$('#tab-subscribe').toggleClass('active');
			
			var emailHeight = $('#widget-email').outerHeight(); // get email height
			var rssHeight = $('#widget-rss').outerHeight(); // get rss height
			
			$('#widget-email').fadeOut(300);
			$('#widget-rss').fadeIn('slow');
			$("#widget-social").animate({
				height: rssHeight
			});
		}
	});
});

/* search */
/*
if(document.getElementById("q").value == "") 
	document.getElementById("q").setAttribute('style', 'background: url(/public/images/txt-searchks.gif) 10px center no-repeat !important');
	
document.getElementById("q").onblur = function(){  
	if (document.getElementById("q").value == '')
		document.getElementById("q").setAttribute('style', 'background: url(/public/images/txt-searchks.gif) 10px center no-repeat !important');
};  				  			
document.getElementById("q").onfocus = function(){  
	document.getElementById("q").setAttribute('style', 'background: none !important');
};*/
