// auto-fill plugin
// Written by Joe Sak http://www.joesak.com/2008/11/19/a-jquery-function-to-auto-fill-input-fields-and-clear-them-on-click/
(function($){$.fn.autofill=function(options){var defaults={value:'First Name',defaultTextColor:"#b2adad",activeTextColor:"#333"};var options=$.extend(defaults,options);return this.each(function(){var obj=$(this);obj.css({color:options.defaultTextColor}).val(options.value).focus(function(){if(obj.val()==options.value){obj.val("").css({color:options.activeTextColor});}}).blur(function(){if(obj.val()==""){obj.css({color:options.defaultTextColor}).val(options.value);}});});};})(jQuery);

// register flash ad
swfobject.registerObject("main-ad", "9.0.115", "<?php echo get_template_directory_uri(); ?>/js/swfobject/expressInstall.swf");

// run in external window
$(function() {
	$('a[rel*=external]').click( function() {
		window.open(this.href);
		return false;
	});
});

// scroll to top
$(document).ready(function() {
	$('a#to-top').click(function(){
		$.scrollTo('#main-wrap', 800, {easing:'easeOutExpo'} );
	});
}); 

/**/
$(document).ready(function(){
	$('#contact').autofill({
		value: "Your telephone or email",
		defaultTextColor: '#5a5a5a',
		activeTextColor: '#333333'
	});
	$('#voucher').autofill({
		value: "Voucher code",
		defaultTextColor: '#5a5a5a',
		activeTextColor: '#333333'
	});
	$('#name').autofill({
		value: "What's your name?",
		defaultTextColor: '#5a5a5a',
		activeTextColor: '#333333'
	});
	$('#email').autofill({
		value: "Your email address?",
		defaultTextColor: '#5a5a5a',
		activeTextColor: '#333333'
	});
	$('#message').autofill({
		value: "Message goes here...",
		defaultTextColor: '#5a5a5a',
		activeTextColor: '#333333'
	});
});


// featured box
$(document).ready(function() {
	$('#featured').tabs({ fxFade: true, fxSpeed: 'fast' });
});

// fade links
$(document).ready(function(){
	$("#sidebar ul li ul li a").mouseover(function(){
		$(this).stop(true);
		$(this).animate({color: 'hsl(0, 100%, 100%)'});
	});
	$("#sidebar ul li ul li a").mouseleave(function(){
		$(this).animate({color: 'hsl(0, 0%, 80%)'});
	});
});