$(document).ready(function(){
	
	// external links
	$("a[href^='http']").attr('target','_blank');

	// drop down menu
	$("#header li").hover(
		function(){ $("ul", this).css('display','block'); },
		function(){ $("ul", this).css('display','none'); }
	);
	
	// in field labels 
	$("#login label").inFieldLabels();
	
	// append facebook like box iframe
	$("#facebook-like-box").append("<iframe src=\"http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FAngela-Stone-Consulting%2F145033028894795&amp;width=244&amp;colorscheme=light&amp;show_faces=false&amp;stream=true&amp;header=false&amp;height=395\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:244px; height:395px;\" allowTransparency=\"true\"></iframe>");
	
	// stupid IE doesn't support last/first selectors so...
	$(":first-child").addClass("first");
	$(":last-child").addClass("last");
	
	// autoclear
	$(".autoclear").each(function(){
		$(this).attr("title", $(this).attr("value"));
	});
	$(".autoclear").focus(function(){
		if ($(this).attr("title") == $(this).attr("value"))
			$(this).attr("value", "");
	});
	$(".autoclear").blur(function(){
		if (!$(this).attr("value") || $(this).attr("value") == "")
			$(this).attr("value", $(this).attr("title"));
		else
			$(this).removeClass("autoclear");
	});
	
	// zebra stripes
	$(
		"table.zebra tbody tr:odd, "
		+ "table#cart tbody tr:odd"
	).addClass('zebra1');
	
	// add input classes since IE can't do attribute selectors
	$("input[type=text]").addClass("text");
	$("input[type=password]").addClass("password");
	
	// oss
	$('#product-details #product-thumbs a').click(function(){
		$('#product-largeimage').attr('src', $(this).attr('href'));
		return false;
	});
	
});

$(window).load(function(){
	
	// slider
	$("#slider").anythingSlider({
		delay 			: 5000,
		easing 			: 'easeOutExpo',
		resizeContents 	: false,
		animationTime 	: 600,
		buildArrows 	: false,
		buildNavigation : false,
		startStopped    : false, // If autoPlay is on, this can force it to start stopped
		theme           : 'default',
		autoPlayLocked  : false,  // If true, user changing slides will not stop the slideshow
		resumeDelay     : 10000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
		onSlideComplete : function(slider){
			// alert('Welcome to Slide #' + slider.currentPage);
		}
	});
	
});
