var preverr = '';
$(document).ready(function(){
	  	  
	  /*
	  $('#notification').delay(2000).fadeIn("fast").animate({
		height: '60px',
		top: '10px'
	  }, 500, function() {
		$('#notification p').fadeIn("fast");
		$('#notification a').fadeIn("fast");
	  });
	  */
	        
      $('a#close').click(function() {
	  		$('#notification').fadeOut("fast");
	  })
	  
	  $('a.tooltip').tipsy({fade: true, gravity: 'n'});
	  					   
	  /* Peekmenu */				   
						   
	  $("ul#cloudbox").hover(function(){
	  		$(".hboxcon").css("display","none");
		  	$("ul.subcloud li").fadeIn("fast");
	  },
	  function(){
	  		$("ul.subcloud li").css("display","none");
			$(".hboxcon").fadeIn("fast");
	  })
	  
	   /* Footernav */
	  
	  $(".flpsub").hover(function(){
		  $("." + this.id).fadeIn("fast");
		  $("#" + this.id + " a#" + this.id +"a").css({'color' : '#eee'});
		  $(".foopanels").fadeTo("fast", 0.02);
	  },
	  function(){
		  $("." + this.id).fadeOut("fast");
		  $("#" + this.id + " a#" + this.id +"a").css({'color' : '#999'});
	  	  $(".foopanels").fadeTo("fast", 1);
	  })
	  
	  /* Portfolio */
		$("div.wcategories a").click(function(){
	  		$("div.wcategories a").removeClass("selected");
	  		$(this).addClass("selected");
	  		shiftcat = this.id;
		  	setScrollBar(shiftcat);
	  })
	  
	  $("ul#horiz_container li").hover(function(){
	  	$(this).children('.portfoliosummary').animate({bottom: "0px"}, 200 );
	  },
	  function(){
	  	$(this).children('.portfoliosummary').animate({bottom: "-150px"}, 200 );
	  });
	  	  
	  /* Page */
	  $("a.servicesoffered").fancybox();
	  
	  /* Page Datepicker
	  $("#datepicker").datepicker();*/
	  
	  /* Carousel */
	  $(function() {
		  $("#fpcon").jCarouselLite({
			  btnNext: "#scrr",
			  btnPrev: "#scrl",
			  visible: 5,
			  scroll: 5,
			  speed: 800,
		  });
	  });
	  	
	  	/* Horizontal Scrollbar */
	  	$("ul#horiz_container li img").lazyload({ 
		    effect : "fadeIn"
		});
	  	
	  	function getUrlVars()
		{
		var vars = [], hash;
		var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
		for(var i = 0; i < hashes.length; i++)
		{
		hash = hashes[i].split('=');
		vars.push(hash[0]);
		vars[hash[0]] = hash[1];
		}
		return vars;
		}
		var curcat = getUrlVars()["cat"];
		setScrollBar(curcat);

		function setScrollBar(curcat)
		{
			if (curcat == null || curcat == "catall")
		  	{
		  		var totalImageWidth = 0;
			  	$("ul#horiz_container li").each(function () {
		           	totalImageWidth += $(this).outerWidth(true);
					$("#horiz_container").width(totalImageWidth);
					$('#horiz_container_outer').horizontalScroll();
				});
				$("ul#horiz_container li").fadeIn("fast");
			}
			else
			{
				var totalImageWidth = 0;
				$(".wcategories a").removeClass('selected');
				$('#' + curcat).addClass('selected');
				$("ul#horiz_container li").css("display","none");
			  	$("ul#horiz_container li." + curcat).each(function () {
			           	totalImageWidth += $(this).outerWidth(true);
						$("#horiz_container").width(totalImageWidth);
						$('#horiz_container_outer').horizontalScroll();
					});
				$("ul#horiz_container li." + curcat).fadeIn("fast");
			}
		}
  });
