$(document).ready(function(){
	var f=('q'==document.activeElement.id?1:0);
	toQsug= false;
	if ('Suburb or Postcode'==$('#q').val()){
		if (0==f)
			$('#q').css('color','#C8C8C8');
		else if (1==f)
			$('#q').val('');
	}
	$('#q').blur(function() {
		f=0;
		if (toQsug){
			$('#qsug').hide();
			toQsug= false;
		}
		if (''==$(this).val())
			$(this).css('color','#C8C8C8').val('Suburb or Postcode');
		else
			$(this).css('color','#505050');
	}).focus(function() {
		f=1;
		if ('Suburb or Postcode'==$(this).val())
			$(this).css('color','#505050').val('');

		var words= $(this).val().split(',');
		if ((words[words.length-1].replace(/^(\s)+/, '')).length>2)
			$('#qsug').show();
	}).hover(
		function (){
			if ('Suburb or Postcode'==$(this).val())
				$(this).css('color','#808080');
		},
		function (){
			if (''==$(this).val()&&f==0)
				$(this).css('color','#C8C8C8').val('Suburb or Postcode');
			else if ('Suburb or Postcode'==$(this).val() && f==0)
				$(this).css('color','#C8C8C8');
		}
	);
	$("[placeholder]").focus(function() {
		var input = $(this);
		if (input.val() == input.attr("placeholder")) {
			input.val("");
			input.removeClass("placeholder");
		}
	}).blur(function() {
		var input = $(this);
		if (input.val() == "" || input.val() == input.attr("placeholder")) {
			input.addClass("placeholder");
			input.val(input.attr("placeholder"));
		}
	}).blur();
	// testimonials
	/*
	$('.testimonial-quote').cycle({
		fx:			'fade',
		speed:		500,
		sync:		true,
		timeout:	6000,
		pause:		1
	});
	// index slideshow
	$('#slideshow').cycle({
		fx:			'uncover',
		speed:		500,
		sync:		true,
		timeout:	7000,
		pager:		'#tabs',
		pagerAnchorBuilder: function(idx, slide){
			return '#tabs li:eq(' + idx + ') a';
		},
		pause:		1
	});*/
});

