//equal heights function - matches heights of a group of elements to the largest 
function equalHeight(group) {
    tallest = 0;
    group.each(function() {
        thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
}

function PopWindow (url,w,h,scroll,resize,center,max,args) {
	if (center) { var winPos = ',top='+((screen.height - h) / 2)+',left='+((screen.width - w) / 2); }
	var scrollArg = (scroll == false) ? '' : ',scrollbars=1';
	var resizeArg = (resize == false) ? '' : ',resizable=1';
	flyout = window.open (url,"newin"+scroll+resize+center,"width=" + w + ",height=" + h + scrollArg + resizeArg + winPos + args);
	if (max == true) {
		flyout.moveTo(0,0);
		flyout.resizeTo(screen.availWidth,screen.availHeight);	}
	else { 
		flyout.resizeTo(w,h); 	}
	flyout.focus();	
}

$(document).ready(function() {

    $('img.caption').jcaption();

    /**************************************
    set equalHeights on content and sidebar
    ***************************************/
    // set equal heights on sidebar and content
    //equalHeight($('#sidebar, #content'));

    /***************
    set last classes
    ****************/
    //$('#news .row:last').addClass('last');
    
    /************
    lavalamp nav
    *************/
	//$("#primary-nav ul").addClass('lavaLampWithImage');
    //$("#primary-nav ul li a.current").parent('li').addClass('current');
    //$("#primary-nav ul").lavaLamp({
    //    speed: 350,
    //    click: function(event, menuItem) {
    //        //return false;
    //    }
    //});

    /**************
    input help text
    ***************/
    // set value to title text
    $('form .hashelptext').each(function(){
        // set original value to title
        $(this).val($(this).attr('title'));

        // set value to null on focus
        $(this).focus(function(){
            $(this).val('');
        });

        // reset help text to title if no user input
         $(this).blur(function(){
            if ( $(this).val() == '' )
                $(this).val($(this).attr('title'));
        });
    });

});
