/**
 * Common Javascript Methods
 *
 * @author 		Zone
 * @email		info@zonecontent.com
 * @url 		http://www.zonecontent.com/
 * @copyright           Copyright (c) 2010, zonecontent.com. All rights reserved.
 * @version		0.0.1
 */

// Stop selected links in main nav from loading something on click

$('#header div.container div.nav ul li.selected a').bind('click', navSelectedClickHandler);

function navSelectedClickHandler() {
    return false;
}


// Temporarily give selected class to clicked nav items (and take it away from all others)

$('#header div.container div.nav ul li a').bind('click', navClickHandler);

function navClickHandler() {
    $(this).parent().siblings().removeClass('selected');
    $(this).parent().addClass('selected');
    Cufon.refresh();
    // return false;
}


/*
 Set left and right columns height to *at least* that of the main content area
 We calculate this minimum value by getting the pixel height of main container div,
 and subtracting the total of height of spacing and heading image. Note: this may change depending on content!
*/

var offsetHeight = ( $('#main div.container img.header').outerHeight(true) + ($('#main div.container div.sidebar-left').outerHeight(true) - $('#main div.container div.sidebar-left').innerHeight()) );
var containerHeight = $('#main div.container').outerHeight(true);
var minHeight = containerHeight - offsetHeight; // Probably need to compute this from certain things
//var minHeight = $('#main div.container div.content').height();
var leftHeight = $('#main div.container div.sidebar-left').height();
var rightHeight = $('#main div.container div.sidebar-right').height();

if (leftHeight < minHeight){ $('#main div.container div.sidebar-left').height(minHeight); }
if (rightHeight < minHeight) { $('#main div.container div.sidebar-right').height(minHeight); }

//console.log($('#main div.container div.content').height());
// console.log('conheight = ' + containerHeight);
// console.log('offheight = ' + offsetHeight);
// console.log('minheight = ' + minHeight);
// console.log('lefheight = ' + leftHeight);
// console.log('righeight = ' + rightHeight);

