$(document).ready(function(){

	// Featurebox Hide All Except Diamante (separated into 3 lines for IE6 compat.)
	$("#ftrbox_cats .ftrbox_cat .txt .box").hide();
	$("#ftrbox_cats .ftrbox_cat .txt").hide();
	$("#ftrbox_diamante .txt").show();

	// Featurebox Text Area Interactivity
	$("#ftrbox_cats .ftrbox_cat .txt")
		.hover(function(){
			$("#ftrbox_cats .ftrbox_cat .txt").stop(); // Stop All Effects
			$(this)
				.show()
				.animate({opacity:1},0) // Make sure current is 100%
				.css({cursor:"pointer"})
				.children(".box").fadeIn("fast");
		},function () {
			$(this).children(".box").fadeOut("fast");
			// Restart Tab Cycling
			switch($(this).parent().attr("id")) {
				case "ftrbox_silver" : f_ftrbox_silver(0); break;
				case "ftrbox_crystal" : f_ftrbox_crystal(0); break;
				case "ftrbox_wedding" : f_ftrbox_wedding(0); break;
				default : f_ftrbox_diamante(0);
			}
		})
		.click(function(){
			location.href = $(this).prev("h1").children("a").attr("href");
		});	

	// ----------------
	// Featurebox Tab Cycling

	function f_ftrbox_diamante(fv_pause) {
		$("#ftrbox_diamante .txt").animate({opacity:1},fv_pause,function(){
			$("#ftrbox_silver .txt").fadeIn("slow",function(){
				f_ftrbox_silver(1500);
			});
		});
	}
	function f_ftrbox_silver(fv_pause) {
		$("#ftrbox_silver .txt").animate({opacity:1},fv_pause,function(){
			$("#ftrbox_crystal .txt").fadeIn("slow",function(){
				$("#ftrbox_silver .txt").hide();
				f_ftrbox_crystal(1500);
			});
		});
	}
	function f_ftrbox_crystal(fv_pause) {
		$("#ftrbox_crystal .txt").animate({opacity:1},fv_pause,function(){
			$("#ftrbox_wedding .txt").fadeIn("slow",function(){
				$("#ftrbox_crystal .txt").hide();
				f_ftrbox_wedding(1500);
			});
		});
	}
	function f_ftrbox_wedding(fv_pause) {
		$("#ftrbox_wedding .txt").animate({opacity:1},fv_pause,function(){
			$("#ftrbox_wedding .txt").fadeOut("slow",function(){
				f_ftrbox_diamante(1500);
			});
		});
	}
	f_ftrbox_diamante(1500);

	// ----------------
	// Scrolling Images

	// Duplicate Scroll Container Contents (for seamless looping)
	$("#scrollingarea").append($("#scrollingarea").html());
	// Number of Scroll Items
	var v_scrl_itm = $("#scrollingarea .scrollitem").length;
	// Width of Each Scroll Item
	var v_scrl_itm_w = 70;
	$("#scrollingarea .scrollitem").css({width:v_scrl_itm_w+"px",margin:"0px"});
	// Width of Scroll Container
	var v_scrl_cnt_w = (v_scrl_itm)*v_scrl_itm_w;
	$("#scrollingarea")
		.css({width:v_scrl_cnt_w+"px"})
		.hover(function(){
			// Stop Scrolling
			$(this).stop();
		},function(){
			// Restart Scrolling
			f_scrl();
	});
		
	function f_scrl() {
		// animate left starts at 0px scrolls left until left = width-(width*2), then restart at 0px
		$("#scrollingarea").animate({left:((v_scrl_cnt_w/2)-v_scrl_cnt_w)+"px"},((v_scrl_itm/2)*3500),"linear",function(){
			$(this).css({left:"0px"});
			f_scrl();
		});
	}
	f_scrl();

	// ----------------
	// Sub-Home Page Category Text Boxes

	$(".items_sub .item")
		.hover(function(){
			$(this).children(".desc").fadeIn();
		}, function() {
			$(this).children(".desc").fadeOut();
		})
		.click(function(){
			location.href = $(this).find("a").attr("href");
		})
		.find("a").attr("title","");

	// --------------------
	// Home Page Slide Show

	if (v_url_rel == "") {
		$.getJSON("slides/home/",function(data){
			// Begin Slide Show
			f_ss("ftrbox_flsh",0,data);
		});
	}

});