jQuery(document).ready(function($){
	// input form value replacer.
	
	$('input[type="text"]','input[type="password"]').each(function(){
		if($(this).val() == ""){
			$(this).val($(this).attr("title"));
		}
	}).blur(function(){
		if($(this).val() == ""){
			$(this).val($(this).attr("title")).removeClass('filled');
		}
	}).focus(function(){
		if($(this).val() == $(this).attr("title") || $(this).length == 0){
			$(this).val('').addClass('filled');
		}
	});
	// simple email spam protection
	$('a.email').each(function(){
		var em = this.rel.replace(':','@');
		this.href = 'mailto:' + em;
		$(this).text(em).removeAttr('rel');
	});

	if($.browser.msie && ($.browser.version == "6.0")){
		$('<div class="error"><h3>Not Supported in IE6</h3><p>We recommend you update your browser.</p></div>').appendTo('div.tweet','div.post');
	}else{
		// Twitter
		$('#tweet_0').twitter({
			username:'cyclestreet',
			count:3
		});
		// Tumblr
		$('#video_0').tumblr({
			offset:0,
			count:1,
			type:'video'
		});
		$('#tag_0').tumblr({
			count:1,
			type:'text',
			tagged:"featured offer",
			bg_img:true
		});
		$('#tag_1').tumblr({
			count:1,
			type:'text',
			tagged:"featured product",
			bg_img:true
		});
		$('#tag_2').tumblr({
			count:1,
			type:'text',
			tagged:"featured ride",
			bg_img:true
		});
		$('#post_0').tumblr({
			offset:0,
			count:1,
			type:'text',
			bg_img:true
		});
		$('#post_1').tumblr({
			offset:1,
			count:1,
			type:'text',
			bg_img:true
		});
		$('#post_2').tumblr({
			offset:2,
			count:1,
			type:'text',
			bg_img:true
		});
	}
});

