function initTabs() {
	jQuery('.tabset').each(function(){
		var _list = jQuery(this);
		var _links = _list.find('a.tab');

		_links.each(function() {
			var _link = jQuery(this);
			jQuery(this).attr('href',jQuery(this).attr('href').substr(jQuery(this).attr('href').indexOf("#")));
            var _href = _link.attr('href');
			var _tab = jQuery(_href);

			if(_link.hasClass('active')) _tab.show();
			else _tab.hide();

			_link.click(function(){
				_links.filter('.active').each(function(){
					jQuery(jQuery(this).removeClass('active').attr('href')).hide();
				});
				_link.addClass('active');
				_tab.show();
				return false;
			});
		});
	});
	
	// Get the value of the anchor ref
    var anchor = window.location.hash.substr(1);
    if(anchor.length){
        if(anchor == 'tab1' || anchor == 'tab2' || anchor == 'tab3'){
            jQuery('a.tab[href$="#'+anchor+'"]').click();
        } else {
            var parentTab = jQuery('div.post[id="'+anchor+'"]').parents('div.tab');
            jQuery('a.tab[href$="#'+parentTab.attr('id')+'"]').click();
            window.location.hash = window.location.hash;
        }
    }
}


jQuery(document).ready(function(){
    // Set up the tabs
    initTabs();
    
    
    
});


hover = function() {
	var nav = document.getElementById("gallery");
	if(nav){
		var nodes = nav.getElementsByTagName("div")
		for (var i=0; i<nodes.length; i++) {
			nodes[i].onmouseover=function() {
				this.className+=" hover";
			}
			nodes[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" hover"), "");
			}
		}
	}
	var _el = document.getElementsByTagName('tr')
	for (var i=0; i<_el.length; i++) {
		_el[i].onmouseover=function() {
			this.className+=" hover";
		}
		_el[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" hover"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", hover);