$(document).ready(function() {

	JQLightboxGrouper ();

});

function putMeThere3(obj){
	var source = $(obj).attr('src');
	if ($(obj).attr('src') !== $('#gallery_pic').attr('src'))
	{
		$('#gallery_div').mouseover(function (){
			$(this).attr('href',source);
		});
		$('#gallery_pic').fadeOut(100, function (){
			$(this).attr('src',source);
			$(this).load(function(){
				$(this).fadeIn(100);
			});
		});
	}
}

function meret (){

	var windowHeight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
	var menuHeight = $('#menu_bg').height();
	var bannerHeight = $('#banner').height();
	var maintopHeight = $('.main_top').height();
	var mainbottomHeight = $('.main_bottom').height();
	var footerHeight = $('#footer_bg').height();
	
	var contentHeight = windowHeight-menuHeight-bannerHeight-maintopHeight-mainbottomHeight-footerHeight;
	
	var actHeight = $('.main_mid').height();

	if(actHeight < contentHeight){
		$('.main_mid').css('height',contentHeight+'px');
	}
}

function JQLightboxGrouper () {
	$(function() {
        var boxen = [];
        //find all links w/ rel="lightbox[gallery_name]" or just rel="lightbox" it works both ways
        $('a[rel*=lightbox]').each(function() {
        //push only unique lightbox[gallery_name] into boxen array
        if ($.inArray($(this).attr('rel'),boxen)) boxen.push($(this).attr('rel'));
    });
    //for each unique lightbox group, apply the lightBox
    $(boxen).each(function(i,val) { $('a[rel='+val+']').lightBox(); });
    });
}
