$(document).ready(function() {
	$(".subcategory").hide();
  $(".subcategory[rel='block']").show();

  //$(".colorbox_image").colorbox();
  
	$(".cat_name").click (
		function() {
			var checkElement = $(this).next();  
     
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				checkElement.slideUp('normal');
				return false;
			}
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
				checkElement.slideDown('normal');
				return false;
			}
	});

	$('.popup_enquiry').colorbox({width: "560px", height: "610px", inline: true, href: '#form-container'});

	$("li#faq div").hide();
	$("li#faq h4").addClass("bg_plus");
	$("li#faq h4").click(
		function() {
			$("li#faq div").slideUp("fast");
			$("li#faq h4").addClass("bg_plus");
			$("li#faq h4").removeClass("bg_minus");
			$("li#faq h4").css("text-decoration","none");
			$("li#faq").removeClass("faq_active");
		  $(this).next("div").slideDown("fast");		  
		  $(this).next("div").prev("h4").addClass("bg_minus");
		  $(this).next("div").prev("h4").removeClass("bg_plus");		  		  
		  $(this).next("div").prev("h4").css("text-decoration","underline");
		  $(this).parent("li").addClass("faq_active");
		}
	);
	
	
	$("li.faq2 div").hide();
	$("li.faq2 h4").addClass("bg_plus");
	$("li.faq2 h4").click(
		function() {
			$("li.faq2 div").slideUp("fast");
			$("li.faq2 h4").addClass("bg_plus");
			$("li.faq2 h4").removeClass("bg_minus");
			$("li.faq2 h4").css("text-decoration","none");
			$("li.faq2").removeClass("faq_active");
		  $(this).next("div").slideDown("fast");		  
		  $(this).next("div").prev("h4").addClass("bg_minus");
		  $(this).next("div").prev("h4").removeClass("bg_plus");		  		  
		  $(this).next("div").prev("h4").css("text-decoration","underline");
		  $(this).parent("li").addClass("faq_active");
		}
	);

	//home page bottom section logos
	function tooltip(){
		/* CONFIG */
		xOffset = 10;
		yOffset = 20;
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		/* END CONFIG */
		$("a.tooltip").hover(function(e){
			$(this).t = $(this).title;
			$(this).title = "";
			$("body").append("<p id='tooltip'>"+ $(this).t +"</p>");
			$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");
		},
		function(){
			$(this).title = $(this).t;
			$("#tooltip").remove();
		});
		$("a.tooltip").mousemove(function(e){
			$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
		});
	};
	tooltip();

	$("#carousel2").CloudCarousel({
		xPos: 410,
		yPos: 7,
		yRadius: -0.5,
		xRadius: 300,
		FPS: 70,
		autoRotate: 'left',
		autoRotateDelay: 3000,
		speed: 0.1,
		minScale: 0.1,
		buttonLeft: $('#but2'),
    buttonRight: $('#but1'),
    bringToFront: true
	}); 

});

