$(document).ready(function () {

    //    if ($('.slideshow').length) {
    //       $('.slideshow').snowfall({ flakeCount: 100, maxSpeed: 10 });
    //    }


    // Code for the rotating banner
    $('.slides').cycle({
        pager: '.buttons',
        fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        pause: 1,
        speed: 1000,
        timeout: 4000
    });
    // Replace any slide that needs flash
    var flashvars = {};
    var params = { wmode: 'transparent' };
    var attributes = {};
    //swfobject.embedSWF("/images/bannerSlides/banner3.swf", "banner3flash", "950", "214", "9.0.0", false, flashvars, params, attributes);


    // Code for the logo scroller
    $('#myLogos').jcarousel({
        auto: 2,
        scroll: 1,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });

    /*
    IF YOU PLAN ON PUTTING XMAS RETURNS ON THIS CHRISTMAS JUST UNCOMMENT THIS CODE AND THE CODE ON THE PRODUCT PAGE
    $('.returnsContainer').hide();

    $('.xmasReturns a').click(function (e) {
    e.preventDefault();
    e.stopPropagation();
    $('.returnsContainer').fadeIn(250);
    });
    $('body').click(function () { if ($('.returnsContainer').is(':visible')) { $('.returnsContainer').fadeOut(500); } });

    */




    $(".tab_content").hide(); //Hide all content

    $("ul.tabs li:first").addClass("active").show(); //Activate first tab

    $(".tab_content:first").show(); //Show first tab content



    $('.main-menu li').hover(function () {

        $(this).children('.menu-drop').show();

    }

		, function () {

		    $(this).children('.menu-drop').hide();

		});



    //$('.main-menu li:last').children('.menu-drop').css('right','0px');

    //$('.main-menu li:last').prev().children('.menu-drop').css('right','0px');



    //Reorder the z-index

    //  $(function () {

    //     var zIndexNumber = 10000;

    //    $('div').each(function () {

    //           $(this).css('zIndex', zIndexNumber);

    //         zIndexNumber -= 10;

    //        });

    //  });

    //On Click Event

    $("ul.tabs li a").click(function () {



        $("ul.tabs li a").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).attr("href"); //Find the href attribute value to identify the active tab + content

        $(activeTab).fadeIn(); //Fade in the active ID content

        return false;

    });

});



function OpenDescription() {

    $("ul.tabs li a").removeClass("active"); //Remove any "active" class

    $("#description").addClass("active"); //Add "active" class to selected tab

    $(".tab_content").hide(); //Hide all tab content



    var activeTab = $("#description").attr("href"); //Find the href attribute value to identify the active tab + content

    $(activeTab).fadeIn(); //Fade in the active ID content

    return false;

}


$(document).ready(function(){
	// Clear field value when clicked
	$(".has_default_value").focus(function(){
		if ( $(this).val() == $(this).attr("title") ) {
			$(this).val("");
		}
	});
	$(".has_default_value").blur(function(){
		if ( $(this).val() == "" ) {
			$(this).val($(this).attr("title"));
		}
	});			  
	// Remove focus outlines
	$("a").keypress(function(){
		this.blur();
		this.hideFocus = false;
		this.style.outline = null;
	});
	$("a").mousedown(function(){
		this.blur();
		this.hideFocus = true;
		this.style.outline = 'none';
	});
	// Rollovers
	$(".rollover").hover(function(){
		this.src = this.src.replace("_off", "_on");
	},
	function(){
		this.src = this.src.replace("_on", "_off");
	});
	$(".rollover").each(function(){
		rollover_src = $(this).attr("src");
		rollover_activate = rollover_src.replace(/_off/gi, "_on");
		$("<img>").attr("src", rollover_activate);
	});
	// Shadowbox
//	Shadowbox.init(document.ready);
});

function mycarousel_initCallback(carousel) {
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function () {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function () {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function () {
        carousel.stopAuto();
    }, function () {
        carousel.startAuto();
    });
};
