	$(document).ready(function () {
		var fliplist = 0; //For magic homepage below, just to make it easier.
		var paused = false;
		var itemheight = 38;
		
		
		/* For more better lightboxing */
		$('a img').parent().lightbox();
		
		/* For more better in-page links */
		$('a[href*=#]').click(function() {
    		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		    && location.hostname == this.hostname) {
		      var $target = $(this.hash);
		      $target = $target.length && $target
		      || $('[name=' + this.hash.slice(1) +']');
		      if ($target.length) {
        		var targetOffset = $target.offset().top;
		        $('html,body')
        		.animate({scrollTop: targetOffset}, targetOffset, "swing");
		       return false;
		      }
		    }
		 });
		
		$('.homepage h1').click(function() {
			
			//paused = paused ? false : true;
			
		});
		
		/* For magic homepage action */
		var start_position = 184;
		var first = true;
		//alert(start_position);

		setInterval(function() {
			if(first) {
				//$('#designfor').css('display','block');
				$('#designfor').fadeIn();
				first = false;
			} else {
				if(!paused) {
					if(fliplist < $('#designfor').children().size()-1) {
						$('#designfor').animate({
							top: $("#designfor").offset().top-itemheight,
							height: $("#designfor").height()+itemheight
						}, 800, "swing");
						fliplist++;
					} else {
						$('#designfor').animate({
							top: start_position,
							height: $("#designfor").height()-(itemheight*fliplist)
						}, 1200, "swing");
		
						fliplist = 0;
					}
				}
			}
		},2500);
	});