/*rollover images*/
$(function() {
  var image_cache = new Object();
  $('.swap').each(function(i) {
    var imgsrc = this.src;
    var dot = this.src.lastIndexOf('.');
    var imgsrc_on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
    image_cache[this.src] = new Image();
    image_cache[this.src].src = imgsrc_on;
    $(this).hover(
      function() { this.src = imgsrc_on; },
      function() { this.src = imgsrc; });
  });
});

/* fade images*/
$(function(){
	$('.fade').hover(
		function() { $(this).stop().fadeTo(240, 0.8);},
		function() { $(this).stop().fadeTo(240, 0.9,function() { $(this).fadeTo(360, 1.0); });}
	);
	$('a .fade0').hover(
		function() { $(this).stop().fadeTo(240, 0);},
		function() { $(this).stop().fadeTo(360, 1);}
	);
});


/*color box*/
$(document).ready(function(){
			//Examples of how to assign the ColorBox event to elements
			$("a[rel='guide']").colorbox();
			$("a[rel='othercut']").colorbox();
			$("a[rel='colorimage']").colorbox();
			$("a[rel='sizeguide']").colorbox();
});



/*category bg*/
$(function(){
	var categorySize = $("#container #leftcolumn .leftcolumn-sub #categoryarea #categorytree .level1").size();
	var bgimg =  "url('/user_data/packages/roji/img/leftmenu/category_bg" + categorySize + ".jpg')"		
	$("#leftcolumn #categoryarea").css("background-image",bgimg);	
});

