jQuery(function($) {     
              
    $(document).ready(function(){ 
    	
  
//2 Column
if($(window).width()>740 && $(window).width()<1051){
	$("#info").width(612);
	$("#paper").width(612);}

//3 Column
else if($(window).width()>1052 && $(window).width()<1363){
	$("#info").width(924);
	$("#paper").width(924);}


//4 Column
else if($(window).width()>1364 && $(window).width()<1675){
	$("#info").width(1236);
	$("#paper").width(1236);}

//5 Column
else if($(window).width()>1676 && $(window).width()<1987){
	$("#info").width(1548);
	$("#paper").width(1548);}

//6 Column
else if($(window).width()>1988 && $(window).width()<2299){
	$("#info").width(1860);
	$("#paper").width(1860);}

//7 Column
else if($(window).width()>2300 && $(window).width()<2611){
	$("#info").width(2172);
	$("#paper").width(2172);}

//8 Column
else if($(window).width()>2612 && $(window).width()<2923){
	$("#info").width(2482);
	$("#paper").width(2482);}
 

    	
   		// wrap the img with a div
		// add the #overlay div
   		// fix size of #overlay div

   		$('#post_content.single a').wrap('<div id="wrapper" style="position:relative"></div>');   
   	 	$("#post_content.single a img").before('<div id="overlay"></div>');       		
		$("#post_content.single a img").each(function(){
   			$this = $(this);
    		$(this).siblings().height($this.height()).width($this.width());
		});

		// IMAGE ROLLOVER FUNCTION - INDEX

			// OPACITY OF BUTTON SET TO 0%
			$("#post_content.heroImage #overlay").css("opacity","0");
			$("#post_content.heroImage .index_title").css("opacity","0");

			// FADE IN FADE OUT

			$("#post_content.heroImage .index_title").hover(
			
				function () { // ON MOUSE OVER
					$(this).stop().animate({ opacity: 0 }, 0);
					$(this).siblings().stop().animate({ opacity: 0 }, 0);
				},
 
				function () { // ON MOUSE OUT
					$(this).stop().animate({ opacity: 0 }, 0);
					$(this).siblings().stop().animate({ opacity: 0 }, 0);
				}
			
			);
		

		// IMAGE ROLLOVER FUNCTION - PROJECT

			// OPACITY OF BUTTON SET TO 0%
			$("#post_content.single #overlay").css("opacity","0");

			// FADE IN FADE OUT
			$("#post_content.single #overlay").hover(
			
			function () { // ON MOUSE OVER
			$(this).stop().animate({ opacity: 0.2 }, "fast");},
 
			function () { // ON MOUSE OUT
				$(this).stop().animate({ opacity: 0 }, "slow");
			});


		
		// div wrap the Vimeo embed
   		$('#post_content.single object').wrap('<div id="video" style="position:relative"></div>'); 	
		
		// VGRID
		
$(function(){
	$("#post_content").vgrid({
		easeing: "easeOutQuint",
		time: 400,
		delay: 20,
		fadeIn: {
			time: 500,
			delay: 50
		}
	});
 
	var hsort_flg = false;
	$("#hsort").click(function(e){
		hsort_flg = !hsort_flg;
		$("#post_content").vgsort(function(a, b){
			var _a = $(a).find('img').text();
			var _b = $(b).find('img').text();
			var _c = hsort_flg ? 1 : -1 ;
			return (_a > _b) ? _c * -1 : _c ;
		}, "easeInOutExpo", 300, 0);
		return false;
	});
 
	$("#rsort").click(function(e){
		$("#post_content").vgsort(function(a, b){
			return Math.random() > 0.5 ? 1 : -1 ;
		}, "easeInOutExpo", 300, 20);
		return false;
	});
});
		
		//LINKS
		$('.myLink a').hover(function() {
			$(this).animate({'backgroundColor': '#00f'},1);
			$(this).animate({'color': '#fff'},1);
		},
		function() { //mouseout
			$(this).animate({'backgroundColor': '#000'},200);
			$(this).animate({'color': '#666'},200);
		});


		
    });
    
    //RESIZE ELEMENT IN BROWSER ACCORDING TO WINDOW
 
 
 
 
$(window).resize(function() {
  
//2 Column
if($(window).width()>740 && $(window).width()<1051){
	$("#info").width(612);
	$("#paper").width(612);}

//3 Column
else if($(window).width()>1052 && $(window).width()<1363){
	$("#info").width(924);
	$("#paper").width(924);}


//4 Column
else if($(window).width()>1364 && $(window).width()<1675){
	$("#info").width(1236);
	$("#paper").width(1236);}

//5 Column
else if($(window).width()>1676 && $(window).width()<1987){
	$("#info").width(1548);
	$("#paper").width(1548);}

//6 Column
else if($(window).width()>1988 && $(window).width()<2299){
	$("#info").width(1860);
	$("#paper").width(1860);}

//7 Column
else if($(window).width()>2300 && $(window).width()<2611){
	$("#info").width(2172);
	$("#paper").width(2172);}

//8 Column
else if($(window).width()>2612 && $(window).width()<2923){
	$("#info").width(2482);
	$("#paper").width(2482);} 
});

    
});
