
// Curvy Corners


/*
    var settingslarge = {
      tl: { radius: 20 },
      tr: { radius: 20 },
      bl: { radius: 20 },
      br: { radius: 20 },
      antiAlias: true
    };

    var settingsmed = {
      tl: { radius: 16 },
      tr: { radius: 16 },
      bl: { radius: 16 },
      br: { radius: 16 },
      antiAlias: true
    };

    var settingssmall = {
      tl: { radius: 10 },
      tr: { radius: 10 },
      bl: { radius: 10 },
      br: { radius: 10 },
      antiAlias: true
    };

    curvyCorners(settingslarge, ".rounded-large");
    curvyCorners(settingslarge, "#shopp .products .product img");
    curvyCorners(settingsmed, ".rounded-med");
    curvyCorners(settingsmed, ".button a");
    curvyCorners(settingsmed, "#shopp input.addtocart");
    curvyCorners(settingssmall, ".rounded-small");
    curvyCorners(settingssmall, "p.button-small a");
*/




$(document).ready(function(){

	// Home page slideshow

	$("ul.cycle").cycle({
    	fx:      'scrollUp',
   	 	delay: 2000,
   	 	timeout: 4000,
   	 	speed: 2000,
    	nowrap: 0,
    	pause: 1
   	});	
   	

	$.preloadCssImages();	

	// Accordion Panels
	
	if ($(".accordion h2").size()==1){
		$("#col1").removeClass("accordion");
	}
		
	//$(".accordion h2").eq(0).addClass("active");
	//$(".accordion div").eq(0).show();
				
/*
	$(".accordion h2").click(function(){
	  $(this).next("div").slideToggle("normal").siblings("div:visible").slideToggle("normal");
	  $(this).toggleClass("active").siblings("h2.active").removeClass("active");
	  $('html, body').animate({scrollTop:0}, 'normal');
	});
*/
	
	$(".accordion h2").not(".active").click(function(){
		$(this).next("div").slideDown("normal").siblings("div:visible").slideUp("normal");
		$(this).addClass("active").siblings("h2.active").removeClass("active");
	});
	
	
	
	
	// Sidebar cascading lists
	
    $("ul.sidebar-menu > li > ul").each(function(i) {
    	$(this).addClass("submenu");
        var parent_li = $(this).parent('li');
        parent_li.addClass("folder");
        parent_li.children("a").attr("href","javascript:;");
    });
            	
    $("ul.sidebar-menu > li > ul").each(function(i) {
	    $("ul.sidebar-menu > li > ul > li > a").each(function(j) {
    		$(this).attr('name', j);
	    });
    });
    
    
                	
	$("li.folder > a").click(function(){
		var selected_folder = $(this).parent('li');
		var selected_menu = $(this).parent('li').children("ul.submenu");
		selected_menu.slideToggle();
		$("ul.submenu:visible").not(selected_menu).slideToggle();
		selected_folder.toggleClass("open");
		$("li.open").not(selected_folder).toggleClass("open");
		
	});
	

	// Clear/replace default field text


    $(".defaultText").focus(function(srcc){
        if ($(this).val() == $(this)[0].title){
            $(this).removeClass("defaultTextActive");
            $(this).val("");
        }
    });
    
    $(".defaultText").blur(function(){
        if ($(this).val() == ""){
            $(this).addClass("defaultTextActive");
            $(this).val($(this)[0].title);
        }
    });
    
    $(".defaultText").blur();        

	
	// Fancybox effects

				
	$("#open-warning").fancybox({
		'overlayColor'		: '#111111',
		'overlayOpacity'	: .9,
		'titleShow'			: false,
		'modal'				: true,
		'padding'			: 0,
		'autoDimensions'	: true
	});
	
	$('a.shopp-zoom').attr('rel', 'gallery-group');

	$("a[rel=gallery-group]").fancybox({
		'overlayColor'		: '#111111',
		'overlayOpacity'	: .9,
		'titleShow'			: true,
		'modal'				: false,
		'padding'			: 0,
		'autoDimensions'	: true,
		'type'              : 'image',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-shopp">Photo ' +  (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
		}
	});
	
	$("#close-warning").click(function(){
		$.fancybox.close();
		$.cookie('enter_site', 1, { expires: 0, path: '/' });
	});	
	
	// Format nav links

	$("div.navigation p:empty").hide();

	$("div.variations-menu select option:eq(0)").remove();

	// Wishlist
	
/*
	$("#shopp .thumbnail").hover(function(){
		$(this).children("div.wishlist-add").toggle();
	});
*/
	
	$("#shopp .thumbnail").hover(
	  function () {
	    $(this).children("div.wishlist-add").show();
	  }, 
	  function () {
	    $(this).children("div.wishlist-add").hide();
	  }
	);
		
	$(".wishlist-remove").click(function(){
		$(this).parents("li.product").slideUp("slow");
	});
	
	$(".wishlist-delete").click(function(){
		$("li.product").slideUp("slow");
	});
	
	
});

$(window).unload(function() {
  $("div.wishlist-add").hide();
});

