// JavaScript Document

//jQuery.noConflict();

jQuery(document).ready(function()  {
	
	
	$('#container').minitabslc();
	$('#container').minitabsrc();
	
	
	
	// do something here

var lastId;

	//$("button").click(function () {
	$(".button").click(function () {
	 	
		var menuId = $(this).attr("id");
	
		if ($("#menuContent").is(":hidden")) {
			  
			  $("#menuContent").slideDown("slow");
			  
			  if ((menuId) == 'homeIdeasShow') {
				$("#homeIdeasContent").show();
				$("#productMaterialsContent").hide();
				$("#blogsContent").hide();
				$("#homeIdeasShow>img").attr('src', '/app_themes/studioM/menu/button-up.gif');
			  } else if ((menuId) == 'productMaterialsShow') {
				$("#homeIdeasContent").hide();
				$("#productMaterialsContent").show();
				$("#blogsContent").hide();
				$("#productMaterialsShow>img").attr('src', '/app_themes/studioM/menu/button-up.gif');
			  } else if ((menuId) == 'blogsShow') {
				$("#homeIdeasContent").hide();
				$("#productMaterialsContent").hide();
				$("#blogsContent").show();
				$("#blogsShow>img").attr('src', '/app_themes/studioM/menu/button-up.gif');
			  } else {
				$("#homeIdeasContent").show();
				$("#productMaterialsContent").hide();
				$("#blogsContent").hide();
				$("#homeIdeasShow>img").attr('src', '/app_themes/studioM/menu/button-up.gif');
				$("#productMaterialsShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
				$("#blogsShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
			  }
			  
			  lastId=menuId;
			  
			  
		} else {
			
			if ((menuId) == (lastId)) {
			
				$("#menuContent").slideUp("slow");
				
				if ((menuId) == 'homeIdeasShow') {
					$("#homeIdeasShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
				} else if ((menuId) == 'productMaterialsShow') {
					$("#productMaterialsShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
				} else if ((menuId) == 'blogsShow') {
					$("#blogsShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
				} else {
					$("#homeIdeasShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
					$("#productMaterialsShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
					$("#blogsShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
				}
					
				lastId=menuId;
				
			} else {

				if ((menuId) == 'homeIdeasShow') {
			  	$("#homeIdeasContent").show();
				$("#productMaterialsContent").hide();
				$("#blogsContent").hide();
				$("#homeIdeasShow>img").attr('src', '/app_themes/studioM/menu/button-up.gif');
				$("#productMaterialsShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
				$("#blogsShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
			  } else if ((menuId) == 'productMaterialsShow') {
			  	$("#homeIdeasContent").hide();
				$("#productMaterialsContent").show();
				$("#blogsContent").hide();
				$("#homeIdeasShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
				$("#productMaterialsShow>img").attr('src', '/app_themes/studioM/menu/button-up.gif');
				$("#blogsShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
			} else if ((menuId) == 'blogsShow') {
			$("#homeIdeasContent").hide();
				$("#productMaterialsContent").hide();
				$("#blogsContent").show();
			$("#homeIdeasShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
				$("#productMaterialsShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
				$("#blogsShow>img").attr('src', '/app_themes/studioM/menu/button-up.gif');
			  } else {
			  	$("#homeIdeasContent").show();
				$("#productMaterialsContent").hide();
				$("#blogsContent").hide();
				$("#homeIdeasShow>img").attr('src', '/app_themes/studioM/menu/button-up.gif');
				$("#productMaterialsShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
				$("#blogsShow>img").attr('src', '/app_themes/studioM/menu/button-down.gif');
			  }
			  
			  lastId=menuId;
					
					
			}
		}

	});
	
});

jQuery.fn.minitabslc = function(speed,effect) {
  lid = "#lc-tabs";
  $(".lc-tab-box-inner>DIV:gt(0)").hide();
  $(lid + ">UL>LI:first").addClass("current");
  $(lid + ">UL>LI>A").click(
    function(){
      $(lid + ">UL>LI").removeClass("current");
	  $(this).parent().addClass("current"); 
      $(this).blur();
      var re = /([_\-\w]+$)/i;
      var target = $('#' + re.exec(this.href)[1]);
      //var old = $(id + ">DIV");
	  var old = $(".lc-tab-box-inner>DIV");
      switch (effect) {
        case 'fade':
          old.fadeOut(speed).fadeOut(speed);
          target.fadeIn(speed);
          break;
        case 'slide':
          old.slideUp(speed);  
          target.fadeOut(speed).fadeIn(speed);
          break;
        default : 
          old.hide(speed);
          target.show(speed)
      }
      return false;
    }
 );
}

jQuery.fn.minitabsrc = function(speed,effect) {
  id = "#rc-tabs";
  $(".rc-tab-box-inner>DIV:gt(0)").hide();
  $(id + ">UL>LI:first").addClass("current");
  $(id + ">UL>LI>A").click(
    function(){
      $(id + ">UL>LI").removeClass("current");
	  $(this).parent().addClass("current"); 
      $(this).blur();
      var re = /([_\-\w]+$)/i;
      var target = $('#' + re.exec(this.href)[1]);
      //var old = $(id + ">DIV");
	  var old = $(".rc-tab-box-inner>DIV");
      switch (effect) {
        case 'fade':
          old.fadeOut(speed).fadeOut(speed);
          target.fadeIn(speed);
          break;
        case 'slide':
          old.slideUp(speed);  
          target.fadeOut(speed).fadeIn(speed);
          break;
        default : 
          old.hide(speed);
          target.show(speed)
      }
      return false;
    }
 );
}

// Background Image Cache for IE6 - stops the flicker
try {   
 document.execCommand("BackgroundImageCache", false, true);   
} catch(err) {} 
