jQuery(document).ready(function() {
    var hash = window.location.hash;
    
    (!hash) ?  
        hideAllExcept('#' + jQuery('#toggleThis > div:first').attr('id')) 
            : hideAllExcept(window.location.hash);

    jQuery('a.toggle').click(function() {
        var href = jQuery(this).attr('href');
        hideAllExcept(href);
        return false; // prevents the window from scrolling to the anchor
    });
	
	
// ######################## animated show/hide
// modified 10/09 by nw to address class rather than IDs

//close all the content divs on page load
jQuery('.mover').hide();

// toggle slide
jQuery('.slideToggle').click(function(){
// by calling sibling, we can use same div for all demos
jQuery(this).siblings('.mover').slideToggle();
});

// regular toggle with speed of 'slow'
jQuery('.slowToggle').click(function(){
jQuery(this).siblings('.mover').toggle('slow');
});

// fade in and out
jQuery('.fadeToggle').toggle(function() {
jQuery(this).siblings('.mover').fadeIn('slow');
}, function() {
jQuery(this).siblings('.mover').fadeOut('slow');
});

//animate
jQuery('.aniToggle').click(function() {
jQuery(this).siblings('.mover')
.slideDown(5500).fadeOut(7300);
});

// ########################

jQuery('.marginExpose').click(function() {

	jQuery(this).siblings('.marginImg').toggleClass('offScreen');
	jQuery(this).siblings('.marginImg').toggleClass('showMarg');
	jQuery(this).siblings('.showMarg').fadeIn('slow');
	jQuery(this).siblings('.offScreen').fadeOut('slow');
	jQuery(this).toggleClass('readMore');
									   }); 
	
});

function hideAllExcept(el) {
    jQuery(el).removeClass('hide').siblings().addClass('hide');
    
    jQuery('a.toggle').removeClass('active');
    jQuery('a[href="' + el + '"]').addClass('active');
}

/*                                  2009-03-04
    "hide all except one"
    by charles stuart
    requires jQuery (http://jQuery.com/)
    ** requires rev 1465 or above **
    ** http://dev.jQuery.com/ticket/745 **
    
    Keep this url with the script:
    http://enure.net/dev/hide-all-except-one/

    OVERVIEW
    This works like tabs, however you may
    style it however you want of course.
    The markup is not structurally tied 
    together--meaning your 'tabs' and
    their content' don't have to be nested.

    The tabs are bookmarkable, however browser
    back and forward buttons do not work.

    HOWTO
    Create links as such and place them 
    anywhere in your markup:
     <a href="#lorem" class="toggle">lorem</a>
     <a href="#ipsum" class="toggle">ipsum</a>

    Put your 'tab' content in a div:
     <div id="toggleThis">
       <div id="lorem">
         lorem
       </div>
       <div id="ipsum">
         ipsum
       </div>
     </div>

    Clicking a .toggle link will hide all inside
    #toggleThis except the link target. As
    you can see the id and the href must match.

    NO JS
    This works works for users without javascript
    enabled. The browser will scroll to the
    target.

    TODO
    This could be abstracted further by
    not requiring the hideable elements to be
    siblings in a parent.

    CHANGES
    [FIXED 2009-03-04] Added "return false" to 
    stop browser from scrolling after clicking 
    "a.toggle".

*/

// ############## swapInner

function swapInner(vThis, str1, str2)
{
 if(vThis.innerHTML == str1){
 vThis.innerHTML = str2;
 }
 else if (vThis.innerHTML == str2){
 vThis.innerHTML = str1;
}
}

// ########################
function showHideMore(vThis)
{
// http://www.javascriptjunkie.com
// alert("Hello From www.javascriptjunkie.com" + vThis.tagName);
	if(vThis.innerHTML == 'MORE'){
	vThis.innerHTML = 'LESS';
	}
	else if (vThis.innerHTML == 'LESS'){
	vThis.innerHTML = 'MORE';
	}
	else if (vThis.innerHTML == 'More Info'){
	vThis.innerHTML = 'Less';
	}
		else if (vThis.innerHTML == 'Less'){
	vThis.innerHTML = 'More Info';
	}
	vParent = vThis.parentNode;
	vSibling = vParent.nextSibling;
	while (vSibling.nodeType==3) {   // Fix for Mozilla/FireFox Empty Space becomes a TextNode or Something
    	vSibling = vSibling.nextSibling;
  	};

	if(vSibling.style.display == "none")
	{
		vSibling.style.display = "block";
	} else {
		vSibling.style.display = "none";
	}
return;
}


// ########################


// JavaScript Document
