$(document).ready(function() {

//Script for bannerNav settings
$("#bannerNav h1").css({'display':'none'});
$("#menuPrograms ul.programsNav li:eq(1)").css({'marginTop':'-20px'});

//Script to determine height of colC based on colB
var colBHeight = $('#container #subMain #left #colB').height();
var colCHeight = $('#container #subMain #colC').height();
var containerHeight = $('#container').height();
var tableHeight = $('#resourceTable').height();

//Check for Safari Browser
if($.browser.safari){
 if ( colCHeight > colBHeight ) {
 colBHeight = 635;
 $('#container #subMain #colC').height(colBHeight);
}

if ( colBHeight > colCHeight ) {
 $('#container #subMain #colC').height(colBHeight+25);
}
}

//Set heights for other browsers
if ( colCHeight > colBHeight ) {
 $('#container #subMain #left').height(colCHeight-10);
}

if ( colBHeight > colCHeight ) {
 $('#container #subMain #colC').height(colBHeight+25);
}

//Menu Selection Script - appends href based on filename
$("a").live({click: function() {
var aLink = $(this).attr("href");

if( aLink.indexOf( "membership" ) !== -1 ) {
$(this).attr("href", aLink + '?menu=1');
}
if( aLink.indexOf( "programs" ) !== -1 ) {
$(this).attr("href", aLink + '?menu=2');
}
if( aLink.indexOf( "community" ) !== -1 ) {
$(this).attr("href", aLink + '?menu=3');
}
if( aLink.indexOf( "get-involved" ) !== -1 ) {
$(this).attr("href", aLink + '?menu=5');
}
if( aLink.indexOf( "contact" ) !== -1 ) {
$(this).attr("href", aLink + '?menu=6');
}

//End of click function and live
}
});


//Show Hide Toggle Function
$('span.showHide > table').css({'display':'inline'});
$('span.showHide > table, span.showHide hr').hide();
$('span.showHide > h3').css({'cursor':'pointer','paddingLeft':'50px','background':'url(../images/icon-more.png) no-repeat left 50%'});

$('span.showHide').toggle(function() {
$('table,hr', this).slideDown('slow');
$('h3', this).css({'cursor':'pointer','paddingLeft':'50px','background':'url(../images/icon-close.png) no-repeat left 50%'});
},
function() {
$('table,hr', this).slideUp('slow');
$('h3', this).css({'cursor':'pointer','paddingLeft':'50px','background':'url(../images/icon-more.png) no-repeat left 50%'});
if ( $('p>a',this).attr('href').length != 0 && $('p>a',this).hasClass('hovered') ) {
 window.open( $('p>a.hovered',this).attr('href') );
}
if ( $('li>a',this).attr('href').length != 0 && $('li>a',this).hasClass('hovered') ) {
 window.open( $('li>a.hovered',this).attr('href') );
}
});




//closing tags for document ready function
});

//SwitchDiv Script
var ids=new Array('menuMemberships','menuPrograms','menuCommunity','menuInvolved','menuContact');

function switchId(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
//		$("#" + id).fadeIn();
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

