
$(document).ready(function(){
	
	$(function(){
		$("#grid-content").vgrid({
			easeing: "easeOutQuint",
			useLoadImageEvent: true,
			useFontSizeListener: true,
			time: 400,
			delay: 20,
			fadeIn: {
				time: 500,
				delay: 50
			}
		});
		
	});
	
	var hsort_flg = false;
	var FLG = true;//worksortbtnFLAG
	
	$("#hsort").click(function(e){
		hsort_flg = true;
		
		if(FLG == true){//ifstart
		$(".menublock").find('h4').text("z");
		FLG = false;
		$("#grid-content").vgsort(function(a, b){
			var _a = $(a).find('h4').text();
			var _b = $(b).find('h4').text();
			var _c = hsort_flg ? 1 : -1 ;
			
			if(_a == "y" || _b == "y"){
				//$(a).css("border-color","#c06");
			}
			else if(_a == "z" || _b == "z"){
				
				$("#hsort").css("color","#c06");
				
				
			}
			else{
				$(a).css("display","none");
				$(b).css("display","none");
			}
			return (_a > _b) ? _c * -1 : _c ;
		
		}, "easeInOutExpo", 300, 0);
		}//ifend
		
		return false;
	});
	
	
	
	$("#asort").click(function(e){
							   
		if(FLG == false){//ifstart
		
		$(".client").css("display","block");
		$(".recentry").css("display","block");
		$("#hsort").css("color","#000");
		$(".menublock").find('h4').text("a");
		FLG = true;
			
		$("#grid-content").vgsort(function(a, b){
			var _a = $(b).find('h4').text();
			var _b = $(a).find('h4').text();
			var _c = hsort_flg ? 1 : -1 ;
			
			if(_a == "y" || _b == "y"){
				//$(a).css("border-color","#c06");
			}
			
			return (_a > _b) ? _c * -1 : _c ;
		
		}, "easeInOutExpo", 300, 0);
		}//ifend
		
		return false;
	});
	
	
	
});



var FLG = true;





$(document).ready(
  function(){
    $("a img").hover(
	   function(){
       		$(this).fadeTo(1,.6,function(){$(this).fadeTo("normal", 1.0);});
	   },
	   function(){});
	    $(function() {
        $('.lbs01 a').lightBox();
		$('.lbs02 a').lightBox();
		$('.lbs03 a').lightBox();
		$('.lbs04 a').lightBox();
		$('.lbs05 a').lightBox();
		$('.lbs06 a').lightBox();
		$('.lbs07 a').lightBox();
		$('.lbs08 a').lightBox();
		$('.lbs09 a').lightBox();
		$('.lbs10 a').lightBox();
		$('.lbs11 a').lightBox();
		$('.lbs12 a').lightBox();
		$('.lbs13 a').lightBox();
		$('.lbs14 a').lightBox();
		$('.lbs15 a').lightBox();
		$('.lbs16 a').lightBox();
		$('.lbs17 a').lightBox();
		$('.lbs18 a').lightBox();
		$('.lbs19 a').lightBox();
		$('.lbs20 a').lightBox();
		$('.lbs21 a').lightBox();
		$('.lbs22 a').lightBox();
		$('.lbs23 a').lightBox();
		$('.lbs24 a').lightBox();
		$('.lbs25 a').lightBox();
		$('.lbs26 a').lightBox();
		$('.lbs27 a').lightBox();
		$('.lbs28 a').lightBox();
		$('.lbs29 a').lightBox();
		$('.lbs30 a').lightBox();
		$('.lbs31 a').lightBox();
		$('.lbs32 a').lightBox();
		$('.lbs33 a').lightBox();
		$('.lbs34 a').lightBox();
		$('.lbs35 a').lightBox();
    });

	   
});





//slideshow scripts
function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
setInterval( "slideSwitch()", 5000 );
});

//slideshow scripts end	

	




