jQuery(function($) {
// Your code using failsafe $ alias here...

//  SCROLLABLE + CUSTOM GALLERY DISPLAY
$(".videogallery .scrollable").scrollable({
    size: 3,
    items: ".items",
    clickable: false
}).each(function() {
    var mainImg = $(this).parents(".scrollarea").prev().find("img");

});


	$(".enterZip").live("click", function(){
		$(this).parent().siblings(".shipData").toggle();
		return false;
	});

	$("ul.sf-menu").superfish({
		animation: {height:'show'},
		speed: 300,
		autoArrows: false,
		dropShadows: false
	}).find("ul").bgIframe();

	$(".itemRow").equalHeights(true);
	$(".modCarousel .items").equalHeights(true);

	$(".itemWrapper ul.swatchList li a").live("mouseover", function(){
		$(this).parents(".swatchList").find("a").removeClass("active");
		$(this).addClass("active");
		var newImg = $(this).find(".swatchAlt").html();
		$(this).parents(".itemWrapper").find(".itemImage").attr({src: newImg});
	});
	
	//Banner slide show
	$("#homeSSW").cycle({
		fx: 'fade',
		speed: 5000,
		timeout: 5000,
		pager: '.nav'
	});	
	$(".sswControls").css({'background-color' : '#fff', 'opacity' : '0.9'});
	
	$(".truncate").truncate({
		max_length: 400,
		more: "read more",
		less: "read less"
	});

// dialog windows 
	$(".uiModal").dialog({
		autoOpen: false,
		width: "720px",
		bgiframe: true,
		modal: true,
		resizable: false,
		buttons: {
			Close: function() {
				$(this).dialog('close');
			}
		}
	});
	
	$(".uiDialog").dialog({
		autoOpen: false,
		width: "720px",
		bgiframe: true,
		modal: false,
		resizable: false,
		buttons: {
			Close: function() {
				$(this).dialog('close');
			}
		}
	});
	
	$(".pageTools .recent").live("click", function(){	
		$(".recentDialog").dialog( "open" );		
		return false;
	});
	
	$(".productImage .btnEnlarge").live("click", function(){	
		$(".enlargeView").dialog( "open" );
		return false;
	});
// END dialog windows 
	
	$(".tabModule .tabsRow > ul").tabs();
	$(".cartSupport .supportTabs > ul").tabs();
	
// carousels 
	$(".modCarousel4 .scrollable").scrollable({
		size: 4,
		items: ".items",
		clickable: false
	});
	

	$(".modCarousel5 .scrollable").scrollable({
		size: 5,
		items: ".items",
		clickable: false
	});

	$(".scrollable").each(function() {
		var mcHeight = $(".itemWrapper:first", this).height();
		$(this).css({'height' : mcHeight});
	});
// END carousels 
		
	$(".swatchList a").cluetip({
	cluetipClass: 'swatch',
		width: '178px',
		positionBy: 'fixed',
		topOffset: '-122px',
		leftOffset: '-115px',
		local:true,
		dropShadow: false,
		showTitle: false
	});
	
	// This is the cluetip for the My Account portion of the main menu
	$('a.load-local').cluetip({local:true, positionBy: 'fixed', activation:'click', width:'215px', height:'155px', sticky:true, leftOffset: '-232px', topOffset: '40px', dropShadow: false, showTitle: false, closePosition:'title', cursor: 'pointer'});


	// This is the cluetip for the help button on the membership page... similar funtions can be set up for any future cluetips as they are needed

	$('a.load-local2').cluetip({local:true, positionBy: 'fixed', activation:'click', width:'440px', sticky:true, leftOffset: '0px', topOffset: '0px', dropShadow: false, showTitle: false, closePosition:'title', cursor: 'pointer'});


// Right Rail Nav 
$(document).ready(function()
{
  //hide the all of the element with class msg_body
  $(".msg_body").hide();
  //toggle the componenet with class msg_body
  $(".msg_head").click(function()
  {
    $(this).next(".msg_body").toggle();
  });
});

$(document).ready(function()
{
  //hide the all of the element with class msg_body
  $(".msg_body3").hide();
  //toggle the componenet with class msg_body
  $(".msg_head3").click(function()
  {
    $(this).next(".msg_body3").toggle(),
    $(".msg_head3").toggleClass("expanded");
  });
  
});


// Account Registration Form sections

//Registration Information
$(document).ready(function()
{
  //hide the all of the element with class msg_body
  $(".regInfo_body").hide();
  //toggle the componenet with class msg_body
  $(".regInfo_head").click(function()
  {
    $(this).next(".regInfo_body").toggle(), 
    $(this).toggleClass("minus");
  });
});

//Membership Information
$(document).ready(function()
{
  //hide the all of the element with class msg_body
  $(".memberInfo_body").hide();
  //toggle the componenet with class msg_body
  $(".memberInfo_head").click(function()
  {
    $(this).next(".memberInfo_body").toggle(), 
    $(this).toggleClass("minus");
  });
});

// Third Party Verification
$(document).ready(function()
{
  //hide the all of the element with class msg_body
  $(".thirdParty_body").hide();
  //toggle the componenet with class msg_body
  $(".thirdParty_head").click(function()
  {
    $(this).next(".thirdParty_body").toggle(), 
    $(this).toggleClass("minus");
  });
});

// Policy/Benificiary Information
$(document).ready(function()
{
  //hide the all of the element with class msg_body
  $(".policyInfo_body").hide();
  //toggle the componenet with class msg_body
  $(".policyInfo_head").click(function()
  {
    $(this).next(".policyInfo_body").toggle(), 
    $(this).toggleClass("minus");
  });
});

// Financial Advisors
$(document).ready(function()
{
  //hide the all of the element with class msg_body
  $(".financial_body").hide();
  //toggle the componenet with class msg_body
  $(".financial_head").click(function()
  {
    $(this).next(".financial_body").toggle(), 
    $(this).toggleClass("minus");
  });
});


// Will/Attourneys
$(document).ready(function()
{
  //hide the all of the element with class msg_body
  $(".willAttorneys_body").hide();
  //toggle the componenet with class msg_body
  $(".willAttorneys_head").click(function()
  {
    $(this).next(".willAttorneys_body").toggle(), 
    $(this).toggleClass("minus");
  });
});

// otherPolicy/Benificiary Information
$(document).ready(function() {
    //hide the all of the element with class msg_body
    $(".otherPolicyInfo_body").hide();
    //toggle the componenet with class msg_body
    $(".otherPolicyInfo_head").click(function() {
        $(this).next(".otherPolicyInfo_body").toggle(),
    $(this).toggleClass("minus");
    });
});


// Next and Save/Continue buttons to open the following section
$(document).ready(function()
{
$(".regInfo_next").click(function()
  {
  $(".memberInfo_body").show(),
  $(".memberInfo_head").addClass("minus");
   });
});


$(document).ready(function()
{
$(".memberInfo_next").click(function()
  {
  $(".thirdParty_body").show(),
  $(".thirdParty_head").addClass("minus");
   });
});

$(document).ready(function()
{
$(".thirdParty_next").click(function()
  {
  $(".policyInfo_body").show(),
  $(".policyInfo_head").addClass("minus");
   });
});

$(document).ready(function()
{
$(".policyInfo_next").click(function()
  {
  $(".financial_body").show(),
  $(".financial_head").addClass("minus");
   });
});

$(document).ready(function()
{
$(".financial_next").click(function()
  {
  $(".willAttorneys_body").show(),
  $(".willAttorneys_head").addClass("minus");
   });
});

$(document).ready(function()
{
$("#accountBtn").click(function()
  {
  $("#loadme").toggle();
   });
});



// Block UI Function for "Lightbox-style" forms
$(document).ready(function() { 
    $('#demo1').click(function() { 
        $.blockUI({ message: $('#loginForm') }); 
 	 $('.submitBtn').attr('title','Click to unblock').click($.unblockUI); 
    }); 
});


});


