// portfolio images hover

var $j = jQuery.noConflict();
var maxNr = 100;
$j(document).ready(function() {
							
$j('.box ul').each(function(i, el) {
	$j(el).find('li:last').addClass("no-border");
});

$j('.page_holder_no_height').each(function(i, el) {
	$j(el).find('div.post_entry_wide:last').addClass("no-border");
	$j(el).find('div.blog_wide_holder:last').addClass("no-border");
});

$j('.featured_posts_blog').each(function(i, el) {
	$j(el).find('div.blog_wide_holder:last').addClass("no-border");
});

$j('.items .box img').each(function() {
            $j(this).hover(function() {
               $j(this).stop().animate({ opacity: 0.7 }, 500);
            },
           function() {
              $j(this).stop().animate({ opacity: 1.0 }, 500);
           });
});

$j('.content_widgets').each(function(i, el) {
	$j(el).find('div.box:eq(2)').addClass("no_margin");
});

$j('.footer').each(function(i, el) {
	for(var j = 0; j <= maxNr; j++)
	{
		if((j + 1) % 4 == 0)
		{		
			$j(el).find('div.box:eq('+j+')').addClass("no_margin");
		}
	}
});

$j('.widget_flickr').each(function(i, el) {
	for(var j = 0; j <= maxNr; j++)
	{
		if((j + 1) % 3 == 0)
		{		
			$j(el).find('li:eq('+j+')').addClass("no_margin");
		}

	}
});

$j('.items').each(function(i, el) {
	for(var j = 0; j <= maxNr; j++)
	{
		if((j + 1) % 4 == 0)
		{		
			$j(el).find('div.box:eq('+j+')').addClass("no_margin");
		}
	}
});

$j("div.portfolio_box_holder img.portfolio_overlay").hide();
	$j("div.portfolio_box_holder").hover(function() {
		$j(this).find('img').fadeIn(500);
	}, function() {
		$j(this).find('img.portfolio_overlay').fadeOut(500);
	});

$j('.page_holder').each(function(i, el) {
	for(var j = 0; j <= maxNr; j++)
	{
		if((j + 1) % 3 == 0)
		{		
			$j(el).find('.portfolio_box:eq('+j+')').addClass("no_margin");
			$j(el).find('.portfolio_div_container:eq('+j+')').addClass("no_margin");
		}

	}
	
	$j(el).find('.social li:eq(3)').addClass("no_margin");
	$j(el).find('.social li:eq(7)').addClass("no_margin");
	
	
});
for(var j = 0; j <= maxNr; j++)
{
	if((j + 1) % 4 == 0)
	{		
		$j("div.footer .box").eq(j).after($j('<div class="clear"></div>'));
	}
}

$j("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});

										
<!--Menu -->
// initialise plugins
$j(document).ready(function() { 
$j('ul.menu').supersubs({ 
         	minWidth:    12,   // minimum width of sub-menus in em units 
            maxWidth:    27,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
        }).superfish();  // call supersubs first, then superfish, so that subs are 
                         // not display:none when measuring. Call before initialising 
                         // containing tabs for same reason.  
}); 
			
});

function setEqualHeight(columns)
{
 var tallestcolumn = 0;
 columns.each(
 function()
 {
 currentHeight = $j(this).height();
 if(currentHeight > tallestcolumn)
{
tallestcolumn = currentHeight;
}
}
);
columns.height(tallestcolumn);
}


$j(document).ready(function() {
 setEqualHeight($j(".page_holder > div"));

});

$j(function() {

    function scroll(direction) {

        var scroll, i,
                positions = [],
                here = $j(window).scrollTop(),
                collection = $j('.mover');

        collection.each(function() {
            positions.push(parseInt($j(this).offset()['top'],10));
        });

        for(i = 0; i < positions.length; i++) {
            if (direction == 'next' && positions[i] > here) { scroll = collection.get(i); break; }
            if (direction == 'prev' && i > 0 && positions[i] >= here) { scroll = collection.get(i-1); break; }
        }

        if (scroll) {
            $j.scrollTo(scroll, {
                duration: 750
            });
        }

        return false;
    }

    $j("#next,#prev").click(function() {
        return scroll($j(this).attr('id'));
    });

    $j(".go_top").click(function() {
        $j.scrollTo($j($j(this).attr("href")), {
            duration: 750
        });
        return false;
    });

});




// Cufon font
Cufon.replace('h1', {hover: true});
Cufon.replace('h2', {hover: true});
Cufon.replace('h3', {hover: true});
Cufon.replace('h4', {hover: true});
Cufon.replace('h5', {hover: true});
Cufon.replace('h6', {hover: true});

//Cufon.replace('a.main-menu', {hover: true});