$(document).ready(function(){

	$('#nav').superfish(); 

	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
	
	$('.popup').popupWindow({ height:500, width:800, top:50, left:50, resizable:1, scrollbars:1 });
	
	$('#swf-mortgages').flash({
		swf: '/wp-content/themes/stixandstones/images/mortgages.swf',
		width: 624,
		height: 234
	});	
	$('#swf-customers').flash({
		swf: '/wp-content/themes/stixandstones/images/customers.swf',
		width: 624,
		height: 234
	});	
	$('#swf-dpr').flash({
		swf: '/wp-content/themes/stixandstones/images/dpr.swf',
		width: 624,
		height: 234
	});	
	$('#swf-hbw').flash({
		swf: '/wp-content/themes/stixandstones/images/hbw.swf',
		width: 624,
		height: 234
	});
	
	$("#IDX-userLoginEmail").val("Email Address");  
		textReplacement($('#IDX-userLoginEmail').css("color", "#000"));  
	$("#IDX-userLoginPassword").val("Password");  
		textReplacement($('#IDX-userLoginPassword').css("color", "#000"));  
		
	$("#main.split div.hentry:nth-child(odd)").addClass("odd");
		

	function textReplacement(input){
		var originalvalue = input.val();  
		input.focus( function(){  
			if( $.trim(input.val()) == originalvalue ){ input.val('').css("color", "#000"); }  
		});  
		input.blur( function(){  
			if( $.trim(input.val()) == '' ){ input.val(originalvalue).css("color", "#000"); }  
		});	
	}
	
	
});
